# Class ClusterControllerClient (4.90.0)

4.90.0 (latest) 4.88.0 4.85.0 4.84.0 4.82.0 4.80.0 4.79.0 4.78.0 4.77.0 4.75.0 4.73.0 4.72.0 4.71.0 4.70.0 4.69.0 4.67.0 4.65.0 4.64.0 4.61.0 4.60.0 4.59.0 4.57.0 4.56.0 4.55.0 4.54.0 4.53.0 4.52.0 4.51.0 4.50.0 4.49.0 4.48.0 4.46.0 4.45.0 4.44.0 4.43.0 4.42.0 4.41.0 4.40.0 4.39.0 4.38.0 4.37.0 4.36.0 4.34.0 4.33.0 4.32.0 4.31.0 4.30.0 4.29.0 4.28.0 4.27.0 4.26.0 4.25.0 4.24.0 4.21.0 4.20.0 4.19.0 4.18.0 4.17.0 4.16.0 4.15.0 4.14.0 4.13.0 4.12.0 4.11.0 4.10.0 4.9.0 4.8.0 4.6.0 4.5.0 4.4.0 4.3.0 4.2.0 4.1.0 4.0.8 3.1.2 3.0.3 2.3.1

|---|---|---|---|
| [GitHub Repository](https://github.com/googleapis/google-cloud-java/tree/main/java-dataproc/google-cloud-dataproc/src/main/java/com/google/cloud/dataproc/v1/ClusterControllerClient.java) | [Product Reference](https://cloud.google.com/dataproc) | [REST Documentation](https://cloud.google.com/dataproc/docs/reference/rest) | [RPC Documentation](https://cloud.google.com/dataproc/docs/reference/rpc) |

Service Description: The ClusterControllerService provides methods to manage clusters of Compute
Engine instances.

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 (ClusterControllerClient clusterControllerClient = ClusterControllerClient.create()) {
       String projectId = "projectId-894832108";
       String region = "region-934795532";
       String clusterName = "clusterName-1141738587";
       Cluster response = clusterControllerClient.getCluster(projectId, region, clusterName);
     }
     
Note: close() needs to be called on the ClusterControllerClient object to clean up resources
such as threads. In the example above, try-with-resources is used, which automatically calls
close().

| Method | Description | Method Variants |
|---|---|---|
| CreateCluster | Creates a cluster in a project. The returned Operation.metadata will be [ClusterOperationMetadata](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#clusteroperationmetadata). | Request object method variants only take one parameter, a request object, which must be constructed before the call. - createClusterAsync(CreateClusterRequest request) Methods that return long-running operations have "Async" method variants that return `OperationFuture`, which is used to track polling of the service. - createClusterAsync(String projectId, String region, Cluster cluster) Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service. - createClusterOperationCallable() - createClusterCallable() |
| UpdateCluster | Updates a cluster in a project. The returned Operation.metadata will be [ClusterOperationMetadata](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#clusteroperationmetadata). The cluster must be in a `RUNNING` state or an error is returned. | Request object method variants only take one parameter, a request object, which must be constructed before the call. - updateClusterAsync(UpdateClusterRequest request) Methods that return long-running operations have "Async" method variants that return `OperationFuture`, which is used to track polling of the service. - updateClusterAsync(String projectId, String region, String clusterName, Cluster cluster, 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. - updateClusterOperationCallable() - updateClusterCallable() |
| StopCluster | Stops a cluster in a project. | Request object method variants only take one parameter, a request object, which must be constructed before the call. - stopClusterAsync(StopClusterRequest request) Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service. - stopClusterOperationCallable() - stopClusterCallable() |
| StartCluster | Starts a cluster in a project. | Request object method variants only take one parameter, a request object, which must be constructed before the call. - startClusterAsync(StartClusterRequest request) Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service. - startClusterOperationCallable() - startClusterCallable() |
| DeleteCluster | Deletes a cluster in a project. The returned Operation.metadata will be [ClusterOperationMetadata](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#clusteroperationmetadata). | Request object method variants only take one parameter, a request object, which must be constructed before the call. - deleteClusterAsync(DeleteClusterRequest request) Methods that return long-running operations have "Async" method variants that return `OperationFuture`, which is used to track polling of the service. - deleteClusterAsync(String projectId, String region, String clusterName) Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service. - deleteClusterOperationCallable() - deleteClusterCallable() |
| GetCluster | Gets the resource representation for a cluster in a project. | Request object method variants only take one parameter, a request object, which must be constructed before the call. - getCluster(GetClusterRequest request) "Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method. - getCluster(String projectId, String region, String clusterName) Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service. - getClusterCallable() |
| ListClusters | Lists all regions/{region}/clusters in a project alphabetically. | Request object method variants only take one parameter, a request object, which must be constructed before the call. - listClusters(ListClustersRequest request) "Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method. - listClusters(String projectId, String region) - listClusters(String projectId, String region, String filter) Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service. - listClustersPagedCallable() - listClustersCallable() |
| DiagnoseCluster | Gets cluster diagnostic information. The returned Operation.metadata will be [ClusterOperationMetadata](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#clusteroperationmetadata). After the operation completes, Operation.response contains [DiagnoseClusterResults](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#diagnoseclusterresults). | Request object method variants only take one parameter, a request object, which must be constructed before the call. - diagnoseClusterAsync(DiagnoseClusterRequest request) Methods that return long-running operations have "Async" method variants that return `OperationFuture`, which is used to track polling of the service. - diagnoseClusterAsync(String projectId, String region, String clusterName) Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service. - diagnoseClusterOperationCallable() - diagnoseClusterCallable() |
| SetIamPolicy | Sets the access control policy on the specified resource. Replacesany existing policy. Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`errors. | Request object method variants only take one parameter, a request object, which must be constructed before the call. - setIamPolicy(SetIamPolicyRequest request) Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service. - setIamPolicyCallable() |
| GetIamPolicy | Gets the access control policy for a resource. Returns an empty policyif the resource exists and does not have a policy set. | Request object method variants only take one parameter, a request object, which must be constructed before the call. - getIamPolicy(GetIamPolicyRequest request) Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service. - getIamPolicyCallable() |
| TestIamPermissions | Returns permissions that a caller has on the specified resource. If theresource does not exist, this will return an empty set ofpermissions, not a `NOT_FOUND` error. Note: This operation is designed to be used for buildingpermission-aware UIs and command-line tools, not for authorizationchecking. This operation may "fail open" without warning. | Request object method variants only take one parameter, a request object, which must be constructed before the call. - testIamPermissions(TestIamPermissionsRequest request) Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service. - testIamPermissionsCallable() |
[Methods]

See the individual methods for example code.

Many parameters require resource names to be formatted in a particular way. To assist with
these names, this class includes a format method for each type of name, and additionally a parse
method to extract the individual identifiers contained within names that are returned.

This class can be customized by passing in a custom instance of ClusterControllerSettings 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
     ClusterControllerSettings clusterControllerSettings =
         ClusterControllerSettings.newBuilder()
             .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
             .build();
     ClusterControllerClient clusterControllerClient =
         ClusterControllerClient.create(clusterControllerSettings);
     
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
     ClusterControllerSettings clusterControllerSettings =
         ClusterControllerSettings.newBuilder().setEndpoint(myEndpoint).build();
     ClusterControllerClient clusterControllerClient =
         ClusterControllerClient.create(clusterControllerSettings);
     
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
     ClusterControllerSettings clusterControllerSettings =
         ClusterControllerSettings.newHttpJsonBuilder().build();
     ClusterControllerClient clusterControllerClient =
         ClusterControllerClient.create(clusterControllerSettings);
     
Please refer to the GitHub repository's samples for more quickstart code snippets.

## Inheritance

[java.lang.Object](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html) \> ClusterControllerClient

## Static Methods

### create()

    public static final ClusterControllerClient create()

Constructs an instance of ClusterControllerClient with default settings.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-dataproc/latest/com.google.cloud.dataproc.v1.ClusterControllerClient` |   |

| **Exceptions** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/io/IOException.html` |   |

### create(ClusterControllerSettings settings)

    public static final ClusterControllerClient create(ClusterControllerSettings settings)

Constructs an instance of ClusterControllerClient, 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` | `https://docs.cloud.google.com/java/docs/reference/google-cloud-dataproc/latest/com.google.cloud.dataproc.v1.ClusterControllerSettings` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-dataproc/latest/com.google.cloud.dataproc.v1.ClusterControllerClient` |   |

| **Exceptions** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/io/IOException.html` |   |

### create(ClusterControllerStub stub)

    public static final ClusterControllerClient create(ClusterControllerStub stub)

Constructs an instance of ClusterControllerClient, using the given stub for making calls. This
is for advanced usage - prefer using create(ClusterControllerSettings).

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `stub` | `https://docs.cloud.google.com/java/docs/reference/google-cloud-dataproc/latest/com.google.cloud.dataproc.v1.stub.ClusterControllerStub` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-dataproc/latest/com.google.cloud.dataproc.v1.ClusterControllerClient` |   |

## Constructors

### ClusterControllerClient(ClusterControllerSettings settings)

    protected ClusterControllerClient(ClusterControllerSettings settings)

Constructs an instance of ClusterControllerClient, 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` | `https://docs.cloud.google.com/java/docs/reference/google-cloud-dataproc/latest/com.google.cloud.dataproc.v1.ClusterControllerSettings` |

### ClusterControllerClient(ClusterControllerStub stub)

    protected ClusterControllerClient(ClusterControllerStub stub)

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `stub` | `https://docs.cloud.google.com/java/docs/reference/google-cloud-dataproc/latest/com.google.cloud.dataproc.v1.stub.ClusterControllerStub` |

## Methods

### awaitTermination(long duration, TimeUnit unit)

    public boolean awaitTermination(long duration, TimeUnit unit)

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `duration` | `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` |
| `unit` | `https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/TimeUnit.html` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` |   |

| **Exceptions** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/lang/InterruptedException.html` |   |

### close()

    public final void close()

### createClusterAsync(CreateClusterRequest request)

    public final OperationFuture<Cluster,ClusterOperationMetadata> createClusterAsync(CreateClusterRequest request)

Creates a cluster in a project. The returned
Operation.metadata will be
[ClusterOperationMetadata](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#clusteroperationmetadata).

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 (ClusterControllerClient clusterControllerClient = ClusterControllerClient.create()) {
       CreateClusterRequest request =
           CreateClusterRequest.newBuilder()
               .setProjectId("projectId-894832108")
               .setRegion("region-934795532")
               .setCluster(Cluster.newBuilder().build())
               .setRequestId("requestId693933066")
               .setActionOnFailedPrimaryWorkers(FailureAction.forNumber(0))
               .build();
       Cluster response = clusterControllerClient.createClusterAsync(request).get();
     }
     
| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/java/docs/reference/google-cloud-dataproc/latest/com.google.cloud.dataproc.v1.CreateClusterRequest` The request object containing all of the parameters for the API call. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/gax/latest/com.google.api.gax.longrunning.OperationFuture.html<https://docs.cloud.google.com/java/docs/reference/google-cloud-dataproc/latest/com.google.cloud.dataproc.v1.Cluster,https://docs.cloud.google.com/java/docs/reference/google-cloud-dataproc/latest/com.google.cloud.dataproc.v1.ClusterOperationMetadata>` |   |

### createClusterAsync(String projectId, String region, Cluster cluster)

    public final OperationFuture<Cluster,ClusterOperationMetadata> createClusterAsync(String projectId, String region, Cluster cluster)

Creates a cluster in a project. The returned
Operation.metadata will be
[ClusterOperationMetadata](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#clusteroperationmetadata).

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 (ClusterControllerClient clusterControllerClient = ClusterControllerClient.create()) {
       String projectId = "projectId-894832108";
       String region = "region-934795532";
       Cluster cluster = Cluster.newBuilder().build();
       Cluster response =
           clusterControllerClient.createClusterAsync(projectId, region, cluster).get();
     }
     
| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `projectId` | `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` Required. The ID of the Google Cloud Platform project that the cluster belongs to. |
| `region` | `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` Required. The Dataproc region in which to handle the request. |
| `cluster` | `https://docs.cloud.google.com/java/docs/reference/google-cloud-dataproc/latest/com.google.cloud.dataproc.v1.Cluster` Required. The cluster to create. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/gax/latest/com.google.api.gax.longrunning.OperationFuture.html<https://docs.cloud.google.com/java/docs/reference/google-cloud-dataproc/latest/com.google.cloud.dataproc.v1.Cluster,https://docs.cloud.google.com/java/docs/reference/google-cloud-dataproc/latest/com.google.cloud.dataproc.v1.ClusterOperationMetadata>` |   |

### createClusterCallable()

    public final UnaryCallable<CreateClusterRequest,Operation> createClusterCallable()

Creates a cluster in a project. The returned
Operation.metadata will be
[ClusterOperationMetadata](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#clusteroperationmetadata).

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 (ClusterControllerClient clusterControllerClient = ClusterControllerClient.create()) {
       CreateClusterRequest request =
           CreateClusterRequest.newBuilder()
               .setProjectId("projectId-894832108")
               .setRegion("region-934795532")
               .setCluster(Cluster.newBuilder().build())
               .setRequestId("requestId693933066")
               .setActionOnFailedPrimaryWorkers(FailureAction.forNumber(0))
               .build();
       ApiFuture<Operation> future =
           clusterControllerClient.createClusterCallable().futureCall(request);
       // Do something.
       Operation response = future.get();
     }
     
| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/gax/latest/com.google.api.gax.rpc.UnaryCallable.html<https://docs.cloud.google.com/java/docs/reference/google-cloud-dataproc/latest/com.google.cloud.dataproc.v1.CreateClusterRequest,https://docs.cloud.google.com/java/docs/reference/gax/latest/com.google.longrunning.Operation.html>` |   |

### createClusterOperationCallable()

    public final OperationCallable<CreateClusterRequest,Cluster,ClusterOperationMetadata> createClusterOperationCallable()

Creates a cluster in a project. The returned
Operation.metadata will be
[ClusterOperationMetadata](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#clusteroperationmetadata).

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 (ClusterControllerClient clusterControllerClient = ClusterControllerClient.create()) {
       CreateClusterRequest request =
           CreateClusterRequest.newBuilder()
               .setProjectId("projectId-894832108")
               .setRegion("region-934795532")
               .setCluster(Cluster.newBuilder().build())
               .setRequestId("requestId693933066")
               .setActionOnFailedPrimaryWorkers(FailureAction.forNumber(0))
               .build();
       OperationFuture<Cluster, ClusterOperationMetadata> future =
           clusterControllerClient.createClusterOperationCallable().futureCall(request);
       // Do something.
       Cluster response = future.get();
     }
     
| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/gax/latest/com.google.api.gax.rpc.OperationCallable.html<https://docs.cloud.google.com/java/docs/reference/google-cloud-dataproc/latest/com.google.cloud.dataproc.v1.CreateClusterRequest,https://docs.cloud.google.com/java/docs/reference/google-cloud-dataproc/latest/com.google.cloud.dataproc.v1.Cluster,https://docs.cloud.google.com/java/docs/reference/google-cloud-dataproc/latest/com.google.cloud.dataproc.v1.ClusterOperationMetadata>` |   |

### deleteClusterAsync(DeleteClusterRequest request)

    public final OperationFuture<Empty,ClusterOperationMetadata> deleteClusterAsync(DeleteClusterRequest request)

Deletes a cluster in a project. The returned
Operation.metadata will be
[ClusterOperationMetadata](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#clusteroperationmetadata).

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 (ClusterControllerClient clusterControllerClient = ClusterControllerClient.create()) {
       DeleteClusterRequest request =
           DeleteClusterRequest.newBuilder()
               .setProjectId("projectId-894832108")
               .setRegion("region-934795532")
               .setClusterName("clusterName-1141738587")
               .setClusterUuid("clusterUuid-1141510955")
               .setRequestId("requestId693933066")
               .build();
       clusterControllerClient.deleteClusterAsync(request).get();
     }
     
| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/java/docs/reference/google-cloud-dataproc/latest/com.google.cloud.dataproc.v1.DeleteClusterRequest` The request object containing all of the parameters for the API call. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/gax/latest/com.google.api.gax.longrunning.OperationFuture.html<https://cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.Empty.html,https://docs.cloud.google.com/java/docs/reference/google-cloud-dataproc/latest/com.google.cloud.dataproc.v1.ClusterOperationMetadata>` |   |

### deleteClusterAsync(String projectId, String region, String clusterName)

    public final OperationFuture<Empty,ClusterOperationMetadata> deleteClusterAsync(String projectId, String region, String clusterName)

Deletes a cluster in a project. The returned
Operation.metadata will be
[ClusterOperationMetadata](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#clusteroperationmetadata).

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 (ClusterControllerClient clusterControllerClient = ClusterControllerClient.create()) {
       String projectId = "projectId-894832108";
       String region = "region-934795532";
       String clusterName = "clusterName-1141738587";
       clusterControllerClient.deleteClusterAsync(projectId, region, clusterName).get();
     }
     
| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `projectId` | `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` Required. The ID of the Google Cloud Platform project that the cluster belongs to. |
| `region` | `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` Required. The Dataproc region in which to handle the request. |
| `clusterName` | `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` Required. The cluster name. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/gax/latest/com.google.api.gax.longrunning.OperationFuture.html<https://cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.Empty.html,https://docs.cloud.google.com/java/docs/reference/google-cloud-dataproc/latest/com.google.cloud.dataproc.v1.ClusterOperationMetadata>` |   |

### deleteClusterCallable()

    public final UnaryCallable<DeleteClusterRequest,Operation> deleteClusterCallable()

Deletes a cluster in a project. The returned
Operation.metadata will be
[ClusterOperationMetadata](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#clusteroperationmetadata).

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 (ClusterControllerClient clusterControllerClient = ClusterControllerClient.create()) {
       DeleteClusterRequest request =
           DeleteClusterRequest.newBuilder()
               .setProjectId("projectId-894832108")
               .setRegion("region-934795532")
               .setClusterName("clusterName-1141738587")
               .setClusterUuid("clusterUuid-1141510955")
               .setRequestId("requestId693933066")
               .build();
       ApiFuture<Operation> future =
           clusterControllerClient.deleteClusterCallable().futureCall(request);
       // Do something.
       future.get();
     }
     
| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/gax/latest/com.google.api.gax.rpc.UnaryCallable.html<https://docs.cloud.google.com/java/docs/reference/google-cloud-dataproc/latest/com.google.cloud.dataproc.v1.DeleteClusterRequest,https://docs.cloud.google.com/java/docs/reference/gax/latest/com.google.longrunning.Operation.html>` |   |

### deleteClusterOperationCallable()

    public final OperationCallable<DeleteClusterRequest,Empty,ClusterOperationMetadata> deleteClusterOperationCallable()

Deletes a cluster in a project. The returned
Operation.metadata will be
[ClusterOperationMetadata](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#clusteroperationmetadata).

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 (ClusterControllerClient clusterControllerClient = ClusterControllerClient.create()) {
       DeleteClusterRequest request =
           DeleteClusterRequest.newBuilder()
               .setProjectId("projectId-894832108")
               .setRegion("region-934795532")
               .setClusterName("clusterName-1141738587")
               .setClusterUuid("clusterUuid-1141510955")
               .setRequestId("requestId693933066")
               .build();
       OperationFuture<Empty, ClusterOperationMetadata> future =
           clusterControllerClient.deleteClusterOperationCallable().futureCall(request);
       // Do something.
       future.get();
     }
     
| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/gax/latest/com.google.api.gax.rpc.OperationCallable.html<https://docs.cloud.google.com/java/docs/reference/google-cloud-dataproc/latest/com.google.cloud.dataproc.v1.DeleteClusterRequest,https://cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.Empty.html,https://docs.cloud.google.com/java/docs/reference/google-cloud-dataproc/latest/com.google.cloud.dataproc.v1.ClusterOperationMetadata>` |   |

### diagnoseClusterAsync(DiagnoseClusterRequest request)

    public final OperationFuture<DiagnoseClusterResults,ClusterOperationMetadata> diagnoseClusterAsync(DiagnoseClusterRequest request)

Gets cluster diagnostic information. The returned
Operation.metadata will be
[ClusterOperationMetadata](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#clusteroperationmetadata).
After the operation completes, Operation.response
contains
[DiagnoseClusterResults](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#diagnoseclusterresults).

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 (ClusterControllerClient clusterControllerClient = ClusterControllerClient.create()) {
       DiagnoseClusterRequest request =
           DiagnoseClusterRequest.newBuilder()
               .setProjectId("projectId-894832108")
               .setRegion("region-934795532")
               .setClusterName("clusterName-1141738587")
               .setTarballGcsDir("tarballGcsDir-1602093510")
               .setDiagnosisInterval(Interval.newBuilder().build())
               .addAllJobs(new ArrayList<String>())
               .addAllYarnApplicationIds(new ArrayList<String>())
               .build();
       DiagnoseClusterResults response = clusterControllerClient.diagnoseClusterAsync(request).get();
     }
     
| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/java/docs/reference/google-cloud-dataproc/latest/com.google.cloud.dataproc.v1.DiagnoseClusterRequest` The request object containing all of the parameters for the API call. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/gax/latest/com.google.api.gax.longrunning.OperationFuture.html<https://docs.cloud.google.com/java/docs/reference/google-cloud-dataproc/latest/com.google.cloud.dataproc.v1.DiagnoseClusterResults,https://docs.cloud.google.com/java/docs/reference/google-cloud-dataproc/latest/com.google.cloud.dataproc.v1.ClusterOperationMetadata>` |   |

### diagnoseClusterAsync(String projectId, String region, String clusterName)

    public final OperationFuture<DiagnoseClusterResults,ClusterOperationMetadata> diagnoseClusterAsync(String projectId, String region, String clusterName)

Gets cluster diagnostic information. The returned
Operation.metadata will be
[ClusterOperationMetadata](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#clusteroperationmetadata).
After the operation completes, Operation.response
contains
[DiagnoseClusterResults](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#diagnoseclusterresults).

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 (ClusterControllerClient clusterControllerClient = ClusterControllerClient.create()) {
       String projectId = "projectId-894832108";
       String region = "region-934795532";
       String clusterName = "clusterName-1141738587";
       DiagnoseClusterResults response =
           clusterControllerClient.diagnoseClusterAsync(projectId, region, clusterName).get();
     }
     
| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `projectId` | `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` Required. The ID of the Google Cloud Platform project that the cluster belongs to. |
| `region` | `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` Required. The Dataproc region in which to handle the request. |
| `clusterName` | `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` Required. The cluster name. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/gax/latest/com.google.api.gax.longrunning.OperationFuture.html<https://docs.cloud.google.com/java/docs/reference/google-cloud-dataproc/latest/com.google.cloud.dataproc.v1.DiagnoseClusterResults,https://docs.cloud.google.com/java/docs/reference/google-cloud-dataproc/latest/com.google.cloud.dataproc.v1.ClusterOperationMetadata>` |   |

### diagnoseClusterCallable()

    public final UnaryCallable<DiagnoseClusterRequest,Operation> diagnoseClusterCallable()

Gets cluster diagnostic information. The returned
Operation.metadata will be
[ClusterOperationMetadata](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#clusteroperationmetadata).
After the operation completes, Operation.response
contains
[DiagnoseClusterResults](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#diagnoseclusterresults).

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 (ClusterControllerClient clusterControllerClient = ClusterControllerClient.create()) {
       DiagnoseClusterRequest request =
           DiagnoseClusterRequest.newBuilder()
               .setProjectId("projectId-894832108")
               .setRegion("region-934795532")
               .setClusterName("clusterName-1141738587")
               .setTarballGcsDir("tarballGcsDir-1602093510")
               .setDiagnosisInterval(Interval.newBuilder().build())
               .addAllJobs(new ArrayList<String>())
               .addAllYarnApplicationIds(new ArrayList<String>())
               .build();
       ApiFuture<Operation> future =
           clusterControllerClient.diagnoseClusterCallable().futureCall(request);
       // Do something.
       Operation response = future.get();
     }
     
| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/gax/latest/com.google.api.gax.rpc.UnaryCallable.html<https://docs.cloud.google.com/java/docs/reference/google-cloud-dataproc/latest/com.google.cloud.dataproc.v1.DiagnoseClusterRequest,https://docs.cloud.google.com/java/docs/reference/gax/latest/com.google.longrunning.Operation.html>` |   |

### diagnoseClusterOperationCallable()

    public final OperationCallable<DiagnoseClusterRequest,DiagnoseClusterResults,ClusterOperationMetadata> diagnoseClusterOperationCallable()

Gets cluster diagnostic information. The returned
Operation.metadata will be
[ClusterOperationMetadata](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#clusteroperationmetadata).
After the operation completes, Operation.response
contains
[DiagnoseClusterResults](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#diagnoseclusterresults).

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 (ClusterControllerClient clusterControllerClient = ClusterControllerClient.create()) {
       DiagnoseClusterRequest request =
           DiagnoseClusterRequest.newBuilder()
               .setProjectId("projectId-894832108")
               .setRegion("region-934795532")
               .setClusterName("clusterName-1141738587")
               .setTarballGcsDir("tarballGcsDir-1602093510")
               .setDiagnosisInterval(Interval.newBuilder().build())
               .addAllJobs(new ArrayList<String>())
               .addAllYarnApplicationIds(new ArrayList<String>())
               .build();
       OperationFuture<DiagnoseClusterResults, ClusterOperationMetadata> future =
           clusterControllerClient.diagnoseClusterOperationCallable().futureCall(request);
       // Do something.
       DiagnoseClusterResults response = future.get();
     }
     
| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/gax/latest/com.google.api.gax.rpc.OperationCallable.html<https://docs.cloud.google.com/java/docs/reference/google-cloud-dataproc/latest/com.google.cloud.dataproc.v1.DiagnoseClusterRequest,https://docs.cloud.google.com/java/docs/reference/google-cloud-dataproc/latest/com.google.cloud.dataproc.v1.DiagnoseClusterResults,https://docs.cloud.google.com/java/docs/reference/google-cloud-dataproc/latest/com.google.cloud.dataproc.v1.ClusterOperationMetadata>` |   |

### getCluster(GetClusterRequest request)

    public final Cluster getCluster(GetClusterRequest request)

Gets the resource representation for a cluster in a project.

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 (ClusterControllerClient clusterControllerClient = ClusterControllerClient.create()) {
       GetClusterRequest request =
           GetClusterRequest.newBuilder()
               .setProjectId("projectId-894832108")
               .setRegion("region-934795532")
               .setClusterName("clusterName-1141738587")
               .build();
       Cluster response = clusterControllerClient.getCluster(request);
     }
     
| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/java/docs/reference/google-cloud-dataproc/latest/com.google.cloud.dataproc.v1.GetClusterRequest` The request object containing all of the parameters for the API call. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-dataproc/latest/com.google.cloud.dataproc.v1.Cluster` |   |

### getCluster(String projectId, String region, String clusterName)

    public final Cluster getCluster(String projectId, String region, String clusterName)

Gets the resource representation for a cluster in a project.

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 (ClusterControllerClient clusterControllerClient = ClusterControllerClient.create()) {
       String projectId = "projectId-894832108";
       String region = "region-934795532";
       String clusterName = "clusterName-1141738587";
       Cluster response = clusterControllerClient.getCluster(projectId, region, clusterName);
     }
     
| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `projectId` | `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` Required. The ID of the Google Cloud Platform project that the cluster belongs to. |
| `region` | `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` Required. The Dataproc region in which to handle the request. |
| `clusterName` | `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` Required. The cluster name. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-dataproc/latest/com.google.cloud.dataproc.v1.Cluster` |   |

### getClusterCallable()

    public final UnaryCallable<GetClusterRequest,Cluster> getClusterCallable()

Gets the resource representation for a cluster in a project.

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 (ClusterControllerClient clusterControllerClient = ClusterControllerClient.create()) {
       GetClusterRequest request =
           GetClusterRequest.newBuilder()
               .setProjectId("projectId-894832108")
               .setRegion("region-934795532")
               .setClusterName("clusterName-1141738587")
               .build();
       ApiFuture<Cluster> future = clusterControllerClient.getClusterCallable().futureCall(request);
       // Do something.
       Cluster response = future.get();
     }
     
| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/gax/latest/com.google.api.gax.rpc.UnaryCallable.html<https://docs.cloud.google.com/java/docs/reference/google-cloud-dataproc/latest/com.google.cloud.dataproc.v1.GetClusterRequest,https://docs.cloud.google.com/java/docs/reference/google-cloud-dataproc/latest/com.google.cloud.dataproc.v1.Cluster>` |   |

### getHttpJsonOperationsClient()

    public final OperationsClient getHttpJsonOperationsClient()

> [!WARNING]
> **Beta**
>
> This feature is covered by the [Pre-GA Offerings Terms](https://docs.cloud.google.com/terms/service-terms#1) of the Terms of Service. Pre-GA libraries might have limited support, and changes to pre-GA libraries might not be compatible with other pre-GA versions. For more information, see the launch stage descriptions.

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** |
| `https://docs.cloud.google.com/java/docs/reference/gax/latest/com.google.api.gax.httpjson.longrunning.OperationsClient.html` |   |

### getIamPolicy(GetIamPolicyRequest request)

    public final Policy getIamPolicy(GetIamPolicyRequest request)

Gets the access control policy for a resource. Returns an empty policyif the resource exists
and does not have a policy set.

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 (ClusterControllerClient clusterControllerClient = ClusterControllerClient.create()) {
       GetIamPolicyRequest request =
           GetIamPolicyRequest.newBuilder()
               .setResource(
                   AutoscalingPolicyName.ofProjectRegionAutoscalingPolicyName(
                           "[PROJECT]", "[REGION]", "[AUTOSCALING_POLICY]")
                       .toString())
               .setOptions(GetPolicyOptions.newBuilder().build())
               .build();
       Policy response = clusterControllerClient.getIamPolicy(request);
     }
     
| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `request` | `com.google.iam.v1.GetIamPolicyRequest` The request object containing all of the parameters for the API call. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `com.google.iam.v1.Policy` |   |

### getIamPolicyCallable()

    public final UnaryCallable<GetIamPolicyRequest,Policy> getIamPolicyCallable()

Gets the access control policy for a resource. Returns an empty policyif the resource exists
and does not have a policy set.

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 (ClusterControllerClient clusterControllerClient = ClusterControllerClient.create()) {
       GetIamPolicyRequest request =
           GetIamPolicyRequest.newBuilder()
               .setResource(
                   AutoscalingPolicyName.ofProjectRegionAutoscalingPolicyName(
                           "[PROJECT]", "[REGION]", "[AUTOSCALING_POLICY]")
                       .toString())
               .setOptions(GetPolicyOptions.newBuilder().build())
               .build();
       ApiFuture<Policy> future = clusterControllerClient.getIamPolicyCallable().futureCall(request);
       // Do something.
       Policy response = future.get();
     }
     
| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/gax/latest/com.google.api.gax.rpc.UnaryCallable.html<com.google.iam.v1.GetIamPolicyRequest,com.google.iam.v1.Policy>` |   |

### 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** |
| `https://docs.cloud.google.com/java/docs/reference/gax/latest/com.google.longrunning.OperationsClient.html` |   |

### getSettings()

    public final ClusterControllerSettings getSettings()

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-dataproc/latest/com.google.cloud.dataproc.v1.ClusterControllerSettings` |   |

### getStub()

    public ClusterControllerStub getStub()

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-dataproc/latest/com.google.cloud.dataproc.v1.stub.ClusterControllerStub` |   |

### isShutdown()

    public boolean isShutdown()

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` |   |

### isTerminated()

    public boolean isTerminated()

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` |   |

### listClusters(ListClustersRequest request)

    public final ClusterControllerClient.ListClustersPagedResponse listClusters(ListClustersRequest request)

Lists all regions/{region}/clusters in a project alphabetically.

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 (ClusterControllerClient clusterControllerClient = ClusterControllerClient.create()) {
       ListClustersRequest request =
           ListClustersRequest.newBuilder()
               .setProjectId("projectId-894832108")
               .setRegion("region-934795532")
               .setFilter("filter-1274492040")
               .setPageSize(883849137)
               .setPageToken("pageToken873572522")
               .build();
       for (Cluster element : clusterControllerClient.listClusters(request).iterateAll()) {
         // doThingsWith(element);
       }
     }
     
| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/java/docs/reference/google-cloud-dataproc/latest/com.google.cloud.dataproc.v1.ListClustersRequest` The request object containing all of the parameters for the API call. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-dataproc/latest/com.google.cloud.dataproc.v1.ClusterControllerClient.ListClustersPagedResponse` |   |

### listClusters(String projectId, String region)

    public final ClusterControllerClient.ListClustersPagedResponse listClusters(String projectId, String region)

Lists all regions/{region}/clusters in a project alphabetically.

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 (ClusterControllerClient clusterControllerClient = ClusterControllerClient.create()) {
       String projectId = "projectId-894832108";
       String region = "region-934795532";
       for (Cluster element : clusterControllerClient.listClusters(projectId, region).iterateAll()) {
         // doThingsWith(element);
       }
     }
     
| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `projectId` | `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` Required. The ID of the Google Cloud Platform project that the cluster belongs to. |
| `region` | `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` Required. The Dataproc region in which to handle the request. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-dataproc/latest/com.google.cloud.dataproc.v1.ClusterControllerClient.ListClustersPagedResponse` |   |

### listClusters(String projectId, String region, String filter)

    public final ClusterControllerClient.ListClustersPagedResponse listClusters(String projectId, String region, String filter)

Lists all regions/{region}/clusters in a project alphabetically.

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 (ClusterControllerClient clusterControllerClient = ClusterControllerClient.create()) {
       String projectId = "projectId-894832108";
       String region = "region-934795532";
       String filter = "filter-1274492040";
       for (Cluster element :
           clusterControllerClient.listClusters(projectId, region, filter).iterateAll()) {
         // doThingsWith(element);
       }
     }
     
| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `projectId` | `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` Required. The ID of the Google Cloud Platform project that the cluster belongs to. |
| `region` | `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` Required. The Dataproc region in which to handle the request. |
| `filter` | `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` Optional. A filter constraining the clusters to list. Filters are case-sensitive and have the following syntax: field = value \[AND \[field = value\]\] ... where \*\*field\*\* is one of `status.state`, `clusterName`, or `labels.[KEY]`, and `[KEY]` is a label key. \*\*value\*\* can be `*` to match all values. `status.state` can be one of the following: `ACTIVE`, `INACTIVE`, `CREATING`, `RUNNING`, `ERROR`, `DELETING`, `UPDATING`, `STOPPING`, or `STOPPED`. `ACTIVE` contains the `CREATING`, `UPDATING`, and `RUNNING` states. `INACTIVE` contains the `DELETING`, `ERROR`, `STOPPING`, and `STOPPED` states. `clusterName` is the name of the cluster provided at creation time. Only the logical `AND` operator is supported; space-separated items are treated as having an implicit `AND` operator. Example filter: status.state = ACTIVE AND clusterName = mycluster AND labels.env = staging AND labels.starred = \* |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-dataproc/latest/com.google.cloud.dataproc.v1.ClusterControllerClient.ListClustersPagedResponse` |   |

### listClustersCallable()

    public final UnaryCallable<ListClustersRequest,ListClustersResponse> listClustersCallable()

Lists all regions/{region}/clusters in a project alphabetically.

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 (ClusterControllerClient clusterControllerClient = ClusterControllerClient.create()) {
       ListClustersRequest request =
           ListClustersRequest.newBuilder()
               .setProjectId("projectId-894832108")
               .setRegion("region-934795532")
               .setFilter("filter-1274492040")
               .setPageSize(883849137)
               .setPageToken("pageToken873572522")
               .build();
       while (true) {
         ListClustersResponse response =
             clusterControllerClient.listClustersCallable().call(request);
         for (Cluster element : response.getClustersList()) {
           // doThingsWith(element);
         }
         String nextPageToken = response.getNextPageToken();
         if (!Strings.isNullOrEmpty(nextPageToken)) {
           request = request.toBuilder().setPageToken(nextPageToken).build();
         } else {
           break;
         }
       }
     }
     
| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/gax/latest/com.google.api.gax.rpc.UnaryCallable.html<https://docs.cloud.google.com/java/docs/reference/google-cloud-dataproc/latest/com.google.cloud.dataproc.v1.ListClustersRequest,https://docs.cloud.google.com/java/docs/reference/google-cloud-dataproc/latest/com.google.cloud.dataproc.v1.ListClustersResponse>` |   |

### listClustersPagedCallable()

    public final UnaryCallable<ListClustersRequest,ClusterControllerClient.ListClustersPagedResponse> listClustersPagedCallable()

Lists all regions/{region}/clusters in a project alphabetically.

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 (ClusterControllerClient clusterControllerClient = ClusterControllerClient.create()) {
       ListClustersRequest request =
           ListClustersRequest.newBuilder()
               .setProjectId("projectId-894832108")
               .setRegion("region-934795532")
               .setFilter("filter-1274492040")
               .setPageSize(883849137)
               .setPageToken("pageToken873572522")
               .build();
       ApiFuture<Cluster> future =
           clusterControllerClient.listClustersPagedCallable().futureCall(request);
       // Do something.
       for (Cluster element : future.get().iterateAll()) {
         // doThingsWith(element);
       }
     }
     
| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/gax/latest/com.google.api.gax.rpc.UnaryCallable.html<https://docs.cloud.google.com/java/docs/reference/google-cloud-dataproc/latest/com.google.cloud.dataproc.v1.ListClustersRequest,https://docs.cloud.google.com/java/docs/reference/google-cloud-dataproc/latest/com.google.cloud.dataproc.v1.ClusterControllerClient.ListClustersPagedResponse>` |   |

### setIamPolicy(SetIamPolicyRequest request)

    public final Policy setIamPolicy(SetIamPolicyRequest request)

Sets the access control policy on the specified resource. Replacesany existing policy.

Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`errors.

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 (ClusterControllerClient clusterControllerClient = ClusterControllerClient.create()) {
       SetIamPolicyRequest request =
           SetIamPolicyRequest.newBuilder()
               .setResource(
                   AutoscalingPolicyName.ofProjectRegionAutoscalingPolicyName(
                           "[PROJECT]", "[REGION]", "[AUTOSCALING_POLICY]")
                       .toString())
               .setPolicy(Policy.newBuilder().build())
               .setUpdateMask(FieldMask.newBuilder().build())
               .build();
       Policy response = clusterControllerClient.setIamPolicy(request);
     }
     
| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `request` | `com.google.iam.v1.SetIamPolicyRequest` The request object containing all of the parameters for the API call. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `com.google.iam.v1.Policy` |   |

### setIamPolicyCallable()

    public final UnaryCallable<SetIamPolicyRequest,Policy> setIamPolicyCallable()

Sets the access control policy on the specified resource. Replacesany existing policy.

Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`errors.

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 (ClusterControllerClient clusterControllerClient = ClusterControllerClient.create()) {
       SetIamPolicyRequest request =
           SetIamPolicyRequest.newBuilder()
               .setResource(
                   AutoscalingPolicyName.ofProjectRegionAutoscalingPolicyName(
                           "[PROJECT]", "[REGION]", "[AUTOSCALING_POLICY]")
                       .toString())
               .setPolicy(Policy.newBuilder().build())
               .setUpdateMask(FieldMask.newBuilder().build())
               .build();
       ApiFuture<Policy> future = clusterControllerClient.setIamPolicyCallable().futureCall(request);
       // Do something.
       Policy response = future.get();
     }
     
| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/gax/latest/com.google.api.gax.rpc.UnaryCallable.html<com.google.iam.v1.SetIamPolicyRequest,com.google.iam.v1.Policy>` |   |

### shutdown()

    public void shutdown()

### shutdownNow()

    public void shutdownNow()

### startClusterAsync(StartClusterRequest request)

    public final OperationFuture<Cluster,ClusterOperationMetadata> startClusterAsync(StartClusterRequest request)

Starts a cluster in a project.

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 (ClusterControllerClient clusterControllerClient = ClusterControllerClient.create()) {
       StartClusterRequest request =
           StartClusterRequest.newBuilder()
               .setProjectId("projectId-894832108")
               .setRegion("region-934795532")
               .setClusterName("clusterName-1141738587")
               .setClusterUuid("clusterUuid-1141510955")
               .setRequestId("requestId693933066")
               .build();
       Cluster response = clusterControllerClient.startClusterAsync(request).get();
     }
     
| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/java/docs/reference/google-cloud-dataproc/latest/com.google.cloud.dataproc.v1.StartClusterRequest` The request object containing all of the parameters for the API call. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/gax/latest/com.google.api.gax.longrunning.OperationFuture.html<https://docs.cloud.google.com/java/docs/reference/google-cloud-dataproc/latest/com.google.cloud.dataproc.v1.Cluster,https://docs.cloud.google.com/java/docs/reference/google-cloud-dataproc/latest/com.google.cloud.dataproc.v1.ClusterOperationMetadata>` |   |

### startClusterCallable()

    public final UnaryCallable<StartClusterRequest,Operation> startClusterCallable()

Starts a cluster in a project.

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 (ClusterControllerClient clusterControllerClient = ClusterControllerClient.create()) {
       StartClusterRequest request =
           StartClusterRequest.newBuilder()
               .setProjectId("projectId-894832108")
               .setRegion("region-934795532")
               .setClusterName("clusterName-1141738587")
               .setClusterUuid("clusterUuid-1141510955")
               .setRequestId("requestId693933066")
               .build();
       ApiFuture<Operation> future =
           clusterControllerClient.startClusterCallable().futureCall(request);
       // Do something.
       Operation response = future.get();
     }
     
| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/gax/latest/com.google.api.gax.rpc.UnaryCallable.html<https://docs.cloud.google.com/java/docs/reference/google-cloud-dataproc/latest/com.google.cloud.dataproc.v1.StartClusterRequest,https://docs.cloud.google.com/java/docs/reference/gax/latest/com.google.longrunning.Operation.html>` |   |

### startClusterOperationCallable()

    public final OperationCallable<StartClusterRequest,Cluster,ClusterOperationMetadata> startClusterOperationCallable()

Starts a cluster in a project.

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 (ClusterControllerClient clusterControllerClient = ClusterControllerClient.create()) {
       StartClusterRequest request =
           StartClusterRequest.newBuilder()
               .setProjectId("projectId-894832108")
               .setRegion("region-934795532")
               .setClusterName("clusterName-1141738587")
               .setClusterUuid("clusterUuid-1141510955")
               .setRequestId("requestId693933066")
               .build();
       OperationFuture<Cluster, ClusterOperationMetadata> future =
           clusterControllerClient.startClusterOperationCallable().futureCall(request);
       // Do something.
       Cluster response = future.get();
     }
     
| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/gax/latest/com.google.api.gax.rpc.OperationCallable.html<https://docs.cloud.google.com/java/docs/reference/google-cloud-dataproc/latest/com.google.cloud.dataproc.v1.StartClusterRequest,https://docs.cloud.google.com/java/docs/reference/google-cloud-dataproc/latest/com.google.cloud.dataproc.v1.Cluster,https://docs.cloud.google.com/java/docs/reference/google-cloud-dataproc/latest/com.google.cloud.dataproc.v1.ClusterOperationMetadata>` |   |

### stopClusterAsync(StopClusterRequest request)

    public final OperationFuture<Cluster,ClusterOperationMetadata> stopClusterAsync(StopClusterRequest request)

Stops a cluster in a project.

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 (ClusterControllerClient clusterControllerClient = ClusterControllerClient.create()) {
       StopClusterRequest request =
           StopClusterRequest.newBuilder()
               .setProjectId("projectId-894832108")
               .setRegion("region-934795532")
               .setClusterName("clusterName-1141738587")
               .setClusterUuid("clusterUuid-1141510955")
               .setRequestId("requestId693933066")
               .build();
       Cluster response = clusterControllerClient.stopClusterAsync(request).get();
     }
     
| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/java/docs/reference/google-cloud-dataproc/latest/com.google.cloud.dataproc.v1.StopClusterRequest` The request object containing all of the parameters for the API call. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/gax/latest/com.google.api.gax.longrunning.OperationFuture.html<https://docs.cloud.google.com/java/docs/reference/google-cloud-dataproc/latest/com.google.cloud.dataproc.v1.Cluster,https://docs.cloud.google.com/java/docs/reference/google-cloud-dataproc/latest/com.google.cloud.dataproc.v1.ClusterOperationMetadata>` |   |

### stopClusterCallable()

    public final UnaryCallable<StopClusterRequest,Operation> stopClusterCallable()

Stops a cluster in a project.

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 (ClusterControllerClient clusterControllerClient = ClusterControllerClient.create()) {
       StopClusterRequest request =
           StopClusterRequest.newBuilder()
               .setProjectId("projectId-894832108")
               .setRegion("region-934795532")
               .setClusterName("clusterName-1141738587")
               .setClusterUuid("clusterUuid-1141510955")
               .setRequestId("requestId693933066")
               .build();
       ApiFuture<Operation> future =
           clusterControllerClient.stopClusterCallable().futureCall(request);
       // Do something.
       Operation response = future.get();
     }
     
| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/gax/latest/com.google.api.gax.rpc.UnaryCallable.html<https://docs.cloud.google.com/java/docs/reference/google-cloud-dataproc/latest/com.google.cloud.dataproc.v1.StopClusterRequest,https://docs.cloud.google.com/java/docs/reference/gax/latest/com.google.longrunning.Operation.html>` |   |

### stopClusterOperationCallable()

    public final OperationCallable<StopClusterRequest,Cluster,ClusterOperationMetadata> stopClusterOperationCallable()

Stops a cluster in a project.

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 (ClusterControllerClient clusterControllerClient = ClusterControllerClient.create()) {
       StopClusterRequest request =
           StopClusterRequest.newBuilder()
               .setProjectId("projectId-894832108")
               .setRegion("region-934795532")
               .setClusterName("clusterName-1141738587")
               .setClusterUuid("clusterUuid-1141510955")
               .setRequestId("requestId693933066")
               .build();
       OperationFuture<Cluster, ClusterOperationMetadata> future =
           clusterControllerClient.stopClusterOperationCallable().futureCall(request);
       // Do something.
       Cluster response = future.get();
     }
     
| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/gax/latest/com.google.api.gax.rpc.OperationCallable.html<https://docs.cloud.google.com/java/docs/reference/google-cloud-dataproc/latest/com.google.cloud.dataproc.v1.StopClusterRequest,https://docs.cloud.google.com/java/docs/reference/google-cloud-dataproc/latest/com.google.cloud.dataproc.v1.Cluster,https://docs.cloud.google.com/java/docs/reference/google-cloud-dataproc/latest/com.google.cloud.dataproc.v1.ClusterOperationMetadata>` |   |

### testIamPermissions(TestIamPermissionsRequest request)

    public final TestIamPermissionsResponse testIamPermissions(TestIamPermissionsRequest request)

Returns permissions that a caller has on the specified resource. If theresource does not exist,
this will return an empty set ofpermissions, not a `NOT_FOUND` error.

Note: This operation is designed to be used for buildingpermission-aware UIs and
command-line tools, not for authorizationchecking. This operation may "fail open" without
warning.

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 (ClusterControllerClient clusterControllerClient = ClusterControllerClient.create()) {
       TestIamPermissionsRequest request =
           TestIamPermissionsRequest.newBuilder()
               .setResource(
                   AutoscalingPolicyName.ofProjectRegionAutoscalingPolicyName(
                           "[PROJECT]", "[REGION]", "[AUTOSCALING_POLICY]")
                       .toString())
               .addAllPermissions(new ArrayList<String>())
               .build();
       TestIamPermissionsResponse response = clusterControllerClient.testIamPermissions(request);
     }
     
| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `request` | `com.google.iam.v1.TestIamPermissionsRequest` The request object containing all of the parameters for the API call. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `com.google.iam.v1.TestIamPermissionsResponse` |   |

### testIamPermissionsCallable()

    public final UnaryCallable<TestIamPermissionsRequest,TestIamPermissionsResponse> testIamPermissionsCallable()

Returns permissions that a caller has on the specified resource. If theresource does not exist,
this will return an empty set ofpermissions, not a `NOT_FOUND` error.

Note: This operation is designed to be used for buildingpermission-aware UIs and
command-line tools, not for authorizationchecking. This operation may "fail open" without
warning.

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 (ClusterControllerClient clusterControllerClient = ClusterControllerClient.create()) {
       TestIamPermissionsRequest request =
           TestIamPermissionsRequest.newBuilder()
               .setResource(
                   AutoscalingPolicyName.ofProjectRegionAutoscalingPolicyName(
                           "[PROJECT]", "[REGION]", "[AUTOSCALING_POLICY]")
                       .toString())
               .addAllPermissions(new ArrayList<String>())
               .build();
       ApiFuture<TestIamPermissionsResponse> future =
           clusterControllerClient.testIamPermissionsCallable().futureCall(request);
       // Do something.
       TestIamPermissionsResponse response = future.get();
     }
     
| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/gax/latest/com.google.api.gax.rpc.UnaryCallable.html<com.google.iam.v1.TestIamPermissionsRequest,com.google.iam.v1.TestIamPermissionsResponse>` |   |

### updateClusterAsync(UpdateClusterRequest request)

    public final OperationFuture<Cluster,ClusterOperationMetadata> updateClusterAsync(UpdateClusterRequest request)

Updates a cluster in a project. The returned
Operation.metadata will be
[ClusterOperationMetadata](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#clusteroperationmetadata).
The cluster must be in a `RUNNING` state or an
error is returned.

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 (ClusterControllerClient clusterControllerClient = ClusterControllerClient.create()) {
       UpdateClusterRequest request =
           UpdateClusterRequest.newBuilder()
               .setProjectId("projectId-894832108")
               .setRegion("region-934795532")
               .setClusterName("clusterName-1141738587")
               .setCluster(Cluster.newBuilder().build())
               .setGracefulDecommissionTimeout(Duration.newBuilder().build())
               .setUpdateMask(FieldMask.newBuilder().build())
               .setRequestId("requestId693933066")
               .build();
       Cluster response = clusterControllerClient.updateClusterAsync(request).get();
     }
     
| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/java/docs/reference/google-cloud-dataproc/latest/com.google.cloud.dataproc.v1.UpdateClusterRequest` The request object containing all of the parameters for the API call. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/gax/latest/com.google.api.gax.longrunning.OperationFuture.html<https://docs.cloud.google.com/java/docs/reference/google-cloud-dataproc/latest/com.google.cloud.dataproc.v1.Cluster,https://docs.cloud.google.com/java/docs/reference/google-cloud-dataproc/latest/com.google.cloud.dataproc.v1.ClusterOperationMetadata>` |   |

### updateClusterAsync(String projectId, String region, String clusterName, Cluster cluster, FieldMask updateMask)

    public final OperationFuture<Cluster,ClusterOperationMetadata> updateClusterAsync(String projectId, String region, String clusterName, Cluster cluster, FieldMask updateMask)

Updates a cluster in a project. The returned
Operation.metadata will be
[ClusterOperationMetadata](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#clusteroperationmetadata).
The cluster must be in a `RUNNING` state or an
error is returned.

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 (ClusterControllerClient clusterControllerClient = ClusterControllerClient.create()) {
       String projectId = "projectId-894832108";
       String region = "region-934795532";
       String clusterName = "clusterName-1141738587";
       Cluster cluster = Cluster.newBuilder().build();
       FieldMask updateMask = FieldMask.newBuilder().build();
       Cluster response =
           clusterControllerClient
               .updateClusterAsync(projectId, region, clusterName, cluster, updateMask)
               .get();
     }
     
| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `projectId` | `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` Required. The ID of the Google Cloud Platform project the cluster belongs to. |
| `region` | `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` Required. The Dataproc region in which to handle the request. |
| `clusterName` | `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` Required. The cluster name. |
| `cluster` | `https://docs.cloud.google.com/java/docs/reference/google-cloud-dataproc/latest/com.google.cloud.dataproc.v1.Cluster` Required. The changes to the cluster. |
| `updateMask` | `https://cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.FieldMask.html` Required. Specifies the path, relative to `Cluster`, of the field to update. For example, to change the number of workers in a cluster to 5, the `update_mask` parameter would be specified as `config.worker_config.num_instances`, and the `PATCH` request body would specify the new value, as follows: { "config":{ "workerConfig":{ "numInstances":"5" } } } Similarly, to change the number of preemptible workers in a cluster to 5, the `update_mask` parameter would be `config.secondary_worker_config.num_instances`, and the `PATCH` request body would be set as follows: { "config":{ "secondaryWorkerConfig":{ "numInstances":"5" } } } \<strong\>Note:\</strong\> Currently, only the following fields can be updated: \<table\> \<tbody\> \<tr\> \<td\>\<strong\>Mask\</strong\>\</td\> \<td\>\<strong\>Purpose\</strong\>\</td\> \</tr\> \<tr\> \<td\>\<strong\>\<em\>labels\</em\>\</strong\>\</td\> \<td\>Update labels\</td\> \</tr\> \<tr\> \<td\>\<strong\>\<em\>config.worker_config.num_instances\</em\>\</strong\>\</td\> \<td\>Resize primary worker group\</td\> \</tr\> \<tr\> \<td\>\<strong\>\<em\>config.secondary_worker_config.num_instances\</em\>\</strong\>\</td\> \<td\>Resize secondary worker group\</td\> \</tr\> \<tr\> \<td\>config.autoscaling_config.policy_uri\</td\>\<td\>Use, stop using, or change autoscaling policies\</td\> \</tr\> \</tbody\> \</table\> |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/gax/latest/com.google.api.gax.longrunning.OperationFuture.html<https://docs.cloud.google.com/java/docs/reference/google-cloud-dataproc/latest/com.google.cloud.dataproc.v1.Cluster,https://docs.cloud.google.com/java/docs/reference/google-cloud-dataproc/latest/com.google.cloud.dataproc.v1.ClusterOperationMetadata>` |   |

### updateClusterCallable()

    public final UnaryCallable<UpdateClusterRequest,Operation> updateClusterCallable()

Updates a cluster in a project. The returned
Operation.metadata will be
[ClusterOperationMetadata](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#clusteroperationmetadata).
The cluster must be in a `RUNNING` state or an
error is returned.

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 (ClusterControllerClient clusterControllerClient = ClusterControllerClient.create()) {
       UpdateClusterRequest request =
           UpdateClusterRequest.newBuilder()
               .setProjectId("projectId-894832108")
               .setRegion("region-934795532")
               .setClusterName("clusterName-1141738587")
               .setCluster(Cluster.newBuilder().build())
               .setGracefulDecommissionTimeout(Duration.newBuilder().build())
               .setUpdateMask(FieldMask.newBuilder().build())
               .setRequestId("requestId693933066")
               .build();
       ApiFuture<Operation> future =
           clusterControllerClient.updateClusterCallable().futureCall(request);
       // Do something.
       Operation response = future.get();
     }
     
| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/gax/latest/com.google.api.gax.rpc.UnaryCallable.html<https://docs.cloud.google.com/java/docs/reference/google-cloud-dataproc/latest/com.google.cloud.dataproc.v1.UpdateClusterRequest,https://docs.cloud.google.com/java/docs/reference/gax/latest/com.google.longrunning.Operation.html>` |   |

### updateClusterOperationCallable()

    public final OperationCallable<UpdateClusterRequest,Cluster,ClusterOperationMetadata> updateClusterOperationCallable()

Updates a cluster in a project. The returned
Operation.metadata will be
[ClusterOperationMetadata](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#clusteroperationmetadata).
The cluster must be in a `RUNNING` state or an
error is returned.

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 (ClusterControllerClient clusterControllerClient = ClusterControllerClient.create()) {
       UpdateClusterRequest request =
           UpdateClusterRequest.newBuilder()
               .setProjectId("projectId-894832108")
               .setRegion("region-934795532")
               .setClusterName("clusterName-1141738587")
               .setCluster(Cluster.newBuilder().build())
               .setGracefulDecommissionTimeout(Duration.newBuilder().build())
               .setUpdateMask(FieldMask.newBuilder().build())
               .setRequestId("requestId693933066")
               .build();
       OperationFuture<Cluster, ClusterOperationMetadata> future =
           clusterControllerClient.updateClusterOperationCallable().futureCall(request);
       // Do something.
       Cluster response = future.get();
     }
     
| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/gax/latest/com.google.api.gax.rpc.OperationCallable.html<https://docs.cloud.google.com/java/docs/reference/google-cloud-dataproc/latest/com.google.cloud.dataproc.v1.UpdateClusterRequest,https://docs.cloud.google.com/java/docs/reference/google-cloud-dataproc/latest/com.google.cloud.dataproc.v1.Cluster,https://docs.cloud.google.com/java/docs/reference/google-cloud-dataproc/latest/com.google.cloud.dataproc.v1.ClusterOperationMetadata>` |   |