google-cloud-video-transcoder-v1 0.6.0 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,901 @@
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/video/transcoder/v1/services_pb"
21
+ require "google/cloud/video/transcoder/v1/transcoder_service/rest/service_stub"
22
+
23
+ module Google
24
+ module Cloud
25
+ module Video
26
+ module Transcoder
27
+ module V1
28
+ module TranscoderService
29
+ module Rest
30
+ ##
31
+ # REST client for the TranscoderService service.
32
+ #
33
+ # Using the Transcoder API, you can queue asynchronous jobs for transcoding
34
+ # media into various output formats. Output formats may include different
35
+ # streaming standards such as HTTP Live Streaming (HLS) and Dynamic Adaptive
36
+ # Streaming over HTTP (DASH). You can also customize jobs using advanced
37
+ # features such as Digital Rights Management (DRM), audio equalization, content
38
+ # concatenation, and digital ad-stitch ready content generation.
39
+ #
40
+ class Client
41
+ include Paths
42
+
43
+ # @private
44
+ attr_reader :transcoder_service_stub
45
+
46
+ ##
47
+ # Configure the TranscoderService Client class.
48
+ #
49
+ # See {::Google::Cloud::Video::Transcoder::V1::TranscoderService::Rest::Client::Configuration}
50
+ # for a description of the configuration fields.
51
+ #
52
+ # @example
53
+ #
54
+ # # Modify the configuration for all TranscoderService clients
55
+ # ::Google::Cloud::Video::Transcoder::V1::TranscoderService::Rest::Client.configure do |config|
56
+ # config.timeout = 10.0
57
+ # end
58
+ #
59
+ # @yield [config] Configure the Client client.
60
+ # @yieldparam config [Client::Configuration]
61
+ #
62
+ # @return [Client::Configuration]
63
+ #
64
+ def self.configure
65
+ @configure ||= begin
66
+ namespace = ["Google", "Cloud", "Video", "Transcoder", "V1"]
67
+ parent_config = while namespace.any?
68
+ parent_name = namespace.join "::"
69
+ parent_const = const_get parent_name
70
+ break parent_const.configure if parent_const.respond_to? :configure
71
+ namespace.pop
72
+ end
73
+ default_config = Client::Configuration.new parent_config
74
+
75
+ default_config.timeout = 60.0
76
+ default_config.retry_policy = {
77
+ initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
78
+ }
79
+
80
+ default_config.rpcs.create_job.timeout = 60.0
81
+
82
+ default_config.rpcs.list_jobs.timeout = 60.0
83
+
84
+ default_config.rpcs.get_job.timeout = 60.0
85
+
86
+ default_config.rpcs.delete_job.timeout = 60.0
87
+
88
+ default_config.rpcs.create_job_template.timeout = 60.0
89
+
90
+ default_config.rpcs.list_job_templates.timeout = 60.0
91
+
92
+ default_config.rpcs.get_job_template.timeout = 60.0
93
+
94
+ default_config.rpcs.delete_job_template.timeout = 60.0
95
+
96
+ default_config
97
+ end
98
+ yield @configure if block_given?
99
+ @configure
100
+ end
101
+
102
+ ##
103
+ # Configure the TranscoderService Client instance.
104
+ #
105
+ # The configuration is set to the derived mode, meaning that values can be changed,
106
+ # but structural changes (adding new fields, etc.) are not allowed. Structural changes
107
+ # should be made on {Client.configure}.
108
+ #
109
+ # See {::Google::Cloud::Video::Transcoder::V1::TranscoderService::Rest::Client::Configuration}
110
+ # for a description of the configuration fields.
111
+ #
112
+ # @yield [config] Configure the Client client.
113
+ # @yieldparam config [Client::Configuration]
114
+ #
115
+ # @return [Client::Configuration]
116
+ #
117
+ def configure
118
+ yield @config if block_given?
119
+ @config
120
+ end
121
+
122
+ ##
123
+ # Create a new TranscoderService REST client object.
124
+ #
125
+ # @example
126
+ #
127
+ # # Create a client using the default configuration
128
+ # client = ::Google::Cloud::Video::Transcoder::V1::TranscoderService::Rest::Client.new
129
+ #
130
+ # # Create a client using a custom configuration
131
+ # client = ::Google::Cloud::Video::Transcoder::V1::TranscoderService::Rest::Client.new do |config|
132
+ # config.timeout = 10.0
133
+ # end
134
+ #
135
+ # @yield [config] Configure the TranscoderService client.
136
+ # @yieldparam config [Client::Configuration]
137
+ #
138
+ def initialize
139
+ # Create the configuration object
140
+ @config = Configuration.new Client.configure
141
+
142
+ # Yield the configuration if needed
143
+ yield @config if block_given?
144
+
145
+ # Create credentials
146
+ credentials = @config.credentials
147
+ # Use self-signed JWT if the endpoint is unchanged from default,
148
+ # but only if the default endpoint does not have a region prefix.
149
+ enable_self_signed_jwt = @config.endpoint == Client.configure.endpoint &&
150
+ !@config.endpoint.split(".").first.include?("-")
151
+ credentials ||= Credentials.default scope: @config.scope,
152
+ enable_self_signed_jwt: enable_self_signed_jwt
153
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
154
+ credentials = Credentials.new credentials, scope: @config.scope
155
+ end
156
+
157
+ @quota_project_id = @config.quota_project
158
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
159
+
160
+ @transcoder_service_stub = ::Google::Cloud::Video::Transcoder::V1::TranscoderService::Rest::ServiceStub.new endpoint: @config.endpoint, credentials: credentials
161
+ end
162
+
163
+ # Service calls
164
+
165
+ ##
166
+ # Creates a job in the specified region.
167
+ #
168
+ # @overload create_job(request, options = nil)
169
+ # Pass arguments to `create_job` via a request object, either of type
170
+ # {::Google::Cloud::Video::Transcoder::V1::CreateJobRequest} or an equivalent Hash.
171
+ #
172
+ # @param request [::Google::Cloud::Video::Transcoder::V1::CreateJobRequest, ::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 create_job(parent: nil, job: nil)
179
+ # Pass arguments to `create_job` 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 parent [::String]
184
+ # Required. The parent location to create and process this job.
185
+ # Format: `projects/{project}/locations/{location}`
186
+ # @param job [::Google::Cloud::Video::Transcoder::V1::Job, ::Hash]
187
+ # Required. Parameters for creating transcoding job.
188
+ # @yield [result, operation] Access the result along with the TransportOperation object
189
+ # @yieldparam result [::Google::Cloud::Video::Transcoder::V1::Job]
190
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
191
+ #
192
+ # @return [::Google::Cloud::Video::Transcoder::V1::Job]
193
+ #
194
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
195
+ def create_job request, options = nil
196
+ raise ::ArgumentError, "request must be provided" if request.nil?
197
+
198
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Video::Transcoder::V1::CreateJobRequest
199
+
200
+ # Converts hash and nil to an options object
201
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
202
+
203
+ # Customize the options with defaults
204
+ call_metadata = @config.rpcs.create_job.metadata.to_h
205
+
206
+ # Set x-goog-api-client and x-goog-user-project headers
207
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
208
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
209
+ gapic_version: ::Google::Cloud::Video::Transcoder::V1::VERSION,
210
+ transports_version_send: [:rest]
211
+
212
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
213
+
214
+ options.apply_defaults timeout: @config.rpcs.create_job.timeout,
215
+ metadata: call_metadata,
216
+ retry_policy: @config.rpcs.create_job.retry_policy
217
+
218
+ options.apply_defaults timeout: @config.timeout,
219
+ metadata: @config.metadata,
220
+ retry_policy: @config.retry_policy
221
+
222
+ @transcoder_service_stub.create_job request, options do |result, operation|
223
+ yield result, operation if block_given?
224
+ return result
225
+ end
226
+ rescue ::Gapic::Rest::Error => e
227
+ raise ::Google::Cloud::Error.from_error(e)
228
+ end
229
+
230
+ ##
231
+ # Lists jobs in the specified region.
232
+ #
233
+ # @overload list_jobs(request, options = nil)
234
+ # Pass arguments to `list_jobs` via a request object, either of type
235
+ # {::Google::Cloud::Video::Transcoder::V1::ListJobsRequest} or an equivalent Hash.
236
+ #
237
+ # @param request [::Google::Cloud::Video::Transcoder::V1::ListJobsRequest, ::Hash]
238
+ # A request object representing the call parameters. Required. To specify no
239
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
240
+ # @param options [::Gapic::CallOptions, ::Hash]
241
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
242
+ #
243
+ # @overload list_jobs(parent: nil, page_size: nil, page_token: nil, filter: nil, order_by: nil)
244
+ # Pass arguments to `list_jobs` via keyword arguments. Note that at
245
+ # least one keyword argument is required. To specify no parameters, or to keep all
246
+ # the default parameter values, pass an empty Hash as a request object (see above).
247
+ #
248
+ # @param parent [::String]
249
+ # Required. Format: `projects/{project}/locations/{location}`
250
+ # @param page_size [::Integer]
251
+ # The maximum number of items to return.
252
+ # @param page_token [::String]
253
+ # The `next_page_token` value returned from a previous List request, if
254
+ # any.
255
+ # @param filter [::String]
256
+ # The filter expression, following the syntax outlined in
257
+ # https://google.aip.dev/160.
258
+ # @param order_by [::String]
259
+ # One or more fields to compare and use to sort the output.
260
+ # See https://google.aip.dev/132#ordering.
261
+ # @yield [result, operation] Access the result along with the TransportOperation object
262
+ # @yieldparam result [::Google::Cloud::Video::Transcoder::V1::ListJobsResponse]
263
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
264
+ #
265
+ # @return [::Google::Cloud::Video::Transcoder::V1::ListJobsResponse]
266
+ #
267
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
268
+ def list_jobs request, options = nil
269
+ raise ::ArgumentError, "request must be provided" if request.nil?
270
+
271
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Video::Transcoder::V1::ListJobsRequest
272
+
273
+ # Converts hash and nil to an options object
274
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
275
+
276
+ # Customize the options with defaults
277
+ call_metadata = @config.rpcs.list_jobs.metadata.to_h
278
+
279
+ # Set x-goog-api-client and x-goog-user-project headers
280
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
281
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
282
+ gapic_version: ::Google::Cloud::Video::Transcoder::V1::VERSION,
283
+ transports_version_send: [:rest]
284
+
285
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
286
+
287
+ options.apply_defaults timeout: @config.rpcs.list_jobs.timeout,
288
+ metadata: call_metadata,
289
+ retry_policy: @config.rpcs.list_jobs.retry_policy
290
+
291
+ options.apply_defaults timeout: @config.timeout,
292
+ metadata: @config.metadata,
293
+ retry_policy: @config.retry_policy
294
+
295
+ @transcoder_service_stub.list_jobs request, options do |result, operation|
296
+ yield result, operation if block_given?
297
+ return result
298
+ end
299
+ rescue ::Gapic::Rest::Error => e
300
+ raise ::Google::Cloud::Error.from_error(e)
301
+ end
302
+
303
+ ##
304
+ # Returns the job data.
305
+ #
306
+ # @overload get_job(request, options = nil)
307
+ # Pass arguments to `get_job` via a request object, either of type
308
+ # {::Google::Cloud::Video::Transcoder::V1::GetJobRequest} or an equivalent Hash.
309
+ #
310
+ # @param request [::Google::Cloud::Video::Transcoder::V1::GetJobRequest, ::Hash]
311
+ # A request object representing the call parameters. Required. To specify no
312
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
313
+ # @param options [::Gapic::CallOptions, ::Hash]
314
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
315
+ #
316
+ # @overload get_job(name: nil)
317
+ # Pass arguments to `get_job` via keyword arguments. Note that at
318
+ # least one keyword argument is required. To specify no parameters, or to keep all
319
+ # the default parameter values, pass an empty Hash as a request object (see above).
320
+ #
321
+ # @param name [::String]
322
+ # Required. The name of the job to retrieve.
323
+ # Format: `projects/{project}/locations/{location}/jobs/{job}`
324
+ # @yield [result, operation] Access the result along with the TransportOperation object
325
+ # @yieldparam result [::Google::Cloud::Video::Transcoder::V1::Job]
326
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
327
+ #
328
+ # @return [::Google::Cloud::Video::Transcoder::V1::Job]
329
+ #
330
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
331
+ def get_job request, options = nil
332
+ raise ::ArgumentError, "request must be provided" if request.nil?
333
+
334
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Video::Transcoder::V1::GetJobRequest
335
+
336
+ # Converts hash and nil to an options object
337
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
338
+
339
+ # Customize the options with defaults
340
+ call_metadata = @config.rpcs.get_job.metadata.to_h
341
+
342
+ # Set x-goog-api-client and x-goog-user-project headers
343
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
344
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
345
+ gapic_version: ::Google::Cloud::Video::Transcoder::V1::VERSION,
346
+ transports_version_send: [:rest]
347
+
348
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
349
+
350
+ options.apply_defaults timeout: @config.rpcs.get_job.timeout,
351
+ metadata: call_metadata,
352
+ retry_policy: @config.rpcs.get_job.retry_policy
353
+
354
+ options.apply_defaults timeout: @config.timeout,
355
+ metadata: @config.metadata,
356
+ retry_policy: @config.retry_policy
357
+
358
+ @transcoder_service_stub.get_job request, options do |result, operation|
359
+ yield result, operation if block_given?
360
+ return result
361
+ end
362
+ rescue ::Gapic::Rest::Error => e
363
+ raise ::Google::Cloud::Error.from_error(e)
364
+ end
365
+
366
+ ##
367
+ # Deletes a job.
368
+ #
369
+ # @overload delete_job(request, options = nil)
370
+ # Pass arguments to `delete_job` via a request object, either of type
371
+ # {::Google::Cloud::Video::Transcoder::V1::DeleteJobRequest} or an equivalent Hash.
372
+ #
373
+ # @param request [::Google::Cloud::Video::Transcoder::V1::DeleteJobRequest, ::Hash]
374
+ # A request object representing the call parameters. Required. To specify no
375
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
376
+ # @param options [::Gapic::CallOptions, ::Hash]
377
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
378
+ #
379
+ # @overload delete_job(name: nil, allow_missing: nil)
380
+ # Pass arguments to `delete_job` via keyword arguments. Note that at
381
+ # least one keyword argument is required. To specify no parameters, or to keep all
382
+ # the default parameter values, pass an empty Hash as a request object (see above).
383
+ #
384
+ # @param name [::String]
385
+ # Required. The name of the job to delete.
386
+ # Format: `projects/{project}/locations/{location}/jobs/{job}`
387
+ # @param allow_missing [::Boolean]
388
+ # If set to true, and the job is not found, the request will succeed but no
389
+ # action will be taken on the server.
390
+ # @yield [result, operation] Access the result along with the TransportOperation object
391
+ # @yieldparam result [::Google::Protobuf::Empty]
392
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
393
+ #
394
+ # @return [::Google::Protobuf::Empty]
395
+ #
396
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
397
+ def delete_job request, options = nil
398
+ raise ::ArgumentError, "request must be provided" if request.nil?
399
+
400
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Video::Transcoder::V1::DeleteJobRequest
401
+
402
+ # Converts hash and nil to an options object
403
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
404
+
405
+ # Customize the options with defaults
406
+ call_metadata = @config.rpcs.delete_job.metadata.to_h
407
+
408
+ # Set x-goog-api-client and x-goog-user-project headers
409
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
410
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
411
+ gapic_version: ::Google::Cloud::Video::Transcoder::V1::VERSION,
412
+ transports_version_send: [:rest]
413
+
414
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
415
+
416
+ options.apply_defaults timeout: @config.rpcs.delete_job.timeout,
417
+ metadata: call_metadata,
418
+ retry_policy: @config.rpcs.delete_job.retry_policy
419
+
420
+ options.apply_defaults timeout: @config.timeout,
421
+ metadata: @config.metadata,
422
+ retry_policy: @config.retry_policy
423
+
424
+ @transcoder_service_stub.delete_job request, options do |result, operation|
425
+ yield result, operation if block_given?
426
+ return result
427
+ end
428
+ rescue ::Gapic::Rest::Error => e
429
+ raise ::Google::Cloud::Error.from_error(e)
430
+ end
431
+
432
+ ##
433
+ # Creates a job template in the specified region.
434
+ #
435
+ # @overload create_job_template(request, options = nil)
436
+ # Pass arguments to `create_job_template` via a request object, either of type
437
+ # {::Google::Cloud::Video::Transcoder::V1::CreateJobTemplateRequest} or an equivalent Hash.
438
+ #
439
+ # @param request [::Google::Cloud::Video::Transcoder::V1::CreateJobTemplateRequest, ::Hash]
440
+ # A request object representing the call parameters. Required. To specify no
441
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
442
+ # @param options [::Gapic::CallOptions, ::Hash]
443
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
444
+ #
445
+ # @overload create_job_template(parent: nil, job_template: nil, job_template_id: nil)
446
+ # Pass arguments to `create_job_template` via keyword arguments. Note that at
447
+ # least one keyword argument is required. To specify no parameters, or to keep all
448
+ # the default parameter values, pass an empty Hash as a request object (see above).
449
+ #
450
+ # @param parent [::String]
451
+ # Required. The parent location to create this job template.
452
+ # Format: `projects/{project}/locations/{location}`
453
+ # @param job_template [::Google::Cloud::Video::Transcoder::V1::JobTemplate, ::Hash]
454
+ # Required. Parameters for creating job template.
455
+ # @param job_template_id [::String]
456
+ # Required. The ID to use for the job template, which will become the final
457
+ # component of the job template's resource name.
458
+ #
459
+ # This value should be 4-63 characters, and valid characters must match the
460
+ # regular expression `[a-zA-Z][a-zA-Z0-9_-]*`.
461
+ # @yield [result, operation] Access the result along with the TransportOperation object
462
+ # @yieldparam result [::Google::Cloud::Video::Transcoder::V1::JobTemplate]
463
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
464
+ #
465
+ # @return [::Google::Cloud::Video::Transcoder::V1::JobTemplate]
466
+ #
467
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
468
+ def create_job_template request, options = nil
469
+ raise ::ArgumentError, "request must be provided" if request.nil?
470
+
471
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Video::Transcoder::V1::CreateJobTemplateRequest
472
+
473
+ # Converts hash and nil to an options object
474
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
475
+
476
+ # Customize the options with defaults
477
+ call_metadata = @config.rpcs.create_job_template.metadata.to_h
478
+
479
+ # Set x-goog-api-client and x-goog-user-project headers
480
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
481
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
482
+ gapic_version: ::Google::Cloud::Video::Transcoder::V1::VERSION,
483
+ transports_version_send: [:rest]
484
+
485
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
486
+
487
+ options.apply_defaults timeout: @config.rpcs.create_job_template.timeout,
488
+ metadata: call_metadata,
489
+ retry_policy: @config.rpcs.create_job_template.retry_policy
490
+
491
+ options.apply_defaults timeout: @config.timeout,
492
+ metadata: @config.metadata,
493
+ retry_policy: @config.retry_policy
494
+
495
+ @transcoder_service_stub.create_job_template request, options do |result, operation|
496
+ yield result, operation if block_given?
497
+ return result
498
+ end
499
+ rescue ::Gapic::Rest::Error => e
500
+ raise ::Google::Cloud::Error.from_error(e)
501
+ end
502
+
503
+ ##
504
+ # Lists job templates in the specified region.
505
+ #
506
+ # @overload list_job_templates(request, options = nil)
507
+ # Pass arguments to `list_job_templates` via a request object, either of type
508
+ # {::Google::Cloud::Video::Transcoder::V1::ListJobTemplatesRequest} or an equivalent Hash.
509
+ #
510
+ # @param request [::Google::Cloud::Video::Transcoder::V1::ListJobTemplatesRequest, ::Hash]
511
+ # A request object representing the call parameters. Required. To specify no
512
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
513
+ # @param options [::Gapic::CallOptions, ::Hash]
514
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
515
+ #
516
+ # @overload list_job_templates(parent: nil, page_size: nil, page_token: nil, filter: nil, order_by: nil)
517
+ # Pass arguments to `list_job_templates` via keyword arguments. Note that at
518
+ # least one keyword argument is required. To specify no parameters, or to keep all
519
+ # the default parameter values, pass an empty Hash as a request object (see above).
520
+ #
521
+ # @param parent [::String]
522
+ # Required. The parent location from which to retrieve the collection of job
523
+ # templates. Format: `projects/{project}/locations/{location}`
524
+ # @param page_size [::Integer]
525
+ # The maximum number of items to return.
526
+ # @param page_token [::String]
527
+ # The `next_page_token` value returned from a previous List request, if
528
+ # any.
529
+ # @param filter [::String]
530
+ # The filter expression, following the syntax outlined in
531
+ # https://google.aip.dev/160.
532
+ # @param order_by [::String]
533
+ # One or more fields to compare and use to sort the output.
534
+ # See https://google.aip.dev/132#ordering.
535
+ # @yield [result, operation] Access the result along with the TransportOperation object
536
+ # @yieldparam result [::Google::Cloud::Video::Transcoder::V1::ListJobTemplatesResponse]
537
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
538
+ #
539
+ # @return [::Google::Cloud::Video::Transcoder::V1::ListJobTemplatesResponse]
540
+ #
541
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
542
+ def list_job_templates request, options = nil
543
+ raise ::ArgumentError, "request must be provided" if request.nil?
544
+
545
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Video::Transcoder::V1::ListJobTemplatesRequest
546
+
547
+ # Converts hash and nil to an options object
548
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
549
+
550
+ # Customize the options with defaults
551
+ call_metadata = @config.rpcs.list_job_templates.metadata.to_h
552
+
553
+ # Set x-goog-api-client and x-goog-user-project headers
554
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
555
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
556
+ gapic_version: ::Google::Cloud::Video::Transcoder::V1::VERSION,
557
+ transports_version_send: [:rest]
558
+
559
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
560
+
561
+ options.apply_defaults timeout: @config.rpcs.list_job_templates.timeout,
562
+ metadata: call_metadata,
563
+ retry_policy: @config.rpcs.list_job_templates.retry_policy
564
+
565
+ options.apply_defaults timeout: @config.timeout,
566
+ metadata: @config.metadata,
567
+ retry_policy: @config.retry_policy
568
+
569
+ @transcoder_service_stub.list_job_templates request, options do |result, operation|
570
+ yield result, operation if block_given?
571
+ return result
572
+ end
573
+ rescue ::Gapic::Rest::Error => e
574
+ raise ::Google::Cloud::Error.from_error(e)
575
+ end
576
+
577
+ ##
578
+ # Returns the job template data.
579
+ #
580
+ # @overload get_job_template(request, options = nil)
581
+ # Pass arguments to `get_job_template` via a request object, either of type
582
+ # {::Google::Cloud::Video::Transcoder::V1::GetJobTemplateRequest} or an equivalent Hash.
583
+ #
584
+ # @param request [::Google::Cloud::Video::Transcoder::V1::GetJobTemplateRequest, ::Hash]
585
+ # A request object representing the call parameters. Required. To specify no
586
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
587
+ # @param options [::Gapic::CallOptions, ::Hash]
588
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
589
+ #
590
+ # @overload get_job_template(name: nil)
591
+ # Pass arguments to `get_job_template` via keyword arguments. Note that at
592
+ # least one keyword argument is required. To specify no parameters, or to keep all
593
+ # the default parameter values, pass an empty Hash as a request object (see above).
594
+ #
595
+ # @param name [::String]
596
+ # Required. The name of the job template to retrieve.
597
+ # Format:
598
+ # `projects/{project}/locations/{location}/jobTemplates/{job_template}`
599
+ # @yield [result, operation] Access the result along with the TransportOperation object
600
+ # @yieldparam result [::Google::Cloud::Video::Transcoder::V1::JobTemplate]
601
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
602
+ #
603
+ # @return [::Google::Cloud::Video::Transcoder::V1::JobTemplate]
604
+ #
605
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
606
+ def get_job_template request, options = nil
607
+ raise ::ArgumentError, "request must be provided" if request.nil?
608
+
609
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Video::Transcoder::V1::GetJobTemplateRequest
610
+
611
+ # Converts hash and nil to an options object
612
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
613
+
614
+ # Customize the options with defaults
615
+ call_metadata = @config.rpcs.get_job_template.metadata.to_h
616
+
617
+ # Set x-goog-api-client and x-goog-user-project headers
618
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
619
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
620
+ gapic_version: ::Google::Cloud::Video::Transcoder::V1::VERSION,
621
+ transports_version_send: [:rest]
622
+
623
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
624
+
625
+ options.apply_defaults timeout: @config.rpcs.get_job_template.timeout,
626
+ metadata: call_metadata,
627
+ retry_policy: @config.rpcs.get_job_template.retry_policy
628
+
629
+ options.apply_defaults timeout: @config.timeout,
630
+ metadata: @config.metadata,
631
+ retry_policy: @config.retry_policy
632
+
633
+ @transcoder_service_stub.get_job_template request, options do |result, operation|
634
+ yield result, operation if block_given?
635
+ return result
636
+ end
637
+ rescue ::Gapic::Rest::Error => e
638
+ raise ::Google::Cloud::Error.from_error(e)
639
+ end
640
+
641
+ ##
642
+ # Deletes a job template.
643
+ #
644
+ # @overload delete_job_template(request, options = nil)
645
+ # Pass arguments to `delete_job_template` via a request object, either of type
646
+ # {::Google::Cloud::Video::Transcoder::V1::DeleteJobTemplateRequest} or an equivalent Hash.
647
+ #
648
+ # @param request [::Google::Cloud::Video::Transcoder::V1::DeleteJobTemplateRequest, ::Hash]
649
+ # A request object representing the call parameters. Required. To specify no
650
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
651
+ # @param options [::Gapic::CallOptions, ::Hash]
652
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
653
+ #
654
+ # @overload delete_job_template(name: nil, allow_missing: nil)
655
+ # Pass arguments to `delete_job_template` via keyword arguments. Note that at
656
+ # least one keyword argument is required. To specify no parameters, or to keep all
657
+ # the default parameter values, pass an empty Hash as a request object (see above).
658
+ #
659
+ # @param name [::String]
660
+ # Required. The name of the job template to delete.
661
+ # `projects/{project}/locations/{location}/jobTemplates/{job_template}`
662
+ # @param allow_missing [::Boolean]
663
+ # If set to true, and the job template is not found, the request will succeed
664
+ # but no action will be taken on the server.
665
+ # @yield [result, operation] Access the result along with the TransportOperation object
666
+ # @yieldparam result [::Google::Protobuf::Empty]
667
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
668
+ #
669
+ # @return [::Google::Protobuf::Empty]
670
+ #
671
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
672
+ def delete_job_template request, options = nil
673
+ raise ::ArgumentError, "request must be provided" if request.nil?
674
+
675
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Video::Transcoder::V1::DeleteJobTemplateRequest
676
+
677
+ # Converts hash and nil to an options object
678
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
679
+
680
+ # Customize the options with defaults
681
+ call_metadata = @config.rpcs.delete_job_template.metadata.to_h
682
+
683
+ # Set x-goog-api-client and x-goog-user-project headers
684
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
685
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
686
+ gapic_version: ::Google::Cloud::Video::Transcoder::V1::VERSION,
687
+ transports_version_send: [:rest]
688
+
689
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
690
+
691
+ options.apply_defaults timeout: @config.rpcs.delete_job_template.timeout,
692
+ metadata: call_metadata,
693
+ retry_policy: @config.rpcs.delete_job_template.retry_policy
694
+
695
+ options.apply_defaults timeout: @config.timeout,
696
+ metadata: @config.metadata,
697
+ retry_policy: @config.retry_policy
698
+
699
+ @transcoder_service_stub.delete_job_template request, options do |result, operation|
700
+ yield result, operation if block_given?
701
+ return result
702
+ end
703
+ rescue ::Gapic::Rest::Error => e
704
+ raise ::Google::Cloud::Error.from_error(e)
705
+ end
706
+
707
+ ##
708
+ # Configuration class for the TranscoderService REST API.
709
+ #
710
+ # This class represents the configuration for TranscoderService REST,
711
+ # providing control over timeouts, retry behavior, logging, transport
712
+ # parameters, and other low-level controls. Certain parameters can also be
713
+ # applied individually to specific RPCs. See
714
+ # {::Google::Cloud::Video::Transcoder::V1::TranscoderService::Rest::Client::Configuration::Rpcs}
715
+ # for a list of RPCs that can be configured independently.
716
+ #
717
+ # Configuration can be applied globally to all clients, or to a single client
718
+ # on construction.
719
+ #
720
+ # @example
721
+ #
722
+ # # Modify the global config, setting the timeout for
723
+ # # create_job to 20 seconds,
724
+ # # and all remaining timeouts to 10 seconds.
725
+ # ::Google::Cloud::Video::Transcoder::V1::TranscoderService::Rest::Client.configure do |config|
726
+ # config.timeout = 10.0
727
+ # config.rpcs.create_job.timeout = 20.0
728
+ # end
729
+ #
730
+ # # Apply the above configuration only to a new client.
731
+ # client = ::Google::Cloud::Video::Transcoder::V1::TranscoderService::Rest::Client.new do |config|
732
+ # config.timeout = 10.0
733
+ # config.rpcs.create_job.timeout = 20.0
734
+ # end
735
+ #
736
+ # @!attribute [rw] endpoint
737
+ # The hostname or hostname:port of the service endpoint.
738
+ # Defaults to `"transcoder.googleapis.com"`.
739
+ # @return [::String]
740
+ # @!attribute [rw] credentials
741
+ # Credentials to send with calls. You may provide any of the following types:
742
+ # * (`String`) The path to a service account key file in JSON format
743
+ # * (`Hash`) A service account key as a Hash
744
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
745
+ # (see the [googleauth docs](https://googleapis.dev/ruby/googleauth/latest/index.html))
746
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
747
+ # (see the [signet docs](https://googleapis.dev/ruby/signet/latest/Signet/OAuth2/Client.html))
748
+ # * (`nil`) indicating no credentials
749
+ # @return [::Object]
750
+ # @!attribute [rw] scope
751
+ # The OAuth scopes
752
+ # @return [::Array<::String>]
753
+ # @!attribute [rw] lib_name
754
+ # The library name as recorded in instrumentation and logging
755
+ # @return [::String]
756
+ # @!attribute [rw] lib_version
757
+ # The library version as recorded in instrumentation and logging
758
+ # @return [::String]
759
+ # @!attribute [rw] timeout
760
+ # The call timeout in seconds.
761
+ # @return [::Numeric]
762
+ # @!attribute [rw] metadata
763
+ # Additional headers to be sent with the call.
764
+ # @return [::Hash{::Symbol=>::String}]
765
+ # @!attribute [rw] retry_policy
766
+ # The retry policy. The value is a hash with the following keys:
767
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
768
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
769
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
770
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
771
+ # trigger a retry.
772
+ # @return [::Hash]
773
+ # @!attribute [rw] quota_project
774
+ # A separate project against which to charge quota.
775
+ # @return [::String]
776
+ #
777
+ class Configuration
778
+ extend ::Gapic::Config
779
+
780
+ config_attr :endpoint, "transcoder.googleapis.com", ::String
781
+ config_attr :credentials, nil do |value|
782
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
783
+ allowed.any? { |klass| klass === value }
784
+ end
785
+ config_attr :scope, nil, ::String, ::Array, nil
786
+ config_attr :lib_name, nil, ::String, nil
787
+ config_attr :lib_version, nil, ::String, nil
788
+ config_attr :timeout, nil, ::Numeric, nil
789
+ config_attr :metadata, nil, ::Hash, nil
790
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
791
+ config_attr :quota_project, nil, ::String, nil
792
+
793
+ # @private
794
+ def initialize parent_config = nil
795
+ @parent_config = parent_config unless parent_config.nil?
796
+
797
+ yield self if block_given?
798
+ end
799
+
800
+ ##
801
+ # Configurations for individual RPCs
802
+ # @return [Rpcs]
803
+ #
804
+ def rpcs
805
+ @rpcs ||= begin
806
+ parent_rpcs = nil
807
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
808
+ Rpcs.new parent_rpcs
809
+ end
810
+ end
811
+
812
+ ##
813
+ # Configuration RPC class for the TranscoderService API.
814
+ #
815
+ # Includes fields providing the configuration for each RPC in this service.
816
+ # Each configuration object is of type `Gapic::Config::Method` and includes
817
+ # the following configuration fields:
818
+ #
819
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
820
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers
821
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
822
+ # include the following keys:
823
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
824
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
825
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
826
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
827
+ # trigger a retry.
828
+ #
829
+ class Rpcs
830
+ ##
831
+ # RPC-specific configuration for `create_job`
832
+ # @return [::Gapic::Config::Method]
833
+ #
834
+ attr_reader :create_job
835
+ ##
836
+ # RPC-specific configuration for `list_jobs`
837
+ # @return [::Gapic::Config::Method]
838
+ #
839
+ attr_reader :list_jobs
840
+ ##
841
+ # RPC-specific configuration for `get_job`
842
+ # @return [::Gapic::Config::Method]
843
+ #
844
+ attr_reader :get_job
845
+ ##
846
+ # RPC-specific configuration for `delete_job`
847
+ # @return [::Gapic::Config::Method]
848
+ #
849
+ attr_reader :delete_job
850
+ ##
851
+ # RPC-specific configuration for `create_job_template`
852
+ # @return [::Gapic::Config::Method]
853
+ #
854
+ attr_reader :create_job_template
855
+ ##
856
+ # RPC-specific configuration for `list_job_templates`
857
+ # @return [::Gapic::Config::Method]
858
+ #
859
+ attr_reader :list_job_templates
860
+ ##
861
+ # RPC-specific configuration for `get_job_template`
862
+ # @return [::Gapic::Config::Method]
863
+ #
864
+ attr_reader :get_job_template
865
+ ##
866
+ # RPC-specific configuration for `delete_job_template`
867
+ # @return [::Gapic::Config::Method]
868
+ #
869
+ attr_reader :delete_job_template
870
+
871
+ # @private
872
+ def initialize parent_rpcs = nil
873
+ create_job_config = parent_rpcs.create_job if parent_rpcs.respond_to? :create_job
874
+ @create_job = ::Gapic::Config::Method.new create_job_config
875
+ list_jobs_config = parent_rpcs.list_jobs if parent_rpcs.respond_to? :list_jobs
876
+ @list_jobs = ::Gapic::Config::Method.new list_jobs_config
877
+ get_job_config = parent_rpcs.get_job if parent_rpcs.respond_to? :get_job
878
+ @get_job = ::Gapic::Config::Method.new get_job_config
879
+ delete_job_config = parent_rpcs.delete_job if parent_rpcs.respond_to? :delete_job
880
+ @delete_job = ::Gapic::Config::Method.new delete_job_config
881
+ create_job_template_config = parent_rpcs.create_job_template if parent_rpcs.respond_to? :create_job_template
882
+ @create_job_template = ::Gapic::Config::Method.new create_job_template_config
883
+ list_job_templates_config = parent_rpcs.list_job_templates if parent_rpcs.respond_to? :list_job_templates
884
+ @list_job_templates = ::Gapic::Config::Method.new list_job_templates_config
885
+ get_job_template_config = parent_rpcs.get_job_template if parent_rpcs.respond_to? :get_job_template
886
+ @get_job_template = ::Gapic::Config::Method.new get_job_template_config
887
+ delete_job_template_config = parent_rpcs.delete_job_template if parent_rpcs.respond_to? :delete_job_template
888
+ @delete_job_template = ::Gapic::Config::Method.new delete_job_template_config
889
+
890
+ yield self if block_given?
891
+ end
892
+ end
893
+ end
894
+ end
895
+ end
896
+ end
897
+ end
898
+ end
899
+ end
900
+ end
901
+ end