Class EnvironmentsClient (1.42.0)

GitHub RepositoryProduct ReferenceREST DocumentationRPC Documentation

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().

Methods
Method Description Method Variants

CreateEnvironment

Create a new environment.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • createEnvironmentAsync(CreateEnvironmentRequest request)

Methods that return long-running operations have "Async" method variants that return OperationFuture, which is used to track polling of the service.

  • createEnvironmentAsync(String parent, Environment environment)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • createEnvironmentOperationCallable()

  • createEnvironmentCallable()

GetEnvironment

Get an existing environment.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • getEnvironment(GetEnvironmentRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • getEnvironment(String name)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • getEnvironmentCallable()

ListEnvironments

List environments.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • listEnvironments(ListEnvironmentsRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • listEnvironments(String parent)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • listEnvironmentsPagedCallable()

  • listEnvironmentsCallable()

UpdateEnvironment

Update an environment.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • updateEnvironmentAsync(UpdateEnvironmentRequest request)

Methods that return long-running operations have "Async" method variants that return OperationFuture, which is used to track polling of the service.

  • updateEnvironmentAsync(String name, Environment environment, FieldMask updateMask)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • updateEnvironmentOperationCallable()

  • updateEnvironmentCallable()

DeleteEnvironment

Delete an environment.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • deleteEnvironmentAsync(DeleteEnvironmentRequest request)

Methods that return long-running operations have "Async" method variants that return OperationFuture, which is used to track polling of the service.

  • deleteEnvironmentAsync(String name)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • deleteEnvironmentOperationCallable()

  • deleteEnvironmentCallable()

ExecuteAirflowCommand

Executes Airflow CLI command.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • executeAirflowCommand(ExecuteAirflowCommandRequest request)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • executeAirflowCommandCallable()

StopAirflowCommand

Stops Airflow CLI command execution.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • stopAirflowCommand(StopAirflowCommandRequest request)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • stopAirflowCommandCallable()

PollAirflowCommand

Polls Airflow CLI command execution and fetches logs.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • pollAirflowCommand(PollAirflowCommandRequest request)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • pollAirflowCommandCallable()

ListWorkloads

Lists workloads in a Cloud Composer environment. Workload is a unit that runs a single Composer component.

This method is supported for Cloud Composer environments in versions composer-3.*.*-airflow-*.*.* and newer.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • listWorkloads(ListWorkloadsRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • listWorkloads(EnvironmentName parent)

  • listWorkloads(String parent)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • listWorkloadsPagedCallable()

  • listWorkloadsCallable()

CreateUserWorkloadsSecret

Creates a user workloads Secret.

This method is supported for Cloud Composer environments in versions composer-3.*.*-airflow-*.*.* and newer.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • createUserWorkloadsSecret(CreateUserWorkloadsSecretRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • createUserWorkloadsSecret(EnvironmentName parent, UserWorkloadsSecret userWorkloadsSecret)

  • createUserWorkloadsSecret(String parent, UserWorkloadsSecret userWorkloadsSecret)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • createUserWorkloadsSecretCallable()

GetUserWorkloadsSecret

Gets an existing user workloads Secret. Values of the "data" field in the response are cleared.

This method is supported for Cloud Composer environments in versions composer-3.*.*-airflow-*.*.* and newer.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • getUserWorkloadsSecret(GetUserWorkloadsSecretRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • getUserWorkloadsSecret(UserWorkloadsSecretName name)

  • getUserWorkloadsSecret(String name)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • getUserWorkloadsSecretCallable()

ListUserWorkloadsSecrets

Lists user workloads Secrets.

This method is supported for Cloud Composer environments in versions composer-3.*.*-airflow-*.*.* and newer.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • listUserWorkloadsSecrets(ListUserWorkloadsSecretsRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • listUserWorkloadsSecrets(EnvironmentName parent)

  • listUserWorkloadsSecrets(String parent)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • listUserWorkloadsSecretsPagedCallable()

  • listUserWorkloadsSecretsCallable()

UpdateUserWorkloadsSecret

Updates a user workloads Secret.

This method is supported for Cloud Composer environments in versions composer-3.*.*-airflow-*.*.* and newer.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • updateUserWorkloadsSecret(UpdateUserWorkloadsSecretRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • updateUserWorkloadsSecret(UserWorkloadsSecret userWorkloadsSecret)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • updateUserWorkloadsSecretCallable()

DeleteUserWorkloadsSecret

Deletes a user workloads Secret.

This method is supported for Cloud Composer environments in versions composer-3.*.*-airflow-*.*.* and newer.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • deleteUserWorkloadsSecret(DeleteUserWorkloadsSecretRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • deleteUserWorkloadsSecret(UserWorkloadsSecretName name)

  • deleteUserWorkloadsSecret(String name)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • deleteUserWorkloadsSecretCallable()

CreateUserWorkloadsConfigMap

Creates a user workloads ConfigMap.

This method is supported for Cloud Composer environments in versions composer-3.*.*-airflow-*.*.* and newer.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • createUserWorkloadsConfigMap(CreateUserWorkloadsConfigMapRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • createUserWorkloadsConfigMap(EnvironmentName parent, UserWorkloadsConfigMap userWorkloadsConfigMap)

  • createUserWorkloadsConfigMap(String parent, UserWorkloadsConfigMap userWorkloadsConfigMap)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • createUserWorkloadsConfigMapCallable()

GetUserWorkloadsConfigMap

Gets an existing user workloads ConfigMap.

This method is supported for Cloud Composer environments in versions composer-3.*.*-airflow-*.*.* and newer.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • getUserWorkloadsConfigMap(GetUserWorkloadsConfigMapRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • getUserWorkloadsConfigMap(UserWorkloadsConfigMapName name)

  • getUserWorkloadsConfigMap(String name)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • getUserWorkloadsConfigMapCallable()

ListUserWorkloadsConfigMaps

Lists user workloads ConfigMaps.

This method is supported for Cloud Composer environments in versions composer-3.*.*-airflow-*.*.* and newer.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • listUserWorkloadsConfigMaps(ListUserWorkloadsConfigMapsRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • listUserWorkloadsConfigMaps(EnvironmentName parent)

  • listUserWorkloadsConfigMaps(String parent)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • listUserWorkloadsConfigMapsPagedCallable()

  • listUserWorkloadsConfigMapsCallable()

UpdateUserWorkloadsConfigMap

Updates a user workloads ConfigMap.

This method is supported for Cloud Composer environments in versions composer-3.*.*-airflow-*.*.* and newer.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • updateUserWorkloadsConfigMap(UpdateUserWorkloadsConfigMapRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • updateUserWorkloadsConfigMap(UserWorkloadsConfigMap userWorkloadsConfigMap)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • updateUserWorkloadsConfigMapCallable()

DeleteUserWorkloadsConfigMap

Deletes a user workloads ConfigMap.

This method is supported for Cloud Composer environments in versions composer-3.*.*-airflow-*.*.* and newer.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • deleteUserWorkloadsConfigMap(DeleteUserWorkloadsConfigMapRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • deleteUserWorkloadsConfigMap(UserWorkloadsConfigMapName name)

  • deleteUserWorkloadsConfigMap(String name)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • deleteUserWorkloadsConfigMapCallable()

SaveSnapshot

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.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • saveSnapshotAsync(SaveSnapshotRequest request)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • saveSnapshotOperationCallable()

  • saveSnapshotCallable()

LoadSnapshot

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.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • loadSnapshotAsync(LoadSnapshotRequest request)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • loadSnapshotOperationCallable()

  • loadSnapshotCallable()

DatabaseFailover

Triggers database failover (only for highly resilient environments).

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • databaseFailoverAsync(DatabaseFailoverRequest request)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • databaseFailoverOperationCallable()

  • databaseFailoverCallable()

FetchDatabaseProperties

Fetches database properties.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • fetchDatabaseProperties(FetchDatabasePropertiesRequest request)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • fetchDatabasePropertiesCallable()

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.

Inheritance

java.lang.Object > EnvironmentsClient

Static Methods

create()

public static final EnvironmentsClient create()

Constructs an instance of EnvironmentsClient with default settings.

Returns
Type Description
EnvironmentsClient
Exceptions
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.

Parameter
Name Description
settings EnvironmentsSettings
Returns
Type Description
EnvironmentsClient
Exceptions
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).

Parameter
Name Description
stub EnvironmentsStub
Returns
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.

Parameter
Name Description
settings EnvironmentsSettings

EnvironmentsClient(EnvironmentsStub stub)

protected EnvironmentsClient(EnvironmentsStub stub)
Parameter
Name Description
stub EnvironmentsStub

Methods

awaitTermination(long duration, TimeUnit unit)

public boolean awaitTermination(long duration, TimeUnit unit)
Parameters
Name Description
duration long
unit TimeUnit
Returns
Type Description
boolean
Exceptions
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();
 }
 
Parameter
Name Description
request CreateEnvironmentRequest

The request object containing all of the parameters for the API call.

Returns
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();
 }
 
Parameters
Name Description
parent String

The parent must be of the form "projects/{projectId}/locations/{locationId}".

environment Environment

The environment to create.

Returns
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();
 }
 
Returns
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();
 }
 
Returns
Type Description
OperationCallable<CreateEnvironmentRequest,Environment,OperationMetadata>

createUserWorkloadsConfigMap(CreateUserWorkloadsConfigMapRequest request)

public final UserWorkloadsConfigMap createUserWorkloadsConfigMap(CreateUserWorkloadsConfigMapRequest request)

Creates a user workloads ConfigMap.

This method is supported for Cloud Composer environments in versions composer-3.*.*-airflow-*.*.* and newer.

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()) {
   CreateUserWorkloadsConfigMapRequest request =
       CreateUserWorkloadsConfigMapRequest.newBuilder()
           .setParent(EnvironmentName.of("[PROJECT]", "[LOCATION]", "[ENVIRONMENT]").toString())
           .setUserWorkloadsConfigMap(UserWorkloadsConfigMap.newBuilder().build())
           .build();
   UserWorkloadsConfigMap response = environmentsClient.createUserWorkloadsConfigMap(request);
 }
 
Parameter
Name Description
request CreateUserWorkloadsConfigMapRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
UserWorkloadsConfigMap

createUserWorkloadsConfigMap(EnvironmentName parent, UserWorkloadsConfigMap userWorkloadsConfigMap)

public final UserWorkloadsConfigMap createUserWorkloadsConfigMap(EnvironmentName parent, UserWorkloadsConfigMap userWorkloadsConfigMap)

Creates a user workloads ConfigMap.

This method is supported for Cloud Composer environments in versions composer-3.*.*-airflow-*.*.* and newer.

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()) {
   EnvironmentName parent = EnvironmentName.of("[PROJECT]", "[LOCATION]", "[ENVIRONMENT]");
   UserWorkloadsConfigMap userWorkloadsConfigMap = UserWorkloadsConfigMap.newBuilder().build();
   UserWorkloadsConfigMap response =
       environmentsClient.createUserWorkloadsConfigMap(parent, userWorkloadsConfigMap);
 }
 
Parameters
Name Description
parent EnvironmentName

Required. The environment name to create a ConfigMap for, in the form: "projects/{projectId}/locations/{locationId}/environments/{environmentId}"

userWorkloadsConfigMap UserWorkloadsConfigMap

Required. User workloads ConfigMap to create.

Returns
Type Description
UserWorkloadsConfigMap

createUserWorkloadsConfigMap(String parent, UserWorkloadsConfigMap userWorkloadsConfigMap)

public final UserWorkloadsConfigMap createUserWorkloadsConfigMap(String parent, UserWorkloadsConfigMap userWorkloadsConfigMap)

Creates a user workloads ConfigMap.

This method is supported for Cloud Composer environments in versions composer-3.*.*-airflow-*.*.* and newer.

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 = EnvironmentName.of("[PROJECT]", "[LOCATION]", "[ENVIRONMENT]").toString();
   UserWorkloadsConfigMap userWorkloadsConfigMap = UserWorkloadsConfigMap.newBuilder().build();
   UserWorkloadsConfigMap response =
       environmentsClient.createUserWorkloadsConfigMap(parent, userWorkloadsConfigMap);
 }
 
Parameters
Name Description
parent String

Required. The environment name to create a ConfigMap for, in the form: "projects/{projectId}/locations/{locationId}/environments/{environmentId}"

userWorkloadsConfigMap UserWorkloadsConfigMap

Required. User workloads ConfigMap to create.

Returns
Type Description
UserWorkloadsConfigMap

createUserWorkloadsConfigMapCallable()

public final UnaryCallable<CreateUserWorkloadsConfigMapRequest,UserWorkloadsConfigMap> createUserWorkloadsConfigMapCallable()

Creates a user workloads ConfigMap.

This method is supported for Cloud Composer environments in versions composer-3.*.*-airflow-*.*.* and newer.

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()) {
   CreateUserWorkloadsConfigMapRequest request =
       CreateUserWorkloadsConfigMapRequest.newBuilder()
           .setParent(EnvironmentName.of("[PROJECT]", "[LOCATION]", "[ENVIRONMENT]").toString())
           .setUserWorkloadsConfigMap(UserWorkloadsConfigMap.newBuilder().build())
           .build();
   ApiFuture<UserWorkloadsConfigMap> future =
       environmentsClient.createUserWorkloadsConfigMapCallable().futureCall(request);
   // Do something.
   UserWorkloadsConfigMap response = future.get();
 }
 
Returns
Type Description
UnaryCallable<CreateUserWorkloadsConfigMapRequest,UserWorkloadsConfigMap>

createUserWorkloadsSecret(CreateUserWorkloadsSecretRequest request)

public final UserWorkloadsSecret createUserWorkloadsSecret(CreateUserWorkloadsSecretRequest request)

Creates a user workloads Secret.

This method is supported for Cloud Composer environments in versions composer-3.*.*-airflow-*.*.* and newer.

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()) {
   CreateUserWorkloadsSecretRequest request =
       CreateUserWorkloadsSecretRequest.newBuilder()
           .setParent(EnvironmentName.of("[PROJECT]", "[LOCATION]", "[ENVIRONMENT]").toString())
           .setUserWorkloadsSecret(UserWorkloadsSecret.newBuilder().build())
           .build();
   UserWorkloadsSecret response = environmentsClient.createUserWorkloadsSecret(request);
 }
 
Parameter
Name Description
request CreateUserWorkloadsSecretRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
UserWorkloadsSecret

createUserWorkloadsSecret(EnvironmentName parent, UserWorkloadsSecret userWorkloadsSecret)

public final UserWorkloadsSecret createUserWorkloadsSecret(EnvironmentName parent, UserWorkloadsSecret userWorkloadsSecret)

Creates a user workloads Secret.

This method is supported for Cloud Composer environments in versions composer-3.*.*-airflow-*.*.* and newer.

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()) {
   EnvironmentName parent = EnvironmentName.of("[PROJECT]", "[LOCATION]", "[ENVIRONMENT]");
   UserWorkloadsSecret userWorkloadsSecret = UserWorkloadsSecret.newBuilder().build();
   UserWorkloadsSecret response =
       environmentsClient.createUserWorkloadsSecret(parent, userWorkloadsSecret);
 }
 
Parameters
Name Description
parent EnvironmentName

Required. The environment name to create a Secret for, in the form: "projects/{projectId}/locations/{locationId}/environments/{environmentId}"

userWorkloadsSecret UserWorkloadsSecret

Required. User workloads Secret to create.

Returns
Type Description
UserWorkloadsSecret

createUserWorkloadsSecret(String parent, UserWorkloadsSecret userWorkloadsSecret)

public final UserWorkloadsSecret createUserWorkloadsSecret(String parent, UserWorkloadsSecret userWorkloadsSecret)

Creates a user workloads Secret.

This method is supported for Cloud Composer environments in versions composer-3.*.*-airflow-*.*.* and newer.

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 = EnvironmentName.of("[PROJECT]", "[LOCATION]", "[ENVIRONMENT]").toString();
   UserWorkloadsSecret userWorkloadsSecret = UserWorkloadsSecret.newBuilder().build();
   UserWorkloadsSecret response =
       environmentsClient.createUserWorkloadsSecret(parent, userWorkloadsSecret);
 }
 
Parameters
Name Description
parent String

Required. The environment name to create a Secret for, in the form: "projects/{projectId}/locations/{locationId}/environments/{environmentId}"

userWorkloadsSecret UserWorkloadsSecret

Required. User workloads Secret to create.

Returns
Type Description
UserWorkloadsSecret

createUserWorkloadsSecretCallable()

public final UnaryCallable<CreateUserWorkloadsSecretRequest,UserWorkloadsSecret> createUserWorkloadsSecretCallable()

Creates a user workloads Secret.

This method is supported for Cloud Composer environments in versions composer-3.*.*-airflow-*.*.* and newer.

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()) {
   CreateUserWorkloadsSecretRequest request =
       CreateUserWorkloadsSecretRequest.newBuilder()
           .setParent(EnvironmentName.of("[PROJECT]", "[LOCATION]", "[ENVIRONMENT]").toString())
           .setUserWorkloadsSecret(UserWorkloadsSecret.newBuilder().build())
           .build();
   ApiFuture<UserWorkloadsSecret> future =
       environmentsClient.createUserWorkloadsSecretCallable().futureCall(request);
   // Do something.
   UserWorkloadsSecret response = future.get();
 }
 
