[e3d4e0a] | 1 | <?php
|
---|
| 2 | /*
|
---|
| 3 | * Copyright 2014 Google Inc.
|
---|
| 4 | *
|
---|
| 5 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
---|
| 6 | * use this file except in compliance with the License. You may obtain a copy of
|
---|
| 7 | * the License at
|
---|
| 8 | *
|
---|
| 9 | * http://www.apache.org/licenses/LICENSE-2.0
|
---|
| 10 | *
|
---|
| 11 | * Unless required by applicable law or agreed to in writing, software
|
---|
| 12 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
---|
| 13 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
---|
| 14 | * License for the specific language governing permissions and limitations under
|
---|
| 15 | * the License.
|
---|
| 16 | */
|
---|
| 17 |
|
---|
| 18 | namespace Google\Service\CloudShell\Resource;
|
---|
| 19 |
|
---|
| 20 | use Google\Service\CloudShell\AddPublicKeyRequest;
|
---|
| 21 | use Google\Service\CloudShell\AuthorizeEnvironmentRequest;
|
---|
| 22 | use Google\Service\CloudShell\Environment;
|
---|
| 23 | use Google\Service\CloudShell\Operation;
|
---|
| 24 | use Google\Service\CloudShell\RemovePublicKeyRequest;
|
---|
| 25 | use Google\Service\CloudShell\StartEnvironmentRequest;
|
---|
| 26 |
|
---|
| 27 | /**
|
---|
| 28 | * The "environments" collection of methods.
|
---|
| 29 | * Typical usage is:
|
---|
| 30 | * <code>
|
---|
| 31 | * $cloudshellService = new Google\Service\CloudShell(...);
|
---|
| 32 | * $environments = $cloudshellService->users_environments;
|
---|
| 33 | * </code>
|
---|
| 34 | */
|
---|
| 35 | class UsersEnvironments extends \Google\Service\Resource
|
---|
| 36 | {
|
---|
| 37 | /**
|
---|
| 38 | * Adds a public SSH key to an environment, allowing clients with the
|
---|
| 39 | * corresponding private key to connect to that environment via SSH. If a key
|
---|
| 40 | * with the same content already exists, this will error with ALREADY_EXISTS.
|
---|
| 41 | * (environments.addPublicKey)
|
---|
| 42 | *
|
---|
| 43 | * @param string $environment Environment this key should be added to, e.g.
|
---|
| 44 | * `users/me/environments/default`.
|
---|
| 45 | * @param AddPublicKeyRequest $postBody
|
---|
| 46 | * @param array $optParams Optional parameters.
|
---|
| 47 | * @return Operation
|
---|
| 48 | * @throws \Google\Service\Exception
|
---|
| 49 | */
|
---|
| 50 | public function addPublicKey($environment, AddPublicKeyRequest $postBody, $optParams = [])
|
---|
| 51 | {
|
---|
| 52 | $params = ['environment' => $environment, 'postBody' => $postBody];
|
---|
| 53 | $params = array_merge($params, $optParams);
|
---|
| 54 | return $this->call('addPublicKey', [$params], Operation::class);
|
---|
| 55 | }
|
---|
| 56 | /**
|
---|
| 57 | * Sends OAuth credentials to a running environment on behalf of a user. When
|
---|
| 58 | * this completes, the environment will be authorized to run various Google
|
---|
| 59 | * Cloud command line tools without requiring the user to manually authenticate.
|
---|
| 60 | * (environments.authorize)
|
---|
| 61 | *
|
---|
| 62 | * @param string $name Name of the resource that should receive the credentials,
|
---|
| 63 | * for example `users/me/environments/default` or
|
---|
| 64 | * `users/someone@example.com/environments/default`.
|
---|
| 65 | * @param AuthorizeEnvironmentRequest $postBody
|
---|
| 66 | * @param array $optParams Optional parameters.
|
---|
| 67 | * @return Operation
|
---|
| 68 | * @throws \Google\Service\Exception
|
---|
| 69 | */
|
---|
| 70 | public function authorize($name, AuthorizeEnvironmentRequest $postBody, $optParams = [])
|
---|
| 71 | {
|
---|
| 72 | $params = ['name' => $name, 'postBody' => $postBody];
|
---|
| 73 | $params = array_merge($params, $optParams);
|
---|
| 74 | return $this->call('authorize', [$params], Operation::class);
|
---|
| 75 | }
|
---|
| 76 | /**
|
---|
| 77 | * Gets an environment. Returns NOT_FOUND if the environment does not exist.
|
---|
| 78 | * (environments.get)
|
---|
| 79 | *
|
---|
| 80 | * @param string $name Required. Name of the requested resource, for example
|
---|
| 81 | * `users/me/environments/default` or
|
---|
| 82 | * `users/someone@example.com/environments/default`.
|
---|
| 83 | * @param array $optParams Optional parameters.
|
---|
| 84 | * @return Environment
|
---|
| 85 | * @throws \Google\Service\Exception
|
---|
| 86 | */
|
---|
| 87 | public function get($name, $optParams = [])
|
---|
| 88 | {
|
---|
| 89 | $params = ['name' => $name];
|
---|
| 90 | $params = array_merge($params, $optParams);
|
---|
| 91 | return $this->call('get', [$params], Environment::class);
|
---|
| 92 | }
|
---|
| 93 | /**
|
---|
| 94 | * Removes a public SSH key from an environment. Clients will no longer be able
|
---|
| 95 | * to connect to the environment using the corresponding private key. If a key
|
---|
| 96 | * with the same content is not present, this will error with NOT_FOUND.
|
---|
| 97 | * (environments.removePublicKey)
|
---|
| 98 | *
|
---|
| 99 | * @param string $environment Environment this key should be removed from, e.g.
|
---|
| 100 | * `users/me/environments/default`.
|
---|
| 101 | * @param RemovePublicKeyRequest $postBody
|
---|
| 102 | * @param array $optParams Optional parameters.
|
---|
| 103 | * @return Operation
|
---|
| 104 | * @throws \Google\Service\Exception
|
---|
| 105 | */
|
---|
| 106 | public function removePublicKey($environment, RemovePublicKeyRequest $postBody, $optParams = [])
|
---|
| 107 | {
|
---|
| 108 | $params = ['environment' => $environment, 'postBody' => $postBody];
|
---|
| 109 | $params = array_merge($params, $optParams);
|
---|
| 110 | return $this->call('removePublicKey', [$params], Operation::class);
|
---|
| 111 | }
|
---|
| 112 | /**
|
---|
| 113 | * Starts an existing environment, allowing clients to connect to it. The
|
---|
| 114 | * returned operation will contain an instance of StartEnvironmentMetadata in
|
---|
| 115 | * its metadata field. Users can wait for the environment to start by polling
|
---|
| 116 | * this operation via GetOperation. Once the environment has finished starting
|
---|
| 117 | * and is ready to accept connections, the operation will contain a
|
---|
| 118 | * StartEnvironmentResponse in its response field. (environments.start)
|
---|
| 119 | *
|
---|
| 120 | * @param string $name Name of the resource that should be started, for example
|
---|
| 121 | * `users/me/environments/default` or
|
---|
| 122 | * `users/someone@example.com/environments/default`.
|
---|
| 123 | * @param StartEnvironmentRequest $postBody
|
---|
| 124 | * @param array $optParams Optional parameters.
|
---|
| 125 | * @return Operation
|
---|
| 126 | * @throws \Google\Service\Exception
|
---|
| 127 | */
|
---|
| 128 | public function start($name, StartEnvironmentRequest $postBody, $optParams = [])
|
---|
| 129 | {
|
---|
| 130 | $params = ['name' => $name, 'postBody' => $postBody];
|
---|
| 131 | $params = array_merge($params, $optParams);
|
---|
| 132 | return $this->call('start', [$params], Operation::class);
|
---|
| 133 | }
|
---|
| 134 | }
|
---|
| 135 |
|
---|
| 136 | // Adding a class alias for backwards compatibility with the previous class name.
|
---|
| 137 | class_alias(UsersEnvironments::class, 'Google_Service_CloudShell_Resource_UsersEnvironments');
|
---|