From 92d4eaafba966a443e4366d32516d17ef0081826 Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Wed, 3 Jun 2020 12:26:07 -0700 Subject: [PATCH] fix: restore GAPIC v2 retry configs (#188) This PR was generated using Autosynth. :rainbow: Synth log will be available here: https://source.cloud.google.com/results/invocations/b94bacd6-05ee-45c2-be4d-b0f667030fab/targets PiperOrigin-RevId: 312088359 Source-Link: https://github.com/googleapis/googleapis/commit/5a90d467aa65e7f038f87585e8fbb45d74475e7c --- .../v3/TranslationServiceClient.java | 254 +++++++++--------- .../v3/TranslationServiceSettings.java | 56 ++-- .../v3/stub/GrpcTranslationServiceStub.java | 90 +++---- .../v3/stub/TranslationServiceStub.java | 20 +- .../stub/TranslationServiceStubSettings.java | 130 ++++----- .../v3beta1/TranslationServiceClient.java | 254 +++++++++--------- .../v3beta1/TranslationServiceSettings.java | 56 ++-- .../stub/GrpcTranslationServiceStub.java | 92 +++---- .../v3beta1/stub/TranslationServiceStub.java | 20 +- .../stub/TranslationServiceStubSettings.java | 130 ++++----- .../v3/TranslationServiceClientTest.java | 96 +++---- .../v3beta1/TranslationServiceClientTest.java | 96 +++---- synth.metadata | 8 +- 13 files changed, 651 insertions(+), 651 deletions(-) diff --git a/google-cloud-translate/src/main/java/com/google/cloud/translate/v3/TranslationServiceClient.java b/google-cloud-translate/src/main/java/com/google/cloud/translate/v3/TranslationServiceClient.java index f851c18d..54642032 100644 --- a/google-cloud-translate/src/main/java/com/google/cloud/translate/v3/TranslationServiceClient.java +++ b/google-cloud-translate/src/main/java/com/google/cloud/translate/v3/TranslationServiceClient.java @@ -173,6 +173,133 @@ public final OperationsClient getOperationsClient() { return operationsClient; } + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes a glossary, or cancels glossary construction if the glossary isn't created yet. Returns + * NOT_FOUND, if the glossary doesn't exist. + * + *

Sample code: + * + *


+   * try (TranslationServiceClient translationServiceClient = TranslationServiceClient.create()) {
+   *   GlossaryName name = GlossaryName.of("[PROJECT]", "[LOCATION]", "[GLOSSARY]");
+   *   DeleteGlossaryResponse response = translationServiceClient.deleteGlossaryAsync(name).get();
+   * }
+   * 
+ * + * @param name Required. The name of the glossary to delete. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi( + "The surface for long-running operations is not stable yet and may change in the future.") + public final OperationFuture deleteGlossaryAsync( + GlossaryName name) { + DeleteGlossaryRequest request = + DeleteGlossaryRequest.newBuilder().setName(name == null ? null : name.toString()).build(); + return deleteGlossaryAsync(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes a glossary, or cancels glossary construction if the glossary isn't created yet. Returns + * NOT_FOUND, if the glossary doesn't exist. + * + *

Sample code: + * + *


+   * try (TranslationServiceClient translationServiceClient = TranslationServiceClient.create()) {
+   *   GlossaryName name = GlossaryName.of("[PROJECT]", "[LOCATION]", "[GLOSSARY]");
+   *   DeleteGlossaryResponse response = translationServiceClient.deleteGlossaryAsync(name.toString()).get();
+   * }
+   * 
+ * + * @param name Required. The name of the glossary to delete. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi( + "The surface for long-running operations is not stable yet and may change in the future.") + public final OperationFuture deleteGlossaryAsync( + String name) { + DeleteGlossaryRequest request = DeleteGlossaryRequest.newBuilder().setName(name).build(); + return deleteGlossaryAsync(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes a glossary, or cancels glossary construction if the glossary isn't created yet. Returns + * NOT_FOUND, if the glossary doesn't exist. + * + *

Sample code: + * + *


+   * try (TranslationServiceClient translationServiceClient = TranslationServiceClient.create()) {
+   *   GlossaryName name = GlossaryName.of("[PROJECT]", "[LOCATION]", "[GLOSSARY]");
+   *   DeleteGlossaryRequest request = DeleteGlossaryRequest.newBuilder()
+   *     .setName(name.toString())
+   *     .build();
+   *   DeleteGlossaryResponse response = translationServiceClient.deleteGlossaryAsync(request).get();
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi( + "The surface for long-running operations is not stable yet and may change in the future.") + public final OperationFuture deleteGlossaryAsync( + DeleteGlossaryRequest request) { + return deleteGlossaryOperationCallable().futureCall(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes a glossary, or cancels glossary construction if the glossary isn't created yet. Returns + * NOT_FOUND, if the glossary doesn't exist. + * + *

Sample code: + * + *


+   * try (TranslationServiceClient translationServiceClient = TranslationServiceClient.create()) {
+   *   GlossaryName name = GlossaryName.of("[PROJECT]", "[LOCATION]", "[GLOSSARY]");
+   *   DeleteGlossaryRequest request = DeleteGlossaryRequest.newBuilder()
+   *     .setName(name.toString())
+   *     .build();
+   *   OperationFuture<DeleteGlossaryResponse, DeleteGlossaryMetadata> future = translationServiceClient.deleteGlossaryOperationCallable().futureCall(request);
+   *   // Do something
+   *   DeleteGlossaryResponse response = future.get();
+   * }
+   * 
+ */ + @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") + public final OperationCallable< + DeleteGlossaryRequest, DeleteGlossaryResponse, DeleteGlossaryMetadata> + deleteGlossaryOperationCallable() { + return stub.deleteGlossaryOperationCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes a glossary, or cancels glossary construction if the glossary isn't created yet. Returns + * NOT_FOUND, if the glossary doesn't exist. + * + *

Sample code: + * + *


+   * try (TranslationServiceClient translationServiceClient = TranslationServiceClient.create()) {
+   *   GlossaryName name = GlossaryName.of("[PROJECT]", "[LOCATION]", "[GLOSSARY]");
+   *   DeleteGlossaryRequest request = DeleteGlossaryRequest.newBuilder()
+   *     .setName(name.toString())
+   *     .build();
+   *   ApiFuture<Operation> future = translationServiceClient.deleteGlossaryCallable().futureCall(request);
+   *   // Do something
+   *   Operation response = future.get();
+   * }
+   * 
+ */ + public final UnaryCallable deleteGlossaryCallable() { + return stub.deleteGlossaryCallable(); + } + // AUTO-GENERATED DOCUMENTATION AND METHOD /** * Translates input text and returns translated text. @@ -1191,133 +1318,6 @@ public final UnaryCallable getGlossaryCallable() { return stub.getGlossaryCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD - /** - * Deletes a glossary, or cancels glossary construction if the glossary isn't created yet. Returns - * NOT_FOUND, if the glossary doesn't exist. - * - *

Sample code: - * - *


-   * try (TranslationServiceClient translationServiceClient = TranslationServiceClient.create()) {
-   *   GlossaryName name = GlossaryName.of("[PROJECT]", "[LOCATION]", "[GLOSSARY]");
-   *   DeleteGlossaryResponse response = translationServiceClient.deleteGlossaryAsync(name).get();
-   * }
-   * 
- * - * @param name Required. The name of the glossary to delete. - * @throws com.google.api.gax.rpc.ApiException if the remote call fails - */ - @BetaApi( - "The surface for long-running operations is not stable yet and may change in the future.") - public final OperationFuture deleteGlossaryAsync( - GlossaryName name) { - DeleteGlossaryRequest request = - DeleteGlossaryRequest.newBuilder().setName(name == null ? null : name.toString()).build(); - return deleteGlossaryAsync(request); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD - /** - * Deletes a glossary, or cancels glossary construction if the glossary isn't created yet. Returns - * NOT_FOUND, if the glossary doesn't exist. - * - *

Sample code: - * - *


-   * try (TranslationServiceClient translationServiceClient = TranslationServiceClient.create()) {
-   *   GlossaryName name = GlossaryName.of("[PROJECT]", "[LOCATION]", "[GLOSSARY]");
-   *   DeleteGlossaryResponse response = translationServiceClient.deleteGlossaryAsync(name.toString()).get();
-   * }
-   * 
- * - * @param name Required. The name of the glossary to delete. - * @throws com.google.api.gax.rpc.ApiException if the remote call fails - */ - @BetaApi( - "The surface for long-running operations is not stable yet and may change in the future.") - public final OperationFuture deleteGlossaryAsync( - String name) { - DeleteGlossaryRequest request = DeleteGlossaryRequest.newBuilder().setName(name).build(); - return deleteGlossaryAsync(request); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD - /** - * Deletes a glossary, or cancels glossary construction if the glossary isn't created yet. Returns - * NOT_FOUND, if the glossary doesn't exist. - * - *

Sample code: - * - *


-   * try (TranslationServiceClient translationServiceClient = TranslationServiceClient.create()) {
-   *   GlossaryName name = GlossaryName.of("[PROJECT]", "[LOCATION]", "[GLOSSARY]");
-   *   DeleteGlossaryRequest request = DeleteGlossaryRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .build();
-   *   DeleteGlossaryResponse response = translationServiceClient.deleteGlossaryAsync(request).get();
-   * }
-   * 
- * - * @param request The request object containing all of the parameters for the API call. - * @throws com.google.api.gax.rpc.ApiException if the remote call fails - */ - @BetaApi( - "The surface for long-running operations is not stable yet and may change in the future.") - public final OperationFuture deleteGlossaryAsync( - DeleteGlossaryRequest request) { - return deleteGlossaryOperationCallable().futureCall(request); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD - /** - * Deletes a glossary, or cancels glossary construction if the glossary isn't created yet. Returns - * NOT_FOUND, if the glossary doesn't exist. - * - *

Sample code: - * - *


-   * try (TranslationServiceClient translationServiceClient = TranslationServiceClient.create()) {
-   *   GlossaryName name = GlossaryName.of("[PROJECT]", "[LOCATION]", "[GLOSSARY]");
-   *   DeleteGlossaryRequest request = DeleteGlossaryRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .build();
-   *   OperationFuture<DeleteGlossaryResponse, DeleteGlossaryMetadata> future = translationServiceClient.deleteGlossaryOperationCallable().futureCall(request);
-   *   // Do something
-   *   DeleteGlossaryResponse response = future.get();
-   * }
-   * 
- */ - @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") - public final OperationCallable< - DeleteGlossaryRequest, DeleteGlossaryResponse, DeleteGlossaryMetadata> - deleteGlossaryOperationCallable() { - return stub.deleteGlossaryOperationCallable(); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD - /** - * Deletes a glossary, or cancels glossary construction if the glossary isn't created yet. Returns - * NOT_FOUND, if the glossary doesn't exist. - * - *

Sample code: - * - *


-   * try (TranslationServiceClient translationServiceClient = TranslationServiceClient.create()) {
-   *   GlossaryName name = GlossaryName.of("[PROJECT]", "[LOCATION]", "[GLOSSARY]");
-   *   DeleteGlossaryRequest request = DeleteGlossaryRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .build();
-   *   ApiFuture<Operation> future = translationServiceClient.deleteGlossaryCallable().futureCall(request);
-   *   // Do something
-   *   Operation response = future.get();
-   * }
-   * 
- */ - public final UnaryCallable deleteGlossaryCallable() { - return stub.deleteGlossaryCallable(); - } - @Override public final void close() { stub.close(); diff --git a/google-cloud-translate/src/main/java/com/google/cloud/translate/v3/TranslationServiceSettings.java b/google-cloud-translate/src/main/java/com/google/cloud/translate/v3/TranslationServiceSettings.java index ccedeb3d..5fed32de 100644 --- a/google-cloud-translate/src/main/java/com/google/cloud/translate/v3/TranslationServiceSettings.java +++ b/google-cloud-translate/src/main/java/com/google/cloud/translate/v3/TranslationServiceSettings.java @@ -69,6 +69,20 @@ @Generated("by gapic-generator") @BetaApi public class TranslationServiceSettings extends ClientSettings { + /** Returns the object with the settings used for calls to deleteGlossary. */ + public UnaryCallSettings deleteGlossarySettings() { + return ((TranslationServiceStubSettings) getStubSettings()).deleteGlossarySettings(); + } + + /** Returns the object with the settings used for calls to deleteGlossary. */ + @BetaApi( + "The surface for long-running operations is not stable yet and may change in the future.") + public OperationCallSettings< + DeleteGlossaryRequest, DeleteGlossaryResponse, DeleteGlossaryMetadata> + deleteGlossaryOperationSettings() { + return ((TranslationServiceStubSettings) getStubSettings()).deleteGlossaryOperationSettings(); + } + /** Returns the object with the settings used for calls to translateText. */ public UnaryCallSettings translateTextSettings() { return ((TranslationServiceStubSettings) getStubSettings()).translateTextSettings(); @@ -125,20 +139,6 @@ public UnaryCallSettings getGlossarySettings() { return ((TranslationServiceStubSettings) getStubSettings()).getGlossarySettings(); } - /** Returns the object with the settings used for calls to deleteGlossary. */ - public UnaryCallSettings deleteGlossarySettings() { - return ((TranslationServiceStubSettings) getStubSettings()).deleteGlossarySettings(); - } - - /** Returns the object with the settings used for calls to deleteGlossary. */ - @BetaApi( - "The surface for long-running operations is not stable yet and may change in the future.") - public OperationCallSettings< - DeleteGlossaryRequest, DeleteGlossaryResponse, DeleteGlossaryMetadata> - deleteGlossaryOperationSettings() { - return ((TranslationServiceStubSettings) getStubSettings()).deleteGlossaryOperationSettings(); - } - public static final TranslationServiceSettings create(TranslationServiceStubSettings stub) throws IOException { return new TranslationServiceSettings.Builder(stub.toBuilder()).build(); @@ -236,6 +236,20 @@ public Builder applyToAllUnaryMethods( return this; } + /** Returns the builder for the settings used for calls to deleteGlossary. */ + public UnaryCallSettings.Builder deleteGlossarySettings() { + return getStubSettingsBuilder().deleteGlossarySettings(); + } + + /** Returns the builder for the settings used for calls to deleteGlossary. */ + @BetaApi( + "The surface for long-running operations is not stable yet and may change in the future.") + public OperationCallSettings.Builder< + DeleteGlossaryRequest, DeleteGlossaryResponse, DeleteGlossaryMetadata> + deleteGlossaryOperationSettings() { + return getStubSettingsBuilder().deleteGlossaryOperationSettings(); + } + /** Returns the builder for the settings used for calls to translateText. */ public UnaryCallSettings.Builder translateTextSettings() { @@ -294,20 +308,6 @@ public UnaryCallSettings.Builder getGlossarySettin return getStubSettingsBuilder().getGlossarySettings(); } - /** Returns the builder for the settings used for calls to deleteGlossary. */ - public UnaryCallSettings.Builder deleteGlossarySettings() { - return getStubSettingsBuilder().deleteGlossarySettings(); - } - - /** Returns the builder for the settings used for calls to deleteGlossary. */ - @BetaApi( - "The surface for long-running operations is not stable yet and may change in the future.") - public OperationCallSettings.Builder< - DeleteGlossaryRequest, DeleteGlossaryResponse, DeleteGlossaryMetadata> - deleteGlossaryOperationSettings() { - return getStubSettingsBuilder().deleteGlossaryOperationSettings(); - } - @Override public TranslationServiceSettings build() throws IOException { return new TranslationServiceSettings(this); diff --git a/google-cloud-translate/src/main/java/com/google/cloud/translate/v3/stub/GrpcTranslationServiceStub.java b/google-cloud-translate/src/main/java/com/google/cloud/translate/v3/stub/GrpcTranslationServiceStub.java index edaaec17..01c52187 100644 --- a/google-cloud-translate/src/main/java/com/google/cloud/translate/v3/stub/GrpcTranslationServiceStub.java +++ b/google-cloud-translate/src/main/java/com/google/cloud/translate/v3/stub/GrpcTranslationServiceStub.java @@ -64,6 +64,15 @@ @BetaApi("A restructuring of stub classes is planned, so this may break in the future") public class GrpcTranslationServiceStub extends TranslationServiceStub { + private static final MethodDescriptor + deleteGlossaryMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.translation.v3.TranslationService/DeleteGlossary") + .setRequestMarshaller( + ProtoUtils.marshaller(DeleteGlossaryRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance())) + .build(); private static final MethodDescriptor translateTextMethodDescriptor = MethodDescriptor.newBuilder() @@ -130,19 +139,14 @@ public class GrpcTranslationServiceStub extends TranslationServiceStub { .setRequestMarshaller(ProtoUtils.marshaller(GetGlossaryRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(Glossary.getDefaultInstance())) .build(); - private static final MethodDescriptor - deleteGlossaryMethodDescriptor = - MethodDescriptor.newBuilder() - .setType(MethodDescriptor.MethodType.UNARY) - .setFullMethodName("google.cloud.translation.v3.TranslationService/DeleteGlossary") - .setRequestMarshaller( - ProtoUtils.marshaller(DeleteGlossaryRequest.getDefaultInstance())) - .setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance())) - .build(); private final BackgroundResource backgroundResources; private final GrpcOperationsStub operationsStub; + private final UnaryCallable deleteGlossaryCallable; + private final OperationCallable< + DeleteGlossaryRequest, DeleteGlossaryResponse, DeleteGlossaryMetadata> + deleteGlossaryOperationCallable; private final UnaryCallable translateTextCallable; private final UnaryCallable detectLanguageCallable; private final UnaryCallable @@ -158,10 +162,6 @@ public class GrpcTranslationServiceStub extends TranslationServiceStub { private final UnaryCallable listGlossariesPagedCallable; private final UnaryCallable getGlossaryCallable; - private final UnaryCallable deleteGlossaryCallable; - private final OperationCallable< - DeleteGlossaryRequest, DeleteGlossaryResponse, DeleteGlossaryMetadata> - deleteGlossaryOperationCallable; private final GrpcStubCallableFactory callableFactory; @@ -205,6 +205,19 @@ protected GrpcTranslationServiceStub( this.callableFactory = callableFactory; this.operationsStub = GrpcOperationsStub.create(clientContext, callableFactory); + GrpcCallSettings deleteGlossaryTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(deleteGlossaryMethodDescriptor) + .setParamsExtractor( + new RequestParamsExtractor() { + @Override + public Map extract(DeleteGlossaryRequest request) { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("name", String.valueOf(request.getName())); + return params.build(); + } + }) + .build(); GrpcCallSettings translateTextTransportSettings = GrpcCallSettings.newBuilder() .setMethodDescriptor(translateTextMethodDescriptor) @@ -299,20 +312,16 @@ public Map extract(GetGlossaryRequest request) { } }) .build(); - GrpcCallSettings deleteGlossaryTransportSettings = - GrpcCallSettings.newBuilder() - .setMethodDescriptor(deleteGlossaryMethodDescriptor) - .setParamsExtractor( - new RequestParamsExtractor() { - @Override - public Map extract(DeleteGlossaryRequest request) { - ImmutableMap.Builder params = ImmutableMap.builder(); - params.put("name", String.valueOf(request.getName())); - return params.build(); - } - }) - .build(); + this.deleteGlossaryCallable = + callableFactory.createUnaryCallable( + deleteGlossaryTransportSettings, settings.deleteGlossarySettings(), clientContext); + this.deleteGlossaryOperationCallable = + callableFactory.createOperationCallable( + deleteGlossaryTransportSettings, + settings.deleteGlossaryOperationSettings(), + clientContext, + this.operationsStub); this.translateTextCallable = callableFactory.createUnaryCallable( translateTextTransportSettings, settings.translateTextSettings(), clientContext); @@ -353,15 +362,6 @@ public Map extract(DeleteGlossaryRequest request) { this.getGlossaryCallable = callableFactory.createUnaryCallable( getGlossaryTransportSettings, settings.getGlossarySettings(), clientContext); - this.deleteGlossaryCallable = - callableFactory.createUnaryCallable( - deleteGlossaryTransportSettings, settings.deleteGlossarySettings(), clientContext); - this.deleteGlossaryOperationCallable = - callableFactory.createOperationCallable( - deleteGlossaryTransportSettings, - settings.deleteGlossaryOperationSettings(), - clientContext, - this.operationsStub); backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources()); } @@ -371,6 +371,16 @@ public GrpcOperationsStub getOperationsStub() { return operationsStub; } + @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") + public OperationCallable + deleteGlossaryOperationCallable() { + return deleteGlossaryOperationCallable; + } + + public UnaryCallable deleteGlossaryCallable() { + return deleteGlossaryCallable; + } + public UnaryCallable translateTextCallable() { return translateTextCallable; } @@ -418,16 +428,6 @@ public UnaryCallable getGlossaryCallable() { return getGlossaryCallable; } - @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") - public OperationCallable - deleteGlossaryOperationCallable() { - return deleteGlossaryOperationCallable; - } - - public UnaryCallable deleteGlossaryCallable() { - return deleteGlossaryCallable; - } - @Override public final void close() { shutdown(); diff --git a/google-cloud-translate/src/main/java/com/google/cloud/translate/v3/stub/TranslationServiceStub.java b/google-cloud-translate/src/main/java/com/google/cloud/translate/v3/stub/TranslationServiceStub.java index 89cb71fa..28059692 100644 --- a/google-cloud-translate/src/main/java/com/google/cloud/translate/v3/stub/TranslationServiceStub.java +++ b/google-cloud-translate/src/main/java/com/google/cloud/translate/v3/stub/TranslationServiceStub.java @@ -58,6 +58,16 @@ public OperationsStub getOperationsStub() { throw new UnsupportedOperationException("Not implemented: getOperationsStub()"); } + @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") + public OperationCallable + deleteGlossaryOperationCallable() { + throw new UnsupportedOperationException("Not implemented: deleteGlossaryOperationCallable()"); + } + + public UnaryCallable deleteGlossaryCallable() { + throw new UnsupportedOperationException("Not implemented: deleteGlossaryCallable()"); + } + public UnaryCallable translateTextCallable() { throw new UnsupportedOperationException("Not implemented: translateTextCallable()"); } @@ -106,16 +116,6 @@ public UnaryCallable getGlossaryCallable() { throw new UnsupportedOperationException("Not implemented: getGlossaryCallable()"); } - @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") - public OperationCallable - deleteGlossaryOperationCallable() { - throw new UnsupportedOperationException("Not implemented: deleteGlossaryOperationCallable()"); - } - - public UnaryCallable deleteGlossaryCallable() { - throw new UnsupportedOperationException("Not implemented: deleteGlossaryCallable()"); - } - @Override public abstract void close(); } diff --git a/google-cloud-translate/src/main/java/com/google/cloud/translate/v3/stub/TranslationServiceStubSettings.java b/google-cloud-translate/src/main/java/com/google/cloud/translate/v3/stub/TranslationServiceStubSettings.java index a65e015f..2ef72e5e 100644 --- a/google-cloud-translate/src/main/java/com/google/cloud/translate/v3/stub/TranslationServiceStubSettings.java +++ b/google-cloud-translate/src/main/java/com/google/cloud/translate/v3/stub/TranslationServiceStubSettings.java @@ -112,6 +112,10 @@ public class TranslationServiceStubSettings extends StubSettings deleteGlossarySettings; + private final OperationCallSettings< + DeleteGlossaryRequest, DeleteGlossaryResponse, DeleteGlossaryMetadata> + deleteGlossaryOperationSettings; private final UnaryCallSettings translateTextSettings; private final UnaryCallSettings @@ -129,10 +133,19 @@ public class TranslationServiceStubSettings extends StubSettings listGlossariesSettings; private final UnaryCallSettings getGlossarySettings; - private final UnaryCallSettings deleteGlossarySettings; - private final OperationCallSettings< + + /** Returns the object with the settings used for calls to deleteGlossary. */ + public UnaryCallSettings deleteGlossarySettings() { + return deleteGlossarySettings; + } + + /** Returns the object with the settings used for calls to deleteGlossary. */ + @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") + public OperationCallSettings< DeleteGlossaryRequest, DeleteGlossaryResponse, DeleteGlossaryMetadata> - deleteGlossaryOperationSettings; + deleteGlossaryOperationSettings() { + return deleteGlossaryOperationSettings; + } /** Returns the object with the settings used for calls to translateText. */ public UnaryCallSettings translateTextSettings() { @@ -187,19 +200,6 @@ public UnaryCallSettings getGlossarySettings() { return getGlossarySettings; } - /** Returns the object with the settings used for calls to deleteGlossary. */ - public UnaryCallSettings deleteGlossarySettings() { - return deleteGlossarySettings; - } - - /** Returns the object with the settings used for calls to deleteGlossary. */ - @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") - public OperationCallSettings< - DeleteGlossaryRequest, DeleteGlossaryResponse, DeleteGlossaryMetadata> - deleteGlossaryOperationSettings() { - return deleteGlossaryOperationSettings; - } - @BetaApi("A restructuring of stub classes is planned, so this may break in the future") public TranslationServiceStub createStub() throws IOException { if (getTransportChannelProvider() @@ -269,6 +269,8 @@ public Builder toBuilder() { protected TranslationServiceStubSettings(Builder settingsBuilder) throws IOException { super(settingsBuilder); + deleteGlossarySettings = settingsBuilder.deleteGlossarySettings().build(); + deleteGlossaryOperationSettings = settingsBuilder.deleteGlossaryOperationSettings().build(); translateTextSettings = settingsBuilder.translateTextSettings().build(); detectLanguageSettings = settingsBuilder.detectLanguageSettings().build(); getSupportedLanguagesSettings = settingsBuilder.getSupportedLanguagesSettings().build(); @@ -279,8 +281,6 @@ protected TranslationServiceStubSettings(Builder settingsBuilder) throws IOExcep createGlossaryOperationSettings = settingsBuilder.createGlossaryOperationSettings().build(); listGlossariesSettings = settingsBuilder.listGlossariesSettings().build(); getGlossarySettings = settingsBuilder.getGlossarySettings().build(); - deleteGlossarySettings = settingsBuilder.deleteGlossarySettings().build(); - deleteGlossaryOperationSettings = settingsBuilder.deleteGlossaryOperationSettings().build(); } private static final PagedListDescriptor @@ -342,6 +342,11 @@ public static class Builder extends StubSettings.Builder { private final ImmutableList> unaryMethodSettingsBuilders; + private final UnaryCallSettings.Builder + deleteGlossarySettings; + private final OperationCallSettings.Builder< + DeleteGlossaryRequest, DeleteGlossaryResponse, DeleteGlossaryMetadata> + deleteGlossaryOperationSettings; private final UnaryCallSettings.Builder translateTextSettings; private final UnaryCallSettings.Builder @@ -362,11 +367,6 @@ public static class Builder ListGlossariesRequest, ListGlossariesResponse, ListGlossariesPagedResponse> listGlossariesSettings; private final UnaryCallSettings.Builder getGlossarySettings; - private final UnaryCallSettings.Builder - deleteGlossarySettings; - private final OperationCallSettings.Builder< - DeleteGlossaryRequest, DeleteGlossaryResponse, DeleteGlossaryMetadata> - deleteGlossaryOperationSettings; private static final ImmutableMap> RETRYABLE_CODE_DEFINITIONS; @@ -409,6 +409,10 @@ protected Builder() { protected Builder(ClientContext clientContext) { super(clientContext); + deleteGlossarySettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + deleteGlossaryOperationSettings = OperationCallSettings.newBuilder(); + translateTextSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); detectLanguageSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); @@ -427,20 +431,16 @@ protected Builder(ClientContext clientContext) { getGlossarySettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); - deleteGlossarySettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); - - deleteGlossaryOperationSettings = OperationCallSettings.newBuilder(); - unaryMethodSettingsBuilders = ImmutableList.>of( + deleteGlossarySettings, translateTextSettings, detectLanguageSettings, getSupportedLanguagesSettings, batchTranslateTextSettings, createGlossarySettings, listGlossariesSettings, - getGlossarySettings, - deleteGlossarySettings); + getGlossarySettings); initDefaults(this); } @@ -456,6 +456,11 @@ private static Builder createDefault() { private static Builder initDefaults(Builder builder) { + builder + .deleteGlossarySettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + builder .translateTextSettings() .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) @@ -490,23 +495,18 @@ private static Builder initDefaults(Builder builder) { .getGlossarySettings() .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); - builder - .deleteGlossarySettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); - builder - .batchTranslateTextOperationSettings() + .deleteGlossaryOperationSettings() .setInitialCallSettings( UnaryCallSettings - .newUnaryCallSettingsBuilder() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) + .newUnaryCallSettingsBuilder() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")) .build()) .setResponseTransformer( - ProtoOperationTransformers.ResponseTransformer.create(BatchTranslateResponse.class)) + ProtoOperationTransformers.ResponseTransformer.create(DeleteGlossaryResponse.class)) .setMetadataTransformer( - ProtoOperationTransformers.MetadataTransformer.create(BatchTranslateMetadata.class)) + ProtoOperationTransformers.MetadataTransformer.create(DeleteGlossaryMetadata.class)) .setPollingAlgorithm( OperationTimedPollAlgorithm.create( RetrySettings.newBuilder() @@ -519,17 +519,17 @@ private static Builder initDefaults(Builder builder) { .setTotalTimeout(Duration.ofMillis(300000L)) .build())); builder - .createGlossaryOperationSettings() + .batchTranslateTextOperationSettings() .setInitialCallSettings( UnaryCallSettings - .newUnaryCallSettingsBuilder() + .newUnaryCallSettingsBuilder() .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")) .build()) .setResponseTransformer( - ProtoOperationTransformers.ResponseTransformer.create(Glossary.class)) + ProtoOperationTransformers.ResponseTransformer.create(BatchTranslateResponse.class)) .setMetadataTransformer( - ProtoOperationTransformers.MetadataTransformer.create(CreateGlossaryMetadata.class)) + ProtoOperationTransformers.MetadataTransformer.create(BatchTranslateMetadata.class)) .setPollingAlgorithm( OperationTimedPollAlgorithm.create( RetrySettings.newBuilder() @@ -542,17 +542,17 @@ private static Builder initDefaults(Builder builder) { .setTotalTimeout(Duration.ofMillis(300000L)) .build())); builder - .deleteGlossaryOperationSettings() + .createGlossaryOperationSettings() .setInitialCallSettings( UnaryCallSettings - .newUnaryCallSettingsBuilder() + .newUnaryCallSettingsBuilder() .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")) .build()) .setResponseTransformer( - ProtoOperationTransformers.ResponseTransformer.create(DeleteGlossaryResponse.class)) + ProtoOperationTransformers.ResponseTransformer.create(Glossary.class)) .setMetadataTransformer( - ProtoOperationTransformers.MetadataTransformer.create(DeleteGlossaryMetadata.class)) + ProtoOperationTransformers.MetadataTransformer.create(CreateGlossaryMetadata.class)) .setPollingAlgorithm( OperationTimedPollAlgorithm.create( RetrySettings.newBuilder() @@ -571,6 +571,8 @@ private static Builder initDefaults(Builder builder) { protected Builder(TranslationServiceStubSettings settings) { super(settings); + deleteGlossarySettings = settings.deleteGlossarySettings.toBuilder(); + deleteGlossaryOperationSettings = settings.deleteGlossaryOperationSettings.toBuilder(); translateTextSettings = settings.translateTextSettings.toBuilder(); detectLanguageSettings = settings.detectLanguageSettings.toBuilder(); getSupportedLanguagesSettings = settings.getSupportedLanguagesSettings.toBuilder(); @@ -581,19 +583,17 @@ protected Builder(TranslationServiceStubSettings settings) { createGlossaryOperationSettings = settings.createGlossaryOperationSettings.toBuilder(); listGlossariesSettings = settings.listGlossariesSettings.toBuilder(); getGlossarySettings = settings.getGlossarySettings.toBuilder(); - deleteGlossarySettings = settings.deleteGlossarySettings.toBuilder(); - deleteGlossaryOperationSettings = settings.deleteGlossaryOperationSettings.toBuilder(); unaryMethodSettingsBuilders = ImmutableList.>of( + deleteGlossarySettings, translateTextSettings, detectLanguageSettings, getSupportedLanguagesSettings, batchTranslateTextSettings, createGlossarySettings, listGlossariesSettings, - getGlossarySettings, - deleteGlossarySettings); + getGlossarySettings); } // NEXT_MAJOR_VER: remove 'throws Exception' @@ -612,6 +612,20 @@ public Builder applyToAllUnaryMethods( return unaryMethodSettingsBuilders; } + /** Returns the builder for the settings used for calls to deleteGlossary. */ + public UnaryCallSettings.Builder deleteGlossarySettings() { + return deleteGlossarySettings; + } + + /** Returns the builder for the settings used for calls to deleteGlossary. */ + @BetaApi( + "The surface for use by generated code is not stable yet and may change in the future.") + public OperationCallSettings.Builder< + DeleteGlossaryRequest, DeleteGlossaryResponse, DeleteGlossaryMetadata> + deleteGlossaryOperationSettings() { + return deleteGlossaryOperationSettings; + } + /** Returns the builder for the settings used for calls to translateText. */ public UnaryCallSettings.Builder translateTextSettings() { @@ -670,20 +684,6 @@ public UnaryCallSettings.Builder getGlossarySettin return getGlossarySettings; } - /** Returns the builder for the settings used for calls to deleteGlossary. */ - public UnaryCallSettings.Builder deleteGlossarySettings() { - return deleteGlossarySettings; - } - - /** Returns the builder for the settings used for calls to deleteGlossary. */ - @BetaApi( - "The surface for use by generated code is not stable yet and may change in the future.") - public OperationCallSettings.Builder< - DeleteGlossaryRequest, DeleteGlossaryResponse, DeleteGlossaryMetadata> - deleteGlossaryOperationSettings() { - return deleteGlossaryOperationSettings; - } - @Override public TranslationServiceStubSettings build() throws IOException { return new TranslationServiceStubSettings(this); diff --git a/google-cloud-translate/src/main/java/com/google/cloud/translate/v3beta1/TranslationServiceClient.java b/google-cloud-translate/src/main/java/com/google/cloud/translate/v3beta1/TranslationServiceClient.java index 55228221..921a9a86 100644 --- a/google-cloud-translate/src/main/java/com/google/cloud/translate/v3beta1/TranslationServiceClient.java +++ b/google-cloud-translate/src/main/java/com/google/cloud/translate/v3beta1/TranslationServiceClient.java @@ -173,6 +173,133 @@ public final OperationsClient getOperationsClient() { return operationsClient; } + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes a glossary, or cancels glossary construction if the glossary isn't created yet. Returns + * NOT_FOUND, if the glossary doesn't exist. + * + *

Sample code: + * + *


+   * try (TranslationServiceClient translationServiceClient = TranslationServiceClient.create()) {
+   *   GlossaryName name = GlossaryName.of("[PROJECT]", "[LOCATION]", "[GLOSSARY]");
+   *   DeleteGlossaryResponse response = translationServiceClient.deleteGlossaryAsync(name).get();
+   * }
+   * 
+ * + * @param name Required. The name of the glossary to delete. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi( + "The surface for long-running operations is not stable yet and may change in the future.") + public final OperationFuture deleteGlossaryAsync( + GlossaryName name) { + DeleteGlossaryRequest request = + DeleteGlossaryRequest.newBuilder().setName(name == null ? null : name.toString()).build(); + return deleteGlossaryAsync(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes a glossary, or cancels glossary construction if the glossary isn't created yet. Returns + * NOT_FOUND, if the glossary doesn't exist. + * + *

Sample code: + * + *


+   * try (TranslationServiceClient translationServiceClient = TranslationServiceClient.create()) {
+   *   GlossaryName name = GlossaryName.of("[PROJECT]", "[LOCATION]", "[GLOSSARY]");
+   *   DeleteGlossaryResponse response = translationServiceClient.deleteGlossaryAsync(name.toString()).get();
+   * }
+   * 
+ * + * @param name Required. The name of the glossary to delete. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi( + "The surface for long-running operations is not stable yet and may change in the future.") + public final OperationFuture deleteGlossaryAsync( + String name) { + DeleteGlossaryRequest request = DeleteGlossaryRequest.newBuilder().setName(name).build(); + return deleteGlossaryAsync(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes a glossary, or cancels glossary construction if the glossary isn't created yet. Returns + * NOT_FOUND, if the glossary doesn't exist. + * + *

Sample code: + * + *


+   * try (TranslationServiceClient translationServiceClient = TranslationServiceClient.create()) {
+   *   GlossaryName name = GlossaryName.of("[PROJECT]", "[LOCATION]", "[GLOSSARY]");
+   *   DeleteGlossaryRequest request = DeleteGlossaryRequest.newBuilder()
+   *     .setName(name.toString())
+   *     .build();
+   *   DeleteGlossaryResponse response = translationServiceClient.deleteGlossaryAsync(request).get();
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi( + "The surface for long-running operations is not stable yet and may change in the future.") + public final OperationFuture deleteGlossaryAsync( + DeleteGlossaryRequest request) { + return deleteGlossaryOperationCallable().futureCall(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes a glossary, or cancels glossary construction if the glossary isn't created yet. Returns + * NOT_FOUND, if the glossary doesn't exist. + * + *

Sample code: + * + *


+   * try (TranslationServiceClient translationServiceClient = TranslationServiceClient.create()) {
+   *   GlossaryName name = GlossaryName.of("[PROJECT]", "[LOCATION]", "[GLOSSARY]");
+   *   DeleteGlossaryRequest request = DeleteGlossaryRequest.newBuilder()
+   *     .setName(name.toString())
+   *     .build();
+   *   OperationFuture<DeleteGlossaryResponse, DeleteGlossaryMetadata> future = translationServiceClient.deleteGlossaryOperationCallable().futureCall(request);
+   *   // Do something
+   *   DeleteGlossaryResponse response = future.get();
+   * }
+   * 
+ */ + @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") + public final OperationCallable< + DeleteGlossaryRequest, DeleteGlossaryResponse, DeleteGlossaryMetadata> + deleteGlossaryOperationCallable() { + return stub.deleteGlossaryOperationCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes a glossary, or cancels glossary construction if the glossary isn't created yet. Returns + * NOT_FOUND, if the glossary doesn't exist. + * + *

Sample code: + * + *


+   * try (TranslationServiceClient translationServiceClient = TranslationServiceClient.create()) {
+   *   GlossaryName name = GlossaryName.of("[PROJECT]", "[LOCATION]", "[GLOSSARY]");
+   *   DeleteGlossaryRequest request = DeleteGlossaryRequest.newBuilder()
+   *     .setName(name.toString())
+   *     .build();
+   *   ApiFuture<Operation> future = translationServiceClient.deleteGlossaryCallable().futureCall(request);
+   *   // Do something
+   *   Operation response = future.get();
+   * }
+   * 
+ */ + public final UnaryCallable deleteGlossaryCallable() { + return stub.deleteGlossaryCallable(); + } + // AUTO-GENERATED DOCUMENTATION AND METHOD /** * Translates input text and returns translated text. @@ -1025,133 +1152,6 @@ public final UnaryCallable getGlossaryCallable() { return stub.getGlossaryCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD - /** - * Deletes a glossary, or cancels glossary construction if the glossary isn't created yet. Returns - * NOT_FOUND, if the glossary doesn't exist. - * - *

Sample code: - * - *


-   * try (TranslationServiceClient translationServiceClient = TranslationServiceClient.create()) {
-   *   GlossaryName name = GlossaryName.of("[PROJECT]", "[LOCATION]", "[GLOSSARY]");
-   *   DeleteGlossaryResponse response = translationServiceClient.deleteGlossaryAsync(name).get();
-   * }
-   * 
- * - * @param name Required. The name of the glossary to delete. - * @throws com.google.api.gax.rpc.ApiException if the remote call fails - */ - @BetaApi( - "The surface for long-running operations is not stable yet and may change in the future.") - public final OperationFuture deleteGlossaryAsync( - GlossaryName name) { - DeleteGlossaryRequest request = - DeleteGlossaryRequest.newBuilder().setName(name == null ? null : name.toString()).build(); - return deleteGlossaryAsync(request); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD - /** - * Deletes a glossary, or cancels glossary construction if the glossary isn't created yet. Returns - * NOT_FOUND, if the glossary doesn't exist. - * - *

Sample code: - * - *


-   * try (TranslationServiceClient translationServiceClient = TranslationServiceClient.create()) {
-   *   GlossaryName name = GlossaryName.of("[PROJECT]", "[LOCATION]", "[GLOSSARY]");
-   *   DeleteGlossaryResponse response = translationServiceClient.deleteGlossaryAsync(name.toString()).get();
-   * }
-   * 
- * - * @param name Required. The name of the glossary to delete. - * @throws com.google.api.gax.rpc.ApiException if the remote call fails - */ - @BetaApi( - "The surface for long-running operations is not stable yet and may change in the future.") - public final OperationFuture deleteGlossaryAsync( - String name) { - DeleteGlossaryRequest request = DeleteGlossaryRequest.newBuilder().setName(name).build(); - return deleteGlossaryAsync(request); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD - /** - * Deletes a glossary, or cancels glossary construction if the glossary isn't created yet. Returns - * NOT_FOUND, if the glossary doesn't exist. - * - *

Sample code: - * - *


-   * try (TranslationServiceClient translationServiceClient = TranslationServiceClient.create()) {
-   *   GlossaryName name = GlossaryName.of("[PROJECT]", "[LOCATION]", "[GLOSSARY]");
-   *   DeleteGlossaryRequest request = DeleteGlossaryRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .build();
-   *   DeleteGlossaryResponse response = translationServiceClient.deleteGlossaryAsync(request).get();
-   * }
-   * 
- * - * @param request The request object containing all of the parameters for the API call. - * @throws com.google.api.gax.rpc.ApiException if the remote call fails - */ - @BetaApi( - "The surface for long-running operations is not stable yet and may change in the future.") - public final OperationFuture deleteGlossaryAsync( - DeleteGlossaryRequest request) { - return deleteGlossaryOperationCallable().futureCall(request); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD - /** - * Deletes a glossary, or cancels glossary construction if the glossary isn't created yet. Returns - * NOT_FOUND, if the glossary doesn't exist. - * - *

Sample code: - * - *


-   * try (TranslationServiceClient translationServiceClient = TranslationServiceClient.create()) {
-   *   GlossaryName name = GlossaryName.of("[PROJECT]", "[LOCATION]", "[GLOSSARY]");
-   *   DeleteGlossaryRequest request = DeleteGlossaryRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .build();
-   *   OperationFuture<DeleteGlossaryResponse, DeleteGlossaryMetadata> future = translationServiceClient.deleteGlossaryOperationCallable().futureCall(request);
-   *   // Do something
-   *   DeleteGlossaryResponse response = future.get();
-   * }
-   * 
- */ - @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") - public final OperationCallable< - DeleteGlossaryRequest, DeleteGlossaryResponse, DeleteGlossaryMetadata> - deleteGlossaryOperationCallable() { - return stub.deleteGlossaryOperationCallable(); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD - /** - * Deletes a glossary, or cancels glossary construction if the glossary isn't created yet. Returns - * NOT_FOUND, if the glossary doesn't exist. - * - *

Sample code: - * - *


-   * try (TranslationServiceClient translationServiceClient = TranslationServiceClient.create()) {
-   *   GlossaryName name = GlossaryName.of("[PROJECT]", "[LOCATION]", "[GLOSSARY]");
-   *   DeleteGlossaryRequest request = DeleteGlossaryRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .build();
-   *   ApiFuture<Operation> future = translationServiceClient.deleteGlossaryCallable().futureCall(request);
-   *   // Do something
-   *   Operation response = future.get();
-   * }
-   * 
- */ - public final UnaryCallable deleteGlossaryCallable() { - return stub.deleteGlossaryCallable(); - } - @Override public final void close() { stub.close(); diff --git a/google-cloud-translate/src/main/java/com/google/cloud/translate/v3beta1/TranslationServiceSettings.java b/google-cloud-translate/src/main/java/com/google/cloud/translate/v3beta1/TranslationServiceSettings.java index fb2947e8..19927740 100644 --- a/google-cloud-translate/src/main/java/com/google/cloud/translate/v3beta1/TranslationServiceSettings.java +++ b/google-cloud-translate/src/main/java/com/google/cloud/translate/v3beta1/TranslationServiceSettings.java @@ -69,6 +69,20 @@ @Generated("by gapic-generator") @BetaApi public class TranslationServiceSettings extends ClientSettings { + /** Returns the object with the settings used for calls to deleteGlossary. */ + public UnaryCallSettings deleteGlossarySettings() { + return ((TranslationServiceStubSettings) getStubSettings()).deleteGlossarySettings(); + } + + /** Returns the object with the settings used for calls to deleteGlossary. */ + @BetaApi( + "The surface for long-running operations is not stable yet and may change in the future.") + public OperationCallSettings< + DeleteGlossaryRequest, DeleteGlossaryResponse, DeleteGlossaryMetadata> + deleteGlossaryOperationSettings() { + return ((TranslationServiceStubSettings) getStubSettings()).deleteGlossaryOperationSettings(); + } + /** Returns the object with the settings used for calls to translateText. */ public UnaryCallSettings translateTextSettings() { return ((TranslationServiceStubSettings) getStubSettings()).translateTextSettings(); @@ -125,20 +139,6 @@ public UnaryCallSettings getGlossarySettings() { return ((TranslationServiceStubSettings) getStubSettings()).getGlossarySettings(); } - /** Returns the object with the settings used for calls to deleteGlossary. */ - public UnaryCallSettings deleteGlossarySettings() { - return ((TranslationServiceStubSettings) getStubSettings()).deleteGlossarySettings(); - } - - /** Returns the object with the settings used for calls to deleteGlossary. */ - @BetaApi( - "The surface for long-running operations is not stable yet and may change in the future.") - public OperationCallSettings< - DeleteGlossaryRequest, DeleteGlossaryResponse, DeleteGlossaryMetadata> - deleteGlossaryOperationSettings() { - return ((TranslationServiceStubSettings) getStubSettings()).deleteGlossaryOperationSettings(); - } - public static final TranslationServiceSettings create(TranslationServiceStubSettings stub) throws IOException { return new TranslationServiceSettings.Builder(stub.toBuilder()).build(); @@ -236,6 +236,20 @@ public Builder applyToAllUnaryMethods( return this; } + /** Returns the builder for the settings used for calls to deleteGlossary. */ + public UnaryCallSettings.Builder deleteGlossarySettings() { + return getStubSettingsBuilder().deleteGlossarySettings(); + } + + /** Returns the builder for the settings used for calls to deleteGlossary. */ + @BetaApi( + "The surface for long-running operations is not stable yet and may change in the future.") + public OperationCallSettings.Builder< + DeleteGlossaryRequest, DeleteGlossaryResponse, DeleteGlossaryMetadata> + deleteGlossaryOperationSettings() { + return getStubSettingsBuilder().deleteGlossaryOperationSettings(); + } + /** Returns the builder for the settings used for calls to translateText. */ public UnaryCallSettings.Builder translateTextSettings() { @@ -294,20 +308,6 @@ public UnaryCallSettings.Builder getGlossarySettin return getStubSettingsBuilder().getGlossarySettings(); } - /** Returns the builder for the settings used for calls to deleteGlossary. */ - public UnaryCallSettings.Builder deleteGlossarySettings() { - return getStubSettingsBuilder().deleteGlossarySettings(); - } - - /** Returns the builder for the settings used for calls to deleteGlossary. */ - @BetaApi( - "The surface for long-running operations is not stable yet and may change in the future.") - public OperationCallSettings.Builder< - DeleteGlossaryRequest, DeleteGlossaryResponse, DeleteGlossaryMetadata> - deleteGlossaryOperationSettings() { - return getStubSettingsBuilder().deleteGlossaryOperationSettings(); - } - @Override public TranslationServiceSettings build() throws IOException { return new TranslationServiceSettings(this); diff --git a/google-cloud-translate/src/main/java/com/google/cloud/translate/v3beta1/stub/GrpcTranslationServiceStub.java b/google-cloud-translate/src/main/java/com/google/cloud/translate/v3beta1/stub/GrpcTranslationServiceStub.java index bdc638af..bd64c88c 100644 --- a/google-cloud-translate/src/main/java/com/google/cloud/translate/v3beta1/stub/GrpcTranslationServiceStub.java +++ b/google-cloud-translate/src/main/java/com/google/cloud/translate/v3beta1/stub/GrpcTranslationServiceStub.java @@ -64,6 +64,16 @@ @BetaApi("A restructuring of stub classes is planned, so this may break in the future") public class GrpcTranslationServiceStub extends TranslationServiceStub { + private static final MethodDescriptor + deleteGlossaryMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName( + "google.cloud.translation.v3beta1.TranslationService/DeleteGlossary") + .setRequestMarshaller( + ProtoUtils.marshaller(DeleteGlossaryRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance())) + .build(); private static final MethodDescriptor translateTextMethodDescriptor = MethodDescriptor.newBuilder() @@ -134,20 +144,14 @@ public class GrpcTranslationServiceStub extends TranslationServiceStub { .setRequestMarshaller(ProtoUtils.marshaller(GetGlossaryRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(Glossary.getDefaultInstance())) .build(); - private static final MethodDescriptor - deleteGlossaryMethodDescriptor = - MethodDescriptor.newBuilder() - .setType(MethodDescriptor.MethodType.UNARY) - .setFullMethodName( - "google.cloud.translation.v3beta1.TranslationService/DeleteGlossary") - .setRequestMarshaller( - ProtoUtils.marshaller(DeleteGlossaryRequest.getDefaultInstance())) - .setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance())) - .build(); private final BackgroundResource backgroundResources; private final GrpcOperationsStub operationsStub; + private final UnaryCallable deleteGlossaryCallable; + private final OperationCallable< + DeleteGlossaryRequest, DeleteGlossaryResponse, DeleteGlossaryMetadata> + deleteGlossaryOperationCallable; private final UnaryCallable translateTextCallable; private final UnaryCallable detectLanguageCallable; private final UnaryCallable @@ -163,10 +167,6 @@ public class GrpcTranslationServiceStub extends TranslationServiceStub { private final UnaryCallable listGlossariesPagedCallable; private final UnaryCallable getGlossaryCallable; - private final UnaryCallable deleteGlossaryCallable; - private final OperationCallable< - DeleteGlossaryRequest, DeleteGlossaryResponse, DeleteGlossaryMetadata> - deleteGlossaryOperationCallable; private final GrpcStubCallableFactory callableFactory; @@ -210,6 +210,19 @@ protected GrpcTranslationServiceStub( this.callableFactory = callableFactory; this.operationsStub = GrpcOperationsStub.create(clientContext, callableFactory); + GrpcCallSettings deleteGlossaryTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(deleteGlossaryMethodDescriptor) + .setParamsExtractor( + new RequestParamsExtractor() { + @Override + public Map extract(DeleteGlossaryRequest request) { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("name", String.valueOf(request.getName())); + return params.build(); + } + }) + .build(); GrpcCallSettings translateTextTransportSettings = GrpcCallSettings.newBuilder() .setMethodDescriptor(translateTextMethodDescriptor) @@ -304,20 +317,16 @@ public Map extract(GetGlossaryRequest request) { } }) .build(); - GrpcCallSettings deleteGlossaryTransportSettings = - GrpcCallSettings.newBuilder() - .setMethodDescriptor(deleteGlossaryMethodDescriptor) - .setParamsExtractor( - new RequestParamsExtractor() { - @Override - public Map extract(DeleteGlossaryRequest request) { - ImmutableMap.Builder params = ImmutableMap.builder(); - params.put("name", String.valueOf(request.getName())); - return params.build(); - } - }) - .build(); + this.deleteGlossaryCallable = + callableFactory.createUnaryCallable( + deleteGlossaryTransportSettings, settings.deleteGlossarySettings(), clientContext); + this.deleteGlossaryOperationCallable = + callableFactory.createOperationCallable( + deleteGlossaryTransportSettings, + settings.deleteGlossaryOperationSettings(), + clientContext, + this.operationsStub); this.translateTextCallable = callableFactory.createUnaryCallable( translateTextTransportSettings, settings.translateTextSettings(), clientContext); @@ -358,15 +367,6 @@ public Map extract(DeleteGlossaryRequest request) { this.getGlossaryCallable = callableFactory.createUnaryCallable( getGlossaryTransportSettings, settings.getGlossarySettings(), clientContext); - this.deleteGlossaryCallable = - callableFactory.createUnaryCallable( - deleteGlossaryTransportSettings, settings.deleteGlossarySettings(), clientContext); - this.deleteGlossaryOperationCallable = - callableFactory.createOperationCallable( - deleteGlossaryTransportSettings, - settings.deleteGlossaryOperationSettings(), - clientContext, - this.operationsStub); backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources()); } @@ -376,6 +376,16 @@ public GrpcOperationsStub getOperationsStub() { return operationsStub; } + @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") + public OperationCallable + deleteGlossaryOperationCallable() { + return deleteGlossaryOperationCallable; + } + + public UnaryCallable deleteGlossaryCallable() { + return deleteGlossaryCallable; + } + public UnaryCallable translateTextCallable() { return translateTextCallable; } @@ -423,16 +433,6 @@ public UnaryCallable getGlossaryCallable() { return getGlossaryCallable; } - @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") - public OperationCallable - deleteGlossaryOperationCallable() { - return deleteGlossaryOperationCallable; - } - - public UnaryCallable deleteGlossaryCallable() { - return deleteGlossaryCallable; - } - @Override public final void close() { shutdown(); diff --git a/google-cloud-translate/src/main/java/com/google/cloud/translate/v3beta1/stub/TranslationServiceStub.java b/google-cloud-translate/src/main/java/com/google/cloud/translate/v3beta1/stub/TranslationServiceStub.java index 26f79d43..f07e832e 100644 --- a/google-cloud-translate/src/main/java/com/google/cloud/translate/v3beta1/stub/TranslationServiceStub.java +++ b/google-cloud-translate/src/main/java/com/google/cloud/translate/v3beta1/stub/TranslationServiceStub.java @@ -58,6 +58,16 @@ public OperationsStub getOperationsStub() { throw new UnsupportedOperationException("Not implemented: getOperationsStub()"); } + @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") + public OperationCallable + deleteGlossaryOperationCallable() { + throw new UnsupportedOperationException("Not implemented: deleteGlossaryOperationCallable()"); + } + + public UnaryCallable deleteGlossaryCallable() { + throw new UnsupportedOperationException("Not implemented: deleteGlossaryCallable()"); + } + public UnaryCallable translateTextCallable() { throw new UnsupportedOperationException("Not implemented: translateTextCallable()"); } @@ -106,16 +116,6 @@ public UnaryCallable getGlossaryCallable() { throw new UnsupportedOperationException("Not implemented: getGlossaryCallable()"); } - @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") - public OperationCallable - deleteGlossaryOperationCallable() { - throw new UnsupportedOperationException("Not implemented: deleteGlossaryOperationCallable()"); - } - - public UnaryCallable deleteGlossaryCallable() { - throw new UnsupportedOperationException("Not implemented: deleteGlossaryCallable()"); - } - @Override public abstract void close(); } diff --git a/google-cloud-translate/src/main/java/com/google/cloud/translate/v3beta1/stub/TranslationServiceStubSettings.java b/google-cloud-translate/src/main/java/com/google/cloud/translate/v3beta1/stub/TranslationServiceStubSettings.java index 8e130491..83e31029 100644 --- a/google-cloud-translate/src/main/java/com/google/cloud/translate/v3beta1/stub/TranslationServiceStubSettings.java +++ b/google-cloud-translate/src/main/java/com/google/cloud/translate/v3beta1/stub/TranslationServiceStubSettings.java @@ -112,6 +112,10 @@ public class TranslationServiceStubSettings extends StubSettings deleteGlossarySettings; + private final OperationCallSettings< + DeleteGlossaryRequest, DeleteGlossaryResponse, DeleteGlossaryMetadata> + deleteGlossaryOperationSettings; private final UnaryCallSettings translateTextSettings; private final UnaryCallSettings @@ -129,10 +133,19 @@ public class TranslationServiceStubSettings extends StubSettings listGlossariesSettings; private final UnaryCallSettings getGlossarySettings; - private final UnaryCallSettings deleteGlossarySettings; - private final OperationCallSettings< + + /** Returns the object with the settings used for calls to deleteGlossary. */ + public UnaryCallSettings deleteGlossarySettings() { + return deleteGlossarySettings; + } + + /** Returns the object with the settings used for calls to deleteGlossary. */ + @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") + public OperationCallSettings< DeleteGlossaryRequest, DeleteGlossaryResponse, DeleteGlossaryMetadata> - deleteGlossaryOperationSettings; + deleteGlossaryOperationSettings() { + return deleteGlossaryOperationSettings; + } /** Returns the object with the settings used for calls to translateText. */ public UnaryCallSettings translateTextSettings() { @@ -187,19 +200,6 @@ public UnaryCallSettings getGlossarySettings() { return getGlossarySettings; } - /** Returns the object with the settings used for calls to deleteGlossary. */ - public UnaryCallSettings deleteGlossarySettings() { - return deleteGlossarySettings; - } - - /** Returns the object with the settings used for calls to deleteGlossary. */ - @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") - public OperationCallSettings< - DeleteGlossaryRequest, DeleteGlossaryResponse, DeleteGlossaryMetadata> - deleteGlossaryOperationSettings() { - return deleteGlossaryOperationSettings; - } - @BetaApi("A restructuring of stub classes is planned, so this may break in the future") public TranslationServiceStub createStub() throws IOException { if (getTransportChannelProvider() @@ -269,6 +269,8 @@ public Builder toBuilder() { protected TranslationServiceStubSettings(Builder settingsBuilder) throws IOException { super(settingsBuilder); + deleteGlossarySettings = settingsBuilder.deleteGlossarySettings().build(); + deleteGlossaryOperationSettings = settingsBuilder.deleteGlossaryOperationSettings().build(); translateTextSettings = settingsBuilder.translateTextSettings().build(); detectLanguageSettings = settingsBuilder.detectLanguageSettings().build(); getSupportedLanguagesSettings = settingsBuilder.getSupportedLanguagesSettings().build(); @@ -279,8 +281,6 @@ protected TranslationServiceStubSettings(Builder settingsBuilder) throws IOExcep createGlossaryOperationSettings = settingsBuilder.createGlossaryOperationSettings().build(); listGlossariesSettings = settingsBuilder.listGlossariesSettings().build(); getGlossarySettings = settingsBuilder.getGlossarySettings().build(); - deleteGlossarySettings = settingsBuilder.deleteGlossarySettings().build(); - deleteGlossaryOperationSettings = settingsBuilder.deleteGlossaryOperationSettings().build(); } private static final PagedListDescriptor @@ -342,6 +342,11 @@ public static class Builder extends StubSettings.Builder { private final ImmutableList> unaryMethodSettingsBuilders; + private final UnaryCallSettings.Builder + deleteGlossarySettings; + private final OperationCallSettings.Builder< + DeleteGlossaryRequest, DeleteGlossaryResponse, DeleteGlossaryMetadata> + deleteGlossaryOperationSettings; private final UnaryCallSettings.Builder translateTextSettings; private final UnaryCallSettings.Builder @@ -362,11 +367,6 @@ public static class Builder ListGlossariesRequest, ListGlossariesResponse, ListGlossariesPagedResponse> listGlossariesSettings; private final UnaryCallSettings.Builder getGlossarySettings; - private final UnaryCallSettings.Builder - deleteGlossarySettings; - private final OperationCallSettings.Builder< - DeleteGlossaryRequest, DeleteGlossaryResponse, DeleteGlossaryMetadata> - deleteGlossaryOperationSettings; private static final ImmutableMap> RETRYABLE_CODE_DEFINITIONS; @@ -409,6 +409,10 @@ protected Builder() { protected Builder(ClientContext clientContext) { super(clientContext); + deleteGlossarySettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + deleteGlossaryOperationSettings = OperationCallSettings.newBuilder(); + translateTextSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); detectLanguageSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); @@ -427,20 +431,16 @@ protected Builder(ClientContext clientContext) { getGlossarySettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); - deleteGlossarySettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); - - deleteGlossaryOperationSettings = OperationCallSettings.newBuilder(); - unaryMethodSettingsBuilders = ImmutableList.>of( + deleteGlossarySettings, translateTextSettings, detectLanguageSettings, getSupportedLanguagesSettings, batchTranslateTextSettings, createGlossarySettings, listGlossariesSettings, - getGlossarySettings, - deleteGlossarySettings); + getGlossarySettings); initDefaults(this); } @@ -456,6 +456,11 @@ private static Builder createDefault() { private static Builder initDefaults(Builder builder) { + builder + .deleteGlossarySettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + builder .translateTextSettings() .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) @@ -490,23 +495,18 @@ private static Builder initDefaults(Builder builder) { .getGlossarySettings() .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); - builder - .deleteGlossarySettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); - builder - .batchTranslateTextOperationSettings() + .deleteGlossaryOperationSettings() .setInitialCallSettings( UnaryCallSettings - .newUnaryCallSettingsBuilder() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) + .newUnaryCallSettingsBuilder() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")) .build()) .setResponseTransformer( - ProtoOperationTransformers.ResponseTransformer.create(BatchTranslateResponse.class)) + ProtoOperationTransformers.ResponseTransformer.create(DeleteGlossaryResponse.class)) .setMetadataTransformer( - ProtoOperationTransformers.MetadataTransformer.create(BatchTranslateMetadata.class)) + ProtoOperationTransformers.MetadataTransformer.create(DeleteGlossaryMetadata.class)) .setPollingAlgorithm( OperationTimedPollAlgorithm.create( RetrySettings.newBuilder() @@ -519,17 +519,17 @@ private static Builder initDefaults(Builder builder) { .setTotalTimeout(Duration.ofMillis(300000L)) .build())); builder - .createGlossaryOperationSettings() + .batchTranslateTextOperationSettings() .setInitialCallSettings( UnaryCallSettings - .newUnaryCallSettingsBuilder() + .newUnaryCallSettingsBuilder() .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")) .build()) .setResponseTransformer( - ProtoOperationTransformers.ResponseTransformer.create(Glossary.class)) + ProtoOperationTransformers.ResponseTransformer.create(BatchTranslateResponse.class)) .setMetadataTransformer( - ProtoOperationTransformers.MetadataTransformer.create(CreateGlossaryMetadata.class)) + ProtoOperationTransformers.MetadataTransformer.create(BatchTranslateMetadata.class)) .setPollingAlgorithm( OperationTimedPollAlgorithm.create( RetrySettings.newBuilder() @@ -542,17 +542,17 @@ private static Builder initDefaults(Builder builder) { .setTotalTimeout(Duration.ofMillis(300000L)) .build())); builder - .deleteGlossaryOperationSettings() + .createGlossaryOperationSettings() .setInitialCallSettings( UnaryCallSettings - .newUnaryCallSettingsBuilder() + .newUnaryCallSettingsBuilder() .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")) .build()) .setResponseTransformer( - ProtoOperationTransformers.ResponseTransformer.create(DeleteGlossaryResponse.class)) + ProtoOperationTransformers.ResponseTransformer.create(Glossary.class)) .setMetadataTransformer( - ProtoOperationTransformers.MetadataTransformer.create(DeleteGlossaryMetadata.class)) + ProtoOperationTransformers.MetadataTransformer.create(CreateGlossaryMetadata.class)) .setPollingAlgorithm( OperationTimedPollAlgorithm.create( RetrySettings.newBuilder() @@ -571,6 +571,8 @@ private static Builder initDefaults(Builder builder) { protected Builder(TranslationServiceStubSettings settings) { super(settings); + deleteGlossarySettings = settings.deleteGlossarySettings.toBuilder(); + deleteGlossaryOperationSettings = settings.deleteGlossaryOperationSettings.toBuilder(); translateTextSettings = settings.translateTextSettings.toBuilder(); detectLanguageSettings = settings.detectLanguageSettings.toBuilder(); getSupportedLanguagesSettings = settings.getSupportedLanguagesSettings.toBuilder(); @@ -581,19 +583,17 @@ protected Builder(TranslationServiceStubSettings settings) { createGlossaryOperationSettings = settings.createGlossaryOperationSettings.toBuilder(); listGlossariesSettings = settings.listGlossariesSettings.toBuilder(); getGlossarySettings = settings.getGlossarySettings.toBuilder(); - deleteGlossarySettings = settings.deleteGlossarySettings.toBuilder(); - deleteGlossaryOperationSettings = settings.deleteGlossaryOperationSettings.toBuilder(); unaryMethodSettingsBuilders = ImmutableList.>of( + deleteGlossarySettings, translateTextSettings, detectLanguageSettings, getSupportedLanguagesSettings, batchTranslateTextSettings, createGlossarySettings, listGlossariesSettings, - getGlossarySettings, - deleteGlossarySettings); + getGlossarySettings); } // NEXT_MAJOR_VER: remove 'throws Exception' @@ -612,6 +612,20 @@ public Builder applyToAllUnaryMethods( return unaryMethodSettingsBuilders; } + /** Returns the builder for the settings used for calls to deleteGlossary. */ + public UnaryCallSettings.Builder deleteGlossarySettings() { + return deleteGlossarySettings; + } + + /** Returns the builder for the settings used for calls to deleteGlossary. */ + @BetaApi( + "The surface for use by generated code is not stable yet and may change in the future.") + public OperationCallSettings.Builder< + DeleteGlossaryRequest, DeleteGlossaryResponse, DeleteGlossaryMetadata> + deleteGlossaryOperationSettings() { + return deleteGlossaryOperationSettings; + } + /** Returns the builder for the settings used for calls to translateText. */ public UnaryCallSettings.Builder translateTextSettings() { @@ -670,20 +684,6 @@ public UnaryCallSettings.Builder getGlossarySettin return getGlossarySettings; } - /** Returns the builder for the settings used for calls to deleteGlossary. */ - public UnaryCallSettings.Builder deleteGlossarySettings() { - return deleteGlossarySettings; - } - - /** Returns the builder for the settings used for calls to deleteGlossary. */ - @BetaApi( - "The surface for use by generated code is not stable yet and may change in the future.") - public OperationCallSettings.Builder< - DeleteGlossaryRequest, DeleteGlossaryResponse, DeleteGlossaryMetadata> - deleteGlossaryOperationSettings() { - return deleteGlossaryOperationSettings; - } - @Override public TranslationServiceStubSettings build() throws IOException { return new TranslationServiceStubSettings(this); diff --git a/google-cloud-translate/src/test/java/com/google/cloud/translate/v3/TranslationServiceClientTest.java b/google-cloud-translate/src/test/java/com/google/cloud/translate/v3/TranslationServiceClientTest.java index 09d4aef2..d4798fc2 100644 --- a/google-cloud-translate/src/test/java/com/google/cloud/translate/v3/TranslationServiceClientTest.java +++ b/google-cloud-translate/src/test/java/com/google/cloud/translate/v3/TranslationServiceClientTest.java @@ -82,6 +82,54 @@ public void tearDown() throws Exception { client.close(); } + @Test + @SuppressWarnings("all") + public void deleteGlossaryTest() throws Exception { + String name2 = "name2-1052831874"; + DeleteGlossaryResponse expectedResponse = + DeleteGlossaryResponse.newBuilder().setName(name2).build(); + Operation resultOperation = + Operation.newBuilder() + .setName("deleteGlossaryTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockTranslationService.addResponse(resultOperation); + + GlossaryName name = GlossaryName.of("[PROJECT]", "[LOCATION]", "[GLOSSARY]"); + + DeleteGlossaryResponse actualResponse = client.deleteGlossaryAsync(name).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockTranslationService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + DeleteGlossaryRequest actualRequest = (DeleteGlossaryRequest) actualRequests.get(0); + + Assert.assertEquals(name, GlossaryName.parse(actualRequest.getName())); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + @SuppressWarnings("all") + public void deleteGlossaryExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + mockTranslationService.addException(exception); + + try { + GlossaryName name = GlossaryName.of("[PROJECT]", "[LOCATION]", "[GLOSSARY]"); + + client.deleteGlossaryAsync(name).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + Assert.assertEquals(InvalidArgumentException.class, e.getCause().getClass()); + InvalidArgumentException apiException = (InvalidArgumentException) e.getCause(); + Assert.assertEquals(StatusCode.Code.INVALID_ARGUMENT, apiException.getStatusCode().getCode()); + } + } + @Test @SuppressWarnings("all") public void translateTextTest() { @@ -498,52 +546,4 @@ public void getGlossaryExceptionTest() throws Exception { // Expected exception } } - - @Test - @SuppressWarnings("all") - public void deleteGlossaryTest() throws Exception { - String name2 = "name2-1052831874"; - DeleteGlossaryResponse expectedResponse = - DeleteGlossaryResponse.newBuilder().setName(name2).build(); - Operation resultOperation = - Operation.newBuilder() - .setName("deleteGlossaryTest") - .setDone(true) - .setResponse(Any.pack(expectedResponse)) - .build(); - mockTranslationService.addResponse(resultOperation); - - GlossaryName name = GlossaryName.of("[PROJECT]", "[LOCATION]", "[GLOSSARY]"); - - DeleteGlossaryResponse actualResponse = client.deleteGlossaryAsync(name).get(); - Assert.assertEquals(expectedResponse, actualResponse); - - List actualRequests = mockTranslationService.getRequests(); - Assert.assertEquals(1, actualRequests.size()); - DeleteGlossaryRequest actualRequest = (DeleteGlossaryRequest) actualRequests.get(0); - - Assert.assertEquals(name, GlossaryName.parse(actualRequest.getName())); - Assert.assertTrue( - channelProvider.isHeaderSent( - ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), - GaxGrpcProperties.getDefaultApiClientHeaderPattern())); - } - - @Test - @SuppressWarnings("all") - public void deleteGlossaryExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); - mockTranslationService.addException(exception); - - try { - GlossaryName name = GlossaryName.of("[PROJECT]", "[LOCATION]", "[GLOSSARY]"); - - client.deleteGlossaryAsync(name).get(); - Assert.fail("No exception raised"); - } catch (ExecutionException e) { - Assert.assertEquals(InvalidArgumentException.class, e.getCause().getClass()); - InvalidArgumentException apiException = (InvalidArgumentException) e.getCause(); - Assert.assertEquals(StatusCode.Code.INVALID_ARGUMENT, apiException.getStatusCode().getCode()); - } - } } diff --git a/google-cloud-translate/src/test/java/com/google/cloud/translate/v3beta1/TranslationServiceClientTest.java b/google-cloud-translate/src/test/java/com/google/cloud/translate/v3beta1/TranslationServiceClientTest.java index e372619b..7a886cdf 100644 --- a/google-cloud-translate/src/test/java/com/google/cloud/translate/v3beta1/TranslationServiceClientTest.java +++ b/google-cloud-translate/src/test/java/com/google/cloud/translate/v3beta1/TranslationServiceClientTest.java @@ -82,6 +82,54 @@ public void tearDown() throws Exception { client.close(); } + @Test + @SuppressWarnings("all") + public void deleteGlossaryTest() throws Exception { + String name2 = "name2-1052831874"; + DeleteGlossaryResponse expectedResponse = + DeleteGlossaryResponse.newBuilder().setName(name2).build(); + Operation resultOperation = + Operation.newBuilder() + .setName("deleteGlossaryTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockTranslationService.addResponse(resultOperation); + + GlossaryName name = GlossaryName.of("[PROJECT]", "[LOCATION]", "[GLOSSARY]"); + + DeleteGlossaryResponse actualResponse = client.deleteGlossaryAsync(name).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockTranslationService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + DeleteGlossaryRequest actualRequest = (DeleteGlossaryRequest) actualRequests.get(0); + + Assert.assertEquals(name, GlossaryName.parse(actualRequest.getName())); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + @SuppressWarnings("all") + public void deleteGlossaryExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + mockTranslationService.addException(exception); + + try { + GlossaryName name = GlossaryName.of("[PROJECT]", "[LOCATION]", "[GLOSSARY]"); + + client.deleteGlossaryAsync(name).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + Assert.assertEquals(InvalidArgumentException.class, e.getCause().getClass()); + InvalidArgumentException apiException = (InvalidArgumentException) e.getCause(); + Assert.assertEquals(StatusCode.Code.INVALID_ARGUMENT, apiException.getStatusCode().getCode()); + } + } + @Test @SuppressWarnings("all") public void translateTextTest() { @@ -501,52 +549,4 @@ public void getGlossaryExceptionTest() throws Exception { // Expected exception } } - - @Test - @SuppressWarnings("all") - public void deleteGlossaryTest() throws Exception { - String name2 = "name2-1052831874"; - DeleteGlossaryResponse expectedResponse = - DeleteGlossaryResponse.newBuilder().setName(name2).build(); - Operation resultOperation = - Operation.newBuilder() - .setName("deleteGlossaryTest") - .setDone(true) - .setResponse(Any.pack(expectedResponse)) - .build(); - mockTranslationService.addResponse(resultOperation); - - GlossaryName name = GlossaryName.of("[PROJECT]", "[LOCATION]", "[GLOSSARY]"); - - DeleteGlossaryResponse actualResponse = client.deleteGlossaryAsync(name).get(); - Assert.assertEquals(expectedResponse, actualResponse); - - List actualRequests = mockTranslationService.getRequests(); - Assert.assertEquals(1, actualRequests.size()); - DeleteGlossaryRequest actualRequest = (DeleteGlossaryRequest) actualRequests.get(0); - - Assert.assertEquals(name, GlossaryName.parse(actualRequest.getName())); - Assert.assertTrue( - channelProvider.isHeaderSent( - ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), - GaxGrpcProperties.getDefaultApiClientHeaderPattern())); - } - - @Test - @SuppressWarnings("all") - public void deleteGlossaryExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); - mockTranslationService.addException(exception); - - try { - GlossaryName name = GlossaryName.of("[PROJECT]", "[LOCATION]", "[GLOSSARY]"); - - client.deleteGlossaryAsync(name).get(); - Assert.fail("No exception raised"); - } catch (ExecutionException e) { - Assert.assertEquals(InvalidArgumentException.class, e.getCause().getClass()); - InvalidArgumentException apiException = (InvalidArgumentException) e.getCause(); - Assert.assertEquals(StatusCode.Code.INVALID_ARGUMENT, apiException.getStatusCode().getCode()); - } - } } diff --git a/synth.metadata b/synth.metadata index 5b478804..63b48a0c 100644 --- a/synth.metadata +++ b/synth.metadata @@ -11,16 +11,16 @@ "git": { "name": "googleapis", "remote": "https://github.com/googleapis/googleapis.git", - "sha": "aed11c01e52921613b9ee469c2d85f5f33175fb7", - "internalRef": "310660461" + "sha": "5a90d467aa65e7f038f87585e8fbb45d74475e7c", + "internalRef": "312088359" } }, { "git": { "name": "googleapis", "remote": "https://github.com/googleapis/googleapis.git", - "sha": "aed11c01e52921613b9ee469c2d85f5f33175fb7", - "internalRef": "310660461" + "sha": "5a90d467aa65e7f038f87585e8fbb45d74475e7c", + "internalRef": "312088359" } }, {