diff --git a/google-cloud-datastore/pom.xml b/google-cloud-datastore/pom.xml index 438123a4e8c9..03b5f4c80b4d 100644 --- a/google-cloud-datastore/pom.xml +++ b/google-cloud-datastore/pom.xml @@ -31,6 +31,12 @@ com.google.cloud.datastore datastore-v1-protos 1.3.0 + + + com.google.api.grpc + grpc-google-common-protos + + com.google.cloud.datastore @@ -43,11 +49,6 @@ - - com.google.api.grpc - grpc-google-common-protos - ${generatedProto.version} - ${project.groupId} google-cloud-core diff --git a/google-cloud-firestore/src/main/java/com/google/cloud/firestore/FirestoreImpl.java b/google-cloud-firestore/src/main/java/com/google/cloud/firestore/FirestoreImpl.java index 391f0472af9a..cf6402debd5c 100644 --- a/google-cloud-firestore/src/main/java/com/google/cloud/firestore/FirestoreImpl.java +++ b/google-cloud-firestore/src/main/java/com/google/cloud/firestore/FirestoreImpl.java @@ -28,7 +28,7 @@ import com.google.firestore.v1beta1.ArrayValue; import com.google.firestore.v1beta1.BatchGetDocumentsRequest; import com.google.firestore.v1beta1.BatchGetDocumentsResponse; -import com.google.firestore.v1beta1.DatabaseName; +import com.google.firestore.v1beta1.DatabaseRootName; import com.google.firestore.v1beta1.MapValue; import com.google.firestore.v1beta1.Value; import com.google.protobuf.ByteString; @@ -149,7 +149,7 @@ static Value encodeValue(@Nullable Object sanitizedObject) { "Failed to detect Project ID. " + "Please explicitly set your Project ID in FirestoreOptions."); this.databasePath = - ResourcePath.create(DatabaseName.create(options.getProjectId(), options.getDatabaseId())); + ResourcePath.create(DatabaseRootName.create(options.getProjectId(), options.getDatabaseId())); } @Nonnull diff --git a/google-cloud-firestore/src/main/java/com/google/cloud/firestore/ResourcePath.java b/google-cloud-firestore/src/main/java/com/google/cloud/firestore/ResourcePath.java index e28b60478f02..cf5c62c5f09e 100644 --- a/google-cloud-firestore/src/main/java/com/google/cloud/firestore/ResourcePath.java +++ b/google-cloud-firestore/src/main/java/com/google/cloud/firestore/ResourcePath.java @@ -18,7 +18,7 @@ import com.google.auto.value.AutoValue; import com.google.common.collect.ImmutableList; -import com.google.firestore.v1beta1.DatabaseName; +import com.google.firestore.v1beta1.DatabaseRootName; import java.util.Arrays; import javax.annotation.Nullable; @@ -32,7 +32,7 @@ abstract class ResourcePath extends BasePath { * @param databaseName The Firestore database name. * @param segments The segments of the path relative to the root collections. */ - static ResourcePath create(DatabaseName databaseName, ImmutableList segments) { + static ResourcePath create(DatabaseRootName databaseName, ImmutableList segments) { return new AutoValue_ResourcePath(segments, databaseName); } @@ -41,7 +41,7 @@ static ResourcePath create(DatabaseName databaseName, ImmutableList segm * * @param databaseName The Firestore database name. */ - static ResourcePath create(DatabaseName databaseName) { + static ResourcePath create(DatabaseRootName databaseName) { return new AutoValue_ResourcePath(ImmutableList.of(), databaseName); } @@ -56,11 +56,11 @@ static ResourcePath create(String resourceName) { if (parts.length >= 6 && parts[0].equals("projects") && parts[2].equals("databases")) { String[] path = Arrays.copyOfRange(parts, 5, parts.length); return create( - DatabaseName.create(parts[1], parts[3]), + DatabaseRootName.create(parts[1], parts[3]), ImmutableList.builder().add(path).build()); } - return create(DatabaseName.parse(resourceName)); + return create(DatabaseRootName.parse(resourceName)); } /** @@ -68,7 +68,7 @@ static ResourcePath create(String resourceName) { * * @return The Firestore database name. */ - abstract DatabaseName getDatabaseName(); + abstract DatabaseRootName getDatabaseName(); /** Returns whether this path points to a document. */ boolean isDocument() { diff --git a/google-cloud-firestore/src/main/java/com/google/cloud/firestore/spi/v1beta1/GrpcFirestoreRpc.java b/google-cloud-firestore/src/main/java/com/google/cloud/firestore/spi/v1beta1/GrpcFirestoreRpc.java index 3e9a3be40a15..3eebb122d3aa 100644 --- a/google-cloud-firestore/src/main/java/com/google/cloud/firestore/spi/v1beta1/GrpcFirestoreRpc.java +++ b/google-cloud-firestore/src/main/java/com/google/cloud/firestore/spi/v1beta1/GrpcFirestoreRpc.java @@ -41,7 +41,7 @@ import com.google.firestore.v1beta1.BeginTransactionResponse; import com.google.firestore.v1beta1.CommitRequest; import com.google.firestore.v1beta1.CommitResponse; -import com.google.firestore.v1beta1.DatabaseName; +import com.google.firestore.v1beta1.DatabaseRootName; import com.google.firestore.v1beta1.ListCollectionIdsRequest; import com.google.firestore.v1beta1.RollbackRequest; import com.google.firestore.v1beta1.RunQueryRequest; @@ -87,7 +87,7 @@ public GrpcFirestoreRpc(final FirestoreOptions options) throws IOException { .setTransportContext(GrpcTransport.newBuilder().setChannel(managedChannel).build()) .build(); } else { - DatabaseName databaseName = DatabaseName + DatabaseRootName databaseName = DatabaseRootName .create(options.getProjectId(), options.getDatabaseId()); Credentials credentials = GrpcTransportOptions.setUpCredentialsProvider(options).getCredentials(); diff --git a/google-cloud-firestore/src/main/java/com/google/cloud/firestore/v1beta1/package-info.java b/google-cloud-firestore/src/main/java/com/google/cloud/firestore/v1beta1/package-info.java index dbcb368c8b13..d2b5b3b38d10 100644 --- a/google-cloud-firestore/src/main/java/com/google/cloud/firestore/v1beta1/package-info.java +++ b/google-cloud-firestore/src/main/java/com/google/cloud/firestore/v1beta1/package-info.java @@ -19,62 +19,7 @@ * *

The interfaces provided are listed below, along with usage samples. * - *

==================== FirestoreAdminClient ==================== - * - *

Service Description: The Cloud Firestore Admin API. - * - *

This API provides several administrative services for Cloud Firestore. - * - *

# Concepts - * - *

Project, Database, Namespace, Collection, and Document are used as defined in the Google Cloud - * Firestore API. - * - *

Operation: An Operation represents work being performed in the background. - * - *

# Services - * - *

## Index - * - *

The index service manages Cloud Firestore indexes. - * - *

Index creation is performed asynchronously. An Operation resource is created for each such - * asynchronous operation. The state of the operation (including any errors encountered) may be - * queried via the Operation resource. - * - *

## Metadata - * - *

Provides metadata and statistical information about data in Cloud Firestore. The data provided - * as part of this API may be stale. - * - *

## Operation - * - *

The Operations collection provides a record of actions performed for the specified Project - * (including any Operations in progress). Operations are not created directly but through calls on - * other collections or resources. - * - *

An Operation that is not yet done may be cancelled. The request to cancel is asynchronous and - * the Operation may continue to run for some time after the request to cancel is made. - * - *

An Operation that is done may be deleted so that it is no longer listed as part of the - * Operation collection. - * - *

Operations are created by service `FirestoreAdmin`, but are accessed via service - * `google.longrunning.Operations`. - * - *

Sample for FirestoreAdminClient: - * - *

- * 
- * try (FirestoreAdminClient firestoreAdminClient = FirestoreAdminClient.create()) {
- *   String formattedParent = FirestoreAdminClient.formatDatabaseName("[PROJECT]", "[DATABASE]");
- *   Index index = Index.newBuilder().build();
- *   Operation response = firestoreAdminClient.createIndex(formattedParent, index);
- * }
- * 
- * 
- * - * =============== FirestoreClient =============== + *

=============== FirestoreClient =============== * *

Service Description: The Cloud Firestore service. * diff --git a/google-cloud-firestore/src/test/java/com/google/cloud/firestore/LocalFirestoreHelper.java b/google-cloud-firestore/src/test/java/com/google/cloud/firestore/LocalFirestoreHelper.java index 92ed6c51bf58..f5033abfed4b 100644 --- a/google-cloud-firestore/src/test/java/com/google/cloud/firestore/LocalFirestoreHelper.java +++ b/google-cloud-firestore/src/test/java/com/google/cloud/firestore/LocalFirestoreHelper.java @@ -31,7 +31,7 @@ import com.google.firestore.v1beta1.CommitRequest; import com.google.firestore.v1beta1.CommitResponse; import com.google.firestore.v1beta1.Cursor; -import com.google.firestore.v1beta1.DatabaseName; +import com.google.firestore.v1beta1.DatabaseRootName; import com.google.firestore.v1beta1.Document; import com.google.firestore.v1beta1.DocumentMask; import com.google.firestore.v1beta1.DocumentTransform; @@ -551,7 +551,7 @@ public boolean equals(Object o) { null, new DocumentReference( null, - ResourcePath.create(DatabaseName.create("", ""), ImmutableList.of("coll", "doc"))), + ResourcePath.create(DatabaseRootName.create("", ""), ImmutableList.of("coll", "doc"))), SINGLE_FIELD_PROTO, Instant.ofEpochSecond(5, 6), Instant.ofEpochSecond(3, 4), diff --git a/google-cloud-firestore/src/test/java/com/google/cloud/firestore/v1beta1/FirestoreClientTest.java b/google-cloud-firestore/src/test/java/com/google/cloud/firestore/v1beta1/FirestoreClientTest.java index 17ba7574463f..8abc77682b0b 100644 --- a/google-cloud-firestore/src/test/java/com/google/cloud/firestore/v1beta1/FirestoreClientTest.java +++ b/google-cloud-firestore/src/test/java/com/google/cloud/firestore/v1beta1/FirestoreClientTest.java @@ -74,8 +74,7 @@ public class FirestoreClientTest { public static void startStaticServer() { mockFirestore = new MockFirestore(); serviceHelper = - new MockServiceHelper( - "in-process-1", Arrays.asList(mockFirestore)); + new MockServiceHelper("in-process-1", Arrays.asList(mockFirestore)); serviceHelper.start(); } diff --git a/google-cloud-language/src/main/java/com/google/cloud/language/v1/LanguageServiceClient.java b/google-cloud-language/src/main/java/com/google/cloud/language/v1/LanguageServiceClient.java index 7259969d91f3..6350317f2f5b 100644 --- a/google-cloud-language/src/main/java/com/google/cloud/language/v1/LanguageServiceClient.java +++ b/google-cloud-language/src/main/java/com/google/cloud/language/v1/LanguageServiceClient.java @@ -455,6 +455,73 @@ public final UnaryCallable analyzeS return stub.analyzeSyntaxCallable(); } + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Classifies a document into categories. + * + *

Sample code: + * + *


+   * try (LanguageServiceClient languageServiceClient = LanguageServiceClient.create()) {
+   *   Document document = Document.newBuilder().build();
+   *   ClassifyTextResponse response = languageServiceClient.classifyText(document);
+   * }
+   * 
+ * + * @param document Input document. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final ClassifyTextResponse classifyText(Document document) { + + ClassifyTextRequest request = ClassifyTextRequest.newBuilder().setDocument(document).build(); + return classifyText(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Classifies a document into categories. + * + *

Sample code: + * + *


+   * try (LanguageServiceClient languageServiceClient = LanguageServiceClient.create()) {
+   *   Document document = Document.newBuilder().build();
+   *   ClassifyTextRequest request = ClassifyTextRequest.newBuilder()
+   *     .setDocument(document)
+   *     .build();
+   *   ClassifyTextResponse response = languageServiceClient.classifyText(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final ClassifyTextResponse classifyText(ClassifyTextRequest request) { + return classifyTextCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Classifies a document into categories. + * + *

Sample code: + * + *


+   * try (LanguageServiceClient languageServiceClient = LanguageServiceClient.create()) {
+   *   Document document = Document.newBuilder().build();
+   *   ClassifyTextRequest request = ClassifyTextRequest.newBuilder()
+   *     .setDocument(document)
+   *     .build();
+   *   ApiFuture<ClassifyTextResponse> future = languageServiceClient.classifyTextCallable().futureCall(request);
+   *   // Do something
+   *   ClassifyTextResponse response = future.get();
+   * }
+   * 
+ */ + public final UnaryCallable classifyTextCallable() { + return stub.classifyTextCallable(); + } + // AUTO-GENERATED DOCUMENTATION AND METHOD /** * A convenience method that provides all the features that analyzeSentiment, analyzeEntities, and diff --git a/google-cloud-language/src/main/java/com/google/cloud/language/v1/LanguageServiceSettings.java b/google-cloud-language/src/main/java/com/google/cloud/language/v1/LanguageServiceSettings.java index 05a30cb08adc..c536e5ef747c 100644 --- a/google-cloud-language/src/main/java/com/google/cloud/language/v1/LanguageServiceSettings.java +++ b/google-cloud-language/src/main/java/com/google/cloud/language/v1/LanguageServiceSettings.java @@ -94,6 +94,7 @@ public class LanguageServiceSettings extends ClientSettings { analyzeEntitySentimentSettings; private final SimpleCallSettings analyzeSyntaxSettings; + private final SimpleCallSettings classifyTextSettings; private final SimpleCallSettings annotateTextSettings; /** Returns the object with the settings used for calls to analyzeSentiment. */ @@ -119,6 +120,11 @@ public SimpleCallSettings analyzeSy return analyzeSyntaxSettings; } + /** Returns the object with the settings used for calls to classifyText. */ + public SimpleCallSettings classifyTextSettings() { + return classifyTextSettings; + } + /** Returns the object with the settings used for calls to annotateText. */ public SimpleCallSettings annotateTextSettings() { return annotateTextSettings; @@ -221,6 +227,7 @@ private LanguageServiceSettings(Builder settingsBuilder) throws IOException { analyzeEntitiesSettings = settingsBuilder.analyzeEntitiesSettings().build(); analyzeEntitySentimentSettings = settingsBuilder.analyzeEntitySentimentSettings().build(); analyzeSyntaxSettings = settingsBuilder.analyzeSyntaxSettings().build(); + classifyTextSettings = settingsBuilder.classifyTextSettings().build(); annotateTextSettings = settingsBuilder.annotateTextSettings().build(); } @@ -237,6 +244,8 @@ public static class Builder extends ClientSettings.Builder { analyzeEntitySentimentSettings; private final SimpleCallSettings.Builder analyzeSyntaxSettings; + private final SimpleCallSettings.Builder + classifyTextSettings; private final SimpleCallSettings.Builder annotateTextSettings; @@ -288,6 +297,8 @@ private Builder(ClientContext clientContext) { analyzeSyntaxSettings = SimpleCallSettings.newBuilder(); + classifyTextSettings = SimpleCallSettings.newBuilder(); + annotateTextSettings = SimpleCallSettings.newBuilder(); unaryMethodSettingsBuilders = @@ -296,6 +307,7 @@ private Builder(ClientContext clientContext) { analyzeEntitiesSettings, analyzeEntitySentimentSettings, analyzeSyntaxSettings, + classifyTextSettings, annotateTextSettings); initDefaults(this); @@ -330,6 +342,11 @@ private static Builder initDefaults(Builder builder) { .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + builder + .classifyTextSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + builder .annotateTextSettings() .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) @@ -345,6 +362,7 @@ private Builder(LanguageServiceSettings settings) { analyzeEntitiesSettings = settings.analyzeEntitiesSettings.toBuilder(); analyzeEntitySentimentSettings = settings.analyzeEntitySentimentSettings.toBuilder(); analyzeSyntaxSettings = settings.analyzeSyntaxSettings.toBuilder(); + classifyTextSettings = settings.classifyTextSettings.toBuilder(); annotateTextSettings = settings.annotateTextSettings.toBuilder(); unaryMethodSettingsBuilders = @@ -353,6 +371,7 @@ private Builder(LanguageServiceSettings settings) { analyzeEntitiesSettings, analyzeEntitySentimentSettings, analyzeSyntaxSettings, + classifyTextSettings, annotateTextSettings); } @@ -409,6 +428,12 @@ public Builder applyToAllUnaryMethods( return analyzeSyntaxSettings; } + /** Returns the builder for the settings used for calls to classifyText. */ + public SimpleCallSettings.Builder + classifyTextSettings() { + return classifyTextSettings; + } + /** Returns the builder for the settings used for calls to annotateText. */ public SimpleCallSettings.Builder annotateTextSettings() { diff --git a/google-cloud-language/src/main/java/com/google/cloud/language/v1/stub/GrpcLanguageServiceStub.java b/google-cloud-language/src/main/java/com/google/cloud/language/v1/stub/GrpcLanguageServiceStub.java index d8dfd11f6f4f..d2c605df0621 100644 --- a/google-cloud-language/src/main/java/com/google/cloud/language/v1/stub/GrpcLanguageServiceStub.java +++ b/google-cloud-language/src/main/java/com/google/cloud/language/v1/stub/GrpcLanguageServiceStub.java @@ -31,6 +31,8 @@ import com.google.cloud.language.v1.AnalyzeSyntaxResponse; import com.google.cloud.language.v1.AnnotateTextRequest; import com.google.cloud.language.v1.AnnotateTextResponse; +import com.google.cloud.language.v1.ClassifyTextRequest; +import com.google.cloud.language.v1.ClassifyTextResponse; import com.google.cloud.language.v1.LanguageServiceSettings; import java.io.IOException; import java.util.concurrent.TimeUnit; @@ -84,6 +86,15 @@ public class GrpcLanguageServiceStub extends LanguageServiceStub { io.grpc.protobuf.ProtoUtils.marshaller(AnalyzeSyntaxRequest.getDefaultInstance()), io.grpc.protobuf.ProtoUtils.marshaller( AnalyzeSyntaxResponse.getDefaultInstance()))); + private static final UnaryCallable + directClassifyTextCallable = + GrpcCallableFactory.createDirectCallable( + io.grpc.MethodDescriptor.create( + io.grpc.MethodDescriptor.MethodType.UNARY, + "google.cloud.language.v1.LanguageService/ClassifyText", + io.grpc.protobuf.ProtoUtils.marshaller(ClassifyTextRequest.getDefaultInstance()), + io.grpc.protobuf.ProtoUtils.marshaller( + ClassifyTextResponse.getDefaultInstance()))); private static final UnaryCallable directAnnotateTextCallable = GrpcCallableFactory.createDirectCallable( @@ -103,6 +114,7 @@ public class GrpcLanguageServiceStub extends LanguageServiceStub { private final UnaryCallable analyzeEntitySentimentCallable; private final UnaryCallable analyzeSyntaxCallable; + private final UnaryCallable classifyTextCallable; private final UnaryCallable annotateTextCallable; public static final GrpcLanguageServiceStub create(LanguageServiceSettings settings) @@ -137,6 +149,9 @@ protected GrpcLanguageServiceStub(LanguageServiceSettings settings, ClientContex this.analyzeSyntaxCallable = GrpcCallableFactory.create( directAnalyzeSyntaxCallable, settings.analyzeSyntaxSettings(), clientContext); + this.classifyTextCallable = + GrpcCallableFactory.create( + directClassifyTextCallable, settings.classifyTextSettings(), clientContext); this.annotateTextCallable = GrpcCallableFactory.create( directAnnotateTextCallable, settings.annotateTextSettings(), clientContext); @@ -162,6 +177,10 @@ public UnaryCallable analyzeSyntaxC return analyzeSyntaxCallable; } + public UnaryCallable classifyTextCallable() { + return classifyTextCallable; + } + public UnaryCallable annotateTextCallable() { return annotateTextCallable; } diff --git a/google-cloud-language/src/main/java/com/google/cloud/language/v1/stub/LanguageServiceStub.java b/google-cloud-language/src/main/java/com/google/cloud/language/v1/stub/LanguageServiceStub.java index ed6cdcbc2986..fc18052fd28c 100644 --- a/google-cloud-language/src/main/java/com/google/cloud/language/v1/stub/LanguageServiceStub.java +++ b/google-cloud-language/src/main/java/com/google/cloud/language/v1/stub/LanguageServiceStub.java @@ -28,6 +28,8 @@ import com.google.cloud.language.v1.AnalyzeSyntaxResponse; import com.google.cloud.language.v1.AnnotateTextRequest; import com.google.cloud.language.v1.AnnotateTextResponse; +import com.google.cloud.language.v1.ClassifyTextRequest; +import com.google.cloud.language.v1.ClassifyTextResponse; import javax.annotation.Generated; // AUTO-GENERATED DOCUMENTATION AND CLASS @@ -58,6 +60,10 @@ public UnaryCallable analyzeSyntaxC throw new UnsupportedOperationException("Not implemented: analyzeSyntaxCallable()"); } + public UnaryCallable classifyTextCallable() { + throw new UnsupportedOperationException("Not implemented: classifyTextCallable()"); + } + public UnaryCallable annotateTextCallable() { throw new UnsupportedOperationException("Not implemented: annotateTextCallable()"); } diff --git a/google-cloud-language/src/test/java/com/google/cloud/language/v1/LanguageServiceClientTest.java b/google-cloud-language/src/test/java/com/google/cloud/language/v1/LanguageServiceClientTest.java index b4634f2db94d..fcd71fca35ce 100644 --- a/google-cloud-language/src/test/java/com/google/cloud/language/v1/LanguageServiceClientTest.java +++ b/google-cloud-language/src/test/java/com/google/cloud/language/v1/LanguageServiceClientTest.java @@ -147,6 +147,47 @@ public void analyzeEntitiesExceptionTest() throws Exception { } } + @Test + @SuppressWarnings("all") + public void analyzeEntitySentimentTest() { + String language = "language-1613589672"; + AnalyzeEntitySentimentResponse expectedResponse = + AnalyzeEntitySentimentResponse.newBuilder().setLanguage(language).build(); + mockLanguageService.addResponse(expectedResponse); + + Document document = Document.newBuilder().build(); + EncodingType encodingType = EncodingType.NONE; + + AnalyzeEntitySentimentResponse actualResponse = + client.analyzeEntitySentiment(document, encodingType); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockLanguageService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + AnalyzeEntitySentimentRequest actualRequest = + (AnalyzeEntitySentimentRequest) actualRequests.get(0); + + Assert.assertEquals(document, actualRequest.getDocument()); + Assert.assertEquals(encodingType, actualRequest.getEncodingType()); + } + + @Test + @SuppressWarnings("all") + public void analyzeEntitySentimentExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + mockLanguageService.addException(exception); + + try { + Document document = Document.newBuilder().build(); + EncodingType encodingType = EncodingType.NONE; + + client.analyzeEntitySentiment(document, encodingType); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + @Test @SuppressWarnings("all") public void analyzeSyntaxTest() { @@ -186,6 +227,40 @@ public void analyzeSyntaxExceptionTest() throws Exception { } } + @Test + @SuppressWarnings("all") + public void classifyTextTest() { + ClassifyTextResponse expectedResponse = ClassifyTextResponse.newBuilder().build(); + mockLanguageService.addResponse(expectedResponse); + + Document document = Document.newBuilder().build(); + + ClassifyTextResponse actualResponse = client.classifyText(document); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockLanguageService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + ClassifyTextRequest actualRequest = (ClassifyTextRequest) actualRequests.get(0); + + Assert.assertEquals(document, actualRequest.getDocument()); + } + + @Test + @SuppressWarnings("all") + public void classifyTextExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + mockLanguageService.addException(exception); + + try { + Document document = Document.newBuilder().build(); + + client.classifyText(document); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + @Test @SuppressWarnings("all") public void annotateTextTest() { diff --git a/google-cloud-language/src/test/java/com/google/cloud/language/v1/MockLanguageServiceImpl.java b/google-cloud-language/src/test/java/com/google/cloud/language/v1/MockLanguageServiceImpl.java index 1a3382ecbbb4..81f2176d48fc 100644 --- a/google-cloud-language/src/test/java/com/google/cloud/language/v1/MockLanguageServiceImpl.java +++ b/google-cloud-language/src/test/java/com/google/cloud/language/v1/MockLanguageServiceImpl.java @@ -84,6 +84,22 @@ public void analyzeEntities( } } + @Override + public void analyzeEntitySentiment( + AnalyzeEntitySentimentRequest request, + StreamObserver responseObserver) { + Object response = responses.remove(); + if (response instanceof AnalyzeEntitySentimentResponse) { + requests.add(request); + responseObserver.onNext((AnalyzeEntitySentimentResponse) response); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError((Exception) response); + } else { + responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); + } + } + @Override public void analyzeSyntax( AnalyzeSyntaxRequest request, StreamObserver responseObserver) { @@ -99,6 +115,21 @@ public void analyzeSyntax( } } + @Override + public void classifyText( + ClassifyTextRequest request, StreamObserver responseObserver) { + Object response = responses.remove(); + if (response instanceof ClassifyTextResponse) { + requests.add(request); + responseObserver.onNext((ClassifyTextResponse) response); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError((Exception) response); + } else { + responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); + } + } + @Override public void annotateText( AnnotateTextRequest request, StreamObserver responseObserver) { diff --git a/google-cloud-logging/src/main/java/com/google/cloud/logging/v2/ConfigClient.java b/google-cloud-logging/src/main/java/com/google/cloud/logging/v2/ConfigClient.java index 5cd8d7035a74..13613c398427 100644 --- a/google-cloud-logging/src/main/java/com/google/cloud/logging/v2/ConfigClient.java +++ b/google-cloud-logging/src/main/java/com/google/cloud/logging/v2/ConfigClient.java @@ -15,22 +15,32 @@ */ package com.google.cloud.logging.v2; +import static com.google.cloud.logging.v2.PagedResponseWrappers.ListExclusionsPagedResponse; import static com.google.cloud.logging.v2.PagedResponseWrappers.ListSinksPagedResponse; import com.google.api.core.BetaApi; import com.google.api.gax.core.BackgroundResource; import com.google.api.gax.rpc.UnaryCallable; import com.google.cloud.logging.v2.stub.ConfigServiceV2Stub; +import com.google.logging.v2.CreateExclusionRequest; import com.google.logging.v2.CreateSinkRequest; +import com.google.logging.v2.DeleteExclusionRequest; import com.google.logging.v2.DeleteSinkRequest; +import com.google.logging.v2.ExclusionNameOneof; +import com.google.logging.v2.GetExclusionRequest; import com.google.logging.v2.GetSinkRequest; +import com.google.logging.v2.ListExclusionsRequest; +import com.google.logging.v2.ListExclusionsResponse; import com.google.logging.v2.ListSinksRequest; import com.google.logging.v2.ListSinksResponse; +import com.google.logging.v2.LogExclusion; import com.google.logging.v2.LogSink; import com.google.logging.v2.ParentNameOneof; import com.google.logging.v2.SinkNameOneof; +import com.google.logging.v2.UpdateExclusionRequest; import com.google.logging.v2.UpdateSinkRequest; import com.google.protobuf.Empty; +import com.google.protobuf.FieldMask; import java.io.IOException; import java.util.concurrent.TimeUnit; import javax.annotation.Generated; @@ -83,7 +93,7 @@ *
  * 
  * ConfigSettings configSettings =
- *     ConfigSettings.defaultBuilder()
+ *     ConfigSettings.newBuilder()
  *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
  *         .build();
  * ConfigClient configClient =
@@ -96,7 +106,7 @@
  * 
  * 
  * ConfigSettings configSettings =
- *     ConfigSettings.defaultBuilder()
+ *     ConfigSettings.newBuilder()
  *         .setTransportProvider(ConfigSettings.defaultGrpcTransportProviderBuilder()
  *             .setChannelProvider(ConfigSettings.defaultGrpcChannelProviderBuilder()
  *                 .setEndpoint(myEndpoint)
@@ -116,7 +126,7 @@ public class ConfigClient implements BackgroundResource {
 
   /** Constructs an instance of ConfigClient with default settings. */
   public static final ConfigClient create() throws IOException {
-    return create(ConfigSettings.defaultBuilder().build());
+    return create(ConfigSettings.newBuilder().build());
   }
 
   /**
@@ -153,6 +163,7 @@ public final ConfigSettings getSettings() {
     return settings;
   }
 
+  @BetaApi
   public ConfigServiceV2Stub getStub() {
     return stub;
   }
@@ -425,12 +436,10 @@ public final UnaryCallable createSinkCallable() {
 
   // AUTO-GENERATED DOCUMENTATION AND METHOD
   /**
-   * Updates a sink. If the named sink doesn't exist, then this method is identical to
-   * [sinks.create](/logging/docs/api/reference/rest/v2/projects.sinks/create). If the named sink
-   * does exist, then this method replaces the following fields in the existing sink with values
-   * from the new sink: `destination`, `filter`, `output_version_format`, `start_time`, and
-   * `end_time`. The updated filter might also have a new `writer_identity`; see the
-   * `unique_writer_identity` field.
+   * Updates a sink. This method replaces the following fields in the existing sink with values from
+   * the new sink: `destination`, `filter`, `output_version_format`, `start_time`, and `end_time`.
+   * The updated sink might also have a new `writer_identity`; see the `unique_writer_identity`
+   * field.
    *
    * 

Sample code: * @@ -450,7 +459,7 @@ public final UnaryCallable createSinkCallable() { * "folders/[FOLDER_ID]/sinks/[SINK_ID]" *

Example: `"projects/my-project-id/sinks/my-sink-id"`. * @param sink Required. The updated sink, whose name is the same identifier that appears as part - * of `sink_name`. If `sink_name` does not exist, then this method creates a new sink. + * of `sink_name`. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final LogSink updateSink(SinkNameOneof sinkName, LogSink sink) { @@ -462,12 +471,10 @@ public final LogSink updateSink(SinkNameOneof sinkName, LogSink sink) { // AUTO-GENERATED DOCUMENTATION AND METHOD /** - * Updates a sink. If the named sink doesn't exist, then this method is identical to - * [sinks.create](/logging/docs/api/reference/rest/v2/projects.sinks/create). If the named sink - * does exist, then this method replaces the following fields in the existing sink with values - * from the new sink: `destination`, `filter`, `output_version_format`, `start_time`, and - * `end_time`. The updated filter might also have a new `writer_identity`; see the - * `unique_writer_identity` field. + * Updates a sink. This method replaces the following fields in the existing sink with values from + * the new sink: `destination`, `filter`, `output_version_format`, `start_time`, and `end_time`. + * The updated sink might also have a new `writer_identity`; see the `unique_writer_identity` + * field. * *

Sample code: * @@ -492,12 +499,10 @@ public final LogSink updateSink(UpdateSinkRequest request) { // AUTO-GENERATED DOCUMENTATION AND METHOD /** - * Updates a sink. If the named sink doesn't exist, then this method is identical to - * [sinks.create](/logging/docs/api/reference/rest/v2/projects.sinks/create). If the named sink - * does exist, then this method replaces the following fields in the existing sink with values - * from the new sink: `destination`, `filter`, `output_version_format`, `start_time`, and - * `end_time`. The updated filter might also have a new `writer_identity`; see the - * `unique_writer_identity` field. + * Updates a sink. This method replaces the following fields in the existing sink with values from + * the new sink: `destination`, `filter`, `output_version_format`, `start_time`, and `end_time`. + * The updated sink might also have a new `writer_identity`; see the `unique_writer_identity` + * field. * *

Sample code: * @@ -596,6 +601,440 @@ public final UnaryCallable deleteSinkCallable() { return stub.deleteSinkCallable(); } + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Lists all the exclusions in a parent resource. + * + *

Sample code: + * + *


+   * try (ConfigClient configClient = ConfigClient.create()) {
+   *   ParentNameOneof parent = ParentNameOneof.from(ProjectName.create("[PROJECT]"));
+   *   for (LogExclusion element : configClient.listExclusions(parent).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param parent Required. The parent resource whose exclusions are to be listed. + *

"projects/[PROJECT_ID]" "organizations/[ORGANIZATION_ID]" + * "billingAccounts/[BILLING_ACCOUNT_ID]" "folders/[FOLDER_ID]" + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final ListExclusionsPagedResponse listExclusions(ParentNameOneof parent) { + ListExclusionsRequest request = + ListExclusionsRequest.newBuilder().setParentWithParentNameOneof(parent).build(); + return listExclusions(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Lists all the exclusions in a parent resource. + * + *

Sample code: + * + *


+   * try (ConfigClient configClient = ConfigClient.create()) {
+   *   ParentNameOneof parent = ParentNameOneof.from(ProjectName.create("[PROJECT]"));
+   *   ListExclusionsRequest request = ListExclusionsRequest.newBuilder()
+   *     .setParentWithParentNameOneof(parent)
+   *     .build();
+   *   for (LogExclusion element : configClient.listExclusions(request).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final ListExclusionsPagedResponse listExclusions(ListExclusionsRequest request) { + return listExclusionsPagedCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Lists all the exclusions in a parent resource. + * + *

Sample code: + * + *


+   * try (ConfigClient configClient = ConfigClient.create()) {
+   *   ParentNameOneof parent = ParentNameOneof.from(ProjectName.create("[PROJECT]"));
+   *   ListExclusionsRequest request = ListExclusionsRequest.newBuilder()
+   *     .setParentWithParentNameOneof(parent)
+   *     .build();
+   *   ApiFuture<ListExclusionsPagedResponse> future = configClient.listExclusionsPagedCallable().futureCall(request);
+   *   // Do something
+   *   for (LogExclusion element : future.get().iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ */ + public final UnaryCallable + listExclusionsPagedCallable() { + return stub.listExclusionsPagedCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Lists all the exclusions in a parent resource. + * + *

Sample code: + * + *


+   * try (ConfigClient configClient = ConfigClient.create()) {
+   *   ParentNameOneof parent = ParentNameOneof.from(ProjectName.create("[PROJECT]"));
+   *   ListExclusionsRequest request = ListExclusionsRequest.newBuilder()
+   *     .setParentWithParentNameOneof(parent)
+   *     .build();
+   *   while (true) {
+   *     ListExclusionsResponse response = configClient.listExclusionsCallable().call(request);
+   *     for (LogExclusion element : response.getExclusionsList()) {
+   *       // doThingsWith(element);
+   *     }
+   *     String nextPageToken = response.getNextPageToken();
+   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *       request = request.toBuilder().setPageToken(nextPageToken).build();
+   *     } else {
+   *       break;
+   *     }
+   *   }
+   * }
+   * 
+ */ + public final UnaryCallable + listExclusionsCallable() { + return stub.listExclusionsCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Gets the description of an exclusion. + * + *

Sample code: + * + *


+   * try (ConfigClient configClient = ConfigClient.create()) {
+   *   ExclusionNameOneof name = ExclusionNameOneof.from(ExclusionName.create("[PROJECT]", "[EXCLUSION]"));
+   *   LogExclusion response = configClient.getExclusion(name);
+   * }
+   * 
+ * + * @param name Required. The resource name of an existing exclusion: + *

"projects/[PROJECT_ID]/exclusions/[EXCLUSION_ID]" + * "organizations/[ORGANIZATION_ID]/exclusions/[EXCLUSION_ID]" + * "billingAccounts/[BILLING_ACCOUNT_ID]/exclusions/[EXCLUSION_ID]" + * "folders/[FOLDER_ID]/exclusions/[EXCLUSION_ID]" + *

Example: `"projects/my-project-id/exclusions/my-exclusion-id"`. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final LogExclusion getExclusion(ExclusionNameOneof name) { + + GetExclusionRequest request = + GetExclusionRequest.newBuilder().setNameWithExclusionNameOneof(name).build(); + return getExclusion(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Gets the description of an exclusion. + * + *

Sample code: + * + *


+   * try (ConfigClient configClient = ConfigClient.create()) {
+   *   ExclusionNameOneof name = ExclusionNameOneof.from(ExclusionName.create("[PROJECT]", "[EXCLUSION]"));
+   *   GetExclusionRequest request = GetExclusionRequest.newBuilder()
+   *     .setNameWithExclusionNameOneof(name)
+   *     .build();
+   *   LogExclusion response = configClient.getExclusion(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + private final LogExclusion getExclusion(GetExclusionRequest request) { + return getExclusionCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Gets the description of an exclusion. + * + *

Sample code: + * + *


+   * try (ConfigClient configClient = ConfigClient.create()) {
+   *   ExclusionNameOneof name = ExclusionNameOneof.from(ExclusionName.create("[PROJECT]", "[EXCLUSION]"));
+   *   GetExclusionRequest request = GetExclusionRequest.newBuilder()
+   *     .setNameWithExclusionNameOneof(name)
+   *     .build();
+   *   ApiFuture<LogExclusion> future = configClient.getExclusionCallable().futureCall(request);
+   *   // Do something
+   *   LogExclusion response = future.get();
+   * }
+   * 
+ */ + public final UnaryCallable getExclusionCallable() { + return stub.getExclusionCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates a new exclusion in a specified parent resource. Only log entries belonging to that + * resource can be excluded. You can have up to 10 exclusions in a resource. + * + *

Sample code: + * + *


+   * try (ConfigClient configClient = ConfigClient.create()) {
+   *   ParentNameOneof parent = ParentNameOneof.from(ProjectName.create("[PROJECT]"));
+   *   LogExclusion exclusion = LogExclusion.newBuilder().build();
+   *   LogExclusion response = configClient.createExclusion(parent, exclusion);
+   * }
+   * 
+ * + * @param parent Required. The parent resource in which to create the exclusion: + *

"projects/[PROJECT_ID]" "organizations/[ORGANIZATION_ID]" + * "billingAccounts/[BILLING_ACCOUNT_ID]" "folders/[FOLDER_ID]" + *

Examples: `"projects/my-logging-project"`, `"organizations/123456789"`. + * @param exclusion Required. The new exclusion, whose `name` parameter is an exclusion name that + * is not already used in the parent resource. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final LogExclusion createExclusion(ParentNameOneof parent, LogExclusion exclusion) { + + CreateExclusionRequest request = + CreateExclusionRequest.newBuilder() + .setParentWithParentNameOneof(parent) + .setExclusion(exclusion) + .build(); + return createExclusion(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates a new exclusion in a specified parent resource. Only log entries belonging to that + * resource can be excluded. You can have up to 10 exclusions in a resource. + * + *

Sample code: + * + *


+   * try (ConfigClient configClient = ConfigClient.create()) {
+   *   ParentNameOneof parent = ParentNameOneof.from(ProjectName.create("[PROJECT]"));
+   *   LogExclusion exclusion = LogExclusion.newBuilder().build();
+   *   CreateExclusionRequest request = CreateExclusionRequest.newBuilder()
+   *     .setParentWithParentNameOneof(parent)
+   *     .setExclusion(exclusion)
+   *     .build();
+   *   LogExclusion response = configClient.createExclusion(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final LogExclusion createExclusion(CreateExclusionRequest request) { + return createExclusionCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates a new exclusion in a specified parent resource. Only log entries belonging to that + * resource can be excluded. You can have up to 10 exclusions in a resource. + * + *

Sample code: + * + *


+   * try (ConfigClient configClient = ConfigClient.create()) {
+   *   ParentNameOneof parent = ParentNameOneof.from(ProjectName.create("[PROJECT]"));
+   *   LogExclusion exclusion = LogExclusion.newBuilder().build();
+   *   CreateExclusionRequest request = CreateExclusionRequest.newBuilder()
+   *     .setParentWithParentNameOneof(parent)
+   *     .setExclusion(exclusion)
+   *     .build();
+   *   ApiFuture<LogExclusion> future = configClient.createExclusionCallable().futureCall(request);
+   *   // Do something
+   *   LogExclusion response = future.get();
+   * }
+   * 
+ */ + public final UnaryCallable createExclusionCallable() { + return stub.createExclusionCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Changes one or more properties of an existing exclusion. + * + *

Sample code: + * + *


+   * try (ConfigClient configClient = ConfigClient.create()) {
+   *   ExclusionNameOneof name = ExclusionNameOneof.from(ExclusionName.create("[PROJECT]", "[EXCLUSION]"));
+   *   LogExclusion exclusion = LogExclusion.newBuilder().build();
+   *   FieldMask updateMask = FieldMask.newBuilder().build();
+   *   LogExclusion response = configClient.updateExclusion(name, exclusion, updateMask);
+   * }
+   * 
+ * + * @param name Required. The resource name of the exclusion to update: + *

"projects/[PROJECT_ID]/exclusions/[EXCLUSION_ID]" + * "organizations/[ORGANIZATION_ID]/exclusions/[EXCLUSION_ID]" + * "billingAccounts/[BILLING_ACCOUNT_ID]/exclusions/[EXCLUSION_ID]" + * "folders/[FOLDER_ID]/exclusions/[EXCLUSION_ID]" + *

Example: `"projects/my-project-id/exclusions/my-exclusion-id"`. + * @param exclusion Required. New values for the existing exclusion. Only the fields specified in + * `update_mask` are relevant. + * @param updateMask Required. A nonempty list of fields to change in the existing exclusion. New + * values for the fields are taken from the corresponding fields in the + * [LogExclusion][google.logging.v2.LogExclusion] included in this request. Fields not + * mentioned in `update_mask` are not changed and are ignored in the request. + *

For example, to change the filter and description of an exclusion, specify an + * `update_mask` of `"filter,description"`. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final LogExclusion updateExclusion( + ExclusionNameOneof name, LogExclusion exclusion, FieldMask updateMask) { + + UpdateExclusionRequest request = + UpdateExclusionRequest.newBuilder() + .setNameWithExclusionNameOneof(name) + .setExclusion(exclusion) + .setUpdateMask(updateMask) + .build(); + return updateExclusion(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Changes one or more properties of an existing exclusion. + * + *

Sample code: + * + *


+   * try (ConfigClient configClient = ConfigClient.create()) {
+   *   ExclusionNameOneof name = ExclusionNameOneof.from(ExclusionName.create("[PROJECT]", "[EXCLUSION]"));
+   *   LogExclusion exclusion = LogExclusion.newBuilder().build();
+   *   FieldMask updateMask = FieldMask.newBuilder().build();
+   *   UpdateExclusionRequest request = UpdateExclusionRequest.newBuilder()
+   *     .setNameWithExclusionNameOneof(name)
+   *     .setExclusion(exclusion)
+   *     .setUpdateMask(updateMask)
+   *     .build();
+   *   LogExclusion response = configClient.updateExclusion(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final LogExclusion updateExclusion(UpdateExclusionRequest request) { + return updateExclusionCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Changes one or more properties of an existing exclusion. + * + *

Sample code: + * + *


+   * try (ConfigClient configClient = ConfigClient.create()) {
+   *   ExclusionNameOneof name = ExclusionNameOneof.from(ExclusionName.create("[PROJECT]", "[EXCLUSION]"));
+   *   LogExclusion exclusion = LogExclusion.newBuilder().build();
+   *   FieldMask updateMask = FieldMask.newBuilder().build();
+   *   UpdateExclusionRequest request = UpdateExclusionRequest.newBuilder()
+   *     .setNameWithExclusionNameOneof(name)
+   *     .setExclusion(exclusion)
+   *     .setUpdateMask(updateMask)
+   *     .build();
+   *   ApiFuture<LogExclusion> future = configClient.updateExclusionCallable().futureCall(request);
+   *   // Do something
+   *   LogExclusion response = future.get();
+   * }
+   * 
+ */ + public final UnaryCallable updateExclusionCallable() { + return stub.updateExclusionCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes an exclusion. + * + *

Sample code: + * + *


+   * try (ConfigClient configClient = ConfigClient.create()) {
+   *   ExclusionNameOneof name = ExclusionNameOneof.from(ExclusionName.create("[PROJECT]", "[EXCLUSION]"));
+   *   configClient.deleteExclusion(name);
+   * }
+   * 
+ * + * @param name Required. The resource name of an existing exclusion to delete: + *

"projects/[PROJECT_ID]/exclusions/[EXCLUSION_ID]" + * "organizations/[ORGANIZATION_ID]/exclusions/[EXCLUSION_ID]" + * "billingAccounts/[BILLING_ACCOUNT_ID]/exclusions/[EXCLUSION_ID]" + * "folders/[FOLDER_ID]/exclusions/[EXCLUSION_ID]" + *

Example: `"projects/my-project-id/exclusions/my-exclusion-id"`. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final void deleteExclusion(ExclusionNameOneof name) { + + DeleteExclusionRequest request = + DeleteExclusionRequest.newBuilder().setNameWithExclusionNameOneof(name).build(); + deleteExclusion(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes an exclusion. + * + *

Sample code: + * + *


+   * try (ConfigClient configClient = ConfigClient.create()) {
+   *   ExclusionNameOneof name = ExclusionNameOneof.from(ExclusionName.create("[PROJECT]", "[EXCLUSION]"));
+   *   DeleteExclusionRequest request = DeleteExclusionRequest.newBuilder()
+   *     .setNameWithExclusionNameOneof(name)
+   *     .build();
+   *   configClient.deleteExclusion(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + private final void deleteExclusion(DeleteExclusionRequest request) { + deleteExclusionCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes an exclusion. + * + *

Sample code: + * + *


+   * try (ConfigClient configClient = ConfigClient.create()) {
+   *   ExclusionNameOneof name = ExclusionNameOneof.from(ExclusionName.create("[PROJECT]", "[EXCLUSION]"));
+   *   DeleteExclusionRequest request = DeleteExclusionRequest.newBuilder()
+   *     .setNameWithExclusionNameOneof(name)
+   *     .build();
+   *   ApiFuture<Void> future = configClient.deleteExclusionCallable().futureCall(request);
+   *   // Do something
+   *   future.get();
+   * }
+   * 
+ */ + public final UnaryCallable deleteExclusionCallable() { + return stub.deleteExclusionCallable(); + } + @Override public final void close() throws Exception { stub.close(); diff --git a/google-cloud-logging/src/main/java/com/google/cloud/logging/v2/ConfigSettings.java b/google-cloud-logging/src/main/java/com/google/cloud/logging/v2/ConfigSettings.java index 00a0ccf8acec..b469483cb673 100644 --- a/google-cloud-logging/src/main/java/com/google/cloud/logging/v2/ConfigSettings.java +++ b/google-cloud-logging/src/main/java/com/google/cloud/logging/v2/ConfigSettings.java @@ -15,6 +15,7 @@ */ package com.google.cloud.logging.v2; +import static com.google.cloud.logging.v2.PagedResponseWrappers.ListExclusionsPagedResponse; import static com.google.cloud.logging.v2.PagedResponseWrappers.ListSinksPagedResponse; import com.google.api.core.ApiFunction; @@ -48,12 +49,19 @@ import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableSet; import com.google.common.collect.Lists; +import com.google.logging.v2.CreateExclusionRequest; import com.google.logging.v2.CreateSinkRequest; +import com.google.logging.v2.DeleteExclusionRequest; import com.google.logging.v2.DeleteSinkRequest; +import com.google.logging.v2.GetExclusionRequest; import com.google.logging.v2.GetSinkRequest; +import com.google.logging.v2.ListExclusionsRequest; +import com.google.logging.v2.ListExclusionsResponse; import com.google.logging.v2.ListSinksRequest; import com.google.logging.v2.ListSinksResponse; +import com.google.logging.v2.LogExclusion; import com.google.logging.v2.LogSink; +import com.google.logging.v2.UpdateExclusionRequest; import com.google.logging.v2.UpdateSinkRequest; import com.google.protobuf.Empty; import io.grpc.Status; @@ -81,7 +89,7 @@ *
  * 
  * ConfigSettings.Builder configSettingsBuilder =
- *     ConfigSettings.defaultBuilder();
+ *     ConfigSettings.newBuilder();
  * configSettingsBuilder.getSinkSettings().getRetrySettingsBuilder()
  *     .setTotalTimeout(Duration.ofSeconds(30));
  * ConfigSettings configSettings = configSettingsBuilder.build();
@@ -115,6 +123,13 @@ public class ConfigSettings extends ClientSettings {
   private final SimpleCallSettings createSinkSettings;
   private final SimpleCallSettings updateSinkSettings;
   private final SimpleCallSettings deleteSinkSettings;
+  private final PagedCallSettings<
+          ListExclusionsRequest, ListExclusionsResponse, ListExclusionsPagedResponse>
+      listExclusionsSettings;
+  private final SimpleCallSettings getExclusionSettings;
+  private final SimpleCallSettings createExclusionSettings;
+  private final SimpleCallSettings updateExclusionSettings;
+  private final SimpleCallSettings deleteExclusionSettings;
 
   /** Returns the object with the settings used for calls to listSinks. */
   public PagedCallSettings
@@ -142,6 +157,33 @@ public SimpleCallSettings deleteSinkSettings() {
     return deleteSinkSettings;
   }
 
+  /** Returns the object with the settings used for calls to listExclusions. */
+  public PagedCallSettings<
+          ListExclusionsRequest, ListExclusionsResponse, ListExclusionsPagedResponse>
+      listExclusionsSettings() {
+    return listExclusionsSettings;
+  }
+
+  /** Returns the object with the settings used for calls to getExclusion. */
+  public SimpleCallSettings getExclusionSettings() {
+    return getExclusionSettings;
+  }
+
+  /** Returns the object with the settings used for calls to createExclusion. */
+  public SimpleCallSettings createExclusionSettings() {
+    return createExclusionSettings;
+  }
+
+  /** Returns the object with the settings used for calls to updateExclusion. */
+  public SimpleCallSettings updateExclusionSettings() {
+    return updateExclusionSettings;
+  }
+
+  /** Returns the object with the settings used for calls to deleteExclusion. */
+  public SimpleCallSettings deleteExclusionSettings() {
+    return deleteExclusionSettings;
+  }
+
   public ConfigServiceV2Stub createStub() throws IOException {
     if (getTransportProvider().getTransportName().equals(GrpcTransport.getGrpcTransportName())) {
       return GrpcConfigServiceV2Stub.create(this);
@@ -198,6 +240,7 @@ private static String getGapicVersion() {
   }
 
   /** Returns a builder for this class with recommended defaults. */
+  @Deprecated
   public static Builder defaultBuilder() {
     return Builder.createDefault();
   }
@@ -206,13 +249,14 @@ public static Builder defaultBuilder() {
    * Returns a builder for this class with recommended defaults for API methods, and the given
    * ClientContext used for executor/transport/credentials.
    */
+  @Deprecated
   public static Builder defaultBuilder(ClientContext clientContext) {
     return new Builder(clientContext);
   }
 
   /** Returns a new builder for this class. */
   public static Builder newBuilder() {
-    return new Builder();
+    return Builder.createDefault();
   }
 
   /** Returns a new builder for this class. */
@@ -237,6 +281,11 @@ private ConfigSettings(Builder settingsBuilder) throws IOException {
     createSinkSettings = settingsBuilder.createSinkSettings().build();
     updateSinkSettings = settingsBuilder.updateSinkSettings().build();
     deleteSinkSettings = settingsBuilder.deleteSinkSettings().build();
+    listExclusionsSettings = settingsBuilder.listExclusionsSettings().build();
+    getExclusionSettings = settingsBuilder.getExclusionSettings().build();
+    createExclusionSettings = settingsBuilder.createExclusionSettings().build();
+    updateExclusionSettings = settingsBuilder.updateExclusionSettings().build();
+    deleteExclusionSettings = settingsBuilder.deleteExclusionSettings().build();
   }
 
   private static final PagedListDescriptor
@@ -273,6 +322,42 @@ public Iterable extractResources(ListSinksResponse payload) {
             }
           };
 
+  private static final PagedListDescriptor<
+          ListExclusionsRequest, ListExclusionsResponse, LogExclusion>
+      LIST_EXCLUSIONS_PAGE_STR_DESC =
+          new PagedListDescriptor() {
+            @Override
+            public String emptyToken() {
+              return "";
+            }
+
+            @Override
+            public ListExclusionsRequest injectToken(ListExclusionsRequest payload, String token) {
+              return ListExclusionsRequest.newBuilder(payload).setPageToken(token).build();
+            }
+
+            @Override
+            public ListExclusionsRequest injectPageSize(
+                ListExclusionsRequest payload, int pageSize) {
+              return ListExclusionsRequest.newBuilder(payload).setPageSize(pageSize).build();
+            }
+
+            @Override
+            public Integer extractPageSize(ListExclusionsRequest payload) {
+              return payload.getPageSize();
+            }
+
+            @Override
+            public String extractNextToken(ListExclusionsResponse payload) {
+              return payload.getNextPageToken();
+            }
+
+            @Override
+            public Iterable extractResources(ListExclusionsResponse payload) {
+              return payload.getExclusionsList();
+            }
+          };
+
   private static final PagedListResponseFactory<
           ListSinksRequest, ListSinksResponse, ListSinksPagedResponse>
       LIST_SINKS_PAGE_STR_FACT =
@@ -290,6 +375,23 @@ public ApiFuture getFuturePagedResponse(
             }
           };
 
+  private static final PagedListResponseFactory<
+          ListExclusionsRequest, ListExclusionsResponse, ListExclusionsPagedResponse>
+      LIST_EXCLUSIONS_PAGE_STR_FACT =
+          new PagedListResponseFactory<
+              ListExclusionsRequest, ListExclusionsResponse, ListExclusionsPagedResponse>() {
+            @Override
+            public ApiFuture getFuturePagedResponse(
+                UnaryCallable callable,
+                ListExclusionsRequest request,
+                ApiCallContext context,
+                ApiFuture futureResponse) {
+              PageContext pageContext =
+                  PageContext.create(callable, LIST_EXCLUSIONS_PAGE_STR_DESC, request, context);
+              return ListExclusionsPagedResponse.createAsync(pageContext, futureResponse);
+            }
+          };
+
   /** Builder for ConfigSettings. */
   public static class Builder extends ClientSettings.Builder {
     private final ImmutableList unaryMethodSettingsBuilders;
@@ -301,6 +403,16 @@ public static class Builder extends ClientSettings.Builder {
     private final SimpleCallSettings.Builder createSinkSettings;
     private final SimpleCallSettings.Builder updateSinkSettings;
     private final SimpleCallSettings.Builder deleteSinkSettings;
+    private final PagedCallSettings.Builder<
+            ListExclusionsRequest, ListExclusionsResponse, ListExclusionsPagedResponse>
+        listExclusionsSettings;
+    private final SimpleCallSettings.Builder
+        getExclusionSettings;
+    private final SimpleCallSettings.Builder
+        createExclusionSettings;
+    private final SimpleCallSettings.Builder
+        updateExclusionSettings;
+    private final SimpleCallSettings.Builder deleteExclusionSettings;
 
     private static final ImmutableMap> RETRYABLE_CODE_DEFINITIONS;
 
@@ -327,12 +439,23 @@ public static class Builder extends ClientSettings.Builder {
               .setInitialRetryDelay(Duration.ofMillis(100L))
               .setRetryDelayMultiplier(1.2)
               .setMaxRetryDelay(Duration.ofMillis(1000L))
-              .setInitialRpcTimeout(Duration.ofMillis(2000L))
+              .setInitialRpcTimeout(Duration.ofMillis(30000L))
               .setRpcTimeoutMultiplier(1.5)
-              .setMaxRpcTimeout(Duration.ofMillis(30000L))
-              .setTotalTimeout(Duration.ofMillis(45000L))
+              .setMaxRpcTimeout(Duration.ofMillis(60000L))
+              .setTotalTimeout(Duration.ofMillis(90000L))
               .build();
       definitions.put("default", settings);
+      settings =
+          RetrySettings.newBuilder()
+              .setInitialRetryDelay(Duration.ofMillis(100L))
+              .setRetryDelayMultiplier(1.2)
+              .setMaxRetryDelay(Duration.ofMillis(1000L))
+              .setInitialRpcTimeout(Duration.ofMillis(30000L))
+              .setRpcTimeoutMultiplier(1.5)
+              .setMaxRpcTimeout(Duration.ofMillis(60000L))
+              .setTotalTimeout(Duration.ofMillis(120000L))
+              .build();
+      definitions.put("write_sink", settings);
       RETRY_PARAM_DEFINITIONS = definitions.build();
     }
 
@@ -353,13 +476,28 @@ private Builder(ClientContext clientContext) {
 
       deleteSinkSettings = SimpleCallSettings.newBuilder();
 
+      listExclusionsSettings = PagedCallSettings.newBuilder(LIST_EXCLUSIONS_PAGE_STR_FACT);
+
+      getExclusionSettings = SimpleCallSettings.newBuilder();
+
+      createExclusionSettings = SimpleCallSettings.newBuilder();
+
+      updateExclusionSettings = SimpleCallSettings.newBuilder();
+
+      deleteExclusionSettings = SimpleCallSettings.newBuilder();
+
       unaryMethodSettingsBuilders =
           ImmutableList.of(
               listSinksSettings,
               getSinkSettings,
               createSinkSettings,
               updateSinkSettings,
-              deleteSinkSettings);
+              deleteSinkSettings,
+              listExclusionsSettings,
+              getExclusionSettings,
+              createExclusionSettings,
+              updateExclusionSettings,
+              deleteExclusionSettings);
 
       initDefaults(this);
     }
@@ -398,6 +536,31 @@ private static Builder initDefaults(Builder builder) {
           .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent"))
           .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default"));
 
+      builder
+          .listExclusionsSettings()
+          .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent"))
+          .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default"));
+
+      builder
+          .getExclusionSettings()
+          .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent"))
+          .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default"));
+
+      builder
+          .createExclusionSettings()
+          .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent"))
+          .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default"));
+
+      builder
+          .updateExclusionSettings()
+          .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent"))
+          .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default"));
+
+      builder
+          .deleteExclusionSettings()
+          .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent"))
+          .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default"));
+
       return builder;
     }
 
@@ -409,6 +572,11 @@ private Builder(ConfigSettings settings) {
       createSinkSettings = settings.createSinkSettings.toBuilder();
       updateSinkSettings = settings.updateSinkSettings.toBuilder();
       deleteSinkSettings = settings.deleteSinkSettings.toBuilder();
+      listExclusionsSettings = settings.listExclusionsSettings.toBuilder();
+      getExclusionSettings = settings.getExclusionSettings.toBuilder();
+      createExclusionSettings = settings.createExclusionSettings.toBuilder();
+      updateExclusionSettings = settings.updateExclusionSettings.toBuilder();
+      deleteExclusionSettings = settings.deleteExclusionSettings.toBuilder();
 
       unaryMethodSettingsBuilders =
           ImmutableList.of(
@@ -416,7 +584,12 @@ private Builder(ConfigSettings settings) {
               getSinkSettings,
               createSinkSettings,
               updateSinkSettings,
-              deleteSinkSettings);
+              deleteSinkSettings,
+              listExclusionsSettings,
+              getExclusionSettings,
+              createExclusionSettings,
+              updateExclusionSettings,
+              deleteExclusionSettings);
     }
 
     @Override
@@ -474,6 +647,35 @@ public SimpleCallSettings.Builder deleteSinkSettings()
       return deleteSinkSettings;
     }
 
+    /** Returns the builder for the settings used for calls to listExclusions. */
+    public PagedCallSettings.Builder<
+            ListExclusionsRequest, ListExclusionsResponse, ListExclusionsPagedResponse>
+        listExclusionsSettings() {
+      return listExclusionsSettings;
+    }
+
+    /** Returns the builder for the settings used for calls to getExclusion. */
+    public SimpleCallSettings.Builder getExclusionSettings() {
+      return getExclusionSettings;
+    }
+
+    /** Returns the builder for the settings used for calls to createExclusion. */
+    public SimpleCallSettings.Builder
+        createExclusionSettings() {
+      return createExclusionSettings;
+    }
+
+    /** Returns the builder for the settings used for calls to updateExclusion. */
+    public SimpleCallSettings.Builder
+        updateExclusionSettings() {
+      return updateExclusionSettings;
+    }
+
+    /** Returns the builder for the settings used for calls to deleteExclusion. */
+    public SimpleCallSettings.Builder deleteExclusionSettings() {
+      return deleteExclusionSettings;
+    }
+
     @Override
     public ConfigSettings build() throws IOException {
       return new ConfigSettings(this);
diff --git a/google-cloud-logging/src/main/java/com/google/cloud/logging/v2/LoggingClient.java b/google-cloud-logging/src/main/java/com/google/cloud/logging/v2/LoggingClient.java
index 9197bbc9a221..8908a912c468 100644
--- a/google-cloud-logging/src/main/java/com/google/cloud/logging/v2/LoggingClient.java
+++ b/google-cloud-logging/src/main/java/com/google/cloud/logging/v2/LoggingClient.java
@@ -90,7 +90,7 @@
  * 
  * 
  * LoggingSettings loggingSettings =
- *     LoggingSettings.defaultBuilder()
+ *     LoggingSettings.newBuilder()
  *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
  *         .build();
  * LoggingClient loggingClient =
@@ -103,7 +103,7 @@
  * 
  * 
  * LoggingSettings loggingSettings =
- *     LoggingSettings.defaultBuilder()
+ *     LoggingSettings.newBuilder()
  *         .setTransportProvider(LoggingSettings.defaultGrpcTransportProviderBuilder()
  *             .setChannelProvider(LoggingSettings.defaultGrpcChannelProviderBuilder()
  *                 .setEndpoint(myEndpoint)
@@ -123,7 +123,7 @@ public class LoggingClient implements BackgroundResource {
 
   /** Constructs an instance of LoggingClient with default settings. */
   public static final LoggingClient create() throws IOException {
-    return create(LoggingSettings.defaultBuilder().build());
+    return create(LoggingSettings.newBuilder().build());
   }
 
   /**
@@ -160,6 +160,7 @@ public final LoggingSettings getSettings() {
     return settings;
   }
 
+  @BetaApi
   public LoggingServiceV2Stub getStub() {
     return stub;
   }
@@ -242,7 +243,11 @@ public final UnaryCallable deleteLogCallable() {
 
   // AUTO-GENERATED DOCUMENTATION AND METHOD
   /**
-   * Writes log entries to Stackdriver Logging.
+   * ## Log entry resources
+   *
+   * 

Writes log entries to Stackdriver Logging. This API method is the only way to send log + * entries to Stackdriver Logging. This method is used, directly or indirectly, by the Stackdriver + * Logging agent (fluentd) and all logging libraries configured to use Stackdriver Logging. * *

Sample code: * @@ -272,16 +277,22 @@ public final UnaryCallable deleteLogCallable() { * in `entries`. If a log entry already has a label with the same key as a label in this * parameter, then the log entry's label is not changed. See * [LogEntry][google.logging.v2.LogEntry]. - * @param entries Required. The log entries to write. Values supplied for the fields `log_name`, - * `resource`, and `labels` in this `entries.write` request are inserted into those log - * entries in this list that do not provide their own values. - *

Stackdriver Logging also creates and inserts values for `timestamp` and `insert_id` if - * the entries do not provide them. The created `insert_id` for the N'th entry in this list - * will be greater than earlier entries and less than later entries. Otherwise, the order of - * log entries in this list does not matter. + * @param entries Required. The log entries to send to Stackdriver Logging. The order of log + * entries in this list does not matter. Values supplied in this method's `log_name`, + * `resource`, and `labels` fields are copied into those log entries in this list that do not + * include values for their corresponding fields. For more information, see the + * [LogEntry][google.logging.v2.LogEntry] type. + *

If the `timestamp` or `insert_id` fields are missing in log entries, then this method + * supplies the current time or a unique identifier, respectively. The supplied values are + * chosen so that, among the log entries that did not supply their own values, the entries + * earlier in the list will sort before the entries later in the list. See the `entries.list` + * method. + *

Log entries with timestamps that are more than the [logs retention + * period](/logging/quota-policy) in the past or more than 24 hours in the future might be + * discarded. Discarding does not return an error. *

To improve throughput and to avoid exceeding the [quota limit](/logging/quota-policy) - * for calls to `entries.write`, you should write multiple log entries at once rather than - * calling this method for each individual log entry. + * for calls to `entries.write`, you should try to include several log entries in this list, + * rather than calling this method for each individual log entry. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final WriteLogEntriesResponse writeLogEntries( @@ -302,7 +313,11 @@ public final WriteLogEntriesResponse writeLogEntries( // AUTO-GENERATED DOCUMENTATION AND METHOD /** - * Writes log entries to Stackdriver Logging. + * ## Log entry resources + * + *

Writes log entries to Stackdriver Logging. This API method is the only way to send log + * entries to Stackdriver Logging. This method is used, directly or indirectly, by the Stackdriver + * Logging agent (fluentd) and all logging libraries configured to use Stackdriver Logging. * *

Sample code: * @@ -325,7 +340,11 @@ public final WriteLogEntriesResponse writeLogEntries(WriteLogEntriesRequest requ // AUTO-GENERATED DOCUMENTATION AND METHOD /** - * Writes log entries to Stackdriver Logging. + * ## Log entry resources + * + *

Writes log entries to Stackdriver Logging. This API method is the only way to send log + * entries to Stackdriver Logging. This method is used, directly or indirectly, by the Stackdriver + * Logging agent (fluentd) and all logging libraries configured to use Stackdriver Logging. * *

Sample code: * diff --git a/google-cloud-logging/src/main/java/com/google/cloud/logging/v2/LoggingSettings.java b/google-cloud-logging/src/main/java/com/google/cloud/logging/v2/LoggingSettings.java index 15daecfd4ad6..a95ba58eabe9 100644 --- a/google-cloud-logging/src/main/java/com/google/cloud/logging/v2/LoggingSettings.java +++ b/google-cloud-logging/src/main/java/com/google/cloud/logging/v2/LoggingSettings.java @@ -96,7 +96,7 @@ *

  * 
  * LoggingSettings.Builder loggingSettingsBuilder =
- *     LoggingSettings.defaultBuilder();
+ *     LoggingSettings.newBuilder();
  * loggingSettingsBuilder.deleteLogSettings().getRetrySettingsBuilder()
  *     .setTotalTimeout(Duration.ofSeconds(30));
  * LoggingSettings loggingSettings = loggingSettingsBuilder.build();
@@ -225,6 +225,7 @@ private static String getGapicVersion() {
   }
 
   /** Returns a builder for this class with recommended defaults. */
+  @Deprecated
   public static Builder defaultBuilder() {
     return Builder.createDefault();
   }
@@ -233,13 +234,14 @@ public static Builder defaultBuilder() {
    * Returns a builder for this class with recommended defaults for API methods, and the given
    * ClientContext used for executor/transport/credentials.
    */
+  @Deprecated
   public static Builder defaultBuilder(ClientContext clientContext) {
     return new Builder(clientContext);
   }
 
   /** Returns a new builder for this class. */
   public static Builder newBuilder() {
-    return new Builder();
+    return Builder.createDefault();
   }
 
   /** Returns a new builder for this class. */
@@ -548,10 +550,10 @@ public static class Builder extends ClientSettings.Builder {
               .setInitialRetryDelay(Duration.ofMillis(100L))
               .setRetryDelayMultiplier(1.2)
               .setMaxRetryDelay(Duration.ofMillis(1000L))
-              .setInitialRpcTimeout(Duration.ofMillis(2000L))
+              .setInitialRpcTimeout(Duration.ofMillis(20000L))
               .setRpcTimeoutMultiplier(1.5)
-              .setMaxRpcTimeout(Duration.ofMillis(30000L))
-              .setTotalTimeout(Duration.ofMillis(45000L))
+              .setMaxRpcTimeout(Duration.ofMillis(60000L))
+              .setTotalTimeout(Duration.ofMillis(90000L))
               .build();
       definitions.put("default", settings);
       settings =
@@ -559,10 +561,10 @@ public static class Builder extends ClientSettings.Builder {
               .setInitialRetryDelay(Duration.ofMillis(100L))
               .setRetryDelayMultiplier(1.2)
               .setMaxRetryDelay(Duration.ofMillis(1000L))
-              .setInitialRpcTimeout(Duration.ofMillis(7000L))
+              .setInitialRpcTimeout(Duration.ofMillis(2000L))
               .setRpcTimeoutMultiplier(1.5)
-              .setMaxRpcTimeout(Duration.ofMillis(30000L))
-              .setTotalTimeout(Duration.ofMillis(45000L))
+              .setMaxRpcTimeout(Duration.ofMillis(10000L))
+              .setTotalTimeout(Duration.ofMillis(20000L))
               .build();
       definitions.put("list", settings);
       RETRY_PARAM_DEFINITIONS = definitions.build();
diff --git a/google-cloud-logging/src/main/java/com/google/cloud/logging/v2/MetricsClient.java b/google-cloud-logging/src/main/java/com/google/cloud/logging/v2/MetricsClient.java
index ed74cc8d45eb..208291c8bd0f 100644
--- a/google-cloud-logging/src/main/java/com/google/cloud/logging/v2/MetricsClient.java
+++ b/google-cloud-logging/src/main/java/com/google/cloud/logging/v2/MetricsClient.java
@@ -82,7 +82,7 @@
  * 
  * 
  * MetricsSettings metricsSettings =
- *     MetricsSettings.defaultBuilder()
+ *     MetricsSettings.newBuilder()
  *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
  *         .build();
  * MetricsClient metricsClient =
@@ -95,7 +95,7 @@
  * 
  * 
  * MetricsSettings metricsSettings =
- *     MetricsSettings.defaultBuilder()
+ *     MetricsSettings.newBuilder()
  *         .setTransportProvider(MetricsSettings.defaultGrpcTransportProviderBuilder()
  *             .setChannelProvider(MetricsSettings.defaultGrpcChannelProviderBuilder()
  *                 .setEndpoint(myEndpoint)
@@ -115,7 +115,7 @@ public class MetricsClient implements BackgroundResource {
 
   /** Constructs an instance of MetricsClient with default settings. */
   public static final MetricsClient create() throws IOException {
-    return create(MetricsSettings.defaultBuilder().build());
+    return create(MetricsSettings.newBuilder().build());
   }
 
   /**
@@ -152,6 +152,7 @@ public final MetricsSettings getSettings() {
     return settings;
   }
 
+  @BetaApi
   public MetricsServiceV2Stub getStub() {
     return stub;
   }
diff --git a/google-cloud-logging/src/main/java/com/google/cloud/logging/v2/MetricsSettings.java b/google-cloud-logging/src/main/java/com/google/cloud/logging/v2/MetricsSettings.java
index 684956b889c4..09ae02cba437 100644
--- a/google-cloud-logging/src/main/java/com/google/cloud/logging/v2/MetricsSettings.java
+++ b/google-cloud-logging/src/main/java/com/google/cloud/logging/v2/MetricsSettings.java
@@ -81,7 +81,7 @@
  * 
  * 
  * MetricsSettings.Builder metricsSettingsBuilder =
- *     MetricsSettings.defaultBuilder();
+ *     MetricsSettings.newBuilder();
  * metricsSettingsBuilder.getLogMetricSettings().getRetrySettingsBuilder()
  *     .setTotalTimeout(Duration.ofSeconds(30));
  * MetricsSettings metricsSettings = metricsSettingsBuilder.build();
@@ -200,6 +200,7 @@ private static String getGapicVersion() {
   }
 
   /** Returns a builder for this class with recommended defaults. */
+  @Deprecated
   public static Builder defaultBuilder() {
     return Builder.createDefault();
   }
@@ -208,13 +209,14 @@ public static Builder defaultBuilder() {
    * Returns a builder for this class with recommended defaults for API methods, and the given
    * ClientContext used for executor/transport/credentials.
    */
+  @Deprecated
   public static Builder defaultBuilder(ClientContext clientContext) {
     return new Builder(clientContext);
   }
 
   /** Returns a new builder for this class. */
   public static Builder newBuilder() {
-    return new Builder();
+    return Builder.createDefault();
   }
 
   /** Returns a new builder for this class. */
@@ -332,10 +334,10 @@ public static class Builder extends ClientSettings.Builder {
               .setInitialRetryDelay(Duration.ofMillis(100L))
               .setRetryDelayMultiplier(1.2)
               .setMaxRetryDelay(Duration.ofMillis(1000L))
-              .setInitialRpcTimeout(Duration.ofMillis(2000L))
+              .setInitialRpcTimeout(Duration.ofMillis(20000L))
               .setRpcTimeoutMultiplier(1.5)
-              .setMaxRpcTimeout(Duration.ofMillis(30000L))
-              .setTotalTimeout(Duration.ofMillis(45000L))
+              .setMaxRpcTimeout(Duration.ofMillis(60000L))
+              .setTotalTimeout(Duration.ofMillis(90000L))
               .build();
       definitions.put("default", settings);
       RETRY_PARAM_DEFINITIONS = definitions.build();
diff --git a/google-cloud-logging/src/main/java/com/google/cloud/logging/v2/PagedResponseWrappers.java b/google-cloud-logging/src/main/java/com/google/cloud/logging/v2/PagedResponseWrappers.java
index 1b164085efaf..14d053274ed8 100644
--- a/google-cloud-logging/src/main/java/com/google/cloud/logging/v2/PagedResponseWrappers.java
+++ b/google-cloud-logging/src/main/java/com/google/cloud/logging/v2/PagedResponseWrappers.java
@@ -24,6 +24,8 @@
 import com.google.api.gax.paging.AbstractPage;
 import com.google.api.gax.paging.AbstractPagedListResponse;
 import com.google.api.gax.rpc.PageContext;
+import com.google.logging.v2.ListExclusionsRequest;
+import com.google.logging.v2.ListExclusionsResponse;
 import com.google.logging.v2.ListLogEntriesRequest;
 import com.google.logging.v2.ListLogEntriesResponse;
 import com.google.logging.v2.ListLogMetricsRequest;
@@ -35,6 +37,7 @@
 import com.google.logging.v2.ListSinksRequest;
 import com.google.logging.v2.ListSinksResponse;
 import com.google.logging.v2.LogEntry;
+import com.google.logging.v2.LogExclusion;
 import com.google.logging.v2.LogMetric;
 import com.google.logging.v2.LogSink;
 import java.util.List;
@@ -361,6 +364,80 @@ protected ListSinksFixedSizeCollection createCollection(
     }
   }
 
+  public static class ListExclusionsPagedResponse
+      extends AbstractPagedListResponse<
+          ListExclusionsRequest, ListExclusionsResponse, LogExclusion, ListExclusionsPage,
+          ListExclusionsFixedSizeCollection> {
+
+    public static ApiFuture createAsync(
+        PageContext context,
+        ApiFuture futureResponse) {
+      ApiFuture futurePage =
+          ListExclusionsPage.createEmptyPage().createPageAsync(context, futureResponse);
+      return ApiFutures.transform(
+          futurePage,
+          new ApiFunction() {
+            @Override
+            public ListExclusionsPagedResponse apply(ListExclusionsPage input) {
+              return new ListExclusionsPagedResponse(input);
+            }
+          });
+    }
+
+    private ListExclusionsPagedResponse(ListExclusionsPage page) {
+      super(page, ListExclusionsFixedSizeCollection.createEmptyCollection());
+    }
+  }
+
+  public static class ListExclusionsPage
+      extends AbstractPage<
+          ListExclusionsRequest, ListExclusionsResponse, LogExclusion, ListExclusionsPage> {
+
+    private ListExclusionsPage(
+        PageContext context,
+        ListExclusionsResponse response) {
+      super(context, response);
+    }
+
+    private static ListExclusionsPage createEmptyPage() {
+      return new ListExclusionsPage(null, null);
+    }
+
+    @Override
+    protected ListExclusionsPage createPage(
+        PageContext context,
+        ListExclusionsResponse response) {
+      return new ListExclusionsPage(context, response);
+    }
+
+    @Override
+    public ApiFuture createPageAsync(
+        PageContext context,
+        ApiFuture futureResponse) {
+      return super.createPageAsync(context, futureResponse);
+    }
+  }
+
+  public static class ListExclusionsFixedSizeCollection
+      extends AbstractFixedSizeCollection<
+          ListExclusionsRequest, ListExclusionsResponse, LogExclusion, ListExclusionsPage,
+          ListExclusionsFixedSizeCollection> {
+
+    private ListExclusionsFixedSizeCollection(List pages, int collectionSize) {
+      super(pages, collectionSize);
+    }
+
+    private static ListExclusionsFixedSizeCollection createEmptyCollection() {
+      return new ListExclusionsFixedSizeCollection(null, 0);
+    }
+
+    @Override
+    protected ListExclusionsFixedSizeCollection createCollection(
+        List pages, int collectionSize) {
+      return new ListExclusionsFixedSizeCollection(pages, collectionSize);
+    }
+  }
+
   public static class ListLogMetricsPagedResponse
       extends AbstractPagedListResponse<
           ListLogMetricsRequest, ListLogMetricsResponse, LogMetric, ListLogMetricsPage,
diff --git a/google-cloud-logging/src/main/java/com/google/cloud/logging/v2/stub/ConfigServiceV2Stub.java b/google-cloud-logging/src/main/java/com/google/cloud/logging/v2/stub/ConfigServiceV2Stub.java
index eded4f5667ae..b9676b8419a3 100644
--- a/google-cloud-logging/src/main/java/com/google/cloud/logging/v2/stub/ConfigServiceV2Stub.java
+++ b/google-cloud-logging/src/main/java/com/google/cloud/logging/v2/stub/ConfigServiceV2Stub.java
@@ -15,17 +15,25 @@
  */
 package com.google.cloud.logging.v2.stub;
 
+import static com.google.cloud.logging.v2.PagedResponseWrappers.ListExclusionsPagedResponse;
 import static com.google.cloud.logging.v2.PagedResponseWrappers.ListSinksPagedResponse;
 
 import com.google.api.core.BetaApi;
 import com.google.api.gax.core.BackgroundResource;
 import com.google.api.gax.rpc.UnaryCallable;
+import com.google.logging.v2.CreateExclusionRequest;
 import com.google.logging.v2.CreateSinkRequest;
+import com.google.logging.v2.DeleteExclusionRequest;
 import com.google.logging.v2.DeleteSinkRequest;
+import com.google.logging.v2.GetExclusionRequest;
 import com.google.logging.v2.GetSinkRequest;
+import com.google.logging.v2.ListExclusionsRequest;
+import com.google.logging.v2.ListExclusionsResponse;
 import com.google.logging.v2.ListSinksRequest;
 import com.google.logging.v2.ListSinksResponse;
+import com.google.logging.v2.LogExclusion;
 import com.google.logging.v2.LogSink;
+import com.google.logging.v2.UpdateExclusionRequest;
 import com.google.logging.v2.UpdateSinkRequest;
 import com.google.protobuf.Empty;
 import javax.annotation.Generated;
@@ -63,4 +71,29 @@ public UnaryCallable updateSinkCallable() {
   public UnaryCallable deleteSinkCallable() {
     throw new UnsupportedOperationException("Not implemented: deleteSinkCallable()");
   }
+
+  public UnaryCallable
+      listExclusionsPagedCallable() {
+    throw new UnsupportedOperationException("Not implemented: listExclusionsPagedCallable()");
+  }
+
+  public UnaryCallable listExclusionsCallable() {
+    throw new UnsupportedOperationException("Not implemented: listExclusionsCallable()");
+  }
+
+  public UnaryCallable getExclusionCallable() {
+    throw new UnsupportedOperationException("Not implemented: getExclusionCallable()");
+  }
+
+  public UnaryCallable createExclusionCallable() {
+    throw new UnsupportedOperationException("Not implemented: createExclusionCallable()");
+  }
+
+  public UnaryCallable updateExclusionCallable() {
+    throw new UnsupportedOperationException("Not implemented: updateExclusionCallable()");
+  }
+
+  public UnaryCallable deleteExclusionCallable() {
+    throw new UnsupportedOperationException("Not implemented: deleteExclusionCallable()");
+  }
 }
diff --git a/google-cloud-logging/src/main/java/com/google/cloud/logging/v2/stub/GrpcConfigServiceV2Stub.java b/google-cloud-logging/src/main/java/com/google/cloud/logging/v2/stub/GrpcConfigServiceV2Stub.java
index bfb0bb1a9164..f348cd2d7c54 100644
--- a/google-cloud-logging/src/main/java/com/google/cloud/logging/v2/stub/GrpcConfigServiceV2Stub.java
+++ b/google-cloud-logging/src/main/java/com/google/cloud/logging/v2/stub/GrpcConfigServiceV2Stub.java
@@ -15,6 +15,7 @@
  */
 package com.google.cloud.logging.v2.stub;
 
+import static com.google.cloud.logging.v2.PagedResponseWrappers.ListExclusionsPagedResponse;
 import static com.google.cloud.logging.v2.PagedResponseWrappers.ListSinksPagedResponse;
 
 import com.google.api.core.BetaApi;
@@ -24,12 +25,19 @@
 import com.google.api.gax.rpc.ClientContext;
 import com.google.api.gax.rpc.UnaryCallable;
 import com.google.cloud.logging.v2.ConfigSettings;
+import com.google.logging.v2.CreateExclusionRequest;
 import com.google.logging.v2.CreateSinkRequest;
+import com.google.logging.v2.DeleteExclusionRequest;
 import com.google.logging.v2.DeleteSinkRequest;
+import com.google.logging.v2.GetExclusionRequest;
 import com.google.logging.v2.GetSinkRequest;
+import com.google.logging.v2.ListExclusionsRequest;
+import com.google.logging.v2.ListExclusionsResponse;
 import com.google.logging.v2.ListSinksRequest;
 import com.google.logging.v2.ListSinksResponse;
+import com.google.logging.v2.LogExclusion;
 import com.google.logging.v2.LogSink;
+import com.google.logging.v2.UpdateExclusionRequest;
 import com.google.logging.v2.UpdateSinkRequest;
 import com.google.protobuf.Empty;
 import java.io.IOException;
@@ -80,6 +88,48 @@ public class GrpcConfigServiceV2Stub extends ConfigServiceV2Stub {
               "google.logging.v2.ConfigServiceV2/DeleteSink",
               io.grpc.protobuf.ProtoUtils.marshaller(DeleteSinkRequest.getDefaultInstance()),
               io.grpc.protobuf.ProtoUtils.marshaller(Empty.getDefaultInstance())));
+  private static final UnaryCallable
+      directListExclusionsCallable =
+          GrpcCallableFactory.createDirectCallable(
+              io.grpc.MethodDescriptor.create(
+                  io.grpc.MethodDescriptor.MethodType.UNARY,
+                  "google.logging.v2.ConfigServiceV2/ListExclusions",
+                  io.grpc.protobuf.ProtoUtils.marshaller(
+                      ListExclusionsRequest.getDefaultInstance()),
+                  io.grpc.protobuf.ProtoUtils.marshaller(
+                      ListExclusionsResponse.getDefaultInstance())));
+  private static final UnaryCallable directGetExclusionCallable =
+      GrpcCallableFactory.createDirectCallable(
+          io.grpc.MethodDescriptor.create(
+              io.grpc.MethodDescriptor.MethodType.UNARY,
+              "google.logging.v2.ConfigServiceV2/GetExclusion",
+              io.grpc.protobuf.ProtoUtils.marshaller(GetExclusionRequest.getDefaultInstance()),
+              io.grpc.protobuf.ProtoUtils.marshaller(LogExclusion.getDefaultInstance())));
+  private static final UnaryCallable
+      directCreateExclusionCallable =
+          GrpcCallableFactory.createDirectCallable(
+              io.grpc.MethodDescriptor.create(
+                  io.grpc.MethodDescriptor.MethodType.UNARY,
+                  "google.logging.v2.ConfigServiceV2/CreateExclusion",
+                  io.grpc.protobuf.ProtoUtils.marshaller(
+                      CreateExclusionRequest.getDefaultInstance()),
+                  io.grpc.protobuf.ProtoUtils.marshaller(LogExclusion.getDefaultInstance())));
+  private static final UnaryCallable
+      directUpdateExclusionCallable =
+          GrpcCallableFactory.createDirectCallable(
+              io.grpc.MethodDescriptor.create(
+                  io.grpc.MethodDescriptor.MethodType.UNARY,
+                  "google.logging.v2.ConfigServiceV2/UpdateExclusion",
+                  io.grpc.protobuf.ProtoUtils.marshaller(
+                      UpdateExclusionRequest.getDefaultInstance()),
+                  io.grpc.protobuf.ProtoUtils.marshaller(LogExclusion.getDefaultInstance())));
+  private static final UnaryCallable directDeleteExclusionCallable =
+      GrpcCallableFactory.createDirectCallable(
+          io.grpc.MethodDescriptor.create(
+              io.grpc.MethodDescriptor.MethodType.UNARY,
+              "google.logging.v2.ConfigServiceV2/DeleteExclusion",
+              io.grpc.protobuf.ProtoUtils.marshaller(DeleteExclusionRequest.getDefaultInstance()),
+              io.grpc.protobuf.ProtoUtils.marshaller(Empty.getDefaultInstance())));
 
   private final BackgroundResource backgroundResources;
 
@@ -89,6 +139,13 @@ public class GrpcConfigServiceV2Stub extends ConfigServiceV2Stub {
   private final UnaryCallable createSinkCallable;
   private final UnaryCallable updateSinkCallable;
   private final UnaryCallable deleteSinkCallable;
+  private final UnaryCallable listExclusionsCallable;
+  private final UnaryCallable
+      listExclusionsPagedCallable;
+  private final UnaryCallable getExclusionCallable;
+  private final UnaryCallable createExclusionCallable;
+  private final UnaryCallable updateExclusionCallable;
+  private final UnaryCallable deleteExclusionCallable;
 
   public static final GrpcConfigServiceV2Stub create(ConfigSettings settings) throws IOException {
     return new GrpcConfigServiceV2Stub(settings, ClientContext.create(settings));
@@ -96,7 +153,7 @@ public static final GrpcConfigServiceV2Stub create(ConfigSettings settings) thro
 
   public static final GrpcConfigServiceV2Stub create(ClientContext clientContext)
       throws IOException {
-    return new GrpcConfigServiceV2Stub(ConfigSettings.defaultBuilder().build(), clientContext);
+    return new GrpcConfigServiceV2Stub(ConfigSettings.newBuilder().build(), clientContext);
   }
 
   /**
@@ -125,6 +182,24 @@ protected GrpcConfigServiceV2Stub(ConfigSettings settings, ClientContext clientC
     this.deleteSinkCallable =
         GrpcCallableFactory.create(
             directDeleteSinkCallable, settings.deleteSinkSettings(), clientContext);
+    this.listExclusionsCallable =
+        GrpcCallableFactory.create(
+            directListExclusionsCallable, settings.listExclusionsSettings(), clientContext);
+    this.listExclusionsPagedCallable =
+        GrpcCallableFactory.createPagedVariant(
+            directListExclusionsCallable, settings.listExclusionsSettings(), clientContext);
+    this.getExclusionCallable =
+        GrpcCallableFactory.create(
+            directGetExclusionCallable, settings.getExclusionSettings(), clientContext);
+    this.createExclusionCallable =
+        GrpcCallableFactory.create(
+            directCreateExclusionCallable, settings.createExclusionSettings(), clientContext);
+    this.updateExclusionCallable =
+        GrpcCallableFactory.create(
+            directUpdateExclusionCallable, settings.updateExclusionSettings(), clientContext);
+    this.deleteExclusionCallable =
+        GrpcCallableFactory.create(
+            directDeleteExclusionCallable, settings.deleteExclusionSettings(), clientContext);
 
     backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources());
   }
@@ -153,6 +228,31 @@ public UnaryCallable deleteSinkCallable() {
     return deleteSinkCallable;
   }
 
+  public UnaryCallable
+      listExclusionsPagedCallable() {
+    return listExclusionsPagedCallable;
+  }
+
+  public UnaryCallable listExclusionsCallable() {
+    return listExclusionsCallable;
+  }
+
+  public UnaryCallable getExclusionCallable() {
+    return getExclusionCallable;
+  }
+
+  public UnaryCallable createExclusionCallable() {
+    return createExclusionCallable;
+  }
+
+  public UnaryCallable updateExclusionCallable() {
+    return updateExclusionCallable;
+  }
+
+  public UnaryCallable deleteExclusionCallable() {
+    return deleteExclusionCallable;
+  }
+
   @Override
   public final void close() throws Exception {
     shutdown();
diff --git a/google-cloud-logging/src/main/java/com/google/cloud/logging/v2/stub/GrpcLoggingServiceV2Stub.java b/google-cloud-logging/src/main/java/com/google/cloud/logging/v2/stub/GrpcLoggingServiceV2Stub.java
index d5e54817d5ce..46fea6097fd3 100644
--- a/google-cloud-logging/src/main/java/com/google/cloud/logging/v2/stub/GrpcLoggingServiceV2Stub.java
+++ b/google-cloud-logging/src/main/java/com/google/cloud/logging/v2/stub/GrpcLoggingServiceV2Stub.java
@@ -118,7 +118,7 @@ public static final GrpcLoggingServiceV2Stub create(LoggingSettings settings) th
 
   public static final GrpcLoggingServiceV2Stub create(ClientContext clientContext)
       throws IOException {
-    return new GrpcLoggingServiceV2Stub(LoggingSettings.defaultBuilder().build(), clientContext);
+    return new GrpcLoggingServiceV2Stub(LoggingSettings.newBuilder().build(), clientContext);
   }
 
   /**
diff --git a/google-cloud-logging/src/main/java/com/google/cloud/logging/v2/stub/GrpcMetricsServiceV2Stub.java b/google-cloud-logging/src/main/java/com/google/cloud/logging/v2/stub/GrpcMetricsServiceV2Stub.java
index 63c32b11eae1..9b7fbdf455bd 100644
--- a/google-cloud-logging/src/main/java/com/google/cloud/logging/v2/stub/GrpcMetricsServiceV2Stub.java
+++ b/google-cloud-logging/src/main/java/com/google/cloud/logging/v2/stub/GrpcMetricsServiceV2Stub.java
@@ -104,7 +104,7 @@ public static final GrpcMetricsServiceV2Stub create(MetricsSettings settings) th
 
   public static final GrpcMetricsServiceV2Stub create(ClientContext clientContext)
       throws IOException {
-    return new GrpcMetricsServiceV2Stub(MetricsSettings.defaultBuilder().build(), clientContext);
+    return new GrpcMetricsServiceV2Stub(MetricsSettings.newBuilder().build(), clientContext);
   }
 
   /**
diff --git a/google-cloud-logging/src/test/java/com/google/cloud/logging/v2/ConfigClientTest.java b/google-cloud-logging/src/test/java/com/google/cloud/logging/v2/ConfigClientTest.java
index dcd2e29fac0a..948efccc697a 100644
--- a/google-cloud-logging/src/test/java/com/google/cloud/logging/v2/ConfigClientTest.java
+++ b/google-cloud-logging/src/test/java/com/google/cloud/logging/v2/ConfigClientTest.java
@@ -15,6 +15,7 @@
  */
 package com.google.cloud.logging.v2;
 
+import static com.google.cloud.logging.v2.PagedResponseWrappers.ListExclusionsPagedResponse;
 import static com.google.cloud.logging.v2.PagedResponseWrappers.ListSinksPagedResponse;
 
 import com.google.api.gax.core.NoCredentialsProvider;
@@ -24,18 +25,28 @@
 import com.google.api.gax.rpc.InvalidArgumentException;
 import com.google.api.resourcenames.ResourceName;
 import com.google.common.collect.Lists;
+import com.google.logging.v2.CreateExclusionRequest;
 import com.google.logging.v2.CreateSinkRequest;
+import com.google.logging.v2.DeleteExclusionRequest;
 import com.google.logging.v2.DeleteSinkRequest;
+import com.google.logging.v2.ExclusionName;
+import com.google.logging.v2.ExclusionNameOneof;
+import com.google.logging.v2.GetExclusionRequest;
 import com.google.logging.v2.GetSinkRequest;
+import com.google.logging.v2.ListExclusionsRequest;
+import com.google.logging.v2.ListExclusionsResponse;
 import com.google.logging.v2.ListSinksRequest;
 import com.google.logging.v2.ListSinksResponse;
+import com.google.logging.v2.LogExclusion;
 import com.google.logging.v2.LogSink;
 import com.google.logging.v2.ParentNameOneof;
 import com.google.logging.v2.ProjectName;
 import com.google.logging.v2.SinkName;
 import com.google.logging.v2.SinkNameOneof;
+import com.google.logging.v2.UpdateExclusionRequest;
 import com.google.logging.v2.UpdateSinkRequest;
 import com.google.protobuf.Empty;
+import com.google.protobuf.FieldMask;
 import com.google.protobuf.GeneratedMessageV3;
 import io.grpc.Status;
 import io.grpc.StatusRuntimeException;
@@ -79,7 +90,7 @@ public static void stopServer() {
   public void setUp() throws IOException {
     serviceHelper.reset();
     ConfigSettings settings =
-        ConfigSettings.defaultBuilder()
+        ConfigSettings.newBuilder()
             .setTransportProvider(
                 GrpcTransportProvider.newBuilder()
                     .setChannelProvider(serviceHelper.createChannelProvider())
@@ -311,4 +322,228 @@ public void deleteSinkExceptionTest() throws Exception {
       // Expected exception
     }
   }
+
+  @Test
+  @SuppressWarnings("all")
+  public void listExclusionsTest() {
+    String nextPageToken = "";
+    LogExclusion exclusionsElement = LogExclusion.newBuilder().build();
+    List exclusions = Arrays.asList(exclusionsElement);
+    ListExclusionsResponse expectedResponse =
+        ListExclusionsResponse.newBuilder()
+            .setNextPageToken(nextPageToken)
+            .addAllExclusions(exclusions)
+            .build();
+    mockConfigServiceV2.addResponse(expectedResponse);
+
+    ParentNameOneof parent = ParentNameOneof.from(ProjectName.create("[PROJECT]"));
+
+    ListExclusionsPagedResponse pagedListResponse = client.listExclusions(parent);
+
+    List resources = Lists.newArrayList(pagedListResponse.iterateAll());
+    Assert.assertEquals(1, resources.size());
+    Assert.assertEquals(expectedResponse.getExclusionsList().get(0), resources.get(0));
+
+    List actualRequests = mockConfigServiceV2.getRequests();
+    Assert.assertEquals(1, actualRequests.size());
+    ListExclusionsRequest actualRequest = (ListExclusionsRequest) actualRequests.get(0);
+
+    Assert.assertEquals(parent, actualRequest.getParentAsParentNameOneof());
+  }
+
+  @Test
+  @SuppressWarnings("all")
+  public void listExclusionsExceptionTest() throws Exception {
+    StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT);
+    mockConfigServiceV2.addException(exception);
+
+    try {
+      ParentNameOneof parent = ParentNameOneof.from(ProjectName.create("[PROJECT]"));
+
+      client.listExclusions(parent);
+      Assert.fail("No exception raised");
+    } catch (InvalidArgumentException e) {
+      // Expected exception
+    }
+  }
+
+  @Test
+  @SuppressWarnings("all")
+  public void getExclusionTest() {
+    String name2 = "name2-1052831874";
+    String description = "description-1724546052";
+    String filter = "filter-1274492040";
+    boolean disabled = true;
+    LogExclusion expectedResponse =
+        LogExclusion.newBuilder()
+            .setName(name2)
+            .setDescription(description)
+            .setFilter(filter)
+            .setDisabled(disabled)
+            .build();
+    mockConfigServiceV2.addResponse(expectedResponse);
+
+    ExclusionNameOneof name =
+        ExclusionNameOneof.from(ExclusionName.create("[PROJECT]", "[EXCLUSION]"));
+
+    LogExclusion actualResponse = client.getExclusion(name);
+    Assert.assertEquals(expectedResponse, actualResponse);
+
+    List actualRequests = mockConfigServiceV2.getRequests();
+    Assert.assertEquals(1, actualRequests.size());
+    GetExclusionRequest actualRequest = (GetExclusionRequest) actualRequests.get(0);
+
+    Assert.assertEquals(name, actualRequest.getNameAsExclusionNameOneof());
+  }
+
+  @Test
+  @SuppressWarnings("all")
+  public void getExclusionExceptionTest() throws Exception {
+    StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT);
+    mockConfigServiceV2.addException(exception);
+
+    try {
+      ExclusionNameOneof name =
+          ExclusionNameOneof.from(ExclusionName.create("[PROJECT]", "[EXCLUSION]"));
+
+      client.getExclusion(name);
+      Assert.fail("No exception raised");
+    } catch (InvalidArgumentException e) {
+      // Expected exception
+    }
+  }
+
+  @Test
+  @SuppressWarnings("all")
+  public void createExclusionTest() {
+    String name = "name3373707";
+    String description = "description-1724546052";
+    String filter = "filter-1274492040";
+    boolean disabled = true;
+    LogExclusion expectedResponse =
+        LogExclusion.newBuilder()
+            .setName(name)
+            .setDescription(description)
+            .setFilter(filter)
+            .setDisabled(disabled)
+            .build();
+    mockConfigServiceV2.addResponse(expectedResponse);
+
+    ParentNameOneof parent = ParentNameOneof.from(ProjectName.create("[PROJECT]"));
+    LogExclusion exclusion = LogExclusion.newBuilder().build();
+
+    LogExclusion actualResponse = client.createExclusion(parent, exclusion);
+    Assert.assertEquals(expectedResponse, actualResponse);
+
+    List actualRequests = mockConfigServiceV2.getRequests();
+    Assert.assertEquals(1, actualRequests.size());
+    CreateExclusionRequest actualRequest = (CreateExclusionRequest) actualRequests.get(0);
+
+    Assert.assertEquals(parent, actualRequest.getParentAsParentNameOneof());
+    Assert.assertEquals(exclusion, actualRequest.getExclusion());
+  }
+
+  @Test
+  @SuppressWarnings("all")
+  public void createExclusionExceptionTest() throws Exception {
+    StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT);
+    mockConfigServiceV2.addException(exception);
+
+    try {
+      ParentNameOneof parent = ParentNameOneof.from(ProjectName.create("[PROJECT]"));
+      LogExclusion exclusion = LogExclusion.newBuilder().build();
+
+      client.createExclusion(parent, exclusion);
+      Assert.fail("No exception raised");
+    } catch (InvalidArgumentException e) {
+      // Expected exception
+    }
+  }
+
+  @Test
+  @SuppressWarnings("all")
+  public void updateExclusionTest() {
+    String name2 = "name2-1052831874";
+    String description = "description-1724546052";
+    String filter = "filter-1274492040";
+    boolean disabled = true;
+    LogExclusion expectedResponse =
+        LogExclusion.newBuilder()
+            .setName(name2)
+            .setDescription(description)
+            .setFilter(filter)
+            .setDisabled(disabled)
+            .build();
+    mockConfigServiceV2.addResponse(expectedResponse);
+
+    ExclusionNameOneof name =
+        ExclusionNameOneof.from(ExclusionName.create("[PROJECT]", "[EXCLUSION]"));
+    LogExclusion exclusion = LogExclusion.newBuilder().build();
+    FieldMask updateMask = FieldMask.newBuilder().build();
+
+    LogExclusion actualResponse = client.updateExclusion(name, exclusion, updateMask);
+    Assert.assertEquals(expectedResponse, actualResponse);
+
+    List actualRequests = mockConfigServiceV2.getRequests();
+    Assert.assertEquals(1, actualRequests.size());
+    UpdateExclusionRequest actualRequest = (UpdateExclusionRequest) actualRequests.get(0);
+
+    Assert.assertEquals(name, actualRequest.getNameAsExclusionNameOneof());
+    Assert.assertEquals(exclusion, actualRequest.getExclusion());
+    Assert.assertEquals(updateMask, actualRequest.getUpdateMask());
+  }
+
+  @Test
+  @SuppressWarnings("all")
+  public void updateExclusionExceptionTest() throws Exception {
+    StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT);
+    mockConfigServiceV2.addException(exception);
+
+    try {
+      ExclusionNameOneof name =
+          ExclusionNameOneof.from(ExclusionName.create("[PROJECT]", "[EXCLUSION]"));
+      LogExclusion exclusion = LogExclusion.newBuilder().build();
+      FieldMask updateMask = FieldMask.newBuilder().build();
+
+      client.updateExclusion(name, exclusion, updateMask);
+      Assert.fail("No exception raised");
+    } catch (InvalidArgumentException e) {
+      // Expected exception
+    }
+  }
+
+  @Test
+  @SuppressWarnings("all")
+  public void deleteExclusionTest() {
+    Empty expectedResponse = Empty.newBuilder().build();
+    mockConfigServiceV2.addResponse(expectedResponse);
+
+    ExclusionNameOneof name =
+        ExclusionNameOneof.from(ExclusionName.create("[PROJECT]", "[EXCLUSION]"));
+
+    client.deleteExclusion(name);
+
+    List actualRequests = mockConfigServiceV2.getRequests();
+    Assert.assertEquals(1, actualRequests.size());
+    DeleteExclusionRequest actualRequest = (DeleteExclusionRequest) actualRequests.get(0);
+
+    Assert.assertEquals(name, actualRequest.getNameAsExclusionNameOneof());
+  }
+
+  @Test
+  @SuppressWarnings("all")
+  public void deleteExclusionExceptionTest() throws Exception {
+    StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT);
+    mockConfigServiceV2.addException(exception);
+
+    try {
+      ExclusionNameOneof name =
+          ExclusionNameOneof.from(ExclusionName.create("[PROJECT]", "[EXCLUSION]"));
+
+      client.deleteExclusion(name);
+      Assert.fail("No exception raised");
+    } catch (InvalidArgumentException e) {
+      // Expected exception
+    }
+  }
 }
diff --git a/google-cloud-logging/src/test/java/com/google/cloud/logging/v2/LoggingClientTest.java b/google-cloud-logging/src/test/java/com/google/cloud/logging/v2/LoggingClientTest.java
index e75cf39f66ab..17e995ecd8e4 100644
--- a/google-cloud-logging/src/test/java/com/google/cloud/logging/v2/LoggingClientTest.java
+++ b/google-cloud-logging/src/test/java/com/google/cloud/logging/v2/LoggingClientTest.java
@@ -84,7 +84,7 @@ public static void stopServer() {
   public void setUp() throws IOException {
     serviceHelper.reset();
     LoggingSettings settings =
-        LoggingSettings.defaultBuilder()
+        LoggingSettings.newBuilder()
             .setTransportProvider(
                 GrpcTransportProvider.newBuilder()
                     .setChannelProvider(serviceHelper.createChannelProvider())
diff --git a/google-cloud-logging/src/test/java/com/google/cloud/logging/v2/MetricsClientTest.java b/google-cloud-logging/src/test/java/com/google/cloud/logging/v2/MetricsClientTest.java
index 4eaf993f47e3..4c035902eff0 100644
--- a/google-cloud-logging/src/test/java/com/google/cloud/logging/v2/MetricsClientTest.java
+++ b/google-cloud-logging/src/test/java/com/google/cloud/logging/v2/MetricsClientTest.java
@@ -78,7 +78,7 @@ public static void stopServer() {
   public void setUp() throws IOException {
     serviceHelper.reset();
     MetricsSettings settings =
-        MetricsSettings.defaultBuilder()
+        MetricsSettings.newBuilder()
             .setTransportProvider(
                 GrpcTransportProvider.newBuilder()
                     .setChannelProvider(serviceHelper.createChannelProvider())
@@ -143,8 +143,14 @@ public void getLogMetricTest() {
     String name = "name3373707";
     String description = "description-1724546052";
     String filter = "filter-1274492040";
+    String valueExtractor = "valueExtractor2047672534";
     LogMetric expectedResponse =
-        LogMetric.newBuilder().setName(name).setDescription(description).setFilter(filter).build();
+        LogMetric.newBuilder()
+            .setName(name)
+            .setDescription(description)
+            .setFilter(filter)
+            .setValueExtractor(valueExtractor)
+            .build();
     mockMetricsServiceV2.addResponse(expectedResponse);
 
     MetricNameOneof metricName = MetricNameOneof.from(MetricName.create("[PROJECT]", "[METRIC]"));
@@ -181,8 +187,14 @@ public void createLogMetricTest() {
     String name = "name3373707";
     String description = "description-1724546052";
     String filter = "filter-1274492040";
+    String valueExtractor = "valueExtractor2047672534";
     LogMetric expectedResponse =
-        LogMetric.newBuilder().setName(name).setDescription(description).setFilter(filter).build();
+        LogMetric.newBuilder()
+            .setName(name)
+            .setDescription(description)
+            .setFilter(filter)
+            .setValueExtractor(valueExtractor)
+            .build();
     mockMetricsServiceV2.addResponse(expectedResponse);
 
     ParentNameOneof parent = ParentNameOneof.from(ProjectName.create("[PROJECT]"));
@@ -222,8 +234,14 @@ public void updateLogMetricTest() {
     String name = "name3373707";
     String description = "description-1724546052";
     String filter = "filter-1274492040";
+    String valueExtractor = "valueExtractor2047672534";
     LogMetric expectedResponse =
-        LogMetric.newBuilder().setName(name).setDescription(description).setFilter(filter).build();
+        LogMetric.newBuilder()
+            .setName(name)
+            .setDescription(description)
+            .setFilter(filter)
+            .setValueExtractor(valueExtractor)
+            .build();
     mockMetricsServiceV2.addResponse(expectedResponse);
 
     MetricNameOneof metricName = MetricNameOneof.from(MetricName.create("[PROJECT]", "[METRIC]"));
diff --git a/google-cloud-logging/src/test/java/com/google/cloud/logging/v2/MockConfigServiceV2Impl.java b/google-cloud-logging/src/test/java/com/google/cloud/logging/v2/MockConfigServiceV2Impl.java
index 5c59f53aca24..c114747f5b68 100644
--- a/google-cloud-logging/src/test/java/com/google/cloud/logging/v2/MockConfigServiceV2Impl.java
+++ b/google-cloud-logging/src/test/java/com/google/cloud/logging/v2/MockConfigServiceV2Impl.java
@@ -16,12 +16,19 @@
 package com.google.cloud.logging.v2;
 
 import com.google.logging.v2.ConfigServiceV2Grpc.ConfigServiceV2ImplBase;
+import com.google.logging.v2.CreateExclusionRequest;
 import com.google.logging.v2.CreateSinkRequest;
+import com.google.logging.v2.DeleteExclusionRequest;
 import com.google.logging.v2.DeleteSinkRequest;
+import com.google.logging.v2.GetExclusionRequest;
 import com.google.logging.v2.GetSinkRequest;
+import com.google.logging.v2.ListExclusionsRequest;
+import com.google.logging.v2.ListExclusionsResponse;
 import com.google.logging.v2.ListSinksRequest;
 import com.google.logging.v2.ListSinksResponse;
+import com.google.logging.v2.LogExclusion;
 import com.google.logging.v2.LogSink;
+import com.google.logging.v2.UpdateExclusionRequest;
 import com.google.logging.v2.UpdateSinkRequest;
 import com.google.protobuf.Empty;
 import com.google.protobuf.GeneratedMessageV3;
@@ -132,4 +139,79 @@ public void deleteSink(DeleteSinkRequest request, StreamObserver response
       responseObserver.onError(new IllegalArgumentException("Unrecognized response type"));
     }
   }
+
+  @Override
+  public void listExclusions(
+      ListExclusionsRequest request, StreamObserver responseObserver) {
+    Object response = responses.remove();
+    if (response instanceof ListExclusionsResponse) {
+      requests.add(request);
+      responseObserver.onNext((ListExclusionsResponse) response);
+      responseObserver.onCompleted();
+    } else if (response instanceof Exception) {
+      responseObserver.onError((Exception) response);
+    } else {
+      responseObserver.onError(new IllegalArgumentException("Unrecognized response type"));
+    }
+  }
+
+  @Override
+  public void getExclusion(
+      GetExclusionRequest request, StreamObserver responseObserver) {
+    Object response = responses.remove();
+    if (response instanceof LogExclusion) {
+      requests.add(request);
+      responseObserver.onNext((LogExclusion) response);
+      responseObserver.onCompleted();
+    } else if (response instanceof Exception) {
+      responseObserver.onError((Exception) response);
+    } else {
+      responseObserver.onError(new IllegalArgumentException("Unrecognized response type"));
+    }
+  }
+
+  @Override
+  public void createExclusion(
+      CreateExclusionRequest request, StreamObserver responseObserver) {
+    Object response = responses.remove();
+    if (response instanceof LogExclusion) {
+      requests.add(request);
+      responseObserver.onNext((LogExclusion) response);
+      responseObserver.onCompleted();
+    } else if (response instanceof Exception) {
+      responseObserver.onError((Exception) response);
+    } else {
+      responseObserver.onError(new IllegalArgumentException("Unrecognized response type"));
+    }
+  }
+
+  @Override
+  public void updateExclusion(
+      UpdateExclusionRequest request, StreamObserver responseObserver) {
+    Object response = responses.remove();
+    if (response instanceof LogExclusion) {
+      requests.add(request);
+      responseObserver.onNext((LogExclusion) response);
+      responseObserver.onCompleted();
+    } else if (response instanceof Exception) {
+      responseObserver.onError((Exception) response);
+    } else {
+      responseObserver.onError(new IllegalArgumentException("Unrecognized response type"));
+    }
+  }
+
+  @Override
+  public void deleteExclusion(
+      DeleteExclusionRequest request, StreamObserver responseObserver) {
+    Object response = responses.remove();
+    if (response instanceof Empty) {
+      requests.add(request);
+      responseObserver.onNext((Empty) response);
+      responseObserver.onCompleted();
+    } else if (response instanceof Exception) {
+      responseObserver.onError((Exception) response);
+    } else {
+      responseObserver.onError(new IllegalArgumentException("Unrecognized response type"));
+    }
+  }
 }
diff --git a/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/SubscriptionAdminSettings.java b/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/SubscriptionAdminSettings.java
index 9bdb54160385..7a2c0622b5b3 100644
--- a/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/SubscriptionAdminSettings.java
+++ b/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/SubscriptionAdminSettings.java
@@ -523,8 +523,8 @@ public static class Builder extends ClientSettings.Builder {
               Lists.newArrayList(
                   GrpcStatusCode.of(Status.Code.CANCELLED),
                   GrpcStatusCode.of(Status.Code.DEADLINE_EXCEEDED),
-                  GrpcStatusCode.of(Status.Code.RESOURCE_EXHAUSTED),
                   GrpcStatusCode.of(Status.Code.INTERNAL),
+                  GrpcStatusCode.of(Status.Code.RESOURCE_EXHAUSTED),
                   GrpcStatusCode.of(Status.Code.UNAVAILABLE))));
       RETRYABLE_CODE_DEFINITIONS = definitions.build();
     }
diff --git a/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/TopicAdminSettings.java b/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/TopicAdminSettings.java
index 44e59ed42c9c..8d9f54a702c1 100644
--- a/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/TopicAdminSettings.java
+++ b/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/TopicAdminSettings.java
@@ -515,13 +515,13 @@ public static class Builder extends ClientSettings.Builder {
           "one_plus_delivery",
           ImmutableSet.copyOf(
               Lists.newArrayList(
+                  GrpcStatusCode.of(Status.Code.ABORTED),
                   GrpcStatusCode.of(Status.Code.CANCELLED),
-                  GrpcStatusCode.of(Status.Code.UNKNOWN),
                   GrpcStatusCode.of(Status.Code.DEADLINE_EXCEEDED),
-                  GrpcStatusCode.of(Status.Code.RESOURCE_EXHAUSTED),
-                  GrpcStatusCode.of(Status.Code.ABORTED),
                   GrpcStatusCode.of(Status.Code.INTERNAL),
-                  GrpcStatusCode.of(Status.Code.UNAVAILABLE))));
+                  GrpcStatusCode.of(Status.Code.RESOURCE_EXHAUSTED),
+                  GrpcStatusCode.of(Status.Code.UNAVAILABLE),
+                  GrpcStatusCode.of(Status.Code.UNKNOWN))));
       definitions.put("non_idempotent", ImmutableSet.copyOf(Lists.newArrayList()));
       RETRYABLE_CODE_DEFINITIONS = definitions.build();
     }
diff --git a/google-cloud-video-intelligence/src/main/java/com/google/cloud/videointelligence/v1beta1/VideoIntelligenceServiceClient.java b/google-cloud-video-intelligence/src/main/java/com/google/cloud/videointelligence/v1beta1/VideoIntelligenceServiceClient.java
index 2fd407ca7e97..c72b79c0a4ef 100644
--- a/google-cloud-video-intelligence/src/main/java/com/google/cloud/videointelligence/v1beta1/VideoIntelligenceServiceClient.java
+++ b/google-cloud-video-intelligence/src/main/java/com/google/cloud/videointelligence/v1beta1/VideoIntelligenceServiceClient.java
@@ -38,12 +38,10 @@
  * 
  * 
  * try (VideoIntelligenceServiceClient videoIntelligenceServiceClient = VideoIntelligenceServiceClient.create()) {
- *   String inputUri = "";
- *   List<Feature> features = new ArrayList<>();
- *   VideoContext videoContext = VideoContext.newBuilder().build();
- *   String outputUri = "";
- *   String locationId = "";
- *   AnnotateVideoResponse response = videoIntelligenceServiceClient.annotateVideoAsync(inputUri, features, videoContext, outputUri, locationId).get();
+ *   String inputUri = "gs://demomaker/cat.mp4";
+ *   Feature featuresElement = Feature.LABEL_DETECTION;
+ *   List<Feature> features = Arrays.asList(featuresElement);
+ *   AnnotateVideoResponse response = videoIntelligenceServiceClient.annotateVideoAsync(inputUri, features).get();
  * }
  * 
  * 
@@ -181,12 +179,10 @@ public final OperationsClient getOperationsClient() { * *

    * try (VideoIntelligenceServiceClient videoIntelligenceServiceClient = VideoIntelligenceServiceClient.create()) {
-   *   String inputUri = "";
-   *   List<Feature> features = new ArrayList<>();
-   *   VideoContext videoContext = VideoContext.newBuilder().build();
-   *   String outputUri = "";
-   *   String locationId = "";
-   *   AnnotateVideoResponse response = videoIntelligenceServiceClient.annotateVideoAsync(inputUri, features, videoContext, outputUri, locationId).get();
+   *   String inputUri = "gs://demomaker/cat.mp4";
+   *   Feature featuresElement = Feature.LABEL_DETECTION;
+   *   List<Feature> features = Arrays.asList(featuresElement);
+   *   AnnotateVideoResponse response = videoIntelligenceServiceClient.annotateVideoAsync(inputUri, features).get();
    * }
    * 
* @@ -199,34 +195,13 @@ public final OperationsClient getOperationsClient() { * to match 0 or more characters; '?' to match 1 character. If unset, the input video should * be embedded in the request as `input_content`. If set, `input_content` should be unset. * @param features Requested video annotation features. - * @param videoContext Additional video context and/or feature-specific parameters. - * @param outputUri Optional location where the output (in JSON format) should be stored. - * Currently, only [Google Cloud Storage](https://cloud.google.com/storage/) URIs are - * supported, which must be specified in the following format: `gs://bucket-id/object-id` - * (other URI formats return - * [google.rpc.Code.INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT]). For more - * information, see [Request URIs](/storage/docs/reference-uris). - * @param locationId Optional cloud region where annotation should take place. Supported cloud - * regions: `us-east1`, `us-west1`, `europe-west1`, `asia-east1`. If no region is specified, a - * region will be determined based on video file location. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final OperationFuture - annotateVideoAsync( - String inputUri, - List features, - VideoContext videoContext, - String outputUri, - String locationId) { + annotateVideoAsync(String inputUri, List features) { AnnotateVideoRequest request = - AnnotateVideoRequest.newBuilder() - .setInputUri(inputUri) - .addAllFeatures(features) - .setVideoContext(videoContext) - .setOutputUri(outputUri) - .setLocationId(locationId) - .build(); + AnnotateVideoRequest.newBuilder().setInputUri(inputUri).addAllFeatures(features).build(); return annotateVideoAsync(request); } @@ -241,8 +216,9 @@ public final OperationsClient getOperationsClient() { * *

    * try (VideoIntelligenceServiceClient videoIntelligenceServiceClient = VideoIntelligenceServiceClient.create()) {
-   *   String inputUri = "";
-   *   List<Feature> features = new ArrayList<>();
+   *   String inputUri = "gs://demomaker/cat.mp4";
+   *   Feature featuresElement = Feature.LABEL_DETECTION;
+   *   List<Feature> features = Arrays.asList(featuresElement);
    *   AnnotateVideoRequest request = AnnotateVideoRequest.newBuilder()
    *     .setInputUri(inputUri)
    *     .addAllFeatures(features)
@@ -270,8 +246,9 @@ public final OperationsClient getOperationsClient() {
    *
    * 

    * try (VideoIntelligenceServiceClient videoIntelligenceServiceClient = VideoIntelligenceServiceClient.create()) {
-   *   String inputUri = "";
-   *   List<Feature> features = new ArrayList<>();
+   *   String inputUri = "gs://demomaker/cat.mp4";
+   *   Feature featuresElement = Feature.LABEL_DETECTION;
+   *   List<Feature> features = Arrays.asList(featuresElement);
    *   AnnotateVideoRequest request = AnnotateVideoRequest.newBuilder()
    *     .setInputUri(inputUri)
    *     .addAllFeatures(features)
@@ -299,8 +276,9 @@ public final OperationsClient getOperationsClient() {
    *
    * 

    * try (VideoIntelligenceServiceClient videoIntelligenceServiceClient = VideoIntelligenceServiceClient.create()) {
-   *   String inputUri = "";
-   *   List<Feature> features = new ArrayList<>();
+   *   String inputUri = "gs://demomaker/cat.mp4";
+   *   Feature featuresElement = Feature.LABEL_DETECTION;
+   *   List<Feature> features = Arrays.asList(featuresElement);
    *   AnnotateVideoRequest request = AnnotateVideoRequest.newBuilder()
    *     .setInputUri(inputUri)
    *     .addAllFeatures(features)
diff --git a/google-cloud-video-intelligence/src/main/java/com/google/cloud/videointelligence/v1beta1/package-info.java b/google-cloud-video-intelligence/src/main/java/com/google/cloud/videointelligence/v1beta1/package-info.java
index 72e3610541b0..c5d966654399 100644
--- a/google-cloud-video-intelligence/src/main/java/com/google/cloud/videointelligence/v1beta1/package-info.java
+++ b/google-cloud-video-intelligence/src/main/java/com/google/cloud/videointelligence/v1beta1/package-info.java
@@ -28,12 +28,10 @@
  * 
  * 
  * try (VideoIntelligenceServiceClient videoIntelligenceServiceClient = VideoIntelligenceServiceClient.create()) {
- *   String inputUri = "";
- *   List<Feature> features = new ArrayList<>();
- *   VideoContext videoContext = VideoContext.newBuilder().build();
- *   String outputUri = "";
- *   String locationId = "";
- *   AnnotateVideoResponse response = videoIntelligenceServiceClient.annotateVideoAsync(inputUri, features, videoContext, outputUri, locationId);
+ *   String inputUri = "gs://demomaker/cat.mp4";
+ *   Feature featuresElement = Feature.LABEL_DETECTION;
+ *   List<Feature> features = Arrays.asList(featuresElement);
+ *   AnnotateVideoResponse response = videoIntelligenceServiceClient.annotateVideoAsync(inputUri, features);
  * }
  * 
  * 
diff --git a/google-cloud-video-intelligence/src/test/java/com/google/cloud/videointelligence/v1beta1/VideoIntelligenceServiceClientTest.java b/google-cloud-video-intelligence/src/test/java/com/google/cloud/videointelligence/v1beta1/VideoIntelligenceServiceClientTest.java index 38759765b03c..f28808152a02 100644 --- a/google-cloud-video-intelligence/src/test/java/com/google/cloud/videointelligence/v1beta1/VideoIntelligenceServiceClientTest.java +++ b/google-cloud-video-intelligence/src/test/java/com/google/cloud/videointelligence/v1beta1/VideoIntelligenceServiceClientTest.java @@ -27,7 +27,6 @@ import io.grpc.Status; import io.grpc.StatusRuntimeException; import java.io.IOException; -import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.concurrent.ExecutionException; @@ -89,14 +88,11 @@ public void annotateVideoTest() throws Exception { .build(); mockVideoIntelligenceService.addResponse(resultOperation); - String inputUri = "inputUri1707300727"; - List features = new ArrayList<>(); - VideoContext videoContext = VideoContext.newBuilder().build(); - String outputUri = "outputUri-1273518802"; - String locationId = "locationId552319461"; + String inputUri = "gs://demomaker/cat.mp4"; + Feature featuresElement = Feature.LABEL_DETECTION; + List features = Arrays.asList(featuresElement); - AnnotateVideoResponse actualResponse = - client.annotateVideoAsync(inputUri, features, videoContext, outputUri, locationId).get(); + AnnotateVideoResponse actualResponse = client.annotateVideoAsync(inputUri, features).get(); Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockVideoIntelligenceService.getRequests(); @@ -105,9 +101,6 @@ public void annotateVideoTest() throws Exception { Assert.assertEquals(inputUri, actualRequest.getInputUri()); Assert.assertEquals(features, actualRequest.getFeaturesList()); - Assert.assertEquals(videoContext, actualRequest.getVideoContext()); - Assert.assertEquals(outputUri, actualRequest.getOutputUri()); - Assert.assertEquals(locationId, actualRequest.getLocationId()); } @Test @@ -117,13 +110,11 @@ public void annotateVideoExceptionTest() throws Exception { mockVideoIntelligenceService.addException(exception); try { - String inputUri = "inputUri1707300727"; - List features = new ArrayList<>(); - VideoContext videoContext = VideoContext.newBuilder().build(); - String outputUri = "outputUri-1273518802"; - String locationId = "locationId552319461"; + String inputUri = "gs://demomaker/cat.mp4"; + Feature featuresElement = Feature.LABEL_DETECTION; + List features = Arrays.asList(featuresElement); - client.annotateVideoAsync(inputUri, features, videoContext, outputUri, locationId).get(); + client.annotateVideoAsync(inputUri, features).get(); Assert.fail("No exception raised"); } catch (ExecutionException e) { Assert.assertEquals(InvalidArgumentException.class, e.getCause().getClass()); diff --git a/pom.xml b/pom.xml index b45b999803cd..c371e0fde4d1 100644 --- a/pom.xml +++ b/pom.xml @@ -142,7 +142,7 @@ 1.1.0 1.9.1 0.26.1 - 0.1.21 + 0.1.22 0.8.0 1.7.0 2.0.6.Final @@ -729,11 +729,6 @@ proto-google-common-protos ${generatedProto.version} - - com.google.api.grpc - grpc-google-common-protos - ${generatedProto.version} - com.google.api.grpc proto-google-iam-v1