@BetaApi @Generated(value="by gapic-generator-java") public class EnvironmentsClient extends Object implements com.google.api.gax.core.BackgroundResource
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 (EnvironmentsClient environmentsClient = EnvironmentsClient.create()) {
String name = "name3373707";
Environment response = environmentsClient.getEnvironment(name);
}
Note: close() needs to be called on the EnvironmentsClient object to clean up resources such as threads. In the example above, try-with-resources is used, which automatically calls close().
The surface of this class includes several types of Java methods for each of the API's methods:
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 EnvironmentsSettings 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
EnvironmentsSettings environmentsSettings =
EnvironmentsSettings.newBuilder()
.setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
.build();
EnvironmentsClient environmentsClient = EnvironmentsClient.create(environmentsSettings);
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
EnvironmentsSettings environmentsSettings =
EnvironmentsSettings.newBuilder().setEndpoint(myEndpoint).build();
EnvironmentsClient environmentsClient = EnvironmentsClient.create(environmentsSettings);
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
EnvironmentsSettings environmentsSettings = EnvironmentsSettings.newHttpJsonBuilder().build();
EnvironmentsClient environmentsClient = EnvironmentsClient.create(environmentsSettings);
Please refer to the GitHub repository's samples for more quickstart code snippets.
| Modifier and Type | Class and Description |
|---|---|
static class |
EnvironmentsClient.ListEnvironmentsFixedSizeCollection |
static class |
EnvironmentsClient.ListEnvironmentsPage |
static class |
EnvironmentsClient.ListEnvironmentsPagedResponse |
| Modifier | Constructor and Description |
|---|---|
protected |
EnvironmentsClient(EnvironmentsSettings settings)
Constructs an instance of EnvironmentsClient, using the given settings.
|
protected |
EnvironmentsClient(EnvironmentsStub stub) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
awaitTermination(long duration,
TimeUnit unit) |
com.google.api.gax.longrunning.OperationFuture<CheckUpgradeResponse,OperationMetadata> |
checkUpgradeAsync(CheckUpgradeRequest request)
Check if an upgrade operation on the environment will succeed.
|
com.google.api.gax.rpc.UnaryCallable<CheckUpgradeRequest,com.google.longrunning.Operation> |
checkUpgradeCallable()
Check if an upgrade operation on the environment will succeed.
|
com.google.api.gax.rpc.OperationCallable<CheckUpgradeRequest,CheckUpgradeResponse,OperationMetadata> |
checkUpgradeOperationCallable()
Check if an upgrade operation on the environment will succeed.
|
void |
close() |
static EnvironmentsClient |
create()
Constructs an instance of EnvironmentsClient with default settings.
|
static EnvironmentsClient |
create(EnvironmentsSettings settings)
Constructs an instance of EnvironmentsClient, using the given settings.
|
static EnvironmentsClient |
create(EnvironmentsStub stub)
Constructs an instance of EnvironmentsClient, using the given stub for making calls.
|
com.google.api.gax.longrunning.OperationFuture<Environment,OperationMetadata> |
createEnvironmentAsync(CreateEnvironmentRequest request)
Create a new environment.
|
com.google.api.gax.longrunning.OperationFuture<Environment,OperationMetadata> |
createEnvironmentAsync(String parent,
Environment environment)
Create a new environment.
|
com.google.api.gax.rpc.UnaryCallable<CreateEnvironmentRequest,com.google.longrunning.Operation> |
createEnvironmentCallable()
Create a new environment.
|
com.google.api.gax.rpc.OperationCallable<CreateEnvironmentRequest,Environment,OperationMetadata> |
createEnvironmentOperationCallable()
Create a new environment.
|
com.google.api.gax.longrunning.OperationFuture<DatabaseFailoverResponse,OperationMetadata> |
databaseFailoverAsync(DatabaseFailoverRequest request)
Triggers database failover (only for highly resilient environments).
|
com.google.api.gax.rpc.UnaryCallable<DatabaseFailoverRequest,com.google.longrunning.Operation> |
databaseFailoverCallable()
Triggers database failover (only for highly resilient environments).
|
com.google.api.gax.rpc.OperationCallable<DatabaseFailoverRequest,DatabaseFailoverResponse,OperationMetadata> |
databaseFailoverOperationCallable()
Triggers database failover (only for highly resilient environments).
|
com.google.api.gax.longrunning.OperationFuture<com.google.protobuf.Empty,OperationMetadata> |
deleteEnvironmentAsync(DeleteEnvironmentRequest request)
Delete an environment.
|
com.google.api.gax.longrunning.OperationFuture<com.google.protobuf.Empty,OperationMetadata> |
deleteEnvironmentAsync(String name)
Delete an environment.
|
com.google.api.gax.rpc.UnaryCallable<DeleteEnvironmentRequest,com.google.longrunning.Operation> |
deleteEnvironmentCallable()
Delete an environment.
|
com.google.api.gax.rpc.OperationCallable<DeleteEnvironmentRequest,com.google.protobuf.Empty,OperationMetadata> |
deleteEnvironmentOperationCallable()
Delete an environment.
|
ExecuteAirflowCommandResponse |
executeAirflowCommand(ExecuteAirflowCommandRequest request)
Executes Airflow CLI command.
|
com.google.api.gax.rpc.UnaryCallable<ExecuteAirflowCommandRequest,ExecuteAirflowCommandResponse> |
executeAirflowCommandCallable()
Executes Airflow CLI command.
|
FetchDatabasePropertiesResponse |
fetchDatabaseProperties(FetchDatabasePropertiesRequest request)
Fetches database properties.
|
com.google.api.gax.rpc.UnaryCallable<FetchDatabasePropertiesRequest,FetchDatabasePropertiesResponse> |
fetchDatabasePropertiesCallable()
Fetches database properties.
|
Environment |
getEnvironment(GetEnvironmentRequest request)
Get an existing environment.
|
Environment |
getEnvironment(String name)
Get an existing environment.
|
com.google.api.gax.rpc.UnaryCallable<GetEnvironmentRequest,Environment> |
getEnvironmentCallable()
Get an existing environment.
|
com.google.api.gax.httpjson.longrunning.OperationsClient |
getHttpJsonOperationsClient()
Returns the OperationsClient that can be used to query the status of a long-running operation
returned by another API method call.
|
com.google.longrunning.OperationsClient |
getOperationsClient()
Returns the OperationsClient that can be used to query the status of a long-running operation
returned by another API method call.
|
EnvironmentsSettings |
getSettings() |
EnvironmentsStub |
getStub() |
boolean |
isShutdown() |
boolean |
isTerminated() |
EnvironmentsClient.ListEnvironmentsPagedResponse |
listEnvironments(ListEnvironmentsRequest request)
List environments.
|
EnvironmentsClient.ListEnvironmentsPagedResponse |
listEnvironments(String parent)
List environments.
|
com.google.api.gax.rpc.UnaryCallable<ListEnvironmentsRequest,ListEnvironmentsResponse> |
listEnvironmentsCallable()
List environments.
|
com.google.api.gax.rpc.UnaryCallable<ListEnvironmentsRequest,EnvironmentsClient.ListEnvironmentsPagedResponse> |
listEnvironmentsPagedCallable()
List environments.
|
com.google.api.gax.longrunning.OperationFuture<LoadSnapshotResponse,OperationMetadata> |
loadSnapshotAsync(LoadSnapshotRequest request)
Loads a snapshot of a Cloud Composer environment.
|
com.google.api.gax.rpc.UnaryCallable<LoadSnapshotRequest,com.google.longrunning.Operation> |
loadSnapshotCallable()
Loads a snapshot of a Cloud Composer environment.
|
com.google.api.gax.rpc.OperationCallable<LoadSnapshotRequest,LoadSnapshotResponse,OperationMetadata> |
loadSnapshotOperationCallable()
Loads a snapshot of a Cloud Composer environment.
|
PollAirflowCommandResponse |
pollAirflowCommand(PollAirflowCommandRequest request)
Polls Airflow CLI command execution and fetches logs.
|
com.google.api.gax.rpc.UnaryCallable<PollAirflowCommandRequest,PollAirflowCommandResponse> |
pollAirflowCommandCallable()
Polls Airflow CLI command execution and fetches logs.
|
com.google.api.gax.longrunning.OperationFuture<Environment,OperationMetadata> |
restartWebServerAsync(RestartWebServerRequest request)
Restart Airflow web server.
|
com.google.api.gax.rpc.UnaryCallable<RestartWebServerRequest,com.google.longrunning.Operation> |
restartWebServerCallable()
Restart Airflow web server.
|
com.google.api.gax.rpc.OperationCallable<RestartWebServerRequest,Environment,OperationMetadata> |
restartWebServerOperationCallable()
Restart Airflow web server.
|
com.google.api.gax.longrunning.OperationFuture<SaveSnapshotResponse,OperationMetadata> |
saveSnapshotAsync(SaveSnapshotRequest request)
Creates a snapshots of a Cloud Composer environment.
|
com.google.api.gax.rpc.UnaryCallable<SaveSnapshotRequest,com.google.longrunning.Operation> |
saveSnapshotCallable()
Creates a snapshots of a Cloud Composer environment.
|
com.google.api.gax.rpc.OperationCallable<SaveSnapshotRequest,SaveSnapshotResponse,OperationMetadata> |
saveSnapshotOperationCallable()
Creates a snapshots of a Cloud Composer environment.
|
void |
shutdown() |
void |
shutdownNow() |
StopAirflowCommandResponse |
stopAirflowCommand(StopAirflowCommandRequest request)
Stops Airflow CLI command execution.
|
com.google.api.gax.rpc.UnaryCallable<StopAirflowCommandRequest,StopAirflowCommandResponse> |
stopAirflowCommandCallable()
Stops Airflow CLI command execution.
|
com.google.api.gax.longrunning.OperationFuture<Environment,OperationMetadata> |
updateEnvironmentAsync(String name,
Environment environment,
com.google.protobuf.FieldMask updateMask)
Update an environment.
|
com.google.api.gax.longrunning.OperationFuture<Environment,OperationMetadata> |
updateEnvironmentAsync(UpdateEnvironmentRequest request)
Update an environment.
|
com.google.api.gax.rpc.UnaryCallable<UpdateEnvironmentRequest,com.google.longrunning.Operation> |
updateEnvironmentCallable()
Update an environment.
|
com.google.api.gax.rpc.OperationCallable<UpdateEnvironmentRequest,Environment,OperationMetadata> |
updateEnvironmentOperationCallable()
Update an environment.
|
protected EnvironmentsClient(EnvironmentsSettings settings) throws IOException
IOExceptionprotected EnvironmentsClient(EnvironmentsStub stub)
public static final EnvironmentsClient create() throws IOException
IOExceptionpublic static final EnvironmentsClient create(EnvironmentsSettings settings) throws IOException
IOExceptionpublic static final EnvironmentsClient create(EnvironmentsStub stub)
public final EnvironmentsSettings getSettings()
public EnvironmentsStub getStub()
public final com.google.longrunning.OperationsClient getOperationsClient()
@BetaApi public final com.google.api.gax.httpjson.longrunning.OperationsClient getHttpJsonOperationsClient()
public final com.google.api.gax.longrunning.OperationFuture<Environment,OperationMetadata> createEnvironmentAsync(String parent, Environment environment)
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 (EnvironmentsClient environmentsClient = EnvironmentsClient.create()) {
String parent = "parent-995424086";
Environment environment = Environment.newBuilder().build();
Environment response = environmentsClient.createEnvironmentAsync(parent, environment).get();
}
parent - The parent must be of the form "projects/{projectId}/locations/{locationId}".environment - The environment to create.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.longrunning.OperationFuture<Environment,OperationMetadata> createEnvironmentAsync(CreateEnvironmentRequest request)
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 (EnvironmentsClient environmentsClient = EnvironmentsClient.create()) {
CreateEnvironmentRequest request =
CreateEnvironmentRequest.newBuilder()
.setParent("parent-995424086")
.setEnvironment(Environment.newBuilder().build())
.build();
Environment response = environmentsClient.createEnvironmentAsync(request).get();
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.OperationCallable<CreateEnvironmentRequest,Environment,OperationMetadata> createEnvironmentOperationCallable()
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 (EnvironmentsClient environmentsClient = EnvironmentsClient.create()) {
CreateEnvironmentRequest request =
CreateEnvironmentRequest.newBuilder()
.setParent("parent-995424086")
.setEnvironment(Environment.newBuilder().build())
.build();
OperationFuture<Environment, OperationMetadata> future =
environmentsClient.createEnvironmentOperationCallable().futureCall(request);
// Do something.
Environment response = future.get();
}
public final com.google.api.gax.rpc.UnaryCallable<CreateEnvironmentRequest,com.google.longrunning.Operation> createEnvironmentCallable()
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 (EnvironmentsClient environmentsClient = EnvironmentsClient.create()) {
CreateEnvironmentRequest request =
CreateEnvironmentRequest.newBuilder()
.setParent("parent-995424086")
.setEnvironment(Environment.newBuilder().build())
.build();
ApiFuture<Operation> future =
environmentsClient.createEnvironmentCallable().futureCall(request);
// Do something.
Operation response = future.get();
}
public final Environment getEnvironment(String name)
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 (EnvironmentsClient environmentsClient = EnvironmentsClient.create()) {
String name = "name3373707";
Environment response = environmentsClient.getEnvironment(name);
}
name - The resource name of the environment to get, in the form:
"projects/{projectId}/locations/{locationId}/environments/{environmentId}"com.google.api.gax.rpc.ApiException - if the remote call failspublic final Environment getEnvironment(GetEnvironmentRequest request)
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 (EnvironmentsClient environmentsClient = EnvironmentsClient.create()) {
GetEnvironmentRequest request =
GetEnvironmentRequest.newBuilder().setName("name3373707").build();
Environment response = environmentsClient.getEnvironment(request);
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<GetEnvironmentRequest,Environment> getEnvironmentCallable()
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 (EnvironmentsClient environmentsClient = EnvironmentsClient.create()) {
GetEnvironmentRequest request =
GetEnvironmentRequest.newBuilder().setName("name3373707").build();
ApiFuture<Environment> future =
environmentsClient.getEnvironmentCallable().futureCall(request);
// Do something.
Environment response = future.get();
}
public final EnvironmentsClient.ListEnvironmentsPagedResponse listEnvironments(String parent)
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 (EnvironmentsClient environmentsClient = EnvironmentsClient.create()) {
String parent = "parent-995424086";
for (Environment element : environmentsClient.listEnvironments(parent).iterateAll()) {
// doThingsWith(element);
}
}
parent - List environments in the given project and location, in the form:
"projects/{projectId}/locations/{locationId}"com.google.api.gax.rpc.ApiException - if the remote call failspublic final EnvironmentsClient.ListEnvironmentsPagedResponse listEnvironments(ListEnvironmentsRequest request)
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 (EnvironmentsClient environmentsClient = EnvironmentsClient.create()) {
ListEnvironmentsRequest request =
ListEnvironmentsRequest.newBuilder()
.setParent("parent-995424086")
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
for (Environment element : environmentsClient.listEnvironments(request).iterateAll()) {
// doThingsWith(element);
}
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<ListEnvironmentsRequest,EnvironmentsClient.ListEnvironmentsPagedResponse> listEnvironmentsPagedCallable()
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 (EnvironmentsClient environmentsClient = EnvironmentsClient.create()) {
ListEnvironmentsRequest request =
ListEnvironmentsRequest.newBuilder()
.setParent("parent-995424086")
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
ApiFuture<Environment> future =
environmentsClient.listEnvironmentsPagedCallable().futureCall(request);
// Do something.
for (Environment element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
public final com.google.api.gax.rpc.UnaryCallable<ListEnvironmentsRequest,ListEnvironmentsResponse> listEnvironmentsCallable()
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 (EnvironmentsClient environmentsClient = EnvironmentsClient.create()) {
ListEnvironmentsRequest request =
ListEnvironmentsRequest.newBuilder()
.setParent("parent-995424086")
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
while (true) {
ListEnvironmentsResponse response =
environmentsClient.listEnvironmentsCallable().call(request);
for (Environment element : response.getEnvironmentsList()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
public final com.google.api.gax.longrunning.OperationFuture<Environment,OperationMetadata> updateEnvironmentAsync(String name, Environment environment, com.google.protobuf.FieldMask updateMask)
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 (EnvironmentsClient environmentsClient = EnvironmentsClient.create()) {
String name = "name3373707";
Environment environment = Environment.newBuilder().build();
FieldMask updateMask = FieldMask.newBuilder().build();
Environment response =
environmentsClient.updateEnvironmentAsync(name, environment, updateMask).get();
}
name - The relative resource name of the environment to update, in the form:
"projects/{projectId}/locations/{locationId}/environments/{environmentId}"environment - A patch environment. Fields specified by the `updateMask` will be copied
from the patch environment into the environment under update.updateMask - Required. A comma-separated list of paths, relative to `Environment`, of
fields to update. For example, to set the version of scikit-learn to install in the
environment to 0.19.0 and to remove an existing installation of argparse, the `updateMask`
parameter would include the following two `paths` values:
"config.softwareConfig.pypiPackages.scikit-learn" and
"config.softwareConfig.pypiPackages.argparse". The included patch environment would specify
the scikit-learn version as follows:
{ "config":{ "softwareConfig":{ "pypiPackages":{ "scikit-learn":"==0.19.0" } } } }
Note that in the above example, any existing PyPI packages other than scikit-learn and argparse will be unaffected.
Only one update type may be included in a single request's `updateMask`. For example, one cannot update both the PyPI packages and labels in the same request. However, it is possible to update multiple members of a map field simultaneously in the same request. For example, to set the labels "label1" and "label2" while clearing "label3" (assuming it already exists), one can provide the paths "labels.label1", "labels.label2", and "labels.label3" and populate the patch environment as follows:
{ "labels":{ "label1":"new-label1-value" "label2":"new-label2-value" } }
Note that in the above example, any existing labels that are not included in the `updateMask` will be unaffected.
It is also possible to replace an entire map field by providing the map field's path in the `updateMask`. The new value of the field will be that which is provided in the patch environment. For example, to delete all pre-existing user-specified PyPI packages and install botocore at version 1.7.14, the `updateMask` would contain the path "config.softwareConfig.pypiPackages", and the patch environment would be the following:
{ "config":{ "softwareConfig":{ "pypiPackages":{ "botocore":"==1.7.14" } } } }
**Note:** Only the following fields can be updated:
com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.longrunning.OperationFuture<Environment,OperationMetadata> updateEnvironmentAsync(UpdateEnvironmentRequest request)
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 (EnvironmentsClient environmentsClient = EnvironmentsClient.create()) {
UpdateEnvironmentRequest request =
UpdateEnvironmentRequest.newBuilder()
.setName("name3373707")
.setEnvironment(Environment.newBuilder().build())
.setUpdateMask(FieldMask.newBuilder().build())
.build();
Environment response = environmentsClient.updateEnvironmentAsync(request).get();
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.OperationCallable<UpdateEnvironmentRequest,Environment,OperationMetadata> updateEnvironmentOperationCallable()
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 (EnvironmentsClient environmentsClient = EnvironmentsClient.create()) {
UpdateEnvironmentRequest request =
UpdateEnvironmentRequest.newBuilder()
.setName("name3373707")
.setEnvironment(Environment.newBuilder().build())
.setUpdateMask(FieldMask.newBuilder().build())
.build();
OperationFuture<Environment, OperationMetadata> future =
environmentsClient.updateEnvironmentOperationCallable().futureCall(request);
// Do something.
Environment response = future.get();
}
public final com.google.api.gax.rpc.UnaryCallable<UpdateEnvironmentRequest,com.google.longrunning.Operation> updateEnvironmentCallable()
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 (EnvironmentsClient environmentsClient = EnvironmentsClient.create()) {
UpdateEnvironmentRequest request =
UpdateEnvironmentRequest.newBuilder()
.setName("name3373707")
.setEnvironment(Environment.newBuilder().build())
.setUpdateMask(FieldMask.newBuilder().build())
.build();
ApiFuture<Operation> future =
environmentsClient.updateEnvironmentCallable().futureCall(request);
// Do something.
Operation response = future.get();
}
public final com.google.api.gax.longrunning.OperationFuture<com.google.protobuf.Empty,OperationMetadata> deleteEnvironmentAsync(String name)
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 (EnvironmentsClient environmentsClient = EnvironmentsClient.create()) {
String name = "name3373707";
environmentsClient.deleteEnvironmentAsync(name).get();
}
name - The environment to delete, in the form:
"projects/{projectId}/locations/{locationId}/environments/{environmentId}"com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.longrunning.OperationFuture<com.google.protobuf.Empty,OperationMetadata> deleteEnvironmentAsync(DeleteEnvironmentRequest request)
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 (EnvironmentsClient environmentsClient = EnvironmentsClient.create()) {
DeleteEnvironmentRequest request =
DeleteEnvironmentRequest.newBuilder().setName("name3373707").build();
environmentsClient.deleteEnvironmentAsync(request).get();
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.OperationCallable<DeleteEnvironmentRequest,com.google.protobuf.Empty,OperationMetadata> deleteEnvironmentOperationCallable()
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 (EnvironmentsClient environmentsClient = EnvironmentsClient.create()) {
DeleteEnvironmentRequest request =
DeleteEnvironmentRequest.newBuilder().setName("name3373707").build();
OperationFuture<Empty, OperationMetadata> future =
environmentsClient.deleteEnvironmentOperationCallable().futureCall(request);
// Do something.
future.get();
}
public final com.google.api.gax.rpc.UnaryCallable<DeleteEnvironmentRequest,com.google.longrunning.Operation> deleteEnvironmentCallable()
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 (EnvironmentsClient environmentsClient = EnvironmentsClient.create()) {
DeleteEnvironmentRequest request =
DeleteEnvironmentRequest.newBuilder().setName("name3373707").build();
ApiFuture<Operation> future =
environmentsClient.deleteEnvironmentCallable().futureCall(request);
// Do something.
future.get();
}
public final com.google.api.gax.longrunning.OperationFuture<Environment,OperationMetadata> restartWebServerAsync(RestartWebServerRequest request)
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 (EnvironmentsClient environmentsClient = EnvironmentsClient.create()) {
RestartWebServerRequest request =
RestartWebServerRequest.newBuilder().setName("name3373707").build();
Environment response = environmentsClient.restartWebServerAsync(request).get();
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.OperationCallable<RestartWebServerRequest,Environment,OperationMetadata> restartWebServerOperationCallable()
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 (EnvironmentsClient environmentsClient = EnvironmentsClient.create()) {
RestartWebServerRequest request =
RestartWebServerRequest.newBuilder().setName("name3373707").build();
OperationFuture<Environment, OperationMetadata> future =
environmentsClient.restartWebServerOperationCallable().futureCall(request);
// Do something.
Environment response = future.get();
}
public final com.google.api.gax.rpc.UnaryCallable<RestartWebServerRequest,com.google.longrunning.Operation> restartWebServerCallable()
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 (EnvironmentsClient environmentsClient = EnvironmentsClient.create()) {
RestartWebServerRequest request =
RestartWebServerRequest.newBuilder().setName("name3373707").build();
ApiFuture<Operation> future =
environmentsClient.restartWebServerCallable().futureCall(request);
// Do something.
Operation response = future.get();
}
public final com.google.api.gax.longrunning.OperationFuture<CheckUpgradeResponse,OperationMetadata> checkUpgradeAsync(CheckUpgradeRequest request)
In case of problems detailed info can be found in the returned Operation.
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 (EnvironmentsClient environmentsClient = EnvironmentsClient.create()) {
CheckUpgradeRequest request =
CheckUpgradeRequest.newBuilder()
.setEnvironment("environment-85904877")
.setImageVersion("imageVersion949870333")
.build();
CheckUpgradeResponse response = environmentsClient.checkUpgradeAsync(request).get();
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.OperationCallable<CheckUpgradeRequest,CheckUpgradeResponse,OperationMetadata> checkUpgradeOperationCallable()
In case of problems detailed info can be found in the returned Operation.
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 (EnvironmentsClient environmentsClient = EnvironmentsClient.create()) {
CheckUpgradeRequest request =
CheckUpgradeRequest.newBuilder()
.setEnvironment("environment-85904877")
.setImageVersion("imageVersion949870333")
.build();
OperationFuture<CheckUpgradeResponse, OperationMetadata> future =
environmentsClient.checkUpgradeOperationCallable().futureCall(request);
// Do something.
CheckUpgradeResponse response = future.get();
}
public final com.google.api.gax.rpc.UnaryCallable<CheckUpgradeRequest,com.google.longrunning.Operation> checkUpgradeCallable()
In case of problems detailed info can be found in the returned Operation.
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 (EnvironmentsClient environmentsClient = EnvironmentsClient.create()) {
CheckUpgradeRequest request =
CheckUpgradeRequest.newBuilder()
.setEnvironment("environment-85904877")
.setImageVersion("imageVersion949870333")
.build();
ApiFuture<Operation> future = environmentsClient.checkUpgradeCallable().futureCall(request);
// Do something.
Operation response = future.get();
}
public final ExecuteAirflowCommandResponse executeAirflowCommand(ExecuteAirflowCommandRequest request)
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 (EnvironmentsClient environmentsClient = EnvironmentsClient.create()) {
ExecuteAirflowCommandRequest request =
ExecuteAirflowCommandRequest.newBuilder()
.setEnvironment("environment-85904877")
.setCommand("command950394699")
.setSubcommand("subcommand2099091723")
.addAllParameters(new ArrayList<String>())
.build();
ExecuteAirflowCommandResponse response = environmentsClient.executeAirflowCommand(request);
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<ExecuteAirflowCommandRequest,ExecuteAirflowCommandResponse> executeAirflowCommandCallable()
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 (EnvironmentsClient environmentsClient = EnvironmentsClient.create()) {
ExecuteAirflowCommandRequest request =
ExecuteAirflowCommandRequest.newBuilder()
.setEnvironment("environment-85904877")
.setCommand("command950394699")
.setSubcommand("subcommand2099091723")
.addAllParameters(new ArrayList<String>())
.build();
ApiFuture<ExecuteAirflowCommandResponse> future =
environmentsClient.executeAirflowCommandCallable().futureCall(request);
// Do something.
ExecuteAirflowCommandResponse response = future.get();
}
public final StopAirflowCommandResponse stopAirflowCommand(StopAirflowCommandRequest request)
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 (EnvironmentsClient environmentsClient = EnvironmentsClient.create()) {
StopAirflowCommandRequest request =
StopAirflowCommandRequest.newBuilder()
.setEnvironment("environment-85904877")
.setExecutionId("executionId-454906285")
.setPod("pod111173")
.setPodNamespace("podNamespace463962262")
.setForce(true)
.build();
StopAirflowCommandResponse response = environmentsClient.stopAirflowCommand(request);
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<StopAirflowCommandRequest,StopAirflowCommandResponse> stopAirflowCommandCallable()
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 (EnvironmentsClient environmentsClient = EnvironmentsClient.create()) {
StopAirflowCommandRequest request =
StopAirflowCommandRequest.newBuilder()
.setEnvironment("environment-85904877")
.setExecutionId("executionId-454906285")
.setPod("pod111173")
.setPodNamespace("podNamespace463962262")
.setForce(true)
.build();
ApiFuture<StopAirflowCommandResponse> future =
environmentsClient.stopAirflowCommandCallable().futureCall(request);
// Do something.
StopAirflowCommandResponse response = future.get();
}
public final PollAirflowCommandResponse pollAirflowCommand(PollAirflowCommandRequest request)
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 (EnvironmentsClient environmentsClient = EnvironmentsClient.create()) {
PollAirflowCommandRequest request =
PollAirflowCommandRequest.newBuilder()
.setEnvironment("environment-85904877")
.setExecutionId("executionId-454906285")
.setPod("pod111173")
.setPodNamespace("podNamespace463962262")
.setNextLineNumber(1176642216)
.build();
PollAirflowCommandResponse response = environmentsClient.pollAirflowCommand(request);
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<PollAirflowCommandRequest,PollAirflowCommandResponse> pollAirflowCommandCallable()
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 (EnvironmentsClient environmentsClient = EnvironmentsClient.create()) {
PollAirflowCommandRequest request =
PollAirflowCommandRequest.newBuilder()
.setEnvironment("environment-85904877")
.setExecutionId("executionId-454906285")
.setPod("pod111173")
.setPodNamespace("podNamespace463962262")
.setNextLineNumber(1176642216)
.build();
ApiFuture<PollAirflowCommandResponse> future =
environmentsClient.pollAirflowCommandCallable().futureCall(request);
// Do something.
PollAirflowCommandResponse response = future.get();
}
public final com.google.api.gax.longrunning.OperationFuture<SaveSnapshotResponse,OperationMetadata> saveSnapshotAsync(SaveSnapshotRequest request)
As a result of this operation, snapshot of environment's state is stored in a location specified in the SaveSnapshotRequest.
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 (EnvironmentsClient environmentsClient = EnvironmentsClient.create()) {
SaveSnapshotRequest request =
SaveSnapshotRequest.newBuilder()
.setEnvironment("environment-85904877")
.setSnapshotLocation("snapshotLocation1625609625")
.build();
SaveSnapshotResponse response = environmentsClient.saveSnapshotAsync(request).get();
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.OperationCallable<SaveSnapshotRequest,SaveSnapshotResponse,OperationMetadata> saveSnapshotOperationCallable()
As a result of this operation, snapshot of environment's state is stored in a location specified in the SaveSnapshotRequest.
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 (EnvironmentsClient environmentsClient = EnvironmentsClient.create()) {
SaveSnapshotRequest request =
SaveSnapshotRequest.newBuilder()
.setEnvironment("environment-85904877")
.setSnapshotLocation("snapshotLocation1625609625")
.build();
OperationFuture<SaveSnapshotResponse, OperationMetadata> future =
environmentsClient.saveSnapshotOperationCallable().futureCall(request);
// Do something.
SaveSnapshotResponse response = future.get();
}
public final com.google.api.gax.rpc.UnaryCallable<SaveSnapshotRequest,com.google.longrunning.Operation> saveSnapshotCallable()
As a result of this operation, snapshot of environment's state is stored in a location specified in the SaveSnapshotRequest.
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 (EnvironmentsClient environmentsClient = EnvironmentsClient.create()) {
SaveSnapshotRequest request =
SaveSnapshotRequest.newBuilder()
.setEnvironment("environment-85904877")
.setSnapshotLocation("snapshotLocation1625609625")
.build();
ApiFuture<Operation> future = environmentsClient.saveSnapshotCallable().futureCall(request);
// Do something.
Operation response = future.get();
}
public final com.google.api.gax.longrunning.OperationFuture<LoadSnapshotResponse,OperationMetadata> loadSnapshotAsync(LoadSnapshotRequest request)
As a result of this operation, a snapshot of environment's specified in LoadSnapshotRequest is loaded into the environment.
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 (EnvironmentsClient environmentsClient = EnvironmentsClient.create()) {
LoadSnapshotRequest request =
LoadSnapshotRequest.newBuilder()
.setEnvironment("environment-85904877")
.setSnapshotPath("snapshotPath-931648503")
.setSkipPypiPackagesInstallation(true)
.setSkipEnvironmentVariablesSetting(true)
.setSkipAirflowOverridesSetting(true)
.setSkipGcsDataCopying(true)
.build();
LoadSnapshotResponse response = environmentsClient.loadSnapshotAsync(request).get();
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.OperationCallable<LoadSnapshotRequest,LoadSnapshotResponse,OperationMetadata> loadSnapshotOperationCallable()
As a result of this operation, a snapshot of environment's specified in LoadSnapshotRequest is loaded into the environment.
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 (EnvironmentsClient environmentsClient = EnvironmentsClient.create()) {
LoadSnapshotRequest request =
LoadSnapshotRequest.newBuilder()
.setEnvironment("environment-85904877")
.setSnapshotPath("snapshotPath-931648503")
.setSkipPypiPackagesInstallation(true)
.setSkipEnvironmentVariablesSetting(true)
.setSkipAirflowOverridesSetting(true)
.setSkipGcsDataCopying(true)
.build();
OperationFuture<LoadSnapshotResponse, OperationMetadata> future =
environmentsClient.loadSnapshotOperationCallable().futureCall(request);
// Do something.
LoadSnapshotResponse response = future.get();
}
public final com.google.api.gax.rpc.UnaryCallable<LoadSnapshotRequest,com.google.longrunning.Operation> loadSnapshotCallable()
As a result of this operation, a snapshot of environment's specified in LoadSnapshotRequest is loaded into the environment.
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 (EnvironmentsClient environmentsClient = EnvironmentsClient.create()) {
LoadSnapshotRequest request =
LoadSnapshotRequest.newBuilder()
.setEnvironment("environment-85904877")
.setSnapshotPath("snapshotPath-931648503")
.setSkipPypiPackagesInstallation(true)
.setSkipEnvironmentVariablesSetting(true)
.setSkipAirflowOverridesSetting(true)
.setSkipGcsDataCopying(true)
.build();
ApiFuture<Operation> future = environmentsClient.loadSnapshotCallable().futureCall(request);
// Do something.
Operation response = future.get();
}
public final com.google.api.gax.longrunning.OperationFuture<DatabaseFailoverResponse,OperationMetadata> databaseFailoverAsync(DatabaseFailoverRequest request)
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 (EnvironmentsClient environmentsClient = EnvironmentsClient.create()) {
DatabaseFailoverRequest request =
DatabaseFailoverRequest.newBuilder().setEnvironment("environment-85904877").build();
DatabaseFailoverResponse response = environmentsClient.databaseFailoverAsync(request).get();
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.OperationCallable<DatabaseFailoverRequest,DatabaseFailoverResponse,OperationMetadata> databaseFailoverOperationCallable()
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 (EnvironmentsClient environmentsClient = EnvironmentsClient.create()) {
DatabaseFailoverRequest request =
DatabaseFailoverRequest.newBuilder().setEnvironment("environment-85904877").build();
OperationFuture<DatabaseFailoverResponse, OperationMetadata> future =
environmentsClient.databaseFailoverOperationCallable().futureCall(request);
// Do something.
DatabaseFailoverResponse response = future.get();
}
public final com.google.api.gax.rpc.UnaryCallable<DatabaseFailoverRequest,com.google.longrunning.Operation> databaseFailoverCallable()
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 (EnvironmentsClient environmentsClient = EnvironmentsClient.create()) {
DatabaseFailoverRequest request =
DatabaseFailoverRequest.newBuilder().setEnvironment("environment-85904877").build();
ApiFuture<Operation> future =
environmentsClient.databaseFailoverCallable().futureCall(request);
// Do something.
Operation response = future.get();
}
public final FetchDatabasePropertiesResponse fetchDatabaseProperties(FetchDatabasePropertiesRequest request)
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 (EnvironmentsClient environmentsClient = EnvironmentsClient.create()) {
FetchDatabasePropertiesRequest request =
FetchDatabasePropertiesRequest.newBuilder()
.setEnvironment(
EnvironmentName.of("[PROJECT]", "[LOCATION]", "[ENVIRONMENT]").toString())
.build();
FetchDatabasePropertiesResponse response =
environmentsClient.fetchDatabaseProperties(request);
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<FetchDatabasePropertiesRequest,FetchDatabasePropertiesResponse> fetchDatabasePropertiesCallable()
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 (EnvironmentsClient environmentsClient = EnvironmentsClient.create()) {
FetchDatabasePropertiesRequest request =
FetchDatabasePropertiesRequest.newBuilder()
.setEnvironment(
EnvironmentName.of("[PROJECT]", "[LOCATION]", "[ENVIRONMENT]").toString())
.build();
ApiFuture<FetchDatabasePropertiesResponse> future =
environmentsClient.fetchDatabasePropertiesCallable().futureCall(request);
// Do something.
FetchDatabasePropertiesResponse response = future.get();
}
public final void close()
close in interface AutoCloseablepublic void shutdown()
shutdown in interface com.google.api.gax.core.BackgroundResourcepublic boolean isShutdown()
isShutdown in interface com.google.api.gax.core.BackgroundResourcepublic boolean isTerminated()
isTerminated in interface com.google.api.gax.core.BackgroundResourcepublic void shutdownNow()
shutdownNow in interface com.google.api.gax.core.BackgroundResourcepublic boolean awaitTermination(long duration,
TimeUnit unit)
throws InterruptedException
awaitTermination in interface com.google.api.gax.core.BackgroundResourceInterruptedExceptionCopyright © 2023 Google LLC. All rights reserved.