{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. * try (AutoscalingPolicyServiceClient autoscalingPolicyServiceClient = * AutoscalingPolicyServiceClient.create()) { * LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); @@ -81,6 +82,8 @@ *To customize credentials: * *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. * AutoscalingPolicyServiceSettings autoscalingPolicyServiceSettings = * AutoscalingPolicyServiceSettings.newBuilder() * .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials)) @@ -92,12 +95,29 @@ *To customize the endpoint: * *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. * AutoscalingPolicyServiceSettings autoscalingPolicyServiceSettings = * AutoscalingPolicyServiceSettings.newBuilder().setEndpoint(myEndpoint).build(); * AutoscalingPolicyServiceClient autoscalingPolicyServiceClient = * AutoscalingPolicyServiceClient.create(autoscalingPolicyServiceSettings); * }* + *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 for illustrative purposes only. + * // It may require modifications to work in your environment. + * AutoscalingPolicyServiceSettings autoscalingPolicyServiceSettings = + * AutoscalingPolicyServiceSettings.newBuilder() + * .setTransportChannelProvider( + * AutoscalingPolicyServiceSettings.defaultHttpJsonTransportProviderBuilder().build()) + * .build(); + * AutoscalingPolicyServiceClient autoscalingPolicyServiceClient = + * AutoscalingPolicyServiceClient.create(autoscalingPolicyServiceSettings); + * }+ * *Please refer to the GitHub repository's samples for more quickstart code snippets. */ @Generated("by gapic-generator-java") @@ -124,7 +144,6 @@ public static final AutoscalingPolicyServiceClient create( * Constructs an instance of AutoscalingPolicyServiceClient, using the given stub for making * calls. This is for advanced usage - prefer using create(AutoscalingPolicyServiceSettings). */ - @BetaApi("A restructuring of stub classes is planned, so this may break in the future") public static final AutoscalingPolicyServiceClient create(AutoscalingPolicyServiceStub stub) { return new AutoscalingPolicyServiceClient(stub); } @@ -140,7 +159,6 @@ protected AutoscalingPolicyServiceClient(AutoscalingPolicyServiceSettings settin this.stub = ((AutoscalingPolicyServiceStubSettings) settings.getStubSettings()).createStub(); } - @BetaApi("A restructuring of stub classes is planned, so this may break in the future") protected AutoscalingPolicyServiceClient(AutoscalingPolicyServiceStub stub) { this.settings = null; this.stub = stub; @@ -150,7 +168,6 @@ public final AutoscalingPolicyServiceSettings getSettings() { return settings; } - @BetaApi("A restructuring of stub classes is planned, so this may break in the future") public AutoscalingPolicyServiceStub getStub() { return stub; } @@ -162,6 +179,8 @@ public AutoscalingPolicyServiceStub getStub() { *
Sample code: * *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. * try (AutoscalingPolicyServiceClient autoscalingPolicyServiceClient = * AutoscalingPolicyServiceClient.create()) { * LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); @@ -202,6 +221,8 @@ public final AutoscalingPolicy createAutoscalingPolicy( *Sample code: * *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. * try (AutoscalingPolicyServiceClient autoscalingPolicyServiceClient = * AutoscalingPolicyServiceClient.create()) { * RegionName parent = RegionName.of("[PROJECT]", "[REGION]"); @@ -242,6 +263,8 @@ public final AutoscalingPolicy createAutoscalingPolicy( *Sample code: * *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. * try (AutoscalingPolicyServiceClient autoscalingPolicyServiceClient = * AutoscalingPolicyServiceClient.create()) { * String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); @@ -278,6 +301,8 @@ public final AutoscalingPolicy createAutoscalingPolicy(String parent, Autoscalin *Sample code: * *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. * try (AutoscalingPolicyServiceClient autoscalingPolicyServiceClient = * AutoscalingPolicyServiceClient.create()) { * CreateAutoscalingPolicyRequest request = @@ -303,6 +328,8 @@ public final AutoscalingPolicy createAutoscalingPolicy(CreateAutoscalingPolicyRe *Sample code: * *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. * try (AutoscalingPolicyServiceClient autoscalingPolicyServiceClient = * AutoscalingPolicyServiceClient.create()) { * CreateAutoscalingPolicyRequest request = @@ -331,6 +358,8 @@ public final AutoscalingPolicy createAutoscalingPolicy(CreateAutoscalingPolicyRe *Sample code: * *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. * try (AutoscalingPolicyServiceClient autoscalingPolicyServiceClient = * AutoscalingPolicyServiceClient.create()) { * AutoscalingPolicy policy = AutoscalingPolicy.newBuilder().build(); @@ -356,6 +385,8 @@ public final AutoscalingPolicy updateAutoscalingPolicy(AutoscalingPolicy policy) *Sample code: * *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. * try (AutoscalingPolicyServiceClient autoscalingPolicyServiceClient = * AutoscalingPolicyServiceClient.create()) { * UpdateAutoscalingPolicyRequest request = @@ -382,6 +413,8 @@ public final AutoscalingPolicy updateAutoscalingPolicy(UpdateAutoscalingPolicyRe *Sample code: * *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. * try (AutoscalingPolicyServiceClient autoscalingPolicyServiceClient = * AutoscalingPolicyServiceClient.create()) { * UpdateAutoscalingPolicyRequest request = @@ -407,6 +440,8 @@ public final AutoscalingPolicy updateAutoscalingPolicy(UpdateAutoscalingPolicyRe *Sample code: * *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. * try (AutoscalingPolicyServiceClient autoscalingPolicyServiceClient = * AutoscalingPolicyServiceClient.create()) { * AutoscalingPolicyName name = @@ -446,6 +481,8 @@ public final AutoscalingPolicy getAutoscalingPolicy(AutoscalingPolicyName name) *Sample code: * *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. * try (AutoscalingPolicyServiceClient autoscalingPolicyServiceClient = * AutoscalingPolicyServiceClient.create()) { * String name = @@ -484,6 +521,8 @@ public final AutoscalingPolicy getAutoscalingPolicy(String name) { *Sample code: * *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. * try (AutoscalingPolicyServiceClient autoscalingPolicyServiceClient = * AutoscalingPolicyServiceClient.create()) { * GetAutoscalingPolicyRequest request = @@ -511,6 +550,8 @@ public final AutoscalingPolicy getAutoscalingPolicy(GetAutoscalingPolicyRequest *Sample code: * *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. * try (AutoscalingPolicyServiceClient autoscalingPolicyServiceClient = * AutoscalingPolicyServiceClient.create()) { * GetAutoscalingPolicyRequest request = @@ -539,6 +580,8 @@ public final AutoscalingPolicy getAutoscalingPolicy(GetAutoscalingPolicyRequest *Sample code: * *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. * try (AutoscalingPolicyServiceClient autoscalingPolicyServiceClient = * AutoscalingPolicyServiceClient.create()) { * LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); @@ -577,6 +620,8 @@ public final ListAutoscalingPoliciesPagedResponse listAutoscalingPolicies(Locati *Sample code: * *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. * try (AutoscalingPolicyServiceClient autoscalingPolicyServiceClient = * AutoscalingPolicyServiceClient.create()) { * RegionName parent = RegionName.of("[PROJECT]", "[REGION]"); @@ -615,6 +660,8 @@ public final ListAutoscalingPoliciesPagedResponse listAutoscalingPolicies(Region *Sample code: * *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. * try (AutoscalingPolicyServiceClient autoscalingPolicyServiceClient = * AutoscalingPolicyServiceClient.create()) { * String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); @@ -651,6 +698,8 @@ public final ListAutoscalingPoliciesPagedResponse listAutoscalingPolicies(String *Sample code: * *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. * try (AutoscalingPolicyServiceClient autoscalingPolicyServiceClient = * AutoscalingPolicyServiceClient.create()) { * ListAutoscalingPoliciesRequest request = @@ -681,6 +730,8 @@ public final ListAutoscalingPoliciesPagedResponse listAutoscalingPolicies( *Sample code: * *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. * try (AutoscalingPolicyServiceClient autoscalingPolicyServiceClient = * AutoscalingPolicyServiceClient.create()) { * ListAutoscalingPoliciesRequest request = @@ -710,6 +761,8 @@ public final ListAutoscalingPoliciesPagedResponse listAutoscalingPolicies( *Sample code: * *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. * try (AutoscalingPolicyServiceClient autoscalingPolicyServiceClient = * AutoscalingPolicyServiceClient.create()) { * ListAutoscalingPoliciesRequest request = @@ -721,7 +774,7 @@ public final ListAutoscalingPoliciesPagedResponse listAutoscalingPolicies( * while (true) { * ListAutoscalingPoliciesResponse response = * autoscalingPolicyServiceClient.listAutoscalingPoliciesCallable().call(request); - * for (AutoscalingPolicy element : response.getResponsesList()) { + * for (AutoscalingPolicy element : response.getPoliciesList()) { * // doThingsWith(element); * } * String nextPageToken = response.getNextPageToken(); @@ -747,6 +800,8 @@ public final ListAutoscalingPoliciesPagedResponse listAutoscalingPolicies( *Sample code: * *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. * try (AutoscalingPolicyServiceClient autoscalingPolicyServiceClient = * AutoscalingPolicyServiceClient.create()) { * AutoscalingPolicyName name = @@ -787,6 +842,8 @@ public final void deleteAutoscalingPolicy(AutoscalingPolicyName name) { *Sample code: * *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. * try (AutoscalingPolicyServiceClient autoscalingPolicyServiceClient = * AutoscalingPolicyServiceClient.create()) { * String name = @@ -826,6 +883,8 @@ public final void deleteAutoscalingPolicy(String name) { *Sample code: * *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. * try (AutoscalingPolicyServiceClient autoscalingPolicyServiceClient = * AutoscalingPolicyServiceClient.create()) { * DeleteAutoscalingPolicyRequest request = @@ -854,6 +913,8 @@ public final void deleteAutoscalingPolicy(DeleteAutoscalingPolicyRequest request *Sample code: * *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. * try (AutoscalingPolicyServiceClient autoscalingPolicyServiceClient = * AutoscalingPolicyServiceClient.create()) { * DeleteAutoscalingPolicyRequest request = diff --git a/java-dataproc/google-cloud-dataproc/src/main/java/com/google/cloud/dataproc/v1/AutoscalingPolicyServiceSettings.java b/java-dataproc/google-cloud-dataproc/src/main/java/com/google/cloud/dataproc/v1/AutoscalingPolicyServiceSettings.java index 28bc9d987f93..44d8018c90ad 100644 --- a/java-dataproc/google-cloud-dataproc/src/main/java/com/google/cloud/dataproc/v1/AutoscalingPolicyServiceSettings.java +++ b/java-dataproc/google-cloud-dataproc/src/main/java/com/google/cloud/dataproc/v1/AutoscalingPolicyServiceSettings.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Google LLC + * 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. @@ -23,6 +23,7 @@ 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; @@ -53,6 +54,8 @@ *For example, to set the total timeout of createAutoscalingPolicy to 30 seconds: * *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. * AutoscalingPolicyServiceSettings.Builder autoscalingPolicyServiceSettingsBuilder = * AutoscalingPolicyServiceSettings.newBuilder(); * autoscalingPolicyServiceSettingsBuilder @@ -135,11 +138,18 @@ public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilde return AutoscalingPolicyServiceStubSettings.defaultCredentialsProviderBuilder(); } - /** Returns a builder for the default ChannelProvider for this service. */ + /** Returns a builder for the default gRPC ChannelProvider for this service. */ public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() { return AutoscalingPolicyServiceStubSettings.defaultGrpcTransportProviderBuilder(); } + /** Returns a builder for the default REST ChannelProvider for this service. */ + @BetaApi + public static InstantiatingHttpJsonChannelProvider.Builder + defaultHttpJsonTransportProviderBuilder() { + return AutoscalingPolicyServiceStubSettings.defaultHttpJsonTransportProviderBuilder(); + } + public static TransportChannelProvider defaultTransportChannelProvider() { return AutoscalingPolicyServiceStubSettings.defaultTransportChannelProvider(); } @@ -149,11 +159,17 @@ public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuil return AutoscalingPolicyServiceStubSettings.defaultApiClientHeaderProviderBuilder(); } - /** Returns a new builder for this class. */ + /** 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); @@ -192,6 +208,11 @@ private static Builder createDefault() { return new Builder(AutoscalingPolicyServiceStubSettings.newBuilder()); } + @BetaApi + private static Builder createHttpJsonDefault() { + return new Builder(AutoscalingPolicyServiceStubSettings.newHttpJsonBuilder()); + } + public AutoscalingPolicyServiceStubSettings.Builder getStubSettingsBuilder() { return ((AutoscalingPolicyServiceStubSettings.Builder) getStubSettings()); } diff --git a/java-dataproc/google-cloud-dataproc/src/main/java/com/google/cloud/dataproc/v1/BatchControllerClient.java b/java-dataproc/google-cloud-dataproc/src/main/java/com/google/cloud/dataproc/v1/BatchControllerClient.java index 6a52d75eba07..c8f26d1d7616 100644 --- a/java-dataproc/google-cloud-dataproc/src/main/java/com/google/cloud/dataproc/v1/BatchControllerClient.java +++ b/java-dataproc/google-cloud-dataproc/src/main/java/com/google/cloud/dataproc/v1/BatchControllerClient.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Google LLC + * 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. @@ -20,6 +20,7 @@ import com.google.api.core.ApiFutures; 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.paging.AbstractFixedSizeCollection; import com.google.api.gax.paging.AbstractPage; @@ -31,7 +32,6 @@ import com.google.cloud.dataproc.v1.stub.BatchControllerStubSettings; import com.google.common.util.concurrent.MoreExecutors; import com.google.longrunning.Operation; -import com.google.longrunning.OperationsClient; import com.google.protobuf.Empty; import java.io.IOException; import java.util.List; @@ -46,6 +46,8 @@ * calls that map to API methods. Sample code to get started: * *{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. * try (BatchControllerClient batchControllerClient = BatchControllerClient.create()) { * BatchName name = BatchName.of("[PROJECT]", "[LOCATION]", "[BATCH]"); * Batch response = batchControllerClient.getBatch(name); @@ -82,6 +84,8 @@ *To customize credentials: * *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. * BatchControllerSettings batchControllerSettings = * BatchControllerSettings.newBuilder() * .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials)) @@ -93,19 +97,37 @@ *To customize the endpoint: * *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. * BatchControllerSettings batchControllerSettings = * BatchControllerSettings.newBuilder().setEndpoint(myEndpoint).build(); * BatchControllerClient batchControllerClient = * BatchControllerClient.create(batchControllerSettings); * }* + *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 for illustrative purposes only. + * // It may require modifications to work in your environment. + * BatchControllerSettings batchControllerSettings = + * BatchControllerSettings.newBuilder() + * .setTransportChannelProvider( + * BatchControllerSettings.defaultHttpJsonTransportProviderBuilder().build()) + * .build(); + * BatchControllerClient batchControllerClient = + * BatchControllerClient.create(batchControllerSettings); + * }+ * *Please refer to the GitHub repository's samples for more quickstart code snippets. */ @Generated("by gapic-generator-java") public class BatchControllerClient implements BackgroundResource { private final BatchControllerSettings settings; private final BatchControllerStub stub; - private final OperationsClient operationsClient; + private final OperationsClient httpJsonOperationsClient; + private final com.google.longrunning.OperationsClient operationsClient; /** Constructs an instance of BatchControllerClient with default settings. */ public static final BatchControllerClient create() throws IOException { @@ -125,7 +147,6 @@ public static final BatchControllerClient create(BatchControllerSettings setting * Constructs an instance of BatchControllerClient, using the given stub for making calls. This is * for advanced usage - prefer using create(BatchControllerSettings). */ - @BetaApi("A restructuring of stub classes is planned, so this may break in the future") public static final BatchControllerClient create(BatchControllerStub stub) { return new BatchControllerClient(stub); } @@ -138,21 +159,23 @@ public static final BatchControllerClient create(BatchControllerStub stub) { protected BatchControllerClient(BatchControllerSettings settings) throws IOException { this.settings = settings; this.stub = ((BatchControllerStubSettings) settings.getStubSettings()).createStub(); - this.operationsClient = OperationsClient.create(this.stub.getOperationsStub()); + this.operationsClient = + com.google.longrunning.OperationsClient.create(this.stub.getOperationsStub()); + this.httpJsonOperationsClient = OperationsClient.create(this.stub.getHttpJsonOperationsStub()); } - @BetaApi("A restructuring of stub classes is planned, so this may break in the future") protected BatchControllerClient(BatchControllerStub stub) { this.settings = null; this.stub = stub; - this.operationsClient = OperationsClient.create(this.stub.getOperationsStub()); + this.operationsClient = + com.google.longrunning.OperationsClient.create(this.stub.getOperationsStub()); + this.httpJsonOperationsClient = OperationsClient.create(this.stub.getHttpJsonOperationsStub()); } public final BatchControllerSettings getSettings() { return settings; } - @BetaApi("A restructuring of stub classes is planned, so this may break in the future") public BatchControllerStub getStub() { return stub; } @@ -161,10 +184,19 @@ public BatchControllerStub getStub() { * Returns the OperationsClient that can be used to query the status of a long-running operation * returned by another API method call. */ - public final OperationsClient getOperationsClient() { + 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 batch workload that executes asynchronously. @@ -172,6 +204,8 @@ public final OperationsClient getOperationsClient() { *
Sample code: * *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. * try (BatchControllerClient batchControllerClient = BatchControllerClient.create()) { * LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); * Batch batch = Batch.newBuilder().build(); @@ -205,6 +239,8 @@ public final OperationFuturecreateBatchAsync( * Sample code: * *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. * try (BatchControllerClient batchControllerClient = BatchControllerClient.create()) { * String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); * Batch batch = Batch.newBuilder().build(); @@ -238,6 +274,8 @@ public final OperationFuturecreateBatchAsync( * Sample code: * *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. * try (BatchControllerClient batchControllerClient = BatchControllerClient.create()) { * CreateBatchRequest request = * CreateBatchRequest.newBuilder() @@ -265,6 +303,8 @@ public final OperationFuturecreateBatchAsync( * Sample code: * *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. * try (BatchControllerClient batchControllerClient = BatchControllerClient.create()) { * CreateBatchRequest request = * CreateBatchRequest.newBuilder() @@ -292,6 +332,8 @@ public final OperationFuturecreateBatchAsync( * Sample code: * *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. * try (BatchControllerClient batchControllerClient = BatchControllerClient.create()) { * CreateBatchRequest request = * CreateBatchRequest.newBuilder() @@ -317,6 +359,8 @@ public final UnaryCallablecreateBatchCallable() * Sample code: * *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. * try (BatchControllerClient batchControllerClient = BatchControllerClient.create()) { * BatchName name = BatchName.of("[PROJECT]", "[LOCATION]", "[BATCH]"); * Batch response = batchControllerClient.getBatch(name); @@ -339,6 +383,8 @@ public final Batch getBatch(BatchName name) { *Sample code: * *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. * try (BatchControllerClient batchControllerClient = BatchControllerClient.create()) { * String name = BatchName.of("[PROJECT]", "[LOCATION]", "[BATCH]").toString(); * Batch response = batchControllerClient.getBatch(name); @@ -360,6 +406,8 @@ public final Batch getBatch(String name) { *Sample code: * *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. * try (BatchControllerClient batchControllerClient = BatchControllerClient.create()) { * GetBatchRequest request = * GetBatchRequest.newBuilder() @@ -383,6 +431,8 @@ public final Batch getBatch(GetBatchRequest request) { *Sample code: * *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. * try (BatchControllerClient batchControllerClient = BatchControllerClient.create()) { * GetBatchRequest request = * GetBatchRequest.newBuilder() @@ -405,6 +455,8 @@ public final UnaryCallablegetBatchCallable() { * Sample code: * *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. * try (BatchControllerClient batchControllerClient = BatchControllerClient.create()) { * LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); * for (Batch element : batchControllerClient.listBatches(parent).iterateAll()) { @@ -431,6 +483,8 @@ public final ListBatchesPagedResponse listBatches(LocationName parent) { *Sample code: * *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. * try (BatchControllerClient batchControllerClient = BatchControllerClient.create()) { * String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); * for (Batch element : batchControllerClient.listBatches(parent).iterateAll()) { @@ -454,6 +508,8 @@ public final ListBatchesPagedResponse listBatches(String parent) { *Sample code: * *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. * try (BatchControllerClient batchControllerClient = BatchControllerClient.create()) { * ListBatchesRequest request = * ListBatchesRequest.newBuilder() @@ -481,6 +537,8 @@ public final ListBatchesPagedResponse listBatches(ListBatchesRequest request) { *Sample code: * *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. * try (BatchControllerClient batchControllerClient = BatchControllerClient.create()) { * ListBatchesRequest request = * ListBatchesRequest.newBuilder() @@ -509,6 +567,8 @@ public final ListBatchesPagedResponse listBatches(ListBatchesRequest request) { *Sample code: * *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. * try (BatchControllerClient batchControllerClient = BatchControllerClient.create()) { * ListBatchesRequest request = * ListBatchesRequest.newBuilder() @@ -518,7 +578,7 @@ public final ListBatchesPagedResponse listBatches(ListBatchesRequest request) { * .build(); * while (true) { * ListBatchesResponse response = batchControllerClient.listBatchesCallable().call(request); - * for (Batch element : response.getResponsesList()) { + * for (Batch element : response.getBatchesList()) { * // doThingsWith(element); * } * String nextPageToken = response.getNextPageToken(); @@ -543,6 +603,8 @@ public final UnaryCallablelistBatchesC * Sample code: * *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. * try (BatchControllerClient batchControllerClient = BatchControllerClient.create()) { * BatchName name = BatchName.of("[PROJECT]", "[LOCATION]", "[BATCH]"); * batchControllerClient.deleteBatch(name); @@ -566,6 +628,8 @@ public final void deleteBatch(BatchName name) { *Sample code: * *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. * try (BatchControllerClient batchControllerClient = BatchControllerClient.create()) { * String name = BatchName.of("[PROJECT]", "[LOCATION]", "[BATCH]").toString(); * batchControllerClient.deleteBatch(name); @@ -588,6 +652,8 @@ public final void deleteBatch(String name) { *Sample code: * *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. * try (BatchControllerClient batchControllerClient = BatchControllerClient.create()) { * DeleteBatchRequest request = * DeleteBatchRequest.newBuilder() @@ -612,6 +678,8 @@ public final void deleteBatch(DeleteBatchRequest request) { *Sample code: * *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. * try (BatchControllerClient batchControllerClient = BatchControllerClient.create()) { * DeleteBatchRequest request = * DeleteBatchRequest.newBuilder() diff --git a/java-dataproc/google-cloud-dataproc/src/main/java/com/google/cloud/dataproc/v1/BatchControllerSettings.java b/java-dataproc/google-cloud-dataproc/src/main/java/com/google/cloud/dataproc/v1/BatchControllerSettings.java index 0aceb61d3719..a52bdd7df200 100644 --- a/java-dataproc/google-cloud-dataproc/src/main/java/com/google/cloud/dataproc/v1/BatchControllerSettings.java +++ b/java-dataproc/google-cloud-dataproc/src/main/java/com/google/cloud/dataproc/v1/BatchControllerSettings.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Google LLC + * 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. @@ -23,6 +23,7 @@ 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; @@ -55,6 +56,8 @@ *For example, to set the total timeout of getBatch to 30 seconds: * *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. * BatchControllerSettings.Builder batchControllerSettingsBuilder = * BatchControllerSettings.newBuilder(); * batchControllerSettingsBuilder @@ -124,11 +127,18 @@ public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilde return BatchControllerStubSettings.defaultCredentialsProviderBuilder(); } - /** Returns a builder for the default ChannelProvider for this service. */ + /** Returns a builder for the default gRPC ChannelProvider for this service. */ public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() { return BatchControllerStubSettings.defaultGrpcTransportProviderBuilder(); } + /** Returns a builder for the default REST ChannelProvider for this service. */ + @BetaApi + public static InstantiatingHttpJsonChannelProvider.Builder + defaultHttpJsonTransportProviderBuilder() { + return BatchControllerStubSettings.defaultHttpJsonTransportProviderBuilder(); + } + public static TransportChannelProvider defaultTransportChannelProvider() { return BatchControllerStubSettings.defaultTransportChannelProvider(); } @@ -138,11 +148,17 @@ public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuil return BatchControllerStubSettings.defaultApiClientHeaderProviderBuilder(); } - /** Returns a new builder for this class. */ + /** 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); @@ -180,6 +196,11 @@ private static Builder createDefault() { return new Builder(BatchControllerStubSettings.newBuilder()); } + @BetaApi + private static Builder createHttpJsonDefault() { + return new Builder(BatchControllerStubSettings.newHttpJsonBuilder()); + } + public BatchControllerStubSettings.Builder getStubSettingsBuilder() { return ((BatchControllerStubSettings.Builder) getStubSettings()); } diff --git a/java-dataproc/google-cloud-dataproc/src/main/java/com/google/cloud/dataproc/v1/ClusterControllerClient.java b/java-dataproc/google-cloud-dataproc/src/main/java/com/google/cloud/dataproc/v1/ClusterControllerClient.java index 9cf9ec25ffef..5cecf3207d4e 100644 --- a/java-dataproc/google-cloud-dataproc/src/main/java/com/google/cloud/dataproc/v1/ClusterControllerClient.java +++ b/java-dataproc/google-cloud-dataproc/src/main/java/com/google/cloud/dataproc/v1/ClusterControllerClient.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Google LLC + * 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. @@ -20,6 +20,7 @@ import com.google.api.core.ApiFutures; 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.paging.AbstractFixedSizeCollection; import com.google.api.gax.paging.AbstractPage; @@ -31,7 +32,6 @@ import com.google.cloud.dataproc.v1.stub.ClusterControllerStubSettings; import com.google.common.util.concurrent.MoreExecutors; import com.google.longrunning.Operation; -import com.google.longrunning.OperationsClient; import com.google.protobuf.Empty; import com.google.protobuf.FieldMask; import java.io.IOException; @@ -48,6 +48,8 @@ * calls that map to API methods. Sample code to get started: * *{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. * try (ClusterControllerClient clusterControllerClient = ClusterControllerClient.create()) { * String projectId = "projectId-894832108"; * String region = "region-934795532"; @@ -86,6 +88,8 @@ *To customize credentials: * *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. * ClusterControllerSettings clusterControllerSettings = * ClusterControllerSettings.newBuilder() * .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials)) @@ -97,19 +101,37 @@ *To customize the endpoint: * *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. * ClusterControllerSettings clusterControllerSettings = * ClusterControllerSettings.newBuilder().setEndpoint(myEndpoint).build(); * ClusterControllerClient clusterControllerClient = * ClusterControllerClient.create(clusterControllerSettings); * }* + *To use REST (HTTP1.1/JSON) transport (instead of gRPC) for sending and receiving requests over + * the wire: + * + *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. + * ClusterControllerSettings clusterControllerSettings = + * ClusterControllerSettings.newBuilder() + * .setTransportChannelProvider( + * ClusterControllerSettings.defaultHttpJsonTransportProviderBuilder().build()) + * .build(); + * ClusterControllerClient clusterControllerClient = + * ClusterControllerClient.create(clusterControllerSettings); + * }+ * *Please refer to the GitHub repository's samples for more quickstart code snippets. */ @Generated("by gapic-generator-java") public class ClusterControllerClient implements BackgroundResource { private final ClusterControllerSettings settings; private final ClusterControllerStub stub; - private final OperationsClient operationsClient; + private final OperationsClient httpJsonOperationsClient; + private final com.google.longrunning.OperationsClient operationsClient; /** Constructs an instance of ClusterControllerClient with default settings. */ public static final ClusterControllerClient create() throws IOException { @@ -129,7 +151,6 @@ public static final ClusterControllerClient create(ClusterControllerSettings set * Constructs an instance of ClusterControllerClient, using the given stub for making calls. This * is for advanced usage - prefer using create(ClusterControllerSettings). */ - @BetaApi("A restructuring of stub classes is planned, so this may break in the future") public static final ClusterControllerClient create(ClusterControllerStub stub) { return new ClusterControllerClient(stub); } @@ -142,21 +163,23 @@ public static final ClusterControllerClient create(ClusterControllerStub stub) { protected ClusterControllerClient(ClusterControllerSettings settings) throws IOException { this.settings = settings; this.stub = ((ClusterControllerStubSettings) settings.getStubSettings()).createStub(); - this.operationsClient = OperationsClient.create(this.stub.getOperationsStub()); + this.operationsClient = + com.google.longrunning.OperationsClient.create(this.stub.getOperationsStub()); + this.httpJsonOperationsClient = OperationsClient.create(this.stub.getHttpJsonOperationsStub()); } - @BetaApi("A restructuring of stub classes is planned, so this may break in the future") protected ClusterControllerClient(ClusterControllerStub stub) { this.settings = null; this.stub = stub; - this.operationsClient = OperationsClient.create(this.stub.getOperationsStub()); + this.operationsClient = + com.google.longrunning.OperationsClient.create(this.stub.getOperationsStub()); + this.httpJsonOperationsClient = OperationsClient.create(this.stub.getHttpJsonOperationsStub()); } public final ClusterControllerSettings getSettings() { return settings; } - @BetaApi("A restructuring of stub classes is planned, so this may break in the future") public ClusterControllerStub getStub() { return stub; } @@ -165,10 +188,19 @@ public ClusterControllerStub getStub() { * Returns the OperationsClient that can be used to query the status of a long-running operation * returned by another API method call. */ - public final OperationsClient getOperationsClient() { + 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 cluster in a project. The returned @@ -178,6 +210,8 @@ public final OperationsClient getOperationsClient() { *
Sample code: * *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. * try (ClusterControllerClient clusterControllerClient = ClusterControllerClient.create()) { * String projectId = "projectId-894832108"; * String region = "region-934795532"; @@ -213,6 +247,8 @@ public final OperationFuturecreateClusterAsy * Sample code: * *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. * try (ClusterControllerClient clusterControllerClient = ClusterControllerClient.create()) { * CreateClusterRequest request = * CreateClusterRequest.newBuilder() @@ -243,6 +279,8 @@ public final OperationFuturecreateClusterAsy * Sample code: * *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. * try (ClusterControllerClient clusterControllerClient = ClusterControllerClient.create()) { * CreateClusterRequest request = * CreateClusterRequest.newBuilder() @@ -273,6 +311,8 @@ public final OperationFuturecreateClusterAsy * Sample code: * *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. * try (ClusterControllerClient clusterControllerClient = ClusterControllerClient.create()) { * CreateClusterRequest request = * CreateClusterRequest.newBuilder() @@ -304,6 +344,8 @@ public final UnaryCallablecreateClusterCallabl * Sample code: * *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. * try (ClusterControllerClient clusterControllerClient = ClusterControllerClient.create()) { * String projectId = "projectId-894832108"; * String region = "region-934795532"; @@ -368,6 +410,8 @@ public final OperationFutureupdateClusterAsy * Sample code: * *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. * try (ClusterControllerClient clusterControllerClient = ClusterControllerClient.create()) { * UpdateClusterRequest request = * UpdateClusterRequest.newBuilder() @@ -402,6 +446,8 @@ public final OperationFutureupdateClusterAsy * Sample code: * *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. * try (ClusterControllerClient clusterControllerClient = ClusterControllerClient.create()) { * UpdateClusterRequest request = * UpdateClusterRequest.newBuilder() @@ -436,6 +482,8 @@ public final OperationFutureupdateClusterAsy * Sample code: * *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. * try (ClusterControllerClient clusterControllerClient = ClusterControllerClient.create()) { * UpdateClusterRequest request = * UpdateClusterRequest.newBuilder() @@ -465,6 +513,8 @@ public final UnaryCallableupdateClusterCallabl * Sample code: * *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. * try (ClusterControllerClient clusterControllerClient = ClusterControllerClient.create()) { * StopClusterRequest request = * StopClusterRequest.newBuilder() @@ -493,6 +543,8 @@ public final OperationFuturestopClusterAsync * Sample code: * *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. * try (ClusterControllerClient clusterControllerClient = ClusterControllerClient.create()) { * StopClusterRequest request = * StopClusterRequest.newBuilder() @@ -521,6 +573,8 @@ public final OperationFuturestopClusterAsync * Sample code: * *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. * try (ClusterControllerClient clusterControllerClient = ClusterControllerClient.create()) { * StopClusterRequest request = * StopClusterRequest.newBuilder() @@ -548,6 +602,8 @@ public final UnaryCallablestopClusterCallable() * Sample code: * *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. * try (ClusterControllerClient clusterControllerClient = ClusterControllerClient.create()) { * StartClusterRequest request = * StartClusterRequest.newBuilder() @@ -576,6 +632,8 @@ public final OperationFuturestartClusterAsyn * Sample code: * *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. * try (ClusterControllerClient clusterControllerClient = ClusterControllerClient.create()) { * StartClusterRequest request = * StartClusterRequest.newBuilder() @@ -604,6 +662,8 @@ public final OperationFuturestartClusterAsyn * Sample code: * *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. * try (ClusterControllerClient clusterControllerClient = ClusterControllerClient.create()) { * StartClusterRequest request = * StartClusterRequest.newBuilder() @@ -633,6 +693,8 @@ public final UnaryCallablestartClusterCallable( * Sample code: * *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. * try (ClusterControllerClient clusterControllerClient = ClusterControllerClient.create()) { * String projectId = "projectId-894832108"; * String region = "region-934795532"; @@ -667,6 +729,8 @@ public final OperationFuturedeleteClusterAsync * Sample code: * *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. * try (ClusterControllerClient clusterControllerClient = ClusterControllerClient.create()) { * DeleteClusterRequest request = * DeleteClusterRequest.newBuilder() @@ -697,6 +761,8 @@ public final OperationFuturedeleteClusterAsync * Sample code: * *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. * try (ClusterControllerClient clusterControllerClient = ClusterControllerClient.create()) { * DeleteClusterRequest request = * DeleteClusterRequest.newBuilder() @@ -727,6 +793,8 @@ public final OperationFuturedeleteClusterAsync * Sample code: * *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. * try (ClusterControllerClient clusterControllerClient = ClusterControllerClient.create()) { * DeleteClusterRequest request = * DeleteClusterRequest.newBuilder() @@ -754,6 +822,8 @@ public final UnaryCallabledeleteClusterCallabl * Sample code: * *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. * try (ClusterControllerClient clusterControllerClient = ClusterControllerClient.create()) { * String projectId = "projectId-894832108"; * String region = "region-934795532"; @@ -785,6 +855,8 @@ public final Cluster getCluster(String projectId, String region, String clusterN *Sample code: * *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. * try (ClusterControllerClient clusterControllerClient = ClusterControllerClient.create()) { * GetClusterRequest request = * GetClusterRequest.newBuilder() @@ -810,6 +882,8 @@ public final Cluster getCluster(GetClusterRequest request) { *Sample code: * *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. * try (ClusterControllerClient clusterControllerClient = ClusterControllerClient.create()) { * GetClusterRequest request = * GetClusterRequest.newBuilder() @@ -834,6 +908,8 @@ public final UnaryCallablegetClusterCallable() { * Sample code: * *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. * try (ClusterControllerClient clusterControllerClient = ClusterControllerClient.create()) { * String projectId = "projectId-894832108"; * String region = "region-934795532"; @@ -861,6 +937,8 @@ public final ListClustersPagedResponse listClusters(String projectId, String reg *Sample code: * *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. * try (ClusterControllerClient clusterControllerClient = ClusterControllerClient.create()) { * String projectId = "projectId-894832108"; * String region = "region-934795532"; @@ -909,6 +987,8 @@ public final ListClustersPagedResponse listClusters( *Sample code: * *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. * try (ClusterControllerClient clusterControllerClient = ClusterControllerClient.create()) { * ListClustersRequest request = * ListClustersRequest.newBuilder() @@ -938,6 +1018,8 @@ public final ListClustersPagedResponse listClusters(ListClustersRequest request) *Sample code: * *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. * try (ClusterControllerClient clusterControllerClient = ClusterControllerClient.create()) { * ListClustersRequest request = * ListClustersRequest.newBuilder() @@ -968,6 +1050,8 @@ public final ListClustersPagedResponse listClusters(ListClustersRequest request) *Sample code: * *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. * try (ClusterControllerClient clusterControllerClient = ClusterControllerClient.create()) { * ListClustersRequest request = * ListClustersRequest.newBuilder() @@ -980,7 +1064,7 @@ public final ListClustersPagedResponse listClusters(ListClustersRequest request) * while (true) { * ListClustersResponse response = * clusterControllerClient.listClustersCallable().call(request); - * for (Cluster element : response.getResponsesList()) { + * for (Cluster element : response.getClustersList()) { * // doThingsWith(element); * } * String nextPageToken = response.getNextPageToken(); @@ -1009,6 +1093,8 @@ public final UnaryCallablelistCluste * Sample code: * *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. * try (ClusterControllerClient clusterControllerClient = ClusterControllerClient.create()) { * String projectId = "projectId-894832108"; * String region = "region-934795532"; @@ -1047,6 +1133,8 @@ public final UnaryCallablelistCluste * Sample code: * *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. * try (ClusterControllerClient clusterControllerClient = ClusterControllerClient.create()) { * DiagnoseClusterRequest request = * DiagnoseClusterRequest.newBuilder() @@ -1078,6 +1166,8 @@ public final UnaryCallablelistCluste * Sample code: * *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. * try (ClusterControllerClient clusterControllerClient = ClusterControllerClient.create()) { * DiagnoseClusterRequest request = * DiagnoseClusterRequest.newBuilder() @@ -1110,6 +1200,8 @@ public final UnaryCallablelistCluste * Sample code: * *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. * try (ClusterControllerClient clusterControllerClient = ClusterControllerClient.create()) { * DiagnoseClusterRequest request = * DiagnoseClusterRequest.newBuilder() diff --git a/java-dataproc/google-cloud-dataproc/src/main/java/com/google/cloud/dataproc/v1/ClusterControllerSettings.java b/java-dataproc/google-cloud-dataproc/src/main/java/com/google/cloud/dataproc/v1/ClusterControllerSettings.java index b608594b1861..55d39d98e9f1 100644 --- a/java-dataproc/google-cloud-dataproc/src/main/java/com/google/cloud/dataproc/v1/ClusterControllerSettings.java +++ b/java-dataproc/google-cloud-dataproc/src/main/java/com/google/cloud/dataproc/v1/ClusterControllerSettings.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Google LLC + * 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. @@ -23,6 +23,7 @@ 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; @@ -55,6 +56,8 @@ *For example, to set the total timeout of getCluster to 30 seconds: * *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. * ClusterControllerSettings.Builder clusterControllerSettingsBuilder = * ClusterControllerSettings.newBuilder(); * clusterControllerSettingsBuilder @@ -175,11 +178,18 @@ public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilde return ClusterControllerStubSettings.defaultCredentialsProviderBuilder(); } - /** Returns a builder for the default ChannelProvider for this service. */ + /** Returns a builder for the default gRPC ChannelProvider for this service. */ public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() { return ClusterControllerStubSettings.defaultGrpcTransportProviderBuilder(); } + /** Returns a builder for the default REST ChannelProvider for this service. */ + @BetaApi + public static InstantiatingHttpJsonChannelProvider.Builder + defaultHttpJsonTransportProviderBuilder() { + return ClusterControllerStubSettings.defaultHttpJsonTransportProviderBuilder(); + } + public static TransportChannelProvider defaultTransportChannelProvider() { return ClusterControllerStubSettings.defaultTransportChannelProvider(); } @@ -189,11 +199,17 @@ public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuil return ClusterControllerStubSettings.defaultApiClientHeaderProviderBuilder(); } - /** Returns a new builder for this class. */ + /** 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); @@ -231,6 +247,11 @@ private static Builder createDefault() { return new Builder(ClusterControllerStubSettings.newBuilder()); } + @BetaApi + private static Builder createHttpJsonDefault() { + return new Builder(ClusterControllerStubSettings.newHttpJsonBuilder()); + } + public ClusterControllerStubSettings.Builder getStubSettingsBuilder() { return ((ClusterControllerStubSettings.Builder) getStubSettings()); } diff --git a/java-dataproc/google-cloud-dataproc/src/main/java/com/google/cloud/dataproc/v1/JobControllerClient.java b/java-dataproc/google-cloud-dataproc/src/main/java/com/google/cloud/dataproc/v1/JobControllerClient.java index d052c400b89e..58cfd102b15c 100644 --- a/java-dataproc/google-cloud-dataproc/src/main/java/com/google/cloud/dataproc/v1/JobControllerClient.java +++ b/java-dataproc/google-cloud-dataproc/src/main/java/com/google/cloud/dataproc/v1/JobControllerClient.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Google LLC + * 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. @@ -20,6 +20,7 @@ import com.google.api.core.ApiFutures; 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.paging.AbstractFixedSizeCollection; import com.google.api.gax.paging.AbstractPage; @@ -31,7 +32,6 @@ import com.google.cloud.dataproc.v1.stub.JobControllerStubSettings; import com.google.common.util.concurrent.MoreExecutors; import com.google.longrunning.Operation; -import com.google.longrunning.OperationsClient; import com.google.protobuf.Empty; import java.io.IOException; import java.util.List; @@ -46,6 +46,8 @@ * calls that map to API methods. Sample code to get started: * *{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. * try (JobControllerClient jobControllerClient = JobControllerClient.create()) { * String projectId = "projectId-894832108"; * String region = "region-934795532"; @@ -83,6 +85,8 @@ *To customize credentials: * *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. * JobControllerSettings jobControllerSettings = * JobControllerSettings.newBuilder() * .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials)) @@ -93,18 +97,35 @@ *To customize the endpoint: * *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. * JobControllerSettings jobControllerSettings = * JobControllerSettings.newBuilder().setEndpoint(myEndpoint).build(); * JobControllerClient jobControllerClient = JobControllerClient.create(jobControllerSettings); * }* + *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 for illustrative purposes only. + * // It may require modifications to work in your environment. + * JobControllerSettings jobControllerSettings = + * JobControllerSettings.newBuilder() + * .setTransportChannelProvider( + * JobControllerSettings.defaultHttpJsonTransportProviderBuilder().build()) + * .build(); + * JobControllerClient jobControllerClient = JobControllerClient.create(jobControllerSettings); + * }+ * *Please refer to the GitHub repository's samples for more quickstart code snippets. */ @Generated("by gapic-generator-java") public class JobControllerClient implements BackgroundResource { private final JobControllerSettings settings; private final JobControllerStub stub; - private final OperationsClient operationsClient; + private final OperationsClient httpJsonOperationsClient; + private final com.google.longrunning.OperationsClient operationsClient; /** Constructs an instance of JobControllerClient with default settings. */ public static final JobControllerClient create() throws IOException { @@ -124,7 +145,6 @@ public static final JobControllerClient create(JobControllerSettings settings) * Constructs an instance of JobControllerClient, using the given stub for making calls. This is * for advanced usage - prefer using create(JobControllerSettings). */ - @BetaApi("A restructuring of stub classes is planned, so this may break in the future") public static final JobControllerClient create(JobControllerStub stub) { return new JobControllerClient(stub); } @@ -137,21 +157,23 @@ public static final JobControllerClient create(JobControllerStub stub) { protected JobControllerClient(JobControllerSettings settings) throws IOException { this.settings = settings; this.stub = ((JobControllerStubSettings) settings.getStubSettings()).createStub(); - this.operationsClient = OperationsClient.create(this.stub.getOperationsStub()); + this.operationsClient = + com.google.longrunning.OperationsClient.create(this.stub.getOperationsStub()); + this.httpJsonOperationsClient = OperationsClient.create(this.stub.getHttpJsonOperationsStub()); } - @BetaApi("A restructuring of stub classes is planned, so this may break in the future") protected JobControllerClient(JobControllerStub stub) { this.settings = null; this.stub = stub; - this.operationsClient = OperationsClient.create(this.stub.getOperationsStub()); + this.operationsClient = + com.google.longrunning.OperationsClient.create(this.stub.getOperationsStub()); + this.httpJsonOperationsClient = OperationsClient.create(this.stub.getHttpJsonOperationsStub()); } public final JobControllerSettings getSettings() { return settings; } - @BetaApi("A restructuring of stub classes is planned, so this may break in the future") public JobControllerStub getStub() { return stub; } @@ -160,10 +182,19 @@ public JobControllerStub getStub() { * Returns the OperationsClient that can be used to query the status of a long-running operation * returned by another API method call. */ - public final OperationsClient getOperationsClient() { + 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. /** * Submits a job to a cluster. @@ -171,6 +202,8 @@ public final OperationsClient getOperationsClient() { *
Sample code: * *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. * try (JobControllerClient jobControllerClient = JobControllerClient.create()) { * String projectId = "projectId-894832108"; * String region = "region-934795532"; @@ -197,6 +230,8 @@ public final Job submitJob(String projectId, String region, Job job) { *Sample code: * *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. * try (JobControllerClient jobControllerClient = JobControllerClient.create()) { * SubmitJobRequest request = * SubmitJobRequest.newBuilder() @@ -223,6 +258,8 @@ public final Job submitJob(SubmitJobRequest request) { *Sample code: * *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. * try (JobControllerClient jobControllerClient = JobControllerClient.create()) { * SubmitJobRequest request = * SubmitJobRequest.newBuilder() @@ -248,6 +285,8 @@ public final UnaryCallablesubmitJobCallable() { * Sample code: * *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. * try (JobControllerClient jobControllerClient = JobControllerClient.create()) { * String projectId = "projectId-894832108"; * String region = "region-934795532"; @@ -275,6 +314,8 @@ public final OperationFuturesubmitJobAsOperationAsync( * Sample code: * *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. * try (JobControllerClient jobControllerClient = JobControllerClient.create()) { * SubmitJobRequest request = * SubmitJobRequest.newBuilder() @@ -302,6 +343,8 @@ public final OperationFuturesubmitJobAsOperationAsync( * Sample code: * *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. * try (JobControllerClient jobControllerClient = JobControllerClient.create()) { * SubmitJobRequest request = * SubmitJobRequest.newBuilder() @@ -329,6 +372,8 @@ public final OperationFuturesubmitJobAsOperationAsync( * Sample code: * *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. * try (JobControllerClient jobControllerClient = JobControllerClient.create()) { * SubmitJobRequest request = * SubmitJobRequest.newBuilder() @@ -355,6 +400,8 @@ public final UnaryCallablesubmitJobAsOperationCall * Sample code: * *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. * try (JobControllerClient jobControllerClient = JobControllerClient.create()) { * String projectId = "projectId-894832108"; * String region = "region-934795532"; @@ -385,6 +432,8 @@ public final Job getJob(String projectId, String region, String jobId) { *Sample code: * *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. * try (JobControllerClient jobControllerClient = JobControllerClient.create()) { * GetJobRequest request = * GetJobRequest.newBuilder() @@ -410,6 +459,8 @@ public final Job getJob(GetJobRequest request) { *Sample code: * *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. * try (JobControllerClient jobControllerClient = JobControllerClient.create()) { * GetJobRequest request = * GetJobRequest.newBuilder() @@ -434,6 +485,8 @@ public final UnaryCallablegetJobCallable() { * Sample code: * *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. * try (JobControllerClient jobControllerClient = JobControllerClient.create()) { * String projectId = "projectId-894832108"; * String region = "region-934795532"; @@ -460,6 +513,8 @@ public final ListJobsPagedResponse listJobs(String projectId, String region) { *Sample code: * *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. * try (JobControllerClient jobControllerClient = JobControllerClient.create()) { * String projectId = "projectId-894832108"; * String region = "region-934795532"; @@ -500,6 +555,8 @@ public final ListJobsPagedResponse listJobs(String projectId, String region, Str *Sample code: * *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. * try (JobControllerClient jobControllerClient = JobControllerClient.create()) { * ListJobsRequest request = * ListJobsRequest.newBuilder() @@ -530,6 +587,8 @@ public final ListJobsPagedResponse listJobs(ListJobsRequest request) { *Sample code: * *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. * try (JobControllerClient jobControllerClient = JobControllerClient.create()) { * ListJobsRequest request = * ListJobsRequest.newBuilder() @@ -559,6 +618,8 @@ public final UnaryCallablelistJobsPaged * Sample code: * *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. * try (JobControllerClient jobControllerClient = JobControllerClient.create()) { * ListJobsRequest request = * ListJobsRequest.newBuilder() @@ -571,7 +632,7 @@ public final UnaryCallablelistJobsPaged * .build(); * while (true) { * ListJobsResponse response = jobControllerClient.listJobsCallable().call(request); - * for (Job element : response.getResponsesList()) { + * for (Job element : response.getJobsList()) { * // doThingsWith(element); * } * String nextPageToken = response.getNextPageToken(); @@ -595,6 +656,8 @@ public final UnaryCallable listJobsCallable() * Sample code: * *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. * try (JobControllerClient jobControllerClient = JobControllerClient.create()) { * UpdateJobRequest request = * UpdateJobRequest.newBuilder() @@ -622,6 +685,8 @@ public final Job updateJob(UpdateJobRequest request) { *Sample code: * *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. * try (JobControllerClient jobControllerClient = JobControllerClient.create()) { * UpdateJobRequest request = * UpdateJobRequest.newBuilder() @@ -651,6 +716,8 @@ public final UnaryCallableupdateJobCallable() { * Sample code: * *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. * try (JobControllerClient jobControllerClient = JobControllerClient.create()) { * String projectId = "projectId-894832108"; * String region = "region-934795532"; @@ -684,6 +751,8 @@ public final Job cancelJob(String projectId, String region, String jobId) { *Sample code: * *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. * try (JobControllerClient jobControllerClient = JobControllerClient.create()) { * CancelJobRequest request = * CancelJobRequest.newBuilder() @@ -712,6 +781,8 @@ public final Job cancelJob(CancelJobRequest request) { *Sample code: * *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. * try (JobControllerClient jobControllerClient = JobControllerClient.create()) { * CancelJobRequest request = * CancelJobRequest.newBuilder() @@ -737,6 +808,8 @@ public final UnaryCallablecancelJobCallable() { * Sample code: * *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. * try (JobControllerClient jobControllerClient = JobControllerClient.create()) { * String projectId = "projectId-894832108"; * String region = "region-934795532"; @@ -768,6 +841,8 @@ public final void deleteJob(String projectId, String region, String jobId) { *Sample code: * *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. * try (JobControllerClient jobControllerClient = JobControllerClient.create()) { * DeleteJobRequest request = * DeleteJobRequest.newBuilder() @@ -794,6 +869,8 @@ public final void deleteJob(DeleteJobRequest request) { *Sample code: * *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. * try (JobControllerClient jobControllerClient = JobControllerClient.create()) { * DeleteJobRequest request = * DeleteJobRequest.newBuilder() diff --git a/java-dataproc/google-cloud-dataproc/src/main/java/com/google/cloud/dataproc/v1/JobControllerSettings.java b/java-dataproc/google-cloud-dataproc/src/main/java/com/google/cloud/dataproc/v1/JobControllerSettings.java index 4a443d1068cd..71bc0b5e3666 100644 --- a/java-dataproc/google-cloud-dataproc/src/main/java/com/google/cloud/dataproc/v1/JobControllerSettings.java +++ b/java-dataproc/google-cloud-dataproc/src/main/java/com/google/cloud/dataproc/v1/JobControllerSettings.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Google LLC + * 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. @@ -23,6 +23,7 @@ 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; @@ -55,6 +56,8 @@ *For example, to set the total timeout of submitJob to 30 seconds: * *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. * JobControllerSettings.Builder jobControllerSettingsBuilder = JobControllerSettings.newBuilder(); * jobControllerSettingsBuilder * .submitJobSettings() @@ -138,11 +141,18 @@ public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilde return JobControllerStubSettings.defaultCredentialsProviderBuilder(); } - /** Returns a builder for the default ChannelProvider for this service. */ + /** Returns a builder for the default gRPC ChannelProvider for this service. */ public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() { return JobControllerStubSettings.defaultGrpcTransportProviderBuilder(); } + /** Returns a builder for the default REST ChannelProvider for this service. */ + @BetaApi + public static InstantiatingHttpJsonChannelProvider.Builder + defaultHttpJsonTransportProviderBuilder() { + return JobControllerStubSettings.defaultHttpJsonTransportProviderBuilder(); + } + public static TransportChannelProvider defaultTransportChannelProvider() { return JobControllerStubSettings.defaultTransportChannelProvider(); } @@ -152,11 +162,17 @@ public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuil return JobControllerStubSettings.defaultApiClientHeaderProviderBuilder(); } - /** Returns a new builder for this class. */ + /** 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); @@ -194,6 +210,11 @@ private static Builder createDefault() { return new Builder(JobControllerStubSettings.newBuilder()); } + @BetaApi + private static Builder createHttpJsonDefault() { + return new Builder(JobControllerStubSettings.newHttpJsonBuilder()); + } + public JobControllerStubSettings.Builder getStubSettingsBuilder() { return ((JobControllerStubSettings.Builder) getStubSettings()); } diff --git a/java-dataproc/google-cloud-dataproc/src/main/java/com/google/cloud/dataproc/v1/WorkflowTemplateServiceClient.java b/java-dataproc/google-cloud-dataproc/src/main/java/com/google/cloud/dataproc/v1/WorkflowTemplateServiceClient.java index c9478f493427..8d0650988a62 100644 --- a/java-dataproc/google-cloud-dataproc/src/main/java/com/google/cloud/dataproc/v1/WorkflowTemplateServiceClient.java +++ b/java-dataproc/google-cloud-dataproc/src/main/java/com/google/cloud/dataproc/v1/WorkflowTemplateServiceClient.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Google LLC + * 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. @@ -20,6 +20,7 @@ import com.google.api.core.ApiFutures; 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.paging.AbstractFixedSizeCollection; import com.google.api.gax.paging.AbstractPage; @@ -31,7 +32,6 @@ import com.google.cloud.dataproc.v1.stub.WorkflowTemplateServiceStubSettings; import com.google.common.util.concurrent.MoreExecutors; import com.google.longrunning.Operation; -import com.google.longrunning.OperationsClient; import com.google.protobuf.Empty; import java.io.IOException; import java.util.List; @@ -47,6 +47,8 @@ * calls that map to API methods. Sample code to get started: * *{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. * try (WorkflowTemplateServiceClient workflowTemplateServiceClient = * WorkflowTemplateServiceClient.create()) { * LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); @@ -86,6 +88,8 @@ *To customize credentials: * *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. * WorkflowTemplateServiceSettings workflowTemplateServiceSettings = * WorkflowTemplateServiceSettings.newBuilder() * .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials)) @@ -97,19 +101,37 @@ *To customize the endpoint: * *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. * WorkflowTemplateServiceSettings workflowTemplateServiceSettings = * WorkflowTemplateServiceSettings.newBuilder().setEndpoint(myEndpoint).build(); * WorkflowTemplateServiceClient workflowTemplateServiceClient = * WorkflowTemplateServiceClient.create(workflowTemplateServiceSettings); * }* + *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 for illustrative purposes only. + * // It may require modifications to work in your environment. + * WorkflowTemplateServiceSettings workflowTemplateServiceSettings = + * WorkflowTemplateServiceSettings.newBuilder() + * .setTransportChannelProvider( + * WorkflowTemplateServiceSettings.defaultHttpJsonTransportProviderBuilder().build()) + * .build(); + * WorkflowTemplateServiceClient workflowTemplateServiceClient = + * WorkflowTemplateServiceClient.create(workflowTemplateServiceSettings); + * }+ * *Please refer to the GitHub repository's samples for more quickstart code snippets. */ @Generated("by gapic-generator-java") public class WorkflowTemplateServiceClient implements BackgroundResource { private final WorkflowTemplateServiceSettings settings; private final WorkflowTemplateServiceStub stub; - private final OperationsClient operationsClient; + private final OperationsClient httpJsonOperationsClient; + private final com.google.longrunning.OperationsClient operationsClient; /** Constructs an instance of WorkflowTemplateServiceClient with default settings. */ public static final WorkflowTemplateServiceClient create() throws IOException { @@ -129,7 +151,6 @@ public static final WorkflowTemplateServiceClient create(WorkflowTemplateService * Constructs an instance of WorkflowTemplateServiceClient, using the given stub for making calls. * This is for advanced usage - prefer using create(WorkflowTemplateServiceSettings). */ - @BetaApi("A restructuring of stub classes is planned, so this may break in the future") public static final WorkflowTemplateServiceClient create(WorkflowTemplateServiceStub stub) { return new WorkflowTemplateServiceClient(stub); } @@ -143,21 +164,23 @@ protected WorkflowTemplateServiceClient(WorkflowTemplateServiceSettings settings throws IOException { this.settings = settings; this.stub = ((WorkflowTemplateServiceStubSettings) settings.getStubSettings()).createStub(); - this.operationsClient = OperationsClient.create(this.stub.getOperationsStub()); + this.operationsClient = + com.google.longrunning.OperationsClient.create(this.stub.getOperationsStub()); + this.httpJsonOperationsClient = OperationsClient.create(this.stub.getHttpJsonOperationsStub()); } - @BetaApi("A restructuring of stub classes is planned, so this may break in the future") protected WorkflowTemplateServiceClient(WorkflowTemplateServiceStub stub) { this.settings = null; this.stub = stub; - this.operationsClient = OperationsClient.create(this.stub.getOperationsStub()); + this.operationsClient = + com.google.longrunning.OperationsClient.create(this.stub.getOperationsStub()); + this.httpJsonOperationsClient = OperationsClient.create(this.stub.getHttpJsonOperationsStub()); } public final WorkflowTemplateServiceSettings getSettings() { return settings; } - @BetaApi("A restructuring of stub classes is planned, so this may break in the future") public WorkflowTemplateServiceStub getStub() { return stub; } @@ -166,10 +189,19 @@ public WorkflowTemplateServiceStub getStub() { * Returns the OperationsClient that can be used to query the status of a long-running operation * returned by another API method call. */ - public final OperationsClient getOperationsClient() { + 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 new workflow template. @@ -177,6 +209,8 @@ public final OperationsClient getOperationsClient() { *
Sample code: * *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. * try (WorkflowTemplateServiceClient workflowTemplateServiceClient = * WorkflowTemplateServiceClient.create()) { * LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); @@ -217,6 +251,8 @@ public final WorkflowTemplate createWorkflowTemplate( *Sample code: * *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. * try (WorkflowTemplateServiceClient workflowTemplateServiceClient = * WorkflowTemplateServiceClient.create()) { * RegionName parent = RegionName.of("[PROJECT]", "[REGION]"); @@ -257,6 +293,8 @@ public final WorkflowTemplate createWorkflowTemplate( *Sample code: * *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. * try (WorkflowTemplateServiceClient workflowTemplateServiceClient = * WorkflowTemplateServiceClient.create()) { * String parent = RegionName.of("[PROJECT]", "[REGION]").toString(); @@ -293,6 +331,8 @@ public final WorkflowTemplate createWorkflowTemplate(String parent, WorkflowTemp *Sample code: * *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. * try (WorkflowTemplateServiceClient workflowTemplateServiceClient = * WorkflowTemplateServiceClient.create()) { * CreateWorkflowTemplateRequest request = @@ -318,6 +358,8 @@ public final WorkflowTemplate createWorkflowTemplate(CreateWorkflowTemplateReque *Sample code: * *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. * try (WorkflowTemplateServiceClient workflowTemplateServiceClient = * WorkflowTemplateServiceClient.create()) { * CreateWorkflowTemplateRequest request = @@ -346,11 +388,13 @@ public final WorkflowTemplate createWorkflowTemplate(CreateWorkflowTemplateReque *Sample code: * *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. * try (WorkflowTemplateServiceClient workflowTemplateServiceClient = * WorkflowTemplateServiceClient.create()) { * WorkflowTemplateName name = - * WorkflowTemplateName.ofProjectRegionWorkflowTemplateName( - * "[PROJECT]", "[REGION]", "[WORKFLOW_TEMPLATE]"); + * WorkflowTemplateName.ofProjectLocationWorkflowTemplateName( + * "[PROJECT]", "[LOCATION]", "[WORKFLOW_TEMPLATE]"); * WorkflowTemplate response = workflowTemplateServiceClient.getWorkflowTemplate(name); * } * }@@ -387,6 +431,8 @@ public final WorkflowTemplate getWorkflowTemplate(WorkflowTemplateName name) { *Sample code: * *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. * try (WorkflowTemplateServiceClient workflowTemplateServiceClient = * WorkflowTemplateServiceClient.create()) { * String name = @@ -427,13 +473,15 @@ public final WorkflowTemplate getWorkflowTemplate(String name) { *Sample code: * *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. * try (WorkflowTemplateServiceClient workflowTemplateServiceClient = * WorkflowTemplateServiceClient.create()) { * GetWorkflowTemplateRequest request = * GetWorkflowTemplateRequest.newBuilder() * .setName( - * WorkflowTemplateName.ofProjectRegionWorkflowTemplateName( - * "[PROJECT]", "[REGION]", "[WORKFLOW_TEMPLATE]") + * WorkflowTemplateName.ofProjectLocationWorkflowTemplateName( + * "[PROJECT]", "[LOCATION]", "[WORKFLOW_TEMPLATE]") * .toString()) * .setVersion(351608024) * .build(); @@ -457,13 +505,15 @@ public final WorkflowTemplate getWorkflowTemplate(GetWorkflowTemplateRequest req *Sample code: * *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. * try (WorkflowTemplateServiceClient workflowTemplateServiceClient = * WorkflowTemplateServiceClient.create()) { * GetWorkflowTemplateRequest request = * GetWorkflowTemplateRequest.newBuilder() * .setName( - * WorkflowTemplateName.ofProjectRegionWorkflowTemplateName( - * "[PROJECT]", "[REGION]", "[WORKFLOW_TEMPLATE]") + * WorkflowTemplateName.ofProjectLocationWorkflowTemplateName( + * "[PROJECT]", "[LOCATION]", "[WORKFLOW_TEMPLATE]") * .toString()) * .setVersion(351608024) * .build(); @@ -502,11 +552,13 @@ public final WorkflowTemplate getWorkflowTemplate(GetWorkflowTemplateRequest req *Sample code: * *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. * try (WorkflowTemplateServiceClient workflowTemplateServiceClient = * WorkflowTemplateServiceClient.create()) { * WorkflowTemplateName name = - * WorkflowTemplateName.ofProjectRegionWorkflowTemplateName( - * "[PROJECT]", "[REGION]", "[WORKFLOW_TEMPLATE]"); + * WorkflowTemplateName.ofProjectLocationWorkflowTemplateName( + * "[PROJECT]", "[LOCATION]", "[WORKFLOW_TEMPLATE]"); * workflowTemplateServiceClient.instantiateWorkflowTemplateAsync(name).get(); * } * }@@ -558,6 +610,8 @@ public final OperationFutureinstantiateWorkflowTemplat * Sample code: * *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. * try (WorkflowTemplateServiceClient workflowTemplateServiceClient = * WorkflowTemplateServiceClient.create()) { * String name = @@ -613,11 +667,13 @@ public final OperationFutureinstantiateWorkflowTemplat * Sample code: * *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. * try (WorkflowTemplateServiceClient workflowTemplateServiceClient = * WorkflowTemplateServiceClient.create()) { * WorkflowTemplateName name = - * WorkflowTemplateName.ofProjectRegionWorkflowTemplateName( - * "[PROJECT]", "[REGION]", "[WORKFLOW_TEMPLATE]"); + * WorkflowTemplateName.ofProjectLocationWorkflowTemplateName( + * "[PROJECT]", "[LOCATION]", "[WORKFLOW_TEMPLATE]"); * Mapparameters = new HashMap<>(); * workflowTemplateServiceClient.instantiateWorkflowTemplateAsync(name, parameters).get(); * } @@ -673,6 +729,8 @@ public final OperationFuture instantiateWorkflowTemplat * Sample code: * *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. * try (WorkflowTemplateServiceClient workflowTemplateServiceClient = * WorkflowTemplateServiceClient.create()) { * String name = @@ -734,13 +792,15 @@ public final OperationFutureinstantiateWorkflowTemplat * Sample code: * *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. * try (WorkflowTemplateServiceClient workflowTemplateServiceClient = * WorkflowTemplateServiceClient.create()) { * InstantiateWorkflowTemplateRequest request = * InstantiateWorkflowTemplateRequest.newBuilder() * .setName( - * WorkflowTemplateName.ofProjectRegionWorkflowTemplateName( - * "[PROJECT]", "[REGION]", "[WORKFLOW_TEMPLATE]") + * WorkflowTemplateName.ofProjectLocationWorkflowTemplateName( + * "[PROJECT]", "[LOCATION]", "[WORKFLOW_TEMPLATE]") * .toString()) * .setVersion(351608024) * .setRequestId("requestId693933066") @@ -781,13 +841,15 @@ public final OperationFutureinstantiateWorkflowTemplat * Sample code: * *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. * try (WorkflowTemplateServiceClient workflowTemplateServiceClient = * WorkflowTemplateServiceClient.create()) { * InstantiateWorkflowTemplateRequest request = * InstantiateWorkflowTemplateRequest.newBuilder() * .setName( - * WorkflowTemplateName.ofProjectRegionWorkflowTemplateName( - * "[PROJECT]", "[REGION]", "[WORKFLOW_TEMPLATE]") + * WorkflowTemplateName.ofProjectLocationWorkflowTemplateName( + * "[PROJECT]", "[LOCATION]", "[WORKFLOW_TEMPLATE]") * .toString()) * .setVersion(351608024) * .setRequestId("requestId693933066") @@ -830,13 +892,15 @@ public final OperationFutureinstantiateWorkflowTemplat * Sample code: * *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. * try (WorkflowTemplateServiceClient workflowTemplateServiceClient = * WorkflowTemplateServiceClient.create()) { * InstantiateWorkflowTemplateRequest request = * InstantiateWorkflowTemplateRequest.newBuilder() * .setName( - * WorkflowTemplateName.ofProjectRegionWorkflowTemplateName( - * "[PROJECT]", "[REGION]", "[WORKFLOW_TEMPLATE]") + * WorkflowTemplateName.ofProjectLocationWorkflowTemplateName( + * "[PROJECT]", "[LOCATION]", "[WORKFLOW_TEMPLATE]") * .toString()) * .setVersion(351608024) * .setRequestId("requestId693933066") @@ -882,6 +946,8 @@ public final OperationFutureinstantiateWorkflowTemplat * Sample code: * *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. * try (WorkflowTemplateServiceClient workflowTemplateServiceClient = * WorkflowTemplateServiceClient.create()) { * LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); @@ -942,6 +1008,8 @@ public final OperationFutureinstantiateInlineWorkflowT * Sample code: * *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. * try (WorkflowTemplateServiceClient workflowTemplateServiceClient = * WorkflowTemplateServiceClient.create()) { * RegionName parent = RegionName.of("[PROJECT]", "[REGION]"); @@ -1002,6 +1070,8 @@ public final OperationFutureinstantiateInlineWorkflowT * Sample code: * *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. * try (WorkflowTemplateServiceClient workflowTemplateServiceClient = * WorkflowTemplateServiceClient.create()) { * String parent = RegionName.of("[PROJECT]", "[REGION]").toString(); @@ -1062,6 +1132,8 @@ public final OperationFutureinstantiateInlineWorkflowT * Sample code: * *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. * try (WorkflowTemplateServiceClient workflowTemplateServiceClient = * WorkflowTemplateServiceClient.create()) { * InstantiateInlineWorkflowTemplateRequest request = @@ -1110,6 +1182,8 @@ public final OperationFutureinstantiateInlineWorkflowT * Sample code: * *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. * try (WorkflowTemplateServiceClient workflowTemplateServiceClient = * WorkflowTemplateServiceClient.create()) { * InstantiateInlineWorkflowTemplateRequest request = @@ -1160,6 +1234,8 @@ public final OperationFutureinstantiateInlineWorkflowT * Sample code: * *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. * try (WorkflowTemplateServiceClient workflowTemplateServiceClient = * WorkflowTemplateServiceClient.create()) { * InstantiateInlineWorkflowTemplateRequest request = @@ -1190,6 +1266,8 @@ public final OperationFutureinstantiateInlineWorkflowT * Sample code: * *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. * try (WorkflowTemplateServiceClient workflowTemplateServiceClient = * WorkflowTemplateServiceClient.create()) { * WorkflowTemplate template = WorkflowTemplate.newBuilder().build(); @@ -1215,6 +1293,8 @@ public final WorkflowTemplate updateWorkflowTemplate(WorkflowTemplate template) *Sample code: * *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. * try (WorkflowTemplateServiceClient workflowTemplateServiceClient = * WorkflowTemplateServiceClient.create()) { * UpdateWorkflowTemplateRequest request = @@ -1240,6 +1320,8 @@ public final WorkflowTemplate updateWorkflowTemplate(UpdateWorkflowTemplateReque *Sample code: * *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. * try (WorkflowTemplateServiceClient workflowTemplateServiceClient = * WorkflowTemplateServiceClient.create()) { * UpdateWorkflowTemplateRequest request = @@ -1265,6 +1347,8 @@ public final WorkflowTemplate updateWorkflowTemplate(UpdateWorkflowTemplateReque *Sample code: * *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. * try (WorkflowTemplateServiceClient workflowTemplateServiceClient = * WorkflowTemplateServiceClient.create()) { * LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); @@ -1303,6 +1387,8 @@ public final ListWorkflowTemplatesPagedResponse listWorkflowTemplates(LocationNa *Sample code: * *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. * try (WorkflowTemplateServiceClient workflowTemplateServiceClient = * WorkflowTemplateServiceClient.create()) { * RegionName parent = RegionName.of("[PROJECT]", "[REGION]"); @@ -1341,6 +1427,8 @@ public final ListWorkflowTemplatesPagedResponse listWorkflowTemplates(RegionName *Sample code: * *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. * try (WorkflowTemplateServiceClient workflowTemplateServiceClient = * WorkflowTemplateServiceClient.create()) { * String parent = RegionName.of("[PROJECT]", "[REGION]").toString(); @@ -1377,6 +1465,8 @@ public final ListWorkflowTemplatesPagedResponse listWorkflowTemplates(String par *Sample code: * *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. * try (WorkflowTemplateServiceClient workflowTemplateServiceClient = * WorkflowTemplateServiceClient.create()) { * ListWorkflowTemplatesRequest request = @@ -1407,6 +1497,8 @@ public final ListWorkflowTemplatesPagedResponse listWorkflowTemplates( *Sample code: * *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. * try (WorkflowTemplateServiceClient workflowTemplateServiceClient = * WorkflowTemplateServiceClient.create()) { * ListWorkflowTemplatesRequest request = @@ -1436,6 +1528,8 @@ public final ListWorkflowTemplatesPagedResponse listWorkflowTemplates( *Sample code: * *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. * try (WorkflowTemplateServiceClient workflowTemplateServiceClient = * WorkflowTemplateServiceClient.create()) { * ListWorkflowTemplatesRequest request = @@ -1447,7 +1541,7 @@ public final ListWorkflowTemplatesPagedResponse listWorkflowTemplates( * while (true) { * ListWorkflowTemplatesResponse response = * workflowTemplateServiceClient.listWorkflowTemplatesCallable().call(request); - * for (WorkflowTemplate element : response.getResponsesList()) { + * for (WorkflowTemplate element : response.getTemplatesList()) { * // doThingsWith(element); * } * String nextPageToken = response.getNextPageToken(); @@ -1472,11 +1566,13 @@ public final ListWorkflowTemplatesPagedResponse listWorkflowTemplates( *Sample code: * *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. * try (WorkflowTemplateServiceClient workflowTemplateServiceClient = * WorkflowTemplateServiceClient.create()) { * WorkflowTemplateName name = - * WorkflowTemplateName.ofProjectRegionWorkflowTemplateName( - * "[PROJECT]", "[REGION]", "[WORKFLOW_TEMPLATE]"); + * WorkflowTemplateName.ofProjectLocationWorkflowTemplateName( + * "[PROJECT]", "[LOCATION]", "[WORKFLOW_TEMPLATE]"); * workflowTemplateServiceClient.deleteWorkflowTemplate(name); * } * }@@ -1511,6 +1607,8 @@ public final void deleteWorkflowTemplate(WorkflowTemplateName name) { *Sample code: * *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. * try (WorkflowTemplateServiceClient workflowTemplateServiceClient = * WorkflowTemplateServiceClient.create()) { * String name = @@ -1549,13 +1647,15 @@ public final void deleteWorkflowTemplate(String name) { *Sample code: * *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. * try (WorkflowTemplateServiceClient workflowTemplateServiceClient = * WorkflowTemplateServiceClient.create()) { * DeleteWorkflowTemplateRequest request = * DeleteWorkflowTemplateRequest.newBuilder() * .setName( - * WorkflowTemplateName.ofProjectRegionWorkflowTemplateName( - * "[PROJECT]", "[REGION]", "[WORKFLOW_TEMPLATE]") + * WorkflowTemplateName.ofProjectLocationWorkflowTemplateName( + * "[PROJECT]", "[LOCATION]", "[WORKFLOW_TEMPLATE]") * .toString()) * .setVersion(351608024) * .build(); @@ -1577,13 +1677,15 @@ public final void deleteWorkflowTemplate(DeleteWorkflowTemplateRequest request) *Sample code: * *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. * try (WorkflowTemplateServiceClient workflowTemplateServiceClient = * WorkflowTemplateServiceClient.create()) { * DeleteWorkflowTemplateRequest request = * DeleteWorkflowTemplateRequest.newBuilder() * .setName( - * WorkflowTemplateName.ofProjectRegionWorkflowTemplateName( - * "[PROJECT]", "[REGION]", "[WORKFLOW_TEMPLATE]") + * WorkflowTemplateName.ofProjectLocationWorkflowTemplateName( + * "[PROJECT]", "[LOCATION]", "[WORKFLOW_TEMPLATE]") * .toString()) * .setVersion(351608024) * .build(); diff --git a/java-dataproc/google-cloud-dataproc/src/main/java/com/google/cloud/dataproc/v1/WorkflowTemplateServiceSettings.java b/java-dataproc/google-cloud-dataproc/src/main/java/com/google/cloud/dataproc/v1/WorkflowTemplateServiceSettings.java index 9502edcb289f..88c8dfc287e6 100644 --- a/java-dataproc/google-cloud-dataproc/src/main/java/com/google/cloud/dataproc/v1/WorkflowTemplateServiceSettings.java +++ b/java-dataproc/google-cloud-dataproc/src/main/java/com/google/cloud/dataproc/v1/WorkflowTemplateServiceSettings.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Google LLC + * 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. @@ -23,6 +23,7 @@ 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; @@ -55,6 +56,8 @@ *For example, to set the total timeout of createWorkflowTemplate to 30 seconds: * *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. * WorkflowTemplateServiceSettings.Builder workflowTemplateServiceSettingsBuilder = * WorkflowTemplateServiceSettings.newBuilder(); * workflowTemplateServiceSettingsBuilder @@ -163,11 +166,18 @@ public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilde return WorkflowTemplateServiceStubSettings.defaultCredentialsProviderBuilder(); } - /** Returns a builder for the default ChannelProvider for this service. */ + /** Returns a builder for the default gRPC ChannelProvider for this service. */ public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() { return WorkflowTemplateServiceStubSettings.defaultGrpcTransportProviderBuilder(); } + /** Returns a builder for the default REST ChannelProvider for this service. */ + @BetaApi + public static InstantiatingHttpJsonChannelProvider.Builder + defaultHttpJsonTransportProviderBuilder() { + return WorkflowTemplateServiceStubSettings.defaultHttpJsonTransportProviderBuilder(); + } + public static TransportChannelProvider defaultTransportChannelProvider() { return WorkflowTemplateServiceStubSettings.defaultTransportChannelProvider(); } @@ -177,11 +187,17 @@ public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuil return WorkflowTemplateServiceStubSettings.defaultApiClientHeaderProviderBuilder(); } - /** Returns a new builder for this class. */ + /** 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); @@ -220,6 +236,11 @@ private static Builder createDefault() { return new Builder(WorkflowTemplateServiceStubSettings.newBuilder()); } + @BetaApi + private static Builder createHttpJsonDefault() { + return new Builder(WorkflowTemplateServiceStubSettings.newHttpJsonBuilder()); + } + public WorkflowTemplateServiceStubSettings.Builder getStubSettingsBuilder() { return ((WorkflowTemplateServiceStubSettings.Builder) getStubSettings()); } 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 ff77c4df1731..df1f4105bf6a 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 @@ -1,5 +1,5 @@ /* - * Copyright 2021 Google LLC + * 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. @@ -24,6 +24,8 @@ *Sample for AutoscalingPolicyServiceClient: * *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. * try (AutoscalingPolicyServiceClient autoscalingPolicyServiceClient = * AutoscalingPolicyServiceClient.create()) { * LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); @@ -40,6 +42,8 @@ *Sample for BatchControllerClient: * *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. * try (BatchControllerClient batchControllerClient = BatchControllerClient.create()) { * BatchName name = BatchName.of("[PROJECT]", "[LOCATION]", "[BATCH]"); * Batch response = batchControllerClient.getBatch(name); @@ -54,6 +58,8 @@ *Sample for ClusterControllerClient: * *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. * try (ClusterControllerClient clusterControllerClient = ClusterControllerClient.create()) { * String projectId = "projectId-894832108"; * String region = "region-934795532"; @@ -69,6 +75,8 @@ *Sample for JobControllerClient: * *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. * try (JobControllerClient jobControllerClient = JobControllerClient.create()) { * String projectId = "projectId-894832108"; * String region = "region-934795532"; @@ -84,6 +92,8 @@ *Sample for WorkflowTemplateServiceClient: * *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. * try (WorkflowTemplateServiceClient workflowTemplateServiceClient = * WorkflowTemplateServiceClient.create()) { * LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); diff --git a/java-dataproc/google-cloud-dataproc/src/main/java/com/google/cloud/dataproc/v1/stub/AutoscalingPolicyServiceStub.java b/java-dataproc/google-cloud-dataproc/src/main/java/com/google/cloud/dataproc/v1/stub/AutoscalingPolicyServiceStub.java index a4cb2d3b1dd9..71613b6da693 100644 --- a/java-dataproc/google-cloud-dataproc/src/main/java/com/google/cloud/dataproc/v1/stub/AutoscalingPolicyServiceStub.java +++ b/java-dataproc/google-cloud-dataproc/src/main/java/com/google/cloud/dataproc/v1/stub/AutoscalingPolicyServiceStub.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Google LLC + * 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. diff --git a/java-dataproc/google-cloud-dataproc/src/main/java/com/google/cloud/dataproc/v1/stub/AutoscalingPolicyServiceStubSettings.java b/java-dataproc/google-cloud-dataproc/src/main/java/com/google/cloud/dataproc/v1/stub/AutoscalingPolicyServiceStubSettings.java index d32c58ce17a9..1a2a5e94b665 100644 --- a/java-dataproc/google-cloud-dataproc/src/main/java/com/google/cloud/dataproc/v1/stub/AutoscalingPolicyServiceStubSettings.java +++ b/java-dataproc/google-cloud-dataproc/src/main/java/com/google/cloud/dataproc/v1/stub/AutoscalingPolicyServiceStubSettings.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Google LLC + * 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. @@ -27,6 +27,9 @@ 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.httpjson.GaxHttpJsonProperties; +import com.google.api.gax.httpjson.HttpJsonTransportChannel; +import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider; import com.google.api.gax.retrying.RetrySettings; import com.google.api.gax.rpc.ApiCallContext; import com.google.api.gax.rpc.ApiClientHeaderProvider; @@ -75,6 +78,8 @@ *For example, to set the total timeout of createAutoscalingPolicy to 30 seconds: * *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. * AutoscalingPolicyServiceStubSettings.Builder autoscalingPolicyServiceSettingsBuilder = * AutoscalingPolicyServiceStubSettings.newBuilder(); * autoscalingPolicyServiceSettingsBuilder @@ -216,13 +221,17 @@ public ApiFuturegetFuturePagedResponse( return deleteAutoscalingPolicySettings; } - @BetaApi("A restructuring of stub classes is planned, so this may break in the future") public AutoscalingPolicyServiceStub createStub() throws IOException { if (getTransportChannelProvider() .getTransportName() .equals(GrpcTransportChannel.getGrpcTransportName())) { return GrpcAutoscalingPolicyServiceStub.create(this); } + if (getTransportChannelProvider() + .getTransportName() + .equals(HttpJsonTransportChannel.getHttpJsonTransportName())) { + return HttpJsonAutoscalingPolicyServiceStub.create(this); + } throw new UnsupportedOperationException( String.format( "Transport not supported: %s", getTransportChannelProvider().getTransportName())); @@ -255,18 +264,25 @@ public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilde .setUseJwtAccessWithScope(true); } - /** Returns a builder for the default ChannelProvider for this service. */ + /** 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 defaultApiClientHeaderProviderBuilder() { + public static ApiClientHeaderProvider.Builder defaultGrpcApiClientHeaderProviderBuilder() { return ApiClientHeaderProvider.newBuilder() .setGeneratedLibToken( "gapic", GaxProperties.getLibraryVersion(AutoscalingPolicyServiceStubSettings.class)) @@ -274,11 +290,30 @@ public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuil GaxGrpcProperties.getGrpcTokenName(), GaxGrpcProperties.getGrpcVersion()); } - /** Returns a new builder for this class. */ + @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(AutoscalingPolicyServiceStubSettings.class)) + .setTransportToken( + GaxHttpJsonProperties.getHttpJsonTokenName(), + GaxHttpJsonProperties.getHttpJsonVersion()); + } + + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return AutoscalingPolicyServiceStubSettings.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); @@ -414,6 +449,19 @@ private static Builder createDefault() { 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 .createAutoscalingPolicySettings() diff --git a/java-dataproc/google-cloud-dataproc/src/main/java/com/google/cloud/dataproc/v1/stub/BatchControllerStub.java b/java-dataproc/google-cloud-dataproc/src/main/java/com/google/cloud/dataproc/v1/stub/BatchControllerStub.java index 3c8721b8f1cd..83554c32b5c0 100644 --- a/java-dataproc/google-cloud-dataproc/src/main/java/com/google/cloud/dataproc/v1/stub/BatchControllerStub.java +++ b/java-dataproc/google-cloud-dataproc/src/main/java/com/google/cloud/dataproc/v1/stub/BatchControllerStub.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Google LLC + * 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. @@ -43,7 +43,11 @@ public abstract class BatchControllerStub implements BackgroundResource { public OperationsStub getOperationsStub() { - throw new UnsupportedOperationException("Not implemented: getOperationsStub()"); + return null; + } + + public com.google.api.gax.httpjson.longrunning.stub.OperationsStub getHttpJsonOperationsStub() { + return null; } public OperationCallable diff --git a/java-dataproc/google-cloud-dataproc/src/main/java/com/google/cloud/dataproc/v1/stub/BatchControllerStubSettings.java b/java-dataproc/google-cloud-dataproc/src/main/java/com/google/cloud/dataproc/v1/stub/BatchControllerStubSettings.java index 793163de952b..832821dc9090 100644 --- a/java-dataproc/google-cloud-dataproc/src/main/java/com/google/cloud/dataproc/v1/stub/BatchControllerStubSettings.java +++ b/java-dataproc/google-cloud-dataproc/src/main/java/com/google/cloud/dataproc/v1/stub/BatchControllerStubSettings.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Google LLC + * 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. @@ -28,6 +28,9 @@ 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; @@ -80,6 +83,8 @@ * For example, to set the total timeout of getBatch to 30 seconds: * *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. * BatchControllerStubSettings.Builder batchControllerSettingsBuilder = * BatchControllerStubSettings.newBuilder(); * batchControllerSettingsBuilder @@ -188,13 +193,17 @@ public UnaryCallSettingsdeleteBatchSettings() { return deleteBatchSettings; } - @BetaApi("A restructuring of stub classes is planned, so this may break in the future") public BatchControllerStub createStub() throws IOException { if (getTransportChannelProvider() .getTransportName() .equals(GrpcTransportChannel.getGrpcTransportName())) { return GrpcBatchControllerStub.create(this); } + if (getTransportChannelProvider() + .getTransportName() + .equals(HttpJsonTransportChannel.getHttpJsonTransportName())) { + return HttpJsonBatchControllerStub.create(this); + } throw new UnsupportedOperationException( String.format( "Transport not supported: %s", getTransportChannelProvider().getTransportName())); @@ -227,18 +236,25 @@ public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilde .setUseJwtAccessWithScope(true); } - /** Returns a builder for the default ChannelProvider for this service. */ + /** 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 defaultApiClientHeaderProviderBuilder() { + public static ApiClientHeaderProvider.Builder defaultGrpcApiClientHeaderProviderBuilder() { return ApiClientHeaderProvider.newBuilder() .setGeneratedLibToken( "gapic", GaxProperties.getLibraryVersion(BatchControllerStubSettings.class)) @@ -246,11 +262,30 @@ public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuil GaxGrpcProperties.getGrpcTokenName(), GaxGrpcProperties.getGrpcVersion()); } - /** Returns a new builder for this class. */ + @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(BatchControllerStubSettings.class)) + .setTransportToken( + GaxHttpJsonProperties.getHttpJsonTokenName(), + GaxHttpJsonProperties.getHttpJsonVersion()); + } + + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return BatchControllerStubSettings.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); @@ -348,6 +383,19 @@ private static Builder createDefault() { 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 .createBatchSettings() diff --git a/java-dataproc/google-cloud-dataproc/src/main/java/com/google/cloud/dataproc/v1/stub/ClusterControllerStub.java b/java-dataproc/google-cloud-dataproc/src/main/java/com/google/cloud/dataproc/v1/stub/ClusterControllerStub.java index 2cae1ff5b8b0..ba43eba85ce0 100644 --- a/java-dataproc/google-cloud-dataproc/src/main/java/com/google/cloud/dataproc/v1/stub/ClusterControllerStub.java +++ b/java-dataproc/google-cloud-dataproc/src/main/java/com/google/cloud/dataproc/v1/stub/ClusterControllerStub.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Google LLC + * 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. @@ -48,7 +48,11 @@ public abstract class ClusterControllerStub implements BackgroundResource { public OperationsStub getOperationsStub() { - throw new UnsupportedOperationException("Not implemented: getOperationsStub()"); + return null; + } + + public com.google.api.gax.httpjson.longrunning.stub.OperationsStub getHttpJsonOperationsStub() { + return null; } public OperationCallable diff --git a/java-dataproc/google-cloud-dataproc/src/main/java/com/google/cloud/dataproc/v1/stub/ClusterControllerStubSettings.java b/java-dataproc/google-cloud-dataproc/src/main/java/com/google/cloud/dataproc/v1/stub/ClusterControllerStubSettings.java index 48194eb46627..766ba6112ca6 100644 --- a/java-dataproc/google-cloud-dataproc/src/main/java/com/google/cloud/dataproc/v1/stub/ClusterControllerStubSettings.java +++ b/java-dataproc/google-cloud-dataproc/src/main/java/com/google/cloud/dataproc/v1/stub/ClusterControllerStubSettings.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Google LLC + * 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. @@ -28,6 +28,9 @@ 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; @@ -85,6 +88,8 @@ * For example, to set the total timeout of getCluster to 30 seconds: * *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. * ClusterControllerStubSettings.Builder clusterControllerSettingsBuilder = * ClusterControllerStubSettings.newBuilder(); * clusterControllerSettingsBuilder @@ -261,13 +266,17 @@ public UnaryCallSettingsdiagnoseClusterSetti return diagnoseClusterOperationSettings; } - @BetaApi("A restructuring of stub classes is planned, so this may break in the future") public ClusterControllerStub createStub() throws IOException { if (getTransportChannelProvider() .getTransportName() .equals(GrpcTransportChannel.getGrpcTransportName())) { return GrpcClusterControllerStub.create(this); } + if (getTransportChannelProvider() + .getTransportName() + .equals(HttpJsonTransportChannel.getHttpJsonTransportName())) { + return HttpJsonClusterControllerStub.create(this); + } throw new UnsupportedOperationException( String.format( "Transport not supported: %s", getTransportChannelProvider().getTransportName())); @@ -300,18 +309,25 @@ public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilde .setUseJwtAccessWithScope(true); } - /** Returns a builder for the default ChannelProvider for this service. */ + /** 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 defaultApiClientHeaderProviderBuilder() { + public static ApiClientHeaderProvider.Builder defaultGrpcApiClientHeaderProviderBuilder() { return ApiClientHeaderProvider.newBuilder() .setGeneratedLibToken( "gapic", GaxProperties.getLibraryVersion(ClusterControllerStubSettings.class)) @@ -319,11 +335,30 @@ public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuil GaxGrpcProperties.getGrpcTokenName(), GaxGrpcProperties.getGrpcVersion()); } - /** Returns a new builder for this class. */ + @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(ClusterControllerStubSettings.class)) + .setTransportToken( + GaxHttpJsonProperties.getHttpJsonTokenName(), + GaxHttpJsonProperties.getHttpJsonVersion()); + } + + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return ClusterControllerStubSettings.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); @@ -515,6 +550,19 @@ private static Builder createDefault() { 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 .createClusterSettings() diff --git a/java-dataproc/google-cloud-dataproc/src/main/java/com/google/cloud/dataproc/v1/stub/GrpcAutoscalingPolicyServiceCallableFactory.java b/java-dataproc/google-cloud-dataproc/src/main/java/com/google/cloud/dataproc/v1/stub/GrpcAutoscalingPolicyServiceCallableFactory.java index 8bb76da35770..4d243b6fc050 100644 --- a/java-dataproc/google-cloud-dataproc/src/main/java/com/google/cloud/dataproc/v1/stub/GrpcAutoscalingPolicyServiceCallableFactory.java +++ b/java-dataproc/google-cloud-dataproc/src/main/java/com/google/cloud/dataproc/v1/stub/GrpcAutoscalingPolicyServiceCallableFactory.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Google LLC + * 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. diff --git a/java-dataproc/google-cloud-dataproc/src/main/java/com/google/cloud/dataproc/v1/stub/GrpcAutoscalingPolicyServiceStub.java b/java-dataproc/google-cloud-dataproc/src/main/java/com/google/cloud/dataproc/v1/stub/GrpcAutoscalingPolicyServiceStub.java index 89dd2c6563df..1a8d03fa912e 100644 --- a/java-dataproc/google-cloud-dataproc/src/main/java/com/google/cloud/dataproc/v1/stub/GrpcAutoscalingPolicyServiceStub.java +++ b/java-dataproc/google-cloud-dataproc/src/main/java/com/google/cloud/dataproc/v1/stub/GrpcAutoscalingPolicyServiceStub.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Google LLC + * 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. diff --git a/java-dataproc/google-cloud-dataproc/src/main/java/com/google/cloud/dataproc/v1/stub/GrpcBatchControllerCallableFactory.java b/java-dataproc/google-cloud-dataproc/src/main/java/com/google/cloud/dataproc/v1/stub/GrpcBatchControllerCallableFactory.java index 0a5ca6af23ce..143a1c2d2dfc 100644 --- a/java-dataproc/google-cloud-dataproc/src/main/java/com/google/cloud/dataproc/v1/stub/GrpcBatchControllerCallableFactory.java +++ b/java-dataproc/google-cloud-dataproc/src/main/java/com/google/cloud/dataproc/v1/stub/GrpcBatchControllerCallableFactory.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Google LLC + * 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. diff --git a/java-dataproc/google-cloud-dataproc/src/main/java/com/google/cloud/dataproc/v1/stub/GrpcBatchControllerStub.java b/java-dataproc/google-cloud-dataproc/src/main/java/com/google/cloud/dataproc/v1/stub/GrpcBatchControllerStub.java index c7b481b653b9..044146baa455 100644 --- a/java-dataproc/google-cloud-dataproc/src/main/java/com/google/cloud/dataproc/v1/stub/GrpcBatchControllerStub.java +++ b/java-dataproc/google-cloud-dataproc/src/main/java/com/google/cloud/dataproc/v1/stub/GrpcBatchControllerStub.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Google LLC + * 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. diff --git a/java-dataproc/google-cloud-dataproc/src/main/java/com/google/cloud/dataproc/v1/stub/GrpcClusterControllerCallableFactory.java b/java-dataproc/google-cloud-dataproc/src/main/java/com/google/cloud/dataproc/v1/stub/GrpcClusterControllerCallableFactory.java index 7e08bdaf07d3..e4649a750f1e 100644 --- a/java-dataproc/google-cloud-dataproc/src/main/java/com/google/cloud/dataproc/v1/stub/GrpcClusterControllerCallableFactory.java +++ b/java-dataproc/google-cloud-dataproc/src/main/java/com/google/cloud/dataproc/v1/stub/GrpcClusterControllerCallableFactory.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Google LLC + * 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. diff --git a/java-dataproc/google-cloud-dataproc/src/main/java/com/google/cloud/dataproc/v1/stub/GrpcClusterControllerStub.java b/java-dataproc/google-cloud-dataproc/src/main/java/com/google/cloud/dataproc/v1/stub/GrpcClusterControllerStub.java index 7b9fb4cbfbd0..078395cc0c98 100644 --- a/java-dataproc/google-cloud-dataproc/src/main/java/com/google/cloud/dataproc/v1/stub/GrpcClusterControllerStub.java +++ b/java-dataproc/google-cloud-dataproc/src/main/java/com/google/cloud/dataproc/v1/stub/GrpcClusterControllerStub.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Google LLC + * 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. diff --git a/java-dataproc/google-cloud-dataproc/src/main/java/com/google/cloud/dataproc/v1/stub/GrpcJobControllerCallableFactory.java b/java-dataproc/google-cloud-dataproc/src/main/java/com/google/cloud/dataproc/v1/stub/GrpcJobControllerCallableFactory.java index 6c20d95ac05a..b28a67de2d2e 100644 --- a/java-dataproc/google-cloud-dataproc/src/main/java/com/google/cloud/dataproc/v1/stub/GrpcJobControllerCallableFactory.java +++ b/java-dataproc/google-cloud-dataproc/src/main/java/com/google/cloud/dataproc/v1/stub/GrpcJobControllerCallableFactory.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Google LLC + * 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. diff --git a/java-dataproc/google-cloud-dataproc/src/main/java/com/google/cloud/dataproc/v1/stub/GrpcJobControllerStub.java b/java-dataproc/google-cloud-dataproc/src/main/java/com/google/cloud/dataproc/v1/stub/GrpcJobControllerStub.java index 4eb3b09fc49a..52b5ae898e1c 100644 --- a/java-dataproc/google-cloud-dataproc/src/main/java/com/google/cloud/dataproc/v1/stub/GrpcJobControllerStub.java +++ b/java-dataproc/google-cloud-dataproc/src/main/java/com/google/cloud/dataproc/v1/stub/GrpcJobControllerStub.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Google LLC + * 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. diff --git a/java-dataproc/google-cloud-dataproc/src/main/java/com/google/cloud/dataproc/v1/stub/GrpcWorkflowTemplateServiceCallableFactory.java b/java-dataproc/google-cloud-dataproc/src/main/java/com/google/cloud/dataproc/v1/stub/GrpcWorkflowTemplateServiceCallableFactory.java index 5899556e7d48..0d576947474d 100644 --- a/java-dataproc/google-cloud-dataproc/src/main/java/com/google/cloud/dataproc/v1/stub/GrpcWorkflowTemplateServiceCallableFactory.java +++ b/java-dataproc/google-cloud-dataproc/src/main/java/com/google/cloud/dataproc/v1/stub/GrpcWorkflowTemplateServiceCallableFactory.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Google LLC + * 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. diff --git a/java-dataproc/google-cloud-dataproc/src/main/java/com/google/cloud/dataproc/v1/stub/GrpcWorkflowTemplateServiceStub.java b/java-dataproc/google-cloud-dataproc/src/main/java/com/google/cloud/dataproc/v1/stub/GrpcWorkflowTemplateServiceStub.java index 405a7863507b..1efd3f9289ec 100644 --- a/java-dataproc/google-cloud-dataproc/src/main/java/com/google/cloud/dataproc/v1/stub/GrpcWorkflowTemplateServiceStub.java +++ b/java-dataproc/google-cloud-dataproc/src/main/java/com/google/cloud/dataproc/v1/stub/GrpcWorkflowTemplateServiceStub.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Google LLC + * 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. diff --git a/java-dataproc/google-cloud-dataproc/src/main/java/com/google/cloud/dataproc/v1/stub/HttpJsonAutoscalingPolicyServiceCallableFactory.java b/java-dataproc/google-cloud-dataproc/src/main/java/com/google/cloud/dataproc/v1/stub/HttpJsonAutoscalingPolicyServiceCallableFactory.java new file mode 100644 index 000000000000..760e1347742b --- /dev/null +++ b/java-dataproc/google-cloud-dataproc/src/main/java/com/google/cloud/dataproc/v1/stub/HttpJsonAutoscalingPolicyServiceCallableFactory.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 AutoscalingPolicyService service API. + * + * This class is for advanced usage. + */ +@Generated("by gapic-generator-java") +@BetaApi +public class HttpJsonAutoscalingPolicyServiceCallableFactory + 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/HttpJsonAutoscalingPolicyServiceStub.java b/java-dataproc/google-cloud-dataproc/src/main/java/com/google/cloud/dataproc/v1/stub/HttpJsonAutoscalingPolicyServiceStub.java new file mode 100644 index 000000000000..ee4bb3b9b304 --- /dev/null +++ b/java-dataproc/google-cloud-dataproc/src/main/java/com/google/cloud/dataproc/v1/stub/HttpJsonAutoscalingPolicyServiceStub.java @@ -0,0 +1,452 @@ +/* + * 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 static com.google.cloud.dataproc.v1.AutoscalingPolicyServiceClient.ListAutoscalingPoliciesPagedResponse; + +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.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.rpc.ClientContext; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.dataproc.v1.AutoscalingPolicy; +import com.google.cloud.dataproc.v1.CreateAutoscalingPolicyRequest; +import com.google.cloud.dataproc.v1.DeleteAutoscalingPolicyRequest; +import com.google.cloud.dataproc.v1.GetAutoscalingPolicyRequest; +import com.google.cloud.dataproc.v1.ListAutoscalingPoliciesRequest; +import com.google.cloud.dataproc.v1.ListAutoscalingPoliciesResponse; +import com.google.cloud.dataproc.v1.UpdateAutoscalingPolicyRequest; +import com.google.protobuf.Empty; +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 AutoscalingPolicyService service API. + * + * This class is for advanced usage and reflects the underlying API directly. + */ +@Generated("by gapic-generator-java") +@BetaApi +public class HttpJsonAutoscalingPolicyServiceStub extends AutoscalingPolicyServiceStub { + private static final TypeRegistry typeRegistry = TypeRegistry.newBuilder().build(); + + private static final ApiMethodDescriptor
+ createAutoscalingPolicyMethodDescriptor = + ApiMethodDescriptor. newBuilder() + .setFullMethodName( + "google.cloud.dataproc.v1.AutoscalingPolicyService/CreateAutoscalingPolicy") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter. newBuilder() + .setPath( + "/v1/{parent=projects/*/locations/*}/autoscalingPolicies", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "parent", request.getParent()); + return fields; + }) + .setAdditionalPaths("/v1/{parent=projects/*/regions/*}/autoscalingPolicies") + .setQueryParamsExtractor( + request -> { + Map > fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create().toBody("policy", request.getPolicy())) + .build()) + .setResponseParser( + ProtoMessageResponseParser. newBuilder() + .setDefaultInstance(AutoscalingPolicy.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + updateAutoscalingPolicyMethodDescriptor = + ApiMethodDescriptor. newBuilder() + .setFullMethodName( + "google.cloud.dataproc.v1.AutoscalingPolicyService/UpdateAutoscalingPolicy") + .setHttpMethod("PUT") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter. newBuilder() + .setPath( + "/v1/{policy.name=projects/*/locations/*/autoscalingPolicies/*}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam( + fields, "policy.name", request.getPolicy().getName()); + return fields; + }) + .setAdditionalPaths( + "/v1/{policy.name=projects/*/regions/*/autoscalingPolicies/*}") + .setQueryParamsExtractor( + request -> { + Map > fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create().toBody("policy", request.getPolicy())) + .build()) + .setResponseParser( + ProtoMessageResponseParser. newBuilder() + .setDefaultInstance(AutoscalingPolicy.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + getAutoscalingPolicyMethodDescriptor = + ApiMethodDescriptor. newBuilder() + .setFullMethodName( + "google.cloud.dataproc.v1.AutoscalingPolicyService/GetAutoscalingPolicy") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter. newBuilder() + .setPath( + "/v1/{name=projects/*/locations/*/autoscalingPolicies/*}", + request -> { + Map