From 50f0ad0e3f3184d227927c172a1055bbaa8bdcb0 Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Tue, 28 Jul 2020 12:24:08 -0700 Subject: [PATCH] fix: fix LRO annotations for method `DiagnoseCluster`. (#250) This PR was generated using Autosynth. :rainbow: Synth log will be available here: https://source.cloud.google.com/results/invocations/fa501585-95fa-4c4d-9062-c23b3406d7ec/targets - [ ] To automatically regenerate this PR, check this box. PiperOrigin-RevId: 321255718 Source-Link: https://github.com/googleapis/googleapis/commit/0e7900e3950d32ccafae22a2ccb85fa61ffe08f9 --- .../dataproc/v1/ClusterControllerClient.java | 21 ++++++++++--------- .../v1/ClusterControllerSettings.java | 6 ++++-- .../v1/stub/ClusterControllerStub.java | 2 +- .../stub/ClusterControllerStubSettings.java | 15 +++++++------ .../v1/stub/GrpcClusterControllerStub.java | 5 +++-- .../v1/ClusterControllerClientTest.java | 7 +++++-- .../cloud/dataproc/v1/ClustersProto.java | 21 ++++++++++--------- .../google/cloud/dataproc/v1/clusters.proto | 4 ++-- synth.metadata | 10 ++++----- 9 files changed, 51 insertions(+), 40 deletions(-) diff --git a/google-cloud-dataproc/src/main/java/com/google/cloud/dataproc/v1/ClusterControllerClient.java b/google-cloud-dataproc/src/main/java/com/google/cloud/dataproc/v1/ClusterControllerClient.java index 9731463b..371777be 100644 --- a/google-cloud-dataproc/src/main/java/com/google/cloud/dataproc/v1/ClusterControllerClient.java +++ b/google-cloud-dataproc/src/main/java/com/google/cloud/dataproc/v1/ClusterControllerClient.java @@ -607,7 +607,7 @@ public final UnaryCallable deleteClusterCallabl * String projectId = ""; * String region = ""; * String clusterName = ""; - * clusterControllerClient.diagnoseClusterAsync(projectId, region, clusterName).get(); + * DiagnoseClusterResults response = clusterControllerClient.diagnoseClusterAsync(projectId, region, clusterName).get(); * } * * @@ -619,8 +619,8 @@ public final UnaryCallable deleteClusterCallabl */ @BetaApi( "The surface for long-running operations is not stable yet and may change in the future.") - public final OperationFuture diagnoseClusterAsync( - String projectId, String region, String clusterName) { + public final OperationFuture + diagnoseClusterAsync(String projectId, String region, String clusterName) { DiagnoseClusterRequest request = DiagnoseClusterRequest.newBuilder() .setProjectId(projectId) @@ -651,7 +651,7 @@ public final OperationFuture diagnoseClusterAsync * .setRegion(region) * .setClusterName(clusterName) * .build(); - * clusterControllerClient.diagnoseClusterAsync(request).get(); + * DiagnoseClusterResults response = clusterControllerClient.diagnoseClusterAsync(request).get(); * } * * @@ -660,8 +660,8 @@ public final OperationFuture diagnoseClusterAsync */ @BetaApi( "The surface for long-running operations is not stable yet and may change in the future.") - public final OperationFuture diagnoseClusterAsync( - DiagnoseClusterRequest request) { + public final OperationFuture + diagnoseClusterAsync(DiagnoseClusterRequest request) { return diagnoseClusterOperationCallable().futureCall(request); } @@ -686,14 +686,15 @@ public final OperationFuture diagnoseClusterAsync * .setRegion(region) * .setClusterName(clusterName) * .build(); - * OperationFuture<Empty, DiagnoseClusterResults> future = clusterControllerClient.diagnoseClusterOperationCallable().futureCall(request); + * OperationFuture<DiagnoseClusterResults, ClusterOperationMetadata> future = clusterControllerClient.diagnoseClusterOperationCallable().futureCall(request); * // Do something - * future.get(); + * DiagnoseClusterResults response = future.get(); * } * */ @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") - public final OperationCallable + public final OperationCallable< + DiagnoseClusterRequest, DiagnoseClusterResults, ClusterOperationMetadata> diagnoseClusterOperationCallable() { return stub.diagnoseClusterOperationCallable(); } @@ -721,7 +722,7 @@ public final OperationFuture diagnoseClusterAsync * .build(); * ApiFuture<Operation> future = clusterControllerClient.diagnoseClusterCallable().futureCall(request); * // Do something - * future.get(); + * Operation response = future.get(); * } * */ diff --git a/google-cloud-dataproc/src/main/java/com/google/cloud/dataproc/v1/ClusterControllerSettings.java b/google-cloud-dataproc/src/main/java/com/google/cloud/dataproc/v1/ClusterControllerSettings.java index 497b0bb7..421263de 100644 --- a/google-cloud-dataproc/src/main/java/com/google/cloud/dataproc/v1/ClusterControllerSettings.java +++ b/google-cloud-dataproc/src/main/java/com/google/cloud/dataproc/v1/ClusterControllerSettings.java @@ -117,7 +117,8 @@ public UnaryCallSettings diagnoseClusterSetti /** Returns the object with the settings used for calls to diagnoseCluster. */ @BetaApi( "The surface for long-running operations is not stable yet and may change in the future.") - public OperationCallSettings + public OperationCallSettings< + DiagnoseClusterRequest, DiagnoseClusterResults, ClusterOperationMetadata> diagnoseClusterOperationSettings() { return ((ClusterControllerStubSettings) getStubSettings()).diagnoseClusterOperationSettings(); } @@ -277,7 +278,8 @@ public UnaryCallSettings.Builder diagnoseClus /** Returns the builder for the settings used for calls to diagnoseCluster. */ @BetaApi( "The surface for long-running operations is not stable yet and may change in the future.") - public OperationCallSettings.Builder + public OperationCallSettings.Builder< + DiagnoseClusterRequest, DiagnoseClusterResults, ClusterOperationMetadata> diagnoseClusterOperationSettings() { return getStubSettingsBuilder().diagnoseClusterOperationSettings(); } diff --git a/google-cloud-dataproc/src/main/java/com/google/cloud/dataproc/v1/stub/ClusterControllerStub.java b/google-cloud-dataproc/src/main/java/com/google/cloud/dataproc/v1/stub/ClusterControllerStub.java index 7655c576..e1fbf8c3 100644 --- a/google-cloud-dataproc/src/main/java/com/google/cloud/dataproc/v1/stub/ClusterControllerStub.java +++ b/google-cloud-dataproc/src/main/java/com/google/cloud/dataproc/v1/stub/ClusterControllerStub.java @@ -82,7 +82,7 @@ public UnaryCallable deleteClusterCallable() { } @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") - public OperationCallable + public OperationCallable diagnoseClusterOperationCallable() { throw new UnsupportedOperationException("Not implemented: diagnoseClusterOperationCallable()"); } diff --git a/google-cloud-dataproc/src/main/java/com/google/cloud/dataproc/v1/stub/ClusterControllerStubSettings.java b/google-cloud-dataproc/src/main/java/com/google/cloud/dataproc/v1/stub/ClusterControllerStubSettings.java index 2c027450..1d232648 100644 --- a/google-cloud-dataproc/src/main/java/com/google/cloud/dataproc/v1/stub/ClusterControllerStubSettings.java +++ b/google-cloud-dataproc/src/main/java/com/google/cloud/dataproc/v1/stub/ClusterControllerStubSettings.java @@ -112,7 +112,8 @@ public class ClusterControllerStubSettings extends StubSettings deleteClusterOperationSettings; private final UnaryCallSettings diagnoseClusterSettings; - private final OperationCallSettings + private final OperationCallSettings< + DiagnoseClusterRequest, DiagnoseClusterResults, ClusterOperationMetadata> diagnoseClusterOperationSettings; private final UnaryCallSettings getClusterSettings; private final PagedCallSettings< @@ -162,7 +163,8 @@ public UnaryCallSettings diagnoseClusterSetti /** Returns the object with the settings used for calls to diagnoseCluster. */ @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") - public OperationCallSettings + public OperationCallSettings< + DiagnoseClusterRequest, DiagnoseClusterResults, ClusterOperationMetadata> diagnoseClusterOperationSettings() { return diagnoseClusterOperationSettings; } @@ -331,7 +333,7 @@ public static class Builder extends StubSettings.Builder diagnoseClusterSettings; private final OperationCallSettings.Builder< - DiagnoseClusterRequest, Empty, DiagnoseClusterResults> + DiagnoseClusterRequest, DiagnoseClusterResults, ClusterOperationMetadata> diagnoseClusterOperationSettings; private final UnaryCallSettings.Builder getClusterSettings; private final PagedCallSettings.Builder< @@ -547,9 +549,9 @@ private static Builder initDefaults(Builder builder) { .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_5_params")) .build()) .setResponseTransformer( - ProtoOperationTransformers.ResponseTransformer.create(Empty.class)) + ProtoOperationTransformers.ResponseTransformer.create(DiagnoseClusterResults.class)) .setMetadataTransformer( - ProtoOperationTransformers.MetadataTransformer.create(DiagnoseClusterResults.class)) + ProtoOperationTransformers.MetadataTransformer.create(ClusterOperationMetadata.class)) .setPollingAlgorithm( OperationTimedPollAlgorithm.create( RetrySettings.newBuilder() @@ -652,7 +654,8 @@ public UnaryCallSettings.Builder diagnoseClus /** Returns the builder for the settings used for calls to diagnoseCluster. */ @BetaApi( "The surface for use by generated code is not stable yet and may change in the future.") - public OperationCallSettings.Builder + public OperationCallSettings.Builder< + DiagnoseClusterRequest, DiagnoseClusterResults, ClusterOperationMetadata> diagnoseClusterOperationSettings() { return diagnoseClusterOperationSettings; } diff --git a/google-cloud-dataproc/src/main/java/com/google/cloud/dataproc/v1/stub/GrpcClusterControllerStub.java b/google-cloud-dataproc/src/main/java/com/google/cloud/dataproc/v1/stub/GrpcClusterControllerStub.java index 33d2b574..b1c845f0 100644 --- a/google-cloud-dataproc/src/main/java/com/google/cloud/dataproc/v1/stub/GrpcClusterControllerStub.java +++ b/google-cloud-dataproc/src/main/java/com/google/cloud/dataproc/v1/stub/GrpcClusterControllerStub.java @@ -120,7 +120,8 @@ public class GrpcClusterControllerStub extends ClusterControllerStub { private final OperationCallable deleteClusterOperationCallable; private final UnaryCallable diagnoseClusterCallable; - private final OperationCallable + private final OperationCallable< + DiagnoseClusterRequest, DiagnoseClusterResults, ClusterOperationMetadata> diagnoseClusterOperationCallable; private final UnaryCallable getClusterCallable; private final UnaryCallable listClustersCallable; @@ -279,7 +280,7 @@ public UnaryCallable deleteClusterCallable() { } @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") - public OperationCallable + public OperationCallable diagnoseClusterOperationCallable() { return diagnoseClusterOperationCallable; } diff --git a/google-cloud-dataproc/src/test/java/com/google/cloud/dataproc/v1/ClusterControllerClientTest.java b/google-cloud-dataproc/src/test/java/com/google/cloud/dataproc/v1/ClusterControllerClientTest.java index fece24b4..8c1163ce 100644 --- a/google-cloud-dataproc/src/test/java/com/google/cloud/dataproc/v1/ClusterControllerClientTest.java +++ b/google-cloud-dataproc/src/test/java/com/google/cloud/dataproc/v1/ClusterControllerClientTest.java @@ -276,7 +276,9 @@ public void deleteClusterExceptionTest() throws Exception { @Test @SuppressWarnings("all") public void diagnoseClusterTest() throws Exception { - Empty expectedResponse = Empty.newBuilder().build(); + String outputUri = "outputUri-1273518802"; + DiagnoseClusterResults expectedResponse = + DiagnoseClusterResults.newBuilder().setOutputUri(outputUri).build(); Operation resultOperation = Operation.newBuilder() .setName("diagnoseClusterTest") @@ -289,7 +291,8 @@ public void diagnoseClusterTest() throws Exception { String region = "region-934795532"; String clusterName = "clusterName-1018081872"; - Empty actualResponse = client.diagnoseClusterAsync(projectId, region, clusterName).get(); + DiagnoseClusterResults actualResponse = + client.diagnoseClusterAsync(projectId, region, clusterName).get(); Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockClusterController.getRequests(); diff --git a/proto-google-cloud-dataproc-v1/src/main/java/com/google/cloud/dataproc/v1/ClustersProto.java b/proto-google-cloud-dataproc-v1/src/main/java/com/google/cloud/dataproc/v1/ClustersProto.java index 2ea622c9..dd0174cd 100644 --- a/proto-google-cloud-dataproc-v1/src/main/java/com/google/cloud/dataproc/v1/ClustersProto.java +++ b/proto-google-cloud-dataproc-v1/src/main/java/com/google/cloud/dataproc/v1/ClustersProto.java @@ -308,7 +308,7 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { + "TypeB\003\340A\001\022\020\n\003key\030\002 \001(\tB\003\340A\001\022\023\n\006values\030\003 " + "\003(\tB\003\340A\001\"_\n\004Type\022\024\n\020TYPE_UNSPECIFIED\020\000\022\022" + "\n\016NO_RESERVATION\020\001\022\023\n\017ANY_RESERVATION\020\002\022" - + "\030\n\024SPECIFIC_RESERVATION\020\0032\343\014\n\021ClusterCon" + + "\030\n\024SPECIFIC_RESERVATION\020\0032\377\014\n\021ClusterCon" + "troller\022\200\002\n\rCreateCluster\022..google.cloud" + ".dataproc.v1.CreateClusterRequest\032\035.goog" + "le.longrunning.Operation\"\237\001\202\323\344\223\002>\"3/v1/p" @@ -340,19 +340,20 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { + "google.cloud.dataproc.v1.ListClustersRes" + "ponse\"j\202\323\344\223\0025\0223/v1/projects/{project_id}" + "/regions/{region}/clusters\332A\021project_id," - + "region\332A\030project_id,region,filter\022\216\002\n\017Di" + + "region\332A\030project_id,region,filter\022\252\002\n\017Di" + "agnoseCluster\0220.google.cloud.dataproc.v1" + ".DiagnoseClusterRequest\032\035.google.longrun" - + "ning.Operation\"\251\001\202\323\344\223\002P\"K/v1/projects/{p" + + "ning.Operation\"\305\001\202\323\344\223\002P\"K/v1/projects/{p" + "roject_id}/regions/{region}/clusters/{cl" + "uster_name}:diagnose:\001*\332A\036project_id,reg" - + "ion,cluster_name\312A/\n\025google.protobuf.Emp" - + "ty\022\026DiagnoseClusterResults\032K\312A\027dataproc." - + "googleapis.com\322A.https://www.googleapis." - + "com/auth/cloud-platformBq\n\034com.google.cl" - + "oud.dataproc.v1B\rClustersProtoP\001Z@google" - + ".golang.org/genproto/googleapis/cloud/da" - + "taproc/v1;dataprocb\006proto3" + + "ion,cluster_name\312AK\n\026DiagnoseClusterResu" + + "lts\0221google.cloud.dataproc.v1.ClusterOpe" + + "rationMetadata\032K\312A\027dataproc.googleapis.c" + + "om\322A.https://www.googleapis.com/auth/clo" + + "ud-platformBq\n\034com.google.cloud.dataproc" + + ".v1B\rClustersProtoP\001Z@google.golang.org/" + + "genproto/googleapis/cloud/dataproc/v1;da" + + "taprocb\006proto3" }; descriptor = com.google.protobuf.Descriptors.FileDescriptor.internalBuildGeneratedFileFrom( diff --git a/proto-google-cloud-dataproc-v1/src/main/proto/google/cloud/dataproc/v1/clusters.proto b/proto-google-cloud-dataproc-v1/src/main/proto/google/cloud/dataproc/v1/clusters.proto index fbaf9391..c66d35d3 100644 --- a/proto-google-cloud-dataproc-v1/src/main/proto/google/cloud/dataproc/v1/clusters.proto +++ b/proto-google-cloud-dataproc-v1/src/main/proto/google/cloud/dataproc/v1/clusters.proto @@ -111,8 +111,8 @@ service ClusterController { }; option (google.api.method_signature) = "project_id,region,cluster_name"; option (google.longrunning.operation_info) = { - response_type: "google.protobuf.Empty" - metadata_type: "DiagnoseClusterResults" + response_type: "DiagnoseClusterResults" + metadata_type: "google.cloud.dataproc.v1.ClusterOperationMetadata" }; } } diff --git a/synth.metadata b/synth.metadata index 5e000f12..f7294ca7 100644 --- a/synth.metadata +++ b/synth.metadata @@ -4,23 +4,23 @@ "git": { "name": ".", "remote": "https://github.com/googleapis/java-dataproc.git", - "sha": "f246195ad7aa0fd04694256f885c09b22c10289b" + "sha": "bef1b0d43ffa90cf27303a87ce8e020083512841" } }, { "git": { "name": "googleapis", "remote": "https://github.com/googleapis/googleapis.git", - "sha": "ec05fa81a492c84fbe5b85341738ced42604ce68", - "internalRef": "320442976" + "sha": "0e7900e3950d32ccafae22a2ccb85fa61ffe08f9", + "internalRef": "321255718" } }, { "git": { "name": "googleapis", "remote": "https://github.com/googleapis/googleapis.git", - "sha": "ec05fa81a492c84fbe5b85341738ced42604ce68", - "internalRef": "320442976" + "sha": "0e7900e3950d32ccafae22a2ccb85fa61ffe08f9", + "internalRef": "321255718" } }, {