Returns
Type Description
UnaryCallable<CreateUserWorkloadsSecretRequest,UserWorkloadsSecret>

databaseFailoverAsync(DatabaseFailoverRequest request)

public final OperationFuture<DatabaseFailoverResponse,OperationMetadata> databaseFailoverAsync(DatabaseFailoverRequest request)

Triggers database failover (only for highly resilient 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()) {
   DatabaseFailoverRequest request =
       DatabaseFailoverRequest.newBuilder().setEnvironment("environment-85904877").build();
   DatabaseFailoverResponse response = environmentsClient.databaseFailoverAsync(request).get();
 }
 
Parameter
Name Description
request DatabaseFailoverRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
OperationFuture<DatabaseFailoverResponse,OperationMetadata>

databaseFailoverCallable()

public final UnaryCallable<DatabaseFailoverRequest,Operation> databaseFailoverCallable()

Triggers database failover (only for highly resilient 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()) {
   DatabaseFailoverRequest request =
       DatabaseFailoverRequest.newBuilder().setEnvironment("environment-85904877").build();
   ApiFuture<Operation> future =
       environmentsClient.databaseFailoverCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
Type Description
UnaryCallable<DatabaseFailoverRequest,Operation>

databaseFailoverOperationCallable()

public final OperationCallable<DatabaseFailoverRequest,DatabaseFailoverResponse,OperationMetadata> databaseFailoverOperationCallable()

Triggers database failover (only for highly resilient 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()) {
   DatabaseFailoverRequest request =
       DatabaseFailoverRequest.newBuilder().setEnvironment("environment-85904877").build();
   OperationFuture<DatabaseFailoverResponse, OperationMetadata> future =
       environmentsClient.databaseFailoverOperationCallable().futureCall(request);
   // Do something.
   DatabaseFailoverResponse response = future.get();
 }
 
Returns
Type Description
OperationCallable<DatabaseFailoverRequest,DatabaseFailoverResponse,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();
 }
 
