Class CloudShellServiceClient (2.40.0)
Stay organized with collections
Save and categorize content based on your preferences.
- 2.79.0 (latest)
- 2.77.0
- 2.75.0
- 2.74.0
- 2.73.0
- 2.72.0
- 2.71.0
- 2.69.0
- 2.67.0
- 2.66.0
- 2.63.0
- 2.62.0
- 2.61.0
- 2.59.0
- 2.58.0
- 2.57.0
- 2.56.0
- 2.55.0
- 2.54.0
- 2.53.0
- 2.52.0
- 2.51.0
- 2.50.0
- 2.48.0
- 2.47.0
- 2.46.0
- 2.45.0
- 2.44.0
- 2.43.0
- 2.42.0
- 2.41.0
- 2.40.0
- 2.39.0
- 2.38.0
- 2.36.0
- 2.35.0
- 2.34.0
- 2.33.0
- 2.32.0
- 2.31.0
- 2.30.0
- 2.29.0
- 2.28.0
- 2.27.0
- 2.26.0
- 2.23.0
- 2.22.0
- 2.21.0
- 2.20.0
- 2.19.0
- 2.18.0
- 2.17.0
- 2.16.0
- 2.15.0
- 2.14.0
- 2.13.0
- 2.12.0
- 2.11.0
- 2.10.0
- 2.8.0
- 2.7.0
- 2.6.0
- 2.5.0
- 2.4.0
- 2.3.0
- 2.1.11
Service Description: 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.
This class provides the ability to make remote calls to the backing service through method calls that map to API methods. Sample code to get started:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try(CloudShellServiceClientcloudShellServiceClient=CloudShellServiceClient.create()){
EnvironmentNamename=EnvironmentName.of("[USER]","[ENVIRONMENT]");
Environmentresponse=cloudShellServiceClient.getEnvironment(name);
}
Note: close() needs to be called on the CloudShellServiceClient object to clean up resources such as threads. In the example above, try-with-resources is used, which automatically calls close().
| Method | Description | Method Variants |
|---|---|---|
GetEnvironment |
Gets an environment. Returns NOT_FOUND if the environment does not exist. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
StartEnvironment |
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. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
AuthorizeEnvironment |
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. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
AddPublicKey |
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. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
RemovePublicKey |
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. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
See the individual methods for example code.
Many parameters require resource names to be formatted in a particular way. To assist with these names, this class includes a format method for each type of name, and additionally a parse method to extract the individual identifiers contained within names that are returned.
This class can be customized by passing in a custom instance of CloudShellServiceSettings to create(). For example:
To customize credentials:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
CloudShellServiceSettingscloudShellServiceSettings=
CloudShellServiceSettings.newBuilder()
.setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
.build();
CloudShellServiceClientcloudShellServiceClient=
CloudShellServiceClient.create(cloudShellServiceSettings);
To customize the endpoint:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
CloudShellServiceSettingscloudShellServiceSettings=
CloudShellServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
CloudShellServiceClientcloudShellServiceClient=
CloudShellServiceClient.create(cloudShellServiceSettings);
To use REST (HTTP1.1/JSON) transport (instead of gRPC) for sending and receiving requests over the wire:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
CloudShellServiceSettingscloudShellServiceSettings=
CloudShellServiceSettings.newHttpJsonBuilder().build();
CloudShellServiceClientcloudShellServiceClient=
CloudShellServiceClient.create(cloudShellServiceSettings);
Please refer to the GitHub repository's samples for more quickstart code snippets.
Static Methods
create()
publicstaticfinalCloudShellServiceClientcreate()Constructs an instance of CloudShellServiceClient with default settings.
| Returns | |
|---|---|
| Type | Description |
CloudShellServiceClient |
|
| Exceptions | |
|---|---|
| Type | Description |
IOException |
|
create(CloudShellServiceSettings settings)
publicstaticfinalCloudShellServiceClientcreate(CloudShellServiceSettingssettings)Constructs an instance of CloudShellServiceClient, using the given settings. The channels are created based on the settings passed in, or defaults for any settings that are not set.
| Parameter | |
|---|---|
| Name | Description |
settings |
CloudShellServiceSettings |
| Returns | |
|---|---|
| Type | Description |
CloudShellServiceClient |
|
| Exceptions | |
|---|---|
| Type | Description |
IOException |
|
create(CloudShellServiceStub stub)
publicstaticfinalCloudShellServiceClientcreate(CloudShellServiceStubstub)Constructs an instance of CloudShellServiceClient, using the given stub for making calls. This is for advanced usage - prefer using create(CloudShellServiceSettings).
| Parameter | |
|---|---|
| Name | Description |
stub |
CloudShellServiceStub |
| Returns | |
|---|---|
| Type | Description |
CloudShellServiceClient |
|
Constructors
CloudShellServiceClient(CloudShellServiceSettings settings)
protectedCloudShellServiceClient(CloudShellServiceSettingssettings)Constructs an instance of CloudShellServiceClient, using the given settings. This is protected so that it is easy to make a subclass, but otherwise, the static factory methods should be preferred.
| Parameter | |
|---|---|
| Name | Description |
settings |
CloudShellServiceSettings |
CloudShellServiceClient(CloudShellServiceStub stub)
protectedCloudShellServiceClient(CloudShellServiceStubstub)| Parameter | |
|---|---|
| Name | Description |
stub |
CloudShellServiceStub |
Methods
addPublicKeyAsync(AddPublicKeyRequest request)
publicfinalOperationFuture<AddPublicKeyResponse,AddPublicKeyMetadata>addPublicKeyAsync(AddPublicKeyRequestrequest)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.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try(CloudShellServiceClientcloudShellServiceClient=CloudShellServiceClient.create()){
AddPublicKeyRequestrequest=
AddPublicKeyRequest.newBuilder()
.setEnvironment("environment-85904877")
.setKey("key106079")
.build();
AddPublicKeyResponseresponse=cloudShellServiceClient.addPublicKeyAsync(request).get();
}
| Parameter | |
|---|---|
| Name | Description |
request |
AddPublicKeyRequest The request object containing all of the parameters for the API call. |
| Returns | |
|---|---|
| Type | Description |
OperationFuture<AddPublicKeyResponse,AddPublicKeyMetadata> |
|
addPublicKeyCallable()
publicfinalUnaryCallable<AddPublicKeyRequest,Operation>addPublicKeyCallable()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.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try(CloudShellServiceClientcloudShellServiceClient=CloudShellServiceClient.create()){
AddPublicKeyRequestrequest=
AddPublicKeyRequest.newBuilder()
.setEnvironment("environment-85904877")
.setKey("key106079")
.build();
ApiFuture<Operation>future=
cloudShellServiceClient.addPublicKeyCallable().futureCall(request);
// Do something.
Operationresponse=future.get();
}
| Returns | |
|---|---|
| Type | Description |
UnaryCallable<AddPublicKeyRequest,Operation> |
|
addPublicKeyOperationCallable()
publicfinalOperationCallable<AddPublicKeyRequest,AddPublicKeyResponse,AddPublicKeyMetadata>addPublicKeyOperationCallable()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.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try(CloudShellServiceClientcloudShellServiceClient=CloudShellServiceClient.create()){
AddPublicKeyRequestrequest=
AddPublicKeyRequest.newBuilder()
.setEnvironment("environment-85904877")
.setKey("key106079")
.build();
OperationFuture<AddPublicKeyResponse,AddPublicKeyMetadata>future=
cloudShellServiceClient.addPublicKeyOperationCallable().futureCall(request);
// Do something.
AddPublicKeyResponseresponse=future.get();
}
| Returns | |
|---|---|
| Type | Description |
OperationCallable<AddPublicKeyRequest,AddPublicKeyResponse,AddPublicKeyMetadata> |
|
authorizeEnvironmentAsync(AuthorizeEnvironmentRequest request)
publicfinalOperationFuture<AuthorizeEnvironmentResponse,AuthorizeEnvironmentMetadata>authorizeEnvironmentAsync(AuthorizeEnvironmentRequestrequest)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.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try(CloudShellServiceClientcloudShellServiceClient=CloudShellServiceClient.create()){
AuthorizeEnvironmentRequestrequest=
AuthorizeEnvironmentRequest.newBuilder()
.setName("name3373707")
.setAccessToken("accessToken-1042689291")
.setIdToken("idToken1642509726")
.setExpireTime(Timestamp.newBuilder().build())
.build();
AuthorizeEnvironmentResponseresponse=
cloudShellServiceClient.authorizeEnvironmentAsync(request).get();
}
| Parameter | |
|---|---|
| Name | Description |
request |
AuthorizeEnvironmentRequest The request object containing all of the parameters for the API call. |
| Returns | |
|---|---|
| Type | Description |
OperationFuture<AuthorizeEnvironmentResponse,AuthorizeEnvironmentMetadata> |
|
authorizeEnvironmentCallable()
publicfinalUnaryCallable<AuthorizeEnvironmentRequest,Operation>authorizeEnvironmentCallable()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.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try(CloudShellServiceClientcloudShellServiceClient=CloudShellServiceClient.create()){
AuthorizeEnvironmentRequestrequest=
AuthorizeEnvironmentRequest.newBuilder()
.setName("name3373707")
.setAccessToken("accessToken-1042689291")
.setIdToken("idToken1642509726")
.setExpireTime(Timestamp.newBuilder().build())
.build();
ApiFuture<Operation>future=
cloudShellServiceClient.authorizeEnvironmentCallable().futureCall(request);
// Do something.
Operationresponse=future.get();
}
| Returns | |
|---|---|
| Type | Description |
UnaryCallable<AuthorizeEnvironmentRequest,Operation> |
|
authorizeEnvironmentOperationCallable()
publicfinalOperationCallable<AuthorizeEnvironmentRequest,AuthorizeEnvironmentResponse,AuthorizeEnvironmentMetadata>authorizeEnvironmentOperationCallable()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.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try(CloudShellServiceClientcloudShellServiceClient=CloudShellServiceClient.create()){
AuthorizeEnvironmentRequestrequest=
AuthorizeEnvironmentRequest.newBuilder()
.setName("name3373707")
.setAccessToken("accessToken-1042689291")
.setIdToken("idToken1642509726")
.setExpireTime(Timestamp.newBuilder().build())
.build();
OperationFuture<AuthorizeEnvironmentResponse,AuthorizeEnvironmentMetadata>future=
cloudShellServiceClient.authorizeEnvironmentOperationCallable().futureCall(request);
// Do something.
AuthorizeEnvironmentResponseresponse=future.get();
}
| Returns | |
|---|---|
| Type | Description |
OperationCallable<AuthorizeEnvironmentRequest,AuthorizeEnvironmentResponse,AuthorizeEnvironmentMetadata> |
|
awaitTermination(long duration, TimeUnit unit)
publicbooleanawaitTermination(longduration,TimeUnitunit)| Parameters | |
|---|---|
| Name | Description |
duration |
long |
unit |
TimeUnit |
| Returns | |
|---|---|
| Type | Description |
boolean |
|
| Exceptions | |
|---|---|
| Type | Description |
InterruptedException |
|
close()
publicfinalvoidclose()getEnvironment(EnvironmentName name)
publicfinalEnvironmentgetEnvironment(EnvironmentNamename)Gets an environment. Returns NOT_FOUND if the environment does not exist.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try(CloudShellServiceClientcloudShellServiceClient=CloudShellServiceClient.create()){
EnvironmentNamename=EnvironmentName.of("[USER]","[ENVIRONMENT]");
Environmentresponse=cloudShellServiceClient.getEnvironment(name);
}
| Parameter | |
|---|---|
| Name | Description |
name |
EnvironmentName Required. Name of the requested resource, for example
|
| Returns | |
|---|---|
| Type | Description |
Environment |
|
getEnvironment(GetEnvironmentRequest request)
publicfinalEnvironmentgetEnvironment(GetEnvironmentRequestrequest)Gets an environment. Returns NOT_FOUND if the environment does not exist.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try(CloudShellServiceClientcloudShellServiceClient=CloudShellServiceClient.create()){
GetEnvironmentRequestrequest=
GetEnvironmentRequest.newBuilder()
.setName(EnvironmentName.of("[USER]","[ENVIRONMENT]").toString())
.build();
Environmentresponse=cloudShellServiceClient.getEnvironment(request);
}
| Parameter | |
|---|---|
| Name | Description |
request |
GetEnvironmentRequest The request object containing all of the parameters for the API call. |
| Returns | |
|---|---|
| Type | Description |
Environment |
|
getEnvironment(String name)
publicfinalEnvironmentgetEnvironment(Stringname)Gets an environment. Returns NOT_FOUND if the environment does not exist.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try(CloudShellServiceClientcloudShellServiceClient=CloudShellServiceClient.create()){
Stringname=EnvironmentName.of("[USER]","[ENVIRONMENT]").toString();
Environmentresponse=cloudShellServiceClient.getEnvironment(name);
}
| Parameter | |
|---|---|
| Name | Description |
name |
String Required. Name of the requested resource, for example
|
| Returns | |
|---|---|
| Type | Description |
Environment |
|
getEnvironmentCallable()
publicfinalUnaryCallable<GetEnvironmentRequest,Environment>getEnvironmentCallable()Gets an environment. Returns NOT_FOUND if the environment does not exist.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try(CloudShellServiceClientcloudShellServiceClient=CloudShellServiceClient.create()){
GetEnvironmentRequestrequest=
GetEnvironmentRequest.newBuilder()
.setName(EnvironmentName.of("[USER]","[ENVIRONMENT]").toString())
.build();
ApiFuture<Environment>future=
cloudShellServiceClient.getEnvironmentCallable().futureCall(request);
// Do something.
Environmentresponse=future.get();
}
| Returns | |
|---|---|
| Type | Description |
UnaryCallable<GetEnvironmentRequest,Environment> |
|
getHttpJsonOperationsClient()
publicfinalOperationsClientgetHttpJsonOperationsClient()Returns the OperationsClient that can be used to query the status of a long-running operation returned by another API method call.
| Returns | |
|---|---|
| Type | Description |
OperationsClient |
|
getOperationsClient()
publicfinalOperationsClientgetOperationsClient()Returns the OperationsClient that can be used to query the status of a long-running operation returned by another API method call.
| Returns | |
|---|---|
| Type | Description |
OperationsClient |
|
getSettings()
publicfinalCloudShellServiceSettingsgetSettings()| Returns | |
|---|---|
| Type | Description |
CloudShellServiceSettings |
|
getStub()
publicCloudShellServiceStubgetStub()| Returns | |
|---|---|
| Type | Description |
CloudShellServiceStub |
|
isShutdown()
publicbooleanisShutdown()| Returns | |
|---|---|
| Type | Description |
boolean |
|
isTerminated()
publicbooleanisTerminated()| Returns | |
|---|---|
| Type | Description |
boolean |
|
removePublicKeyAsync(RemovePublicKeyRequest request)
publicfinalOperationFuture<RemovePublicKeyResponse,RemovePublicKeyMetadata>removePublicKeyAsync(RemovePublicKeyRequestrequest)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.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try(CloudShellServiceClientcloudShellServiceClient=CloudShellServiceClient.create()){
RemovePublicKeyRequestrequest=
RemovePublicKeyRequest.newBuilder()
.setEnvironment("environment-85904877")
.setKey("key106079")
.build();
RemovePublicKeyResponseresponse=
cloudShellServiceClient.removePublicKeyAsync(request).get();
}
| Parameter | |
|---|---|
| Name | Description |
request |
RemovePublicKeyRequest The request object containing all of the parameters for the API call. |
| Returns | |
|---|---|
| Type | Description |
OperationFuture<RemovePublicKeyResponse,RemovePublicKeyMetadata> |
|
removePublicKeyCallable()
publicfinalUnaryCallable<RemovePublicKeyRequest,Operation>removePublicKeyCallable()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.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try(CloudShellServiceClientcloudShellServiceClient=CloudShellServiceClient.create()){
RemovePublicKeyRequestrequest=
RemovePublicKeyRequest.newBuilder()
.setEnvironment("environment-85904877")
.setKey("key106079")
.build();
ApiFuture<Operation>future=
cloudShellServiceClient.removePublicKeyCallable().futureCall(request);
// Do something.
Operationresponse=future.get();
}
| Returns | |
|---|---|
| Type | Description |
UnaryCallable<RemovePublicKeyRequest,Operation> |
|
removePublicKeyOperationCallable()
publicfinalOperationCallable<RemovePublicKeyRequest,RemovePublicKeyResponse,RemovePublicKeyMetadata>removePublicKeyOperationCallable()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.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try(CloudShellServiceClientcloudShellServiceClient=CloudShellServiceClient.create()){
RemovePublicKeyRequestrequest=
RemovePublicKeyRequest.newBuilder()
.setEnvironment("environment-85904877")
.setKey("key106079")
.build();
OperationFuture<RemovePublicKeyResponse,RemovePublicKeyMetadata>future=
cloudShellServiceClient.removePublicKeyOperationCallable().futureCall(request);
// Do something.
RemovePublicKeyResponseresponse=future.get();
}
| Returns | |
|---|---|
| Type | Description |
OperationCallable<RemovePublicKeyRequest,RemovePublicKeyResponse,RemovePublicKeyMetadata> |
|
shutdown()
publicvoidshutdown()shutdownNow()
publicvoidshutdownNow()startEnvironmentAsync(StartEnvironmentRequest request)
publicfinalOperationFuture<StartEnvironmentResponse,StartEnvironmentMetadata>startEnvironmentAsync(StartEnvironmentRequestrequest)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.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try(CloudShellServiceClientcloudShellServiceClient=CloudShellServiceClient.create()){
StartEnvironmentRequestrequest=
StartEnvironmentRequest.newBuilder()
.setName("name3373707")
.setAccessToken("accessToken-1042689291")
.addAllPublicKeys(newArrayList<String>())
.build();
StartEnvironmentResponseresponse=
cloudShellServiceClient.startEnvironmentAsync(request).get();
}
| Parameter | |
|---|---|
| Name | Description |
request |
StartEnvironmentRequest The request object containing all of the parameters for the API call. |
| Returns | |
|---|---|
| Type | Description |
OperationFuture<StartEnvironmentResponse,StartEnvironmentMetadata> |
|
startEnvironmentCallable()
publicfinalUnaryCallable<StartEnvironmentRequest,Operation>startEnvironmentCallable()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.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try(CloudShellServiceClientcloudShellServiceClient=CloudShellServiceClient.create()){
StartEnvironmentRequestrequest=
StartEnvironmentRequest.newBuilder()
.setName("name3373707")
.setAccessToken("accessToken-1042689291")
.addAllPublicKeys(newArrayList<String>())
.build();
ApiFuture<Operation>future=
cloudShellServiceClient.startEnvironmentCallable().futureCall(request);
// Do something.
Operationresponse=future.get();
}
| Returns | |
|---|---|
| Type | Description |
UnaryCallable<StartEnvironmentRequest,Operation> |
|
startEnvironmentOperationCallable()
publicfinalOperationCallable<StartEnvironmentRequest,StartEnvironmentResponse,StartEnvironmentMetadata>startEnvironmentOperationCallable()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.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try(CloudShellServiceClientcloudShellServiceClient=CloudShellServiceClient.create()){
StartEnvironmentRequestrequest=
StartEnvironmentRequest.newBuilder()
.setName("name3373707")
.setAccessToken("accessToken-1042689291")
.addAllPublicKeys(newArrayList<String>())
.build();
OperationFuture<StartEnvironmentResponse,StartEnvironmentMetadata>future=
cloudShellServiceClient.startEnvironmentOperationCallable().futureCall(request);
// Do something.
StartEnvironmentResponseresponse=future.get();
}
| Returns | |
|---|---|
| Type | Description |
OperationCallable<StartEnvironmentRequest,StartEnvironmentResponse,StartEnvironmentMetadata> |
|