From d4e261e54ca0c0b35884de859813a9bb59a07bfb Mon Sep 17 00:00:00 2001 From: Neo Wu Date: Mon, 19 Mar 2018 16:16:27 -0700 Subject: [PATCH] fix video directory --- .../v1/VideoIntelligenceServiceSettings.java | 2 +- .../VideoIntelligenceServiceStubSettings.java | 2 +- .../VideoIntelligenceServiceSettings.java | 2 +- .../VideoIntelligenceServiceStubSettings.java | 2 +- .../VideoIntelligenceServiceSettings.java | 2 +- .../VideoIntelligenceServiceStubSettings.java | 2 +- .../VideoIntelligenceServiceClient.java | 0 .../VideoIntelligenceServiceSettings.java | 0 .../v1p1beta1/package-info.java | 0 .../GrpcVideoIntelligenceServiceStub.java | 0 .../stub/VideoIntelligenceServiceStub.java | 0 .../VideoIntelligenceServiceStubSettings.java | 0 .../MockVideoIntelligenceService.java | 0 .../MockVideoIntelligenceServiceImpl.java | 0 .../VideoIntelligenceServiceClientTest.java | 0 .../v1/VideoIntelligenceServiceClient.java | 321 ------------------ .../v1/VideoIntelligenceServiceSettings.java | 192 ----------- .../videointelligence/v1/package-info.java | 39 --- .../GrpcVideoIntelligenceServiceStub.java | 147 -------- .../v1/stub/VideoIntelligenceServiceStub.java | 51 --- .../VideoIntelligenceServiceStubSettings.java | 318 ----------------- .../VideoIntelligenceServiceClient.java | 321 ------------------ .../VideoIntelligenceServiceSettings.java | 192 ----------- .../v1beta1/package-info.java | 39 --- .../GrpcVideoIntelligenceServiceStub.java | 147 -------- .../stub/VideoIntelligenceServiceStub.java | 51 --- .../VideoIntelligenceServiceStubSettings.java | 318 ----------------- .../VideoIntelligenceServiceClient.java | 321 ------------------ .../VideoIntelligenceServiceSettings.java | 192 ----------- .../v1beta2/package-info.java | 39 --- .../GrpcVideoIntelligenceServiceStub.java | 147 -------- .../stub/VideoIntelligenceServiceStub.java | 51 --- .../VideoIntelligenceServiceStubSettings.java | 318 ----------------- .../v1/MockVideoIntelligenceService.java | 57 ---- .../v1/MockVideoIntelligenceServiceImpl.java | 74 ---- .../VideoIntelligenceServiceClientTest.java | 130 ------- .../v1/VideoIntelligenceServiceSmokeTest.java | 60 ---- .../v1beta1/MockVideoIntelligenceService.java | 57 ---- .../MockVideoIntelligenceServiceImpl.java | 74 ---- .../VideoIntelligenceServiceClientTest.java | 130 ------- .../v1beta2/MockVideoIntelligenceService.java | 57 ---- .../MockVideoIntelligenceServiceImpl.java | 74 ---- .../VideoIntelligenceServiceClientTest.java | 130 ------- .../VideoIntelligenceServiceSmokeTest.java | 60 ---- 44 files changed, 6 insertions(+), 4113 deletions(-) rename {google-cloud-videointelligence => google-cloud-video-intelligence}/src/main/java/com/google/cloud/videointelligence/v1p1beta1/VideoIntelligenceServiceClient.java (100%) rename {google-cloud-videointelligence => google-cloud-video-intelligence}/src/main/java/com/google/cloud/videointelligence/v1p1beta1/VideoIntelligenceServiceSettings.java (100%) rename {google-cloud-videointelligence => google-cloud-video-intelligence}/src/main/java/com/google/cloud/videointelligence/v1p1beta1/package-info.java (100%) rename {google-cloud-videointelligence => google-cloud-video-intelligence}/src/main/java/com/google/cloud/videointelligence/v1p1beta1/stub/GrpcVideoIntelligenceServiceStub.java (100%) rename {google-cloud-videointelligence => google-cloud-video-intelligence}/src/main/java/com/google/cloud/videointelligence/v1p1beta1/stub/VideoIntelligenceServiceStub.java (100%) rename {google-cloud-videointelligence => google-cloud-video-intelligence}/src/main/java/com/google/cloud/videointelligence/v1p1beta1/stub/VideoIntelligenceServiceStubSettings.java (100%) rename {google-cloud-videointelligence => google-cloud-video-intelligence}/src/test/java/com/google/cloud/videointelligence/v1p1beta1/MockVideoIntelligenceService.java (100%) rename {google-cloud-videointelligence => google-cloud-video-intelligence}/src/test/java/com/google/cloud/videointelligence/v1p1beta1/MockVideoIntelligenceServiceImpl.java (100%) rename {google-cloud-videointelligence => google-cloud-video-intelligence}/src/test/java/com/google/cloud/videointelligence/v1p1beta1/VideoIntelligenceServiceClientTest.java (100%) delete mode 100644 google-cloud-videointelligence/src/main/java/com/google/cloud/videointelligence/v1/VideoIntelligenceServiceClient.java delete mode 100644 google-cloud-videointelligence/src/main/java/com/google/cloud/videointelligence/v1/VideoIntelligenceServiceSettings.java delete mode 100644 google-cloud-videointelligence/src/main/java/com/google/cloud/videointelligence/v1/package-info.java delete mode 100644 google-cloud-videointelligence/src/main/java/com/google/cloud/videointelligence/v1/stub/GrpcVideoIntelligenceServiceStub.java delete mode 100644 google-cloud-videointelligence/src/main/java/com/google/cloud/videointelligence/v1/stub/VideoIntelligenceServiceStub.java delete mode 100644 google-cloud-videointelligence/src/main/java/com/google/cloud/videointelligence/v1/stub/VideoIntelligenceServiceStubSettings.java delete mode 100644 google-cloud-videointelligence/src/main/java/com/google/cloud/videointelligence/v1beta1/VideoIntelligenceServiceClient.java delete mode 100644 google-cloud-videointelligence/src/main/java/com/google/cloud/videointelligence/v1beta1/VideoIntelligenceServiceSettings.java delete mode 100644 google-cloud-videointelligence/src/main/java/com/google/cloud/videointelligence/v1beta1/package-info.java delete mode 100644 google-cloud-videointelligence/src/main/java/com/google/cloud/videointelligence/v1beta1/stub/GrpcVideoIntelligenceServiceStub.java delete mode 100644 google-cloud-videointelligence/src/main/java/com/google/cloud/videointelligence/v1beta1/stub/VideoIntelligenceServiceStub.java delete mode 100644 google-cloud-videointelligence/src/main/java/com/google/cloud/videointelligence/v1beta1/stub/VideoIntelligenceServiceStubSettings.java delete mode 100644 google-cloud-videointelligence/src/main/java/com/google/cloud/videointelligence/v1beta2/VideoIntelligenceServiceClient.java delete mode 100644 google-cloud-videointelligence/src/main/java/com/google/cloud/videointelligence/v1beta2/VideoIntelligenceServiceSettings.java delete mode 100644 google-cloud-videointelligence/src/main/java/com/google/cloud/videointelligence/v1beta2/package-info.java delete mode 100644 google-cloud-videointelligence/src/main/java/com/google/cloud/videointelligence/v1beta2/stub/GrpcVideoIntelligenceServiceStub.java delete mode 100644 google-cloud-videointelligence/src/main/java/com/google/cloud/videointelligence/v1beta2/stub/VideoIntelligenceServiceStub.java delete mode 100644 google-cloud-videointelligence/src/main/java/com/google/cloud/videointelligence/v1beta2/stub/VideoIntelligenceServiceStubSettings.java delete mode 100644 google-cloud-videointelligence/src/test/java/com/google/cloud/videointelligence/v1/MockVideoIntelligenceService.java delete mode 100644 google-cloud-videointelligence/src/test/java/com/google/cloud/videointelligence/v1/MockVideoIntelligenceServiceImpl.java delete mode 100644 google-cloud-videointelligence/src/test/java/com/google/cloud/videointelligence/v1/VideoIntelligenceServiceClientTest.java delete mode 100644 google-cloud-videointelligence/src/test/java/com/google/cloud/videointelligence/v1/VideoIntelligenceServiceSmokeTest.java delete mode 100644 google-cloud-videointelligence/src/test/java/com/google/cloud/videointelligence/v1beta1/MockVideoIntelligenceService.java delete mode 100644 google-cloud-videointelligence/src/test/java/com/google/cloud/videointelligence/v1beta1/MockVideoIntelligenceServiceImpl.java delete mode 100644 google-cloud-videointelligence/src/test/java/com/google/cloud/videointelligence/v1beta1/VideoIntelligenceServiceClientTest.java delete mode 100644 google-cloud-videointelligence/src/test/java/com/google/cloud/videointelligence/v1beta2/MockVideoIntelligenceService.java delete mode 100644 google-cloud-videointelligence/src/test/java/com/google/cloud/videointelligence/v1beta2/MockVideoIntelligenceServiceImpl.java delete mode 100644 google-cloud-videointelligence/src/test/java/com/google/cloud/videointelligence/v1beta2/VideoIntelligenceServiceClientTest.java delete mode 100644 google-cloud-videointelligence/src/test/java/com/google/cloud/videointelligence/v1p1beta1/VideoIntelligenceServiceSmokeTest.java diff --git a/google-cloud-video-intelligence/src/main/java/com/google/cloud/videointelligence/v1/VideoIntelligenceServiceSettings.java b/google-cloud-video-intelligence/src/main/java/com/google/cloud/videointelligence/v1/VideoIntelligenceServiceSettings.java index 38ca233d2815..ad9008306598 100644 --- a/google-cloud-video-intelligence/src/main/java/com/google/cloud/videointelligence/v1/VideoIntelligenceServiceSettings.java +++ b/google-cloud-video-intelligence/src/main/java/com/google/cloud/videointelligence/v1/VideoIntelligenceServiceSettings.java @@ -53,7 +53,7 @@ * * VideoIntelligenceServiceSettings.Builder videoIntelligenceServiceSettingsBuilder = * VideoIntelligenceServiceSettings.newBuilder(); - * videoIntelligenceServiceSettingsBuilder.annotateVideoSettings().getRetrySettingsBuilder() + * videoIntelligenceServiceSettingsBuilder.annotateVideoSettings().getRetrySettings().toBuilder() * .setTotalTimeout(Duration.ofSeconds(30)); * VideoIntelligenceServiceSettings videoIntelligenceServiceSettings = videoIntelligenceServiceSettingsBuilder.build(); * diff --git a/google-cloud-video-intelligence/src/main/java/com/google/cloud/videointelligence/v1/stub/VideoIntelligenceServiceStubSettings.java b/google-cloud-video-intelligence/src/main/java/com/google/cloud/videointelligence/v1/stub/VideoIntelligenceServiceStubSettings.java index 4fcaecdebaf8..88b2f426bf36 100644 --- a/google-cloud-video-intelligence/src/main/java/com/google/cloud/videointelligence/v1/stub/VideoIntelligenceServiceStubSettings.java +++ b/google-cloud-video-intelligence/src/main/java/com/google/cloud/videointelligence/v1/stub/VideoIntelligenceServiceStubSettings.java @@ -68,7 +68,7 @@ * * VideoIntelligenceServiceStubSettings.Builder videoIntelligenceServiceSettingsBuilder = * VideoIntelligenceServiceStubSettings.newBuilder(); - * videoIntelligenceServiceSettingsBuilder.annotateVideoSettings().getRetrySettingsBuilder() + * videoIntelligenceServiceSettingsBuilder.annotateVideoSettings().getRetrySettings().toBuilder() * .setTotalTimeout(Duration.ofSeconds(30)); * VideoIntelligenceServiceStubSettings videoIntelligenceServiceSettings = videoIntelligenceServiceSettingsBuilder.build(); * diff --git a/google-cloud-video-intelligence/src/main/java/com/google/cloud/videointelligence/v1beta1/VideoIntelligenceServiceSettings.java b/google-cloud-video-intelligence/src/main/java/com/google/cloud/videointelligence/v1beta1/VideoIntelligenceServiceSettings.java index 938eb88273ba..dea9309efe19 100644 --- a/google-cloud-video-intelligence/src/main/java/com/google/cloud/videointelligence/v1beta1/VideoIntelligenceServiceSettings.java +++ b/google-cloud-video-intelligence/src/main/java/com/google/cloud/videointelligence/v1beta1/VideoIntelligenceServiceSettings.java @@ -53,7 +53,7 @@ * * VideoIntelligenceServiceSettings.Builder videoIntelligenceServiceSettingsBuilder = * VideoIntelligenceServiceSettings.newBuilder(); - * videoIntelligenceServiceSettingsBuilder.annotateVideoSettings().getRetrySettingsBuilder() + * videoIntelligenceServiceSettingsBuilder.annotateVideoSettings().getRetrySettings().toBuilder() * .setTotalTimeout(Duration.ofSeconds(30)); * VideoIntelligenceServiceSettings videoIntelligenceServiceSettings = videoIntelligenceServiceSettingsBuilder.build(); * diff --git a/google-cloud-video-intelligence/src/main/java/com/google/cloud/videointelligence/v1beta1/stub/VideoIntelligenceServiceStubSettings.java b/google-cloud-video-intelligence/src/main/java/com/google/cloud/videointelligence/v1beta1/stub/VideoIntelligenceServiceStubSettings.java index 6b14acce4df7..4da697fb1e53 100644 --- a/google-cloud-video-intelligence/src/main/java/com/google/cloud/videointelligence/v1beta1/stub/VideoIntelligenceServiceStubSettings.java +++ b/google-cloud-video-intelligence/src/main/java/com/google/cloud/videointelligence/v1beta1/stub/VideoIntelligenceServiceStubSettings.java @@ -68,7 +68,7 @@ * * VideoIntelligenceServiceStubSettings.Builder videoIntelligenceServiceSettingsBuilder = * VideoIntelligenceServiceStubSettings.newBuilder(); - * videoIntelligenceServiceSettingsBuilder.annotateVideoSettings().getRetrySettingsBuilder() + * videoIntelligenceServiceSettingsBuilder.annotateVideoSettings().getRetrySettings().toBuilder() * .setTotalTimeout(Duration.ofSeconds(30)); * VideoIntelligenceServiceStubSettings videoIntelligenceServiceSettings = videoIntelligenceServiceSettingsBuilder.build(); * diff --git a/google-cloud-video-intelligence/src/main/java/com/google/cloud/videointelligence/v1beta2/VideoIntelligenceServiceSettings.java b/google-cloud-video-intelligence/src/main/java/com/google/cloud/videointelligence/v1beta2/VideoIntelligenceServiceSettings.java index 91aa59f4a5e5..3cfb898fd5a2 100644 --- a/google-cloud-video-intelligence/src/main/java/com/google/cloud/videointelligence/v1beta2/VideoIntelligenceServiceSettings.java +++ b/google-cloud-video-intelligence/src/main/java/com/google/cloud/videointelligence/v1beta2/VideoIntelligenceServiceSettings.java @@ -53,7 +53,7 @@ * * VideoIntelligenceServiceSettings.Builder videoIntelligenceServiceSettingsBuilder = * VideoIntelligenceServiceSettings.newBuilder(); - * videoIntelligenceServiceSettingsBuilder.annotateVideoSettings().getRetrySettingsBuilder() + * videoIntelligenceServiceSettingsBuilder.annotateVideoSettings().getRetrySettings().toBuilder() * .setTotalTimeout(Duration.ofSeconds(30)); * VideoIntelligenceServiceSettings videoIntelligenceServiceSettings = videoIntelligenceServiceSettingsBuilder.build(); * diff --git a/google-cloud-video-intelligence/src/main/java/com/google/cloud/videointelligence/v1beta2/stub/VideoIntelligenceServiceStubSettings.java b/google-cloud-video-intelligence/src/main/java/com/google/cloud/videointelligence/v1beta2/stub/VideoIntelligenceServiceStubSettings.java index 19d47c4c654c..2e37558e95a2 100644 --- a/google-cloud-video-intelligence/src/main/java/com/google/cloud/videointelligence/v1beta2/stub/VideoIntelligenceServiceStubSettings.java +++ b/google-cloud-video-intelligence/src/main/java/com/google/cloud/videointelligence/v1beta2/stub/VideoIntelligenceServiceStubSettings.java @@ -68,7 +68,7 @@ * * VideoIntelligenceServiceStubSettings.Builder videoIntelligenceServiceSettingsBuilder = * VideoIntelligenceServiceStubSettings.newBuilder(); - * videoIntelligenceServiceSettingsBuilder.annotateVideoSettings().getRetrySettingsBuilder() + * videoIntelligenceServiceSettingsBuilder.annotateVideoSettings().getRetrySettings().toBuilder() * .setTotalTimeout(Duration.ofSeconds(30)); * VideoIntelligenceServiceStubSettings videoIntelligenceServiceSettings = videoIntelligenceServiceSettingsBuilder.build(); * diff --git a/google-cloud-videointelligence/src/main/java/com/google/cloud/videointelligence/v1p1beta1/VideoIntelligenceServiceClient.java b/google-cloud-video-intelligence/src/main/java/com/google/cloud/videointelligence/v1p1beta1/VideoIntelligenceServiceClient.java similarity index 100% rename from google-cloud-videointelligence/src/main/java/com/google/cloud/videointelligence/v1p1beta1/VideoIntelligenceServiceClient.java rename to google-cloud-video-intelligence/src/main/java/com/google/cloud/videointelligence/v1p1beta1/VideoIntelligenceServiceClient.java diff --git a/google-cloud-videointelligence/src/main/java/com/google/cloud/videointelligence/v1p1beta1/VideoIntelligenceServiceSettings.java b/google-cloud-video-intelligence/src/main/java/com/google/cloud/videointelligence/v1p1beta1/VideoIntelligenceServiceSettings.java similarity index 100% rename from google-cloud-videointelligence/src/main/java/com/google/cloud/videointelligence/v1p1beta1/VideoIntelligenceServiceSettings.java rename to google-cloud-video-intelligence/src/main/java/com/google/cloud/videointelligence/v1p1beta1/VideoIntelligenceServiceSettings.java diff --git a/google-cloud-videointelligence/src/main/java/com/google/cloud/videointelligence/v1p1beta1/package-info.java b/google-cloud-video-intelligence/src/main/java/com/google/cloud/videointelligence/v1p1beta1/package-info.java similarity index 100% rename from google-cloud-videointelligence/src/main/java/com/google/cloud/videointelligence/v1p1beta1/package-info.java rename to google-cloud-video-intelligence/src/main/java/com/google/cloud/videointelligence/v1p1beta1/package-info.java diff --git a/google-cloud-videointelligence/src/main/java/com/google/cloud/videointelligence/v1p1beta1/stub/GrpcVideoIntelligenceServiceStub.java b/google-cloud-video-intelligence/src/main/java/com/google/cloud/videointelligence/v1p1beta1/stub/GrpcVideoIntelligenceServiceStub.java similarity index 100% rename from google-cloud-videointelligence/src/main/java/com/google/cloud/videointelligence/v1p1beta1/stub/GrpcVideoIntelligenceServiceStub.java rename to google-cloud-video-intelligence/src/main/java/com/google/cloud/videointelligence/v1p1beta1/stub/GrpcVideoIntelligenceServiceStub.java diff --git a/google-cloud-videointelligence/src/main/java/com/google/cloud/videointelligence/v1p1beta1/stub/VideoIntelligenceServiceStub.java b/google-cloud-video-intelligence/src/main/java/com/google/cloud/videointelligence/v1p1beta1/stub/VideoIntelligenceServiceStub.java similarity index 100% rename from google-cloud-videointelligence/src/main/java/com/google/cloud/videointelligence/v1p1beta1/stub/VideoIntelligenceServiceStub.java rename to google-cloud-video-intelligence/src/main/java/com/google/cloud/videointelligence/v1p1beta1/stub/VideoIntelligenceServiceStub.java diff --git a/google-cloud-videointelligence/src/main/java/com/google/cloud/videointelligence/v1p1beta1/stub/VideoIntelligenceServiceStubSettings.java b/google-cloud-video-intelligence/src/main/java/com/google/cloud/videointelligence/v1p1beta1/stub/VideoIntelligenceServiceStubSettings.java similarity index 100% rename from google-cloud-videointelligence/src/main/java/com/google/cloud/videointelligence/v1p1beta1/stub/VideoIntelligenceServiceStubSettings.java rename to google-cloud-video-intelligence/src/main/java/com/google/cloud/videointelligence/v1p1beta1/stub/VideoIntelligenceServiceStubSettings.java diff --git a/google-cloud-videointelligence/src/test/java/com/google/cloud/videointelligence/v1p1beta1/MockVideoIntelligenceService.java b/google-cloud-video-intelligence/src/test/java/com/google/cloud/videointelligence/v1p1beta1/MockVideoIntelligenceService.java similarity index 100% rename from google-cloud-videointelligence/src/test/java/com/google/cloud/videointelligence/v1p1beta1/MockVideoIntelligenceService.java rename to google-cloud-video-intelligence/src/test/java/com/google/cloud/videointelligence/v1p1beta1/MockVideoIntelligenceService.java diff --git a/google-cloud-videointelligence/src/test/java/com/google/cloud/videointelligence/v1p1beta1/MockVideoIntelligenceServiceImpl.java b/google-cloud-video-intelligence/src/test/java/com/google/cloud/videointelligence/v1p1beta1/MockVideoIntelligenceServiceImpl.java similarity index 100% rename from google-cloud-videointelligence/src/test/java/com/google/cloud/videointelligence/v1p1beta1/MockVideoIntelligenceServiceImpl.java rename to google-cloud-video-intelligence/src/test/java/com/google/cloud/videointelligence/v1p1beta1/MockVideoIntelligenceServiceImpl.java diff --git a/google-cloud-videointelligence/src/test/java/com/google/cloud/videointelligence/v1p1beta1/VideoIntelligenceServiceClientTest.java b/google-cloud-video-intelligence/src/test/java/com/google/cloud/videointelligence/v1p1beta1/VideoIntelligenceServiceClientTest.java similarity index 100% rename from google-cloud-videointelligence/src/test/java/com/google/cloud/videointelligence/v1p1beta1/VideoIntelligenceServiceClientTest.java rename to google-cloud-video-intelligence/src/test/java/com/google/cloud/videointelligence/v1p1beta1/VideoIntelligenceServiceClientTest.java diff --git a/google-cloud-videointelligence/src/main/java/com/google/cloud/videointelligence/v1/VideoIntelligenceServiceClient.java b/google-cloud-videointelligence/src/main/java/com/google/cloud/videointelligence/v1/VideoIntelligenceServiceClient.java deleted file mode 100644 index 197f5be8f5cc..000000000000 --- a/google-cloud-videointelligence/src/main/java/com/google/cloud/videointelligence/v1/VideoIntelligenceServiceClient.java +++ /dev/null @@ -1,321 +0,0 @@ -/* - * 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.videointelligence.v1; - -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.videointelligence.v1.stub.VideoIntelligenceServiceStub; -import com.google.cloud.videointelligence.v1.stub.VideoIntelligenceServiceStubSettings; -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 implements Google Cloud Video Intelligence API. - * - *

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: - * - *

- * 
- * try (VideoIntelligenceServiceClient videoIntelligenceServiceClient = VideoIntelligenceServiceClient.create()) {
- *   String inputUri = "gs://demomaker/cat.mp4";
- *   Feature featuresElement = Feature.LABEL_DETECTION;
- *   List<Feature> features = Arrays.asList(featuresElement);
- *   AnnotateVideoResponse response = videoIntelligenceServiceClient.annotateVideoAsync(inputUri, features).get();
- * }
- * 
- * 
- * - *

Note: close() needs to be called on the videoIntelligenceServiceClient 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: - * - *

    - *
  1. 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. - *
  2. 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. - *
  3. 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 - * VideoIntelligenceServiceSettings to create(). For example: - * - *

To customize credentials: - * - *

- * 
- * VideoIntelligenceServiceSettings videoIntelligenceServiceSettings =
- *     VideoIntelligenceServiceSettings.newBuilder()
- *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
- *         .build();
- * VideoIntelligenceServiceClient videoIntelligenceServiceClient =
- *     VideoIntelligenceServiceClient.create(videoIntelligenceServiceSettings);
- * 
- * 
- * - * To customize the endpoint: - * - *
- * 
- * VideoIntelligenceServiceSettings videoIntelligenceServiceSettings =
- *     VideoIntelligenceServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
- * VideoIntelligenceServiceClient videoIntelligenceServiceClient =
- *     VideoIntelligenceServiceClient.create(videoIntelligenceServiceSettings);
- * 
- * 
- */ -@Generated("by GAPIC v0.0.5") -@BetaApi -public class VideoIntelligenceServiceClient implements BackgroundResource { - private final VideoIntelligenceServiceSettings settings; - private final VideoIntelligenceServiceStub stub; - private final OperationsClient operationsClient; - - /** Constructs an instance of VideoIntelligenceServiceClient with default settings. */ - public static final VideoIntelligenceServiceClient create() throws IOException { - return create(VideoIntelligenceServiceSettings.newBuilder().build()); - } - - /** - * Constructs an instance of VideoIntelligenceServiceClient, 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 VideoIntelligenceServiceClient create( - VideoIntelligenceServiceSettings settings) throws IOException { - return new VideoIntelligenceServiceClient(settings); - } - - /** - * Constructs an instance of VideoIntelligenceServiceClient, using the given stub for making - * calls. This is for advanced usage - prefer to use VideoIntelligenceServiceSettings}. - */ - @BetaApi("A restructuring of stub classes is planned, so this may break in the future") - public static final VideoIntelligenceServiceClient create(VideoIntelligenceServiceStub stub) { - return new VideoIntelligenceServiceClient(stub); - } - - /** - * Constructs an instance of VideoIntelligenceServiceClient, 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 VideoIntelligenceServiceClient(VideoIntelligenceServiceSettings settings) - throws IOException { - this.settings = settings; - this.stub = ((VideoIntelligenceServiceStubSettings) 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 VideoIntelligenceServiceClient(VideoIntelligenceServiceStub stub) { - this.settings = null; - this.stub = stub; - this.operationsClient = OperationsClient.create(this.stub.getOperationsStub()); - } - - public final VideoIntelligenceServiceSettings getSettings() { - return settings; - } - - @BetaApi("A restructuring of stub classes is planned, so this may break in the future") - public VideoIntelligenceServiceStub 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 - /** - * Performs asynchronous video annotation. Progress and results can be retrieved through the - * `google.longrunning.Operations` interface. `Operation.metadata` contains - * `AnnotateVideoProgress` (progress). `Operation.response` contains `AnnotateVideoResponse` - * (results). - * - *

Sample code: - * - *


-   * try (VideoIntelligenceServiceClient videoIntelligenceServiceClient = VideoIntelligenceServiceClient.create()) {
-   *   String inputUri = "gs://demomaker/cat.mp4";
-   *   Feature featuresElement = Feature.LABEL_DETECTION;
-   *   List<Feature> features = Arrays.asList(featuresElement);
-   *   AnnotateVideoResponse response = videoIntelligenceServiceClient.annotateVideoAsync(inputUri, features).get();
-   * }
-   * 
- * - * @param inputUri Input video location. 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). A video URI may include - * wildcards in `object-id`, and thus identify multiple videos. Supported wildcards: '*' - * 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. - * @throws com.google.api.gax.rpc.ApiException if the remote call fails - */ - public final OperationFuture annotateVideoAsync( - String inputUri, List features) { - - AnnotateVideoRequest request = - AnnotateVideoRequest.newBuilder().setInputUri(inputUri).addAllFeatures(features).build(); - return annotateVideoAsync(request); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD - /** - * Performs asynchronous video annotation. Progress and results can be retrieved through the - * `google.longrunning.Operations` interface. `Operation.metadata` contains - * `AnnotateVideoProgress` (progress). `Operation.response` contains `AnnotateVideoResponse` - * (results). - * - *

Sample code: - * - *


-   * try (VideoIntelligenceServiceClient videoIntelligenceServiceClient = VideoIntelligenceServiceClient.create()) {
-   *   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)
-   *     .build();
-   *   AnnotateVideoResponse response = videoIntelligenceServiceClient.annotateVideoAsync(request).get();
-   * }
-   * 
- * - * @param request The request object containing all of the parameters for the API call. - * @throws com.google.api.gax.rpc.ApiException if the remote call fails - */ - public final OperationFuture annotateVideoAsync( - AnnotateVideoRequest request) { - return annotateVideoOperationCallable().futureCall(request); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD - /** - * Performs asynchronous video annotation. Progress and results can be retrieved through the - * `google.longrunning.Operations` interface. `Operation.metadata` contains - * `AnnotateVideoProgress` (progress). `Operation.response` contains `AnnotateVideoResponse` - * (results). - * - *

Sample code: - * - *


-   * try (VideoIntelligenceServiceClient videoIntelligenceServiceClient = VideoIntelligenceServiceClient.create()) {
-   *   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)
-   *     .build();
-   *   OperationFuture<Operation> future = videoIntelligenceServiceClient.annotateVideoOperationCallable().futureCall(request);
-   *   // Do something
-   *   AnnotateVideoResponse response = future.get();
-   * }
-   * 
- */ - public final OperationCallable - annotateVideoOperationCallable() { - return stub.annotateVideoOperationCallable(); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD - /** - * Performs asynchronous video annotation. Progress and results can be retrieved through the - * `google.longrunning.Operations` interface. `Operation.metadata` contains - * `AnnotateVideoProgress` (progress). `Operation.response` contains `AnnotateVideoResponse` - * (results). - * - *

Sample code: - * - *


-   * try (VideoIntelligenceServiceClient videoIntelligenceServiceClient = VideoIntelligenceServiceClient.create()) {
-   *   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)
-   *     .build();
-   *   ApiFuture<Operation> future = videoIntelligenceServiceClient.annotateVideoCallable().futureCall(request);
-   *   // Do something
-   *   Operation response = future.get();
-   * }
-   * 
- */ - public final UnaryCallable annotateVideoCallable() { - return stub.annotateVideoCallable(); - } - - @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-videointelligence/src/main/java/com/google/cloud/videointelligence/v1/VideoIntelligenceServiceSettings.java b/google-cloud-videointelligence/src/main/java/com/google/cloud/videointelligence/v1/VideoIntelligenceServiceSettings.java deleted file mode 100644 index ad9008306598..000000000000 --- a/google-cloud-videointelligence/src/main/java/com/google/cloud/videointelligence/v1/VideoIntelligenceServiceSettings.java +++ /dev/null @@ -1,192 +0,0 @@ -/* - * 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.videointelligence.v1; - -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.videointelligence.v1.stub.VideoIntelligenceServiceStubSettings; -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 VideoIntelligenceServiceClient}. - * - *

The default instance has everything set to sensible defaults: - * - *

    - *
  • The default service address (videointelligence.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 annotateVideoAsync to 30 seconds: - * - *

- * 
- * VideoIntelligenceServiceSettings.Builder videoIntelligenceServiceSettingsBuilder =
- *     VideoIntelligenceServiceSettings.newBuilder();
- * videoIntelligenceServiceSettingsBuilder.annotateVideoSettings().getRetrySettings().toBuilder()
- *     .setTotalTimeout(Duration.ofSeconds(30));
- * VideoIntelligenceServiceSettings videoIntelligenceServiceSettings = videoIntelligenceServiceSettingsBuilder.build();
- * 
- * 
- */ -@Generated("by GAPIC v0.0.5") -@BetaApi -public class VideoIntelligenceServiceSettings - extends ClientSettings { - /** Returns the object with the settings used for calls to annotateVideo. */ - public UnaryCallSettings annotateVideoSettings() { - return ((VideoIntelligenceServiceStubSettings) getStubSettings()).annotateVideoSettings(); - } - - /** Returns the object with the settings used for calls to annotateVideo. */ - public OperationCallSettings - annotateVideoOperationSettings() { - return ((VideoIntelligenceServiceStubSettings) getStubSettings()) - .annotateVideoOperationSettings(); - } - - public static final VideoIntelligenceServiceSettings create( - VideoIntelligenceServiceStubSettings stub) throws IOException { - return new VideoIntelligenceServiceSettings.Builder(stub.toBuilder()).build(); - } - - /** Returns a builder for the default ExecutorProvider for this service. */ - public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { - return VideoIntelligenceServiceStubSettings.defaultExecutorProviderBuilder(); - } - - /** Returns the default service endpoint. */ - public static String getDefaultEndpoint() { - return VideoIntelligenceServiceStubSettings.getDefaultEndpoint(); - } - - /** Returns the default service scopes. */ - public static List getDefaultServiceScopes() { - return VideoIntelligenceServiceStubSettings.getDefaultServiceScopes(); - } - - /** Returns a builder for the default credentials for this service. */ - public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { - return VideoIntelligenceServiceStubSettings.defaultCredentialsProviderBuilder(); - } - - /** Returns a builder for the default ChannelProvider for this service. */ - public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() { - return VideoIntelligenceServiceStubSettings.defaultGrpcTransportProviderBuilder(); - } - - public static TransportChannelProvider defaultTransportChannelProvider() { - return VideoIntelligenceServiceStubSettings.defaultTransportChannelProvider(); - } - - @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") - public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { - return VideoIntelligenceServiceStubSettings.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 VideoIntelligenceServiceSettings(Builder settingsBuilder) throws IOException { - super(settingsBuilder); - } - - /** Builder for VideoIntelligenceServiceSettings. */ - public static class Builder - extends ClientSettings.Builder { - protected Builder() throws IOException { - this((ClientContext) null); - } - - protected Builder(ClientContext clientContext) { - super(VideoIntelligenceServiceStubSettings.newBuilder(clientContext)); - } - - private static Builder createDefault() { - return new Builder(VideoIntelligenceServiceStubSettings.newBuilder()); - } - - protected Builder(VideoIntelligenceServiceSettings settings) { - super(settings.getStubSettings().toBuilder()); - } - - protected Builder(VideoIntelligenceServiceStubSettings.Builder stubSettings) { - super(stubSettings); - } - - public VideoIntelligenceServiceStubSettings.Builder getStubSettingsBuilder() { - return ((VideoIntelligenceServiceStubSettings.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 annotateVideo. */ - public UnaryCallSettings.Builder annotateVideoSettings() { - return getStubSettingsBuilder().annotateVideoSettings(); - } - - /** Returns the builder for the settings used for calls to annotateVideo. */ - public OperationCallSettings.Builder< - AnnotateVideoRequest, AnnotateVideoResponse, AnnotateVideoProgress> - annotateVideoOperationSettings() { - return getStubSettingsBuilder().annotateVideoOperationSettings(); - } - - @Override - public VideoIntelligenceServiceSettings build() throws IOException { - return new VideoIntelligenceServiceSettings(this); - } - } -} diff --git a/google-cloud-videointelligence/src/main/java/com/google/cloud/videointelligence/v1/package-info.java b/google-cloud-videointelligence/src/main/java/com/google/cloud/videointelligence/v1/package-info.java deleted file mode 100644 index 4db37157b399..000000000000 --- a/google-cloud-videointelligence/src/main/java/com/google/cloud/videointelligence/v1/package-info.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * 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 Cloud Video Intelligence API. - * - *

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

============================== VideoIntelligenceServiceClient ============================== - * - *

Service Description: Service that implements Google Cloud Video Intelligence API. - * - *

Sample for VideoIntelligenceServiceClient: - * - *

- * 
- * try (VideoIntelligenceServiceClient videoIntelligenceServiceClient = VideoIntelligenceServiceClient.create()) {
- *   String inputUri = "gs://demomaker/cat.mp4";
- *   Feature featuresElement = Feature.LABEL_DETECTION;
- *   List<Feature> features = Arrays.asList(featuresElement);
- *   AnnotateVideoResponse response = videoIntelligenceServiceClient.annotateVideoAsync(inputUri, features);
- * }
- * 
- * 
- */ -package com.google.cloud.videointelligence.v1; diff --git a/google-cloud-videointelligence/src/main/java/com/google/cloud/videointelligence/v1/stub/GrpcVideoIntelligenceServiceStub.java b/google-cloud-videointelligence/src/main/java/com/google/cloud/videointelligence/v1/stub/GrpcVideoIntelligenceServiceStub.java deleted file mode 100644 index f2c4bd849371..000000000000 --- a/google-cloud-videointelligence/src/main/java/com/google/cloud/videointelligence/v1/stub/GrpcVideoIntelligenceServiceStub.java +++ /dev/null @@ -1,147 +0,0 @@ -/* - * 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.videointelligence.v1.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.videointelligence.v1.AnnotateVideoProgress; -import com.google.cloud.videointelligence.v1.AnnotateVideoRequest; -import com.google.cloud.videointelligence.v1.AnnotateVideoResponse; -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 Cloud Video Intelligence 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 GrpcVideoIntelligenceServiceStub extends VideoIntelligenceServiceStub { - - private static final MethodDescriptor - annotateVideoMethodDescriptor = - MethodDescriptor.newBuilder() - .setType(MethodDescriptor.MethodType.UNARY) - .setFullMethodName( - "google.cloud.videointelligence.v1.VideoIntelligenceService/AnnotateVideo") - .setRequestMarshaller( - ProtoUtils.marshaller(AnnotateVideoRequest.getDefaultInstance())) - .setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance())) - .build(); - - private final BackgroundResource backgroundResources; - private final GrpcOperationsStub operationsStub; - - private final UnaryCallable annotateVideoCallable; - private final OperationCallable< - AnnotateVideoRequest, AnnotateVideoResponse, AnnotateVideoProgress> - annotateVideoOperationCallable; - - public static final GrpcVideoIntelligenceServiceStub create( - VideoIntelligenceServiceStubSettings settings) throws IOException { - return new GrpcVideoIntelligenceServiceStub(settings, ClientContext.create(settings)); - } - - public static final GrpcVideoIntelligenceServiceStub create(ClientContext clientContext) - throws IOException { - return new GrpcVideoIntelligenceServiceStub( - VideoIntelligenceServiceStubSettings.newBuilder().build(), clientContext); - } - - /** - * Constructs an instance of GrpcVideoIntelligenceServiceStub, 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 GrpcVideoIntelligenceServiceStub( - VideoIntelligenceServiceStubSettings settings, ClientContext clientContext) - throws IOException { - this.operationsStub = GrpcOperationsStub.create(clientContext); - - GrpcCallSettings annotateVideoTransportSettings = - GrpcCallSettings.newBuilder() - .setMethodDescriptor(annotateVideoMethodDescriptor) - .build(); - - this.annotateVideoCallable = - GrpcCallableFactory.createUnaryCallable( - annotateVideoTransportSettings, settings.annotateVideoSettings(), clientContext); - this.annotateVideoOperationCallable = - GrpcCallableFactory.createOperationCallable( - annotateVideoTransportSettings, - settings.annotateVideoOperationSettings(), - clientContext, - this.operationsStub); - - backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources()); - } - - public GrpcOperationsStub getOperationsStub() { - return operationsStub; - } - - public OperationCallable - annotateVideoOperationCallable() { - return annotateVideoOperationCallable; - } - - public UnaryCallable annotateVideoCallable() { - return annotateVideoCallable; - } - - @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-videointelligence/src/main/java/com/google/cloud/videointelligence/v1/stub/VideoIntelligenceServiceStub.java b/google-cloud-videointelligence/src/main/java/com/google/cloud/videointelligence/v1/stub/VideoIntelligenceServiceStub.java deleted file mode 100644 index b322f92bbfd2..000000000000 --- a/google-cloud-videointelligence/src/main/java/com/google/cloud/videointelligence/v1/stub/VideoIntelligenceServiceStub.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * 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.videointelligence.v1.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.videointelligence.v1.AnnotateVideoProgress; -import com.google.cloud.videointelligence.v1.AnnotateVideoRequest; -import com.google.cloud.videointelligence.v1.AnnotateVideoResponse; -import com.google.longrunning.Operation; -import com.google.longrunning.stub.OperationsStub; -import javax.annotation.Generated; - -// AUTO-GENERATED DOCUMENTATION AND CLASS -/** - * Base stub class for Cloud Video Intelligence 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 VideoIntelligenceServiceStub implements BackgroundResource { - - public OperationsStub getOperationsStub() { - throw new UnsupportedOperationException("Not implemented: getOperationsStub()"); - } - - public OperationCallable - annotateVideoOperationCallable() { - throw new UnsupportedOperationException("Not implemented: annotateVideoOperationCallable()"); - } - - public UnaryCallable annotateVideoCallable() { - throw new UnsupportedOperationException("Not implemented: annotateVideoCallable()"); - } -} diff --git a/google-cloud-videointelligence/src/main/java/com/google/cloud/videointelligence/v1/stub/VideoIntelligenceServiceStubSettings.java b/google-cloud-videointelligence/src/main/java/com/google/cloud/videointelligence/v1/stub/VideoIntelligenceServiceStubSettings.java deleted file mode 100644 index 88b2f426bf36..000000000000 --- a/google-cloud-videointelligence/src/main/java/com/google/cloud/videointelligence/v1/stub/VideoIntelligenceServiceStubSettings.java +++ /dev/null @@ -1,318 +0,0 @@ -/* - * 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.videointelligence.v1.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.videointelligence.v1.AnnotateVideoProgress; -import com.google.cloud.videointelligence.v1.AnnotateVideoRequest; -import com.google.cloud.videointelligence.v1.AnnotateVideoResponse; -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 VideoIntelligenceServiceStub}. - * - *

The default instance has everything set to sensible defaults: - * - *

    - *
  • The default service address (videointelligence.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 annotateVideoAsync to 30 seconds: - * - *

- * 
- * VideoIntelligenceServiceStubSettings.Builder videoIntelligenceServiceSettingsBuilder =
- *     VideoIntelligenceServiceStubSettings.newBuilder();
- * videoIntelligenceServiceSettingsBuilder.annotateVideoSettings().getRetrySettings().toBuilder()
- *     .setTotalTimeout(Duration.ofSeconds(30));
- * VideoIntelligenceServiceStubSettings videoIntelligenceServiceSettings = videoIntelligenceServiceSettingsBuilder.build();
- * 
- * 
- */ -@Generated("by GAPIC v0.0.5") -@BetaApi -public class VideoIntelligenceServiceStubSettings - extends StubSettings { - /** The default scopes of the service. */ - private static final ImmutableList DEFAULT_SERVICE_SCOPES = - ImmutableList.builder().add("https://www.googleapis.com/auth/cloud-platform").build(); - - private final UnaryCallSettings annotateVideoSettings; - private final OperationCallSettings< - AnnotateVideoRequest, AnnotateVideoResponse, AnnotateVideoProgress> - annotateVideoOperationSettings; - - /** Returns the object with the settings used for calls to annotateVideo. */ - public UnaryCallSettings annotateVideoSettings() { - return annotateVideoSettings; - } - - /** Returns the object with the settings used for calls to annotateVideo. */ - public OperationCallSettings - annotateVideoOperationSettings() { - return annotateVideoOperationSettings; - } - - @BetaApi("A restructuring of stub classes is planned, so this may break in the future") - public VideoIntelligenceServiceStub createStub() throws IOException { - if (getTransportChannelProvider() - .getTransportName() - .equals(GrpcTransportChannel.getGrpcTransportName())) { - return GrpcVideoIntelligenceServiceStub.create(this); - } else { - throw new UnsupportedOperationException( - "Transport not supported: " + getTransportChannelProvider().getTransportName()); - } - } - - /** Returns a builder for the default ExecutorProvider for this service. */ - public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { - return InstantiatingExecutorProvider.newBuilder(); - } - - /** Returns the default service endpoint. */ - public static String getDefaultEndpoint() { - return "videointelligence.googleapis.com:443"; - } - - /** Returns the default service scopes. */ - public static List getDefaultServiceScopes() { - return DEFAULT_SERVICE_SCOPES; - } - - /** Returns a builder for the default credentials for this service. */ - public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { - return GoogleCredentialsProvider.newBuilder().setScopesToApply(DEFAULT_SERVICE_SCOPES); - } - - /** Returns a builder for the default ChannelProvider for this service. */ - public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() { - return InstantiatingGrpcChannelProvider.newBuilder(); - } - - public static TransportChannelProvider defaultTransportChannelProvider() { - return defaultGrpcTransportProviderBuilder().build(); - } - - @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") - public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { - return ApiClientHeaderProvider.newBuilder() - .setGeneratedLibToken( - "gapic", GaxProperties.getLibraryVersion(VideoIntelligenceServiceStubSettings.class)) - .setTransportToken( - GaxGrpcProperties.getGrpcTokenName(), GaxGrpcProperties.getGrpcVersion()); - } - - /** 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 VideoIntelligenceServiceStubSettings(Builder settingsBuilder) throws IOException { - super(settingsBuilder); - - annotateVideoSettings = settingsBuilder.annotateVideoSettings().build(); - annotateVideoOperationSettings = settingsBuilder.annotateVideoOperationSettings().build(); - } - - /** Builder for VideoIntelligenceServiceStubSettings. */ - public static class Builder - extends StubSettings.Builder { - private final ImmutableList> unaryMethodSettingsBuilders; - - private final UnaryCallSettings.Builder annotateVideoSettings; - private final OperationCallSettings.Builder< - AnnotateVideoRequest, AnnotateVideoResponse, AnnotateVideoProgress> - annotateVideoOperationSettings; - - private static final ImmutableMap> - RETRYABLE_CODE_DEFINITIONS; - - static { - ImmutableMap.Builder> definitions = - ImmutableMap.builder(); - definitions.put( - "idempotent", - ImmutableSet.copyOf( - Lists.newArrayList( - StatusCode.Code.DEADLINE_EXCEEDED, StatusCode.Code.UNAVAILABLE))); - definitions.put("non_idempotent", ImmutableSet.copyOf(Lists.newArrayList())); - RETRYABLE_CODE_DEFINITIONS = definitions.build(); - } - - private static final ImmutableMap RETRY_PARAM_DEFINITIONS; - - static { - ImmutableMap.Builder definitions = ImmutableMap.builder(); - RetrySettings settings = null; - settings = - RetrySettings.newBuilder() - .setInitialRetryDelay(Duration.ofMillis(1000L)) - .setRetryDelayMultiplier(2.5) - .setMaxRetryDelay(Duration.ofMillis(120000L)) - .setInitialRpcTimeout(Duration.ofMillis(120000L)) - .setRpcTimeoutMultiplier(1.0) - .setMaxRpcTimeout(Duration.ofMillis(120000L)) - .setTotalTimeout(Duration.ofMillis(600000L)) - .build(); - definitions.put("default", settings); - RETRY_PARAM_DEFINITIONS = definitions.build(); - } - - protected Builder() { - this((ClientContext) null); - } - - protected Builder(ClientContext clientContext) { - super(clientContext); - - annotateVideoSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); - - annotateVideoOperationSettings = OperationCallSettings.newBuilder(); - - unaryMethodSettingsBuilders = - ImmutableList.>of(annotateVideoSettings); - - initDefaults(this); - } - - private static Builder createDefault() { - Builder builder = new Builder((ClientContext) null); - builder.setTransportChannelProvider(defaultTransportChannelProvider()); - builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build()); - builder.setInternalHeaderProvider(defaultApiClientHeaderProviderBuilder().build()); - builder.setEndpoint(getDefaultEndpoint()); - return initDefaults(builder); - } - - private static Builder initDefaults(Builder builder) { - - builder - .annotateVideoSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); - builder - .annotateVideoOperationSettings() - .setInitialCallSettings( - UnaryCallSettings - .newUnaryCallSettingsBuilder() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")) - .build()) - .setResponseTransformer( - ProtoOperationTransformers.ResponseTransformer.create(AnnotateVideoResponse.class)) - .setMetadataTransformer( - ProtoOperationTransformers.MetadataTransformer.create(AnnotateVideoProgress.class)) - .setPollingAlgorithm( - OperationTimedPollAlgorithm.create( - RetrySettings.newBuilder() - .setInitialRetryDelay(Duration.ofMillis(20000L)) - .setRetryDelayMultiplier(1.5) - .setMaxRetryDelay(Duration.ofMillis(45000L)) - .setInitialRpcTimeout(Duration.ZERO) // ignored - .setRpcTimeoutMultiplier(1.0) // ignored - .setMaxRpcTimeout(Duration.ZERO) // ignored - .setTotalTimeout(Duration.ofMillis(86400000L)) - .build())); - - return builder; - } - - protected Builder(VideoIntelligenceServiceStubSettings settings) { - super(settings); - - annotateVideoSettings = settings.annotateVideoSettings.toBuilder(); - annotateVideoOperationSettings = settings.annotateVideoOperationSettings.toBuilder(); - - unaryMethodSettingsBuilders = - ImmutableList.>of(annotateVideoSettings); - } - - /** - * 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(unaryMethodSettingsBuilders, settingsUpdater); - return this; - } - - public ImmutableList> unaryMethodSettingsBuilders() { - return unaryMethodSettingsBuilders; - } - - /** Returns the builder for the settings used for calls to annotateVideo. */ - public UnaryCallSettings.Builder annotateVideoSettings() { - return annotateVideoSettings; - } - - /** Returns the builder for the settings used for calls to annotateVideo. */ - public OperationCallSettings.Builder< - AnnotateVideoRequest, AnnotateVideoResponse, AnnotateVideoProgress> - annotateVideoOperationSettings() { - return annotateVideoOperationSettings; - } - - @Override - public VideoIntelligenceServiceStubSettings build() throws IOException { - return new VideoIntelligenceServiceStubSettings(this); - } - } -} diff --git a/google-cloud-videointelligence/src/main/java/com/google/cloud/videointelligence/v1beta1/VideoIntelligenceServiceClient.java b/google-cloud-videointelligence/src/main/java/com/google/cloud/videointelligence/v1beta1/VideoIntelligenceServiceClient.java deleted file mode 100644 index 131e92b0574e..000000000000 --- a/google-cloud-videointelligence/src/main/java/com/google/cloud/videointelligence/v1beta1/VideoIntelligenceServiceClient.java +++ /dev/null @@ -1,321 +0,0 @@ -/* - * 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.videointelligence.v1beta1; - -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.videointelligence.v1beta1.stub.VideoIntelligenceServiceStub; -import com.google.cloud.videointelligence.v1beta1.stub.VideoIntelligenceServiceStubSettings; -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 implements Google Cloud Video Intelligence API. - * - *

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: - * - *

- * 
- * try (VideoIntelligenceServiceClient videoIntelligenceServiceClient = VideoIntelligenceServiceClient.create()) {
- *   String inputUri = "gs://demomaker/cat.mp4";
- *   Feature featuresElement = Feature.LABEL_DETECTION;
- *   List<Feature> features = Arrays.asList(featuresElement);
- *   AnnotateVideoResponse response = videoIntelligenceServiceClient.annotateVideoAsync(inputUri, features).get();
- * }
- * 
- * 
- * - *

Note: close() needs to be called on the videoIntelligenceServiceClient 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: - * - *

    - *
  1. 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. - *
  2. 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. - *
  3. 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 - * VideoIntelligenceServiceSettings to create(). For example: - * - *

To customize credentials: - * - *

- * 
- * VideoIntelligenceServiceSettings videoIntelligenceServiceSettings =
- *     VideoIntelligenceServiceSettings.newBuilder()
- *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
- *         .build();
- * VideoIntelligenceServiceClient videoIntelligenceServiceClient =
- *     VideoIntelligenceServiceClient.create(videoIntelligenceServiceSettings);
- * 
- * 
- * - * To customize the endpoint: - * - *
- * 
- * VideoIntelligenceServiceSettings videoIntelligenceServiceSettings =
- *     VideoIntelligenceServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
- * VideoIntelligenceServiceClient videoIntelligenceServiceClient =
- *     VideoIntelligenceServiceClient.create(videoIntelligenceServiceSettings);
- * 
- * 
- */ -@Generated("by GAPIC v0.0.5") -@BetaApi -public class VideoIntelligenceServiceClient implements BackgroundResource { - private final VideoIntelligenceServiceSettings settings; - private final VideoIntelligenceServiceStub stub; - private final OperationsClient operationsClient; - - /** Constructs an instance of VideoIntelligenceServiceClient with default settings. */ - public static final VideoIntelligenceServiceClient create() throws IOException { - return create(VideoIntelligenceServiceSettings.newBuilder().build()); - } - - /** - * Constructs an instance of VideoIntelligenceServiceClient, 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 VideoIntelligenceServiceClient create( - VideoIntelligenceServiceSettings settings) throws IOException { - return new VideoIntelligenceServiceClient(settings); - } - - /** - * Constructs an instance of VideoIntelligenceServiceClient, using the given stub for making - * calls. This is for advanced usage - prefer to use VideoIntelligenceServiceSettings}. - */ - @BetaApi("A restructuring of stub classes is planned, so this may break in the future") - public static final VideoIntelligenceServiceClient create(VideoIntelligenceServiceStub stub) { - return new VideoIntelligenceServiceClient(stub); - } - - /** - * Constructs an instance of VideoIntelligenceServiceClient, 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 VideoIntelligenceServiceClient(VideoIntelligenceServiceSettings settings) - throws IOException { - this.settings = settings; - this.stub = ((VideoIntelligenceServiceStubSettings) 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 VideoIntelligenceServiceClient(VideoIntelligenceServiceStub stub) { - this.settings = null; - this.stub = stub; - this.operationsClient = OperationsClient.create(this.stub.getOperationsStub()); - } - - public final VideoIntelligenceServiceSettings getSettings() { - return settings; - } - - @BetaApi("A restructuring of stub classes is planned, so this may break in the future") - public VideoIntelligenceServiceStub 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 - /** - * Performs asynchronous video annotation. Progress and results can be retrieved through the - * `google.longrunning.Operations` interface. `Operation.metadata` contains - * `AnnotateVideoProgress` (progress). `Operation.response` contains `AnnotateVideoResponse` - * (results). - * - *

Sample code: - * - *


-   * try (VideoIntelligenceServiceClient videoIntelligenceServiceClient = VideoIntelligenceServiceClient.create()) {
-   *   String inputUri = "gs://demomaker/cat.mp4";
-   *   Feature featuresElement = Feature.LABEL_DETECTION;
-   *   List<Feature> features = Arrays.asList(featuresElement);
-   *   AnnotateVideoResponse response = videoIntelligenceServiceClient.annotateVideoAsync(inputUri, features).get();
-   * }
-   * 
- * - * @param inputUri Input video location. 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). A video URI may include - * wildcards in `object-id`, and thus identify multiple videos. Supported wildcards: '*' - * 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. - * @throws com.google.api.gax.rpc.ApiException if the remote call fails - */ - public final OperationFuture annotateVideoAsync( - String inputUri, List features) { - - AnnotateVideoRequest request = - AnnotateVideoRequest.newBuilder().setInputUri(inputUri).addAllFeatures(features).build(); - return annotateVideoAsync(request); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD - /** - * Performs asynchronous video annotation. Progress and results can be retrieved through the - * `google.longrunning.Operations` interface. `Operation.metadata` contains - * `AnnotateVideoProgress` (progress). `Operation.response` contains `AnnotateVideoResponse` - * (results). - * - *

Sample code: - * - *


-   * try (VideoIntelligenceServiceClient videoIntelligenceServiceClient = VideoIntelligenceServiceClient.create()) {
-   *   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)
-   *     .build();
-   *   AnnotateVideoResponse response = videoIntelligenceServiceClient.annotateVideoAsync(request).get();
-   * }
-   * 
- * - * @param request The request object containing all of the parameters for the API call. - * @throws com.google.api.gax.rpc.ApiException if the remote call fails - */ - public final OperationFuture annotateVideoAsync( - AnnotateVideoRequest request) { - return annotateVideoOperationCallable().futureCall(request); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD - /** - * Performs asynchronous video annotation. Progress and results can be retrieved through the - * `google.longrunning.Operations` interface. `Operation.metadata` contains - * `AnnotateVideoProgress` (progress). `Operation.response` contains `AnnotateVideoResponse` - * (results). - * - *

Sample code: - * - *


-   * try (VideoIntelligenceServiceClient videoIntelligenceServiceClient = VideoIntelligenceServiceClient.create()) {
-   *   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)
-   *     .build();
-   *   OperationFuture<Operation> future = videoIntelligenceServiceClient.annotateVideoOperationCallable().futureCall(request);
-   *   // Do something
-   *   AnnotateVideoResponse response = future.get();
-   * }
-   * 
- */ - public final OperationCallable - annotateVideoOperationCallable() { - return stub.annotateVideoOperationCallable(); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD - /** - * Performs asynchronous video annotation. Progress and results can be retrieved through the - * `google.longrunning.Operations` interface. `Operation.metadata` contains - * `AnnotateVideoProgress` (progress). `Operation.response` contains `AnnotateVideoResponse` - * (results). - * - *

Sample code: - * - *


-   * try (VideoIntelligenceServiceClient videoIntelligenceServiceClient = VideoIntelligenceServiceClient.create()) {
-   *   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)
-   *     .build();
-   *   ApiFuture<Operation> future = videoIntelligenceServiceClient.annotateVideoCallable().futureCall(request);
-   *   // Do something
-   *   Operation response = future.get();
-   * }
-   * 
- */ - public final UnaryCallable annotateVideoCallable() { - return stub.annotateVideoCallable(); - } - - @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-videointelligence/src/main/java/com/google/cloud/videointelligence/v1beta1/VideoIntelligenceServiceSettings.java b/google-cloud-videointelligence/src/main/java/com/google/cloud/videointelligence/v1beta1/VideoIntelligenceServiceSettings.java deleted file mode 100644 index dea9309efe19..000000000000 --- a/google-cloud-videointelligence/src/main/java/com/google/cloud/videointelligence/v1beta1/VideoIntelligenceServiceSettings.java +++ /dev/null @@ -1,192 +0,0 @@ -/* - * 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.videointelligence.v1beta1; - -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.videointelligence.v1beta1.stub.VideoIntelligenceServiceStubSettings; -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 VideoIntelligenceServiceClient}. - * - *

The default instance has everything set to sensible defaults: - * - *

    - *
  • The default service address (videointelligence.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 annotateVideoAsync to 30 seconds: - * - *

- * 
- * VideoIntelligenceServiceSettings.Builder videoIntelligenceServiceSettingsBuilder =
- *     VideoIntelligenceServiceSettings.newBuilder();
- * videoIntelligenceServiceSettingsBuilder.annotateVideoSettings().getRetrySettings().toBuilder()
- *     .setTotalTimeout(Duration.ofSeconds(30));
- * VideoIntelligenceServiceSettings videoIntelligenceServiceSettings = videoIntelligenceServiceSettingsBuilder.build();
- * 
- * 
- */ -@Generated("by GAPIC v0.0.5") -@BetaApi -public class VideoIntelligenceServiceSettings - extends ClientSettings { - /** Returns the object with the settings used for calls to annotateVideo. */ - public UnaryCallSettings annotateVideoSettings() { - return ((VideoIntelligenceServiceStubSettings) getStubSettings()).annotateVideoSettings(); - } - - /** Returns the object with the settings used for calls to annotateVideo. */ - public OperationCallSettings - annotateVideoOperationSettings() { - return ((VideoIntelligenceServiceStubSettings) getStubSettings()) - .annotateVideoOperationSettings(); - } - - public static final VideoIntelligenceServiceSettings create( - VideoIntelligenceServiceStubSettings stub) throws IOException { - return new VideoIntelligenceServiceSettings.Builder(stub.toBuilder()).build(); - } - - /** Returns a builder for the default ExecutorProvider for this service. */ - public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { - return VideoIntelligenceServiceStubSettings.defaultExecutorProviderBuilder(); - } - - /** Returns the default service endpoint. */ - public static String getDefaultEndpoint() { - return VideoIntelligenceServiceStubSettings.getDefaultEndpoint(); - } - - /** Returns the default service scopes. */ - public static List getDefaultServiceScopes() { - return VideoIntelligenceServiceStubSettings.getDefaultServiceScopes(); - } - - /** Returns a builder for the default credentials for this service. */ - public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { - return VideoIntelligenceServiceStubSettings.defaultCredentialsProviderBuilder(); - } - - /** Returns a builder for the default ChannelProvider for this service. */ - public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() { - return VideoIntelligenceServiceStubSettings.defaultGrpcTransportProviderBuilder(); - } - - public static TransportChannelProvider defaultTransportChannelProvider() { - return VideoIntelligenceServiceStubSettings.defaultTransportChannelProvider(); - } - - @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") - public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { - return VideoIntelligenceServiceStubSettings.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 VideoIntelligenceServiceSettings(Builder settingsBuilder) throws IOException { - super(settingsBuilder); - } - - /** Builder for VideoIntelligenceServiceSettings. */ - public static class Builder - extends ClientSettings.Builder { - protected Builder() throws IOException { - this((ClientContext) null); - } - - protected Builder(ClientContext clientContext) { - super(VideoIntelligenceServiceStubSettings.newBuilder(clientContext)); - } - - private static Builder createDefault() { - return new Builder(VideoIntelligenceServiceStubSettings.newBuilder()); - } - - protected Builder(VideoIntelligenceServiceSettings settings) { - super(settings.getStubSettings().toBuilder()); - } - - protected Builder(VideoIntelligenceServiceStubSettings.Builder stubSettings) { - super(stubSettings); - } - - public VideoIntelligenceServiceStubSettings.Builder getStubSettingsBuilder() { - return ((VideoIntelligenceServiceStubSettings.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 annotateVideo. */ - public UnaryCallSettings.Builder annotateVideoSettings() { - return getStubSettingsBuilder().annotateVideoSettings(); - } - - /** Returns the builder for the settings used for calls to annotateVideo. */ - public OperationCallSettings.Builder< - AnnotateVideoRequest, AnnotateVideoResponse, AnnotateVideoProgress> - annotateVideoOperationSettings() { - return getStubSettingsBuilder().annotateVideoOperationSettings(); - } - - @Override - public VideoIntelligenceServiceSettings build() throws IOException { - return new VideoIntelligenceServiceSettings(this); - } - } -} diff --git a/google-cloud-videointelligence/src/main/java/com/google/cloud/videointelligence/v1beta1/package-info.java b/google-cloud-videointelligence/src/main/java/com/google/cloud/videointelligence/v1beta1/package-info.java deleted file mode 100644 index 5b481c51c40b..000000000000 --- a/google-cloud-videointelligence/src/main/java/com/google/cloud/videointelligence/v1beta1/package-info.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * 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 Video Intelligence API. - * - *

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

============================== VideoIntelligenceServiceClient ============================== - * - *

Service Description: Service that implements Google Cloud Video Intelligence API. - * - *

Sample for VideoIntelligenceServiceClient: - * - *

- * 
- * try (VideoIntelligenceServiceClient videoIntelligenceServiceClient = VideoIntelligenceServiceClient.create()) {
- *   String inputUri = "gs://demomaker/cat.mp4";
- *   Feature featuresElement = Feature.LABEL_DETECTION;
- *   List<Feature> features = Arrays.asList(featuresElement);
- *   AnnotateVideoResponse response = videoIntelligenceServiceClient.annotateVideoAsync(inputUri, features);
- * }
- * 
- * 
- */ -package com.google.cloud.videointelligence.v1beta1; diff --git a/google-cloud-videointelligence/src/main/java/com/google/cloud/videointelligence/v1beta1/stub/GrpcVideoIntelligenceServiceStub.java b/google-cloud-videointelligence/src/main/java/com/google/cloud/videointelligence/v1beta1/stub/GrpcVideoIntelligenceServiceStub.java deleted file mode 100644 index 1329acdf7efd..000000000000 --- a/google-cloud-videointelligence/src/main/java/com/google/cloud/videointelligence/v1beta1/stub/GrpcVideoIntelligenceServiceStub.java +++ /dev/null @@ -1,147 +0,0 @@ -/* - * 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.videointelligence.v1beta1.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.videointelligence.v1beta1.AnnotateVideoProgress; -import com.google.cloud.videointelligence.v1beta1.AnnotateVideoRequest; -import com.google.cloud.videointelligence.v1beta1.AnnotateVideoResponse; -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 Video Intelligence 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 GrpcVideoIntelligenceServiceStub extends VideoIntelligenceServiceStub { - - private static final MethodDescriptor - annotateVideoMethodDescriptor = - MethodDescriptor.newBuilder() - .setType(MethodDescriptor.MethodType.UNARY) - .setFullMethodName( - "google.cloud.videointelligence.v1beta1.VideoIntelligenceService/AnnotateVideo") - .setRequestMarshaller( - ProtoUtils.marshaller(AnnotateVideoRequest.getDefaultInstance())) - .setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance())) - .build(); - - private final BackgroundResource backgroundResources; - private final GrpcOperationsStub operationsStub; - - private final UnaryCallable annotateVideoCallable; - private final OperationCallable< - AnnotateVideoRequest, AnnotateVideoResponse, AnnotateVideoProgress> - annotateVideoOperationCallable; - - public static final GrpcVideoIntelligenceServiceStub create( - VideoIntelligenceServiceStubSettings settings) throws IOException { - return new GrpcVideoIntelligenceServiceStub(settings, ClientContext.create(settings)); - } - - public static final GrpcVideoIntelligenceServiceStub create(ClientContext clientContext) - throws IOException { - return new GrpcVideoIntelligenceServiceStub( - VideoIntelligenceServiceStubSettings.newBuilder().build(), clientContext); - } - - /** - * Constructs an instance of GrpcVideoIntelligenceServiceStub, 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 GrpcVideoIntelligenceServiceStub( - VideoIntelligenceServiceStubSettings settings, ClientContext clientContext) - throws IOException { - this.operationsStub = GrpcOperationsStub.create(clientContext); - - GrpcCallSettings annotateVideoTransportSettings = - GrpcCallSettings.newBuilder() - .setMethodDescriptor(annotateVideoMethodDescriptor) - .build(); - - this.annotateVideoCallable = - GrpcCallableFactory.createUnaryCallable( - annotateVideoTransportSettings, settings.annotateVideoSettings(), clientContext); - this.annotateVideoOperationCallable = - GrpcCallableFactory.createOperationCallable( - annotateVideoTransportSettings, - settings.annotateVideoOperationSettings(), - clientContext, - this.operationsStub); - - backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources()); - } - - public GrpcOperationsStub getOperationsStub() { - return operationsStub; - } - - public OperationCallable - annotateVideoOperationCallable() { - return annotateVideoOperationCallable; - } - - public UnaryCallable annotateVideoCallable() { - return annotateVideoCallable; - } - - @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-videointelligence/src/main/java/com/google/cloud/videointelligence/v1beta1/stub/VideoIntelligenceServiceStub.java b/google-cloud-videointelligence/src/main/java/com/google/cloud/videointelligence/v1beta1/stub/VideoIntelligenceServiceStub.java deleted file mode 100644 index c7d49c7ca3fb..000000000000 --- a/google-cloud-videointelligence/src/main/java/com/google/cloud/videointelligence/v1beta1/stub/VideoIntelligenceServiceStub.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * 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.videointelligence.v1beta1.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.videointelligence.v1beta1.AnnotateVideoProgress; -import com.google.cloud.videointelligence.v1beta1.AnnotateVideoRequest; -import com.google.cloud.videointelligence.v1beta1.AnnotateVideoResponse; -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 Video Intelligence 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 VideoIntelligenceServiceStub implements BackgroundResource { - - public OperationsStub getOperationsStub() { - throw new UnsupportedOperationException("Not implemented: getOperationsStub()"); - } - - public OperationCallable - annotateVideoOperationCallable() { - throw new UnsupportedOperationException("Not implemented: annotateVideoOperationCallable()"); - } - - public UnaryCallable annotateVideoCallable() { - throw new UnsupportedOperationException("Not implemented: annotateVideoCallable()"); - } -} diff --git a/google-cloud-videointelligence/src/main/java/com/google/cloud/videointelligence/v1beta1/stub/VideoIntelligenceServiceStubSettings.java b/google-cloud-videointelligence/src/main/java/com/google/cloud/videointelligence/v1beta1/stub/VideoIntelligenceServiceStubSettings.java deleted file mode 100644 index 4da697fb1e53..000000000000 --- a/google-cloud-videointelligence/src/main/java/com/google/cloud/videointelligence/v1beta1/stub/VideoIntelligenceServiceStubSettings.java +++ /dev/null @@ -1,318 +0,0 @@ -/* - * 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.videointelligence.v1beta1.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.videointelligence.v1beta1.AnnotateVideoProgress; -import com.google.cloud.videointelligence.v1beta1.AnnotateVideoRequest; -import com.google.cloud.videointelligence.v1beta1.AnnotateVideoResponse; -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 VideoIntelligenceServiceStub}. - * - *

The default instance has everything set to sensible defaults: - * - *

    - *
  • The default service address (videointelligence.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 annotateVideoAsync to 30 seconds: - * - *

- * 
- * VideoIntelligenceServiceStubSettings.Builder videoIntelligenceServiceSettingsBuilder =
- *     VideoIntelligenceServiceStubSettings.newBuilder();
- * videoIntelligenceServiceSettingsBuilder.annotateVideoSettings().getRetrySettings().toBuilder()
- *     .setTotalTimeout(Duration.ofSeconds(30));
- * VideoIntelligenceServiceStubSettings videoIntelligenceServiceSettings = videoIntelligenceServiceSettingsBuilder.build();
- * 
- * 
- */ -@Generated("by GAPIC v0.0.5") -@BetaApi -public class VideoIntelligenceServiceStubSettings - extends StubSettings { - /** The default scopes of the service. */ - private static final ImmutableList DEFAULT_SERVICE_SCOPES = - ImmutableList.builder().add("https://www.googleapis.com/auth/cloud-platform").build(); - - private final UnaryCallSettings annotateVideoSettings; - private final OperationCallSettings< - AnnotateVideoRequest, AnnotateVideoResponse, AnnotateVideoProgress> - annotateVideoOperationSettings; - - /** Returns the object with the settings used for calls to annotateVideo. */ - public UnaryCallSettings annotateVideoSettings() { - return annotateVideoSettings; - } - - /** Returns the object with the settings used for calls to annotateVideo. */ - public OperationCallSettings - annotateVideoOperationSettings() { - return annotateVideoOperationSettings; - } - - @BetaApi("A restructuring of stub classes is planned, so this may break in the future") - public VideoIntelligenceServiceStub createStub() throws IOException { - if (getTransportChannelProvider() - .getTransportName() - .equals(GrpcTransportChannel.getGrpcTransportName())) { - return GrpcVideoIntelligenceServiceStub.create(this); - } else { - throw new UnsupportedOperationException( - "Transport not supported: " + getTransportChannelProvider().getTransportName()); - } - } - - /** Returns a builder for the default ExecutorProvider for this service. */ - public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { - return InstantiatingExecutorProvider.newBuilder(); - } - - /** Returns the default service endpoint. */ - public static String getDefaultEndpoint() { - return "videointelligence.googleapis.com:443"; - } - - /** Returns the default service scopes. */ - public static List getDefaultServiceScopes() { - return DEFAULT_SERVICE_SCOPES; - } - - /** Returns a builder for the default credentials for this service. */ - public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { - return GoogleCredentialsProvider.newBuilder().setScopesToApply(DEFAULT_SERVICE_SCOPES); - } - - /** Returns a builder for the default ChannelProvider for this service. */ - public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() { - return InstantiatingGrpcChannelProvider.newBuilder(); - } - - public static TransportChannelProvider defaultTransportChannelProvider() { - return defaultGrpcTransportProviderBuilder().build(); - } - - @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") - public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { - return ApiClientHeaderProvider.newBuilder() - .setGeneratedLibToken( - "gapic", GaxProperties.getLibraryVersion(VideoIntelligenceServiceStubSettings.class)) - .setTransportToken( - GaxGrpcProperties.getGrpcTokenName(), GaxGrpcProperties.getGrpcVersion()); - } - - /** 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 VideoIntelligenceServiceStubSettings(Builder settingsBuilder) throws IOException { - super(settingsBuilder); - - annotateVideoSettings = settingsBuilder.annotateVideoSettings().build(); - annotateVideoOperationSettings = settingsBuilder.annotateVideoOperationSettings().build(); - } - - /** Builder for VideoIntelligenceServiceStubSettings. */ - public static class Builder - extends StubSettings.Builder { - private final ImmutableList> unaryMethodSettingsBuilders; - - private final UnaryCallSettings.Builder annotateVideoSettings; - private final OperationCallSettings.Builder< - AnnotateVideoRequest, AnnotateVideoResponse, AnnotateVideoProgress> - annotateVideoOperationSettings; - - private static final ImmutableMap> - RETRYABLE_CODE_DEFINITIONS; - - static { - ImmutableMap.Builder> definitions = - ImmutableMap.builder(); - definitions.put( - "idempotent", - ImmutableSet.copyOf( - Lists.newArrayList( - StatusCode.Code.DEADLINE_EXCEEDED, StatusCode.Code.UNAVAILABLE))); - definitions.put("non_idempotent", ImmutableSet.copyOf(Lists.newArrayList())); - RETRYABLE_CODE_DEFINITIONS = definitions.build(); - } - - private static final ImmutableMap RETRY_PARAM_DEFINITIONS; - - static { - ImmutableMap.Builder definitions = ImmutableMap.builder(); - RetrySettings settings = null; - settings = - RetrySettings.newBuilder() - .setInitialRetryDelay(Duration.ofMillis(1000L)) - .setRetryDelayMultiplier(2.5) - .setMaxRetryDelay(Duration.ofMillis(120000L)) - .setInitialRpcTimeout(Duration.ofMillis(120000L)) - .setRpcTimeoutMultiplier(1.0) - .setMaxRpcTimeout(Duration.ofMillis(120000L)) - .setTotalTimeout(Duration.ofMillis(600000L)) - .build(); - definitions.put("default", settings); - RETRY_PARAM_DEFINITIONS = definitions.build(); - } - - protected Builder() { - this((ClientContext) null); - } - - protected Builder(ClientContext clientContext) { - super(clientContext); - - annotateVideoSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); - - annotateVideoOperationSettings = OperationCallSettings.newBuilder(); - - unaryMethodSettingsBuilders = - ImmutableList.>of(annotateVideoSettings); - - initDefaults(this); - } - - private static Builder createDefault() { - Builder builder = new Builder((ClientContext) null); - builder.setTransportChannelProvider(defaultTransportChannelProvider()); - builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build()); - builder.setInternalHeaderProvider(defaultApiClientHeaderProviderBuilder().build()); - builder.setEndpoint(getDefaultEndpoint()); - return initDefaults(builder); - } - - private static Builder initDefaults(Builder builder) { - - builder - .annotateVideoSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); - builder - .annotateVideoOperationSettings() - .setInitialCallSettings( - UnaryCallSettings - .newUnaryCallSettingsBuilder() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")) - .build()) - .setResponseTransformer( - ProtoOperationTransformers.ResponseTransformer.create(AnnotateVideoResponse.class)) - .setMetadataTransformer( - ProtoOperationTransformers.MetadataTransformer.create(AnnotateVideoProgress.class)) - .setPollingAlgorithm( - OperationTimedPollAlgorithm.create( - RetrySettings.newBuilder() - .setInitialRetryDelay(Duration.ofMillis(20000L)) - .setRetryDelayMultiplier(1.5) - .setMaxRetryDelay(Duration.ofMillis(45000L)) - .setInitialRpcTimeout(Duration.ZERO) // ignored - .setRpcTimeoutMultiplier(1.0) // ignored - .setMaxRpcTimeout(Duration.ZERO) // ignored - .setTotalTimeout(Duration.ofMillis(86400000L)) - .build())); - - return builder; - } - - protected Builder(VideoIntelligenceServiceStubSettings settings) { - super(settings); - - annotateVideoSettings = settings.annotateVideoSettings.toBuilder(); - annotateVideoOperationSettings = settings.annotateVideoOperationSettings.toBuilder(); - - unaryMethodSettingsBuilders = - ImmutableList.>of(annotateVideoSettings); - } - - /** - * 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(unaryMethodSettingsBuilders, settingsUpdater); - return this; - } - - public ImmutableList> unaryMethodSettingsBuilders() { - return unaryMethodSettingsBuilders; - } - - /** Returns the builder for the settings used for calls to annotateVideo. */ - public UnaryCallSettings.Builder annotateVideoSettings() { - return annotateVideoSettings; - } - - /** Returns the builder for the settings used for calls to annotateVideo. */ - public OperationCallSettings.Builder< - AnnotateVideoRequest, AnnotateVideoResponse, AnnotateVideoProgress> - annotateVideoOperationSettings() { - return annotateVideoOperationSettings; - } - - @Override - public VideoIntelligenceServiceStubSettings build() throws IOException { - return new VideoIntelligenceServiceStubSettings(this); - } - } -} diff --git a/google-cloud-videointelligence/src/main/java/com/google/cloud/videointelligence/v1beta2/VideoIntelligenceServiceClient.java b/google-cloud-videointelligence/src/main/java/com/google/cloud/videointelligence/v1beta2/VideoIntelligenceServiceClient.java deleted file mode 100644 index fd8bd71161ec..000000000000 --- a/google-cloud-videointelligence/src/main/java/com/google/cloud/videointelligence/v1beta2/VideoIntelligenceServiceClient.java +++ /dev/null @@ -1,321 +0,0 @@ -/* - * 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.videointelligence.v1beta2; - -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.videointelligence.v1beta2.stub.VideoIntelligenceServiceStub; -import com.google.cloud.videointelligence.v1beta2.stub.VideoIntelligenceServiceStubSettings; -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 implements Google Cloud Video Intelligence API. - * - *

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: - * - *

- * 
- * try (VideoIntelligenceServiceClient videoIntelligenceServiceClient = VideoIntelligenceServiceClient.create()) {
- *   String inputUri = "gs://demomaker/cat.mp4";
- *   Feature featuresElement = Feature.LABEL_DETECTION;
- *   List<Feature> features = Arrays.asList(featuresElement);
- *   AnnotateVideoResponse response = videoIntelligenceServiceClient.annotateVideoAsync(inputUri, features).get();
- * }
- * 
- * 
- * - *

Note: close() needs to be called on the videoIntelligenceServiceClient 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: - * - *

    - *
  1. 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. - *
  2. 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. - *
  3. 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 - * VideoIntelligenceServiceSettings to create(). For example: - * - *

To customize credentials: - * - *

- * 
- * VideoIntelligenceServiceSettings videoIntelligenceServiceSettings =
- *     VideoIntelligenceServiceSettings.newBuilder()
- *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
- *         .build();
- * VideoIntelligenceServiceClient videoIntelligenceServiceClient =
- *     VideoIntelligenceServiceClient.create(videoIntelligenceServiceSettings);
- * 
- * 
- * - * To customize the endpoint: - * - *
- * 
- * VideoIntelligenceServiceSettings videoIntelligenceServiceSettings =
- *     VideoIntelligenceServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
- * VideoIntelligenceServiceClient videoIntelligenceServiceClient =
- *     VideoIntelligenceServiceClient.create(videoIntelligenceServiceSettings);
- * 
- * 
- */ -@Generated("by GAPIC v0.0.5") -@BetaApi -public class VideoIntelligenceServiceClient implements BackgroundResource { - private final VideoIntelligenceServiceSettings settings; - private final VideoIntelligenceServiceStub stub; - private final OperationsClient operationsClient; - - /** Constructs an instance of VideoIntelligenceServiceClient with default settings. */ - public static final VideoIntelligenceServiceClient create() throws IOException { - return create(VideoIntelligenceServiceSettings.newBuilder().build()); - } - - /** - * Constructs an instance of VideoIntelligenceServiceClient, 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 VideoIntelligenceServiceClient create( - VideoIntelligenceServiceSettings settings) throws IOException { - return new VideoIntelligenceServiceClient(settings); - } - - /** - * Constructs an instance of VideoIntelligenceServiceClient, using the given stub for making - * calls. This is for advanced usage - prefer to use VideoIntelligenceServiceSettings}. - */ - @BetaApi("A restructuring of stub classes is planned, so this may break in the future") - public static final VideoIntelligenceServiceClient create(VideoIntelligenceServiceStub stub) { - return new VideoIntelligenceServiceClient(stub); - } - - /** - * Constructs an instance of VideoIntelligenceServiceClient, 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 VideoIntelligenceServiceClient(VideoIntelligenceServiceSettings settings) - throws IOException { - this.settings = settings; - this.stub = ((VideoIntelligenceServiceStubSettings) 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 VideoIntelligenceServiceClient(VideoIntelligenceServiceStub stub) { - this.settings = null; - this.stub = stub; - this.operationsClient = OperationsClient.create(this.stub.getOperationsStub()); - } - - public final VideoIntelligenceServiceSettings getSettings() { - return settings; - } - - @BetaApi("A restructuring of stub classes is planned, so this may break in the future") - public VideoIntelligenceServiceStub 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 - /** - * Performs asynchronous video annotation. Progress and results can be retrieved through the - * `google.longrunning.Operations` interface. `Operation.metadata` contains - * `AnnotateVideoProgress` (progress). `Operation.response` contains `AnnotateVideoResponse` - * (results). - * - *

Sample code: - * - *


-   * try (VideoIntelligenceServiceClient videoIntelligenceServiceClient = VideoIntelligenceServiceClient.create()) {
-   *   String inputUri = "gs://demomaker/cat.mp4";
-   *   Feature featuresElement = Feature.LABEL_DETECTION;
-   *   List<Feature> features = Arrays.asList(featuresElement);
-   *   AnnotateVideoResponse response = videoIntelligenceServiceClient.annotateVideoAsync(inputUri, features).get();
-   * }
-   * 
- * - * @param inputUri Input video location. 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). A video URI may include - * wildcards in `object-id`, and thus identify multiple videos. Supported wildcards: '*' - * 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. - * @throws com.google.api.gax.rpc.ApiException if the remote call fails - */ - public final OperationFuture annotateVideoAsync( - String inputUri, List features) { - - AnnotateVideoRequest request = - AnnotateVideoRequest.newBuilder().setInputUri(inputUri).addAllFeatures(features).build(); - return annotateVideoAsync(request); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD - /** - * Performs asynchronous video annotation. Progress and results can be retrieved through the - * `google.longrunning.Operations` interface. `Operation.metadata` contains - * `AnnotateVideoProgress` (progress). `Operation.response` contains `AnnotateVideoResponse` - * (results). - * - *

Sample code: - * - *


-   * try (VideoIntelligenceServiceClient videoIntelligenceServiceClient = VideoIntelligenceServiceClient.create()) {
-   *   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)
-   *     .build();
-   *   AnnotateVideoResponse response = videoIntelligenceServiceClient.annotateVideoAsync(request).get();
-   * }
-   * 
- * - * @param request The request object containing all of the parameters for the API call. - * @throws com.google.api.gax.rpc.ApiException if the remote call fails - */ - public final OperationFuture annotateVideoAsync( - AnnotateVideoRequest request) { - return annotateVideoOperationCallable().futureCall(request); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD - /** - * Performs asynchronous video annotation. Progress and results can be retrieved through the - * `google.longrunning.Operations` interface. `Operation.metadata` contains - * `AnnotateVideoProgress` (progress). `Operation.response` contains `AnnotateVideoResponse` - * (results). - * - *

Sample code: - * - *


-   * try (VideoIntelligenceServiceClient videoIntelligenceServiceClient = VideoIntelligenceServiceClient.create()) {
-   *   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)
-   *     .build();
-   *   OperationFuture<Operation> future = videoIntelligenceServiceClient.annotateVideoOperationCallable().futureCall(request);
-   *   // Do something
-   *   AnnotateVideoResponse response = future.get();
-   * }
-   * 
- */ - public final OperationCallable - annotateVideoOperationCallable() { - return stub.annotateVideoOperationCallable(); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD - /** - * Performs asynchronous video annotation. Progress and results can be retrieved through the - * `google.longrunning.Operations` interface. `Operation.metadata` contains - * `AnnotateVideoProgress` (progress). `Operation.response` contains `AnnotateVideoResponse` - * (results). - * - *

Sample code: - * - *


-   * try (VideoIntelligenceServiceClient videoIntelligenceServiceClient = VideoIntelligenceServiceClient.create()) {
-   *   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)
-   *     .build();
-   *   ApiFuture<Operation> future = videoIntelligenceServiceClient.annotateVideoCallable().futureCall(request);
-   *   // Do something
-   *   Operation response = future.get();
-   * }
-   * 
- */ - public final UnaryCallable annotateVideoCallable() { - return stub.annotateVideoCallable(); - } - - @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-videointelligence/src/main/java/com/google/cloud/videointelligence/v1beta2/VideoIntelligenceServiceSettings.java b/google-cloud-videointelligence/src/main/java/com/google/cloud/videointelligence/v1beta2/VideoIntelligenceServiceSettings.java deleted file mode 100644 index 3cfb898fd5a2..000000000000 --- a/google-cloud-videointelligence/src/main/java/com/google/cloud/videointelligence/v1beta2/VideoIntelligenceServiceSettings.java +++ /dev/null @@ -1,192 +0,0 @@ -/* - * 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.videointelligence.v1beta2; - -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.videointelligence.v1beta2.stub.VideoIntelligenceServiceStubSettings; -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 VideoIntelligenceServiceClient}. - * - *

The default instance has everything set to sensible defaults: - * - *

    - *
  • The default service address (videointelligence.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 annotateVideoAsync to 30 seconds: - * - *

- * 
- * VideoIntelligenceServiceSettings.Builder videoIntelligenceServiceSettingsBuilder =
- *     VideoIntelligenceServiceSettings.newBuilder();
- * videoIntelligenceServiceSettingsBuilder.annotateVideoSettings().getRetrySettings().toBuilder()
- *     .setTotalTimeout(Duration.ofSeconds(30));
- * VideoIntelligenceServiceSettings videoIntelligenceServiceSettings = videoIntelligenceServiceSettingsBuilder.build();
- * 
- * 
- */ -@Generated("by GAPIC v0.0.5") -@BetaApi -public class VideoIntelligenceServiceSettings - extends ClientSettings { - /** Returns the object with the settings used for calls to annotateVideo. */ - public UnaryCallSettings annotateVideoSettings() { - return ((VideoIntelligenceServiceStubSettings) getStubSettings()).annotateVideoSettings(); - } - - /** Returns the object with the settings used for calls to annotateVideo. */ - public OperationCallSettings - annotateVideoOperationSettings() { - return ((VideoIntelligenceServiceStubSettings) getStubSettings()) - .annotateVideoOperationSettings(); - } - - public static final VideoIntelligenceServiceSettings create( - VideoIntelligenceServiceStubSettings stub) throws IOException { - return new VideoIntelligenceServiceSettings.Builder(stub.toBuilder()).build(); - } - - /** Returns a builder for the default ExecutorProvider for this service. */ - public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { - return VideoIntelligenceServiceStubSettings.defaultExecutorProviderBuilder(); - } - - /** Returns the default service endpoint. */ - public static String getDefaultEndpoint() { - return VideoIntelligenceServiceStubSettings.getDefaultEndpoint(); - } - - /** Returns the default service scopes. */ - public static List getDefaultServiceScopes() { - return VideoIntelligenceServiceStubSettings.getDefaultServiceScopes(); - } - - /** Returns a builder for the default credentials for this service. */ - public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { - return VideoIntelligenceServiceStubSettings.defaultCredentialsProviderBuilder(); - } - - /** Returns a builder for the default ChannelProvider for this service. */ - public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() { - return VideoIntelligenceServiceStubSettings.defaultGrpcTransportProviderBuilder(); - } - - public static TransportChannelProvider defaultTransportChannelProvider() { - return VideoIntelligenceServiceStubSettings.defaultTransportChannelProvider(); - } - - @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") - public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { - return VideoIntelligenceServiceStubSettings.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 VideoIntelligenceServiceSettings(Builder settingsBuilder) throws IOException { - super(settingsBuilder); - } - - /** Builder for VideoIntelligenceServiceSettings. */ - public static class Builder - extends ClientSettings.Builder { - protected Builder() throws IOException { - this((ClientContext) null); - } - - protected Builder(ClientContext clientContext) { - super(VideoIntelligenceServiceStubSettings.newBuilder(clientContext)); - } - - private static Builder createDefault() { - return new Builder(VideoIntelligenceServiceStubSettings.newBuilder()); - } - - protected Builder(VideoIntelligenceServiceSettings settings) { - super(settings.getStubSettings().toBuilder()); - } - - protected Builder(VideoIntelligenceServiceStubSettings.Builder stubSettings) { - super(stubSettings); - } - - public VideoIntelligenceServiceStubSettings.Builder getStubSettingsBuilder() { - return ((VideoIntelligenceServiceStubSettings.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 annotateVideo. */ - public UnaryCallSettings.Builder annotateVideoSettings() { - return getStubSettingsBuilder().annotateVideoSettings(); - } - - /** Returns the builder for the settings used for calls to annotateVideo. */ - public OperationCallSettings.Builder< - AnnotateVideoRequest, AnnotateVideoResponse, AnnotateVideoProgress> - annotateVideoOperationSettings() { - return getStubSettingsBuilder().annotateVideoOperationSettings(); - } - - @Override - public VideoIntelligenceServiceSettings build() throws IOException { - return new VideoIntelligenceServiceSettings(this); - } - } -} diff --git a/google-cloud-videointelligence/src/main/java/com/google/cloud/videointelligence/v1beta2/package-info.java b/google-cloud-videointelligence/src/main/java/com/google/cloud/videointelligence/v1beta2/package-info.java deleted file mode 100644 index 5dc0160f8d7e..000000000000 --- a/google-cloud-videointelligence/src/main/java/com/google/cloud/videointelligence/v1beta2/package-info.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * 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 Video Intelligence API. - * - *

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

============================== VideoIntelligenceServiceClient ============================== - * - *

Service Description: Service that implements Google Cloud Video Intelligence API. - * - *

Sample for VideoIntelligenceServiceClient: - * - *

- * 
- * try (VideoIntelligenceServiceClient videoIntelligenceServiceClient = VideoIntelligenceServiceClient.create()) {
- *   String inputUri = "gs://demomaker/cat.mp4";
- *   Feature featuresElement = Feature.LABEL_DETECTION;
- *   List<Feature> features = Arrays.asList(featuresElement);
- *   AnnotateVideoResponse response = videoIntelligenceServiceClient.annotateVideoAsync(inputUri, features);
- * }
- * 
- * 
- */ -package com.google.cloud.videointelligence.v1beta2; diff --git a/google-cloud-videointelligence/src/main/java/com/google/cloud/videointelligence/v1beta2/stub/GrpcVideoIntelligenceServiceStub.java b/google-cloud-videointelligence/src/main/java/com/google/cloud/videointelligence/v1beta2/stub/GrpcVideoIntelligenceServiceStub.java deleted file mode 100644 index ba2685392268..000000000000 --- a/google-cloud-videointelligence/src/main/java/com/google/cloud/videointelligence/v1beta2/stub/GrpcVideoIntelligenceServiceStub.java +++ /dev/null @@ -1,147 +0,0 @@ -/* - * 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.videointelligence.v1beta2.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.videointelligence.v1beta2.AnnotateVideoProgress; -import com.google.cloud.videointelligence.v1beta2.AnnotateVideoRequest; -import com.google.cloud.videointelligence.v1beta2.AnnotateVideoResponse; -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 Video Intelligence 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 GrpcVideoIntelligenceServiceStub extends VideoIntelligenceServiceStub { - - private static final MethodDescriptor - annotateVideoMethodDescriptor = - MethodDescriptor.newBuilder() - .setType(MethodDescriptor.MethodType.UNARY) - .setFullMethodName( - "google.cloud.videointelligence.v1beta2.VideoIntelligenceService/AnnotateVideo") - .setRequestMarshaller( - ProtoUtils.marshaller(AnnotateVideoRequest.getDefaultInstance())) - .setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance())) - .build(); - - private final BackgroundResource backgroundResources; - private final GrpcOperationsStub operationsStub; - - private final UnaryCallable annotateVideoCallable; - private final OperationCallable< - AnnotateVideoRequest, AnnotateVideoResponse, AnnotateVideoProgress> - annotateVideoOperationCallable; - - public static final GrpcVideoIntelligenceServiceStub create( - VideoIntelligenceServiceStubSettings settings) throws IOException { - return new GrpcVideoIntelligenceServiceStub(settings, ClientContext.create(settings)); - } - - public static final GrpcVideoIntelligenceServiceStub create(ClientContext clientContext) - throws IOException { - return new GrpcVideoIntelligenceServiceStub( - VideoIntelligenceServiceStubSettings.newBuilder().build(), clientContext); - } - - /** - * Constructs an instance of GrpcVideoIntelligenceServiceStub, 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 GrpcVideoIntelligenceServiceStub( - VideoIntelligenceServiceStubSettings settings, ClientContext clientContext) - throws IOException { - this.operationsStub = GrpcOperationsStub.create(clientContext); - - GrpcCallSettings annotateVideoTransportSettings = - GrpcCallSettings.newBuilder() - .setMethodDescriptor(annotateVideoMethodDescriptor) - .build(); - - this.annotateVideoCallable = - GrpcCallableFactory.createUnaryCallable( - annotateVideoTransportSettings, settings.annotateVideoSettings(), clientContext); - this.annotateVideoOperationCallable = - GrpcCallableFactory.createOperationCallable( - annotateVideoTransportSettings, - settings.annotateVideoOperationSettings(), - clientContext, - this.operationsStub); - - backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources()); - } - - public GrpcOperationsStub getOperationsStub() { - return operationsStub; - } - - public OperationCallable - annotateVideoOperationCallable() { - return annotateVideoOperationCallable; - } - - public UnaryCallable annotateVideoCallable() { - return annotateVideoCallable; - } - - @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-videointelligence/src/main/java/com/google/cloud/videointelligence/v1beta2/stub/VideoIntelligenceServiceStub.java b/google-cloud-videointelligence/src/main/java/com/google/cloud/videointelligence/v1beta2/stub/VideoIntelligenceServiceStub.java deleted file mode 100644 index 6cf5324f40bb..000000000000 --- a/google-cloud-videointelligence/src/main/java/com/google/cloud/videointelligence/v1beta2/stub/VideoIntelligenceServiceStub.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * 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.videointelligence.v1beta2.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.videointelligence.v1beta2.AnnotateVideoProgress; -import com.google.cloud.videointelligence.v1beta2.AnnotateVideoRequest; -import com.google.cloud.videointelligence.v1beta2.AnnotateVideoResponse; -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 Video Intelligence 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 VideoIntelligenceServiceStub implements BackgroundResource { - - public OperationsStub getOperationsStub() { - throw new UnsupportedOperationException("Not implemented: getOperationsStub()"); - } - - public OperationCallable - annotateVideoOperationCallable() { - throw new UnsupportedOperationException("Not implemented: annotateVideoOperationCallable()"); - } - - public UnaryCallable annotateVideoCallable() { - throw new UnsupportedOperationException("Not implemented: annotateVideoCallable()"); - } -} diff --git a/google-cloud-videointelligence/src/main/java/com/google/cloud/videointelligence/v1beta2/stub/VideoIntelligenceServiceStubSettings.java b/google-cloud-videointelligence/src/main/java/com/google/cloud/videointelligence/v1beta2/stub/VideoIntelligenceServiceStubSettings.java deleted file mode 100644 index 2e37558e95a2..000000000000 --- a/google-cloud-videointelligence/src/main/java/com/google/cloud/videointelligence/v1beta2/stub/VideoIntelligenceServiceStubSettings.java +++ /dev/null @@ -1,318 +0,0 @@ -/* - * 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.videointelligence.v1beta2.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.videointelligence.v1beta2.AnnotateVideoProgress; -import com.google.cloud.videointelligence.v1beta2.AnnotateVideoRequest; -import com.google.cloud.videointelligence.v1beta2.AnnotateVideoResponse; -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 VideoIntelligenceServiceStub}. - * - *

The default instance has everything set to sensible defaults: - * - *

    - *
  • The default service address (videointelligence.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 annotateVideoAsync to 30 seconds: - * - *

- * 
- * VideoIntelligenceServiceStubSettings.Builder videoIntelligenceServiceSettingsBuilder =
- *     VideoIntelligenceServiceStubSettings.newBuilder();
- * videoIntelligenceServiceSettingsBuilder.annotateVideoSettings().getRetrySettings().toBuilder()
- *     .setTotalTimeout(Duration.ofSeconds(30));
- * VideoIntelligenceServiceStubSettings videoIntelligenceServiceSettings = videoIntelligenceServiceSettingsBuilder.build();
- * 
- * 
- */ -@Generated("by GAPIC v0.0.5") -@BetaApi -public class VideoIntelligenceServiceStubSettings - extends StubSettings { - /** The default scopes of the service. */ - private static final ImmutableList DEFAULT_SERVICE_SCOPES = - ImmutableList.builder().add("https://www.googleapis.com/auth/cloud-platform").build(); - - private final UnaryCallSettings annotateVideoSettings; - private final OperationCallSettings< - AnnotateVideoRequest, AnnotateVideoResponse, AnnotateVideoProgress> - annotateVideoOperationSettings; - - /** Returns the object with the settings used for calls to annotateVideo. */ - public UnaryCallSettings annotateVideoSettings() { - return annotateVideoSettings; - } - - /** Returns the object with the settings used for calls to annotateVideo. */ - public OperationCallSettings - annotateVideoOperationSettings() { - return annotateVideoOperationSettings; - } - - @BetaApi("A restructuring of stub classes is planned, so this may break in the future") - public VideoIntelligenceServiceStub createStub() throws IOException { - if (getTransportChannelProvider() - .getTransportName() - .equals(GrpcTransportChannel.getGrpcTransportName())) { - return GrpcVideoIntelligenceServiceStub.create(this); - } else { - throw new UnsupportedOperationException( - "Transport not supported: " + getTransportChannelProvider().getTransportName()); - } - } - - /** Returns a builder for the default ExecutorProvider for this service. */ - public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { - return InstantiatingExecutorProvider.newBuilder(); - } - - /** Returns the default service endpoint. */ - public static String getDefaultEndpoint() { - return "videointelligence.googleapis.com:443"; - } - - /** Returns the default service scopes. */ - public static List getDefaultServiceScopes() { - return DEFAULT_SERVICE_SCOPES; - } - - /** Returns a builder for the default credentials for this service. */ - public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { - return GoogleCredentialsProvider.newBuilder().setScopesToApply(DEFAULT_SERVICE_SCOPES); - } - - /** Returns a builder for the default ChannelProvider for this service. */ - public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() { - return InstantiatingGrpcChannelProvider.newBuilder(); - } - - public static TransportChannelProvider defaultTransportChannelProvider() { - return defaultGrpcTransportProviderBuilder().build(); - } - - @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") - public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { - return ApiClientHeaderProvider.newBuilder() - .setGeneratedLibToken( - "gapic", GaxProperties.getLibraryVersion(VideoIntelligenceServiceStubSettings.class)) - .setTransportToken( - GaxGrpcProperties.getGrpcTokenName(), GaxGrpcProperties.getGrpcVersion()); - } - - /** 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 VideoIntelligenceServiceStubSettings(Builder settingsBuilder) throws IOException { - super(settingsBuilder); - - annotateVideoSettings = settingsBuilder.annotateVideoSettings().build(); - annotateVideoOperationSettings = settingsBuilder.annotateVideoOperationSettings().build(); - } - - /** Builder for VideoIntelligenceServiceStubSettings. */ - public static class Builder - extends StubSettings.Builder { - private final ImmutableList> unaryMethodSettingsBuilders; - - private final UnaryCallSettings.Builder annotateVideoSettings; - private final OperationCallSettings.Builder< - AnnotateVideoRequest, AnnotateVideoResponse, AnnotateVideoProgress> - annotateVideoOperationSettings; - - private static final ImmutableMap> - RETRYABLE_CODE_DEFINITIONS; - - static { - ImmutableMap.Builder> definitions = - ImmutableMap.builder(); - definitions.put( - "idempotent", - ImmutableSet.copyOf( - Lists.newArrayList( - StatusCode.Code.DEADLINE_EXCEEDED, StatusCode.Code.UNAVAILABLE))); - definitions.put("non_idempotent", ImmutableSet.copyOf(Lists.newArrayList())); - RETRYABLE_CODE_DEFINITIONS = definitions.build(); - } - - private static final ImmutableMap RETRY_PARAM_DEFINITIONS; - - static { - ImmutableMap.Builder definitions = ImmutableMap.builder(); - RetrySettings settings = null; - settings = - RetrySettings.newBuilder() - .setInitialRetryDelay(Duration.ofMillis(1000L)) - .setRetryDelayMultiplier(2.5) - .setMaxRetryDelay(Duration.ofMillis(120000L)) - .setInitialRpcTimeout(Duration.ofMillis(120000L)) - .setRpcTimeoutMultiplier(1.0) - .setMaxRpcTimeout(Duration.ofMillis(120000L)) - .setTotalTimeout(Duration.ofMillis(600000L)) - .build(); - definitions.put("default", settings); - RETRY_PARAM_DEFINITIONS = definitions.build(); - } - - protected Builder() { - this((ClientContext) null); - } - - protected Builder(ClientContext clientContext) { - super(clientContext); - - annotateVideoSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); - - annotateVideoOperationSettings = OperationCallSettings.newBuilder(); - - unaryMethodSettingsBuilders = - ImmutableList.>of(annotateVideoSettings); - - initDefaults(this); - } - - private static Builder createDefault() { - Builder builder = new Builder((ClientContext) null); - builder.setTransportChannelProvider(defaultTransportChannelProvider()); - builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build()); - builder.setInternalHeaderProvider(defaultApiClientHeaderProviderBuilder().build()); - builder.setEndpoint(getDefaultEndpoint()); - return initDefaults(builder); - } - - private static Builder initDefaults(Builder builder) { - - builder - .annotateVideoSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); - builder - .annotateVideoOperationSettings() - .setInitialCallSettings( - UnaryCallSettings - .newUnaryCallSettingsBuilder() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")) - .build()) - .setResponseTransformer( - ProtoOperationTransformers.ResponseTransformer.create(AnnotateVideoResponse.class)) - .setMetadataTransformer( - ProtoOperationTransformers.MetadataTransformer.create(AnnotateVideoProgress.class)) - .setPollingAlgorithm( - OperationTimedPollAlgorithm.create( - RetrySettings.newBuilder() - .setInitialRetryDelay(Duration.ofMillis(20000L)) - .setRetryDelayMultiplier(1.5) - .setMaxRetryDelay(Duration.ofMillis(45000L)) - .setInitialRpcTimeout(Duration.ZERO) // ignored - .setRpcTimeoutMultiplier(1.0) // ignored - .setMaxRpcTimeout(Duration.ZERO) // ignored - .setTotalTimeout(Duration.ofMillis(86400000L)) - .build())); - - return builder; - } - - protected Builder(VideoIntelligenceServiceStubSettings settings) { - super(settings); - - annotateVideoSettings = settings.annotateVideoSettings.toBuilder(); - annotateVideoOperationSettings = settings.annotateVideoOperationSettings.toBuilder(); - - unaryMethodSettingsBuilders = - ImmutableList.>of(annotateVideoSettings); - } - - /** - * 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(unaryMethodSettingsBuilders, settingsUpdater); - return this; - } - - public ImmutableList> unaryMethodSettingsBuilders() { - return unaryMethodSettingsBuilders; - } - - /** Returns the builder for the settings used for calls to annotateVideo. */ - public UnaryCallSettings.Builder annotateVideoSettings() { - return annotateVideoSettings; - } - - /** Returns the builder for the settings used for calls to annotateVideo. */ - public OperationCallSettings.Builder< - AnnotateVideoRequest, AnnotateVideoResponse, AnnotateVideoProgress> - annotateVideoOperationSettings() { - return annotateVideoOperationSettings; - } - - @Override - public VideoIntelligenceServiceStubSettings build() throws IOException { - return new VideoIntelligenceServiceStubSettings(this); - } - } -} diff --git a/google-cloud-videointelligence/src/test/java/com/google/cloud/videointelligence/v1/MockVideoIntelligenceService.java b/google-cloud-videointelligence/src/test/java/com/google/cloud/videointelligence/v1/MockVideoIntelligenceService.java deleted file mode 100644 index 33b0177dd3dc..000000000000 --- a/google-cloud-videointelligence/src/test/java/com/google/cloud/videointelligence/v1/MockVideoIntelligenceService.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * 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.videointelligence.v1; - -import com.google.api.core.BetaApi; -import com.google.api.gax.grpc.testing.MockGrpcService; -import com.google.protobuf.GeneratedMessageV3; -import io.grpc.ServerServiceDefinition; -import java.util.List; - -@javax.annotation.Generated("by GAPIC") -@BetaApi -public class MockVideoIntelligenceService implements MockGrpcService { - private final MockVideoIntelligenceServiceImpl serviceImpl; - - public MockVideoIntelligenceService() { - serviceImpl = new MockVideoIntelligenceServiceImpl(); - } - - @Override - public List getRequests() { - return serviceImpl.getRequests(); - } - - @Override - public void addResponse(GeneratedMessageV3 response) { - serviceImpl.addResponse(response); - } - - @Override - public void addException(Exception exception) { - serviceImpl.addException(exception); - } - - @Override - public ServerServiceDefinition getServiceDefinition() { - return serviceImpl.bindService(); - } - - @Override - public void reset() { - serviceImpl.reset(); - } -} diff --git a/google-cloud-videointelligence/src/test/java/com/google/cloud/videointelligence/v1/MockVideoIntelligenceServiceImpl.java b/google-cloud-videointelligence/src/test/java/com/google/cloud/videointelligence/v1/MockVideoIntelligenceServiceImpl.java deleted file mode 100644 index b63e560e83b7..000000000000 --- a/google-cloud-videointelligence/src/test/java/com/google/cloud/videointelligence/v1/MockVideoIntelligenceServiceImpl.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * 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.videointelligence.v1; - -import com.google.api.core.BetaApi; -import com.google.cloud.videointelligence.v1.VideoIntelligenceServiceGrpc.VideoIntelligenceServiceImplBase; -import com.google.longrunning.Operation; -import com.google.protobuf.GeneratedMessageV3; -import io.grpc.stub.StreamObserver; -import java.util.ArrayList; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; - -@javax.annotation.Generated("by GAPIC") -@BetaApi -public class MockVideoIntelligenceServiceImpl extends VideoIntelligenceServiceImplBase { - private ArrayList requests; - private Queue responses; - - public MockVideoIntelligenceServiceImpl() { - requests = new ArrayList<>(); - responses = new LinkedList<>(); - } - - public List getRequests() { - return requests; - } - - public void addResponse(GeneratedMessageV3 response) { - responses.add(response); - } - - public void setResponses(List responses) { - this.responses = new LinkedList(responses); - } - - public void addException(Exception exception) { - responses.add(exception); - } - - public void reset() { - requests = new ArrayList<>(); - responses = new LinkedList<>(); - } - - @Override - public void annotateVideo( - AnnotateVideoRequest request, StreamObserver responseObserver) { - Object response = responses.remove(); - if (response instanceof Operation) { - requests.add(request); - responseObserver.onNext((Operation) 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-videointelligence/src/test/java/com/google/cloud/videointelligence/v1/VideoIntelligenceServiceClientTest.java b/google-cloud-videointelligence/src/test/java/com/google/cloud/videointelligence/v1/VideoIntelligenceServiceClientTest.java deleted file mode 100644 index f1adc0ba63e3..000000000000 --- a/google-cloud-videointelligence/src/test/java/com/google/cloud/videointelligence/v1/VideoIntelligenceServiceClientTest.java +++ /dev/null @@ -1,130 +0,0 @@ -/* - * 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.videointelligence.v1; - -import com.google.api.gax.core.NoCredentialsProvider; -import com.google.api.gax.grpc.GaxGrpcProperties; -import com.google.api.gax.grpc.testing.LocalChannelProvider; -import com.google.api.gax.grpc.testing.MockGrpcService; -import com.google.api.gax.grpc.testing.MockServiceHelper; -import com.google.api.gax.rpc.ApiClientHeaderProvider; -import com.google.api.gax.rpc.InvalidArgumentException; -import com.google.api.gax.rpc.StatusCode; -import com.google.longrunning.Operation; -import com.google.protobuf.Any; -import com.google.protobuf.GeneratedMessageV3; -import io.grpc.Status; -import io.grpc.StatusRuntimeException; -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.concurrent.ExecutionException; -import org.junit.After; -import org.junit.AfterClass; -import org.junit.Assert; -import org.junit.Before; -import org.junit.BeforeClass; -import org.junit.Test; - -@javax.annotation.Generated("by GAPIC") -public class VideoIntelligenceServiceClientTest { - private static MockVideoIntelligenceService mockVideoIntelligenceService; - private static MockServiceHelper serviceHelper; - private VideoIntelligenceServiceClient client; - private LocalChannelProvider channelProvider; - - @BeforeClass - public static void startStaticServer() { - mockVideoIntelligenceService = new MockVideoIntelligenceService(); - serviceHelper = - new MockServiceHelper( - "in-process-1", Arrays.asList(mockVideoIntelligenceService)); - serviceHelper.start(); - } - - @AfterClass - public static void stopServer() { - serviceHelper.stop(); - } - - @Before - public void setUp() throws IOException { - serviceHelper.reset(); - channelProvider = serviceHelper.createChannelProvider(); - VideoIntelligenceServiceSettings settings = - VideoIntelligenceServiceSettings.newBuilder() - .setTransportChannelProvider(channelProvider) - .setCredentialsProvider(NoCredentialsProvider.create()) - .build(); - client = VideoIntelligenceServiceClient.create(settings); - } - - @After - public void tearDown() throws Exception { - client.close(); - } - - @Test - @SuppressWarnings("all") - public void annotateVideoTest() throws Exception { - AnnotateVideoResponse expectedResponse = AnnotateVideoResponse.newBuilder().build(); - Operation resultOperation = - Operation.newBuilder() - .setName("annotateVideoTest") - .setDone(true) - .setResponse(Any.pack(expectedResponse)) - .build(); - mockVideoIntelligenceService.addResponse(resultOperation); - - String inputUri = "gs://demomaker/cat.mp4"; - Feature featuresElement = Feature.LABEL_DETECTION; - List features = Arrays.asList(featuresElement); - - AnnotateVideoResponse actualResponse = client.annotateVideoAsync(inputUri, features).get(); - Assert.assertEquals(expectedResponse, actualResponse); - - List actualRequests = mockVideoIntelligenceService.getRequests(); - Assert.assertEquals(1, actualRequests.size()); - AnnotateVideoRequest actualRequest = (AnnotateVideoRequest) actualRequests.get(0); - - Assert.assertEquals(inputUri, actualRequest.getInputUri()); - Assert.assertEquals(features, actualRequest.getFeaturesList()); - Assert.assertTrue( - channelProvider.isHeaderSent( - ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), - GaxGrpcProperties.getDefaultApiClientHeaderPattern())); - } - - @Test - @SuppressWarnings("all") - public void annotateVideoExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); - mockVideoIntelligenceService.addException(exception); - - try { - String inputUri = "gs://demomaker/cat.mp4"; - Feature featuresElement = Feature.LABEL_DETECTION; - List features = Arrays.asList(featuresElement); - - client.annotateVideoAsync(inputUri, features).get(); - Assert.fail("No exception raised"); - } catch (ExecutionException e) { - Assert.assertEquals(InvalidArgumentException.class, e.getCause().getClass()); - InvalidArgumentException apiException = (InvalidArgumentException) e.getCause(); - Assert.assertEquals(StatusCode.Code.INVALID_ARGUMENT, apiException.getStatusCode().getCode()); - } - } -} diff --git a/google-cloud-videointelligence/src/test/java/com/google/cloud/videointelligence/v1/VideoIntelligenceServiceSmokeTest.java b/google-cloud-videointelligence/src/test/java/com/google/cloud/videointelligence/v1/VideoIntelligenceServiceSmokeTest.java deleted file mode 100644 index 2e27a796679a..000000000000 --- a/google-cloud-videointelligence/src/test/java/com/google/cloud/videointelligence/v1/VideoIntelligenceServiceSmokeTest.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * 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.videointelligence.v1; - -import com.google.common.base.Preconditions; -import java.util.Arrays; -import java.util.List; -import java.util.logging.Level; -import java.util.logging.Logger; - -@javax.annotation.Generated("by GAPIC") -public class VideoIntelligenceServiceSmokeTest { - private static final String PROJECT_ENV_NAME = "GOOGLE_CLOUD_PROJECT"; - private static final String LEGACY_PROJECT_ENV_NAME = "GCLOUD_PROJECT"; - - public static void main(String args[]) { - Logger.getLogger("").setLevel(Level.WARNING); - try { - executeNoCatch(); - System.out.println("OK"); - } catch (Exception e) { - System.err.println("Failed with exception:"); - e.printStackTrace(System.err); - System.exit(1); - } - } - - public static void executeNoCatch() throws Exception { - try (VideoIntelligenceServiceClient client = VideoIntelligenceServiceClient.create()) { - String inputUri = "gs://demomaker/cat.mp4"; - Feature featuresElement = Feature.LABEL_DETECTION; - List features = Arrays.asList(featuresElement); - - AnnotateVideoResponse response = client.annotateVideoAsync(inputUri, features).get(); - } - } - - private static String getProjectId() { - String projectId = System.getProperty(PROJECT_ENV_NAME, System.getenv(PROJECT_ENV_NAME)); - if (projectId == null) { - projectId = - System.getProperty(LEGACY_PROJECT_ENV_NAME, System.getenv(LEGACY_PROJECT_ENV_NAME)); - } - Preconditions.checkArgument(projectId != null, "A project ID is required."); - return projectId; - } -} diff --git a/google-cloud-videointelligence/src/test/java/com/google/cloud/videointelligence/v1beta1/MockVideoIntelligenceService.java b/google-cloud-videointelligence/src/test/java/com/google/cloud/videointelligence/v1beta1/MockVideoIntelligenceService.java deleted file mode 100644 index 18332772c708..000000000000 --- a/google-cloud-videointelligence/src/test/java/com/google/cloud/videointelligence/v1beta1/MockVideoIntelligenceService.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * 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.videointelligence.v1beta1; - -import com.google.api.core.BetaApi; -import com.google.api.gax.grpc.testing.MockGrpcService; -import com.google.protobuf.GeneratedMessageV3; -import io.grpc.ServerServiceDefinition; -import java.util.List; - -@javax.annotation.Generated("by GAPIC") -@BetaApi -public class MockVideoIntelligenceService implements MockGrpcService { - private final MockVideoIntelligenceServiceImpl serviceImpl; - - public MockVideoIntelligenceService() { - serviceImpl = new MockVideoIntelligenceServiceImpl(); - } - - @Override - public List getRequests() { - return serviceImpl.getRequests(); - } - - @Override - public void addResponse(GeneratedMessageV3 response) { - serviceImpl.addResponse(response); - } - - @Override - public void addException(Exception exception) { - serviceImpl.addException(exception); - } - - @Override - public ServerServiceDefinition getServiceDefinition() { - return serviceImpl.bindService(); - } - - @Override - public void reset() { - serviceImpl.reset(); - } -} diff --git a/google-cloud-videointelligence/src/test/java/com/google/cloud/videointelligence/v1beta1/MockVideoIntelligenceServiceImpl.java b/google-cloud-videointelligence/src/test/java/com/google/cloud/videointelligence/v1beta1/MockVideoIntelligenceServiceImpl.java deleted file mode 100644 index f1934809a439..000000000000 --- a/google-cloud-videointelligence/src/test/java/com/google/cloud/videointelligence/v1beta1/MockVideoIntelligenceServiceImpl.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * 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.videointelligence.v1beta1; - -import com.google.api.core.BetaApi; -import com.google.cloud.videointelligence.v1beta1.VideoIntelligenceServiceGrpc.VideoIntelligenceServiceImplBase; -import com.google.longrunning.Operation; -import com.google.protobuf.GeneratedMessageV3; -import io.grpc.stub.StreamObserver; -import java.util.ArrayList; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; - -@javax.annotation.Generated("by GAPIC") -@BetaApi -public class MockVideoIntelligenceServiceImpl extends VideoIntelligenceServiceImplBase { - private ArrayList requests; - private Queue responses; - - public MockVideoIntelligenceServiceImpl() { - requests = new ArrayList<>(); - responses = new LinkedList<>(); - } - - public List getRequests() { - return requests; - } - - public void addResponse(GeneratedMessageV3 response) { - responses.add(response); - } - - public void setResponses(List responses) { - this.responses = new LinkedList(responses); - } - - public void addException(Exception exception) { - responses.add(exception); - } - - public void reset() { - requests = new ArrayList<>(); - responses = new LinkedList<>(); - } - - @Override - public void annotateVideo( - AnnotateVideoRequest request, StreamObserver responseObserver) { - Object response = responses.remove(); - if (response instanceof Operation) { - requests.add(request); - responseObserver.onNext((Operation) 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-videointelligence/src/test/java/com/google/cloud/videointelligence/v1beta1/VideoIntelligenceServiceClientTest.java b/google-cloud-videointelligence/src/test/java/com/google/cloud/videointelligence/v1beta1/VideoIntelligenceServiceClientTest.java deleted file mode 100644 index 33a2b13ea1d6..000000000000 --- a/google-cloud-videointelligence/src/test/java/com/google/cloud/videointelligence/v1beta1/VideoIntelligenceServiceClientTest.java +++ /dev/null @@ -1,130 +0,0 @@ -/* - * 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.videointelligence.v1beta1; - -import com.google.api.gax.core.NoCredentialsProvider; -import com.google.api.gax.grpc.GaxGrpcProperties; -import com.google.api.gax.grpc.testing.LocalChannelProvider; -import com.google.api.gax.grpc.testing.MockGrpcService; -import com.google.api.gax.grpc.testing.MockServiceHelper; -import com.google.api.gax.rpc.ApiClientHeaderProvider; -import com.google.api.gax.rpc.InvalidArgumentException; -import com.google.api.gax.rpc.StatusCode; -import com.google.longrunning.Operation; -import com.google.protobuf.Any; -import com.google.protobuf.GeneratedMessageV3; -import io.grpc.Status; -import io.grpc.StatusRuntimeException; -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.concurrent.ExecutionException; -import org.junit.After; -import org.junit.AfterClass; -import org.junit.Assert; -import org.junit.Before; -import org.junit.BeforeClass; -import org.junit.Test; - -@javax.annotation.Generated("by GAPIC") -public class VideoIntelligenceServiceClientTest { - private static MockVideoIntelligenceService mockVideoIntelligenceService; - private static MockServiceHelper serviceHelper; - private VideoIntelligenceServiceClient client; - private LocalChannelProvider channelProvider; - - @BeforeClass - public static void startStaticServer() { - mockVideoIntelligenceService = new MockVideoIntelligenceService(); - serviceHelper = - new MockServiceHelper( - "in-process-1", Arrays.asList(mockVideoIntelligenceService)); - serviceHelper.start(); - } - - @AfterClass - public static void stopServer() { - serviceHelper.stop(); - } - - @Before - public void setUp() throws IOException { - serviceHelper.reset(); - channelProvider = serviceHelper.createChannelProvider(); - VideoIntelligenceServiceSettings settings = - VideoIntelligenceServiceSettings.newBuilder() - .setTransportChannelProvider(channelProvider) - .setCredentialsProvider(NoCredentialsProvider.create()) - .build(); - client = VideoIntelligenceServiceClient.create(settings); - } - - @After - public void tearDown() throws Exception { - client.close(); - } - - @Test - @SuppressWarnings("all") - public void annotateVideoTest() throws Exception { - AnnotateVideoResponse expectedResponse = AnnotateVideoResponse.newBuilder().build(); - Operation resultOperation = - Operation.newBuilder() - .setName("annotateVideoTest") - .setDone(true) - .setResponse(Any.pack(expectedResponse)) - .build(); - mockVideoIntelligenceService.addResponse(resultOperation); - - String inputUri = "gs://demomaker/cat.mp4"; - Feature featuresElement = Feature.LABEL_DETECTION; - List features = Arrays.asList(featuresElement); - - AnnotateVideoResponse actualResponse = client.annotateVideoAsync(inputUri, features).get(); - Assert.assertEquals(expectedResponse, actualResponse); - - List actualRequests = mockVideoIntelligenceService.getRequests(); - Assert.assertEquals(1, actualRequests.size()); - AnnotateVideoRequest actualRequest = (AnnotateVideoRequest) actualRequests.get(0); - - Assert.assertEquals(inputUri, actualRequest.getInputUri()); - Assert.assertEquals(features, actualRequest.getFeaturesList()); - Assert.assertTrue( - channelProvider.isHeaderSent( - ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), - GaxGrpcProperties.getDefaultApiClientHeaderPattern())); - } - - @Test - @SuppressWarnings("all") - public void annotateVideoExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); - mockVideoIntelligenceService.addException(exception); - - try { - String inputUri = "gs://demomaker/cat.mp4"; - Feature featuresElement = Feature.LABEL_DETECTION; - List features = Arrays.asList(featuresElement); - - client.annotateVideoAsync(inputUri, features).get(); - Assert.fail("No exception raised"); - } catch (ExecutionException e) { - Assert.assertEquals(InvalidArgumentException.class, e.getCause().getClass()); - InvalidArgumentException apiException = (InvalidArgumentException) e.getCause(); - Assert.assertEquals(StatusCode.Code.INVALID_ARGUMENT, apiException.getStatusCode().getCode()); - } - } -} diff --git a/google-cloud-videointelligence/src/test/java/com/google/cloud/videointelligence/v1beta2/MockVideoIntelligenceService.java b/google-cloud-videointelligence/src/test/java/com/google/cloud/videointelligence/v1beta2/MockVideoIntelligenceService.java deleted file mode 100644 index b104697c373d..000000000000 --- a/google-cloud-videointelligence/src/test/java/com/google/cloud/videointelligence/v1beta2/MockVideoIntelligenceService.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * 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.videointelligence.v1beta2; - -import com.google.api.core.BetaApi; -import com.google.api.gax.grpc.testing.MockGrpcService; -import com.google.protobuf.GeneratedMessageV3; -import io.grpc.ServerServiceDefinition; -import java.util.List; - -@javax.annotation.Generated("by GAPIC") -@BetaApi -public class MockVideoIntelligenceService implements MockGrpcService { - private final MockVideoIntelligenceServiceImpl serviceImpl; - - public MockVideoIntelligenceService() { - serviceImpl = new MockVideoIntelligenceServiceImpl(); - } - - @Override - public List getRequests() { - return serviceImpl.getRequests(); - } - - @Override - public void addResponse(GeneratedMessageV3 response) { - serviceImpl.addResponse(response); - } - - @Override - public void addException(Exception exception) { - serviceImpl.addException(exception); - } - - @Override - public ServerServiceDefinition getServiceDefinition() { - return serviceImpl.bindService(); - } - - @Override - public void reset() { - serviceImpl.reset(); - } -} diff --git a/google-cloud-videointelligence/src/test/java/com/google/cloud/videointelligence/v1beta2/MockVideoIntelligenceServiceImpl.java b/google-cloud-videointelligence/src/test/java/com/google/cloud/videointelligence/v1beta2/MockVideoIntelligenceServiceImpl.java deleted file mode 100644 index fb7ae0972e36..000000000000 --- a/google-cloud-videointelligence/src/test/java/com/google/cloud/videointelligence/v1beta2/MockVideoIntelligenceServiceImpl.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * 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.videointelligence.v1beta2; - -import com.google.api.core.BetaApi; -import com.google.cloud.videointelligence.v1beta2.VideoIntelligenceServiceGrpc.VideoIntelligenceServiceImplBase; -import com.google.longrunning.Operation; -import com.google.protobuf.GeneratedMessageV3; -import io.grpc.stub.StreamObserver; -import java.util.ArrayList; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; - -@javax.annotation.Generated("by GAPIC") -@BetaApi -public class MockVideoIntelligenceServiceImpl extends VideoIntelligenceServiceImplBase { - private ArrayList requests; - private Queue responses; - - public MockVideoIntelligenceServiceImpl() { - requests = new ArrayList<>(); - responses = new LinkedList<>(); - } - - public List getRequests() { - return requests; - } - - public void addResponse(GeneratedMessageV3 response) { - responses.add(response); - } - - public void setResponses(List responses) { - this.responses = new LinkedList(responses); - } - - public void addException(Exception exception) { - responses.add(exception); - } - - public void reset() { - requests = new ArrayList<>(); - responses = new LinkedList<>(); - } - - @Override - public void annotateVideo( - AnnotateVideoRequest request, StreamObserver responseObserver) { - Object response = responses.remove(); - if (response instanceof Operation) { - requests.add(request); - responseObserver.onNext((Operation) 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-videointelligence/src/test/java/com/google/cloud/videointelligence/v1beta2/VideoIntelligenceServiceClientTest.java b/google-cloud-videointelligence/src/test/java/com/google/cloud/videointelligence/v1beta2/VideoIntelligenceServiceClientTest.java deleted file mode 100644 index ee40b26b3db9..000000000000 --- a/google-cloud-videointelligence/src/test/java/com/google/cloud/videointelligence/v1beta2/VideoIntelligenceServiceClientTest.java +++ /dev/null @@ -1,130 +0,0 @@ -/* - * 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.videointelligence.v1beta2; - -import com.google.api.gax.core.NoCredentialsProvider; -import com.google.api.gax.grpc.GaxGrpcProperties; -import com.google.api.gax.grpc.testing.LocalChannelProvider; -import com.google.api.gax.grpc.testing.MockGrpcService; -import com.google.api.gax.grpc.testing.MockServiceHelper; -import com.google.api.gax.rpc.ApiClientHeaderProvider; -import com.google.api.gax.rpc.InvalidArgumentException; -import com.google.api.gax.rpc.StatusCode; -import com.google.longrunning.Operation; -import com.google.protobuf.Any; -import com.google.protobuf.GeneratedMessageV3; -import io.grpc.Status; -import io.grpc.StatusRuntimeException; -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.concurrent.ExecutionException; -import org.junit.After; -import org.junit.AfterClass; -import org.junit.Assert; -import org.junit.Before; -import org.junit.BeforeClass; -import org.junit.Test; - -@javax.annotation.Generated("by GAPIC") -public class VideoIntelligenceServiceClientTest { - private static MockVideoIntelligenceService mockVideoIntelligenceService; - private static MockServiceHelper serviceHelper; - private VideoIntelligenceServiceClient client; - private LocalChannelProvider channelProvider; - - @BeforeClass - public static void startStaticServer() { - mockVideoIntelligenceService = new MockVideoIntelligenceService(); - serviceHelper = - new MockServiceHelper( - "in-process-1", Arrays.asList(mockVideoIntelligenceService)); - serviceHelper.start(); - } - - @AfterClass - public static void stopServer() { - serviceHelper.stop(); - } - - @Before - public void setUp() throws IOException { - serviceHelper.reset(); - channelProvider = serviceHelper.createChannelProvider(); - VideoIntelligenceServiceSettings settings = - VideoIntelligenceServiceSettings.newBuilder() - .setTransportChannelProvider(channelProvider) - .setCredentialsProvider(NoCredentialsProvider.create()) - .build(); - client = VideoIntelligenceServiceClient.create(settings); - } - - @After - public void tearDown() throws Exception { - client.close(); - } - - @Test - @SuppressWarnings("all") - public void annotateVideoTest() throws Exception { - AnnotateVideoResponse expectedResponse = AnnotateVideoResponse.newBuilder().build(); - Operation resultOperation = - Operation.newBuilder() - .setName("annotateVideoTest") - .setDone(true) - .setResponse(Any.pack(expectedResponse)) - .build(); - mockVideoIntelligenceService.addResponse(resultOperation); - - String inputUri = "gs://demomaker/cat.mp4"; - Feature featuresElement = Feature.LABEL_DETECTION; - List features = Arrays.asList(featuresElement); - - AnnotateVideoResponse actualResponse = client.annotateVideoAsync(inputUri, features).get(); - Assert.assertEquals(expectedResponse, actualResponse); - - List actualRequests = mockVideoIntelligenceService.getRequests(); - Assert.assertEquals(1, actualRequests.size()); - AnnotateVideoRequest actualRequest = (AnnotateVideoRequest) actualRequests.get(0); - - Assert.assertEquals(inputUri, actualRequest.getInputUri()); - Assert.assertEquals(features, actualRequest.getFeaturesList()); - Assert.assertTrue( - channelProvider.isHeaderSent( - ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), - GaxGrpcProperties.getDefaultApiClientHeaderPattern())); - } - - @Test - @SuppressWarnings("all") - public void annotateVideoExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); - mockVideoIntelligenceService.addException(exception); - - try { - String inputUri = "gs://demomaker/cat.mp4"; - Feature featuresElement = Feature.LABEL_DETECTION; - List features = Arrays.asList(featuresElement); - - client.annotateVideoAsync(inputUri, features).get(); - Assert.fail("No exception raised"); - } catch (ExecutionException e) { - Assert.assertEquals(InvalidArgumentException.class, e.getCause().getClass()); - InvalidArgumentException apiException = (InvalidArgumentException) e.getCause(); - Assert.assertEquals(StatusCode.Code.INVALID_ARGUMENT, apiException.getStatusCode().getCode()); - } - } -} diff --git a/google-cloud-videointelligence/src/test/java/com/google/cloud/videointelligence/v1p1beta1/VideoIntelligenceServiceSmokeTest.java b/google-cloud-videointelligence/src/test/java/com/google/cloud/videointelligence/v1p1beta1/VideoIntelligenceServiceSmokeTest.java deleted file mode 100644 index a202c86e0665..000000000000 --- a/google-cloud-videointelligence/src/test/java/com/google/cloud/videointelligence/v1p1beta1/VideoIntelligenceServiceSmokeTest.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * 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.videointelligence.v1p1beta1; - -import com.google.common.base.Preconditions; -import java.util.Arrays; -import java.util.List; -import java.util.logging.Level; -import java.util.logging.Logger; - -@javax.annotation.Generated("by GAPIC") -public class VideoIntelligenceServiceSmokeTest { - private static final String PROJECT_ENV_NAME = "GOOGLE_CLOUD_PROJECT"; - private static final String LEGACY_PROJECT_ENV_NAME = "GCLOUD_PROJECT"; - - public static void main(String args[]) { - Logger.getLogger("").setLevel(Level.WARNING); - try { - executeNoCatch(); - System.out.println("OK"); - } catch (Exception e) { - System.err.println("Failed with exception:"); - e.printStackTrace(System.err); - System.exit(1); - } - } - - public static void executeNoCatch() throws Exception { - try (VideoIntelligenceServiceClient client = VideoIntelligenceServiceClient.create()) { - String inputUri = "gs://demomaker/cat.mp4"; - Feature featuresElement = Feature.LABEL_DETECTION; - List features = Arrays.asList(featuresElement); - - AnnotateVideoResponse response = client.annotateVideoAsync(inputUri, features).get(); - } - } - - private static String getProjectId() { - String projectId = System.getProperty(PROJECT_ENV_NAME, System.getenv(PROJECT_ENV_NAME)); - if (projectId == null) { - projectId = - System.getProperty(LEGACY_PROJECT_ENV_NAME, System.getenv(LEGACY_PROJECT_ENV_NAME)); - } - Preconditions.checkArgument(projectId != null, "A project ID is required."); - return projectId; - } -}