Parameter
Name Description
request DeleteEnvironmentRequest

The request object containing all of the parameters for the API call.

Returns
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();
 }
 
Parameter
Name Description
name String

The environment to delete, in the form: "projects/{projectId}/locations/{locationId}/environments/{environmentId}"

Returns
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();
 }
 
Returns
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();
 }
 
Returns
Type Description
OperationCallable<DeleteEnvironmentRequest,Empty,OperationMetadata>

deleteUserWorkloadsConfigMap(DeleteUserWorkloadsConfigMapRequest request)

public final void deleteUserWorkloadsConfigMap(DeleteUserWorkloadsConfigMapRequest request)

Deletes a user workloads ConfigMap.

This method is supported for Cloud Composer environments in versions composer-3.*.*-airflow-*.*.* and newer.

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()) {
   DeleteUserWorkloadsConfigMapRequest request =
       DeleteUserWorkloadsConfigMapRequest.newBuilder()
           .setName(
               UserWorkloadsConfigMapName.of(
                       "[PROJECT]", "[LOCATION]", "[ENVIRONMENT]", "[USER_WORKLOADS_CONFIG_MAP]")
                   .toString())
           .build();
   environmentsClient.deleteUserWorkloadsConfigMap(request);
 }
 
Parameter
Name Description
request DeleteUserWorkloadsConfigMapRequest

