diff --git a/google-cloud-bom/pom.xml b/google-cloud-bom/pom.xml
index 0506160c7c03..77aeeab577a8 100644
--- a/google-cloud-bom/pom.xml
+++ b/google-cloud-bom/pom.xml
@@ -172,8 +172,8 @@
1.19.01.19.00.36.0
- 0.3.0
- 1.2.0
+ 0.4.0
+ 1.3.0
@@ -780,6 +780,16 @@
grpc-google-cloud-vision-v1p1beta1${generated-proto-beta.version}
+
+ com.google.api.grpc
+ proto-google-cloud-vision-v1p2beta1
+ ${generated-proto-ga.version}
+
+
+ com.google.api.grpc
+ grpc-google-cloud-vision-v1p2beta1
+ ${generated-proto-ga.version}
+ com.google.cloudgoogle-cloud-video-intelligence
diff --git a/google-cloud-vision/pom.xml b/google-cloud-vision/pom.xml
index 9f5372b3d1e3..9030bba35865 100644
--- a/google-cloud-vision/pom.xml
+++ b/google-cloud-vision/pom.xml
@@ -34,6 +34,10 @@
com.google.api.grpcproto-google-cloud-vision-v1p1beta1
+
+ com.google.api.grpc
+ proto-google-cloud-vision-v1p2beta1
+ io.grpcgrpc-netty-shaded
@@ -77,6 +81,11 @@
grpc-google-cloud-vision-v1p1beta1test
+
+ com.google.api.grpc
+ grpc-google-cloud-vision-v1p2beta1
+ test
+ com.google.apigax-grpc
diff --git a/google-cloud-vision/src/main/java/com/google/cloud/vision/v1p2beta1/ImageAnnotatorClient.java b/google-cloud-vision/src/main/java/com/google/cloud/vision/v1p2beta1/ImageAnnotatorClient.java
new file mode 100644
index 000000000000..0ccf242c109f
--- /dev/null
+++ b/google-cloud-vision/src/main/java/com/google/cloud/vision/v1p2beta1/ImageAnnotatorClient.java
@@ -0,0 +1,375 @@
+/*
+ * Copyright 2018 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.google.cloud.vision.v1p2beta1;
+
+import com.google.api.core.BetaApi;
+import com.google.api.gax.core.BackgroundResource;
+import com.google.api.gax.longrunning.OperationFuture;
+import com.google.api.gax.rpc.OperationCallable;
+import com.google.api.gax.rpc.UnaryCallable;
+import com.google.cloud.vision.v1p2beta1.stub.ImageAnnotatorStub;
+import com.google.cloud.vision.v1p2beta1.stub.ImageAnnotatorStubSettings;
+import com.google.longrunning.Operation;
+import com.google.longrunning.OperationsClient;
+import java.io.IOException;
+import java.util.List;
+import java.util.concurrent.TimeUnit;
+import javax.annotation.Generated;
+
+// AUTO-GENERATED DOCUMENTATION AND SERVICE
+/**
+ * Service Description: Service that performs Google Cloud Vision API detection tasks over client
+ * images, such as face, landmark, logo, label, and text detection. The ImageAnnotator service
+ * returns detected entities from the images.
+ *
+ *
This class provides the ability to make remote calls to the backing service through method
+ * calls that map to API methods. Sample code to get started:
+ *
+ *
Note: close() needs to be called on the imageAnnotatorClient object to clean up resources such
+ * as threads. In the example above, try-with-resources is used, which automatically calls close().
+ *
+ *
The surface of this class includes several types of Java methods for each of the API's
+ * methods:
+ *
+ *
+ *
A "flattened" method. With this type of method, the fields of the request type have been
+ * converted into function parameters. It may be the case that not all fields are available as
+ * parameters, and not every API method will have a flattened method entry point.
+ *
A "request object" method. This type of method only takes one parameter, a request object,
+ * which must be constructed before the call. Not every API method will have a request object
+ * method.
+ *
A "callable" method. This type of method takes no parameters and returns an immutable API
+ * callable object, which can be used to initiate calls to the service.
+ *
+ *
+ *
See the individual methods for example code.
+ *
+ *
Many parameters require resource names to be formatted in a particular way. To assist with
+ * these names, this class includes a format method for each type of name, and additionally a parse
+ * method to extract the individual identifiers contained within names that are returned.
+ *
+ *
This class can be customized by passing in a custom instance of ImageAnnotatorSettings to
+ * create(). For example:
+ *
+ *
+ */
+@Generated("by GAPIC v0.0.5")
+public class ImageAnnotatorClient implements BackgroundResource {
+ private final ImageAnnotatorSettings settings;
+ private final ImageAnnotatorStub stub;
+ private final OperationsClient operationsClient;
+
+ /** Constructs an instance of ImageAnnotatorClient with default settings. */
+ public static final ImageAnnotatorClient create() throws IOException {
+ return create(ImageAnnotatorSettings.newBuilder().build());
+ }
+
+ /**
+ * Constructs an instance of ImageAnnotatorClient, using the given settings. The channels are
+ * created based on the settings passed in, or defaults for any settings that are not set.
+ */
+ public static final ImageAnnotatorClient create(ImageAnnotatorSettings settings)
+ throws IOException {
+ return new ImageAnnotatorClient(settings);
+ }
+
+ /**
+ * Constructs an instance of ImageAnnotatorClient, using the given stub for making calls. This is
+ * for advanced usage - prefer to use ImageAnnotatorSettings}.
+ */
+ @BetaApi("A restructuring of stub classes is planned, so this may break in the future")
+ public static final ImageAnnotatorClient create(ImageAnnotatorStub stub) {
+ return new ImageAnnotatorClient(stub);
+ }
+
+ /**
+ * Constructs an instance of ImageAnnotatorClient, using the given settings. This is protected so
+ * that it is easy to make a subclass, but otherwise, the static factory methods should be
+ * preferred.
+ */
+ protected ImageAnnotatorClient(ImageAnnotatorSettings settings) throws IOException {
+ this.settings = settings;
+ this.stub = ((ImageAnnotatorStubSettings) settings.getStubSettings()).createStub();
+ this.operationsClient = OperationsClient.create(this.stub.getOperationsStub());
+ }
+
+ @BetaApi("A restructuring of stub classes is planned, so this may break in the future")
+ protected ImageAnnotatorClient(ImageAnnotatorStub stub) {
+ this.settings = null;
+ this.stub = stub;
+ this.operationsClient = OperationsClient.create(this.stub.getOperationsStub());
+ }
+
+ public final ImageAnnotatorSettings getSettings() {
+ return settings;
+ }
+
+ @BetaApi("A restructuring of stub classes is planned, so this may break in the future")
+ public ImageAnnotatorStub getStub() {
+ return stub;
+ }
+
+ /**
+ * Returns the OperationsClient that can be used to query the status of a long-running operation
+ * returned by another API method call.
+ */
+ public final OperationsClient getOperationsClient() {
+ return operationsClient;
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Run image detection and annotation for a batch of images.
+ *
+ *
+ *
+ * @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 BatchAnnotateImagesResponse batchAnnotateImages(
+ BatchAnnotateImagesRequest request) {
+ return batchAnnotateImagesCallable().call(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Run image detection and annotation for a batch of images.
+ *
+ *
+ */
+ public final UnaryCallable
+ batchAnnotateImagesCallable() {
+ return stub.batchAnnotateImagesCallable();
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Run async image detection and annotation for a list of generic files (e.g. PDF) which may
+ * contain multiple pages and multiple images per page. Progress and results can be retrieved
+ * through the `google.longrunning.Operations` interface. `Operation.metadata` contains
+ * `OperationMetadata` (metadata). `Operation.response` contains `AsyncBatchAnnotateFilesResponse`
+ * (results).
+ *
+ *
+ *
+ * @param requests Individual async file annotation requests for this batch.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final OperationFuture
+ asyncBatchAnnotateFilesAsync(List requests) {
+
+ AsyncBatchAnnotateFilesRequest request =
+ AsyncBatchAnnotateFilesRequest.newBuilder().addAllRequests(requests).build();
+ return asyncBatchAnnotateFilesAsync(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Run async image detection and annotation for a list of generic files (e.g. PDF) which may
+ * contain multiple pages and multiple images per page. Progress and results can be retrieved
+ * through the `google.longrunning.Operations` interface. `Operation.metadata` contains
+ * `OperationMetadata` (metadata). `Operation.response` contains `AsyncBatchAnnotateFilesResponse`
+ * (results).
+ *
+ *
+ *
+ * @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 OperationFuture
+ asyncBatchAnnotateFilesAsync(AsyncBatchAnnotateFilesRequest request) {
+ return asyncBatchAnnotateFilesOperationCallable().futureCall(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Run async image detection and annotation for a list of generic files (e.g. PDF) which may
+ * contain multiple pages and multiple images per page. Progress and results can be retrieved
+ * through the `google.longrunning.Operations` interface. `Operation.metadata` contains
+ * `OperationMetadata` (metadata). `Operation.response` contains `AsyncBatchAnnotateFilesResponse`
+ * (results).
+ *
+ *
+ */
+ public final OperationCallable<
+ AsyncBatchAnnotateFilesRequest, AsyncBatchAnnotateFilesResponse, OperationMetadata>
+ asyncBatchAnnotateFilesOperationCallable() {
+ return stub.asyncBatchAnnotateFilesOperationCallable();
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Run async image detection and annotation for a list of generic files (e.g. PDF) which may
+ * contain multiple pages and multiple images per page. Progress and results can be retrieved
+ * through the `google.longrunning.Operations` interface. `Operation.metadata` contains
+ * `OperationMetadata` (metadata). `Operation.response` contains `AsyncBatchAnnotateFilesResponse`
+ * (results).
+ *
+ *
+ */
+ public final UnaryCallable
+ asyncBatchAnnotateFilesCallable() {
+ return stub.asyncBatchAnnotateFilesCallable();
+ }
+
+ @Override
+ public final void close() throws Exception {
+ stub.close();
+ }
+
+ @Override
+ public void shutdown() {
+ stub.shutdown();
+ }
+
+ @Override
+ public boolean isShutdown() {
+ return stub.isShutdown();
+ }
+
+ @Override
+ public boolean isTerminated() {
+ return stub.isTerminated();
+ }
+
+ @Override
+ public void shutdownNow() {
+ stub.shutdownNow();
+ }
+
+ @Override
+ public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException {
+ return stub.awaitTermination(duration, unit);
+ }
+}
diff --git a/google-cloud-vision/src/main/java/com/google/cloud/vision/v1p2beta1/ImageAnnotatorSettings.java b/google-cloud-vision/src/main/java/com/google/cloud/vision/v1p2beta1/ImageAnnotatorSettings.java
new file mode 100644
index 000000000000..475f6a56eb43
--- /dev/null
+++ b/google-cloud-vision/src/main/java/com/google/cloud/vision/v1p2beta1/ImageAnnotatorSettings.java
@@ -0,0 +1,203 @@
+/*
+ * Copyright 2018 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.google.cloud.vision.v1p2beta1;
+
+import com.google.api.core.ApiFunction;
+import com.google.api.core.BetaApi;
+import com.google.api.gax.core.GoogleCredentialsProvider;
+import com.google.api.gax.core.InstantiatingExecutorProvider;
+import com.google.api.gax.grpc.InstantiatingGrpcChannelProvider;
+import com.google.api.gax.rpc.ApiClientHeaderProvider;
+import com.google.api.gax.rpc.ClientContext;
+import com.google.api.gax.rpc.ClientSettings;
+import com.google.api.gax.rpc.OperationCallSettings;
+import com.google.api.gax.rpc.TransportChannelProvider;
+import com.google.api.gax.rpc.UnaryCallSettings;
+import com.google.cloud.vision.v1p2beta1.stub.ImageAnnotatorStubSettings;
+import com.google.longrunning.Operation;
+import java.io.IOException;
+import java.util.List;
+import javax.annotation.Generated;
+
+// AUTO-GENERATED DOCUMENTATION AND CLASS
+/**
+ * Settings class to configure an instance of {@link ImageAnnotatorClient}.
+ *
+ *
The default instance has everything set to sensible defaults:
+ *
+ *
+ *
The default service address (vision.googleapis.com) and default port (443) are used.
+ *
Credentials are acquired automatically through Application Default Credentials.
+ *
Retries are configured for idempotent methods but not for non-idempotent methods.
+ *
+ *
+ *
The builder of this class is recursive, so contained classes are themselves builders. When
+ * build() is called, the tree of builders is called to create the complete settings object. For
+ * example, to set the total timeout of batchAnnotateImages to 30 seconds:
+ *
+ *
+ */
+@Generated("by GAPIC v0.0.5")
+public class ImageAnnotatorSettings extends ClientSettings {
+ /** Returns the object with the settings used for calls to batchAnnotateImages. */
+ public UnaryCallSettings
+ batchAnnotateImagesSettings() {
+ return ((ImageAnnotatorStubSettings) getStubSettings()).batchAnnotateImagesSettings();
+ }
+
+ /** Returns the object with the settings used for calls to asyncBatchAnnotateFiles. */
+ public UnaryCallSettings
+ asyncBatchAnnotateFilesSettings() {
+ return ((ImageAnnotatorStubSettings) getStubSettings()).asyncBatchAnnotateFilesSettings();
+ }
+
+ /** Returns the object with the settings used for calls to asyncBatchAnnotateFiles. */
+ public OperationCallSettings<
+ AsyncBatchAnnotateFilesRequest, AsyncBatchAnnotateFilesResponse, OperationMetadata>
+ asyncBatchAnnotateFilesOperationSettings() {
+ return ((ImageAnnotatorStubSettings) getStubSettings())
+ .asyncBatchAnnotateFilesOperationSettings();
+ }
+
+ public static final ImageAnnotatorSettings create(ImageAnnotatorStubSettings stub)
+ throws IOException {
+ return new ImageAnnotatorSettings.Builder(stub.toBuilder()).build();
+ }
+
+ /** Returns a builder for the default ExecutorProvider for this service. */
+ public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() {
+ return ImageAnnotatorStubSettings.defaultExecutorProviderBuilder();
+ }
+
+ /** Returns the default service endpoint. */
+ public static String getDefaultEndpoint() {
+ return ImageAnnotatorStubSettings.getDefaultEndpoint();
+ }
+
+ /** Returns the default service scopes. */
+ public static List getDefaultServiceScopes() {
+ return ImageAnnotatorStubSettings.getDefaultServiceScopes();
+ }
+
+ /** Returns a builder for the default credentials for this service. */
+ public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() {
+ return ImageAnnotatorStubSettings.defaultCredentialsProviderBuilder();
+ }
+
+ /** Returns a builder for the default ChannelProvider for this service. */
+ public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() {
+ return ImageAnnotatorStubSettings.defaultGrpcTransportProviderBuilder();
+ }
+
+ public static TransportChannelProvider defaultTransportChannelProvider() {
+ return ImageAnnotatorStubSettings.defaultTransportChannelProvider();
+ }
+
+ @BetaApi("The surface for customizing headers is not stable yet and may change in the future.")
+ public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() {
+ return ImageAnnotatorStubSettings.defaultApiClientHeaderProviderBuilder();
+ }
+
+ /** Returns a new builder for this class. */
+ public static Builder newBuilder() {
+ return Builder.createDefault();
+ }
+
+ /** Returns a new builder for this class. */
+ public static Builder newBuilder(ClientContext clientContext) {
+ return new Builder(clientContext);
+ }
+
+ /** Returns a builder containing all the values of this settings class. */
+ public Builder toBuilder() {
+ return new Builder(this);
+ }
+
+ protected ImageAnnotatorSettings(Builder settingsBuilder) throws IOException {
+ super(settingsBuilder);
+ }
+
+ /** Builder for ImageAnnotatorSettings. */
+ public static class Builder extends ClientSettings.Builder {
+ protected Builder() throws IOException {
+ this((ClientContext) null);
+ }
+
+ protected Builder(ClientContext clientContext) {
+ super(ImageAnnotatorStubSettings.newBuilder(clientContext));
+ }
+
+ private static Builder createDefault() {
+ return new Builder(ImageAnnotatorStubSettings.newBuilder());
+ }
+
+ protected Builder(ImageAnnotatorSettings settings) {
+ super(settings.getStubSettings().toBuilder());
+ }
+
+ protected Builder(ImageAnnotatorStubSettings.Builder stubSettings) {
+ super(stubSettings);
+ }
+
+ public ImageAnnotatorStubSettings.Builder getStubSettingsBuilder() {
+ return ((ImageAnnotatorStubSettings.Builder) getStubSettings());
+ }
+
+ /**
+ * Applies the given settings updater function to all of the unary API methods in this service.
+ *
+ *
Note: This method does not support applying settings to streaming methods.
+ */
+ public Builder applyToAllUnaryMethods(
+ ApiFunction, Void> settingsUpdater) throws Exception {
+ super.applyToAllUnaryMethods(
+ getStubSettingsBuilder().unaryMethodSettingsBuilders(), settingsUpdater);
+ return this;
+ }
+
+ /** Returns the builder for the settings used for calls to batchAnnotateImages. */
+ public UnaryCallSettings.Builder
+ batchAnnotateImagesSettings() {
+ return getStubSettingsBuilder().batchAnnotateImagesSettings();
+ }
+
+ /** Returns the builder for the settings used for calls to asyncBatchAnnotateFiles. */
+ public UnaryCallSettings.Builder
+ asyncBatchAnnotateFilesSettings() {
+ return getStubSettingsBuilder().asyncBatchAnnotateFilesSettings();
+ }
+
+ /** Returns the builder for the settings used for calls to asyncBatchAnnotateFiles. */
+ public OperationCallSettings.Builder<
+ AsyncBatchAnnotateFilesRequest, AsyncBatchAnnotateFilesResponse, OperationMetadata>
+ asyncBatchAnnotateFilesOperationSettings() {
+ return getStubSettingsBuilder().asyncBatchAnnotateFilesOperationSettings();
+ }
+
+ @Override
+ public ImageAnnotatorSettings build() throws IOException {
+ return new ImageAnnotatorSettings(this);
+ }
+ }
+}
diff --git a/google-cloud-vision/src/main/java/com/google/cloud/vision/v1p2beta1/package-info.java b/google-cloud-vision/src/main/java/com/google/cloud/vision/v1p2beta1/package-info.java
new file mode 100644
index 000000000000..bcd23873e09b
--- /dev/null
+++ b/google-cloud-vision/src/main/java/com/google/cloud/vision/v1p2beta1/package-info.java
@@ -0,0 +1,39 @@
+/*
+ * Copyright 2018 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * A client to Google Cloud Vision API.
+ *
+ *
The interfaces provided are listed below, along with usage samples.
+ *
+ *
Service Description: Service that performs Google Cloud Vision API detection tasks over client
+ * images, such as face, landmark, logo, label, and text detection. The ImageAnnotator service
+ * returns detected entities from the images.
+ *
+ *
+ */
+package com.google.cloud.vision.v1p2beta1;
diff --git a/google-cloud-vision/src/main/java/com/google/cloud/vision/v1p2beta1/stub/GrpcImageAnnotatorStub.java b/google-cloud-vision/src/main/java/com/google/cloud/vision/v1p2beta1/stub/GrpcImageAnnotatorStub.java
new file mode 100644
index 000000000000..56be8b4a8354
--- /dev/null
+++ b/google-cloud-vision/src/main/java/com/google/cloud/vision/v1p2beta1/stub/GrpcImageAnnotatorStub.java
@@ -0,0 +1,181 @@
+/*
+ * Copyright 2018 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.google.cloud.vision.v1p2beta1.stub;
+
+import com.google.api.core.BetaApi;
+import com.google.api.gax.core.BackgroundResource;
+import com.google.api.gax.core.BackgroundResourceAggregation;
+import com.google.api.gax.grpc.GrpcCallSettings;
+import com.google.api.gax.grpc.GrpcCallableFactory;
+import com.google.api.gax.rpc.ClientContext;
+import com.google.api.gax.rpc.OperationCallable;
+import com.google.api.gax.rpc.UnaryCallable;
+import com.google.cloud.vision.v1p2beta1.AsyncBatchAnnotateFilesRequest;
+import com.google.cloud.vision.v1p2beta1.AsyncBatchAnnotateFilesResponse;
+import com.google.cloud.vision.v1p2beta1.BatchAnnotateImagesRequest;
+import com.google.cloud.vision.v1p2beta1.BatchAnnotateImagesResponse;
+import com.google.cloud.vision.v1p2beta1.OperationMetadata;
+import com.google.longrunning.Operation;
+import com.google.longrunning.stub.GrpcOperationsStub;
+import io.grpc.MethodDescriptor;
+import io.grpc.protobuf.ProtoUtils;
+import java.io.IOException;
+import java.util.concurrent.TimeUnit;
+import javax.annotation.Generated;
+
+// AUTO-GENERATED DOCUMENTATION AND CLASS
+/**
+ * gRPC stub implementation for Google Cloud Vision API.
+ *
+ *
This class is for advanced usage and reflects the underlying API directly.
+ */
+@Generated("by GAPIC v0.0.5")
+@BetaApi("A restructuring of stub classes is planned, so this may break in the future")
+public class GrpcImageAnnotatorStub extends ImageAnnotatorStub {
+
+ private static final MethodDescriptor
+ batchAnnotateImagesMethodDescriptor =
+ MethodDescriptor.newBuilder()
+ .setType(MethodDescriptor.MethodType.UNARY)
+ .setFullMethodName("google.cloud.vision.v1p2beta1.ImageAnnotator/BatchAnnotateImages")
+ .setRequestMarshaller(
+ ProtoUtils.marshaller(BatchAnnotateImagesRequest.getDefaultInstance()))
+ .setResponseMarshaller(
+ ProtoUtils.marshaller(BatchAnnotateImagesResponse.getDefaultInstance()))
+ .build();
+ private static final MethodDescriptor
+ asyncBatchAnnotateFilesMethodDescriptor =
+ MethodDescriptor.newBuilder()
+ .setType(MethodDescriptor.MethodType.UNARY)
+ .setFullMethodName(
+ "google.cloud.vision.v1p2beta1.ImageAnnotator/AsyncBatchAnnotateFiles")
+ .setRequestMarshaller(
+ ProtoUtils.marshaller(AsyncBatchAnnotateFilesRequest.getDefaultInstance()))
+ .setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance()))
+ .build();
+
+ private final BackgroundResource backgroundResources;
+ private final GrpcOperationsStub operationsStub;
+
+ private final UnaryCallable
+ batchAnnotateImagesCallable;
+ private final UnaryCallable
+ asyncBatchAnnotateFilesCallable;
+ private final OperationCallable<
+ AsyncBatchAnnotateFilesRequest, AsyncBatchAnnotateFilesResponse, OperationMetadata>
+ asyncBatchAnnotateFilesOperationCallable;
+
+ public static final GrpcImageAnnotatorStub create(ImageAnnotatorStubSettings settings)
+ throws IOException {
+ return new GrpcImageAnnotatorStub(settings, ClientContext.create(settings));
+ }
+
+ public static final GrpcImageAnnotatorStub create(ClientContext clientContext)
+ throws IOException {
+ return new GrpcImageAnnotatorStub(
+ ImageAnnotatorStubSettings.newBuilder().build(), clientContext);
+ }
+
+ /**
+ * Constructs an instance of GrpcImageAnnotatorStub, using the given settings. This is protected
+ * so that it is easy to make a subclass, but otherwise, the static factory methods should be
+ * preferred.
+ */
+ protected GrpcImageAnnotatorStub(ImageAnnotatorStubSettings settings, ClientContext clientContext)
+ throws IOException {
+ this.operationsStub = GrpcOperationsStub.create(clientContext);
+
+ GrpcCallSettings
+ batchAnnotateImagesTransportSettings =
+ GrpcCallSettings.newBuilder()
+ .setMethodDescriptor(batchAnnotateImagesMethodDescriptor)
+ .build();
+ GrpcCallSettings
+ asyncBatchAnnotateFilesTransportSettings =
+ GrpcCallSettings.newBuilder()
+ .setMethodDescriptor(asyncBatchAnnotateFilesMethodDescriptor)
+ .build();
+
+ this.batchAnnotateImagesCallable =
+ GrpcCallableFactory.createUnaryCallable(
+ batchAnnotateImagesTransportSettings,
+ settings.batchAnnotateImagesSettings(),
+ clientContext);
+ this.asyncBatchAnnotateFilesCallable =
+ GrpcCallableFactory.createUnaryCallable(
+ asyncBatchAnnotateFilesTransportSettings,
+ settings.asyncBatchAnnotateFilesSettings(),
+ clientContext);
+ this.asyncBatchAnnotateFilesOperationCallable =
+ GrpcCallableFactory.createOperationCallable(
+ asyncBatchAnnotateFilesTransportSettings,
+ settings.asyncBatchAnnotateFilesOperationSettings(),
+ clientContext,
+ this.operationsStub);
+
+ backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources());
+ }
+
+ public GrpcOperationsStub getOperationsStub() {
+ return operationsStub;
+ }
+
+ public UnaryCallable
+ batchAnnotateImagesCallable() {
+ return batchAnnotateImagesCallable;
+ }
+
+ public OperationCallable<
+ AsyncBatchAnnotateFilesRequest, AsyncBatchAnnotateFilesResponse, OperationMetadata>
+ asyncBatchAnnotateFilesOperationCallable() {
+ return asyncBatchAnnotateFilesOperationCallable;
+ }
+
+ public UnaryCallable
+ asyncBatchAnnotateFilesCallable() {
+ return asyncBatchAnnotateFilesCallable;
+ }
+
+ @Override
+ public final void close() throws Exception {
+ shutdown();
+ }
+
+ @Override
+ public void shutdown() {
+ backgroundResources.shutdown();
+ }
+
+ @Override
+ public boolean isShutdown() {
+ return backgroundResources.isShutdown();
+ }
+
+ @Override
+ public boolean isTerminated() {
+ return backgroundResources.isTerminated();
+ }
+
+ @Override
+ public void shutdownNow() {
+ backgroundResources.shutdownNow();
+ }
+
+ @Override
+ public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException {
+ return backgroundResources.awaitTermination(duration, unit);
+ }
+}
diff --git a/google-cloud-vision/src/main/java/com/google/cloud/vision/v1p2beta1/stub/ImageAnnotatorStub.java b/google-cloud-vision/src/main/java/com/google/cloud/vision/v1p2beta1/stub/ImageAnnotatorStub.java
new file mode 100644
index 000000000000..c7d036f4a91e
--- /dev/null
+++ b/google-cloud-vision/src/main/java/com/google/cloud/vision/v1p2beta1/stub/ImageAnnotatorStub.java
@@ -0,0 +1,61 @@
+/*
+ * Copyright 2018 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.google.cloud.vision.v1p2beta1.stub;
+
+import com.google.api.core.BetaApi;
+import com.google.api.gax.core.BackgroundResource;
+import com.google.api.gax.rpc.OperationCallable;
+import com.google.api.gax.rpc.UnaryCallable;
+import com.google.cloud.vision.v1p2beta1.AsyncBatchAnnotateFilesRequest;
+import com.google.cloud.vision.v1p2beta1.AsyncBatchAnnotateFilesResponse;
+import com.google.cloud.vision.v1p2beta1.BatchAnnotateImagesRequest;
+import com.google.cloud.vision.v1p2beta1.BatchAnnotateImagesResponse;
+import com.google.cloud.vision.v1p2beta1.OperationMetadata;
+import com.google.longrunning.Operation;
+import com.google.longrunning.stub.OperationsStub;
+import javax.annotation.Generated;
+
+// AUTO-GENERATED DOCUMENTATION AND CLASS
+/**
+ * Base stub class for Google Cloud Vision API.
+ *
+ *
This class is for advanced usage and reflects the underlying API directly.
+ */
+@Generated("by GAPIC v0.0.5")
+@BetaApi("A restructuring of stub classes is planned, so this may break in the future")
+public abstract class ImageAnnotatorStub implements BackgroundResource {
+
+ public OperationsStub getOperationsStub() {
+ throw new UnsupportedOperationException("Not implemented: getOperationsStub()");
+ }
+
+ public UnaryCallable
+ batchAnnotateImagesCallable() {
+ throw new UnsupportedOperationException("Not implemented: batchAnnotateImagesCallable()");
+ }
+
+ public OperationCallable<
+ AsyncBatchAnnotateFilesRequest, AsyncBatchAnnotateFilesResponse, OperationMetadata>
+ asyncBatchAnnotateFilesOperationCallable() {
+ throw new UnsupportedOperationException(
+ "Not implemented: asyncBatchAnnotateFilesOperationCallable()");
+ }
+
+ public UnaryCallable
+ asyncBatchAnnotateFilesCallable() {
+ throw new UnsupportedOperationException("Not implemented: asyncBatchAnnotateFilesCallable()");
+ }
+}
diff --git a/google-cloud-vision/src/main/java/com/google/cloud/vision/v1p2beta1/stub/ImageAnnotatorStubSettings.java b/google-cloud-vision/src/main/java/com/google/cloud/vision/v1p2beta1/stub/ImageAnnotatorStubSettings.java
new file mode 100644
index 000000000000..aa47bb96c262
--- /dev/null
+++ b/google-cloud-vision/src/main/java/com/google/cloud/vision/v1p2beta1/stub/ImageAnnotatorStubSettings.java
@@ -0,0 +1,354 @@
+/*
+ * Copyright 2018 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.google.cloud.vision.v1p2beta1.stub;
+
+import com.google.api.core.ApiFunction;
+import com.google.api.core.BetaApi;
+import com.google.api.gax.core.GaxProperties;
+import com.google.api.gax.core.GoogleCredentialsProvider;
+import com.google.api.gax.core.InstantiatingExecutorProvider;
+import com.google.api.gax.grpc.GaxGrpcProperties;
+import com.google.api.gax.grpc.GrpcTransportChannel;
+import com.google.api.gax.grpc.InstantiatingGrpcChannelProvider;
+import com.google.api.gax.grpc.ProtoOperationTransformers;
+import com.google.api.gax.longrunning.OperationSnapshot;
+import com.google.api.gax.longrunning.OperationTimedPollAlgorithm;
+import com.google.api.gax.retrying.RetrySettings;
+import com.google.api.gax.rpc.ApiClientHeaderProvider;
+import com.google.api.gax.rpc.ClientContext;
+import com.google.api.gax.rpc.OperationCallSettings;
+import com.google.api.gax.rpc.StatusCode;
+import com.google.api.gax.rpc.StubSettings;
+import com.google.api.gax.rpc.TransportChannelProvider;
+import com.google.api.gax.rpc.UnaryCallSettings;
+import com.google.cloud.vision.v1p2beta1.AsyncBatchAnnotateFilesRequest;
+import com.google.cloud.vision.v1p2beta1.AsyncBatchAnnotateFilesResponse;
+import com.google.cloud.vision.v1p2beta1.BatchAnnotateImagesRequest;
+import com.google.cloud.vision.v1p2beta1.BatchAnnotateImagesResponse;
+import com.google.cloud.vision.v1p2beta1.OperationMetadata;
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.ImmutableSet;
+import com.google.common.collect.Lists;
+import com.google.longrunning.Operation;
+import java.io.IOException;
+import java.util.List;
+import javax.annotation.Generated;
+import org.threeten.bp.Duration;
+
+// AUTO-GENERATED DOCUMENTATION AND CLASS
+/**
+ * Settings class to configure an instance of {@link ImageAnnotatorStub}.
+ *
+ *
The default instance has everything set to sensible defaults:
+ *
+ *
+ *
The default service address (vision.googleapis.com) and default port (443) are used.
+ *
Credentials are acquired automatically through Application Default Credentials.
+ *
Retries are configured for idempotent methods but not for non-idempotent methods.
+ *
+ *
+ *
The builder of this class is recursive, so contained classes are themselves builders. When
+ * build() is called, the tree of builders is called to create the complete settings object. For
+ * example, to set the total timeout of batchAnnotateImages to 30 seconds:
+ *
+ *