Skip to content

Commit

Permalink
feat: Enable REST transport for most of Java and Go clients (#920)
Browse files Browse the repository at this point in the history
* feat: Enable REST transport for most of Java and Go clients

PiperOrigin-RevId: 456641589

Source-Link: googleapis/googleapis@8a251f5

Source-Link: https://github.com/googleapis/googleapis-gen/commit/4ca52a529cf01308d9714950edffbea3560cfbdb
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNGNhNTJhNTI5Y2YwMTMwOGQ5NzE0OTUwZWRmZmJlYTM1NjBjZmJkYiJ9

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

* deps: adding gax-httpjson

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
Co-authored-by: Tomo Suzuki <[email protected]>
  • Loading branch information
3 people authored Jun 23, 2022
1 parent c9ba84d commit 912d332
Show file tree
Hide file tree
Showing 51 changed files with 2,458 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/*
* Copyright 2022 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.samples;

// [START videointelligence_v1_generated_videointelligenceservicestubsettings_annotatevideo_sync]
import com.google.cloud.videointelligence.v1.stub.VideoIntelligenceServiceStubSettings;
import java.time.Duration;

public class SyncAnnotateVideo {

public static void main(String[] args) throws Exception {
syncAnnotateVideo();
}

public static void syncAnnotateVideo() throws Exception {
// This snippet has been automatically generated for illustrative purposes only.
// It may require modifications to work in your environment.
VideoIntelligenceServiceStubSettings.Builder videoIntelligenceServiceSettingsBuilder =
VideoIntelligenceServiceStubSettings.newBuilder();
videoIntelligenceServiceSettingsBuilder
.annotateVideoSettings()
.setRetrySettings(
videoIntelligenceServiceSettingsBuilder
.annotateVideoSettings()
.getRetrySettings()
.toBuilder()
.setTotalTimeout(Duration.ofSeconds(30))
.build());
VideoIntelligenceServiceStubSettings videoIntelligenceServiceSettings =
videoIntelligenceServiceSettingsBuilder.build();
}
}
// [END videointelligence_v1_generated_videointelligenceservicestubsettings_annotatevideo_sync]
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
/*
* Copyright 2022 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.samples;

// [START videointelligence_v1_generated_videointelligenceserviceclient_annotatevideo_async]
import com.google.api.core.ApiFuture;
import com.google.cloud.videointelligence.v1.AnnotateVideoRequest;
import com.google.cloud.videointelligence.v1.Feature;
import com.google.cloud.videointelligence.v1.VideoContext;
import com.google.cloud.videointelligence.v1.VideoIntelligenceServiceClient;
import com.google.longrunning.Operation;
import com.google.protobuf.ByteString;
import java.util.ArrayList;

public class AsyncAnnotateVideo {

public static void main(String[] args) throws Exception {
asyncAnnotateVideo();
}

public static void asyncAnnotateVideo() throws Exception {
// This snippet has been automatically generated for illustrative purposes only.
// It may require modifications to work in your environment.
try (VideoIntelligenceServiceClient videoIntelligenceServiceClient =
VideoIntelligenceServiceClient.create()) {
AnnotateVideoRequest request =
AnnotateVideoRequest.newBuilder()
.setInputUri("inputUri470706498")
.setInputContent(ByteString.EMPTY)
.addAllFeatures(new ArrayList<Feature>())
.setVideoContext(VideoContext.newBuilder().build())
.setOutputUri("outputUri-2119300949")
.setLocationId("locationId1541836720")
.build();
ApiFuture<Operation> future =
videoIntelligenceServiceClient.annotateVideoCallable().futureCall(request);
// Do something.
Operation response = future.get();
}
}
}
// [END videointelligence_v1_generated_videointelligenceserviceclient_annotatevideo_async]
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
/*
* Copyright 2022 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.samples;

// [START videointelligence_v1_generated_videointelligenceserviceclient_annotatevideo_lro_async]
import com.google.api.gax.longrunning.OperationFuture;
import com.google.cloud.videointelligence.v1.AnnotateVideoProgress;
import com.google.cloud.videointelligence.v1.AnnotateVideoRequest;
import com.google.cloud.videointelligence.v1.AnnotateVideoResponse;
import com.google.cloud.videointelligence.v1.Feature;
import com.google.cloud.videointelligence.v1.VideoContext;
import com.google.cloud.videointelligence.v1.VideoIntelligenceServiceClient;
import com.google.protobuf.ByteString;
import java.util.ArrayList;

public class AsyncAnnotateVideoLRO {

public static void main(String[] args) throws Exception {
asyncAnnotateVideoLRO();
}

public static void asyncAnnotateVideoLRO() throws Exception {
// This snippet has been automatically generated for illustrative purposes only.
// It may require modifications to work in your environment.
try (VideoIntelligenceServiceClient videoIntelligenceServiceClient =
VideoIntelligenceServiceClient.create()) {
AnnotateVideoRequest request =
AnnotateVideoRequest.newBuilder()
.setInputUri("inputUri470706498")
.setInputContent(ByteString.EMPTY)
.addAllFeatures(new ArrayList<Feature>())
.setVideoContext(VideoContext.newBuilder().build())
.setOutputUri("outputUri-2119300949")
.setLocationId("locationId1541836720")
.build();
OperationFuture<AnnotateVideoResponse, AnnotateVideoProgress> future =
videoIntelligenceServiceClient.annotateVideoOperationCallable().futureCall(request);
// Do something.
AnnotateVideoResponse response = future.get();
}
}
}
// [END videointelligence_v1_generated_videointelligenceserviceclient_annotatevideo_lro_async]
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
/*
* Copyright 2022 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.samples;

// [START videointelligence_v1_generated_videointelligenceserviceclient_annotatevideo_sync]
import com.google.cloud.videointelligence.v1.AnnotateVideoRequest;
import com.google.cloud.videointelligence.v1.AnnotateVideoResponse;
import com.google.cloud.videointelligence.v1.Feature;
import com.google.cloud.videointelligence.v1.VideoContext;
import com.google.cloud.videointelligence.v1.VideoIntelligenceServiceClient;
import com.google.protobuf.ByteString;
import java.util.ArrayList;

public class SyncAnnotateVideo {

public static void main(String[] args) throws Exception {
syncAnnotateVideo();
}

public static void syncAnnotateVideo() throws Exception {
// This snippet has been automatically generated for illustrative purposes only.
// It may require modifications to work in your environment.
try (VideoIntelligenceServiceClient videoIntelligenceServiceClient =
VideoIntelligenceServiceClient.create()) {
AnnotateVideoRequest request =
AnnotateVideoRequest.newBuilder()
.setInputUri("inputUri470706498")
.setInputContent(ByteString.EMPTY)
.addAllFeatures(new ArrayList<Feature>())
.setVideoContext(VideoContext.newBuilder().build())
.setOutputUri("outputUri-2119300949")
.setLocationId("locationId1541836720")
.build();
AnnotateVideoResponse response =
videoIntelligenceServiceClient.annotateVideoAsync(request).get();
}
}
}
// [END videointelligence_v1_generated_videointelligenceserviceclient_annotatevideo_sync]
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/*
* Copyright 2022 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.samples;

// [START
// videointelligence_v1_generated_videointelligenceserviceclient_annotatevideo_stringlistfeature_sync]
import com.google.cloud.videointelligence.v1.AnnotateVideoResponse;
import com.google.cloud.videointelligence.v1.Feature;
import com.google.cloud.videointelligence.v1.VideoIntelligenceServiceClient;
import java.util.ArrayList;
import java.util.List;

public class SyncAnnotateVideoStringListfeature {

public static void main(String[] args) throws Exception {
syncAnnotateVideoStringListfeature();
}

public static void syncAnnotateVideoStringListfeature() throws Exception {
// This snippet has been automatically generated for illustrative purposes only.
// It may require modifications to work in your environment.
try (VideoIntelligenceServiceClient videoIntelligenceServiceClient =
VideoIntelligenceServiceClient.create()) {
String inputUri = "inputUri470706498";
List<Feature> features = new ArrayList<>();
AnnotateVideoResponse response =
videoIntelligenceServiceClient.annotateVideoAsync(inputUri, features).get();
}
}
}
// [END
// videointelligence_v1_generated_videointelligenceserviceclient_annotatevideo_stringlistfeature_sync]
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/*
* Copyright 2022 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.samples;

// [START
// videointelligence_v1_generated_videointelligenceserviceclient_create_setcredentialsprovider_sync]
import com.google.api.gax.core.FixedCredentialsProvider;
import com.google.cloud.videointelligence.v1.VideoIntelligenceServiceClient;
import com.google.cloud.videointelligence.v1.VideoIntelligenceServiceSettings;
import com.google.cloud.videointelligence.v1.myCredentials;

public class SyncCreateSetCredentialsProvider {

public static void main(String[] args) throws Exception {
syncCreateSetCredentialsProvider();
}

public static void syncCreateSetCredentialsProvider() throws Exception {
// This snippet has been automatically generated for illustrative purposes only.
// It may require modifications to work in your environment.
VideoIntelligenceServiceSettings videoIntelligenceServiceSettings =
VideoIntelligenceServiceSettings.newBuilder()
.setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
.build();
VideoIntelligenceServiceClient videoIntelligenceServiceClient =
VideoIntelligenceServiceClient.create(videoIntelligenceServiceSettings);
}
}
// [END
// videointelligence_v1_generated_videointelligenceserviceclient_create_setcredentialsprovider_sync]
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/*
* Copyright 2022 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.samples;

// [START
// videointelligence_v1_generated_videointelligenceserviceclient_create_setcredentialsprovider1_sync]
import com.google.cloud.videointelligence.v1.VideoIntelligenceServiceClient;
import com.google.cloud.videointelligence.v1.VideoIntelligenceServiceSettings;

public class SyncCreateSetCredentialsProvider1 {

public static void main(String[] args) throws Exception {
syncCreateSetCredentialsProvider1();
}

public static void syncCreateSetCredentialsProvider1() throws Exception {
// This snippet has been automatically generated for illustrative purposes only.
// It may require modifications to work in your environment.
VideoIntelligenceServiceSettings videoIntelligenceServiceSettings =
VideoIntelligenceServiceSettings.newBuilder()
.setTransportChannelProvider(
VideoIntelligenceServiceSettings.defaultHttpJsonTransportProviderBuilder().build())
.build();
VideoIntelligenceServiceClient videoIntelligenceServiceClient =
VideoIntelligenceServiceClient.create(videoIntelligenceServiceSettings);
}
}
// [END
// videointelligence_v1_generated_videointelligenceserviceclient_create_setcredentialsprovider1_sync]
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/*
* Copyright 2022 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.samples;

// [START videointelligence_v1_generated_videointelligenceserviceclient_create_setendpoint_sync]
import com.google.cloud.videointelligence.v1.VideoIntelligenceServiceClient;
import com.google.cloud.videointelligence.v1.VideoIntelligenceServiceSettings;
import com.google.cloud.videointelligence.v1.myEndpoint;

public class SyncCreateSetEndpoint {

public static void main(String[] args) throws Exception {
syncCreateSetEndpoint();
}

public static void syncCreateSetEndpoint() throws Exception {
// This snippet has been automatically generated for illustrative purposes only.
// It may require modifications to work in your environment.
VideoIntelligenceServiceSettings videoIntelligenceServiceSettings =
VideoIntelligenceServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
VideoIntelligenceServiceClient videoIntelligenceServiceClient =
VideoIntelligenceServiceClient.create(videoIntelligenceServiceSettings);
}
}
// [END videointelligence_v1_generated_videointelligenceserviceclient_create_setendpoint_sync]
Loading

0 comments on commit 912d332

Please sign in to comment.