The request object containing all of the parameters for the API call.

deleteUserWorkloadsConfigMap(UserWorkloadsConfigMapName name)

public final void deleteUserWorkloadsConfigMap(UserWorkloadsConfigMapName name)

Deletes a user workloads ConfigMap.

This method is supported for Cloud Composer environments in versions composer-3.*.*-airflow-*.*.* and newer.

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()) {
   UserWorkloadsConfigMapName name =
       UserWorkloadsConfigMapName.of(
           "[PROJECT]", "[LOCATION]", "[ENVIRONMENT]", "[USER_WORKLOADS_CONFIG_MAP]");
   environmentsClient.deleteUserWorkloadsConfigMap(name);
 }
 
Parameter
Name Description
name UserWorkloadsConfigMapName

Required. The ConfigMap to delete, in the form: "projects/{projectId}/locations/{locationId}/environments/{environmentId}/userWorkloadsConfigMaps/{userWorkloadsConfigMapId}"

deleteUserWorkloadsConfigMap(String name)

public final void deleteUserWorkloadsConfigMap(String name)

Deletes a user workloads ConfigMap.

This method is supported for Cloud Composer environments in versions composer-3.*.*-airflow-*.*.* and newer.

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 =
       UserWorkloadsConfigMapName.of(
               "[PROJECT]", "[LOCATION]", "[ENVIRONMENT]", "[USER_WORKLOADS_CONFIG_MAP]")
           .toString();
   environmentsClient.deleteUserWorkloadsConfigMap(name);
 }
 
