Skip to content

Commit 912d332

Browse files
feat: Enable REST transport for most of Java and Go clients (#920)
* 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]>
1 parent c9ba84d commit 912d332

File tree

51 files changed

+2458
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+2458
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
/*
2+
* Copyright 2022 Google LLC
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package com.google.cloud.videointelligence.v1.stub.samples;
18+
19+
// [START videointelligence_v1_generated_videointelligenceservicestubsettings_annotatevideo_sync]
20+
import com.google.cloud.videointelligence.v1.stub.VideoIntelligenceServiceStubSettings;
21+
import java.time.Duration;
22+
23+
public class SyncAnnotateVideo {
24+
25+
public static void main(String[] args) throws Exception {
26+
syncAnnotateVideo();
27+
}
28+
29+
public static void syncAnnotateVideo() throws Exception {
30+
// This snippet has been automatically generated for illustrative purposes only.
31+
// It may require modifications to work in your environment.
32+
VideoIntelligenceServiceStubSettings.Builder videoIntelligenceServiceSettingsBuilder =
33+
VideoIntelligenceServiceStubSettings.newBuilder();
34+
videoIntelligenceServiceSettingsBuilder
35+
.annotateVideoSettings()
36+
.setRetrySettings(
37+
videoIntelligenceServiceSettingsBuilder
38+
.annotateVideoSettings()
39+
.getRetrySettings()
40+
.toBuilder()
41+
.setTotalTimeout(Duration.ofSeconds(30))
42+
.build());
43+
VideoIntelligenceServiceStubSettings videoIntelligenceServiceSettings =
44+
videoIntelligenceServiceSettingsBuilder.build();
45+
}
46+
}
47+
// [END videointelligence_v1_generated_videointelligenceservicestubsettings_annotatevideo_sync]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
/*
2+
* Copyright 2022 Google LLC
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package com.google.cloud.videointelligence.v1.samples;
18+
19+
// [START videointelligence_v1_generated_videointelligenceserviceclient_annotatevideo_async]
20+
import com.google.api.core.ApiFuture;
21+
import com.google.cloud.videointelligence.v1.AnnotateVideoRequest;
22+
import com.google.cloud.videointelligence.v1.Feature;
23+
import com.google.cloud.videointelligence.v1.VideoContext;
24+
import com.google.cloud.videointelligence.v1.VideoIntelligenceServiceClient;
25+
import com.google.longrunning.Operation;
26+
import com.google.protobuf.ByteString;
27+
import java.util.ArrayList;
28+
29+
public class AsyncAnnotateVideo {
30+
31+
public static void main(String[] args) throws Exception {
32+
asyncAnnotateVideo();
33+
}
34+
35+
public static void asyncAnnotateVideo() throws Exception {
36+
// This snippet has been automatically generated for illustrative purposes only.
37+
// It may require modifications to work in your environment.
38+
try (VideoIntelligenceServiceClient videoIntelligenceServiceClient =
39+
VideoIntelligenceServiceClient.create()) {
40+
AnnotateVideoRequest request =
41+
AnnotateVideoRequest.newBuilder()
42+
.setInputUri("inputUri470706498")
43+
.setInputContent(ByteString.EMPTY)
44+
.addAllFeatures(new ArrayList<Feature>())
45+
.setVideoContext(VideoContext.newBuilder().build())
46+
.setOutputUri("outputUri-2119300949")
47+
.setLocationId("locationId1541836720")
48+
.build();
49+
ApiFuture<Operation> future =
50+
videoIntelligenceServiceClient.annotateVideoCallable().futureCall(request);
51+
// Do something.
52+
Operation response = future.get();
53+
}
54+
}
55+
}
56+
// [END videointelligence_v1_generated_videointelligenceserviceclient_annotatevideo_async]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
/*
2+
* Copyright 2022 Google LLC
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package com.google.cloud.videointelligence.v1.samples;
18+
19+
// [START videointelligence_v1_generated_videointelligenceserviceclient_annotatevideo_lro_async]
20+
import com.google.api.gax.longrunning.OperationFuture;
21+
import com.google.cloud.videointelligence.v1.AnnotateVideoProgress;
22+
import com.google.cloud.videointelligence.v1.AnnotateVideoRequest;
23+
import com.google.cloud.videointelligence.v1.AnnotateVideoResponse;
24+
import com.google.cloud.videointelligence.v1.Feature;
25+
import com.google.cloud.videointelligence.v1.VideoContext;
26+
import com.google.cloud.videointelligence.v1.VideoIntelligenceServiceClient;
27+
import com.google.protobuf.ByteString;
28+
import java.util.ArrayList;
29+
30+
public class AsyncAnnotateVideoLRO {
31+
32+
public static void main(String[] args) throws Exception {
33+
asyncAnnotateVideoLRO();
34+
}
35+
36+
public static void asyncAnnotateVideoLRO() throws Exception {
37+
// This snippet has been automatically generated for illustrative purposes only.
38+
// It may require modifications to work in your environment.
39+
try (VideoIntelligenceServiceClient videoIntelligenceServiceClient =
40+
VideoIntelligenceServiceClient.create()) {
41+
AnnotateVideoRequest request =
42+
AnnotateVideoRequest.newBuilder()
43+
.setInputUri("inputUri470706498")
44+
.setInputContent(ByteString.EMPTY)
45+
.addAllFeatures(new ArrayList<Feature>())
46+
.setVideoContext(VideoContext.newBuilder().build())
47+
.setOutputUri("outputUri-2119300949")
48+
.setLocationId("locationId1541836720")
49+
.build();
50+
OperationFuture<AnnotateVideoResponse, AnnotateVideoProgress> future =
51+
videoIntelligenceServiceClient.annotateVideoOperationCallable().futureCall(request);
52+
// Do something.
53+
AnnotateVideoResponse response = future.get();
54+
}
55+
}
56+
}
57+
// [END videointelligence_v1_generated_videointelligenceserviceclient_annotatevideo_lro_async]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
/*
2+
* Copyright 2022 Google LLC
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package com.google.cloud.videointelligence.v1.samples;
18+
19+
// [START videointelligence_v1_generated_videointelligenceserviceclient_annotatevideo_sync]
20+
import com.google.cloud.videointelligence.v1.AnnotateVideoRequest;
21+
import com.google.cloud.videointelligence.v1.AnnotateVideoResponse;
22+
import com.google.cloud.videointelligence.v1.Feature;
23+
import com.google.cloud.videointelligence.v1.VideoContext;
24+
import com.google.cloud.videointelligence.v1.VideoIntelligenceServiceClient;
25+
import com.google.protobuf.ByteString;
26+
import java.util.ArrayList;
27+
28+
public class SyncAnnotateVideo {
29+
30+
public static void main(String[] args) throws Exception {
31+
syncAnnotateVideo();
32+
}
33+
34+
public static void syncAnnotateVideo() throws Exception {
35+
// This snippet has been automatically generated for illustrative purposes only.
36+
// It may require modifications to work in your environment.
37+
try (VideoIntelligenceServiceClient videoIntelligenceServiceClient =
38+
VideoIntelligenceServiceClient.create()) {
39+
AnnotateVideoRequest request =
40+
AnnotateVideoRequest.newBuilder()
41+
.setInputUri("inputUri470706498")
42+
.setInputContent(ByteString.EMPTY)
43+
.addAllFeatures(new ArrayList<Feature>())
44+
.setVideoContext(VideoContext.newBuilder().build())
45+
.setOutputUri("outputUri-2119300949")
46+
.setLocationId("locationId1541836720")
47+
.build();
48+
AnnotateVideoResponse response =
49+
videoIntelligenceServiceClient.annotateVideoAsync(request).get();
50+
}
51+
}
52+
}
53+
// [END videointelligence_v1_generated_videointelligenceserviceclient_annotatevideo_sync]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
/*
2+
* Copyright 2022 Google LLC
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package com.google.cloud.videointelligence.v1.samples;
18+
19+
// [START
20+
// videointelligence_v1_generated_videointelligenceserviceclient_annotatevideo_stringlistfeature_sync]
21+
import com.google.cloud.videointelligence.v1.AnnotateVideoResponse;
22+
import com.google.cloud.videointelligence.v1.Feature;
23+
import com.google.cloud.videointelligence.v1.VideoIntelligenceServiceClient;
24+
import java.util.ArrayList;
25+
import java.util.List;
26+
27+
public class SyncAnnotateVideoStringListfeature {
28+
29+
public static void main(String[] args) throws Exception {
30+
syncAnnotateVideoStringListfeature();
31+
}
32+
33+
public static void syncAnnotateVideoStringListfeature() throws Exception {
34+
// This snippet has been automatically generated for illustrative purposes only.
35+
// It may require modifications to work in your environment.
36+
try (VideoIntelligenceServiceClient videoIntelligenceServiceClient =
37+
VideoIntelligenceServiceClient.create()) {
38+
String inputUri = "inputUri470706498";
39+
List<Feature> features = new ArrayList<>();
40+
AnnotateVideoResponse response =
41+
videoIntelligenceServiceClient.annotateVideoAsync(inputUri, features).get();
42+
}
43+
}
44+
}
45+
// [END
46+
// videointelligence_v1_generated_videointelligenceserviceclient_annotatevideo_stringlistfeature_sync]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
/*
2+
* Copyright 2022 Google LLC
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package com.google.cloud.videointelligence.v1.samples;
18+
19+
// [START
20+
// videointelligence_v1_generated_videointelligenceserviceclient_create_setcredentialsprovider_sync]
21+
import com.google.api.gax.core.FixedCredentialsProvider;
22+
import com.google.cloud.videointelligence.v1.VideoIntelligenceServiceClient;
23+
import com.google.cloud.videointelligence.v1.VideoIntelligenceServiceSettings;
24+
import com.google.cloud.videointelligence.v1.myCredentials;
25+
26+
public class SyncCreateSetCredentialsProvider {
27+
28+
public static void main(String[] args) throws Exception {
29+
syncCreateSetCredentialsProvider();
30+
}
31+
32+
public static void syncCreateSetCredentialsProvider() throws Exception {
33+
// This snippet has been automatically generated for illustrative purposes only.
34+
// It may require modifications to work in your environment.
35+
VideoIntelligenceServiceSettings videoIntelligenceServiceSettings =
36+
VideoIntelligenceServiceSettings.newBuilder()
37+
.setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
38+
.build();
39+
VideoIntelligenceServiceClient videoIntelligenceServiceClient =
40+
VideoIntelligenceServiceClient.create(videoIntelligenceServiceSettings);
41+
}
42+
}
43+
// [END
44+
// videointelligence_v1_generated_videointelligenceserviceclient_create_setcredentialsprovider_sync]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
/*
2+
* Copyright 2022 Google LLC
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package com.google.cloud.videointelligence.v1.samples;
18+
19+
// [START
20+
// videointelligence_v1_generated_videointelligenceserviceclient_create_setcredentialsprovider1_sync]
21+
import com.google.cloud.videointelligence.v1.VideoIntelligenceServiceClient;
22+
import com.google.cloud.videointelligence.v1.VideoIntelligenceServiceSettings;
23+
24+
public class SyncCreateSetCredentialsProvider1 {
25+
26+
public static void main(String[] args) throws Exception {
27+
syncCreateSetCredentialsProvider1();
28+
}
29+
30+
public static void syncCreateSetCredentialsProvider1() throws Exception {
31+
// This snippet has been automatically generated for illustrative purposes only.
32+
// It may require modifications to work in your environment.
33+
VideoIntelligenceServiceSettings videoIntelligenceServiceSettings =
34+
VideoIntelligenceServiceSettings.newBuilder()
35+
.setTransportChannelProvider(
36+
VideoIntelligenceServiceSettings.defaultHttpJsonTransportProviderBuilder().build())
37+
.build();
38+
VideoIntelligenceServiceClient videoIntelligenceServiceClient =
39+
VideoIntelligenceServiceClient.create(videoIntelligenceServiceSettings);
40+
}
41+
}
42+
// [END
43+
// videointelligence_v1_generated_videointelligenceserviceclient_create_setcredentialsprovider1_sync]
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
/*
2+
* Copyright 2022 Google LLC
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package com.google.cloud.videointelligence.v1.samples;
18+
19+
// [START videointelligence_v1_generated_videointelligenceserviceclient_create_setendpoint_sync]
20+
import com.google.cloud.videointelligence.v1.VideoIntelligenceServiceClient;
21+
import com.google.cloud.videointelligence.v1.VideoIntelligenceServiceSettings;
22+
import com.google.cloud.videointelligence.v1.myEndpoint;
23+
24+
public class SyncCreateSetEndpoint {
25+
26+
public static void main(String[] args) throws Exception {
27+
syncCreateSetEndpoint();
28+
}
29+
30+
public static void syncCreateSetEndpoint() throws Exception {
31+
// This snippet has been automatically generated for illustrative purposes only.
32+
// It may require modifications to work in your environment.
33+
VideoIntelligenceServiceSettings videoIntelligenceServiceSettings =
34+
VideoIntelligenceServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
35+
VideoIntelligenceServiceClient videoIntelligenceServiceClient =
36+
VideoIntelligenceServiceClient.create(videoIntelligenceServiceSettings);
37+
}
38+
}
39+
// [END videointelligence_v1_generated_videointelligenceserviceclient_create_setendpoint_sync]

0 commit comments

Comments
 (0)