google-cloud-video_intelligence-v1p3beta1 0.1.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.
Files changed (28) hide show
  1. checksums.yaml +7 -0
  2. data/.yardopts +12 -0
  3. data/AUTHENTICATION.md +169 -0
  4. data/LICENSE.md +201 -0
  5. data/README.md +139 -0
  6. data/lib/google/cloud/video_intelligence/v1p3beta1/streaming_video_intelligence_service/client.rb +361 -0
  7. data/lib/google/cloud/video_intelligence/v1p3beta1/streaming_video_intelligence_service/credentials.rb +51 -0
  8. data/lib/google/cloud/video_intelligence/v1p3beta1/streaming_video_intelligence_service.rb +48 -0
  9. data/lib/google/cloud/video_intelligence/v1p3beta1/version.rb +28 -0
  10. data/lib/google/cloud/video_intelligence/v1p3beta1/video_intelligence_service/client.rb +414 -0
  11. data/lib/google/cloud/video_intelligence/v1p3beta1/video_intelligence_service/credentials.rb +51 -0
  12. data/lib/google/cloud/video_intelligence/v1p3beta1/video_intelligence_service/operations.rb +664 -0
  13. data/lib/google/cloud/video_intelligence/v1p3beta1/video_intelligence_service.rb +49 -0
  14. data/lib/google/cloud/video_intelligence/v1p3beta1.rb +39 -0
  15. data/lib/google/cloud/videointelligence/v1p3beta1/video_intelligence_pb.rb +405 -0
  16. data/lib/google/cloud/videointelligence/v1p3beta1/video_intelligence_services_pb.rb +66 -0
  17. data/lib/google-cloud-video_intelligence-v1p3beta1.rb +21 -0
  18. data/proto_docs/README.md +4 -0
  19. data/proto_docs/google/api/field_behavior.rb +71 -0
  20. data/proto_docs/google/api/resource.rb +283 -0
  21. data/proto_docs/google/cloud/videointelligence/v1p3beta1/video_intelligence.rb +1196 -0
  22. data/proto_docs/google/longrunning/operations.rb +164 -0
  23. data/proto_docs/google/protobuf/any.rb +141 -0
  24. data/proto_docs/google/protobuf/duration.rb +98 -0
  25. data/proto_docs/google/protobuf/empty.rb +36 -0
  26. data/proto_docs/google/protobuf/timestamp.rb +129 -0
  27. data/proto_docs/google/rpc/status.rb +46 -0
  28. metadata +219 -0