Parameter
Name Description
name String

Required. The ConfigMap to delete, in the form: "projects/{projectId}/locations/{locationId}/environments/{environmentId}/userWorkloadsConfigMaps/{userWorkloadsConfigMapId}"

deleteUserWorkloadsConfigMapCallable()

public final UnaryCallable<DeleteUserWorkloadsConfigMapRequest,Empty> deleteUserWorkloadsConfigMapCallable()

Deletes a user workloads ConfigMap.

This method is supported for Cloud Composer environments in versions composer-3.*.*-airflow-*.*.* and newer.

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()) {
   DeleteUserWorkloadsConfigMapRequest request =
       DeleteUserWorkloadsConfigMapRequest.newBuilder()
           .setName(
               UserWorkloadsConfigMapName.of(
                       "[PROJECT]", "[LOCATION]", "[ENVIRONMENT]", "[USER_WORKLOADS_CONFIG_MAP]")
                   .toString())
           .build();
   ApiFuture<Empty> future =
       environmentsClient.deleteUserWorkloadsConfigMapCallable().futureCall(request);
   // Do something.
   future.get();
 }
 
Returns
Type Description
UnaryCallable<DeleteUserWorkloadsConfigMapRequest,Empty>

deleteUserWorkloadsSecret(DeleteUserWorkloadsSecretRequest request)

