API for interacting with Google Cloud Shell.
Each user of Cloud Shell has at least one environment, which has the ID "default". Environment consists of a Docker image defining what is installed on the environment and a home directory containing the user's data that will remain across sessions. Clients use this API to start and fetch information about their environment, which can then be used to connect to that environment via a separate SSH client.
Equality
Instances of this class created via copy-construction or copy-assignment always compare equal. Instances created with equal std::shared_ptr<*Connection>
objects compare equal. Objects that compare equal share the same underlying resources.
Performance
Creating a new instance of this class is a relatively expensive operation, new objects establish new connections to the service. In contrast, copy-construction, move-construction, and the corresponding assignment operations are relatively efficient as the copies share all underlying resources.
Thread Safety
Concurrent access to different instances of this class, even if they compare equal, is guaranteed to work. Two or more threads operating on the same instance of this class is not guaranteed to work. Since copy-construction and move-construction is a relatively efficient operation, consider using such a copy when using this class from multiple threads.
Constructors
CloudShellServiceClient(CloudShellServiceClient const &)
Copy and move support
Parameter | |
---|---|
Name | Description |
|
CloudShellServiceClient const &
|
CloudShellServiceClient(CloudShellServiceClient &&)
Copy and move support
Parameter | |
---|---|
Name | Description |
|
CloudShellServiceClient &&
|
CloudShellServiceClient(std::shared_ptr< CloudShellServiceConnection >, Options)
Parameters | |
---|---|
Name | Description |
connection |
std::shared_ptr< CloudShellServiceConnection >
|
opts |
Options
|
Operators
operator=(CloudShellServiceClient const &)
Copy and move support
Parameter | |
---|---|
Name | Description |
|
CloudShellServiceClient const &
|
Returns | |
---|---|
Type | Description |
CloudShellServiceClient & |
operator=(CloudShellServiceClient &&)
Copy and move support
Parameter | |
---|---|
Name | Description |
|
CloudShellServiceClient &&
|
Returns | |
---|---|
Type | Description |
CloudShellServiceClient & |
Functions
GetEnvironment(std::string const &, Options)
Gets an environment.
Returns NOT_FOUND if the environment does not exist.
Parameters | |
---|---|
Name | Description |
name |
std::string const &
Required. Name of the requested resource, for example |
opts |
Options
Optional. Override the class-level options, such as retry and backoff policies. |
Returns | |
---|---|
Type | Description |
StatusOr< google::cloud::shell::v1::Environment > | the result of the RPC. The response message type (google.cloud.shell.v1.Environment) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the |
GetEnvironment(google::cloud::shell::v1::GetEnvironmentRequest const &, Options)
Gets an environment.
Returns NOT_FOUND if the environment does not exist.
Parameters | |
---|---|
Name | Description |
request |
google::cloud::shell::v1::GetEnvironmentRequest const &
Unary RPCs, such as the one wrapped by this function, receive a single |
opts |
Options
Optional. Override the class-level options, such as retry and backoff policies. |
Returns | |
---|---|
Type | Description |
StatusOr< google::cloud::shell::v1::Environment > | the result of the RPC. The response message type (google.cloud.shell.v1.Environment) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the |
StartEnvironment(google::cloud::shell::v1::StartEnvironmentRequest const &, Options)
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.
Parameters | |
---|---|
Name | Description |
request |
google::cloud::shell::v1::StartEnvironmentRequest const &
Unary RPCs, such as the one wrapped by this function, receive a single |
opts |
Options
Optional. Override the class-level options, such as retry and backoff policies. |
Returns | |
---|---|
Type | Description |
future< StatusOr< google::cloud::shell::v1::StartEnvironmentResponse > > | A |
AuthorizeEnvironment(google::cloud::shell::v1::AuthorizeEnvironmentRequest const &, Options)
Sends 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 | |
---|---|
Name | Description |
request |
google::cloud::shell::v1::AuthorizeEnvironmentRequest const &
Unary RPCs, such as the one wrapped by this function, receive a single |
opts |
Options
Optional. Override the class-level options, such as retry and backoff policies. |
Returns | |
---|---|
Type | Description |
future< StatusOr< google::cloud::shell::v1::AuthorizeEnvironmentResponse > > | A |
AddPublicKey(google::cloud::shell::v1::AddPublicKeyRequest const &, Options)
Adds a public SSH key to an environment, allowing clients with the corresponding private key to connect to that environment via SSH.
If a key with the same content already exists, this will error with ALREADY_EXISTS.
Parameters | |
---|---|
Name | Description |
request |
google::cloud::shell::v1::AddPublicKeyRequest const &
Unary RPCs, such as the one wrapped by this function, receive a single |
opts |
Options
Optional. Override the class-level options, such as retry and backoff policies. |
Returns | |
---|---|
Type | Description |
future< StatusOr< google::cloud::shell::v1::AddPublicKeyResponse > > | A |
RemovePublicKey(google::cloud::shell::v1::RemovePublicKeyRequest const &, Options)
Removes a public SSH key from an environment.
Clients will no longer be able to connect to the environment using the corresponding private key. If a key with the same content is not present, this will error with NOT_FOUND.
Parameters | |
---|---|
Name | Description |
request |
google::cloud::shell::v1::RemovePublicKeyRequest const &
Unary RPCs, such as the one wrapped by this function, receive a single |
opts |
Options
Optional. Override the class-level options, such as retry and backoff policies. |
Returns | |
---|---|
Type | Description |
future< StatusOr< google::cloud::shell::v1::RemovePublicKeyResponse > > | A |