@@ -0,0 +1,414 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2021 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/v1p3beta1/video_intelligence_pb"
21
+
22
+ module Google
23
+ module Cloud
24
+ module VideoIntelligence
25
+ module V1p3beta1
26
+ module VideoIntelligenceService
27
+ ##
28
+ # Client for the VideoIntelligenceService service.
29
+ #
30
+ # Service that implements the Video Intelligence API.
31
+ #
32
+ class Client
33
+ # @private
34
+ attr_reader :video_intelligence_service_stub
35
+
36
+ ##
37
+ # Configure the VideoIntelligenceService Client class.
38
+ #
39
+ # See {::Google::Cloud::VideoIntelligence::V1p3beta1::VideoIntelligenceService::Client::Configuration}
40
+ # for a description of the configuration fields.
41
+ #
42
+ # @example
43
+ #
44
+ # # Modify the configuration for all VideoIntelligenceService clients
45
+ # ::Google::Cloud::VideoIntelligence::V1p3beta1::VideoIntelligenceService::Client.configure do |config|
46
+ # config.timeout = 10.0
47
+ # end
48
+ #
49
+ # @yield [config] Configure the Client client.
50
+ # @yieldparam config [Client::Configuration]
51
+ #
52
+ # @return [Client::Configuration]
53
+ #
54
+ def self.configure
55
+ @configure ||= begin
56
+ namespace = ["Google", "Cloud", "VideoIntelligence", "V1p3beta1"]
57
+ parent_config = while namespace.any?
58
+ parent_name = namespace.join "::"
59
+ parent_const = const_get parent_name
60
+ break parent_const.configure if parent_const.respond_to? :configure
61
+ namespace.pop
62
+ end
63
+ default_config = Client::Configuration.new parent_config
64
+
65
+ default_config.rpcs.annotate_video.timeout = 600.0
66
+ default_config.rpcs.annotate_video.retry_policy = {
67
+ initial_delay: 1.0, max_delay: 120.0, multiplier: 2.5, retry_codes: [14, 4]
68
+ }
69
+
70
+ default_config
71
+ end
72
+ yield @configure if block_given?
73
+ @configure
74
+ end
75
+
76
+ ##
77
+ # Configure the VideoIntelligenceService Client instance.
78
+ #
79
+ # The configuration is set to the derived mode, meaning that values can be changed,
80
+ # but structural changes (adding new fields, etc.) are not allowed. Structural changes
81
+ # should be made on {Client.configure}.
82
+ #
83
+ # See {::Google::Cloud::VideoIntelligence::V1p3beta1::VideoIntelligenceService::Client::Configuration}
84
+ # for a description of the configuration fields.
85
+ #
86
+ # @yield [config] Configure the Client client.
87
+ # @yieldparam config [Client::Configuration]
88
+ #
89
+ # @return [Client::Configuration]
90
+ #
91
+ def configure
92
+ yield @config if block_given?
93
+ @config
94
+ end
95
+
96
+ ##
97
+ # Create a new VideoIntelligenceService client object.
98
+ #
99
+ # @example
100
+ #
101
+ # # Create a client using the default configuration
102
+ # client = ::Google::Cloud::VideoIntelligence::V1p3beta1::VideoIntelligenceService::Client.new
103
+ #
104
+ # # Create a client using a custom configuration
105
+ # client = ::Google::Cloud::VideoIntelligence::V1p3beta1::VideoIntelligenceService::Client.new do |config|
106
+ # config.timeout = 10.0
107
+ # end
108
+ #
109
+ # @yield [config] Configure the VideoIntelligenceService client.
110
+ # @yieldparam config [Client::Configuration]
111
+ #
112
+ def initialize
113
+ # These require statements are intentionally placed here to initialize
114
+ # the gRPC module only when it's required.
115
+ # See https://github.com/googleapis/toolkit/issues/446
116
+ require "gapic/grpc"
117
+ require "google/cloud/videointelligence/v1p3beta1/video_intelligence_services_pb"
118
+
119
+ # Create the configuration object
120
+ @config = Configuration.new Client.configure
121
+
122
+ # Yield the configuration if needed
123
+ yield @config if block_given?
124
+
125
+ # Create credentials
126
+ credentials = @config.credentials
127
+ # Use self-signed JWT if the endpoint is unchanged from default,
128
+ # but only if the default endpoint does not have a region prefix.
129
+ enable_self_signed_jwt = @config.endpoint == Client.configure.endpoint &&
130
+ !@config.endpoint.split(".").first.include?("-")
131
+ credentials ||= Credentials.default scope: @config.scope,
132
+ enable_self_signed_jwt: enable_self_signed_jwt
133
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
134
+ credentials = Credentials.new credentials, scope: @config.scope
135
+ end
136
+ @quota_project_id = @config.quota_project
137
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
138
+
139
+ @operations_client = Operations.new do |config|
140
+ config.credentials = credentials
141
+ config.endpoint = @config.endpoint
142
+ end
143
+
144
+ @video_intelligence_service_stub = ::Gapic::ServiceStub.new(
145
+ ::Google::Cloud::VideoIntelligence::V1p3beta1::VideoIntelligenceService::Stub,
146
+ credentials: credentials,
147
+ endpoint: @config.endpoint,
148
+ channel_args: @config.channel_args,
149
+ interceptors: @config.interceptors
150
+ )
151
+ end
152
+
153
+ ##
154
+ # Get the associated client for long-running operations.
155
+ #
156
+ # @return [::Google::Cloud::VideoIntelligence::V1p3beta1::VideoIntelligenceService::Operations]
157
+ #
158
+ attr_reader :operations_client
159
+
160
+ # Service calls
161
+
162
+ ##
163
+ # Performs asynchronous video annotation. Progress and results can be
164
+ # retrieved through the `google.longrunning.Operations` interface.
165
+ # `Operation.metadata` contains `AnnotateVideoProgress` (progress).
166
+ # `Operation.response` contains `AnnotateVideoResponse` (results).
167
+ #
168
+ # @overload annotate_video(request, options = nil)
169
+ # Pass arguments to `annotate_video` via a request object, either of type
170
+ # {::Google::Cloud::VideoIntelligence::V1p3beta1::AnnotateVideoRequest} or an equivalent Hash.
171
+ #
172
+ # @param request [::Google::Cloud::VideoIntelligence::V1p3beta1::AnnotateVideoRequest, ::Hash]
173
+ # A request object representing the call parameters. Required. To specify no
174
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
175
+ # @param options [::Gapic::CallOptions, ::Hash]
176
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
177
+ #
178
+ # @overload annotate_video(input_uri: nil, input_content: nil, features: nil, video_context: nil, output_uri: nil, location_id: nil)
179
+ # Pass arguments to `annotate_video` via keyword arguments. Note that at
180
+ # least one keyword argument is required. To specify no parameters, or to keep all
181
+ # the default parameter values, pass an empty Hash as a request object (see above).
182
+ #
183
+ # @param input_uri [::String]
184
+ # Input video location. Currently, only
185
+ # [Cloud Storage](https://cloud.google.com/storage/) URIs are
186
+ # supported. URIs must be specified in the following format:
187
+ # `gs://bucket-id/object-id` (other URI formats return
188
+ # [google.rpc.Code.INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT]). For
189
+ # more information, see [Request
190
+ # URIs](https://cloud.google.com/storage/docs/request-endpoints). To identify
191
+ # multiple videos, a video URI may include wildcards in the `object-id`.
192
+ # Supported wildcards: '*' to match 0 or more characters;
193
+ # '?' to match 1 character. If unset, the input video should be embedded
194
+ # in the request as `input_content`. If set, `input_content` must be unset.
195
+ # @param input_content [::String]
196
+ # The video data bytes.
197
+ # If unset, the input video(s) should be specified via the `input_uri`.
198
+ # If set, `input_uri` must be unset.
199
+ # @param features [::Array<::Google::Cloud::VideoIntelligence::V1p3beta1::Feature>]
200
+ # Required. Requested video annotation features.
201
+ # @param video_context [::Google::Cloud::VideoIntelligence::V1p3beta1::VideoContext, ::Hash]
202
+ # Additional video context and/or feature-specific parameters.
203
+ # @param output_uri [::String]
204
+ # Optional. Location where the output (in JSON format) should be stored.
205
+ # Currently, only [Cloud Storage](https://cloud.google.com/storage/)
206
+ # URIs are supported. These must be specified in the following format:
207
+ # `gs://bucket-id/object-id` (other URI formats return
208
+ # [google.rpc.Code.INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT]). For
209
+ # more information, see [Request
210
+ # URIs](https://cloud.google.com/storage/docs/request-endpoints).
211
+ # @param location_id [::String]
212
+ # Optional. Cloud region where annotation should take place. Supported cloud
213
+ # regions are: `us-east1`, `us-west1`, `europe-west1`, `asia-east1`. If no
214
+ # region is specified, the region will be determined based on video file
215
+ # location.
216
+ #
217
+ # @yield [response, operation] Access the result along with the RPC operation
218
+ # @yieldparam response [::Gapic::Operation]
219
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
220
+ #
221
+ # @return [::Gapic::Operation]
222
+ #
223
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
224
+ #
225
+ def annotate_video request, options = nil
226
+ raise ::ArgumentError, "request must be provided" if request.nil?
227
+
228
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::VideoIntelligence::V1p3beta1::AnnotateVideoRequest
229
+
230
+ # Converts hash and nil to an options object
231
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
232
+
233
+ # Customize the options with defaults
234
+ metadata = @config.rpcs.annotate_video.metadata.to_h
235
+
236
+ # Set x-goog-api-client and x-goog-user-project headers
237
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
238
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
239
+ gapic_version: ::Google::Cloud::VideoIntelligence::V1p3beta1::VERSION
240
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
241
+
242
+ options.apply_defaults timeout: @config.rpcs.annotate_video.timeout,
243
+ metadata: metadata,
244
+ retry_policy: @config.rpcs.annotate_video.retry_policy
245
+
246
+ options.apply_defaults timeout: @config.timeout,
247
+ metadata: @config.metadata,
248
+ retry_policy: @config.retry_policy
249
+
250
+ @video_intelligence_service_stub.call_rpc :annotate_video, request, options: options do |response, operation|
251
+ response = ::Gapic::Operation.new response, @operations_client, options: options
252
+ yield response, operation if block_given?
253
+ return response
254
+ end
255
+ rescue ::GRPC::BadStatus => e
256
+ raise ::Google::Cloud::Error.from_error(e)
257
+ end
258
+
259
+ ##
260
+ # Configuration class for the VideoIntelligenceService API.
261
+ #
262
+ # This class represents the configuration for VideoIntelligenceService,
263
+ # providing control over timeouts, retry behavior, logging, transport
264
+ # parameters, and other low-level controls. Certain parameters can also be
265
+ # applied individually to specific RPCs. See
266
+ # {::Google::Cloud::VideoIntelligence::V1p3beta1::VideoIntelligenceService::Client::Configuration::Rpcs}
267
+ # for a list of RPCs that can be configured independently.
268
+ #
269
+ # Configuration can be applied globally to all clients, or to a single client
270
+ # on construction.
271
+ #
272
+ # @example
273
+ #
274
+ # # Modify the global config, setting the timeout for
275
+ # # annotate_video to 20 seconds,
276
+ # # and all remaining timeouts to 10 seconds.
277
+ # ::Google::Cloud::VideoIntelligence::V1p3beta1::VideoIntelligenceService::Client.configure do |config|
278
+ # config.timeout = 10.0
279
+ # config.rpcs.annotate_video.timeout = 20.0
280
+ # end
281
+ #
282
+ # # Apply the above configuration only to a new client.
283
+ # client = ::Google::Cloud::VideoIntelligence::V1p3beta1::VideoIntelligenceService::Client.new do |config|
284
+ # config.timeout = 10.0
285
+ # config.rpcs.annotate_video.timeout = 20.0
286
+ # end
287
+ #
288
+ # @!attribute [rw] endpoint
289
+ # The hostname or hostname:port of the service endpoint.
290
+ # Defaults to `"videointelligence.googleapis.com"`.
291
+ # @return [::String]
292
+ # @!attribute [rw] credentials
293
+ # Credentials to send with calls. You may provide any of the following types:
294
+ # * (`String`) The path to a service account key file in JSON format
295
+ # * (`Hash`) A service account key as a Hash
296
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
297
+ # (see the [googleauth docs](https://googleapis.dev/ruby/googleauth/latest/index.html))
298
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
299
+ # (see the [signet docs](https://googleapis.dev/ruby/signet/latest/Signet/OAuth2/Client.html))
300
+ # * (`GRPC::Core::Channel`) a gRPC channel with included credentials
301
+ # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
302
+ # * (`nil`) indicating no credentials
303
+ # @return [::Object]
304
+ # @!attribute [rw] scope
305
+ # The OAuth scopes
306
+ # @return [::Array<::String>]
307
+ # @!attribute [rw] lib_name
308
+ # The library name as recorded in instrumentation and logging
309
+ # @return [::String]
310
+ # @!attribute [rw] lib_version
311
+ # The library version as recorded in instrumentation and logging
312
+ # @return [::String]
313
+ # @!attribute [rw] channel_args
314
+ # Extra parameters passed to the gRPC channel. Note: this is ignored if a
315
+ # `GRPC::Core::Channel` object is provided as the credential.
316
+ # @return [::Hash]
317
+ # @!attribute [rw] interceptors
318
+ # An array of interceptors that are run before calls are executed.
319
+ # @return [::Array<::GRPC::ClientInterceptor>]
320
+ # @!attribute [rw] timeout
321
+ # The call timeout in seconds.
322
+ # @return [::Numeric]
323
+ # @!attribute [rw] metadata
324
+ # Additional gRPC headers to be sent with the call.
325
+ # @return [::Hash{::Symbol=>::String}]
326
+ # @!attribute [rw] retry_policy
327
+ # The retry policy. The value is a hash with the following keys:
328
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
329
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
330
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
331
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
332
+ # trigger a retry.
333
+ # @return [::Hash]
334
+ # @!attribute [rw] quota_project
335
+ # A separate project against which to charge quota.
336
+ # @return [::String]
337
+ #
338
+ class Configuration
339
+ extend ::Gapic::Config
340
+
341
+ config_attr :endpoint, "videointelligence.googleapis.com", ::String
342
+ config_attr :credentials, nil do |value|
343
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
344
+ allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
345
+ allowed.any? { |klass| klass === value }
346
+ end
347
+ config_attr :scope, nil, ::String, ::Array, nil
348
+ config_attr :lib_name, nil, ::String, nil
349
+ config_attr :lib_version, nil, ::String, nil
350
+ config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
351
+ config_attr :interceptors, nil, ::Array, nil
352
+ config_attr :timeout, nil, ::Numeric, nil
353
+ config_attr :metadata, nil, ::Hash, nil
354
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
355
+ config_attr :quota_project, nil, ::String, nil
356
+
357
+ # @private
358
+ def initialize parent_config = nil
359
+ @parent_config = parent_config unless parent_config.nil?
360
+
361
+ yield self if block_given?
362
+ end
363
+
364
+ ##
365
+ # Configurations for individual RPCs
366
+ # @return [Rpcs]
367
+ #
368
+ def rpcs
369
+ @rpcs ||= begin
370
+ parent_rpcs = nil
371
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
372
+ Rpcs.new parent_rpcs
373
+ end
374
+ end
375
+
376
+ ##
377
+ # Configuration RPC class for the VideoIntelligenceService API.
378
+ #
379
+ # Includes fields providing the configuration for each RPC in this service.
380
+ # Each configuration object is of type `Gapic::Config::Method` and includes
381
+ # the following configuration fields:
382
+ #
383
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
384
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
385
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
386
+ # include the following keys:
387
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
388
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
389
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
390
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
391
+ # trigger a retry.
392
+ #
393
+ class Rpcs
394
+ ##
395
+ # RPC-specific configuration for `annotate_video`
396
+ # @return [::Gapic::Config::Method]
397
+ #
398
+ attr_reader :annotate_video
399
+
400
+ # @private
401
+ def initialize parent_rpcs = nil
402
+ annotate_video_config = parent_rpcs.annotate_video if parent_rpcs.respond_to? :annotate_video
403
+ @annotate_video = ::Gapic::Config::Method.new annotate_video_config
404
+
405
+ yield self if block_given?
406
+ end
407
+ end
408
+ end
409
+ end
410
+ end
411
+ end
412
+ end
413
+ end
414
+ end
@@ -0,0 +1,51 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2021 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 "googleauth"
20
+
21
+ module Google
22
+ module Cloud
23
+ module VideoIntelligence
24
+ module V1p3beta1
25
+ module VideoIntelligenceService
26
+ # Credentials for the VideoIntelligenceService API.
27
+ class Credentials < ::Google::Auth::Credentials
28
+ self.scope = [
29
+ "https://www.googleapis.com/auth/cloud-platform"
30
+ ]
31
+ self.env_vars = [
32
+ "VIDEO_INTELLIGENCE_CREDENTIALS",
33
+ "VIDEO_INTELLIGENCE_KEYFILE",
34
+ "GOOGLE_CLOUD_CREDENTIALS",
35
+ "GOOGLE_CLOUD_KEYFILE",
36
+ "GCLOUD_KEYFILE",
37
+ "VIDEO_INTELLIGENCE_CREDENTIALS_JSON",
38
+ "VIDEO_INTELLIGENCE_KEYFILE_JSON",
39
+ "GOOGLE_CLOUD_CREDENTIALS_JSON",
40
+ "GOOGLE_CLOUD_KEYFILE_JSON",
41
+ "GCLOUD_KEYFILE_JSON"
42
+ ]
43
+ self.paths = [
44
+ "~/.config/google_cloud/application_default_credentials.json"
45
+ ]
46
+ end
47
+ end
48
+ end
49
+ end
50
+ end
51
+ end