public final void deleteUserWorkloadsSecret(DeleteUserWorkloadsSecretRequest request)

Deletes a user workloads Secret.

This method is supported for Cloud Composer environments in versions composer-3.*.*-airflow-*.*.* and newer.

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()) {
   DeleteUserWorkloadsSecretRequest request =
       DeleteUserWorkloadsSecretRequest.newBuilder()
           .setName(
               UserWorkloadsSecretName.of(
                       "[PROJECT]", "[LOCATION]", "[ENVIRONMENT]", "[USER_WORKLOADS_SECRET]")
                   .toString())
           .build();
   environmentsClient.deleteUserWorkloadsSecret(request);
 }
 
Parameter
Name Description
request DeleteUserWorkloadsSecretRequest

The request object containing all of the parameters for the API call.

deleteUserWorkloadsSecret(UserWorkloadsSecretName name)

public final void deleteUserWorkloadsSecret(UserWorkloadsSecretName name)

Deletes a user workloads Secret.

This method is supported for Cloud Composer environments in versions composer-3.*.*-airflow-*.*.* and newer.

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()) {
   UserWorkloadsSecretName name =
       UserWorkloadsSecretName.of(
           "[PROJECT]", "[LOCATION]", "[ENVIRONMENT]", "[USER_WORKLOADS_SECRET]");
   environmentsClient.deleteUserWorkloadsSecret(name);
 }
 
Parameter
Name Description
name UserWorkloadsSecretName

Required. The Secret to delete, in the form: "projects/{projectId}/locations/{locationId}/environments/{environmentId}/userWorkloadsSecrets/{userWorkloadsSecretId}"

deleteUserWorkloadsSecret(String name)

public final void deleteUserWorkloadsSecret(String name)

Deletes a user workloads Secret.

This method is supported for Cloud Composer environments in versions composer-3.*.*-airflow-*.*.* and newer.

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 =
       UserWorkloadsSecretName.of(
               "[PROJECT]", "[LOCATION]", "[ENVIRONMENT]", "[USER_WORKLOADS_SECRET]")
           .toString();
   environmentsClient.deleteUserWorkloadsSecret(name);
 }
 
Parameter
Name Description
name String

Required. The Secret to delete, in the form: "projects/{projectId}/locations/{locationId}/environments/{environmentId}/userWorkloadsSecrets/{userWorkloadsSecretId}"

deleteUserWorkloadsSecretCallable()

public final UnaryCallable<DeleteUserWorkloadsSecretRequest,Empty> deleteUserWorkloadsSecretCallable()

Deletes a user workloads Secret.

This method is supported for Cloud Composer environments in versions composer-3.*.*-airflow-*.*.* and newer.

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()) {
   DeleteUserWorkloadsSecretRequest request =
       DeleteUserWorkloadsSecretRequest.newBuilder()
           .setName(
               UserWorkloadsSecretName.of(
                       "[PROJECT]", "[LOCATION]", "[ENVIRONMENT]", "[USER_WORKLOADS_SECRET]")
                   .toString())
           .build();
   ApiFuture<Empty> future =
       environmentsClient.deleteUserWorkloadsSecretCallable().futureCall(request);
   // Do something.
   future.get();
 }
 
Returns
Type Description
UnaryCallable<DeleteUserWorkloadsSecretRequest,Empty>

executeAirflowCommand(ExecuteAirflowCommandRequest request)

