-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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]>
- Loading branch information
1 parent
c9ba84d
commit 912d332
Showing
51 changed files
with
2,458 additions
and
0 deletions.
There are no files selected for viewing
47 changes: 47 additions & 0 deletions
47
...ligence/v1/stub/videointelligenceservicestubsettings/annotatevideo/SyncAnnotateVideo.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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] |
56 changes: 56 additions & 0 deletions
56
...videointelligence/v1/videointelligenceserviceclient/annotatevideo/AsyncAnnotateVideo.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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] |
57 changes: 57 additions & 0 deletions
57
...eointelligence/v1/videointelligenceserviceclient/annotatevideo/AsyncAnnotateVideoLRO.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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] |
53 changes: 53 additions & 0 deletions
53
.../videointelligence/v1/videointelligenceserviceclient/annotatevideo/SyncAnnotateVideo.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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] |
46 changes: 46 additions & 0 deletions
46
...e/v1/videointelligenceserviceclient/annotatevideo/SyncAnnotateVideoStringListfeature.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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] |
44 changes: 44 additions & 0 deletions
44
...telligence/v1/videointelligenceserviceclient/create/SyncCreateSetCredentialsProvider.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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] |
43 changes: 43 additions & 0 deletions
43
...elligence/v1/videointelligenceserviceclient/create/SyncCreateSetCredentialsProvider1.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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] |
39 changes: 39 additions & 0 deletions
39
...oud/videointelligence/v1/videointelligenceserviceclient/create/SyncCreateSetEndpoint.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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] |
Oops, something went wrong.