google-cloud-video_intelligence-v1beta2 0.4.5 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/AUTHENTICATION.md +1 -1
- data/README.md +12 -7
- data/lib/google/cloud/video_intelligence/v1beta2/rest.rb +37 -0
- data/lib/google/cloud/video_intelligence/v1beta2/version.rb +1 -1
- data/lib/google/cloud/video_intelligence/v1beta2/video_intelligence_service/client.rb +4 -4
- data/lib/google/cloud/video_intelligence/v1beta2/video_intelligence_service/operations.rb +15 -14
- data/lib/google/cloud/video_intelligence/v1beta2/video_intelligence_service/rest/client.rb +394 -0
- data/lib/google/cloud/video_intelligence/v1beta2/video_intelligence_service/rest/operations.rb +814 -0
- data/lib/google/cloud/video_intelligence/v1beta2/video_intelligence_service/rest/service_stub.rb +106 -0
- data/lib/google/cloud/video_intelligence/v1beta2/video_intelligence_service/rest.rb +52 -0
- data/lib/google/cloud/video_intelligence/v1beta2/video_intelligence_service.rb +7 -1
- data/lib/google/cloud/video_intelligence/v1beta2.rb +8 -1
- data/lib/google/cloud/videointelligence/v1beta2/video_intelligence_pb.rb +2 -1
- data/proto_docs/google/api/client.rb +318 -0
- data/proto_docs/google/api/launch_stage.rb +71 -0
- data/proto_docs/google/protobuf/any.rb +3 -3
- data/proto_docs/google/protobuf/empty.rb +0 -2
- data/proto_docs/google/rpc/status.rb +4 -2
- metadata +19 -12
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: aeaba2ca457a7bb903e56078cb24d46d1139937b1764f2d95f09155af43280b3
|
|
4
|
+
data.tar.gz: 735f8a6adeecc639fbfb0bb7e912ec0ed10a36f660d85a1a156f67feff547e36
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 17f2a57e06834763972ba300c320b62438a7675956673ed44540ca7721b513a4c44b7cc7a0f3a3a6511416eb104f806da69c28be4506d519d313060d80bc6bcf
|
|
7
|
+
data.tar.gz: 8295f7d9797cbe6a2e9e4a7bf28aa6193d15ff9ef5c74d051e209f4cf4c89a27bee68c1fff93af9a02758db7cc3b958d089e4c59cb977e1f860bc2b92823f421
|
data/AUTHENTICATION.md
CHANGED
|
@@ -114,7 +114,7 @@ credentials are discovered.
|
|
|
114
114
|
To configure your system for this, simply:
|
|
115
115
|
|
|
116
116
|
1. [Download and install the Cloud SDK](https://cloud.google.com/sdk)
|
|
117
|
-
2. Authenticate using OAuth 2.0 `$ gcloud auth login`
|
|
117
|
+
2. Authenticate using OAuth 2.0 `$ gcloud auth application-default login`
|
|
118
118
|
3. Write code as if already authenticated.
|
|
119
119
|
|
|
120
120
|
**NOTE:** This is _not_ recommended for running in production. The Cloud SDK
|
data/README.md
CHANGED
|
@@ -37,7 +37,7 @@ request = ::Google::Cloud::VideoIntelligence::V1beta2::AnnotateVideoRequest.new
|
|
|
37
37
|
response = client.annotate_video request
|
|
38
38
|
```
|
|
39
39
|
|
|
40
|
-
View the [Client Library Documentation](https://
|
|
40
|
+
View the [Client Library Documentation](https://cloud.google.com/ruby/docs/reference/google-cloud-video_intelligence-v1beta2/latest)
|
|
41
41
|
for class and method documentation.
|
|
42
42
|
|
|
43
43
|
See also the [Product Documentation](https://cloud.google.com/video-intelligence)
|
|
@@ -46,7 +46,7 @@ for general usage information.
|
|
|
46
46
|
## Enabling Logging
|
|
47
47
|
|
|
48
48
|
To enable logging for this library, set the logger for the underlying [gRPC](https://github.com/grpc/grpc/tree/master/src/ruby) library.
|
|
49
|
-
The logger that you set may be a Ruby stdlib [`Logger`](https://ruby-doc.org/
|
|
49
|
+
The logger that you set may be a Ruby stdlib [`Logger`](https://ruby-doc.org/current/stdlibs/logger/Logger.html) as shown below,
|
|
50
50
|
or a [`Google::Cloud::Logging::Logger`](https://googleapis.dev/ruby/google-cloud-logging/latest)
|
|
51
51
|
that will write logs to [Cloud Logging](https://cloud.google.com/logging/). See [grpc/logconfig.rb](https://github.com/grpc/grpc/blob/master/src/ruby/lib/grpc/logconfig.rb)
|
|
52
52
|
and the gRPC [spec_helper.rb](https://github.com/grpc/grpc/blob/master/src/ruby/spec/spec_helper.rb) for additional information.
|
|
@@ -69,16 +69,21 @@ module GRPC
|
|
|
69
69
|
end
|
|
70
70
|
```
|
|
71
71
|
|
|
72
|
+
|
|
73
|
+
## Google Cloud Samples
|
|
74
|
+
|
|
75
|
+
To browse ready to use code samples check [Google Cloud Samples](https://cloud.google.com/docs/samples).
|
|
76
|
+
|
|
72
77
|
## Supported Ruby Versions
|
|
73
78
|
|
|
74
|
-
This library is supported on Ruby 2.
|
|
79
|
+
This library is supported on Ruby 2.6+.
|
|
75
80
|
|
|
76
81
|
Google provides official support for Ruby versions that are actively supported
|
|
77
82
|
by Ruby Core—that is, Ruby versions that are either in normal maintenance or
|
|
78
|
-
in security maintenance, and not end of life.
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
83
|
+
in security maintenance, and not end of life. Older versions of Ruby _may_
|
|
84
|
+
still work, but are unsupported and not recommended. See
|
|
85
|
+
https://www.ruby-lang.org/en/downloads/branches/ for details about the Ruby
|
|
86
|
+
support schedule.
|
|
82
87
|
|
|
83
88
|
## Which client should I use?
|
|
84
89
|
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# Copyright 2023 Google LLC
|
|
4
|
+
#
|
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
# you may not use this file except in compliance with the License.
|
|
7
|
+
# You may obtain a copy of the License at
|
|
8
|
+
#
|
|
9
|
+
# https://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
#
|
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
# See the License for the specific language governing permissions and
|
|
15
|
+
# limitations under the License.
|
|
16
|
+
|
|
17
|
+
# Auto-generated by gapic-generator-ruby. DO NOT EDIT!
|
|
18
|
+
|
|
19
|
+
require "google/cloud/video_intelligence/v1beta2/video_intelligence_service/rest"
|
|
20
|
+
require "google/cloud/video_intelligence/v1beta2/version"
|
|
21
|
+
|
|
22
|
+
module Google
|
|
23
|
+
module Cloud
|
|
24
|
+
module VideoIntelligence
|
|
25
|
+
##
|
|
26
|
+
# To load just the REST part of this package, including all its services, and instantiate a REST client:
|
|
27
|
+
#
|
|
28
|
+
# @example
|
|
29
|
+
#
|
|
30
|
+
# require "google/cloud/video_intelligence/v1beta2/rest"
|
|
31
|
+
# client = ::Google::Cloud::VideoIntelligence::V1beta2::VideoIntelligenceService::Rest::Client.new
|
|
32
|
+
#
|
|
33
|
+
module V1beta2
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
end
|
|
@@ -234,14 +234,14 @@ module Google
|
|
|
234
234
|
# # Call the annotate_video method.
|
|
235
235
|
# result = client.annotate_video request
|
|
236
236
|
#
|
|
237
|
-
# # The returned object is of type Gapic::Operation. You can use
|
|
238
|
-
# #
|
|
239
|
-
# #
|
|
237
|
+
# # The returned object is of type Gapic::Operation. You can use it to
|
|
238
|
+
# # check the status of an operation, cancel it, or wait for results.
|
|
239
|
+
# # Here is how to wait for a response.
|
|
240
240
|
# result.wait_until_done! timeout: 60
|
|
241
241
|
# if result.response?
|
|
242
242
|
# p result.response
|
|
243
243
|
# else
|
|
244
|
-
# puts "
|
|
244
|
+
# puts "No response received."
|
|
245
245
|
# end
|
|
246
246
|
#
|
|
247
247
|
def annotate_video request, options = nil
|
|
@@ -95,6 +95,9 @@ module Google
|
|
|
95
95
|
channel_args: @config.channel_args,
|
|
96
96
|
interceptors: @config.interceptors
|
|
97
97
|
)
|
|
98
|
+
|
|
99
|
+
# Used by an LRO wrapper for some methods of this service
|
|
100
|
+
@operations_client = self
|
|
98
101
|
end
|
|
99
102
|
|
|
100
103
|
# Service calls
|
|
@@ -155,13 +158,11 @@ module Google
|
|
|
155
158
|
# # Call the list_operations method.
|
|
156
159
|
# result = client.list_operations request
|
|
157
160
|
#
|
|
158
|
-
# # The returned object is of type Gapic::PagedEnumerable. You can
|
|
159
|
-
# #
|
|
160
|
-
#
|
|
161
|
-
# # methods are also available for managing paging directly.
|
|
162
|
-
# result.each do |response|
|
|
161
|
+
# # The returned object is of type Gapic::PagedEnumerable. You can iterate
|
|
162
|
+
# # over elements, and API calls will be issued to fetch pages as needed.
|
|
163
|
+
# result.each do |item|
|
|
163
164
|
# # Each element is of type ::Google::Longrunning::Operation.
|
|
164
|
-
# p
|
|
165
|
+
# p item
|
|
165
166
|
# end
|
|
166
167
|
#
|
|
167
168
|
def list_operations request, options = nil
|
|
@@ -250,14 +251,14 @@ module Google
|
|
|
250
251
|
# # Call the get_operation method.
|
|
251
252
|
# result = client.get_operation request
|
|
252
253
|
#
|
|
253
|
-
# # The returned object is of type Gapic::Operation. You can use
|
|
254
|
-
# #
|
|
255
|
-
# #
|
|
254
|
+
# # The returned object is of type Gapic::Operation. You can use it to
|
|
255
|
+
# # check the status of an operation, cancel it, or wait for results.
|
|
256
|
+
# # Here is how to wait for a response.
|
|
256
257
|
# result.wait_until_done! timeout: 60
|
|
257
258
|
# if result.response?
|
|
258
259
|
# p result.response
|
|
259
260
|
# else
|
|
260
|
-
# puts "
|
|
261
|
+
# puts "No response received."
|
|
261
262
|
# end
|
|
262
263
|
#
|
|
263
264
|
def get_operation request, options = nil
|
|
@@ -537,14 +538,14 @@ module Google
|
|
|
537
538
|
# # Call the wait_operation method.
|
|
538
539
|
# result = client.wait_operation request
|
|
539
540
|
#
|
|
540
|
-
# # The returned object is of type Gapic::Operation. You can use
|
|
541
|
-
# #
|
|
542
|
-
# #
|
|
541
|
+
# # The returned object is of type Gapic::Operation. You can use it to
|
|
542
|
+
# # check the status of an operation, cancel it, or wait for results.
|
|
543
|
+
# # Here is how to wait for a response.
|
|
543
544
|
# result.wait_until_done! timeout: 60
|
|
544
545
|
# if result.response?
|
|
545
546
|
# p result.response
|
|
546
547
|
# else
|
|
547
|
-
# puts "
|
|
548
|
+
# puts "No response received."
|
|
548
549
|
# end
|
|
549
550
|
#
|
|
550
551
|
def wait_operation request, options = nil
|
|
@@ -0,0 +1,394 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# Copyright 2023 Google LLC
|
|
4
|
+
#
|
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
# you may not use this file except in compliance with the License.
|
|
7
|
+
# You may obtain a copy of the License at
|
|
8
|
+
#
|
|
9
|
+
# https://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
#
|
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
# See the License for the specific language governing permissions and
|
|
15
|
+
# limitations under the License.
|
|
16
|
+
|
|
17
|
+
# Auto-generated by gapic-generator-ruby. DO NOT EDIT!
|
|
18
|
+
|
|
19
|
+
require "google/cloud/errors"
|
|
20
|
+
require "google/cloud/videointelligence/v1beta2/video_intelligence_pb"
|
|
21
|
+
require "google/cloud/video_intelligence/v1beta2/video_intelligence_service/rest/service_stub"
|
|
22
|
+
|
|
23
|
+
module Google
|
|
24
|
+
module Cloud
|
|
25
|
+
module VideoIntelligence
|
|
26
|
+
module V1beta2
|
|
27
|
+
module VideoIntelligenceService
|
|
28
|
+
module Rest
|
|
29
|
+
##
|
|
30
|
+
# REST client for the VideoIntelligenceService service.
|
|
31
|
+
#
|
|
32
|
+
# Service that implements Google Cloud Video Intelligence API.
|
|
33
|
+
#
|
|
34
|
+
class Client
|
|
35
|
+
# @private
|
|
36
|
+
attr_reader :video_intelligence_service_stub
|
|
37
|
+
|
|
38
|
+
##
|
|
39
|
+
# Configure the VideoIntelligenceService Client class.
|
|
40
|
+
#
|
|
41
|
+
# See {::Google::Cloud::VideoIntelligence::V1beta2::VideoIntelligenceService::Rest::Client::Configuration}
|
|
42
|
+
# for a description of the configuration fields.
|
|
43
|
+
#
|
|
44
|
+
# @example
|
|
45
|
+
#
|
|
46
|
+
# # Modify the configuration for all VideoIntelligenceService clients
|
|
47
|
+
# ::Google::Cloud::VideoIntelligence::V1beta2::VideoIntelligenceService::Rest::Client.configure do |config|
|
|
48
|
+
# config.timeout = 10.0
|
|
49
|
+
# end
|
|
50
|
+
#
|
|
51
|
+
# @yield [config] Configure the Client client.
|
|
52
|
+
# @yieldparam config [Client::Configuration]
|
|
53
|
+
#
|
|
54
|
+
# @return [Client::Configuration]
|
|
55
|
+
#
|
|
56
|
+
def self.configure
|
|
57
|
+
@configure ||= begin
|
|
58
|
+
namespace = ["Google", "Cloud", "VideoIntelligence", "V1beta2"]
|
|
59
|
+
parent_config = while namespace.any?
|
|
60
|
+
parent_name = namespace.join "::"
|
|
61
|
+
parent_const = const_get parent_name
|
|
62
|
+
break parent_const.configure if parent_const.respond_to? :configure
|
|
63
|
+
namespace.pop
|
|
64
|
+
end
|
|
65
|
+
default_config = Client::Configuration.new parent_config
|
|
66
|
+
|
|
67
|
+
default_config.rpcs.annotate_video.timeout = 600.0
|
|
68
|
+
default_config.rpcs.annotate_video.retry_policy = {
|
|
69
|
+
initial_delay: 1.0, max_delay: 120.0, multiplier: 2.5, retry_codes: [14, 4]
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
default_config
|
|
73
|
+
end
|
|
74
|
+
yield @configure if block_given?
|
|
75
|
+
@configure
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
##
|
|
79
|
+
# Configure the VideoIntelligenceService Client instance.
|
|
80
|
+
#
|
|
81
|
+
# The configuration is set to the derived mode, meaning that values can be changed,
|
|
82
|
+
# but structural changes (adding new fields, etc.) are not allowed. Structural changes
|
|
83
|
+
# should be made on {Client.configure}.
|
|
84
|
+
#
|
|
85
|
+
# See {::Google::Cloud::VideoIntelligence::V1beta2::VideoIntelligenceService::Rest::Client::Configuration}
|
|
86
|
+
# for a description of the configuration fields.
|
|
87
|
+
#
|
|
88
|
+
# @yield [config] Configure the Client client.
|
|
89
|
+
# @yieldparam config [Client::Configuration]
|
|
90
|
+
#
|
|
91
|
+
# @return [Client::Configuration]
|
|
92
|
+
#
|
|
93
|
+
def configure
|
|
94
|
+
yield @config if block_given?
|
|
95
|
+
@config
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
##
|
|
99
|
+
# Create a new VideoIntelligenceService REST client object.
|
|
100
|
+
#
|
|
101
|
+
# @example
|
|
102
|
+
#
|
|
103
|
+
# # Create a client using the default configuration
|
|
104
|
+
# client = ::Google::Cloud::VideoIntelligence::V1beta2::VideoIntelligenceService::Rest::Client.new
|
|
105
|
+
#
|
|
106
|
+
# # Create a client using a custom configuration
|
|
107
|
+
# client = ::Google::Cloud::VideoIntelligence::V1beta2::VideoIntelligenceService::Rest::Client.new do |config|
|
|
108
|
+
# config.timeout = 10.0
|
|
109
|
+
# end
|
|
110
|
+
#
|
|
111
|
+
# @yield [config] Configure the VideoIntelligenceService client.
|
|
112
|
+
# @yieldparam config [Client::Configuration]
|
|
113
|
+
#
|
|
114
|
+
def initialize
|
|
115
|
+
# Create the configuration object
|
|
116
|
+
@config = Configuration.new Client.configure
|
|
117
|
+
|
|
118
|
+
# Yield the configuration if needed
|
|
119
|
+
yield @config if block_given?
|
|
120
|
+
|
|
121
|
+
# Create credentials
|
|
122
|
+
credentials = @config.credentials
|
|
123
|
+
# Use self-signed JWT if the endpoint is unchanged from default,
|
|
124
|
+
# but only if the default endpoint does not have a region prefix.
|
|
125
|
+
enable_self_signed_jwt = @config.endpoint == Client.configure.endpoint &&
|
|
126
|
+
!@config.endpoint.split(".").first.include?("-")
|
|
127
|
+
credentials ||= Credentials.default scope: @config.scope,
|
|
128
|
+
enable_self_signed_jwt: enable_self_signed_jwt
|
|
129
|
+
if credentials.is_a?(::String) || credentials.is_a?(::Hash)
|
|
130
|
+
credentials = Credentials.new credentials, scope: @config.scope
|
|
131
|
+
end
|
|
132
|
+
|
|
133
|
+
@quota_project_id = @config.quota_project
|
|
134
|
+
@quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
|
|
135
|
+
|
|
136
|
+
@operations_client = ::Google::Cloud::VideoIntelligence::V1beta2::VideoIntelligenceService::Rest::Operations.new do |config|
|
|
137
|
+
config.credentials = credentials
|
|
138
|
+
config.quota_project = @quota_project_id
|
|
139
|
+
config.endpoint = @config.endpoint
|
|
140
|
+
end
|
|
141
|
+
|
|
142
|
+
@video_intelligence_service_stub = ::Google::Cloud::VideoIntelligence::V1beta2::VideoIntelligenceService::Rest::ServiceStub.new endpoint: @config.endpoint, credentials: credentials
|
|
143
|
+
end
|
|
144
|
+
|
|
145
|
+
##
|
|
146
|
+
# Get the associated client for long-running operations.
|
|
147
|
+
#
|
|
148
|
+
# @return [::Google::Cloud::VideoIntelligence::V1beta2::VideoIntelligenceService::Rest::Operations]
|
|
149
|
+
#
|
|
150
|
+
attr_reader :operations_client
|
|
151
|
+
|
|
152
|
+
# Service calls
|
|
153
|
+
|
|
154
|
+
##
|
|
155
|
+
# Performs asynchronous video annotation. Progress and results can be
|
|
156
|
+
# retrieved through the `google.longrunning.Operations` interface.
|
|
157
|
+
# `Operation.metadata` contains `AnnotateVideoProgress` (progress).
|
|
158
|
+
# `Operation.response` contains `AnnotateVideoResponse` (results).
|
|
159
|
+
#
|
|
160
|
+
# @overload annotate_video(request, options = nil)
|
|
161
|
+
# Pass arguments to `annotate_video` via a request object, either of type
|
|
162
|
+
# {::Google::Cloud::VideoIntelligence::V1beta2::AnnotateVideoRequest} or an equivalent Hash.
|
|
163
|
+
#
|
|
164
|
+
# @param request [::Google::Cloud::VideoIntelligence::V1beta2::AnnotateVideoRequest, ::Hash]
|
|
165
|
+
# A request object representing the call parameters. Required. To specify no
|
|
166
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
|
167
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
|
168
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
|
169
|
+
#
|
|
170
|
+
# @overload annotate_video(input_uri: nil, input_content: nil, features: nil, video_context: nil, output_uri: nil, location_id: nil)
|
|
171
|
+
# Pass arguments to `annotate_video` via keyword arguments. Note that at
|
|
172
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
|
173
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
|
174
|
+
#
|
|
175
|
+
# @param input_uri [::String]
|
|
176
|
+
# Input video location. Currently, only
|
|
177
|
+
# [Google Cloud Storage](https://cloud.google.com/storage/) URIs are
|
|
178
|
+
# supported, which must be specified in the following format:
|
|
179
|
+
# `gs://bucket-id/object-id` (other URI formats return
|
|
180
|
+
# [google.rpc.Code.INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT]). For
|
|
181
|
+
# more information, see [Request
|
|
182
|
+
# URIs](https://cloud.google.com/storage/docs/request-endpoints). A video URI
|
|
183
|
+
# may include wildcards in `object-id`, and thus identify multiple videos.
|
|
184
|
+
# Supported wildcards: '*' to match 0 or more characters;
|
|
185
|
+
# '?' to match 1 character. If unset, the input video should be embedded
|
|
186
|
+
# in the request as `input_content`. If set, `input_content` should be unset.
|
|
187
|
+
# @param input_content [::String]
|
|
188
|
+
# The video data bytes.
|
|
189
|
+
# If unset, the input video(s) should be specified via `input_uri`.
|
|
190
|
+
# If set, `input_uri` should be unset.
|
|
191
|
+
# @param features [::Array<::Google::Cloud::VideoIntelligence::V1beta2::Feature>]
|
|
192
|
+
# Required. Requested video annotation features.
|
|
193
|
+
# @param video_context [::Google::Cloud::VideoIntelligence::V1beta2::VideoContext, ::Hash]
|
|
194
|
+
# Additional video context and/or feature-specific parameters.
|
|
195
|
+
# @param output_uri [::String]
|
|
196
|
+
# Optional. Location where the output (in JSON format) should be stored.
|
|
197
|
+
# Currently, only [Google Cloud Storage](https://cloud.google.com/storage/)
|
|
198
|
+
# URIs are supported, which must be specified in the following format:
|
|
199
|
+
# `gs://bucket-id/object-id` (other URI formats return
|
|
200
|
+
# [google.rpc.Code.INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT]). For
|
|
201
|
+
# more information, see [Request
|
|
202
|
+
# URIs](https://cloud.google.com/storage/docs/request-endpoints).
|
|
203
|
+
# @param location_id [::String]
|
|
204
|
+
# Optional. Cloud region where annotation should take place. Supported cloud
|
|
205
|
+
# regions: `us-east1`, `us-west1`, `europe-west1`, `asia-east1`. If no region
|
|
206
|
+
# is specified, a region will be determined based on video file location.
|
|
207
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
|
208
|
+
# @yieldparam result [::Gapic::Operation]
|
|
209
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
|
210
|
+
#
|
|
211
|
+
# @return [::Gapic::Operation]
|
|
212
|
+
#
|
|
213
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
|
214
|
+
def annotate_video request, options = nil
|
|
215
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
|
216
|
+
|
|
217
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::VideoIntelligence::V1beta2::AnnotateVideoRequest
|
|
218
|
+
|
|
219
|
+
# Converts hash and nil to an options object
|
|
220
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
|
221
|
+
|
|
222
|
+
# Customize the options with defaults
|
|
223
|
+
call_metadata = @config.rpcs.annotate_video.metadata.to_h
|
|
224
|
+
|
|
225
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
|
226
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
|
227
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
|
228
|
+
gapic_version: ::Google::Cloud::VideoIntelligence::V1beta2::VERSION,
|
|
229
|
+
transports_version_send: [:rest]
|
|
230
|
+
|
|
231
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
|
232
|
+
|
|
233
|
+
options.apply_defaults timeout: @config.rpcs.annotate_video.timeout,
|
|
234
|
+
metadata: call_metadata,
|
|
235
|
+
retry_policy: @config.rpcs.annotate_video.retry_policy
|
|
236
|
+
|
|
237
|
+
options.apply_defaults timeout: @config.timeout,
|
|
238
|
+
metadata: @config.metadata,
|
|
239
|
+
retry_policy: @config.retry_policy
|
|
240
|
+
|
|
241
|
+
@video_intelligence_service_stub.annotate_video request, options do |result, operation|
|
|
242
|
+
result = ::Gapic::Operation.new result, @operations_client, options: options
|
|
243
|
+
yield result, operation if block_given?
|
|
244
|
+
return result
|
|
245
|
+
end
|
|
246
|
+
rescue ::Gapic::Rest::Error => e
|
|
247
|
+
raise ::Google::Cloud::Error.from_error(e)
|
|
248
|
+
end
|
|
249
|
+
|
|
250
|
+
##
|
|
251
|
+
# Configuration class for the VideoIntelligenceService REST API.
|
|
252
|
+
#
|
|
253
|
+
# This class represents the configuration for VideoIntelligenceService REST,
|
|
254
|
+
# providing control over timeouts, retry behavior, logging, transport
|
|
255
|
+
# parameters, and other low-level controls. Certain parameters can also be
|
|
256
|
+
# applied individually to specific RPCs. See
|
|
257
|
+
# {::Google::Cloud::VideoIntelligence::V1beta2::VideoIntelligenceService::Rest::Client::Configuration::Rpcs}
|
|
258
|
+
# for a list of RPCs that can be configured independently.
|
|
259
|
+
#
|
|
260
|
+
# Configuration can be applied globally to all clients, or to a single client
|
|
261
|
+
# on construction.
|
|
262
|
+
#
|
|
263
|
+
# @example
|
|
264
|
+
#
|
|
265
|
+
# # Modify the global config, setting the timeout for
|
|
266
|
+
# # annotate_video to 20 seconds,
|
|
267
|
+
# # and all remaining timeouts to 10 seconds.
|
|
268
|
+
# ::Google::Cloud::VideoIntelligence::V1beta2::VideoIntelligenceService::Rest::Client.configure do |config|
|
|
269
|
+
# config.timeout = 10.0
|
|
270
|
+
# config.rpcs.annotate_video.timeout = 20.0
|
|
271
|
+
# end
|
|
272
|
+
#
|
|
273
|
+
# # Apply the above configuration only to a new client.
|
|
274
|
+
# client = ::Google::Cloud::VideoIntelligence::V1beta2::VideoIntelligenceService::Rest::Client.new do |config|
|
|
275
|
+
# config.timeout = 10.0
|
|
276
|
+
# config.rpcs.annotate_video.timeout = 20.0
|
|
277
|
+
# end
|
|
278
|
+
#
|
|
279
|
+
# @!attribute [rw] endpoint
|
|
280
|
+
# The hostname or hostname:port of the service endpoint.
|
|
281
|
+
# Defaults to `"videointelligence.googleapis.com"`.
|
|
282
|
+
# @return [::String]
|
|
283
|
+
# @!attribute [rw] credentials
|
|
284
|
+
# Credentials to send with calls. You may provide any of the following types:
|
|
285
|
+
# * (`String`) The path to a service account key file in JSON format
|
|
286
|
+
# * (`Hash`) A service account key as a Hash
|
|
287
|
+
# * (`Google::Auth::Credentials`) A googleauth credentials object
|
|
288
|
+
# (see the [googleauth docs](https://googleapis.dev/ruby/googleauth/latest/index.html))
|
|
289
|
+
# * (`Signet::OAuth2::Client`) A signet oauth2 client object
|
|
290
|
+
# (see the [signet docs](https://googleapis.dev/ruby/signet/latest/Signet/OAuth2/Client.html))
|
|
291
|
+
# * (`nil`) indicating no credentials
|
|
292
|
+
# @return [::Object]
|
|
293
|
+
# @!attribute [rw] scope
|
|
294
|
+
# The OAuth scopes
|
|
295
|
+
# @return [::Array<::String>]
|
|
296
|
+
# @!attribute [rw] lib_name
|
|
297
|
+
# The library name as recorded in instrumentation and logging
|
|
298
|
+
# @return [::String]
|
|
299
|
+
# @!attribute [rw] lib_version
|
|
300
|
+
# The library version as recorded in instrumentation and logging
|
|
301
|
+
# @return [::String]
|
|
302
|
+
# @!attribute [rw] timeout
|
|
303
|
+
# The call timeout in seconds.
|
|
304
|
+
# @return [::Numeric]
|
|
305
|
+
# @!attribute [rw] metadata
|
|
306
|
+
# Additional headers to be sent with the call.
|
|
307
|
+
# @return [::Hash{::Symbol=>::String}]
|
|
308
|
+
# @!attribute [rw] retry_policy
|
|
309
|
+
# The retry policy. The value is a hash with the following keys:
|
|
310
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
|
311
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
|
312
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
|
313
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
|
314
|
+
# trigger a retry.
|
|
315
|
+
# @return [::Hash]
|
|
316
|
+
# @!attribute [rw] quota_project
|
|
317
|
+
# A separate project against which to charge quota.
|
|
318
|
+
# @return [::String]
|
|
319
|
+
#
|
|
320
|
+
class Configuration
|
|
321
|
+
extend ::Gapic::Config
|
|
322
|
+
|
|
323
|
+
config_attr :endpoint, "videointelligence.googleapis.com", ::String
|
|
324
|
+
config_attr :credentials, nil do |value|
|
|
325
|
+
allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
|
|
326
|
+
allowed.any? { |klass| klass === value }
|
|
327
|
+
end
|
|
328
|
+
config_attr :scope, nil, ::String, ::Array, nil
|
|
329
|
+
config_attr :lib_name, nil, ::String, nil
|
|
330
|
+
config_attr :lib_version, nil, ::String, nil
|
|
331
|
+
config_attr :timeout, nil, ::Numeric, nil
|
|
332
|
+
config_attr :metadata, nil, ::Hash, nil
|
|
333
|
+
config_attr :retry_policy, nil, ::Hash, ::Proc, nil
|
|
334
|
+
config_attr :quota_project, nil, ::String, nil
|
|
335
|
+
|
|
336
|
+
# @private
|
|
337
|
+
def initialize parent_config = nil
|
|
338
|
+
@parent_config = parent_config unless parent_config.nil?
|
|
339
|
+
|
|
340
|
+
yield self if block_given?
|
|
341
|
+
end
|
|
342
|
+
|
|
343
|
+
##
|
|
344
|
+
# Configurations for individual RPCs
|
|
345
|
+
# @return [Rpcs]
|
|
346
|
+
#
|
|
347
|
+
def rpcs
|
|
348
|
+
@rpcs ||= begin
|
|
349
|
+
parent_rpcs = nil
|
|
350
|
+
parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
|
|
351
|
+
Rpcs.new parent_rpcs
|
|
352
|
+
end
|
|
353
|
+
end
|
|
354
|
+
|
|
355
|
+
##
|
|
356
|
+
# Configuration RPC class for the VideoIntelligenceService API.
|
|
357
|
+
#
|
|
358
|
+
# Includes fields providing the configuration for each RPC in this service.
|
|
359
|
+
# Each configuration object is of type `Gapic::Config::Method` and includes
|
|
360
|
+
# the following configuration fields:
|
|
361
|
+
#
|
|
362
|
+
# * `timeout` (*type:* `Numeric`) - The call timeout in seconds
|
|
363
|
+
# * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers
|
|
364
|
+
# * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
|
|
365
|
+
# include the following keys:
|
|
366
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
|
367
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
|
368
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
|
369
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
|
370
|
+
# trigger a retry.
|
|
371
|
+
#
|
|
372
|
+
class Rpcs
|
|
373
|
+
##
|
|
374
|
+
# RPC-specific configuration for `annotate_video`
|
|
375
|
+
# @return [::Gapic::Config::Method]
|
|
376
|
+
#
|
|
377
|
+
attr_reader :annotate_video
|
|
378
|
+
|
|
379
|
+
# @private
|
|
380
|
+
def initialize parent_rpcs = nil
|
|
381
|
+
annotate_video_config = parent_rpcs.annotate_video if parent_rpcs.respond_to? :annotate_video
|
|
382
|
+
@annotate_video = ::Gapic::Config::Method.new annotate_video_config
|
|
383
|
+
|
|
384
|
+
yield self if block_given?
|
|
385
|
+
end
|
|
386
|
+
end
|
|
387
|
+
end
|
|
388
|
+
end
|
|
389
|
+
end
|
|
390
|
+
end
|
|
391
|
+
end
|
|
392
|
+
end
|
|
393
|
+
end
|
|
394
|
+
end
|