public final ExecuteAirflowCommandResponse executeAirflowCommand(ExecuteAirflowCommandRequest request)

Executes Airflow CLI command.

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);
 }
 
Parameter
Name Description
request ExecuteAirflowCommandRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
ExecuteAirflowCommandResponse

executeAirflowCommandCallable()

public final UnaryCallable<ExecuteAirflowCommandRequest,ExecuteAirflowCommandResponse> executeAirflowCommandCallable()

Executes Airflow CLI command.

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();
 }
 
Returns
Type Description
UnaryCallable<ExecuteAirflowCommandRequest,ExecuteAirflowCommandResponse>

fetchDatabaseProperties(FetchDatabasePropertiesRequest request)

public final FetchDatabasePropertiesResponse fetchDatabaseProperties(FetchDatabasePropertiesRequest request)

Fetches database properties.

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);
 }
 
Parameter
Name Description
request FetchDatabasePropertiesRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
FetchDatabasePropertiesResponse

fetchDatabasePropertiesCallable()

public final UnaryCallable<FetchDatabasePropertiesRequest,FetchDatabasePropertiesResponse> fetchDatabasePropertiesCallable()

Fetches database properties.

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();
 }
 
Returns
Type Description
UnaryCallable<FetchDatabasePropertiesRequest,FetchDatabasePropertiesResponse>

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);
 }
 
Parameter
Name Description
request GetEnvironmentRequest

The request object containing all of the parameters for the API call.

Returns
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);
 }
 
Parameter
Name Description
name String

The resource name of the environment to get, in the form: "projects/{projectId}/locations/{locationId}/environments/{environmentId}"

Returns
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();
 }
 
Returns
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.

Returns
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.

Returns
Type Description
OperationsClient

getSettings()

public final EnvironmentsSettings getSettings()
Returns
Type Description
EnvironmentsSettings

getStub()

public EnvironmentsStub getStub()
Returns
Type Description
EnvironmentsStub

getUserWorkloadsConfigMap(GetUserWorkloadsConfigMapRequest request)

public final UserWorkloadsConfigMap getUserWorkloadsConfigMap(GetUserWorkloadsConfigMapRequest request)

Gets an existing user workloads ConfigMap.

This method is supported for Cloud Composer environments in versions composer-3.*.*-airflow-*.*.* and newer.

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()) {
   GetUserWorkloadsConfigMapRequest request =
       GetUserWorkloadsConfigMapRequest.newBuilder()
           .setName(
               UserWorkloadsConfigMapName.of(
                       "[PROJECT]", "[LOCATION]", "[ENVIRONMENT]", "[USER_WORKLOADS_CONFIG_MAP]")
                   .toString())
           .build();
   UserWorkloadsConfigMap response = environmentsClient.getUserWorkloadsConfigMap(request);
 }
 
Parameter
Name Description
request GetUserWorkloadsConfigMapRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
UserWorkloadsConfigMap

getUserWorkloadsConfigMap(UserWorkloadsConfigMapName name)

public final UserWorkloadsConfigMap getUserWorkloadsConfigMap(UserWorkloadsConfigMapName name)

Gets an existing user workloads ConfigMap.

This method is supported for Cloud Composer environments in versions composer-3.*.*-airflow-*.*.* and newer.

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()) {
   UserWorkloadsConfigMapName name =
       UserWorkloadsConfigMapName.of(
           "[PROJECT]", "[LOCATION]", "[ENVIRONMENT]", "[USER_WORKLOADS_CONFIG_MAP]");
   UserWorkloadsConfigMap response = environmentsClient.getUserWorkloadsConfigMap(name);
 }
 
Parameter
Name Description
name UserWorkloadsConfigMapName

Required. The resource name of the ConfigMap to get, in the form: "projects/{projectId}/locations/{locationId}/environments/{environmentId}/userWorkloadsConfigMaps/{userWorkloadsConfigMapId}"

Returns
Type Description
UserWorkloadsConfigMap

getUserWorkloadsConfigMap(String name)

public final UserWorkloadsConfigMap getUserWorkloadsConfigMap(String name)

Gets an existing user workloads ConfigMap.

This method is supported for Cloud Composer environments in versions composer-3.*.*-airflow-*.*.* and newer.

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 =
       UserWorkloadsConfigMapName.of(
               "[PROJECT]", "[LOCATION]", "[ENVIRONMENT]", "[USER_WORKLOADS_CONFIG_MAP]")
           .toString();
   UserWorkloadsConfigMap response = environmentsClient.getUserWorkloadsConfigMap(name);
 }
 
