- 1.55.0 (latest)
- 1.54.0
- 1.53.0
- 1.52.0
- 1.51.0
- 1.49.0
- 1.48.0
- 1.47.0
- 1.46.0
- 1.45.0
- 1.44.0
- 1.43.0
- 1.42.0
- 1.41.0
- 1.40.0
- 1.39.0
- 1.37.0
- 1.36.0
- 1.35.0
- 1.34.0
- 1.33.0
- 1.32.0
- 1.31.0
- 1.30.0
- 1.29.0
- 1.28.0
- 1.27.0
- 1.24.0
- 1.23.0
- 1.22.0
- 1.21.0
- 1.20.0
- 1.19.0
- 1.18.0
- 1.17.0
- 1.16.0
- 1.15.0
- 1.14.0
- 1.13.0
- 1.12.0
- 1.11.0
- 1.9.0
- 1.8.0
- 1.7.0
- 1.6.0
- 1.5.0
- 1.4.0
public class EnvironmentsClient implements BackgroundResource
Service Description: Managed Apache Airflow Environments.
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:
- A "flattened" method. With this type of method, the fields of the request type have been converted into function parameters. It may be the case that not all fields are available as parameters, and not every API method will have a flattened method entry point.
- A "request object" method. This type of method only takes one parameter, a request object, which must be constructed before the call. Not every API method will have a request object method.
- A "callable" method. This type of method takes no parameters and returns 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 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.
Implements
BackgroundResourceStatic Methods
create()
public static final EnvironmentsClient create()
Constructs an instance of EnvironmentsClient with default settings.
Type | Description |
EnvironmentsClient |
Type | Description |
IOException |
create(EnvironmentsSettings settings)
public static final EnvironmentsClient create(EnvironmentsSettings settings)
Constructs an instance of EnvironmentsClient, using the given settings. The channels are created based on the settings passed in, or defaults for any settings that are not set.
Name | Description |
settings |
EnvironmentsSettings |
Type | Description |
EnvironmentsClient |
Type | Description |
IOException |
create(EnvironmentsStub stub)
public static final EnvironmentsClient create(EnvironmentsStub stub)
Constructs an instance of EnvironmentsClient, using the given stub for making calls. This is for advanced usage - prefer using create(EnvironmentsSettings).
Name | Description |
stub |
EnvironmentsStub |
Type | Description |
EnvironmentsClient |
Constructors
EnvironmentsClient(EnvironmentsSettings settings)
protected EnvironmentsClient(EnvironmentsSettings settings)
Constructs an instance of EnvironmentsClient, 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.
Name | Description |
settings |
EnvironmentsSettings |
EnvironmentsClient(EnvironmentsStub stub)
protected EnvironmentsClient(EnvironmentsStub stub)
Name | Description |
stub |
EnvironmentsStub |
Methods
awaitTermination(long duration, TimeUnit unit)
public boolean awaitTermination(long duration, TimeUnit unit)
Name | Description |
duration |
long |
unit |
TimeUnit |
Type | Description |
boolean |
Type | Description |
InterruptedException |
close()
public final void close()
createEnvironmentAsync(CreateEnvironmentRequest request)
public final OperationFuture<Environment,OperationMetadata> createEnvironmentAsync(CreateEnvironmentRequest request)
Create a new 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()) {
CreateEnvironmentRequest request =
CreateEnvironmentRequest.newBuilder()
.setParent("parent-995424086")
.setEnvironment(Environment.newBuilder().build())
.build();
Environment response = environmentsClient.createEnvironmentAsync(request).get();
}
Name | Description |
request |
CreateEnvironmentRequest The request object containing all of the parameters for the API call. |
Type | Description |
OperationFuture<Environment,OperationMetadata> |
createEnvironmentAsync(String parent, Environment environment)
public final OperationFuture<Environment,OperationMetadata> createEnvironmentAsync(String parent, Environment environment)
Create a new 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();
}
Name | Description |
parent |
String The parent must be of the form "projects/{projectId}/locations/{locationId}". |
environment |
Environment The environment to create. |
Type | Description |
OperationFuture<Environment,OperationMetadata> |
createEnvironmentCallable()
public final UnaryCallable<CreateEnvironmentRequest,Operation> createEnvironmentCallable()
Create a new 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()) {
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();
}
Type | Description |
UnaryCallable<CreateEnvironmentRequest,Operation> |
createEnvironmentOperationCallable()
public final OperationCallable<CreateEnvironmentRequest,Environment,OperationMetadata> createEnvironmentOperationCallable()
Create a new 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()) {
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();
}
Type | Description |
OperationCallable<CreateEnvironmentRequest,Environment,OperationMetadata> |
deleteEnvironmentAsync(DeleteEnvironmentRequest request)
public final OperationFuture<Empty,OperationMetadata> deleteEnvironmentAsync(DeleteEnvironmentRequest request)
Delete an 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()) {
DeleteEnvironmentRequest request =
DeleteEnvironmentRequest.newBuilder().setName("name3373707").build();
environmentsClient.deleteEnvironmentAsync(request).get();
}
Name | Description |
request |
DeleteEnvironmentRequest The request object containing all of the parameters for the API call. |
Type | Description |
OperationFuture<Empty,OperationMetadata> |
deleteEnvironmentAsync(String name)
public final OperationFuture<Empty,OperationMetadata> deleteEnvironmentAsync(String name)
Delete an 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 name = "name3373707";
environmentsClient.deleteEnvironmentAsync(name).get();
}
Name | Description |
name |
String The environment to delete, in the form: "projects/{projectId}/locations/{locationId}/environments/{environmentId}" |
Type | Description |
OperationFuture<Empty,OperationMetadata> |
deleteEnvironmentCallable()
public final UnaryCallable<DeleteEnvironmentRequest,Operation> deleteEnvironmentCallable()
Delete an 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()) {
DeleteEnvironmentRequest request =
DeleteEnvironmentRequest.newBuilder().setName("name3373707").build();
ApiFuture<Operation> future =
environmentsClient.deleteEnvironmentCallable().futureCall(request);
// Do something.
future.get();
}
Type | Description |
UnaryCallable<DeleteEnvironmentRequest,Operation> |
deleteEnvironmentOperationCallable()
public final OperationCallable<DeleteEnvironmentRequest,Empty,OperationMetadata> deleteEnvironmentOperationCallable()
Delete an 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()) {
DeleteEnvironmentRequest request =
DeleteEnvironmentRequest.newBuilder().setName("name3373707").build();
OperationFuture<Empty, OperationMetadata> future =
environmentsClient.deleteEnvironmentOperationCallable().futureCall(request);
// Do something.
future.get();
}
Type | Description |
OperationCallable<DeleteEnvironmentRequest,Empty,OperationMetadata> |
getEnvironment(GetEnvironmentRequest request)
public final Environment getEnvironment(GetEnvironmentRequest request)
Get an existing 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()) {
GetEnvironmentRequest request =
GetEnvironmentRequest.newBuilder().setName("name3373707").build();
Environment response = environmentsClient.getEnvironment(request);
}
Name | Description |
request |
GetEnvironmentRequest The request object containing all of the parameters for the API call. |
Type | Description |
Environment |
getEnvironment(String name)
public final Environment getEnvironment(String name)
Get an existing 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 name = "name3373707";
Environment response = environmentsClient.getEnvironment(name);
}
Name | Description |
name |
String The resource name of the environment to get, in the form: "projects/{projectId}/locations/{locationId}/environments/{environmentId}" |
Type | Description |
Environment |
getEnvironmentCallable()
public final UnaryCallable<GetEnvironmentRequest,Environment> getEnvironmentCallable()
Get an existing 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()) {
GetEnvironmentRequest request =
GetEnvironmentRequest.newBuilder().setName("name3373707").build();
ApiFuture<Environment> future =
environmentsClient.getEnvironmentCallable().futureCall(request);
// Do something.
Environment response = future.get();
}
Type | Description |
UnaryCallable<GetEnvironmentRequest,Environment> |
getHttpJsonOperationsClient()
public final OperationsClient getHttpJsonOperationsClient()
Returns the OperationsClient that can be used to query the status of a long-running operation returned by another API method call.
Type | Description |
OperationsClient |
getOperationsClient()
public final OperationsClient getOperationsClient()
Returns the OperationsClient that can be used to query the status of a long-running operation returned by another API method call.
Type | Description |
OperationsClient |
getSettings()
public final EnvironmentsSettings getSettings()
Type | Description |
EnvironmentsSettings |
getStub()
public EnvironmentsStub getStub()
Type | Description |
EnvironmentsStub |
isShutdown()
public boolean isShutdown()
Type | Description |
boolean |
isTerminated()
public boolean isTerminated()
Type | Description |
boolean |
listEnvironments(ListEnvironmentsRequest request)
public final EnvironmentsClient.ListEnvironmentsPagedResponse listEnvironments(ListEnvironmentsRequest request)
List environments.
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);
}
}
Name | Description |
request |
ListEnvironmentsRequest The request object containing all of the parameters for the API call. |
Type | Description |
EnvironmentsClient.ListEnvironmentsPagedResponse |
listEnvironments(String parent)
public final EnvironmentsClient.ListEnvironmentsPagedResponse listEnvironments(String parent)
List environments.
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);
}
}
Name | Description |
parent |
String List environments in the given project and location, in the form: "projects/{projectId}/locations/{locationId}" |
Type | Description |
EnvironmentsClient.ListEnvironmentsPagedResponse |
listEnvironmentsCallable()
public final UnaryCallable<ListEnvironmentsRequest,ListEnvironmentsResponse> listEnvironmentsCallable()
List environments.
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;
}
}
}
Type | Description |
UnaryCallable<ListEnvironmentsRequest,ListEnvironmentsResponse> |
listEnvironmentsPagedCallable()
public final UnaryCallable<ListEnvironmentsRequest,EnvironmentsClient.ListEnvironmentsPagedResponse> listEnvironmentsPagedCallable()
List environments.
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);
}
}
Type | Description |
UnaryCallable<ListEnvironmentsRequest,ListEnvironmentsPagedResponse> |
loadSnapshotAsync(LoadSnapshotRequest request)
public final OperationFuture<LoadSnapshotResponse,OperationMetadata> loadSnapshotAsync(LoadSnapshotRequest request)
Loads a snapshot of a Cloud Composer environment.
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();
}
Name | Description |
request |
LoadSnapshotRequest The request object containing all of the parameters for the API call. |
Type | Description |
OperationFuture<LoadSnapshotResponse,OperationMetadata> |
loadSnapshotCallable()
public final UnaryCallable<LoadSnapshotRequest,Operation> loadSnapshotCallable()
Loads a snapshot of a Cloud Composer environment.
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();
}
Type | Description |
UnaryCallable<LoadSnapshotRequest,Operation> |
loadSnapshotOperationCallable()
public final OperationCallable<LoadSnapshotRequest,LoadSnapshotResponse,OperationMetadata> loadSnapshotOperationCallable()
Loads a snapshot of a Cloud Composer environment.
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();
}
Type | Description |
OperationCallable<LoadSnapshotRequest,LoadSnapshotResponse,OperationMetadata> |
saveSnapshotAsync(SaveSnapshotRequest request)
public final OperationFuture<SaveSnapshotResponse,OperationMetadata> saveSnapshotAsync(SaveSnapshotRequest request)
Creates a snapshots of a Cloud Composer environment.
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();
}
Name | Description |
request |
SaveSnapshotRequest The request object containing all of the parameters for the API call. |
Type | Description |
OperationFuture<SaveSnapshotResponse,OperationMetadata> |
saveSnapshotCallable()
public final UnaryCallable<SaveSnapshotRequest,Operation> saveSnapshotCallable()
Creates a snapshots of a Cloud Composer environment.
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();
}
Type | Description |
UnaryCallable<SaveSnapshotRequest,Operation> |
saveSnapshotOperationCallable()
public final OperationCallable<SaveSnapshotRequest,SaveSnapshotResponse,OperationMetadata> saveSnapshotOperationCallable()
Creates a snapshots of a Cloud Composer environment.
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();
}
Type | Description |
OperationCallable<SaveSnapshotRequest,SaveSnapshotResponse,OperationMetadata> |
shutdown()
public void shutdown()
shutdownNow()
public void shutdownNow()
updateEnvironmentAsync(UpdateEnvironmentRequest request)
public final OperationFuture<Environment,OperationMetadata> updateEnvironmentAsync(UpdateEnvironmentRequest request)
Update an 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()) {
UpdateEnvironmentRequest request =
UpdateEnvironmentRequest.newBuilder()
.setName("name3373707")
.setEnvironment(Environment.newBuilder().build())
.setUpdateMask(FieldMask.newBuilder().build())
.build();
Environment response = environmentsClient.updateEnvironmentAsync(request).get();
}
Name | Description |
request |
UpdateEnvironmentRequest The request object containing all of the parameters for the API call. |
Type | Description |
OperationFuture<Environment,OperationMetadata> |
updateEnvironmentAsync(String name, Environment environment, FieldMask updateMask)
public final OperationFuture<Environment,OperationMetadata> updateEnvironmentAsync(String name, Environment environment, FieldMask updateMask)
Update an 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 name = "name3373707";
Environment environment = Environment.newBuilder().build();
FieldMask updateMask = FieldMask.newBuilder().build();
Environment response =
environmentsClient.updateEnvironmentAsync(name, environment, updateMask).get();
}
Name | Description |
name |
String The relative resource name of the environment to update, in the form: "projects/{projectId}/locations/{locationId}/environments/{environmentId}" |
environment |
Environment A patch environment. Fields specified by the |
updateMask |
FieldMask Required. A comma-separated list of paths, relative to { "config":{ "softwareConfig":{ "pypiPackages":{ "scikit-learn":"==0.19.0" } } } } Note that in the above example, any existing PyPI packages other than scikit-learn and numpy will be unaffected. Only one update type may be included in a single request's { "labels":{ "label1":"new-label1-value" "label2":"new-label2-value" } } Note that in the above example, any existing labels that are not included in the
It is also possible to replace an entire map field by providing the map field's path in
the { "config":{ "softwareConfig":{ "pypiPackages":{ "botocore":"==1.7.14" } } } } **Note:** Only the following fields can be updated:
|
Type | Description |
OperationFuture<Environment,OperationMetadata> |
updateEnvironmentCallable()
public final UnaryCallable<UpdateEnvironmentRequest,Operation> updateEnvironmentCallable()
Update an 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()) {
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();
}
Type | Description |
UnaryCallable<UpdateEnvironmentRequest,Operation> |
updateEnvironmentOperationCallable()
public final OperationCallable<UpdateEnvironmentRequest,Environment,OperationMetadata> updateEnvironmentOperationCallable()
Update an 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()) {
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();
}
Type | Description |
OperationCallable<UpdateEnvironmentRequest,Environment,OperationMetadata> |