diff --git a/README.md b/README.md index 04ceb4a3..16cd71ff 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ If you are using Maven with [BOM][libraries-bom], add this to your pom.xml file com.google.cloud libraries-bom - 7.0.0 + 7.0.1 pom import 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 54642032..f851c18d 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,133 +173,6 @@ 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. @@ -1318,6 +1191,133 @@ 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 5fed32de..ccedeb3d 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,20 +69,6 @@ @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(); @@ -139,6 +125,20 @@ 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,20 +236,6 @@ 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() { @@ -308,6 +294,20 @@ 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 01c52187..edaaec17 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,15 +64,6 @@ @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() @@ -139,14 +130,19 @@ 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 @@ -162,6 +158,10 @@ 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,19 +205,6 @@ 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) @@ -312,16 +299,20 @@ 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); @@ -362,6 +353,15 @@ public Map extract(GetGlossaryRequest 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,16 +371,6 @@ 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; } @@ -428,6 +418,16 @@ 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 28059692..89cb71fa 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,16 +58,6 @@ 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()"); } @@ -116,6 +106,16 @@ 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 2ef72e5e..627b69be 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,10 +112,6 @@ public class TranslationServiceStubSettings extends StubSettings deleteGlossarySettings; - private final OperationCallSettings< - DeleteGlossaryRequest, DeleteGlossaryResponse, DeleteGlossaryMetadata> - deleteGlossaryOperationSettings; private final UnaryCallSettings translateTextSettings; private final UnaryCallSettings @@ -133,19 +129,10 @@ public class TranslationServiceStubSettings extends StubSettings listGlossariesSettings; private final UnaryCallSettings 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< + private final UnaryCallSettings deleteGlossarySettings; + private final OperationCallSettings< DeleteGlossaryRequest, DeleteGlossaryResponse, DeleteGlossaryMetadata> - deleteGlossaryOperationSettings() { - return deleteGlossaryOperationSettings; - } + deleteGlossaryOperationSettings; /** Returns the object with the settings used for calls to translateText. */ public UnaryCallSettings translateTextSettings() { @@ -200,6 +187,19 @@ 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,8 +269,6 @@ 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(); @@ -281,6 +279,8 @@ 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,11 +342,6 @@ 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 @@ -367,6 +362,11 @@ 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; @@ -375,11 +375,13 @@ public static class Builder ImmutableMap.Builder> definitions = ImmutableMap.builder(); definitions.put( - "idempotent", + "retry_policy_1_codes", ImmutableSet.copyOf( Lists.newArrayList( StatusCode.Code.DEADLINE_EXCEEDED, StatusCode.Code.UNAVAILABLE))); - definitions.put("non_idempotent", ImmutableSet.copyOf(Lists.newArrayList())); + definitions.put("no_retry_codes", ImmutableSet.copyOf(Lists.newArrayList())); + definitions.put( + "no_retry_1_codes", ImmutableSet.copyOf(Lists.newArrayList())); RETRYABLE_CODE_DEFINITIONS = definitions.build(); } @@ -393,12 +395,22 @@ public static class Builder .setInitialRetryDelay(Duration.ofMillis(100L)) .setRetryDelayMultiplier(1.3) .setMaxRetryDelay(Duration.ofMillis(60000L)) - .setInitialRpcTimeout(Duration.ofMillis(20000L)) + .setInitialRpcTimeout(Duration.ofMillis(600000L)) + .setRpcTimeoutMultiplier(1.0) + .setMaxRpcTimeout(Duration.ofMillis(600000L)) + .setTotalTimeout(Duration.ofMillis(600000L)) + .build(); + definitions.put("retry_policy_1_params", settings); + settings = RetrySettings.newBuilder().setRpcTimeoutMultiplier(1.0).build(); + definitions.put("no_retry_params", settings); + settings = + RetrySettings.newBuilder() + .setInitialRpcTimeout(Duration.ofMillis(600000L)) .setRpcTimeoutMultiplier(1.0) - .setMaxRpcTimeout(Duration.ofMillis(20000L)) + .setMaxRpcTimeout(Duration.ofMillis(600000L)) .setTotalTimeout(Duration.ofMillis(600000L)) .build(); - definitions.put("default", settings); + definitions.put("no_retry_1_params", settings); RETRY_PARAM_DEFINITIONS = definitions.build(); } @@ -409,10 +421,6 @@ protected Builder() { protected Builder(ClientContext clientContext) { super(clientContext); - deleteGlossarySettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); - - deleteGlossaryOperationSettings = OperationCallSettings.newBuilder(); - translateTextSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); detectLanguageSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); @@ -431,16 +439,20 @@ protected Builder(ClientContext clientContext) { getGlossarySettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + deleteGlossarySettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + deleteGlossaryOperationSettings = OperationCallSettings.newBuilder(); + unaryMethodSettingsBuilders = ImmutableList.>of( - deleteGlossarySettings, translateTextSettings, detectLanguageSettings, getSupportedLanguagesSettings, batchTranslateTextSettings, createGlossarySettings, listGlossariesSettings, - getGlossarySettings); + getGlossarySettings, + deleteGlossarySettings); initDefaults(this); } @@ -456,57 +468,57 @@ 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")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_1_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_1_params")); builder .detectLanguageSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_1_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_1_params")); builder .getSupportedLanguagesSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params")); builder .batchTranslateTextSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_1_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_1_params")); builder .createGlossarySettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_1_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_1_params")); builder .listGlossariesSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params")); builder .getGlossarySettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params")); + builder - .deleteGlossaryOperationSettings() + .deleteGlossarySettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params")); + builder + .batchTranslateTextOperationSettings() .setInitialCallSettings( UnaryCallSettings - .newUnaryCallSettingsBuilder() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")) + .newUnaryCallSettingsBuilder() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_1_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_1_params")) .build()) .setResponseTransformer( - ProtoOperationTransformers.ResponseTransformer.create(DeleteGlossaryResponse.class)) + ProtoOperationTransformers.ResponseTransformer.create(BatchTranslateResponse.class)) .setMetadataTransformer( - ProtoOperationTransformers.MetadataTransformer.create(DeleteGlossaryMetadata.class)) + ProtoOperationTransformers.MetadataTransformer.create(BatchTranslateMetadata.class)) .setPollingAlgorithm( OperationTimedPollAlgorithm.create( RetrySettings.newBuilder() @@ -519,17 +531,17 @@ private static Builder initDefaults(Builder builder) { .setTotalTimeout(Duration.ofMillis(300000L)) .build())); builder - .batchTranslateTextOperationSettings() + .createGlossaryOperationSettings() .setInitialCallSettings( UnaryCallSettings - .newUnaryCallSettingsBuilder() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")) + .newUnaryCallSettingsBuilder() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_1_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_1_params")) .build()) .setResponseTransformer( - ProtoOperationTransformers.ResponseTransformer.create(BatchTranslateResponse.class)) + ProtoOperationTransformers.ResponseTransformer.create(Glossary.class)) .setMetadataTransformer( - ProtoOperationTransformers.MetadataTransformer.create(BatchTranslateMetadata.class)) + ProtoOperationTransformers.MetadataTransformer.create(CreateGlossaryMetadata.class)) .setPollingAlgorithm( OperationTimedPollAlgorithm.create( RetrySettings.newBuilder() @@ -542,17 +554,17 @@ private static Builder initDefaults(Builder builder) { .setTotalTimeout(Duration.ofMillis(300000L)) .build())); builder - .createGlossaryOperationSettings() + .deleteGlossaryOperationSettings() .setInitialCallSettings( UnaryCallSettings - .newUnaryCallSettingsBuilder() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")) + .newUnaryCallSettingsBuilder() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params")) .build()) .setResponseTransformer( - ProtoOperationTransformers.ResponseTransformer.create(Glossary.class)) + ProtoOperationTransformers.ResponseTransformer.create(DeleteGlossaryResponse.class)) .setMetadataTransformer( - ProtoOperationTransformers.MetadataTransformer.create(CreateGlossaryMetadata.class)) + ProtoOperationTransformers.MetadataTransformer.create(DeleteGlossaryMetadata.class)) .setPollingAlgorithm( OperationTimedPollAlgorithm.create( RetrySettings.newBuilder() @@ -571,8 +583,6 @@ 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(); @@ -583,17 +593,19 @@ 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); + getGlossarySettings, + deleteGlossarySettings); } // NEXT_MAJOR_VER: remove 'throws Exception' @@ -612,20 +624,6 @@ 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() { @@ -684,6 +682,20 @@ 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 921a9a86..55228221 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,133 +173,6 @@ 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. @@ -1152,6 +1025,133 @@ 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 19927740..fb2947e8 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,20 +69,6 @@ @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(); @@ -139,6 +125,20 @@ 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,20 +236,6 @@ 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() { @@ -308,6 +294,20 @@ 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 bd64c88c..bdc638af 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,16 +64,6 @@ @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() @@ -144,14 +134,20 @@ 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 @@ -167,6 +163,10 @@ 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,19 +210,6 @@ 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) @@ -317,16 +304,20 @@ 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); @@ -367,6 +358,15 @@ public Map extract(GetGlossaryRequest 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,16 +376,6 @@ 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; } @@ -433,6 +423,16 @@ 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 f07e832e..26f79d43 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,16 +58,6 @@ 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()"); } @@ -116,6 +106,16 @@ 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 83e31029..a8255a5b 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,10 +112,6 @@ public class TranslationServiceStubSettings extends StubSettings deleteGlossarySettings; - private final OperationCallSettings< - DeleteGlossaryRequest, DeleteGlossaryResponse, DeleteGlossaryMetadata> - deleteGlossaryOperationSettings; private final UnaryCallSettings translateTextSettings; private final UnaryCallSettings @@ -133,19 +129,10 @@ public class TranslationServiceStubSettings extends StubSettings listGlossariesSettings; private final UnaryCallSettings 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< + private final UnaryCallSettings deleteGlossarySettings; + private final OperationCallSettings< DeleteGlossaryRequest, DeleteGlossaryResponse, DeleteGlossaryMetadata> - deleteGlossaryOperationSettings() { - return deleteGlossaryOperationSettings; - } + deleteGlossaryOperationSettings; /** Returns the object with the settings used for calls to translateText. */ public UnaryCallSettings translateTextSettings() { @@ -200,6 +187,19 @@ 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,8 +269,6 @@ 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(); @@ -281,6 +279,8 @@ 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,11 +342,6 @@ 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 @@ -367,6 +362,11 @@ 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; @@ -375,11 +375,13 @@ public static class Builder ImmutableMap.Builder> definitions = ImmutableMap.builder(); definitions.put( - "idempotent", + "retry_policy_1_codes", ImmutableSet.copyOf( Lists.newArrayList( StatusCode.Code.DEADLINE_EXCEEDED, StatusCode.Code.UNAVAILABLE))); - definitions.put("non_idempotent", ImmutableSet.copyOf(Lists.newArrayList())); + definitions.put("no_retry_codes", ImmutableSet.copyOf(Lists.newArrayList())); + definitions.put( + "no_retry_1_codes", ImmutableSet.copyOf(Lists.newArrayList())); RETRYABLE_CODE_DEFINITIONS = definitions.build(); } @@ -393,12 +395,22 @@ public static class Builder .setInitialRetryDelay(Duration.ofMillis(100L)) .setRetryDelayMultiplier(1.3) .setMaxRetryDelay(Duration.ofMillis(60000L)) - .setInitialRpcTimeout(Duration.ofMillis(20000L)) + .setInitialRpcTimeout(Duration.ofMillis(600000L)) + .setRpcTimeoutMultiplier(1.0) + .setMaxRpcTimeout(Duration.ofMillis(600000L)) + .setTotalTimeout(Duration.ofMillis(600000L)) + .build(); + definitions.put("retry_policy_1_params", settings); + settings = RetrySettings.newBuilder().setRpcTimeoutMultiplier(1.0).build(); + definitions.put("no_retry_params", settings); + settings = + RetrySettings.newBuilder() + .setInitialRpcTimeout(Duration.ofMillis(600000L)) .setRpcTimeoutMultiplier(1.0) - .setMaxRpcTimeout(Duration.ofMillis(20000L)) + .setMaxRpcTimeout(Duration.ofMillis(600000L)) .setTotalTimeout(Duration.ofMillis(600000L)) .build(); - definitions.put("default", settings); + definitions.put("no_retry_1_params", settings); RETRY_PARAM_DEFINITIONS = definitions.build(); } @@ -409,10 +421,6 @@ protected Builder() { protected Builder(ClientContext clientContext) { super(clientContext); - deleteGlossarySettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); - - deleteGlossaryOperationSettings = OperationCallSettings.newBuilder(); - translateTextSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); detectLanguageSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); @@ -431,16 +439,20 @@ protected Builder(ClientContext clientContext) { getGlossarySettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + deleteGlossarySettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + deleteGlossaryOperationSettings = OperationCallSettings.newBuilder(); + unaryMethodSettingsBuilders = ImmutableList.>of( - deleteGlossarySettings, translateTextSettings, detectLanguageSettings, getSupportedLanguagesSettings, batchTranslateTextSettings, createGlossarySettings, listGlossariesSettings, - getGlossarySettings); + getGlossarySettings, + deleteGlossarySettings); initDefaults(this); } @@ -456,57 +468,57 @@ 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")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_1_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_1_params")); builder .detectLanguageSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_1_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_1_params")); builder .getSupportedLanguagesSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params")); builder .batchTranslateTextSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_1_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_1_params")); builder .createGlossarySettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_1_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_1_params")); builder .listGlossariesSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params")); builder .getGlossarySettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params")); + builder - .deleteGlossaryOperationSettings() + .deleteGlossarySettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params")); + builder + .batchTranslateTextOperationSettings() .setInitialCallSettings( UnaryCallSettings - .newUnaryCallSettingsBuilder() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")) + .newUnaryCallSettingsBuilder() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_1_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_1_params")) .build()) .setResponseTransformer( - ProtoOperationTransformers.ResponseTransformer.create(DeleteGlossaryResponse.class)) + ProtoOperationTransformers.ResponseTransformer.create(BatchTranslateResponse.class)) .setMetadataTransformer( - ProtoOperationTransformers.MetadataTransformer.create(DeleteGlossaryMetadata.class)) + ProtoOperationTransformers.MetadataTransformer.create(BatchTranslateMetadata.class)) .setPollingAlgorithm( OperationTimedPollAlgorithm.create( RetrySettings.newBuilder() @@ -519,17 +531,17 @@ private static Builder initDefaults(Builder builder) { .setTotalTimeout(Duration.ofMillis(300000L)) .build())); builder - .batchTranslateTextOperationSettings() + .createGlossaryOperationSettings() .setInitialCallSettings( UnaryCallSettings - .newUnaryCallSettingsBuilder() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")) + .newUnaryCallSettingsBuilder() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_1_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_1_params")) .build()) .setResponseTransformer( - ProtoOperationTransformers.ResponseTransformer.create(BatchTranslateResponse.class)) + ProtoOperationTransformers.ResponseTransformer.create(Glossary.class)) .setMetadataTransformer( - ProtoOperationTransformers.MetadataTransformer.create(BatchTranslateMetadata.class)) + ProtoOperationTransformers.MetadataTransformer.create(CreateGlossaryMetadata.class)) .setPollingAlgorithm( OperationTimedPollAlgorithm.create( RetrySettings.newBuilder() @@ -542,17 +554,17 @@ private static Builder initDefaults(Builder builder) { .setTotalTimeout(Duration.ofMillis(300000L)) .build())); builder - .createGlossaryOperationSettings() + .deleteGlossaryOperationSettings() .setInitialCallSettings( UnaryCallSettings - .newUnaryCallSettingsBuilder() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")) + .newUnaryCallSettingsBuilder() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params")) .build()) .setResponseTransformer( - ProtoOperationTransformers.ResponseTransformer.create(Glossary.class)) + ProtoOperationTransformers.ResponseTransformer.create(DeleteGlossaryResponse.class)) .setMetadataTransformer( - ProtoOperationTransformers.MetadataTransformer.create(CreateGlossaryMetadata.class)) + ProtoOperationTransformers.MetadataTransformer.create(DeleteGlossaryMetadata.class)) .setPollingAlgorithm( OperationTimedPollAlgorithm.create( RetrySettings.newBuilder() @@ -571,8 +583,6 @@ 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(); @@ -583,17 +593,19 @@ 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); + getGlossarySettings, + deleteGlossarySettings); } // NEXT_MAJOR_VER: remove 'throws Exception' @@ -612,20 +624,6 @@ 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() { @@ -684,6 +682,20 @@ 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 d4798fc2..09d4aef2 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,54 +82,6 @@ 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() { @@ -546,4 +498,52 @@ 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 7a886cdf..e372619b 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,54 +82,6 @@ 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() { @@ -549,4 +501,52 @@ 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 ef99e4e5..35b7b229 100644 --- a/synth.metadata +++ b/synth.metadata @@ -4,23 +4,23 @@ "git": { "name": ".", "remote": "https://github.com/googleapis/java-translate.git", - "sha": "d1f4972a1d9d76a7fafc000a9067327fed6d344c" + "sha": "f6e7a377818c7876dc7bc02d34044eceedd48e42" } }, { "git": { "name": "googleapis", "remote": "https://github.com/googleapis/googleapis.git", - "sha": "c4e37010d74071851ff24121f522e802231ac86e", - "internalRef": "313460921" + "sha": "97e94f5367165e4ec2ea4f3c2096b41877cbfb17", + "internalRef": "317700003" } }, { "git": { "name": "googleapis", "remote": "https://github.com/googleapis/googleapis.git", - "sha": "c4e37010d74071851ff24121f522e802231ac86e", - "internalRef": "313460921" + "sha": "97e94f5367165e4ec2ea4f3c2096b41877cbfb17", + "internalRef": "317700003" } }, {