Parameter
Name Description
name String

Required. The resource name of the ConfigMap to get, in the form: "projects/{projectId}/locations/{locationId}/environments/{environmentId}/userWorkloadsConfigMaps/{userWorkloadsConfigMapId}"

Returns
Type Description
UserWorkloadsConfigMap

getUserWorkloadsConfigMapCallable()

public final UnaryCallable<GetUserWorkloadsConfigMapRequest,UserWorkloadsConfigMap> getUserWorkloadsConfigMapCallable()

Gets an existing user workloads ConfigMap.

This method is supported for Cloud Composer environments in versions composer-3.*.*-airflow-*.*.* and newer.

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()) {
   GetUserWorkloadsConfigMapRequest request =
       GetUserWorkloadsConfigMapRequest.newBuilder()
           .setName(
               UserWorkloadsConfigMapName.of(
                       "[PROJECT]", "[LOCATION]", "[ENVIRONMENT]", "[USER_WORKLOADS_CONFIG_MAP]")
                   .toString())
           .build();
   ApiFuture<UserWorkloadsConfigMap> future =
       environmentsClient.getUserWorkloadsConfigMapCallable().futureCall(request);
   // Do something.
   UserWorkloadsConfigMap response = future.get();
 }
 
Returns
Type Description
UnaryCallable<GetUserWorkloadsConfigMapRequest,UserWorkloadsConfigMap>

getUserWorkloadsSecret(GetUserWorkloadsSecretRequest request)

public final UserWorkloadsSecret getUserWorkloadsSecret(GetUserWorkloadsSecretRequest request)

Gets an existing user workloads Secret. Values of the "data" field in the response are cleared.

This method is supported for Cloud Composer environments in versions composer-3.*.*-airflow-*.*.* and newer.

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()) {
   GetUserWorkloadsSecretRequest request =
       GetUserWorkloadsSecretRequest.newBuilder()
           .setName(
               UserWorkloadsSecretName.of(
                       "[PROJECT]", "[LOCATION]", "[ENVIRONMENT]", "[USER_WORKLOADS_SECRET]")
                   .toString())
           .build();
   UserWorkloadsSecret response = environmentsClient.getUserWorkloadsSecret(request);
 }
 
Parameter
Name Description
request GetUserWorkloadsSecretRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
UserWorkloadsSecret

getUserWorkloadsSecret(UserWorkloadsSecretName name)

public final UserWorkloadsSecret getUserWorkloadsSecret(UserWorkloadsSecretName name)

Gets an existing user workloads Secret. Values of the "data" field in the response are cleared.

This method is supported for Cloud Composer environments in versions composer-3.*.*-airflow-*.*.* and newer.

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()) {
   UserWorkloadsSecretName name =
       UserWorkloadsSecretName.of(
           "[PROJECT]", "[LOCATION]", "[ENVIRONMENT]", "[USER_WORKLOADS_SECRET]");
   UserWorkloadsSecret response = environmentsClient.getUserWorkloadsSecret(name);
 }
 
Parameter
Name Description
name UserWorkloadsSecretName

Required. The resource name of the Secret to get, in the form: "projects/{projectId}/locations/{locationId}/environments/{environmentId}/userWorkloadsSecrets/{userWorkloadsSecretId}"

Returns
Type Description
UserWorkloadsSecret

getUserWorkloadsSecret(String name)

public final UserWorkloadsSecret getUserWorkloadsSecret(String name)

Gets an existing user workloads Secret. Values of the "data" field in the response are cleared.

This method is supported for Cloud Composer environments in versions composer-3.*.*-airflow-*.*.* and newer.

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 =
       UserWorkloadsSecretName.of(
               "[PROJECT]", "[LOCATION]", "[ENVIRONMENT]", "[USER_WORKLOADS_SECRET]")
           .toString();
   UserWorkloadsSecret response = environmentsClient.getUserWorkloadsSecret(name);
 }
 
Parameter
Name Description
name String

Required. The resource name of the Secret to get, in the form: "projects/{projectId}/locations/{locationId}/environments/{environmentId}/userWorkloadsSecrets/{userWorkloadsSecretId}"

Returns
Type Description
UserWorkloadsSecret

getUserWorkloadsSecretCallable()

public final UnaryCallable<GetUserWorkloadsSecretRequest,UserWorkloadsSecret> getUserWorkloadsSecretCallable()

Gets an existing user workloads Secret. Values of the "data" field in the response are cleared.

This method is supported for Cloud Composer environments in versions composer-3.*.*-airflow-*.*.* and newer.

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