diff --git a/java-dataproc/README.md b/java-dataproc/README.md
index 592f807391c1..5ae280d1b937 100644
--- a/java-dataproc/README.md
+++ b/java-dataproc/README.md
@@ -19,20 +19,20 @@ If you are using Maven, add this to your pom.xml file:
com.google.cloudgoogle-cloud-dataproc
- 4.3.0
+ 4.4.0
```
If you are using Gradle without BOM, add this to your dependencies:
```Groovy
-implementation 'com.google.cloud:google-cloud-dataproc:4.3.0'
+implementation 'com.google.cloud:google-cloud-dataproc:4.4.0'
```
If you are using SBT, add this to your dependencies:
```Scala
-libraryDependencies += "com.google.cloud" % "google-cloud-dataproc" % "4.3.0"
+libraryDependencies += "com.google.cloud" % "google-cloud-dataproc" % "4.4.0"
```
## Authentication
diff --git a/java-dataproc/google-cloud-dataproc/src/main/java/com/google/cloud/dataproc/v1/NodeGroupControllerClient.java b/java-dataproc/google-cloud-dataproc/src/main/java/com/google/cloud/dataproc/v1/NodeGroupControllerClient.java
new file mode 100644
index 000000000000..c00c66049e6b
--- /dev/null
+++ b/java-dataproc/google-cloud-dataproc/src/main/java/com/google/cloud/dataproc/v1/NodeGroupControllerClient.java
@@ -0,0 +1,666 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.cloud.dataproc.v1;
+
+import com.google.api.core.BetaApi;
+import com.google.api.gax.core.BackgroundResource;
+import com.google.api.gax.httpjson.longrunning.OperationsClient;
+import com.google.api.gax.longrunning.OperationFuture;
+import com.google.api.gax.rpc.OperationCallable;
+import com.google.api.gax.rpc.UnaryCallable;
+import com.google.cloud.dataproc.v1.stub.NodeGroupControllerStub;
+import com.google.cloud.dataproc.v1.stub.NodeGroupControllerStubSettings;
+import com.google.longrunning.Operation;
+import java.io.IOException;
+import java.util.concurrent.TimeUnit;
+import javax.annotation.Generated;
+
+// AUTO-GENERATED DOCUMENTATION AND CLASS.
+/**
+ * Service Description: The `NodeGroupControllerService` provides methods to manage node groups of
+ * Compute Engine managed 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:
+ *
+ *
{@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 (NodeGroupControllerClient nodeGroupControllerClient = NodeGroupControllerClient.create()) {
+ * NodeGroupName name = NodeGroupName.of("[PROJECT]", "[REGION]", "[CLUSTER]", "[NODE_GROUP]");
+ * NodeGroup response = nodeGroupControllerClient.getNodeGroup(name);
+ * }
+ * }
+ *
+ *
Note: close() needs to be called on the NodeGroupControllerClient object to clean up resources
+ * such as threads. In the example above, try-with-resources is used, which automatically calls
+ * close().
+ *
+ *
The surface of this class includes several types of Java methods for each of the API's
+ * methods:
+ *
+ *
+ *
A "flattened" method. With this type of method, the fields of the request type have been
+ * converted into function parameters. It may be the case that not all fields are available as
+ * parameters, and not every API method will have a flattened method entry point.
+ *
A "request object" method. This type of method only takes one parameter, a request object,
+ * which must be constructed before the call. Not every API method will have a request object
+ * method.
+ *
A "callable" method. This type of method takes no parameters and returns an immutable API
+ * callable object, which can be used to initiate calls to the service.
+ *
+ *
+ *
See the individual methods for example code.
+ *
+ *
Many parameters require resource names to be formatted in a particular way. To assist with
+ * these names, this class includes a format method for each type of name, and additionally a parse
+ * method to extract the individual identifiers contained within names that are returned.
+ *
+ *
This class can be customized by passing in a custom instance of NodeGroupControllerSettings to
+ * create(). For example:
+ *
+ *
To customize credentials:
+ *
+ *
{@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
+ * NodeGroupControllerSettings nodeGroupControllerSettings =
+ * NodeGroupControllerSettings.newBuilder()
+ * .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
+ * .build();
+ * NodeGroupControllerClient nodeGroupControllerClient =
+ * NodeGroupControllerClient.create(nodeGroupControllerSettings);
+ * }
+ *
+ *
To customize the endpoint:
+ *
+ *
{@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
+ * NodeGroupControllerSettings nodeGroupControllerSettings =
+ * NodeGroupControllerSettings.newBuilder().setEndpoint(myEndpoint).build();
+ * NodeGroupControllerClient nodeGroupControllerClient =
+ * NodeGroupControllerClient.create(nodeGroupControllerSettings);
+ * }
+ *
+ *
To use REST (HTTP1.1/JSON) transport (instead of gRPC) for sending and receiving requests over
+ * the wire:
+ *
+ *
{@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
+ * NodeGroupControllerSettings nodeGroupControllerSettings =
+ * NodeGroupControllerSettings.newHttpJsonBuilder().build();
+ * NodeGroupControllerClient nodeGroupControllerClient =
+ * NodeGroupControllerClient.create(nodeGroupControllerSettings);
+ * }
+ *
+ *
Please refer to the GitHub repository's samples for more quickstart code snippets.
+ */
+@Generated("by gapic-generator-java")
+public class NodeGroupControllerClient implements BackgroundResource {
+ private final NodeGroupControllerSettings settings;
+ private final NodeGroupControllerStub stub;
+ private final OperationsClient httpJsonOperationsClient;
+ private final com.google.longrunning.OperationsClient operationsClient;
+
+ /** Constructs an instance of NodeGroupControllerClient with default settings. */
+ public static final NodeGroupControllerClient create() throws IOException {
+ return create(NodeGroupControllerSettings.newBuilder().build());
+ }
+
+ /**
+ * Constructs an instance of NodeGroupControllerClient, using the given settings. The channels are
+ * created based on the settings passed in, or defaults for any settings that are not set.
+ */
+ public static final NodeGroupControllerClient create(NodeGroupControllerSettings settings)
+ throws IOException {
+ return new NodeGroupControllerClient(settings);
+ }
+
+ /**
+ * Constructs an instance of NodeGroupControllerClient, using the given stub for making calls.
+ * This is for advanced usage - prefer using create(NodeGroupControllerSettings).
+ */
+ public static final NodeGroupControllerClient create(NodeGroupControllerStub stub) {
+ return new NodeGroupControllerClient(stub);
+ }
+
+ /**
+ * Constructs an instance of NodeGroupControllerClient, 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.
+ */
+ protected NodeGroupControllerClient(NodeGroupControllerSettings settings) throws IOException {
+ this.settings = settings;
+ this.stub = ((NodeGroupControllerStubSettings) settings.getStubSettings()).createStub();
+ this.operationsClient =
+ com.google.longrunning.OperationsClient.create(this.stub.getOperationsStub());
+ this.httpJsonOperationsClient = OperationsClient.create(this.stub.getHttpJsonOperationsStub());
+ }
+
+ protected NodeGroupControllerClient(NodeGroupControllerStub stub) {
+ this.settings = null;
+ this.stub = stub;
+ this.operationsClient =
+ com.google.longrunning.OperationsClient.create(this.stub.getOperationsStub());
+ this.httpJsonOperationsClient = OperationsClient.create(this.stub.getHttpJsonOperationsStub());
+ }
+
+ public final NodeGroupControllerSettings getSettings() {
+ return settings;
+ }
+
+ public NodeGroupControllerStub getStub() {
+ return stub;
+ }
+
+ /**
+ * Returns the OperationsClient that can be used to query the status of a long-running operation
+ * returned by another API method call.
+ */
+ public final com.google.longrunning.OperationsClient getOperationsClient() {
+ return operationsClient;
+ }
+
+ /**
+ * Returns the OperationsClient that can be used to query the status of a long-running operation
+ * returned by another API method call.
+ */
+ @BetaApi
+ public final OperationsClient getHttpJsonOperationsClient() {
+ return httpJsonOperationsClient;
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Creates a node group in a cluster. The returned
+ * [Operation.metadata][google.longrunning.Operation.metadata] is
+ * [NodeGroupOperationMetadata](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#nodegroupoperationmetadata).
+ *
+ *
Sample code:
+ *
+ *
{@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 (NodeGroupControllerClient nodeGroupControllerClient = NodeGroupControllerClient.create()) {
+ * ClusterRegionName parent = ClusterRegionName.of("[PROJECT]", "[REGION]", "[CLUSTER]");
+ * NodeGroup nodeGroup = NodeGroup.newBuilder().build();
+ * String nodeGroupId = "nodeGroupId1097129880";
+ * NodeGroup response =
+ * nodeGroupControllerClient.createNodeGroupAsync(parent, nodeGroup, nodeGroupId).get();
+ * }
+ * }
+ *
+ * @param parent Required. The parent resource where this node group will be created. Format:
+ * `projects/{project}/regions/{region}/clusters/{cluster}`
+ * @param nodeGroup Required. The node group to create.
+ * @param nodeGroupId Optional. An optional node group ID. Generated if not specified.
+ *
The ID must contain only letters (a-z, A-Z), numbers (0-9), underscores (_), and hyphens
+ * (-). Cannot begin or end with underscore or hyphen. Must consist of from 3 to 33
+ * characters.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final OperationFuture createNodeGroupAsync(
+ ClusterRegionName parent, NodeGroup nodeGroup, String nodeGroupId) {
+ CreateNodeGroupRequest request =
+ CreateNodeGroupRequest.newBuilder()
+ .setParent(parent == null ? null : parent.toString())
+ .setNodeGroup(nodeGroup)
+ .setNodeGroupId(nodeGroupId)
+ .build();
+ return createNodeGroupAsync(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Creates a node group in a cluster. The returned
+ * [Operation.metadata][google.longrunning.Operation.metadata] is
+ * [NodeGroupOperationMetadata](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#nodegroupoperationmetadata).
+ *
+ *
Sample code:
+ *
+ *
{@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 (NodeGroupControllerClient nodeGroupControllerClient = NodeGroupControllerClient.create()) {
+ * String parent = ClusterRegionName.of("[PROJECT]", "[REGION]", "[CLUSTER]").toString();
+ * NodeGroup nodeGroup = NodeGroup.newBuilder().build();
+ * String nodeGroupId = "nodeGroupId1097129880";
+ * NodeGroup response =
+ * nodeGroupControllerClient.createNodeGroupAsync(parent, nodeGroup, nodeGroupId).get();
+ * }
+ * }
+ *
+ * @param parent Required. The parent resource where this node group will be created. Format:
+ * `projects/{project}/regions/{region}/clusters/{cluster}`
+ * @param nodeGroup Required. The node group to create.
+ * @param nodeGroupId Optional. An optional node group ID. Generated if not specified.
+ *
The ID must contain only letters (a-z, A-Z), numbers (0-9), underscores (_), and hyphens
+ * (-). Cannot begin or end with underscore or hyphen. Must consist of from 3 to 33
+ * characters.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final OperationFuture createNodeGroupAsync(
+ String parent, NodeGroup nodeGroup, String nodeGroupId) {
+ CreateNodeGroupRequest request =
+ CreateNodeGroupRequest.newBuilder()
+ .setParent(parent)
+ .setNodeGroup(nodeGroup)
+ .setNodeGroupId(nodeGroupId)
+ .build();
+ return createNodeGroupAsync(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Creates a node group in a cluster. The returned
+ * [Operation.metadata][google.longrunning.Operation.metadata] is
+ * [NodeGroupOperationMetadata](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#nodegroupoperationmetadata).
+ *
+ *
Sample code:
+ *
+ *
{@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 (NodeGroupControllerClient nodeGroupControllerClient = NodeGroupControllerClient.create()) {
+ * CreateNodeGroupRequest request =
+ * CreateNodeGroupRequest.newBuilder()
+ * .setParent(ClusterRegionName.of("[PROJECT]", "[REGION]", "[CLUSTER]").toString())
+ * .setNodeGroup(NodeGroup.newBuilder().build())
+ * .setNodeGroupId("nodeGroupId1097129880")
+ * .setRequestId("requestId693933066")
+ * .build();
+ * NodeGroup response = nodeGroupControllerClient.createNodeGroupAsync(request).get();
+ * }
+ * }
+ *
+ * @param request The request object containing all of the parameters for the API call.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final OperationFuture createNodeGroupAsync(
+ CreateNodeGroupRequest request) {
+ return createNodeGroupOperationCallable().futureCall(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Creates a node group in a cluster. The returned
+ * [Operation.metadata][google.longrunning.Operation.metadata] is
+ * [NodeGroupOperationMetadata](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#nodegroupoperationmetadata).
+ *
+ *
Sample code:
+ *
+ *
{@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 (NodeGroupControllerClient nodeGroupControllerClient = NodeGroupControllerClient.create()) {
+ * CreateNodeGroupRequest request =
+ * CreateNodeGroupRequest.newBuilder()
+ * .setParent(ClusterRegionName.of("[PROJECT]", "[REGION]", "[CLUSTER]").toString())
+ * .setNodeGroup(NodeGroup.newBuilder().build())
+ * .setNodeGroupId("nodeGroupId1097129880")
+ * .setRequestId("requestId693933066")
+ * .build();
+ * OperationFuture future =
+ * nodeGroupControllerClient.createNodeGroupOperationCallable().futureCall(request);
+ * // Do something.
+ * NodeGroup response = future.get();
+ * }
+ * }
+ */
+ public final OperationCallable
+ createNodeGroupOperationCallable() {
+ return stub.createNodeGroupOperationCallable();
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Creates a node group in a cluster. The returned
+ * [Operation.metadata][google.longrunning.Operation.metadata] is
+ * [NodeGroupOperationMetadata](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#nodegroupoperationmetadata).
+ *
+ *
Sample code:
+ *
+ *
{@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 (NodeGroupControllerClient nodeGroupControllerClient = NodeGroupControllerClient.create()) {
+ * CreateNodeGroupRequest request =
+ * CreateNodeGroupRequest.newBuilder()
+ * .setParent(ClusterRegionName.of("[PROJECT]", "[REGION]", "[CLUSTER]").toString())
+ * .setNodeGroup(NodeGroup.newBuilder().build())
+ * .setNodeGroupId("nodeGroupId1097129880")
+ * .setRequestId("requestId693933066")
+ * .build();
+ * ApiFuture future =
+ * nodeGroupControllerClient.createNodeGroupCallable().futureCall(request);
+ * // Do something.
+ * Operation response = future.get();
+ * }
+ * }
+ */
+ public final UnaryCallable createNodeGroupCallable() {
+ return stub.createNodeGroupCallable();
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Resizes a node group in a cluster. The returned
+ * [Operation.metadata][google.longrunning.Operation.metadata] is
+ * [NodeGroupOperationMetadata](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#nodegroupoperationmetadata).
+ *
+ *
Sample code:
+ *
+ *
{@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 (NodeGroupControllerClient nodeGroupControllerClient = NodeGroupControllerClient.create()) {
+ * String name = "name3373707";
+ * int size = 3530753;
+ * NodeGroup response = nodeGroupControllerClient.resizeNodeGroupAsync(name, size).get();
+ * }
+ * }
+ *
+ * @param name Required. The name of the node group to resize. Format:
+ * `projects/{project}/regions/{region}/clusters/{cluster}/nodeGroups/{nodeGroup}`
+ * @param size Required. The number of running instances for the node group to maintain. The group
+ * adds or removes instances to maintain the number of instances specified by this parameter.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final OperationFuture resizeNodeGroupAsync(
+ String name, int size) {
+ ResizeNodeGroupRequest request =
+ ResizeNodeGroupRequest.newBuilder().setName(name).setSize(size).build();
+ return resizeNodeGroupAsync(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Resizes a node group in a cluster. The returned
+ * [Operation.metadata][google.longrunning.Operation.metadata] is
+ * [NodeGroupOperationMetadata](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#nodegroupoperationmetadata).
+ *
+ *
Sample code:
+ *
+ *
{@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 (NodeGroupControllerClient nodeGroupControllerClient = NodeGroupControllerClient.create()) {
+ * ResizeNodeGroupRequest request =
+ * ResizeNodeGroupRequest.newBuilder()
+ * .setName("name3373707")
+ * .setSize(3530753)
+ * .setRequestId("requestId693933066")
+ * .setGracefulDecommissionTimeout(Duration.newBuilder().build())
+ * .build();
+ * NodeGroup response = nodeGroupControllerClient.resizeNodeGroupAsync(request).get();
+ * }
+ * }
+ *
+ * @param request The request object containing all of the parameters for the API call.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final OperationFuture resizeNodeGroupAsync(
+ ResizeNodeGroupRequest request) {
+ return resizeNodeGroupOperationCallable().futureCall(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Resizes a node group in a cluster. The returned
+ * [Operation.metadata][google.longrunning.Operation.metadata] is
+ * [NodeGroupOperationMetadata](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#nodegroupoperationmetadata).
+ *
+ *
Sample code:
+ *
+ *
{@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 (NodeGroupControllerClient nodeGroupControllerClient = NodeGroupControllerClient.create()) {
+ * ResizeNodeGroupRequest request =
+ * ResizeNodeGroupRequest.newBuilder()
+ * .setName("name3373707")
+ * .setSize(3530753)
+ * .setRequestId("requestId693933066")
+ * .setGracefulDecommissionTimeout(Duration.newBuilder().build())
+ * .build();
+ * OperationFuture future =
+ * nodeGroupControllerClient.resizeNodeGroupOperationCallable().futureCall(request);
+ * // Do something.
+ * NodeGroup response = future.get();
+ * }
+ * }
+ */
+ public final OperationCallable
+ resizeNodeGroupOperationCallable() {
+ return stub.resizeNodeGroupOperationCallable();
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Resizes a node group in a cluster. The returned
+ * [Operation.metadata][google.longrunning.Operation.metadata] is
+ * [NodeGroupOperationMetadata](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#nodegroupoperationmetadata).
+ *
+ *
Sample code:
+ *
+ *
{@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 (NodeGroupControllerClient nodeGroupControllerClient = NodeGroupControllerClient.create()) {
+ * ResizeNodeGroupRequest request =
+ * ResizeNodeGroupRequest.newBuilder()
+ * .setName("name3373707")
+ * .setSize(3530753)
+ * .setRequestId("requestId693933066")
+ * .setGracefulDecommissionTimeout(Duration.newBuilder().build())
+ * .build();
+ * ApiFuture future =
+ * nodeGroupControllerClient.resizeNodeGroupCallable().futureCall(request);
+ * // Do something.
+ * Operation response = future.get();
+ * }
+ * }
+ */
+ public final UnaryCallable resizeNodeGroupCallable() {
+ return stub.resizeNodeGroupCallable();
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Gets the resource representation for a node group in a cluster.
+ *
+ *
Sample code:
+ *
+ *
{@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 (NodeGroupControllerClient nodeGroupControllerClient = NodeGroupControllerClient.create()) {
+ * NodeGroupName name = NodeGroupName.of("[PROJECT]", "[REGION]", "[CLUSTER]", "[NODE_GROUP]");
+ * NodeGroup response = nodeGroupControllerClient.getNodeGroup(name);
+ * }
+ * }
+ *
+ * @param name Required. The name of the node group to retrieve. Format:
+ * `projects/{project}/regions/{region}/clusters/{cluster}/nodeGroups/{nodeGroup}`
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final NodeGroup getNodeGroup(NodeGroupName name) {
+ GetNodeGroupRequest request =
+ GetNodeGroupRequest.newBuilder().setName(name == null ? null : name.toString()).build();
+ return getNodeGroup(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Gets the resource representation for a node group in a cluster.
+ *
+ *
Sample code:
+ *
+ *
{@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 (NodeGroupControllerClient nodeGroupControllerClient = NodeGroupControllerClient.create()) {
+ * String name =
+ * NodeGroupName.of("[PROJECT]", "[REGION]", "[CLUSTER]", "[NODE_GROUP]").toString();
+ * NodeGroup response = nodeGroupControllerClient.getNodeGroup(name);
+ * }
+ * }
+ *
+ * @param name Required. The name of the node group to retrieve. Format:
+ * `projects/{project}/regions/{region}/clusters/{cluster}/nodeGroups/{nodeGroup}`
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final NodeGroup getNodeGroup(String name) {
+ GetNodeGroupRequest request = GetNodeGroupRequest.newBuilder().setName(name).build();
+ return getNodeGroup(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Gets the resource representation for a node group in a cluster.
+ *
+ *
Sample code:
+ *
+ *
{@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 (NodeGroupControllerClient nodeGroupControllerClient = NodeGroupControllerClient.create()) {
+ * GetNodeGroupRequest request =
+ * GetNodeGroupRequest.newBuilder()
+ * .setName(
+ * NodeGroupName.of("[PROJECT]", "[REGION]", "[CLUSTER]", "[NODE_GROUP]").toString())
+ * .build();
+ * NodeGroup response = nodeGroupControllerClient.getNodeGroup(request);
+ * }
+ * }
+ *
+ * @param request The request object containing all of the parameters for the API call.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final NodeGroup getNodeGroup(GetNodeGroupRequest request) {
+ return getNodeGroupCallable().call(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Gets the resource representation for a node group in a cluster.
+ *
+ *
Sample code:
+ *
+ *
{@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 (NodeGroupControllerClient nodeGroupControllerClient = NodeGroupControllerClient.create()) {
+ * GetNodeGroupRequest request =
+ * GetNodeGroupRequest.newBuilder()
+ * .setName(
+ * NodeGroupName.of("[PROJECT]", "[REGION]", "[CLUSTER]", "[NODE_GROUP]").toString())
+ * .build();
+ * ApiFuture future =
+ * nodeGroupControllerClient.getNodeGroupCallable().futureCall(request);
+ * // Do something.
+ * NodeGroup response = future.get();
+ * }
+ * }
+ */
+ public final UnaryCallable getNodeGroupCallable() {
+ return stub.getNodeGroupCallable();
+ }
+
+ @Override
+ public final void close() {
+ stub.close();
+ }
+
+ @Override
+ public void shutdown() {
+ stub.shutdown();
+ }
+
+ @Override
+ public boolean isShutdown() {
+ return stub.isShutdown();
+ }
+
+ @Override
+ public boolean isTerminated() {
+ return stub.isTerminated();
+ }
+
+ @Override
+ public void shutdownNow() {
+ stub.shutdownNow();
+ }
+
+ @Override
+ public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException {
+ return stub.awaitTermination(duration, unit);
+ }
+}
diff --git a/java-dataproc/google-cloud-dataproc/src/main/java/com/google/cloud/dataproc/v1/NodeGroupControllerSettings.java b/java-dataproc/google-cloud-dataproc/src/main/java/com/google/cloud/dataproc/v1/NodeGroupControllerSettings.java
new file mode 100644
index 000000000000..67a4d010ab14
--- /dev/null
+++ b/java-dataproc/google-cloud-dataproc/src/main/java/com/google/cloud/dataproc/v1/NodeGroupControllerSettings.java
@@ -0,0 +1,251 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.cloud.dataproc.v1;
+
+import com.google.api.core.ApiFunction;
+import com.google.api.core.BetaApi;
+import com.google.api.gax.core.GoogleCredentialsProvider;
+import com.google.api.gax.core.InstantiatingExecutorProvider;
+import com.google.api.gax.grpc.InstantiatingGrpcChannelProvider;
+import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider;
+import com.google.api.gax.rpc.ApiClientHeaderProvider;
+import com.google.api.gax.rpc.ClientContext;
+import com.google.api.gax.rpc.ClientSettings;
+import com.google.api.gax.rpc.OperationCallSettings;
+import com.google.api.gax.rpc.TransportChannelProvider;
+import com.google.api.gax.rpc.UnaryCallSettings;
+import com.google.cloud.dataproc.v1.stub.NodeGroupControllerStubSettings;
+import com.google.longrunning.Operation;
+import java.io.IOException;
+import java.util.List;
+import javax.annotation.Generated;
+
+// AUTO-GENERATED DOCUMENTATION AND CLASS.
+/**
+ * Settings class to configure an instance of {@link NodeGroupControllerClient}.
+ *
+ *
The default instance has everything set to sensible defaults:
+ *
+ *
+ *
The default service address (dataproc.googleapis.com) and default port (443) are used.
+ *
Credentials are acquired automatically through Application Default Credentials.
+ *
Retries are configured for idempotent methods but not for non-idempotent methods.
+ *
+ *
+ *
The builder of this class is recursive, so contained classes are themselves builders. When
+ * build() is called, the tree of builders is called to create the complete settings object.
+ *
+ *
For example, to set the total timeout of getNodeGroup to 30 seconds:
+ *
+ *
{@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
+ * NodeGroupControllerSettings.Builder nodeGroupControllerSettingsBuilder =
+ * NodeGroupControllerSettings.newBuilder();
+ * nodeGroupControllerSettingsBuilder
+ * .getNodeGroupSettings()
+ * .setRetrySettings(
+ * nodeGroupControllerSettingsBuilder.getNodeGroupSettings().getRetrySettings().toBuilder()
+ * .setTotalTimeout(Duration.ofSeconds(30))
+ * .build());
+ * NodeGroupControllerSettings nodeGroupControllerSettings =
+ * nodeGroupControllerSettingsBuilder.build();
+ * }
+ */
+@Generated("by gapic-generator-java")
+public class NodeGroupControllerSettings extends ClientSettings {
+
+ /** Returns the object with the settings used for calls to createNodeGroup. */
+ public UnaryCallSettings createNodeGroupSettings() {
+ return ((NodeGroupControllerStubSettings) getStubSettings()).createNodeGroupSettings();
+ }
+
+ /** Returns the object with the settings used for calls to createNodeGroup. */
+ public OperationCallSettings
+ createNodeGroupOperationSettings() {
+ return ((NodeGroupControllerStubSettings) getStubSettings()).createNodeGroupOperationSettings();
+ }
+
+ /** Returns the object with the settings used for calls to resizeNodeGroup. */
+ public UnaryCallSettings resizeNodeGroupSettings() {
+ return ((NodeGroupControllerStubSettings) getStubSettings()).resizeNodeGroupSettings();
+ }
+
+ /** Returns the object with the settings used for calls to resizeNodeGroup. */
+ public OperationCallSettings
+ resizeNodeGroupOperationSettings() {
+ return ((NodeGroupControllerStubSettings) getStubSettings()).resizeNodeGroupOperationSettings();
+ }
+
+ /** Returns the object with the settings used for calls to getNodeGroup. */
+ public UnaryCallSettings getNodeGroupSettings() {
+ return ((NodeGroupControllerStubSettings) getStubSettings()).getNodeGroupSettings();
+ }
+
+ public static final NodeGroupControllerSettings create(NodeGroupControllerStubSettings stub)
+ throws IOException {
+ return new NodeGroupControllerSettings.Builder(stub.toBuilder()).build();
+ }
+
+ /** Returns a builder for the default ExecutorProvider for this service. */
+ public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() {
+ return NodeGroupControllerStubSettings.defaultExecutorProviderBuilder();
+ }
+
+ /** Returns the default service endpoint. */
+ public static String getDefaultEndpoint() {
+ return NodeGroupControllerStubSettings.getDefaultEndpoint();
+ }
+
+ /** Returns the default service scopes. */
+ public static List getDefaultServiceScopes() {
+ return NodeGroupControllerStubSettings.getDefaultServiceScopes();
+ }
+
+ /** Returns a builder for the default credentials for this service. */
+ public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() {
+ return NodeGroupControllerStubSettings.defaultCredentialsProviderBuilder();
+ }
+
+ /** Returns a builder for the default gRPC ChannelProvider for this service. */
+ public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() {
+ return NodeGroupControllerStubSettings.defaultGrpcTransportProviderBuilder();
+ }
+
+ /** Returns a builder for the default REST ChannelProvider for this service. */
+ @BetaApi
+ public static InstantiatingHttpJsonChannelProvider.Builder
+ defaultHttpJsonTransportProviderBuilder() {
+ return NodeGroupControllerStubSettings.defaultHttpJsonTransportProviderBuilder();
+ }
+
+ public static TransportChannelProvider defaultTransportChannelProvider() {
+ return NodeGroupControllerStubSettings.defaultTransportChannelProvider();
+ }
+
+ @BetaApi("The surface for customizing headers is not stable yet and may change in the future.")
+ public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() {
+ return NodeGroupControllerStubSettings.defaultApiClientHeaderProviderBuilder();
+ }
+
+ /** Returns a new gRPC builder for this class. */
+ public static Builder newBuilder() {
+ return Builder.createDefault();
+ }
+
+ /** Returns a new REST builder for this class. */
+ @BetaApi
+ public static Builder newHttpJsonBuilder() {
+ return Builder.createHttpJsonDefault();
+ }
+
+ /** Returns a new builder for this class. */
+ public static Builder newBuilder(ClientContext clientContext) {
+ return new Builder(clientContext);
+ }
+
+ /** Returns a builder containing all the values of this settings class. */
+ public Builder toBuilder() {
+ return new Builder(this);
+ }
+
+ protected NodeGroupControllerSettings(Builder settingsBuilder) throws IOException {
+ super(settingsBuilder);
+ }
+
+ /** Builder for NodeGroupControllerSettings. */
+ public static class Builder extends ClientSettings.Builder {
+
+ protected Builder() throws IOException {
+ this(((ClientContext) null));
+ }
+
+ protected Builder(ClientContext clientContext) {
+ super(NodeGroupControllerStubSettings.newBuilder(clientContext));
+ }
+
+ protected Builder(NodeGroupControllerSettings settings) {
+ super(settings.getStubSettings().toBuilder());
+ }
+
+ protected Builder(NodeGroupControllerStubSettings.Builder stubSettings) {
+ super(stubSettings);
+ }
+
+ private static Builder createDefault() {
+ return new Builder(NodeGroupControllerStubSettings.newBuilder());
+ }
+
+ @BetaApi
+ private static Builder createHttpJsonDefault() {
+ return new Builder(NodeGroupControllerStubSettings.newHttpJsonBuilder());
+ }
+
+ public NodeGroupControllerStubSettings.Builder getStubSettingsBuilder() {
+ return ((NodeGroupControllerStubSettings.Builder) getStubSettings());
+ }
+
+ /**
+ * Applies the given settings updater function to all of the unary API methods in this service.
+ *
+ *
Note: This method does not support applying settings to streaming methods.
+ */
+ public Builder applyToAllUnaryMethods(
+ ApiFunction, Void> settingsUpdater) {
+ super.applyToAllUnaryMethods(
+ getStubSettingsBuilder().unaryMethodSettingsBuilders(), settingsUpdater);
+ return this;
+ }
+
+ /** Returns the builder for the settings used for calls to createNodeGroup. */
+ public UnaryCallSettings.Builder createNodeGroupSettings() {
+ return getStubSettingsBuilder().createNodeGroupSettings();
+ }
+
+ /** Returns the builder for the settings used for calls to createNodeGroup. */
+ public OperationCallSettings.Builder<
+ CreateNodeGroupRequest, NodeGroup, NodeGroupOperationMetadata>
+ createNodeGroupOperationSettings() {
+ return getStubSettingsBuilder().createNodeGroupOperationSettings();
+ }
+
+ /** Returns the builder for the settings used for calls to resizeNodeGroup. */
+ public UnaryCallSettings.Builder resizeNodeGroupSettings() {
+ return getStubSettingsBuilder().resizeNodeGroupSettings();
+ }
+
+ /** Returns the builder for the settings used for calls to resizeNodeGroup. */
+ public OperationCallSettings.Builder<
+ ResizeNodeGroupRequest, NodeGroup, NodeGroupOperationMetadata>
+ resizeNodeGroupOperationSettings() {
+ return getStubSettingsBuilder().resizeNodeGroupOperationSettings();
+ }
+
+ /** Returns the builder for the settings used for calls to getNodeGroup. */
+ public UnaryCallSettings.Builder getNodeGroupSettings() {
+ return getStubSettingsBuilder().getNodeGroupSettings();
+ }
+
+ @Override
+ public NodeGroupControllerSettings build() throws IOException {
+ return new NodeGroupControllerSettings(this);
+ }
+ }
+}
diff --git a/java-dataproc/google-cloud-dataproc/src/main/java/com/google/cloud/dataproc/v1/gapic_metadata.json b/java-dataproc/google-cloud-dataproc/src/main/java/com/google/cloud/dataproc/v1/gapic_metadata.json
index 26e0eeb58e8f..832368b59430 100644
--- a/java-dataproc/google-cloud-dataproc/src/main/java/com/google/cloud/dataproc/v1/gapic_metadata.json
+++ b/java-dataproc/google-cloud-dataproc/src/main/java/com/google/cloud/dataproc/v1/gapic_metadata.json
@@ -142,6 +142,24 @@
}
}
}
+ },
+ "NodeGroupController": {
+ "clients": {
+ "grpc": {
+ "libraryClient": "NodeGroupControllerClient",
+ "rpcs": {
+ "CreateNodeGroup": {
+ "methods": ["createNodeGroupAsync", "createNodeGroupAsync", "createNodeGroupAsync", "createNodeGroupOperationCallable", "createNodeGroupCallable"]
+ },
+ "GetNodeGroup": {
+ "methods": ["getNodeGroup", "getNodeGroup", "getNodeGroup", "getNodeGroupCallable"]
+ },
+ "ResizeNodeGroup": {
+ "methods": ["resizeNodeGroupAsync", "resizeNodeGroupAsync", "resizeNodeGroupOperationCallable", "resizeNodeGroupCallable"]
+ }
+ }
+ }
+ }
}
}
}
\ No newline at end of file
diff --git a/java-dataproc/google-cloud-dataproc/src/main/java/com/google/cloud/dataproc/v1/package-info.java b/java-dataproc/google-cloud-dataproc/src/main/java/com/google/cloud/dataproc/v1/package-info.java
index 7f608efc866d..ab6d8c1c9171 100644
--- a/java-dataproc/google-cloud-dataproc/src/main/java/com/google/cloud/dataproc/v1/package-info.java
+++ b/java-dataproc/google-cloud-dataproc/src/main/java/com/google/cloud/dataproc/v1/package-info.java
@@ -117,6 +117,25 @@
* workflowTemplateServiceClient.createWorkflowTemplate(parent, template);
* }
* }
+ *
+ *
Service Description: The `NodeGroupControllerService` provides methods to manage node groups
+ * of Compute Engine managed instances.
+ *
+ *
Sample for NodeGroupControllerClient:
+ *
+ *
{@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 (NodeGroupControllerClient nodeGroupControllerClient = NodeGroupControllerClient.create()) {
+ * NodeGroupName name = NodeGroupName.of("[PROJECT]", "[REGION]", "[CLUSTER]", "[NODE_GROUP]");
+ * NodeGroup response = nodeGroupControllerClient.getNodeGroup(name);
+ * }
+ * }
*/
@Generated("by gapic-generator-java")
package com.google.cloud.dataproc.v1;
diff --git a/java-dataproc/google-cloud-dataproc/src/main/java/com/google/cloud/dataproc/v1/stub/GrpcNodeGroupControllerCallableFactory.java b/java-dataproc/google-cloud-dataproc/src/main/java/com/google/cloud/dataproc/v1/stub/GrpcNodeGroupControllerCallableFactory.java
new file mode 100644
index 000000000000..95148608da7e
--- /dev/null
+++ b/java-dataproc/google-cloud-dataproc/src/main/java/com/google/cloud/dataproc/v1/stub/GrpcNodeGroupControllerCallableFactory.java
@@ -0,0 +1,113 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.cloud.dataproc.v1.stub;
+
+import com.google.api.gax.grpc.GrpcCallSettings;
+import com.google.api.gax.grpc.GrpcCallableFactory;
+import com.google.api.gax.grpc.GrpcStubCallableFactory;
+import com.google.api.gax.rpc.BatchingCallSettings;
+import com.google.api.gax.rpc.BidiStreamingCallable;
+import com.google.api.gax.rpc.ClientContext;
+import com.google.api.gax.rpc.ClientStreamingCallable;
+import com.google.api.gax.rpc.OperationCallSettings;
+import com.google.api.gax.rpc.OperationCallable;
+import com.google.api.gax.rpc.PagedCallSettings;
+import com.google.api.gax.rpc.ServerStreamingCallSettings;
+import com.google.api.gax.rpc.ServerStreamingCallable;
+import com.google.api.gax.rpc.StreamingCallSettings;
+import com.google.api.gax.rpc.UnaryCallSettings;
+import com.google.api.gax.rpc.UnaryCallable;
+import com.google.longrunning.Operation;
+import com.google.longrunning.stub.OperationsStub;
+import javax.annotation.Generated;
+
+// AUTO-GENERATED DOCUMENTATION AND CLASS.
+/**
+ * gRPC callable factory implementation for the NodeGroupController service API.
+ *
+ *
This class is for advanced usage.
+ */
+@Generated("by gapic-generator-java")
+public class GrpcNodeGroupControllerCallableFactory implements GrpcStubCallableFactory {
+
+ @Override
+ public UnaryCallable createUnaryCallable(
+ GrpcCallSettings grpcCallSettings,
+ UnaryCallSettings callSettings,
+ ClientContext clientContext) {
+ return GrpcCallableFactory.createUnaryCallable(grpcCallSettings, callSettings, clientContext);
+ }
+
+ @Override
+ public
+ UnaryCallable createPagedCallable(
+ GrpcCallSettings grpcCallSettings,
+ PagedCallSettings callSettings,
+ ClientContext clientContext) {
+ return GrpcCallableFactory.createPagedCallable(grpcCallSettings, callSettings, clientContext);
+ }
+
+ @Override
+ public UnaryCallable createBatchingCallable(
+ GrpcCallSettings grpcCallSettings,
+ BatchingCallSettings callSettings,
+ ClientContext clientContext) {
+ return GrpcCallableFactory.createBatchingCallable(
+ grpcCallSettings, callSettings, clientContext);
+ }
+
+ @Override
+ public
+ OperationCallable createOperationCallable(
+ GrpcCallSettings grpcCallSettings,
+ OperationCallSettings callSettings,
+ ClientContext clientContext,
+ OperationsStub operationsStub) {
+ return GrpcCallableFactory.createOperationCallable(
+ grpcCallSettings, callSettings, clientContext, operationsStub);
+ }
+
+ @Override
+ public
+ BidiStreamingCallable createBidiStreamingCallable(
+ GrpcCallSettings grpcCallSettings,
+ StreamingCallSettings callSettings,
+ ClientContext clientContext) {
+ return GrpcCallableFactory.createBidiStreamingCallable(
+ grpcCallSettings, callSettings, clientContext);
+ }
+
+ @Override
+ public
+ ServerStreamingCallable createServerStreamingCallable(
+ GrpcCallSettings grpcCallSettings,
+ ServerStreamingCallSettings callSettings,
+ ClientContext clientContext) {
+ return GrpcCallableFactory.createServerStreamingCallable(
+ grpcCallSettings, callSettings, clientContext);
+ }
+
+ @Override
+ public
+ ClientStreamingCallable createClientStreamingCallable(
+ GrpcCallSettings grpcCallSettings,
+ StreamingCallSettings callSettings,
+ ClientContext clientContext) {
+ return GrpcCallableFactory.createClientStreamingCallable(
+ grpcCallSettings, callSettings, clientContext);
+ }
+}
diff --git a/java-dataproc/google-cloud-dataproc/src/main/java/com/google/cloud/dataproc/v1/stub/GrpcNodeGroupControllerStub.java b/java-dataproc/google-cloud-dataproc/src/main/java/com/google/cloud/dataproc/v1/stub/GrpcNodeGroupControllerStub.java
new file mode 100644
index 000000000000..5b7673e26cf4
--- /dev/null
+++ b/java-dataproc/google-cloud-dataproc/src/main/java/com/google/cloud/dataproc/v1/stub/GrpcNodeGroupControllerStub.java
@@ -0,0 +1,252 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.cloud.dataproc.v1.stub;
+
+import com.google.api.gax.core.BackgroundResource;
+import com.google.api.gax.core.BackgroundResourceAggregation;
+import com.google.api.gax.grpc.GrpcCallSettings;
+import com.google.api.gax.grpc.GrpcStubCallableFactory;
+import com.google.api.gax.rpc.ClientContext;
+import com.google.api.gax.rpc.OperationCallable;
+import com.google.api.gax.rpc.UnaryCallable;
+import com.google.cloud.dataproc.v1.CreateNodeGroupRequest;
+import com.google.cloud.dataproc.v1.GetNodeGroupRequest;
+import com.google.cloud.dataproc.v1.NodeGroup;
+import com.google.cloud.dataproc.v1.NodeGroupOperationMetadata;
+import com.google.cloud.dataproc.v1.ResizeNodeGroupRequest;
+import com.google.common.collect.ImmutableMap;
+import com.google.longrunning.Operation;
+import com.google.longrunning.stub.GrpcOperationsStub;
+import io.grpc.MethodDescriptor;
+import io.grpc.protobuf.ProtoUtils;
+import java.io.IOException;
+import java.util.concurrent.TimeUnit;
+import javax.annotation.Generated;
+
+// AUTO-GENERATED DOCUMENTATION AND CLASS.
+/**
+ * gRPC stub implementation for the NodeGroupController service API.
+ *
+ *
This class is for advanced usage and reflects the underlying API directly.
+ */
+@Generated("by gapic-generator-java")
+public class GrpcNodeGroupControllerStub extends NodeGroupControllerStub {
+ private static final MethodDescriptor
+ createNodeGroupMethodDescriptor =
+ MethodDescriptor.newBuilder()
+ .setType(MethodDescriptor.MethodType.UNARY)
+ .setFullMethodName("google.cloud.dataproc.v1.NodeGroupController/CreateNodeGroup")
+ .setRequestMarshaller(
+ ProtoUtils.marshaller(CreateNodeGroupRequest.getDefaultInstance()))
+ .setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance()))
+ .build();
+
+ private static final MethodDescriptor
+ resizeNodeGroupMethodDescriptor =
+ MethodDescriptor.newBuilder()
+ .setType(MethodDescriptor.MethodType.UNARY)
+ .setFullMethodName("google.cloud.dataproc.v1.NodeGroupController/ResizeNodeGroup")
+ .setRequestMarshaller(
+ ProtoUtils.marshaller(ResizeNodeGroupRequest.getDefaultInstance()))
+ .setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance()))
+ .build();
+
+ private static final MethodDescriptor
+ getNodeGroupMethodDescriptor =
+ MethodDescriptor.newBuilder()
+ .setType(MethodDescriptor.MethodType.UNARY)
+ .setFullMethodName("google.cloud.dataproc.v1.NodeGroupController/GetNodeGroup")
+ .setRequestMarshaller(ProtoUtils.marshaller(GetNodeGroupRequest.getDefaultInstance()))
+ .setResponseMarshaller(ProtoUtils.marshaller(NodeGroup.getDefaultInstance()))
+ .build();
+
+ private final UnaryCallable createNodeGroupCallable;
+ private final OperationCallable
+ createNodeGroupOperationCallable;
+ private final UnaryCallable resizeNodeGroupCallable;
+ private final OperationCallable
+ resizeNodeGroupOperationCallable;
+ private final UnaryCallable getNodeGroupCallable;
+
+ private final BackgroundResource backgroundResources;
+ private final GrpcOperationsStub operationsStub;
+ private final GrpcStubCallableFactory callableFactory;
+
+ public static final GrpcNodeGroupControllerStub create(NodeGroupControllerStubSettings settings)
+ throws IOException {
+ return new GrpcNodeGroupControllerStub(settings, ClientContext.create(settings));
+ }
+
+ public static final GrpcNodeGroupControllerStub create(ClientContext clientContext)
+ throws IOException {
+ return new GrpcNodeGroupControllerStub(
+ NodeGroupControllerStubSettings.newBuilder().build(), clientContext);
+ }
+
+ public static final GrpcNodeGroupControllerStub create(
+ ClientContext clientContext, GrpcStubCallableFactory callableFactory) throws IOException {
+ return new GrpcNodeGroupControllerStub(
+ NodeGroupControllerStubSettings.newBuilder().build(), clientContext, callableFactory);
+ }
+
+ /**
+ * Constructs an instance of GrpcNodeGroupControllerStub, 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.
+ */
+ protected GrpcNodeGroupControllerStub(
+ NodeGroupControllerStubSettings settings, ClientContext clientContext) throws IOException {
+ this(settings, clientContext, new GrpcNodeGroupControllerCallableFactory());
+ }
+
+ /**
+ * Constructs an instance of GrpcNodeGroupControllerStub, 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.
+ */
+ protected GrpcNodeGroupControllerStub(
+ NodeGroupControllerStubSettings settings,
+ ClientContext clientContext,
+ GrpcStubCallableFactory callableFactory)
+ throws IOException {
+ this.callableFactory = callableFactory;
+ this.operationsStub = GrpcOperationsStub.create(clientContext, callableFactory);
+
+ GrpcCallSettings createNodeGroupTransportSettings =
+ GrpcCallSettings.newBuilder()
+ .setMethodDescriptor(createNodeGroupMethodDescriptor)
+ .setParamsExtractor(
+ request -> {
+ ImmutableMap.Builder params = ImmutableMap.builder();
+ params.put("parent", String.valueOf(request.getParent()));
+ return params.build();
+ })
+ .build();
+ GrpcCallSettings resizeNodeGroupTransportSettings =
+ GrpcCallSettings.newBuilder()
+ .setMethodDescriptor(resizeNodeGroupMethodDescriptor)
+ .setParamsExtractor(
+ request -> {
+ ImmutableMap.Builder params = ImmutableMap.builder();
+ params.put("name", String.valueOf(request.getName()));
+ return params.build();
+ })
+ .build();
+ GrpcCallSettings getNodeGroupTransportSettings =
+ GrpcCallSettings.newBuilder()
+ .setMethodDescriptor(getNodeGroupMethodDescriptor)
+ .setParamsExtractor(
+ request -> {
+ ImmutableMap.Builder params = ImmutableMap.builder();
+ params.put("name", String.valueOf(request.getName()));
+ return params.build();
+ })
+ .build();
+
+ this.createNodeGroupCallable =
+ callableFactory.createUnaryCallable(
+ createNodeGroupTransportSettings, settings.createNodeGroupSettings(), clientContext);
+ this.createNodeGroupOperationCallable =
+ callableFactory.createOperationCallable(
+ createNodeGroupTransportSettings,
+ settings.createNodeGroupOperationSettings(),
+ clientContext,
+ operationsStub);
+ this.resizeNodeGroupCallable =
+ callableFactory.createUnaryCallable(
+ resizeNodeGroupTransportSettings, settings.resizeNodeGroupSettings(), clientContext);
+ this.resizeNodeGroupOperationCallable =
+ callableFactory.createOperationCallable(
+ resizeNodeGroupTransportSettings,
+ settings.resizeNodeGroupOperationSettings(),
+ clientContext,
+ operationsStub);
+ this.getNodeGroupCallable =
+ callableFactory.createUnaryCallable(
+ getNodeGroupTransportSettings, settings.getNodeGroupSettings(), clientContext);
+
+ this.backgroundResources =
+ new BackgroundResourceAggregation(clientContext.getBackgroundResources());
+ }
+
+ public GrpcOperationsStub getOperationsStub() {
+ return operationsStub;
+ }
+
+ @Override
+ public UnaryCallable createNodeGroupCallable() {
+ return createNodeGroupCallable;
+ }
+
+ @Override
+ public OperationCallable
+ createNodeGroupOperationCallable() {
+ return createNodeGroupOperationCallable;
+ }
+
+ @Override
+ public UnaryCallable resizeNodeGroupCallable() {
+ return resizeNodeGroupCallable;
+ }
+
+ @Override
+ public OperationCallable
+ resizeNodeGroupOperationCallable() {
+ return resizeNodeGroupOperationCallable;
+ }
+
+ @Override
+ public UnaryCallable getNodeGroupCallable() {
+ return getNodeGroupCallable;
+ }
+
+ @Override
+ public final void close() {
+ try {
+ backgroundResources.close();
+ } catch (RuntimeException e) {
+ throw e;
+ } catch (Exception e) {
+ throw new IllegalStateException("Failed to close resource", e);
+ }
+ }
+
+ @Override
+ public void shutdown() {
+ backgroundResources.shutdown();
+ }
+
+ @Override
+ public boolean isShutdown() {
+ return backgroundResources.isShutdown();
+ }
+
+ @Override
+ public boolean isTerminated() {
+ return backgroundResources.isTerminated();
+ }
+
+ @Override
+ public void shutdownNow() {
+ backgroundResources.shutdownNow();
+ }
+
+ @Override
+ public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException {
+ return backgroundResources.awaitTermination(duration, unit);
+ }
+}
diff --git a/java-dataproc/google-cloud-dataproc/src/main/java/com/google/cloud/dataproc/v1/stub/HttpJsonNodeGroupControllerCallableFactory.java b/java-dataproc/google-cloud-dataproc/src/main/java/com/google/cloud/dataproc/v1/stub/HttpJsonNodeGroupControllerCallableFactory.java
new file mode 100644
index 000000000000..e3209b9e61ac
--- /dev/null
+++ b/java-dataproc/google-cloud-dataproc/src/main/java/com/google/cloud/dataproc/v1/stub/HttpJsonNodeGroupControllerCallableFactory.java
@@ -0,0 +1,105 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.cloud.dataproc.v1.stub;
+
+import com.google.api.core.BetaApi;
+import com.google.api.gax.httpjson.HttpJsonCallSettings;
+import com.google.api.gax.httpjson.HttpJsonCallableFactory;
+import com.google.api.gax.httpjson.HttpJsonOperationSnapshotCallable;
+import com.google.api.gax.httpjson.HttpJsonStubCallableFactory;
+import com.google.api.gax.httpjson.longrunning.stub.OperationsStub;
+import com.google.api.gax.rpc.BatchingCallSettings;
+import com.google.api.gax.rpc.ClientContext;
+import com.google.api.gax.rpc.OperationCallSettings;
+import com.google.api.gax.rpc.OperationCallable;
+import com.google.api.gax.rpc.PagedCallSettings;
+import com.google.api.gax.rpc.ServerStreamingCallSettings;
+import com.google.api.gax.rpc.ServerStreamingCallable;
+import com.google.api.gax.rpc.UnaryCallSettings;
+import com.google.api.gax.rpc.UnaryCallable;
+import com.google.longrunning.Operation;
+import javax.annotation.Generated;
+
+// AUTO-GENERATED DOCUMENTATION AND CLASS.
+/**
+ * REST callable factory implementation for the NodeGroupController service API.
+ *
+ *
This class is for advanced usage.
+ */
+@Generated("by gapic-generator-java")
+@BetaApi
+public class HttpJsonNodeGroupControllerCallableFactory
+ implements HttpJsonStubCallableFactory {
+
+ @Override
+ public UnaryCallable createUnaryCallable(
+ HttpJsonCallSettings httpJsonCallSettings,
+ UnaryCallSettings callSettings,
+ ClientContext clientContext) {
+ return HttpJsonCallableFactory.createUnaryCallable(
+ httpJsonCallSettings, callSettings, clientContext);
+ }
+
+ @Override
+ public
+ UnaryCallable createPagedCallable(
+ HttpJsonCallSettings httpJsonCallSettings,
+ PagedCallSettings callSettings,
+ ClientContext clientContext) {
+ return HttpJsonCallableFactory.createPagedCallable(
+ httpJsonCallSettings, callSettings, clientContext);
+ }
+
+ @Override
+ public UnaryCallable createBatchingCallable(
+ HttpJsonCallSettings httpJsonCallSettings,
+ BatchingCallSettings callSettings,
+ ClientContext clientContext) {
+ return HttpJsonCallableFactory.createBatchingCallable(
+ httpJsonCallSettings, callSettings, clientContext);
+ }
+
+ @BetaApi(
+ "The surface for long-running operations is not stable yet and may change in the future.")
+ @Override
+ public
+ OperationCallable createOperationCallable(
+ HttpJsonCallSettings httpJsonCallSettings,
+ OperationCallSettings callSettings,
+ ClientContext clientContext,
+ OperationsStub operationsStub) {
+ UnaryCallable innerCallable =
+ HttpJsonCallableFactory.createBaseUnaryCallable(
+ httpJsonCallSettings, callSettings.getInitialCallSettings(), clientContext);
+ HttpJsonOperationSnapshotCallable initialCallable =
+ new HttpJsonOperationSnapshotCallable(
+ innerCallable,
+ httpJsonCallSettings.getMethodDescriptor().getOperationSnapshotFactory());
+ return HttpJsonCallableFactory.createOperationCallable(
+ callSettings, clientContext, operationsStub.longRunningClient(), initialCallable);
+ }
+
+ @Override
+ public
+ ServerStreamingCallable createServerStreamingCallable(
+ HttpJsonCallSettings httpJsonCallSettings,
+ ServerStreamingCallSettings callSettings,
+ ClientContext clientContext) {
+ return HttpJsonCallableFactory.createServerStreamingCallable(
+ httpJsonCallSettings, callSettings, clientContext);
+ }
+}
diff --git a/java-dataproc/google-cloud-dataproc/src/main/java/com/google/cloud/dataproc/v1/stub/HttpJsonNodeGroupControllerStub.java b/java-dataproc/google-cloud-dataproc/src/main/java/com/google/cloud/dataproc/v1/stub/HttpJsonNodeGroupControllerStub.java
new file mode 100644
index 000000000000..0acea0d80617
--- /dev/null
+++ b/java-dataproc/google-cloud-dataproc/src/main/java/com/google/cloud/dataproc/v1/stub/HttpJsonNodeGroupControllerStub.java
@@ -0,0 +1,353 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.cloud.dataproc.v1.stub;
+
+import com.google.api.core.BetaApi;
+import com.google.api.core.InternalApi;
+import com.google.api.gax.core.BackgroundResource;
+import com.google.api.gax.core.BackgroundResourceAggregation;
+import com.google.api.gax.httpjson.ApiMethodDescriptor;
+import com.google.api.gax.httpjson.HttpJsonCallSettings;
+import com.google.api.gax.httpjson.HttpJsonOperationSnapshot;
+import com.google.api.gax.httpjson.HttpJsonStubCallableFactory;
+import com.google.api.gax.httpjson.ProtoMessageRequestFormatter;
+import com.google.api.gax.httpjson.ProtoMessageResponseParser;
+import com.google.api.gax.httpjson.ProtoRestSerializer;
+import com.google.api.gax.httpjson.longrunning.stub.HttpJsonOperationsStub;
+import com.google.api.gax.rpc.ClientContext;
+import com.google.api.gax.rpc.OperationCallable;
+import com.google.api.gax.rpc.UnaryCallable;
+import com.google.cloud.dataproc.v1.CreateNodeGroupRequest;
+import com.google.cloud.dataproc.v1.GetNodeGroupRequest;
+import com.google.cloud.dataproc.v1.NodeGroup;
+import com.google.cloud.dataproc.v1.NodeGroupOperationMetadata;
+import com.google.cloud.dataproc.v1.ResizeNodeGroupRequest;
+import com.google.longrunning.Operation;
+import com.google.protobuf.TypeRegistry;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.TimeUnit;
+import javax.annotation.Generated;
+
+// AUTO-GENERATED DOCUMENTATION AND CLASS.
+/**
+ * REST stub implementation for the NodeGroupController service API.
+ *
+ *
This class is for advanced usage and reflects the underlying API directly.
+ */
+@Generated("by gapic-generator-java")
+@BetaApi
+public class HttpJsonNodeGroupControllerStub extends NodeGroupControllerStub {
+ private static final TypeRegistry typeRegistry =
+ TypeRegistry.newBuilder()
+ .add(NodeGroup.getDescriptor())
+ .add(NodeGroupOperationMetadata.getDescriptor())
+ .build();
+
+ private static final ApiMethodDescriptor
+ createNodeGroupMethodDescriptor =
+ ApiMethodDescriptor.newBuilder()
+ .setFullMethodName("google.cloud.dataproc.v1.NodeGroupController/CreateNodeGroup")
+ .setHttpMethod("POST")
+ .setType(ApiMethodDescriptor.MethodType.UNARY)
+ .setRequestFormatter(
+ ProtoMessageRequestFormatter.newBuilder()
+ .setPath(
+ "/v1/{parent=projects/*/regions/*/clusters/*}/nodeGroups",
+ request -> {
+ Map fields = new HashMap<>();
+ ProtoRestSerializer serializer =
+ ProtoRestSerializer.create();
+ serializer.putPathParam(fields, "parent", request.getParent());
+ return fields;
+ })
+ .setQueryParamsExtractor(
+ request -> {
+ Map> fields = new HashMap<>();
+ ProtoRestSerializer serializer =
+ ProtoRestSerializer.create();
+ serializer.putQueryParam(
+ fields, "nodeGroupId", request.getNodeGroupId());
+ serializer.putQueryParam(fields, "requestId", request.getRequestId());
+ serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int");
+ return fields;
+ })
+ .setRequestBodyExtractor(
+ request ->
+ ProtoRestSerializer.create()
+ .toBody("nodeGroup", request.getNodeGroup(), true))
+ .build())
+ .setResponseParser(
+ ProtoMessageResponseParser.newBuilder()
+ .setDefaultInstance(Operation.getDefaultInstance())
+ .setDefaultTypeRegistry(typeRegistry)
+ .build())
+ .setOperationSnapshotFactory(
+ (CreateNodeGroupRequest request, Operation response) ->
+ HttpJsonOperationSnapshot.create(response))
+ .build();
+
+ private static final ApiMethodDescriptor
+ resizeNodeGroupMethodDescriptor =
+ ApiMethodDescriptor.newBuilder()
+ .setFullMethodName("google.cloud.dataproc.v1.NodeGroupController/ResizeNodeGroup")
+ .setHttpMethod("POST")
+ .setType(ApiMethodDescriptor.MethodType.UNARY)
+ .setRequestFormatter(
+ ProtoMessageRequestFormatter.newBuilder()
+ .setPath(
+ "/v1/{name=projects/*/regions/*/clusters/*/nodeGroups/*}:resize",
+ request -> {
+ Map fields = new HashMap<>();
+ ProtoRestSerializer serializer =
+ ProtoRestSerializer.create();
+ serializer.putPathParam(fields, "name", request.getName());
+ return fields;
+ })
+ .setQueryParamsExtractor(
+ request -> {
+ Map> fields = new HashMap<>();
+ ProtoRestSerializer serializer =
+ ProtoRestSerializer.create();
+ serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int");
+ return fields;
+ })
+ .setRequestBodyExtractor(
+ request ->
+ ProtoRestSerializer.create()
+ .toBody("*", request.toBuilder().clearName().build(), true))
+ .build())
+ .setResponseParser(
+ ProtoMessageResponseParser.newBuilder()
+ .setDefaultInstance(Operation.getDefaultInstance())
+ .setDefaultTypeRegistry(typeRegistry)
+ .build())
+ .setOperationSnapshotFactory(
+ (ResizeNodeGroupRequest request, Operation response) ->
+ HttpJsonOperationSnapshot.create(response))
+ .build();
+
+ private static final ApiMethodDescriptor
+ getNodeGroupMethodDescriptor =
+ ApiMethodDescriptor.newBuilder()
+ .setFullMethodName("google.cloud.dataproc.v1.NodeGroupController/GetNodeGroup")
+ .setHttpMethod("GET")
+ .setType(ApiMethodDescriptor.MethodType.UNARY)
+ .setRequestFormatter(
+ ProtoMessageRequestFormatter.newBuilder()
+ .setPath(
+ "/v1/{name=projects/*/regions/*/clusters/*/nodeGroups/*}",
+ request -> {
+ Map fields = new HashMap<>();
+ ProtoRestSerializer serializer =
+ ProtoRestSerializer.create();
+ serializer.putPathParam(fields, "name", request.getName());
+ return fields;
+ })
+ .setQueryParamsExtractor(
+ request -> {
+ Map> fields = new HashMap<>();
+ ProtoRestSerializer serializer =
+ ProtoRestSerializer.create();
+ serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int");
+ return fields;
+ })
+ .setRequestBodyExtractor(request -> null)
+ .build())
+ .setResponseParser(
+ ProtoMessageResponseParser.newBuilder()
+ .setDefaultInstance(NodeGroup.getDefaultInstance())
+ .setDefaultTypeRegistry(typeRegistry)
+ .build())
+ .build();
+
+ private final UnaryCallable createNodeGroupCallable;
+ private final OperationCallable
+ createNodeGroupOperationCallable;
+ private final UnaryCallable resizeNodeGroupCallable;
+ private final OperationCallable
+ resizeNodeGroupOperationCallable;
+ private final UnaryCallable getNodeGroupCallable;
+
+ private final BackgroundResource backgroundResources;
+ private final HttpJsonOperationsStub httpJsonOperationsStub;
+ private final HttpJsonStubCallableFactory callableFactory;
+
+ public static final HttpJsonNodeGroupControllerStub create(
+ NodeGroupControllerStubSettings settings) throws IOException {
+ return new HttpJsonNodeGroupControllerStub(settings, ClientContext.create(settings));
+ }
+
+ public static final HttpJsonNodeGroupControllerStub create(ClientContext clientContext)
+ throws IOException {
+ return new HttpJsonNodeGroupControllerStub(
+ NodeGroupControllerStubSettings.newHttpJsonBuilder().build(), clientContext);
+ }
+
+ public static final HttpJsonNodeGroupControllerStub create(
+ ClientContext clientContext, HttpJsonStubCallableFactory callableFactory) throws IOException {
+ return new HttpJsonNodeGroupControllerStub(
+ NodeGroupControllerStubSettings.newHttpJsonBuilder().build(),
+ clientContext,
+ callableFactory);
+ }
+
+ /**
+ * Constructs an instance of HttpJsonNodeGroupControllerStub, 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.
+ */
+ protected HttpJsonNodeGroupControllerStub(
+ NodeGroupControllerStubSettings settings, ClientContext clientContext) throws IOException {
+ this(settings, clientContext, new HttpJsonNodeGroupControllerCallableFactory());
+ }
+
+ /**
+ * Constructs an instance of HttpJsonNodeGroupControllerStub, 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.
+ */
+ protected HttpJsonNodeGroupControllerStub(
+ NodeGroupControllerStubSettings settings,
+ ClientContext clientContext,
+ HttpJsonStubCallableFactory callableFactory)
+ throws IOException {
+ this.callableFactory = callableFactory;
+ this.httpJsonOperationsStub =
+ HttpJsonOperationsStub.create(clientContext, callableFactory, typeRegistry);
+
+ HttpJsonCallSettings createNodeGroupTransportSettings =
+ HttpJsonCallSettings.newBuilder()
+ .setMethodDescriptor(createNodeGroupMethodDescriptor)
+ .setTypeRegistry(typeRegistry)
+ .build();
+ HttpJsonCallSettings resizeNodeGroupTransportSettings =
+ HttpJsonCallSettings.newBuilder()
+ .setMethodDescriptor(resizeNodeGroupMethodDescriptor)
+ .setTypeRegistry(typeRegistry)
+ .build();
+ HttpJsonCallSettings getNodeGroupTransportSettings =
+ HttpJsonCallSettings.newBuilder()
+ .setMethodDescriptor(getNodeGroupMethodDescriptor)
+ .setTypeRegistry(typeRegistry)
+ .build();
+
+ this.createNodeGroupCallable =
+ callableFactory.createUnaryCallable(
+ createNodeGroupTransportSettings, settings.createNodeGroupSettings(), clientContext);
+ this.createNodeGroupOperationCallable =
+ callableFactory.createOperationCallable(
+ createNodeGroupTransportSettings,
+ settings.createNodeGroupOperationSettings(),
+ clientContext,
+ httpJsonOperationsStub);
+ this.resizeNodeGroupCallable =
+ callableFactory.createUnaryCallable(
+ resizeNodeGroupTransportSettings, settings.resizeNodeGroupSettings(), clientContext);
+ this.resizeNodeGroupOperationCallable =
+ callableFactory.createOperationCallable(
+ resizeNodeGroupTransportSettings,
+ settings.resizeNodeGroupOperationSettings(),
+ clientContext,
+ httpJsonOperationsStub);
+ this.getNodeGroupCallable =
+ callableFactory.createUnaryCallable(
+ getNodeGroupTransportSettings, settings.getNodeGroupSettings(), clientContext);
+
+ this.backgroundResources =
+ new BackgroundResourceAggregation(clientContext.getBackgroundResources());
+ }
+
+ @InternalApi
+ public static List getMethodDescriptors() {
+ List methodDescriptors = new ArrayList<>();
+ methodDescriptors.add(createNodeGroupMethodDescriptor);
+ methodDescriptors.add(resizeNodeGroupMethodDescriptor);
+ methodDescriptors.add(getNodeGroupMethodDescriptor);
+ return methodDescriptors;
+ }
+
+ public HttpJsonOperationsStub getHttpJsonOperationsStub() {
+ return httpJsonOperationsStub;
+ }
+
+ @Override
+ public UnaryCallable createNodeGroupCallable() {
+ return createNodeGroupCallable;
+ }
+
+ @Override
+ public OperationCallable
+ createNodeGroupOperationCallable() {
+ return createNodeGroupOperationCallable;
+ }
+
+ @Override
+ public UnaryCallable resizeNodeGroupCallable() {
+ return resizeNodeGroupCallable;
+ }
+
+ @Override
+ public OperationCallable
+ resizeNodeGroupOperationCallable() {
+ return resizeNodeGroupOperationCallable;
+ }
+
+ @Override
+ public UnaryCallable getNodeGroupCallable() {
+ return getNodeGroupCallable;
+ }
+
+ @Override
+ public final void close() {
+ try {
+ backgroundResources.close();
+ } catch (RuntimeException e) {
+ throw e;
+ } catch (Exception e) {
+ throw new IllegalStateException("Failed to close resource", e);
+ }
+ }
+
+ @Override
+ public void shutdown() {
+ backgroundResources.shutdown();
+ }
+
+ @Override
+ public boolean isShutdown() {
+ return backgroundResources.isShutdown();
+ }
+
+ @Override
+ public boolean isTerminated() {
+ return backgroundResources.isTerminated();
+ }
+
+ @Override
+ public void shutdownNow() {
+ backgroundResources.shutdownNow();
+ }
+
+ @Override
+ public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException {
+ return backgroundResources.awaitTermination(duration, unit);
+ }
+}
diff --git a/java-dataproc/google-cloud-dataproc/src/main/java/com/google/cloud/dataproc/v1/stub/NodeGroupControllerStub.java b/java-dataproc/google-cloud-dataproc/src/main/java/com/google/cloud/dataproc/v1/stub/NodeGroupControllerStub.java
new file mode 100644
index 000000000000..168f263a9449
--- /dev/null
+++ b/java-dataproc/google-cloud-dataproc/src/main/java/com/google/cloud/dataproc/v1/stub/NodeGroupControllerStub.java
@@ -0,0 +1,72 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.cloud.dataproc.v1.stub;
+
+import com.google.api.gax.core.BackgroundResource;
+import com.google.api.gax.rpc.OperationCallable;
+import com.google.api.gax.rpc.UnaryCallable;
+import com.google.cloud.dataproc.v1.CreateNodeGroupRequest;
+import com.google.cloud.dataproc.v1.GetNodeGroupRequest;
+import com.google.cloud.dataproc.v1.NodeGroup;
+import com.google.cloud.dataproc.v1.NodeGroupOperationMetadata;
+import com.google.cloud.dataproc.v1.ResizeNodeGroupRequest;
+import com.google.longrunning.Operation;
+import com.google.longrunning.stub.OperationsStub;
+import javax.annotation.Generated;
+
+// AUTO-GENERATED DOCUMENTATION AND CLASS.
+/**
+ * Base stub class for the NodeGroupController service API.
+ *
+ *
This class is for advanced usage and reflects the underlying API directly.
+ */
+@Generated("by gapic-generator-java")
+public abstract class NodeGroupControllerStub implements BackgroundResource {
+
+ public OperationsStub getOperationsStub() {
+ return null;
+ }
+
+ public com.google.api.gax.httpjson.longrunning.stub.OperationsStub getHttpJsonOperationsStub() {
+ return null;
+ }
+
+ public OperationCallable
+ createNodeGroupOperationCallable() {
+ throw new UnsupportedOperationException("Not implemented: createNodeGroupOperationCallable()");
+ }
+
+ public UnaryCallable createNodeGroupCallable() {
+ throw new UnsupportedOperationException("Not implemented: createNodeGroupCallable()");
+ }
+
+ public OperationCallable
+ resizeNodeGroupOperationCallable() {
+ throw new UnsupportedOperationException("Not implemented: resizeNodeGroupOperationCallable()");
+ }
+
+ public UnaryCallable resizeNodeGroupCallable() {
+ throw new UnsupportedOperationException("Not implemented: resizeNodeGroupCallable()");
+ }
+
+ public UnaryCallable getNodeGroupCallable() {
+ throw new UnsupportedOperationException("Not implemented: getNodeGroupCallable()");
+ }
+
+ @Override
+ public abstract void close();
+}
diff --git a/java-dataproc/google-cloud-dataproc/src/main/java/com/google/cloud/dataproc/v1/stub/NodeGroupControllerStubSettings.java b/java-dataproc/google-cloud-dataproc/src/main/java/com/google/cloud/dataproc/v1/stub/NodeGroupControllerStubSettings.java
new file mode 100644
index 000000000000..dabb606ce4c2
--- /dev/null
+++ b/java-dataproc/google-cloud-dataproc/src/main/java/com/google/cloud/dataproc/v1/stub/NodeGroupControllerStubSettings.java
@@ -0,0 +1,461 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.cloud.dataproc.v1.stub;
+
+import com.google.api.core.ApiFunction;
+import com.google.api.core.BetaApi;
+import com.google.api.gax.core.GaxProperties;
+import com.google.api.gax.core.GoogleCredentialsProvider;
+import com.google.api.gax.core.InstantiatingExecutorProvider;
+import com.google.api.gax.grpc.GaxGrpcProperties;
+import com.google.api.gax.grpc.GrpcTransportChannel;
+import com.google.api.gax.grpc.InstantiatingGrpcChannelProvider;
+import com.google.api.gax.grpc.ProtoOperationTransformers;
+import com.google.api.gax.httpjson.GaxHttpJsonProperties;
+import com.google.api.gax.httpjson.HttpJsonTransportChannel;
+import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider;
+import com.google.api.gax.longrunning.OperationSnapshot;
+import com.google.api.gax.longrunning.OperationTimedPollAlgorithm;
+import com.google.api.gax.retrying.RetrySettings;
+import com.google.api.gax.rpc.ApiClientHeaderProvider;
+import com.google.api.gax.rpc.ClientContext;
+import com.google.api.gax.rpc.OperationCallSettings;
+import com.google.api.gax.rpc.StatusCode;
+import com.google.api.gax.rpc.StubSettings;
+import com.google.api.gax.rpc.TransportChannelProvider;
+import com.google.api.gax.rpc.UnaryCallSettings;
+import com.google.cloud.dataproc.v1.CreateNodeGroupRequest;
+import com.google.cloud.dataproc.v1.GetNodeGroupRequest;
+import com.google.cloud.dataproc.v1.NodeGroup;
+import com.google.cloud.dataproc.v1.NodeGroupOperationMetadata;
+import com.google.cloud.dataproc.v1.ResizeNodeGroupRequest;
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.ImmutableSet;
+import com.google.common.collect.Lists;
+import com.google.longrunning.Operation;
+import java.io.IOException;
+import java.util.List;
+import javax.annotation.Generated;
+import org.threeten.bp.Duration;
+
+// AUTO-GENERATED DOCUMENTATION AND CLASS.
+/**
+ * Settings class to configure an instance of {@link NodeGroupControllerStub}.
+ *
+ *
The default instance has everything set to sensible defaults:
+ *
+ *
+ *
The default service address (dataproc.googleapis.com) and default port (443) are used.
+ *
Credentials are acquired automatically through Application Default Credentials.
+ *
Retries are configured for idempotent methods but not for non-idempotent methods.
+ *
+ *
+ *
The builder of this class is recursive, so contained classes are themselves builders. When
+ * build() is called, the tree of builders is called to create the complete settings object.
+ *
+ *
For example, to set the total timeout of getNodeGroup to 30 seconds:
+ *
+ *
{@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
+ * NodeGroupControllerStubSettings.Builder nodeGroupControllerSettingsBuilder =
+ * NodeGroupControllerStubSettings.newBuilder();
+ * nodeGroupControllerSettingsBuilder
+ * .getNodeGroupSettings()
+ * .setRetrySettings(
+ * nodeGroupControllerSettingsBuilder.getNodeGroupSettings().getRetrySettings().toBuilder()
+ * .setTotalTimeout(Duration.ofSeconds(30))
+ * .build());
+ * NodeGroupControllerStubSettings nodeGroupControllerSettings =
+ * nodeGroupControllerSettingsBuilder.build();
+ * }
+ */
+@Generated("by gapic-generator-java")
+public class NodeGroupControllerStubSettings extends StubSettings {
+ /** The default scopes of the service. */
+ private static final ImmutableList DEFAULT_SERVICE_SCOPES =
+ ImmutableList.builder().add("https://www.googleapis.com/auth/cloud-platform").build();
+
+ private final UnaryCallSettings createNodeGroupSettings;
+ private final OperationCallSettings
+ createNodeGroupOperationSettings;
+ private final UnaryCallSettings resizeNodeGroupSettings;
+ private final OperationCallSettings
+ resizeNodeGroupOperationSettings;
+ private final UnaryCallSettings getNodeGroupSettings;
+
+ /** Returns the object with the settings used for calls to createNodeGroup. */
+ public UnaryCallSettings createNodeGroupSettings() {
+ return createNodeGroupSettings;
+ }
+
+ /** Returns the object with the settings used for calls to createNodeGroup. */
+ public OperationCallSettings
+ createNodeGroupOperationSettings() {
+ return createNodeGroupOperationSettings;
+ }
+
+ /** Returns the object with the settings used for calls to resizeNodeGroup. */
+ public UnaryCallSettings resizeNodeGroupSettings() {
+ return resizeNodeGroupSettings;
+ }
+
+ /** Returns the object with the settings used for calls to resizeNodeGroup. */
+ public OperationCallSettings
+ resizeNodeGroupOperationSettings() {
+ return resizeNodeGroupOperationSettings;
+ }
+
+ /** Returns the object with the settings used for calls to getNodeGroup. */
+ public UnaryCallSettings getNodeGroupSettings() {
+ return getNodeGroupSettings;
+ }
+
+ public NodeGroupControllerStub createStub() throws IOException {
+ if (getTransportChannelProvider()
+ .getTransportName()
+ .equals(GrpcTransportChannel.getGrpcTransportName())) {
+ return GrpcNodeGroupControllerStub.create(this);
+ }
+ if (getTransportChannelProvider()
+ .getTransportName()
+ .equals(HttpJsonTransportChannel.getHttpJsonTransportName())) {
+ return HttpJsonNodeGroupControllerStub.create(this);
+ }
+ throw new UnsupportedOperationException(
+ String.format(
+ "Transport not supported: %s", getTransportChannelProvider().getTransportName()));
+ }
+
+ /** Returns a builder for the default ExecutorProvider for this service. */
+ public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() {
+ return InstantiatingExecutorProvider.newBuilder();
+ }
+
+ /** Returns the default service endpoint. */
+ public static String getDefaultEndpoint() {
+ return "dataproc.googleapis.com:443";
+ }
+
+ /** Returns the default mTLS service endpoint. */
+ public static String getDefaultMtlsEndpoint() {
+ return "dataproc.mtls.googleapis.com:443";
+ }
+
+ /** Returns the default service scopes. */
+ public static List getDefaultServiceScopes() {
+ return DEFAULT_SERVICE_SCOPES;
+ }
+
+ /** Returns a builder for the default credentials for this service. */
+ public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() {
+ return GoogleCredentialsProvider.newBuilder()
+ .setScopesToApply(DEFAULT_SERVICE_SCOPES)
+ .setUseJwtAccessWithScope(true);
+ }
+
+ /** Returns a builder for the default gRPC ChannelProvider for this service. */
+ public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() {
+ return InstantiatingGrpcChannelProvider.newBuilder()
+ .setMaxInboundMessageSize(Integer.MAX_VALUE);
+ }
+
+ /** Returns a builder for the default REST ChannelProvider for this service. */
+ @BetaApi
+ public static InstantiatingHttpJsonChannelProvider.Builder
+ defaultHttpJsonTransportProviderBuilder() {
+ return InstantiatingHttpJsonChannelProvider.newBuilder();
+ }
+
+ public static TransportChannelProvider defaultTransportChannelProvider() {
+ return defaultGrpcTransportProviderBuilder().build();
+ }
+
+ @BetaApi("The surface for customizing headers is not stable yet and may change in the future.")
+ public static ApiClientHeaderProvider.Builder defaultGrpcApiClientHeaderProviderBuilder() {
+ return ApiClientHeaderProvider.newBuilder()
+ .setGeneratedLibToken(
+ "gapic", GaxProperties.getLibraryVersion(NodeGroupControllerStubSettings.class))
+ .setTransportToken(
+ GaxGrpcProperties.getGrpcTokenName(), GaxGrpcProperties.getGrpcVersion());
+ }
+
+ @BetaApi("The surface for customizing headers is not stable yet and may change in the future.")
+ public static ApiClientHeaderProvider.Builder defaultHttpJsonApiClientHeaderProviderBuilder() {
+ return ApiClientHeaderProvider.newBuilder()
+ .setGeneratedLibToken(
+ "gapic", GaxProperties.getLibraryVersion(NodeGroupControllerStubSettings.class))
+ .setTransportToken(
+ GaxHttpJsonProperties.getHttpJsonTokenName(),
+ GaxHttpJsonProperties.getHttpJsonVersion());
+ }
+
+ public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() {
+ return NodeGroupControllerStubSettings.defaultGrpcApiClientHeaderProviderBuilder();
+ }
+
+ /** Returns a new gRPC builder for this class. */
+ public static Builder newBuilder() {
+ return Builder.createDefault();
+ }
+
+ /** Returns a new REST builder for this class. */
+ public static Builder newHttpJsonBuilder() {
+ return Builder.createHttpJsonDefault();
+ }
+
+ /** Returns a new builder for this class. */
+ public static Builder newBuilder(ClientContext clientContext) {
+ return new Builder(clientContext);
+ }
+
+ /** Returns a builder containing all the values of this settings class. */
+ public Builder toBuilder() {
+ return new Builder(this);
+ }
+
+ protected NodeGroupControllerStubSettings(Builder settingsBuilder) throws IOException {
+ super(settingsBuilder);
+
+ createNodeGroupSettings = settingsBuilder.createNodeGroupSettings().build();
+ createNodeGroupOperationSettings = settingsBuilder.createNodeGroupOperationSettings().build();
+ resizeNodeGroupSettings = settingsBuilder.resizeNodeGroupSettings().build();
+ resizeNodeGroupOperationSettings = settingsBuilder.resizeNodeGroupOperationSettings().build();
+ getNodeGroupSettings = settingsBuilder.getNodeGroupSettings().build();
+ }
+
+ /** Builder for NodeGroupControllerStubSettings. */
+ public static class Builder
+ extends StubSettings.Builder {
+ private final ImmutableList> unaryMethodSettingsBuilders;
+ private final UnaryCallSettings.Builder
+ createNodeGroupSettings;
+ private final OperationCallSettings.Builder<
+ CreateNodeGroupRequest, NodeGroup, NodeGroupOperationMetadata>
+ createNodeGroupOperationSettings;
+ private final UnaryCallSettings.Builder
+ resizeNodeGroupSettings;
+ private final OperationCallSettings.Builder<
+ ResizeNodeGroupRequest, NodeGroup, NodeGroupOperationMetadata>
+ resizeNodeGroupOperationSettings;
+ private final UnaryCallSettings.Builder getNodeGroupSettings;
+ private static final ImmutableMap>
+ RETRYABLE_CODE_DEFINITIONS;
+
+ static {
+ ImmutableMap.Builder> definitions =
+ ImmutableMap.builder();
+ definitions.put("no_retry_codes", ImmutableSet.copyOf(Lists.newArrayList()));
+ RETRYABLE_CODE_DEFINITIONS = definitions.build();
+ }
+
+ private static final ImmutableMap RETRY_PARAM_DEFINITIONS;
+
+ static {
+ ImmutableMap.Builder definitions = ImmutableMap.builder();
+ RetrySettings settings = null;
+ settings = RetrySettings.newBuilder().setRpcTimeoutMultiplier(1.0).build();
+ definitions.put("no_retry_params", settings);
+ RETRY_PARAM_DEFINITIONS = definitions.build();
+ }
+
+ protected Builder() {
+ this(((ClientContext) null));
+ }
+
+ protected Builder(ClientContext clientContext) {
+ super(clientContext);
+
+ createNodeGroupSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
+ createNodeGroupOperationSettings = OperationCallSettings.newBuilder();
+ resizeNodeGroupSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
+ resizeNodeGroupOperationSettings = OperationCallSettings.newBuilder();
+ getNodeGroupSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
+
+ unaryMethodSettingsBuilders =
+ ImmutableList.>of(
+ createNodeGroupSettings, resizeNodeGroupSettings, getNodeGroupSettings);
+ initDefaults(this);
+ }
+
+ protected Builder(NodeGroupControllerStubSettings settings) {
+ super(settings);
+
+ createNodeGroupSettings = settings.createNodeGroupSettings.toBuilder();
+ createNodeGroupOperationSettings = settings.createNodeGroupOperationSettings.toBuilder();
+ resizeNodeGroupSettings = settings.resizeNodeGroupSettings.toBuilder();
+ resizeNodeGroupOperationSettings = settings.resizeNodeGroupOperationSettings.toBuilder();
+ getNodeGroupSettings = settings.getNodeGroupSettings.toBuilder();
+
+ unaryMethodSettingsBuilders =
+ ImmutableList.>of(
+ createNodeGroupSettings, resizeNodeGroupSettings, getNodeGroupSettings);
+ }
+
+ private static Builder createDefault() {
+ Builder builder = new Builder(((ClientContext) null));
+
+ builder.setTransportChannelProvider(defaultTransportChannelProvider());
+ builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build());
+ builder.setInternalHeaderProvider(defaultApiClientHeaderProviderBuilder().build());
+ builder.setEndpoint(getDefaultEndpoint());
+ builder.setMtlsEndpoint(getDefaultMtlsEndpoint());
+ builder.setSwitchToMtlsEndpointAllowed(true);
+
+ return initDefaults(builder);
+ }
+
+ private static Builder createHttpJsonDefault() {
+ Builder builder = new Builder(((ClientContext) null));
+
+ builder.setTransportChannelProvider(defaultHttpJsonTransportProviderBuilder().build());
+ builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build());
+ builder.setInternalHeaderProvider(defaultHttpJsonApiClientHeaderProviderBuilder().build());
+ builder.setEndpoint(getDefaultEndpoint());
+ builder.setMtlsEndpoint(getDefaultMtlsEndpoint());
+ builder.setSwitchToMtlsEndpointAllowed(true);
+
+ return initDefaults(builder);
+ }
+
+ private static Builder initDefaults(Builder builder) {
+ builder
+ .createNodeGroupSettings()
+ .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_codes"))
+ .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_params"));
+
+ builder
+ .resizeNodeGroupSettings()
+ .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_codes"))
+ .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_params"));
+
+ builder
+ .getNodeGroupSettings()
+ .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_codes"))
+ .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_params"));
+
+ builder
+ .createNodeGroupOperationSettings()
+ .setInitialCallSettings(
+ UnaryCallSettings
+ .newUnaryCallSettingsBuilder()
+ .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_codes"))
+ .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_params"))
+ .build())
+ .setResponseTransformer(
+ ProtoOperationTransformers.ResponseTransformer.create(NodeGroup.class))
+ .setMetadataTransformer(
+ ProtoOperationTransformers.MetadataTransformer.create(
+ NodeGroupOperationMetadata.class))
+ .setPollingAlgorithm(
+ OperationTimedPollAlgorithm.create(
+ RetrySettings.newBuilder()
+ .setInitialRetryDelay(Duration.ofMillis(5000L))
+ .setRetryDelayMultiplier(1.5)
+ .setMaxRetryDelay(Duration.ofMillis(45000L))
+ .setInitialRpcTimeout(Duration.ZERO)
+ .setRpcTimeoutMultiplier(1.0)
+ .setMaxRpcTimeout(Duration.ZERO)
+ .setTotalTimeout(Duration.ofMillis(300000L))
+ .build()));
+
+ builder
+ .resizeNodeGroupOperationSettings()
+ .setInitialCallSettings(
+ UnaryCallSettings
+ .newUnaryCallSettingsBuilder()
+ .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_codes"))
+ .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_params"))
+ .build())
+ .setResponseTransformer(
+ ProtoOperationTransformers.ResponseTransformer.create(NodeGroup.class))
+ .setMetadataTransformer(
+ ProtoOperationTransformers.MetadataTransformer.create(
+ NodeGroupOperationMetadata.class))
+ .setPollingAlgorithm(
+ OperationTimedPollAlgorithm.create(
+ RetrySettings.newBuilder()
+ .setInitialRetryDelay(Duration.ofMillis(5000L))
+ .setRetryDelayMultiplier(1.5)
+ .setMaxRetryDelay(Duration.ofMillis(45000L))
+ .setInitialRpcTimeout(Duration.ZERO)
+ .setRpcTimeoutMultiplier(1.0)
+ .setMaxRpcTimeout(Duration.ZERO)
+ .setTotalTimeout(Duration.ofMillis(300000L))
+ .build()));
+
+ return builder;
+ }
+
+ /**
+ * Applies the given settings updater function to all of the unary API methods in this service.
+ *
+ *
Note: This method does not support applying settings to streaming methods.
+ */
+ public Builder applyToAllUnaryMethods(
+ ApiFunction, Void> settingsUpdater) {
+ super.applyToAllUnaryMethods(unaryMethodSettingsBuilders, settingsUpdater);
+ return this;
+ }
+
+ public ImmutableList> unaryMethodSettingsBuilders() {
+ return unaryMethodSettingsBuilders;
+ }
+
+ /** Returns the builder for the settings used for calls to createNodeGroup. */
+ public UnaryCallSettings.Builder createNodeGroupSettings() {
+ return createNodeGroupSettings;
+ }
+
+ /** Returns the builder for the settings used for calls to createNodeGroup. */
+ @BetaApi(
+ "The surface for use by generated code is not stable yet and may change in the future.")
+ public OperationCallSettings.Builder<
+ CreateNodeGroupRequest, NodeGroup, NodeGroupOperationMetadata>
+ createNodeGroupOperationSettings() {
+ return createNodeGroupOperationSettings;
+ }
+
+ /** Returns the builder for the settings used for calls to resizeNodeGroup. */
+ public UnaryCallSettings.Builder resizeNodeGroupSettings() {
+ return resizeNodeGroupSettings;
+ }
+
+ /** Returns the builder for the settings used for calls to resizeNodeGroup. */
+ @BetaApi(
+ "The surface for use by generated code is not stable yet and may change in the future.")
+ public OperationCallSettings.Builder<
+ ResizeNodeGroupRequest, NodeGroup, NodeGroupOperationMetadata>
+ resizeNodeGroupOperationSettings() {
+ return resizeNodeGroupOperationSettings;
+ }
+
+ /** Returns the builder for the settings used for calls to getNodeGroup. */
+ public UnaryCallSettings.Builder getNodeGroupSettings() {
+ return getNodeGroupSettings;
+ }
+
+ @Override
+ public NodeGroupControllerStubSettings build() throws IOException {
+ return new NodeGroupControllerStubSettings(this);
+ }
+ }
+}
diff --git a/java-dataproc/google-cloud-dataproc/src/test/java/com/google/cloud/dataproc/v1/JobControllerClientHttpJsonTest.java b/java-dataproc/google-cloud-dataproc/src/test/java/com/google/cloud/dataproc/v1/JobControllerClientHttpJsonTest.java
index 0bcb2ad9211d..f1c70ae5bd42 100644
--- a/java-dataproc/google-cloud-dataproc/src/test/java/com/google/cloud/dataproc/v1/JobControllerClientHttpJsonTest.java
+++ b/java-dataproc/google-cloud-dataproc/src/test/java/com/google/cloud/dataproc/v1/JobControllerClientHttpJsonTest.java
@@ -97,6 +97,7 @@ public void submitJobTest() throws Exception {
.setScheduling(JobScheduling.newBuilder().build())
.setJobUuid("jobUuid-1437868776")
.setDone(true)
+ .setDriverSchedulingConfig(DriverSchedulingConfig.newBuilder().build())
.build();
mockService.addResponse(expectedResponse);
@@ -155,6 +156,7 @@ public void submitJobAsOperationTest() throws Exception {
.setScheduling(JobScheduling.newBuilder().build())
.setJobUuid("jobUuid-1437868776")
.setDone(true)
+ .setDriverSchedulingConfig(DriverSchedulingConfig.newBuilder().build())
.build();
Operation resultOperation =
Operation.newBuilder()
@@ -218,6 +220,7 @@ public void getJobTest() throws Exception {
.setScheduling(JobScheduling.newBuilder().build())
.setJobUuid("jobUuid-1437868776")
.setDone(true)
+ .setDriverSchedulingConfig(DriverSchedulingConfig.newBuilder().build())
.build();
mockService.addResponse(expectedResponse);
@@ -382,6 +385,7 @@ public void updateJobTest() throws Exception {
.setScheduling(JobScheduling.newBuilder().build())
.setJobUuid("jobUuid-1437868776")
.setDone(true)
+ .setDriverSchedulingConfig(DriverSchedulingConfig.newBuilder().build())
.build();
mockService.addResponse(expectedResponse);
@@ -450,6 +454,7 @@ public void cancelJobTest() throws Exception {
.setScheduling(JobScheduling.newBuilder().build())
.setJobUuid("jobUuid-1437868776")
.setDone(true)
+ .setDriverSchedulingConfig(DriverSchedulingConfig.newBuilder().build())
.build();
mockService.addResponse(expectedResponse);
diff --git a/java-dataproc/google-cloud-dataproc/src/test/java/com/google/cloud/dataproc/v1/JobControllerClientTest.java b/java-dataproc/google-cloud-dataproc/src/test/java/com/google/cloud/dataproc/v1/JobControllerClientTest.java
index ffa2b83b4e3a..15db8d588ee5 100644
--- a/java-dataproc/google-cloud-dataproc/src/test/java/com/google/cloud/dataproc/v1/JobControllerClientTest.java
+++ b/java-dataproc/google-cloud-dataproc/src/test/java/com/google/cloud/dataproc/v1/JobControllerClientTest.java
@@ -101,6 +101,7 @@ public void submitJobTest() throws Exception {
.setScheduling(JobScheduling.newBuilder().build())
.setJobUuid("jobUuid-1437868776")
.setDone(true)
+ .setDriverSchedulingConfig(DriverSchedulingConfig.newBuilder().build())
.build();
mockJobController.addResponse(expectedResponse);
@@ -155,6 +156,7 @@ public void submitJobAsOperationTest() throws Exception {
.setScheduling(JobScheduling.newBuilder().build())
.setJobUuid("jobUuid-1437868776")
.setDone(true)
+ .setDriverSchedulingConfig(DriverSchedulingConfig.newBuilder().build())
.build();
Operation resultOperation =
Operation.newBuilder()
@@ -217,6 +219,7 @@ public void getJobTest() throws Exception {
.setScheduling(JobScheduling.newBuilder().build())
.setJobUuid("jobUuid-1437868776")
.setDone(true)
+ .setDriverSchedulingConfig(DriverSchedulingConfig.newBuilder().build())
.build();
mockJobController.addResponse(expectedResponse);
@@ -368,6 +371,7 @@ public void updateJobTest() throws Exception {
.setScheduling(JobScheduling.newBuilder().build())
.setJobUuid("jobUuid-1437868776")
.setDone(true)
+ .setDriverSchedulingConfig(DriverSchedulingConfig.newBuilder().build())
.build();
mockJobController.addResponse(expectedResponse);
@@ -434,6 +438,7 @@ public void cancelJobTest() throws Exception {
.setScheduling(JobScheduling.newBuilder().build())
.setJobUuid("jobUuid-1437868776")
.setDone(true)
+ .setDriverSchedulingConfig(DriverSchedulingConfig.newBuilder().build())
.build();
mockJobController.addResponse(expectedResponse);
diff --git a/java-dataproc/google-cloud-dataproc/src/test/java/com/google/cloud/dataproc/v1/MockNodeGroupController.java b/java-dataproc/google-cloud-dataproc/src/test/java/com/google/cloud/dataproc/v1/MockNodeGroupController.java
new file mode 100644
index 000000000000..7b7cff37c787
--- /dev/null
+++ b/java-dataproc/google-cloud-dataproc/src/test/java/com/google/cloud/dataproc/v1/MockNodeGroupController.java
@@ -0,0 +1,59 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.cloud.dataproc.v1;
+
+import com.google.api.core.BetaApi;
+import com.google.api.gax.grpc.testing.MockGrpcService;
+import com.google.protobuf.AbstractMessage;
+import io.grpc.ServerServiceDefinition;
+import java.util.List;
+import javax.annotation.Generated;
+
+@BetaApi
+@Generated("by gapic-generator-java")
+public class MockNodeGroupController implements MockGrpcService {
+ private final MockNodeGroupControllerImpl serviceImpl;
+
+ public MockNodeGroupController() {
+ serviceImpl = new MockNodeGroupControllerImpl();
+ }
+
+ @Override
+ public List getRequests() {
+ return serviceImpl.getRequests();
+ }
+
+ @Override
+ public void addResponse(AbstractMessage response) {
+ serviceImpl.addResponse(response);
+ }
+
+ @Override
+ public void addException(Exception exception) {
+ serviceImpl.addException(exception);
+ }
+
+ @Override
+ public ServerServiceDefinition getServiceDefinition() {
+ return serviceImpl.bindService();
+ }
+
+ @Override
+ public void reset() {
+ serviceImpl.reset();
+ }
+}
diff --git a/java-dataproc/google-cloud-dataproc/src/test/java/com/google/cloud/dataproc/v1/MockNodeGroupControllerImpl.java b/java-dataproc/google-cloud-dataproc/src/test/java/com/google/cloud/dataproc/v1/MockNodeGroupControllerImpl.java
new file mode 100644
index 000000000000..873c3d8b5148
--- /dev/null
+++ b/java-dataproc/google-cloud-dataproc/src/test/java/com/google/cloud/dataproc/v1/MockNodeGroupControllerImpl.java
@@ -0,0 +1,124 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.cloud.dataproc.v1;
+
+import com.google.api.core.BetaApi;
+import com.google.cloud.dataproc.v1.NodeGroupControllerGrpc.NodeGroupControllerImplBase;
+import com.google.longrunning.Operation;
+import com.google.protobuf.AbstractMessage;
+import io.grpc.stub.StreamObserver;
+import java.util.ArrayList;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Queue;
+import javax.annotation.Generated;
+
+@BetaApi
+@Generated("by gapic-generator-java")
+public class MockNodeGroupControllerImpl extends NodeGroupControllerImplBase {
+ private List requests;
+ private Queue