Skip to main content

environments

Creates, updates, deletes, gets or lists an environments resource.

Overview

Nameenvironments
TypeResource
Idgoogle.cloudshell.environments

Fields

The following fields are returned by SELECT queries:

Successful response

NameDatatypeDescription
idstringOutput only. The environment's identifier, unique among the user's environments.
namestringImmutable. Full name of this resource, in the format users/{owner_email}/environments/{environment_id}. {owner_email} is the email address of the user to whom this environment belongs, and {environment_id} is the identifier of this environment. For example, users/someone@example.com/environments/default.
dockerImagestringRequired. Immutable. Full path to the Docker image used to run this environment, e.g. "gcr.io/dev-con/cloud-devshell:latest".
publicKeysarrayOutput only. Public keys associated with the environment. Clients can connect to this environment via SSH only if they possess a private key corresponding to at least one of these public keys. Keys can be added to or removed from the environment using the AddPublicKey and RemovePublicKey methods.
sshHoststringOutput only. Host to which clients can connect to initiate SSH sessions with the environment.
sshPortinteger (int32)Output only. Port to which clients can connect to initiate SSH sessions with the environment.
sshUsernamestringOutput only. Username that clients should use when initiating SSH sessions with the environment.
statestringOutput only. Current execution state of this environment.
webHoststringOutput only. Host to which clients can connect to initiate HTTPS or WSS connections with the environment.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectusersId, environmentsIdGets an environment. Returns NOT_FOUND if the environment does not exist.
startexecusersId, environmentsIdStarts an existing environment, allowing clients to connect to it. The returned operation will contain an instance of StartEnvironmentMetadata in its metadata field. Users can wait for the environment to start by polling this operation via GetOperation. Once the environment has finished starting and is ready to accept connections, the operation will contain a StartEnvironmentResponse in its response field.
authorizeexecusersId, environmentsIdSends OAuth credentials to a running environment on behalf of a user. When this completes, the environment will be authorized to run various Google Cloud command line tools without requiring the user to manually authenticate.

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
environmentsIdstring
usersIdstring

SELECT examples

Gets an environment. Returns NOT_FOUND if the environment does not exist.

SELECT
id,
name,
dockerImage,
publicKeys,
sshHost,
sshPort,
sshUsername,
state,
webHost
FROM google.cloudshell.environments
WHERE usersId = '{{ usersId }}' -- required
AND environmentsId = '{{ environmentsId }}' -- required;

Lifecycle Methods

Starts an existing environment, allowing clients to connect to it. The returned operation will contain an instance of StartEnvironmentMetadata in its metadata field. Users can wait for the environment to start by polling this operation via GetOperation. Once the environment has finished starting and is ready to accept connections, the operation will contain a StartEnvironmentResponse in its response field.

EXEC google.cloudshell.environments.start 
@usersId='{{ usersId }}' --required,
@environmentsId='{{ environmentsId }}' --required
@@json=
'{
"accessToken": "{{ accessToken }}",
"publicKeys": "{{ publicKeys }}"
}';