google-cloud-video-stitcher-v1 0.4.0 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,770 @@
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 "gapic/operation"
20
+ require "google/longrunning/operations_pb"
21
+
22
+ module Google
23
+ module Cloud
24
+ module Video
25
+ module Stitcher
26
+ module V1
27
+ module VideoStitcherService
28
+ # Service that implements Longrunning Operations API.
29
+ class Operations
30
+ # @private
31
+ attr_reader :operations_stub
32
+
33
+ ##
34
+ # Configuration for the VideoStitcherService Operations API.
35
+ #
36
+ # @yield [config] Configure the Operations client.
37
+ # @yieldparam config [Operations::Configuration]
38
+ #
39
+ # @return [Operations::Configuration]
40
+ #
41
+ def self.configure
42
+ @configure ||= Operations::Configuration.new
43
+ yield @configure if block_given?
44
+ @configure
45
+ end
46
+
47
+ ##
48
+ # Configure the VideoStitcherService Operations instance.
49
+ #
50
+ # The configuration is set to the derived mode, meaning that values can be changed,
51
+ # but structural changes (adding new fields, etc.) are not allowed. Structural changes
52
+ # should be made on {Operations.configure}.
53
+ #
54
+ # @yield [config] Configure the Operations client.
55
+ # @yieldparam config [Operations::Configuration]
56
+ #
57
+ # @return [Operations::Configuration]
58
+ #
59
+ def configure
60
+ yield @config if block_given?
61
+ @config
62
+ end
63
+
64
+ ##
65
+ # Create a new Operations client object.
66
+ #
67
+ # @yield [config] Configure the Client client.
68
+ # @yieldparam config [Operations::Configuration]
69
+ #
70
+ def initialize
71
+ # These require statements are intentionally placed here to initialize
72
+ # the gRPC module only when it's required.
73
+ # See https://github.com/googleapis/toolkit/issues/446
74
+ require "gapic/grpc"
75
+ require "google/longrunning/operations_services_pb"
76
+
77
+ # Create the configuration object
78
+ @config = Configuration.new Operations.configure
79
+
80
+ # Yield the configuration if needed
81
+ yield @config if block_given?
82
+
83
+ # Create credentials
84
+ credentials = @config.credentials
85
+ credentials ||= Credentials.default scope: @config.scope
86
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
87
+ credentials = Credentials.new credentials, scope: @config.scope
88
+ end
89
+ @quota_project_id = @config.quota_project
90
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
91
+
92
+ @operations_stub = ::Gapic::ServiceStub.new(
93
+ ::Google::Longrunning::Operations::Stub,
94
+ credentials: credentials,
95
+ endpoint: @config.endpoint,
96
+ channel_args: @config.channel_args,
97
+ interceptors: @config.interceptors
98
+ )
99
+
100
+ # Used by an LRO wrapper for some methods of this service
101
+ @operations_client = self
102
+ end
103
+
104
+ # Service calls
105
+
106
+ ##
107
+ # Lists operations that match the specified filter in the request. If the
108
+ # server doesn't support this method, it returns `UNIMPLEMENTED`.
109
+ #
110
+ # NOTE: the `name` binding allows API services to override the binding
111
+ # to use different resource name schemes, such as `users/*/operations`. To
112
+ # override the binding, API services can add a binding such as
113
+ # `"/v1/{name=users/*}/operations"` to their service configuration.
114
+ # For backwards compatibility, the default name includes the operations
115
+ # collection id, however overriding users must ensure the name binding
116
+ # is the parent resource, without the operations collection id.
117
+ #
118
+ # @overload list_operations(request, options = nil)
119
+ # Pass arguments to `list_operations` via a request object, either of type
120
+ # {::Google::Longrunning::ListOperationsRequest} or an equivalent Hash.
121
+ #
122
+ # @param request [::Google::Longrunning::ListOperationsRequest, ::Hash]
123
+ # A request object representing the call parameters. Required. To specify no
124
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
125
+ # @param options [::Gapic::CallOptions, ::Hash]
126
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
127
+ #
128
+ # @overload list_operations(name: nil, filter: nil, page_size: nil, page_token: nil)
129
+ # Pass arguments to `list_operations` via keyword arguments. Note that at
130
+ # least one keyword argument is required. To specify no parameters, or to keep all
131
+ # the default parameter values, pass an empty Hash as a request object (see above).
132
+ #
133
+ # @param name [::String]
134
+ # The name of the operation's parent resource.
135
+ # @param filter [::String]
136
+ # The standard list filter.
137
+ # @param page_size [::Integer]
138
+ # The standard list page size.
139
+ # @param page_token [::String]
140
+ # The standard list page token.
141
+ #
142
+ # @yield [response, operation] Access the result along with the RPC operation
143
+ # @yieldparam response [::Gapic::PagedEnumerable<::Gapic::Operation>]
144
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
145
+ #
146
+ # @return [::Gapic::PagedEnumerable<::Gapic::Operation>]
147
+ #
148
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
149
+ #
150
+ # @example Basic example
151
+ # require "google/longrunning"
152
+ #
153
+ # # Create a client object. The client can be reused for multiple calls.
154
+ # client = Google::Longrunning::Operations::Client.new
155
+ #
156
+ # # Create a request. To set request fields, pass in keyword arguments.
157
+ # request = Google::Longrunning::ListOperationsRequest.new
158
+ #
159
+ # # Call the list_operations method.
160
+ # result = client.list_operations request
161
+ #
162
+ # # The returned object is of type Gapic::PagedEnumerable. You can iterate
163
+ # # over elements, and API calls will be issued to fetch pages as needed.
164
+ # result.each do |item|
165
+ # # Each element is of type ::Google::Longrunning::Operation.
166
+ # p item
167
+ # end
168
+ #
169
+ def list_operations request, options = nil
170
+ raise ::ArgumentError, "request must be provided" if request.nil?
171
+
172
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::ListOperationsRequest
173
+
174
+ # Converts hash and nil to an options object
175
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
176
+
177
+ # Customize the options with defaults
178
+ metadata = @config.rpcs.list_operations.metadata.to_h
179
+
180
+ # Set x-goog-api-client and x-goog-user-project headers
181
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
182
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
183
+ gapic_version: ::Google::Cloud::Video::Stitcher::V1::VERSION
184
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
185
+
186
+ header_params = {}
187
+ if request.name
188
+ header_params["name"] = request.name
189
+ end
190
+
191
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
192
+ metadata[:"x-goog-request-params"] ||= request_params_header
193
+
194
+ options.apply_defaults timeout: @config.rpcs.list_operations.timeout,
195
+ metadata: metadata,
196
+ retry_policy: @config.rpcs.list_operations.retry_policy
197
+
198
+ options.apply_defaults timeout: @config.timeout,
199
+ metadata: @config.metadata,
200
+ retry_policy: @config.retry_policy
201
+
202
+ @operations_stub.call_rpc :list_operations, request, options: options do |response, operation|
203
+ wrap_lro_operation = ->(op_response) { ::Gapic::Operation.new op_response, @operations_client }
204
+ response = ::Gapic::PagedEnumerable.new @operations_stub, :list_operations, request, response, operation, options, format_resource: wrap_lro_operation
205
+ yield response, operation if block_given?
206
+ return response
207
+ end
208
+ rescue ::GRPC::BadStatus => e
209
+ raise ::Google::Cloud::Error.from_error(e)
210
+ end
211
+
212
+ ##
213
+ # Gets the latest state of a long-running operation. Clients can use this
214
+ # method to poll the operation result at intervals as recommended by the API
215
+ # service.
216
+ #
217
+ # @overload get_operation(request, options = nil)
218
+ # Pass arguments to `get_operation` via a request object, either of type
219
+ # {::Google::Longrunning::GetOperationRequest} or an equivalent Hash.
220
+ #
221
+ # @param request [::Google::Longrunning::GetOperationRequest, ::Hash]
222
+ # A request object representing the call parameters. Required. To specify no
223
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
224
+ # @param options [::Gapic::CallOptions, ::Hash]
225
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
226
+ #
227
+ # @overload get_operation(name: nil)
228
+ # Pass arguments to `get_operation` via keyword arguments. Note that at
229
+ # least one keyword argument is required. To specify no parameters, or to keep all
230
+ # the default parameter values, pass an empty Hash as a request object (see above).
231
+ #
232
+ # @param name [::String]
233
+ # The name of the operation resource.
234
+ #
235
+ # @yield [response, operation] Access the result along with the RPC operation
236
+ # @yieldparam response [::Gapic::Operation]
237
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
238
+ #
239
+ # @return [::Gapic::Operation]
240
+ #
241
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
242
+ #
243
+ # @example Basic example
244
+ # require "google/longrunning"
245
+ #
246
+ # # Create a client object. The client can be reused for multiple calls.
247
+ # client = Google::Longrunning::Operations::Client.new
248
+ #
249
+ # # Create a request. To set request fields, pass in keyword arguments.
250
+ # request = Google::Longrunning::GetOperationRequest.new
251
+ #
252
+ # # Call the get_operation method.
253
+ # result = client.get_operation request
254
+ #
255
+ # # The returned object is of type Gapic::Operation. You can use it to
256
+ # # check the status of an operation, cancel it, or wait for results.
257
+ # # Here is how to wait for a response.
258
+ # result.wait_until_done! timeout: 60
259
+ # if result.response?
260
+ # p result.response
261
+ # else
262
+ # puts "No response received."
263
+ # end
264
+ #
265
+ def get_operation request, options = nil
266
+ raise ::ArgumentError, "request must be provided" if request.nil?
267
+
268
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::GetOperationRequest
269
+
270
+ # Converts hash and nil to an options object
271
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
272
+
273
+ # Customize the options with defaults
274
+ metadata = @config.rpcs.get_operation.metadata.to_h
275
+
276
+ # Set x-goog-api-client and x-goog-user-project headers
277
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
278
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
279
+ gapic_version: ::Google::Cloud::Video::Stitcher::V1::VERSION
280
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
281
+
282
+ header_params = {}
283
+ if request.name
284
+ header_params["name"] = request.name
285
+ end
286
+
287
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
288
+ metadata[:"x-goog-request-params"] ||= request_params_header
289
+
290
+ options.apply_defaults timeout: @config.rpcs.get_operation.timeout,
291
+ metadata: metadata,
292
+ retry_policy: @config.rpcs.get_operation.retry_policy
293
+
294
+ options.apply_defaults timeout: @config.timeout,
295
+ metadata: @config.metadata,
296
+ retry_policy: @config.retry_policy
297
+
298
+ @operations_stub.call_rpc :get_operation, request, options: options do |response, operation|
299
+ response = ::Gapic::Operation.new response, @operations_client, options: options
300
+ yield response, operation if block_given?
301
+ return response
302
+ end
303
+ rescue ::GRPC::BadStatus => e
304
+ raise ::Google::Cloud::Error.from_error(e)
305
+ end
306
+
307
+ ##
308
+ # Deletes a long-running operation. This method indicates that the client is
309
+ # no longer interested in the operation result. It does not cancel the
310
+ # operation. If the server doesn't support this method, it returns
311
+ # `google.rpc.Code.UNIMPLEMENTED`.
312
+ #
313
+ # @overload delete_operation(request, options = nil)
314
+ # Pass arguments to `delete_operation` via a request object, either of type
315
+ # {::Google::Longrunning::DeleteOperationRequest} or an equivalent Hash.
316
+ #
317
+ # @param request [::Google::Longrunning::DeleteOperationRequest, ::Hash]
318
+ # A request object representing the call parameters. Required. To specify no
319
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
320
+ # @param options [::Gapic::CallOptions, ::Hash]
321
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
322
+ #
323
+ # @overload delete_operation(name: nil)
324
+ # Pass arguments to `delete_operation` via keyword arguments. Note that at
325
+ # least one keyword argument is required. To specify no parameters, or to keep all
326
+ # the default parameter values, pass an empty Hash as a request object (see above).
327
+ #
328
+ # @param name [::String]
329
+ # The name of the operation resource to be deleted.
330
+ #
331
+ # @yield [response, operation] Access the result along with the RPC operation
332
+ # @yieldparam response [::Google::Protobuf::Empty]
333
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
334
+ #
335
+ # @return [::Google::Protobuf::Empty]
336
+ #
337
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
338
+ #
339
+ # @example Basic example
340
+ # require "google/longrunning"
341
+ #
342
+ # # Create a client object. The client can be reused for multiple calls.
343
+ # client = Google::Longrunning::Operations::Client.new
344
+ #
345
+ # # Create a request. To set request fields, pass in keyword arguments.
346
+ # request = Google::Longrunning::DeleteOperationRequest.new
347
+ #
348
+ # # Call the delete_operation method.
349
+ # result = client.delete_operation request
350
+ #
351
+ # # The returned object is of type Google::Protobuf::Empty.
352
+ # p result
353
+ #
354
+ def delete_operation request, options = nil
355
+ raise ::ArgumentError, "request must be provided" if request.nil?
356
+
357
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::DeleteOperationRequest
358
+
359
+ # Converts hash and nil to an options object
360
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
361
+
362
+ # Customize the options with defaults
363
+ metadata = @config.rpcs.delete_operation.metadata.to_h
364
+
365
+ # Set x-goog-api-client and x-goog-user-project headers
366
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
367
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
368
+ gapic_version: ::Google::Cloud::Video::Stitcher::V1::VERSION
369
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
370
+
371
+ header_params = {}
372
+ if request.name
373
+ header_params["name"] = request.name
374
+ end
375
+
376
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
377
+ metadata[:"x-goog-request-params"] ||= request_params_header
378
+
379
+ options.apply_defaults timeout: @config.rpcs.delete_operation.timeout,
380
+ metadata: metadata,
381
+ retry_policy: @config.rpcs.delete_operation.retry_policy
382
+
383
+ options.apply_defaults timeout: @config.timeout,
384
+ metadata: @config.metadata,
385
+ retry_policy: @config.retry_policy
386
+
387
+ @operations_stub.call_rpc :delete_operation, request, options: options do |response, operation|
388
+ yield response, operation if block_given?
389
+ return response
390
+ end
391
+ rescue ::GRPC::BadStatus => e
392
+ raise ::Google::Cloud::Error.from_error(e)
393
+ end
394
+
395
+ ##
396
+ # Starts asynchronous cancellation on a long-running operation. The server
397
+ # makes a best effort to cancel the operation, but success is not
398
+ # guaranteed. If the server doesn't support this method, it returns
399
+ # `google.rpc.Code.UNIMPLEMENTED`. Clients can use
400
+ # Operations.GetOperation or
401
+ # other methods to check whether the cancellation succeeded or whether the
402
+ # operation completed despite cancellation. On successful cancellation,
403
+ # the operation is not deleted; instead, it becomes an operation with
404
+ # an {::Google::Longrunning::Operation#error Operation.error} value with a {::Google::Rpc::Status#code google.rpc.Status.code} of 1,
405
+ # corresponding to `Code.CANCELLED`.
406
+ #
407
+ # @overload cancel_operation(request, options = nil)
408
+ # Pass arguments to `cancel_operation` via a request object, either of type
409
+ # {::Google::Longrunning::CancelOperationRequest} or an equivalent Hash.
410
+ #
411
+ # @param request [::Google::Longrunning::CancelOperationRequest, ::Hash]
412
+ # A request object representing the call parameters. Required. To specify no
413
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
414
+ # @param options [::Gapic::CallOptions, ::Hash]
415
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
416
+ #
417
+ # @overload cancel_operation(name: nil)
418
+ # Pass arguments to `cancel_operation` via keyword arguments. Note that at
419
+ # least one keyword argument is required. To specify no parameters, or to keep all
420
+ # the default parameter values, pass an empty Hash as a request object (see above).
421
+ #
422
+ # @param name [::String]
423
+ # The name of the operation resource to be cancelled.
424
+ #
425
+ # @yield [response, operation] Access the result along with the RPC operation
426
+ # @yieldparam response [::Google::Protobuf::Empty]
427
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
428
+ #
429
+ # @return [::Google::Protobuf::Empty]
430
+ #
431
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
432
+ #
433
+ # @example Basic example
434
+ # require "google/longrunning"
435
+ #
436
+ # # Create a client object. The client can be reused for multiple calls.
437
+ # client = Google::Longrunning::Operations::Client.new
438
+ #
439
+ # # Create a request. To set request fields, pass in keyword arguments.
440
+ # request = Google::Longrunning::CancelOperationRequest.new
441
+ #
442
+ # # Call the cancel_operation method.
443
+ # result = client.cancel_operation request
444
+ #
445
+ # # The returned object is of type Google::Protobuf::Empty.
446
+ # p result
447
+ #
448
+ def cancel_operation request, options = nil
449
+ raise ::ArgumentError, "request must be provided" if request.nil?
450
+
451
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::CancelOperationRequest
452
+
453
+ # Converts hash and nil to an options object
454
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
455
+
456
+ # Customize the options with defaults
457
+ metadata = @config.rpcs.cancel_operation.metadata.to_h
458
+
459
+ # Set x-goog-api-client and x-goog-user-project headers
460
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
461
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
462
+ gapic_version: ::Google::Cloud::Video::Stitcher::V1::VERSION
463
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
464
+
465
+ header_params = {}
466
+ if request.name
467
+ header_params["name"] = request.name
468
+ end
469
+
470
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
471
+ metadata[:"x-goog-request-params"] ||= request_params_header
472
+
473
+ options.apply_defaults timeout: @config.rpcs.cancel_operation.timeout,
474
+ metadata: metadata,
475
+ retry_policy: @config.rpcs.cancel_operation.retry_policy
476
+
477
+ options.apply_defaults timeout: @config.timeout,
478
+ metadata: @config.metadata,
479
+ retry_policy: @config.retry_policy
480
+
481
+ @operations_stub.call_rpc :cancel_operation, request, options: options do |response, operation|
482
+ yield response, operation if block_given?
483
+ return response
484
+ end
485
+ rescue ::GRPC::BadStatus => e
486
+ raise ::Google::Cloud::Error.from_error(e)
487
+ end
488
+
489
+ ##
490
+ # Waits until the specified long-running operation is done or reaches at most
491
+ # a specified timeout, returning the latest state. If the operation is
492
+ # already done, the latest state is immediately returned. If the timeout
493
+ # specified is greater than the default HTTP/RPC timeout, the HTTP/RPC
494
+ # timeout is used. If the server does not support this method, it returns
495
+ # `google.rpc.Code.UNIMPLEMENTED`.
496
+ # Note that this method is on a best-effort basis. It may return the latest
497
+ # state before the specified timeout (including immediately), meaning even an
498
+ # immediate response is no guarantee that the operation is done.
499
+ #
500
+ # @overload wait_operation(request, options = nil)
501
+ # Pass arguments to `wait_operation` via a request object, either of type
502
+ # {::Google::Longrunning::WaitOperationRequest} or an equivalent Hash.
503
+ #
504
+ # @param request [::Google::Longrunning::WaitOperationRequest, ::Hash]
505
+ # A request object representing the call parameters. Required. To specify no
506
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
507
+ # @param options [::Gapic::CallOptions, ::Hash]
508
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
509
+ #
510
+ # @overload wait_operation(name: nil, timeout: nil)
511
+ # Pass arguments to `wait_operation` via keyword arguments. Note that at
512
+ # least one keyword argument is required. To specify no parameters, or to keep all
513
+ # the default parameter values, pass an empty Hash as a request object (see above).
514
+ #
515
+ # @param name [::String]
516
+ # The name of the operation resource to wait on.
517
+ # @param timeout [::Google::Protobuf::Duration, ::Hash]
518
+ # The maximum duration to wait before timing out. If left blank, the wait
519
+ # will be at most the time permitted by the underlying HTTP/RPC protocol.
520
+ # If RPC context deadline is also specified, the shorter one will be used.
521
+ #
522
+ # @yield [response, operation] Access the result along with the RPC operation
523
+ # @yieldparam response [::Gapic::Operation]
524
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
525
+ #
526
+ # @return [::Gapic::Operation]
527
+ #
528
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
529
+ #
530
+ # @example Basic example
531
+ # require "google/longrunning"
532
+ #
533
+ # # Create a client object. The client can be reused for multiple calls.
534
+ # client = Google::Longrunning::Operations::Client.new
535
+ #
536
+ # # Create a request. To set request fields, pass in keyword arguments.
537
+ # request = Google::Longrunning::WaitOperationRequest.new
538
+ #
539
+ # # Call the wait_operation method.
540
+ # result = client.wait_operation request
541
+ #
542
+ # # The returned object is of type Gapic::Operation. You can use it to
543
+ # # check the status of an operation, cancel it, or wait for results.
544
+ # # Here is how to wait for a response.
545
+ # result.wait_until_done! timeout: 60
546
+ # if result.response?
547
+ # p result.response
548
+ # else
549
+ # puts "No response received."
550
+ # end
551
+ #
552
+ def wait_operation request, options = nil
553
+ raise ::ArgumentError, "request must be provided" if request.nil?
554
+
555
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::WaitOperationRequest
556
+
557
+ # Converts hash and nil to an options object
558
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
559
+
560
+ # Customize the options with defaults
561
+ metadata = @config.rpcs.wait_operation.metadata.to_h
562
+
563
+ # Set x-goog-api-client and x-goog-user-project headers
564
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
565
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
566
+ gapic_version: ::Google::Cloud::Video::Stitcher::V1::VERSION
567
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
568
+
569
+ options.apply_defaults timeout: @config.rpcs.wait_operation.timeout,
570
+ metadata: metadata,
571
+ retry_policy: @config.rpcs.wait_operation.retry_policy
572
+
573
+ options.apply_defaults timeout: @config.timeout,
574
+ metadata: @config.metadata,
575
+ retry_policy: @config.retry_policy
576
+
577
+ @operations_stub.call_rpc :wait_operation, request, options: options do |response, operation|
578
+ response = ::Gapic::Operation.new response, @operations_client, options: options
579
+ yield response, operation if block_given?
580
+ return response
581
+ end
582
+ rescue ::GRPC::BadStatus => e
583
+ raise ::Google::Cloud::Error.from_error(e)
584
+ end
585
+
586
+ ##
587
+ # Configuration class for the Operations API.
588
+ #
589
+ # This class represents the configuration for Operations,
590
+ # providing control over timeouts, retry behavior, logging, transport
591
+ # parameters, and other low-level controls. Certain parameters can also be
592
+ # applied individually to specific RPCs. See
593
+ # {::Google::Longrunning::Operations::Client::Configuration::Rpcs}
594
+ # for a list of RPCs that can be configured independently.
595
+ #
596
+ # Configuration can be applied globally to all clients, or to a single client
597
+ # on construction.
598
+ #
599
+ # @example
600
+ #
601
+ # # Modify the global config, setting the timeout for
602
+ # # list_operations to 20 seconds,
603
+ # # and all remaining timeouts to 10 seconds.
604
+ # ::Google::Longrunning::Operations::Client.configure do |config|
605
+ # config.timeout = 10.0
606
+ # config.rpcs.list_operations.timeout = 20.0
607
+ # end
608
+ #
609
+ # # Apply the above configuration only to a new client.
610
+ # client = ::Google::Longrunning::Operations::Client.new do |config|
611
+ # config.timeout = 10.0
612
+ # config.rpcs.list_operations.timeout = 20.0
613
+ # end
614
+ #
615
+ # @!attribute [rw] endpoint
616
+ # The hostname or hostname:port of the service endpoint.
617
+ # Defaults to `"videostitcher.googleapis.com"`.
618
+ # @return [::String]
619
+ # @!attribute [rw] credentials
620
+ # Credentials to send with calls. You may provide any of the following types:
621
+ # * (`String`) The path to a service account key file in JSON format
622
+ # * (`Hash`) A service account key as a Hash
623
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
624
+ # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
625
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
626
+ # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
627
+ # * (`GRPC::Core::Channel`) a gRPC channel with included credentials
628
+ # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
629
+ # * (`nil`) indicating no credentials
630
+ # @return [::Object]
631
+ # @!attribute [rw] scope
632
+ # The OAuth scopes
633
+ # @return [::Array<::String>]
634
+ # @!attribute [rw] lib_name
635
+ # The library name as recorded in instrumentation and logging
636
+ # @return [::String]
637
+ # @!attribute [rw] lib_version
638
+ # The library version as recorded in instrumentation and logging
639
+ # @return [::String]
640
+ # @!attribute [rw] channel_args
641
+ # Extra parameters passed to the gRPC channel. Note: this is ignored if a
642
+ # `GRPC::Core::Channel` object is provided as the credential.
643
+ # @return [::Hash]
644
+ # @!attribute [rw] interceptors
645
+ # An array of interceptors that are run before calls are executed.
646
+ # @return [::Array<::GRPC::ClientInterceptor>]
647
+ # @!attribute [rw] timeout
648
+ # The call timeout in seconds.
649
+ # @return [::Numeric]
650
+ # @!attribute [rw] metadata
651
+ # Additional gRPC headers to be sent with the call.
652
+ # @return [::Hash{::Symbol=>::String}]
653
+ # @!attribute [rw] retry_policy
654
+ # The retry policy. The value is a hash with the following keys:
655
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
656
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
657
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
658
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
659
+ # trigger a retry.
660
+ # @return [::Hash]
661
+ # @!attribute [rw] quota_project
662
+ # A separate project against which to charge quota.
663
+ # @return [::String]
664
+ #
665
+ class Configuration
666
+ extend ::Gapic::Config
667
+
668
+ config_attr :endpoint, "videostitcher.googleapis.com", ::String
669
+ config_attr :credentials, nil do |value|
670
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
671
+ allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
672
+ allowed.any? { |klass| klass === value }
673
+ end
674
+ config_attr :scope, nil, ::String, ::Array, nil
675
+ config_attr :lib_name, nil, ::String, nil
676
+ config_attr :lib_version, nil, ::String, nil
677
+ config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
678
+ config_attr :interceptors, nil, ::Array, nil
679
+ config_attr :timeout, nil, ::Numeric, nil
680
+ config_attr :metadata, nil, ::Hash, nil
681
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
682
+ config_attr :quota_project, nil, ::String, nil
683
+
684
+ # @private
685
+ def initialize parent_config = nil
686
+ @parent_config = parent_config unless parent_config.nil?
687
+
688
+ yield self if block_given?
689
+ end
690
+
691
+ ##
692
+ # Configurations for individual RPCs
693
+ # @return [Rpcs]
694
+ #
695
+ def rpcs
696
+ @rpcs ||= begin
697
+ parent_rpcs = nil
698
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
699
+ Rpcs.new parent_rpcs
700
+ end
701
+ end
702
+
703
+ ##
704
+ # Configuration RPC class for the Operations API.
705
+ #
706
+ # Includes fields providing the configuration for each RPC in this service.
707
+ # Each configuration object is of type `Gapic::Config::Method` and includes
708
+ # the following configuration fields:
709
+ #
710
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
711
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
712
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
713
+ # include the following keys:
714
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
715
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
716
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
717
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
718
+ # trigger a retry.
719
+ #
720
+ class Rpcs
721
+ ##
722
+ # RPC-specific configuration for `list_operations`
723
+ # @return [::Gapic::Config::Method]
724
+ #
725
+ attr_reader :list_operations
726
+ ##
727
+ # RPC-specific configuration for `get_operation`
728
+ # @return [::Gapic::Config::Method]
729
+ #
730
+ attr_reader :get_operation
731
+ ##
732
+ # RPC-specific configuration for `delete_operation`
733
+ # @return [::Gapic::Config::Method]
734
+ #
735
+ attr_reader :delete_operation
736
+ ##
737
+ # RPC-specific configuration for `cancel_operation`
738
+ # @return [::Gapic::Config::Method]
739
+ #
740
+ attr_reader :cancel_operation
741
+ ##
742
+ # RPC-specific configuration for `wait_operation`
743
+ # @return [::Gapic::Config::Method]
744
+ #
745
+ attr_reader :wait_operation
746
+
747
+ # @private
748
+ def initialize parent_rpcs = nil
749
+ list_operations_config = parent_rpcs.list_operations if parent_rpcs.respond_to? :list_operations
750
+ @list_operations = ::Gapic::Config::Method.new list_operations_config
751
+ get_operation_config = parent_rpcs.get_operation if parent_rpcs.respond_to? :get_operation
752
+ @get_operation = ::Gapic::Config::Method.new get_operation_config
753
+ delete_operation_config = parent_rpcs.delete_operation if parent_rpcs.respond_to? :delete_operation
754
+ @delete_operation = ::Gapic::Config::Method.new delete_operation_config
755
+ cancel_operation_config = parent_rpcs.cancel_operation if parent_rpcs.respond_to? :cancel_operation
756
+ @cancel_operation = ::Gapic::Config::Method.new cancel_operation_config
757
+ wait_operation_config = parent_rpcs.wait_operation if parent_rpcs.respond_to? :wait_operation
758
+ @wait_operation = ::Gapic::Config::Method.new wait_operation_config
759
+
760
+ yield self if block_given?
761
+ end
762
+ end
763
+ end
764
+ end
765
+ end
766
+ end
767
+ end
768
+ end
769
+ end
770
+ end