google-cloud-tasks-v2beta3 0.8.0 → 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,1761 @@
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/tasks/v2beta3/cloudtasks_pb"
21
+ require "google/cloud/tasks/v2beta3/cloud_tasks/rest/service_stub"
22
+
23
+ module Google
24
+ module Cloud
25
+ module Tasks
26
+ module V2beta3
27
+ module CloudTasks
28
+ module Rest
29
+ ##
30
+ # REST client for the CloudTasks service.
31
+ #
32
+ # Cloud Tasks allows developers to manage the execution of background
33
+ # work in their applications.
34
+ #
35
+ class Client
36
+ include Paths
37
+
38
+ # @private
39
+ attr_reader :cloud_tasks_stub
40
+
41
+ ##
42
+ # Configure the CloudTasks Client class.
43
+ #
44
+ # See {::Google::Cloud::Tasks::V2beta3::CloudTasks::Rest::Client::Configuration}
45
+ # for a description of the configuration fields.
46
+ #
47
+ # @example
48
+ #
49
+ # # Modify the configuration for all CloudTasks clients
50
+ # ::Google::Cloud::Tasks::V2beta3::CloudTasks::Rest::Client.configure do |config|
51
+ # config.timeout = 10.0
52
+ # end
53
+ #
54
+ # @yield [config] Configure the Client client.
55
+ # @yieldparam config [Client::Configuration]
56
+ #
57
+ # @return [Client::Configuration]
58
+ #
59
+ def self.configure
60
+ @configure ||= begin
61
+ namespace = ["Google", "Cloud", "Tasks", "V2beta3"]
62
+ parent_config = while namespace.any?
63
+ parent_name = namespace.join "::"
64
+ parent_const = const_get parent_name
65
+ break parent_const.configure if parent_const.respond_to? :configure
66
+ namespace.pop
67
+ end
68
+ default_config = Client::Configuration.new parent_config
69
+
70
+ default_config.rpcs.list_queues.timeout = 20.0
71
+ default_config.rpcs.list_queues.retry_policy = {
72
+ initial_delay: 0.1, max_delay: 10.0, multiplier: 1.3, retry_codes: [4, 14]
73
+ }
74
+
75
+ default_config.rpcs.get_queue.timeout = 20.0
76
+ default_config.rpcs.get_queue.retry_policy = {
77
+ initial_delay: 0.1, max_delay: 10.0, multiplier: 1.3, retry_codes: [4, 14]
78
+ }
79
+
80
+ default_config.rpcs.create_queue.timeout = 20.0
81
+
82
+ default_config.rpcs.update_queue.timeout = 20.0
83
+
84
+ default_config.rpcs.delete_queue.timeout = 20.0
85
+ default_config.rpcs.delete_queue.retry_policy = {
86
+ initial_delay: 0.1, max_delay: 10.0, multiplier: 1.3, retry_codes: [4, 14]
87
+ }
88
+
89
+ default_config.rpcs.purge_queue.timeout = 20.0
90
+
91
+ default_config.rpcs.pause_queue.timeout = 20.0
92
+
93
+ default_config.rpcs.resume_queue.timeout = 20.0
94
+
95
+ default_config.rpcs.get_iam_policy.timeout = 20.0
96
+ default_config.rpcs.get_iam_policy.retry_policy = {
97
+ initial_delay: 0.1, max_delay: 10.0, multiplier: 1.3, retry_codes: [4, 14]
98
+ }
99
+
100
+ default_config.rpcs.set_iam_policy.timeout = 20.0
101
+
102
+ default_config.rpcs.test_iam_permissions.timeout = 20.0
103
+ default_config.rpcs.test_iam_permissions.retry_policy = {
104
+ initial_delay: 0.1, max_delay: 10.0, multiplier: 1.3, retry_codes: [4, 14]
105
+ }
106
+
107
+ default_config.rpcs.list_tasks.timeout = 20.0
108
+ default_config.rpcs.list_tasks.retry_policy = {
109
+ initial_delay: 0.1, max_delay: 10.0, multiplier: 1.3, retry_codes: [4, 14]
110
+ }
111
+
112
+ default_config.rpcs.get_task.timeout = 20.0
113
+ default_config.rpcs.get_task.retry_policy = {
114
+ initial_delay: 0.1, max_delay: 10.0, multiplier: 1.3, retry_codes: [4, 14]
115
+ }
116
+
117
+ default_config.rpcs.create_task.timeout = 20.0
118
+
119
+ default_config.rpcs.delete_task.timeout = 20.0
120
+ default_config.rpcs.delete_task.retry_policy = {
121
+ initial_delay: 0.1, max_delay: 10.0, multiplier: 1.3, retry_codes: [4, 14]
122
+ }
123
+
124
+ default_config.rpcs.run_task.timeout = 20.0
125
+
126
+ default_config
127
+ end
128
+ yield @configure if block_given?
129
+ @configure
130
+ end
131
+
132
+ ##
133
+ # Configure the CloudTasks Client instance.
134
+ #
135
+ # The configuration is set to the derived mode, meaning that values can be changed,
136
+ # but structural changes (adding new fields, etc.) are not allowed. Structural changes
137
+ # should be made on {Client.configure}.
138
+ #
139
+ # See {::Google::Cloud::Tasks::V2beta3::CloudTasks::Rest::Client::Configuration}
140
+ # for a description of the configuration fields.
141
+ #
142
+ # @yield [config] Configure the Client client.
143
+ # @yieldparam config [Client::Configuration]
144
+ #
145
+ # @return [Client::Configuration]
146
+ #
147
+ def configure
148
+ yield @config if block_given?
149
+ @config
150
+ end
151
+
152
+ ##
153
+ # Create a new CloudTasks REST client object.
154
+ #
155
+ # @example
156
+ #
157
+ # # Create a client using the default configuration
158
+ # client = ::Google::Cloud::Tasks::V2beta3::CloudTasks::Rest::Client.new
159
+ #
160
+ # # Create a client using a custom configuration
161
+ # client = ::Google::Cloud::Tasks::V2beta3::CloudTasks::Rest::Client.new do |config|
162
+ # config.timeout = 10.0
163
+ # end
164
+ #
165
+ # @yield [config] Configure the CloudTasks client.
166
+ # @yieldparam config [Client::Configuration]
167
+ #
168
+ def initialize
169
+ # Create the configuration object
170
+ @config = Configuration.new Client.configure
171
+
172
+ # Yield the configuration if needed
173
+ yield @config if block_given?
174
+
175
+ # Create credentials
176
+ credentials = @config.credentials
177
+ # Use self-signed JWT if the endpoint is unchanged from default,
178
+ # but only if the default endpoint does not have a region prefix.
179
+ enable_self_signed_jwt = @config.endpoint == Client.configure.endpoint &&
180
+ !@config.endpoint.split(".").first.include?("-")
181
+ credentials ||= Credentials.default scope: @config.scope,
182
+ enable_self_signed_jwt: enable_self_signed_jwt
183
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
184
+ credentials = Credentials.new credentials, scope: @config.scope
185
+ end
186
+
187
+ @quota_project_id = @config.quota_project
188
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
189
+
190
+ @cloud_tasks_stub = ::Google::Cloud::Tasks::V2beta3::CloudTasks::Rest::ServiceStub.new endpoint: @config.endpoint, credentials: credentials
191
+ end
192
+
193
+ # Service calls
194
+
195
+ ##
196
+ # Lists queues.
197
+ #
198
+ # Queues are returned in lexicographical order.
199
+ #
200
+ # @overload list_queues(request, options = nil)
201
+ # Pass arguments to `list_queues` via a request object, either of type
202
+ # {::Google::Cloud::Tasks::V2beta3::ListQueuesRequest} or an equivalent Hash.
203
+ #
204
+ # @param request [::Google::Cloud::Tasks::V2beta3::ListQueuesRequest, ::Hash]
205
+ # A request object representing the call parameters. Required. To specify no
206
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
207
+ # @param options [::Gapic::CallOptions, ::Hash]
208
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
209
+ #
210
+ # @overload list_queues(parent: nil, filter: nil, page_size: nil, page_token: nil, read_mask: nil)
211
+ # Pass arguments to `list_queues` via keyword arguments. Note that at
212
+ # least one keyword argument is required. To specify no parameters, or to keep all
213
+ # the default parameter values, pass an empty Hash as a request object (see above).
214
+ #
215
+ # @param parent [::String]
216
+ # Required. The location name.
217
+ # For example: `projects/PROJECT_ID/locations/LOCATION_ID`
218
+ # @param filter [::String]
219
+ # `filter` can be used to specify a subset of queues. Any {::Google::Cloud::Tasks::V2beta3::Queue Queue}
220
+ # field can be used as a filter and several operators as supported.
221
+ # For example: `<=, <, >=, >, !=, =, :`. The filter syntax is the same as
222
+ # described in
223
+ # [Stackdriver's Advanced Logs
224
+ # Filters](https://cloud.google.com/logging/docs/view/advanced_filters).
225
+ #
226
+ # Sample filter "state: PAUSED".
227
+ #
228
+ # Note that using filters might cause fewer queues than the
229
+ # requested page_size to be returned.
230
+ # @param page_size [::Integer]
231
+ # Requested page size.
232
+ #
233
+ # The maximum page size is 9800. If unspecified, the page size will
234
+ # be the maximum. Fewer queues than requested might be returned,
235
+ # even if more queues exist; use the
236
+ # {::Google::Cloud::Tasks::V2beta3::ListQueuesResponse#next_page_token next_page_token} in the
237
+ # response to determine if more queues exist.
238
+ # @param page_token [::String]
239
+ # A token identifying the page of results to return.
240
+ #
241
+ # To request the first page results, page_token must be empty. To
242
+ # request the next page of results, page_token must be the value of
243
+ # {::Google::Cloud::Tasks::V2beta3::ListQueuesResponse#next_page_token next_page_token} returned
244
+ # from the previous call to {::Google::Cloud::Tasks::V2beta3::CloudTasks::Rest::Client#list_queues ListQueues}
245
+ # method. It is an error to switch the value of the
246
+ # {::Google::Cloud::Tasks::V2beta3::ListQueuesRequest#filter filter} while iterating through pages.
247
+ # @param read_mask [::Google::Protobuf::FieldMask, ::Hash]
248
+ # Optional. Read mask is used for a more granular control over what the API returns.
249
+ # If the mask is not present all fields will be returned except
250
+ # [Queue.stats]. [Queue.stats] will be returned only if it was explicitly
251
+ # specified in the mask.
252
+ # @yield [result, operation] Access the result along with the TransportOperation object
253
+ # @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Tasks::V2beta3::Queue>]
254
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
255
+ #
256
+ # @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Tasks::V2beta3::Queue>]
257
+ #
258
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
259
+ def list_queues request, options = nil
260
+ raise ::ArgumentError, "request must be provided" if request.nil?
261
+
262
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Tasks::V2beta3::ListQueuesRequest
263
+
264
+ # Converts hash and nil to an options object
265
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
266
+
267
+ # Customize the options with defaults
268
+ call_metadata = @config.rpcs.list_queues.metadata.to_h
269
+
270
+ # Set x-goog-api-client and x-goog-user-project headers
271
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
272
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
273
+ gapic_version: ::Google::Cloud::Tasks::V2beta3::VERSION,
274
+ transports_version_send: [:rest]
275
+
276
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
277
+
278
+ options.apply_defaults timeout: @config.rpcs.list_queues.timeout,
279
+ metadata: call_metadata,
280
+ retry_policy: @config.rpcs.list_queues.retry_policy
281
+
282
+ options.apply_defaults timeout: @config.timeout,
283
+ metadata: @config.metadata,
284
+ retry_policy: @config.retry_policy
285
+
286
+ @cloud_tasks_stub.list_queues request, options do |result, operation|
287
+ result = ::Gapic::Rest::PagedEnumerable.new @cloud_tasks_stub, :list_queues, "queues", request, result, options
288
+ yield result, operation if block_given?
289
+ return result
290
+ end
291
+ rescue ::Gapic::Rest::Error => e
292
+ raise ::Google::Cloud::Error.from_error(e)
293
+ end
294
+
295
+ ##
296
+ # Gets a queue.
297
+ #
298
+ # @overload get_queue(request, options = nil)
299
+ # Pass arguments to `get_queue` via a request object, either of type
300
+ # {::Google::Cloud::Tasks::V2beta3::GetQueueRequest} or an equivalent Hash.
301
+ #
302
+ # @param request [::Google::Cloud::Tasks::V2beta3::GetQueueRequest, ::Hash]
303
+ # A request object representing the call parameters. Required. To specify no
304
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
305
+ # @param options [::Gapic::CallOptions, ::Hash]
306
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
307
+ #
308
+ # @overload get_queue(name: nil, read_mask: nil)
309
+ # Pass arguments to `get_queue` via keyword arguments. Note that at
310
+ # least one keyword argument is required. To specify no parameters, or to keep all
311
+ # the default parameter values, pass an empty Hash as a request object (see above).
312
+ #
313
+ # @param name [::String]
314
+ # Required. The resource name of the queue. For example:
315
+ # `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID`
316
+ # @param read_mask [::Google::Protobuf::FieldMask, ::Hash]
317
+ # Optional. Read mask is used for a more granular control over what the API returns.
318
+ # If the mask is not present all fields will be returned except
319
+ # [Queue.stats]. [Queue.stats] will be returned only if it was explicitly
320
+ # specified in the mask.
321
+ # @yield [result, operation] Access the result along with the TransportOperation object
322
+ # @yieldparam result [::Google::Cloud::Tasks::V2beta3::Queue]
323
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
324
+ #
325
+ # @return [::Google::Cloud::Tasks::V2beta3::Queue]
326
+ #
327
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
328
+ def get_queue request, options = nil
329
+ raise ::ArgumentError, "request must be provided" if request.nil?
330
+
331
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Tasks::V2beta3::GetQueueRequest
332
+
333
+ # Converts hash and nil to an options object
334
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
335
+
336
+ # Customize the options with defaults
337
+ call_metadata = @config.rpcs.get_queue.metadata.to_h
338
+
339
+ # Set x-goog-api-client and x-goog-user-project headers
340
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
341
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
342
+ gapic_version: ::Google::Cloud::Tasks::V2beta3::VERSION,
343
+ transports_version_send: [:rest]
344
+
345
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
346
+
347
+ options.apply_defaults timeout: @config.rpcs.get_queue.timeout,
348
+ metadata: call_metadata,
349
+ retry_policy: @config.rpcs.get_queue.retry_policy
350
+
351
+ options.apply_defaults timeout: @config.timeout,
352
+ metadata: @config.metadata,
353
+ retry_policy: @config.retry_policy
354
+
355
+ @cloud_tasks_stub.get_queue request, options do |result, operation|
356
+ yield result, operation if block_given?
357
+ return result
358
+ end
359
+ rescue ::Gapic::Rest::Error => e
360
+ raise ::Google::Cloud::Error.from_error(e)
361
+ end
362
+
363
+ ##
364
+ # Creates a queue.
365
+ #
366
+ # Queues created with this method allow tasks to live for a maximum of 31
367
+ # days. After a task is 31 days old, the task will be deleted regardless of whether
368
+ # it was dispatched or not.
369
+ #
370
+ # WARNING: Using this method may have unintended side effects if you are
371
+ # using an App Engine `queue.yaml` or `queue.xml` file to manage your queues.
372
+ # Read
373
+ # [Overview of Queue Management and
374
+ # queue.yaml](https://cloud.google.com/tasks/docs/queue-yaml) before using
375
+ # this method.
376
+ #
377
+ # @overload create_queue(request, options = nil)
378
+ # Pass arguments to `create_queue` via a request object, either of type
379
+ # {::Google::Cloud::Tasks::V2beta3::CreateQueueRequest} or an equivalent Hash.
380
+ #
381
+ # @param request [::Google::Cloud::Tasks::V2beta3::CreateQueueRequest, ::Hash]
382
+ # A request object representing the call parameters. Required. To specify no
383
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
384
+ # @param options [::Gapic::CallOptions, ::Hash]
385
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
386
+ #
387
+ # @overload create_queue(parent: nil, queue: nil)
388
+ # Pass arguments to `create_queue` via keyword arguments. Note that at
389
+ # least one keyword argument is required. To specify no parameters, or to keep all
390
+ # the default parameter values, pass an empty Hash as a request object (see above).
391
+ #
392
+ # @param parent [::String]
393
+ # Required. The location name in which the queue will be created.
394
+ # For example: `projects/PROJECT_ID/locations/LOCATION_ID`
395
+ #
396
+ # The list of allowed locations can be obtained by calling Cloud
397
+ # Tasks' implementation of
398
+ # [ListLocations][google.cloud.location.Locations.ListLocations].
399
+ # @param queue [::Google::Cloud::Tasks::V2beta3::Queue, ::Hash]
400
+ # Required. The queue to create.
401
+ #
402
+ # [Queue's name][google.cloud.tasks.v2beta3.Queue.name] cannot be the same as an existing queue.
403
+ # @yield [result, operation] Access the result along with the TransportOperation object
404
+ # @yieldparam result [::Google::Cloud::Tasks::V2beta3::Queue]
405
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
406
+ #
407
+ # @return [::Google::Cloud::Tasks::V2beta3::Queue]
408
+ #
409
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
410
+ def create_queue request, options = nil
411
+ raise ::ArgumentError, "request must be provided" if request.nil?
412
+
413
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Tasks::V2beta3::CreateQueueRequest
414
+
415
+ # Converts hash and nil to an options object
416
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
417
+
418
+ # Customize the options with defaults
419
+ call_metadata = @config.rpcs.create_queue.metadata.to_h
420
+
421
+ # Set x-goog-api-client and x-goog-user-project headers
422
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
423
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
424
+ gapic_version: ::Google::Cloud::Tasks::V2beta3::VERSION,
425
+ transports_version_send: [:rest]
426
+
427
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
428
+
429
+ options.apply_defaults timeout: @config.rpcs.create_queue.timeout,
430
+ metadata: call_metadata,
431
+ retry_policy: @config.rpcs.create_queue.retry_policy
432
+
433
+ options.apply_defaults timeout: @config.timeout,
434
+ metadata: @config.metadata,
435
+ retry_policy: @config.retry_policy
436
+
437
+ @cloud_tasks_stub.create_queue request, options do |result, operation|
438
+ yield result, operation if block_given?
439
+ return result
440
+ end
441
+ rescue ::Gapic::Rest::Error => e
442
+ raise ::Google::Cloud::Error.from_error(e)
443
+ end
444
+
445
+ ##
446
+ # Updates a queue.
447
+ #
448
+ # This method creates the queue if it does not exist and updates
449
+ # the queue if it does exist.
450
+ #
451
+ # Queues created with this method allow tasks to live for a maximum of 31
452
+ # days. After a task is 31 days old, the task will be deleted regardless of whether
453
+ # it was dispatched or not.
454
+ #
455
+ # WARNING: Using this method may have unintended side effects if you are
456
+ # using an App Engine `queue.yaml` or `queue.xml` file to manage your queues.
457
+ # Read
458
+ # [Overview of Queue Management and
459
+ # queue.yaml](https://cloud.google.com/tasks/docs/queue-yaml) before using
460
+ # this method.
461
+ #
462
+ # @overload update_queue(request, options = nil)
463
+ # Pass arguments to `update_queue` via a request object, either of type
464
+ # {::Google::Cloud::Tasks::V2beta3::UpdateQueueRequest} or an equivalent Hash.
465
+ #
466
+ # @param request [::Google::Cloud::Tasks::V2beta3::UpdateQueueRequest, ::Hash]
467
+ # A request object representing the call parameters. Required. To specify no
468
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
469
+ # @param options [::Gapic::CallOptions, ::Hash]
470
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
471
+ #
472
+ # @overload update_queue(queue: nil, update_mask: nil)
473
+ # Pass arguments to `update_queue` via keyword arguments. Note that at
474
+ # least one keyword argument is required. To specify no parameters, or to keep all
475
+ # the default parameter values, pass an empty Hash as a request object (see above).
476
+ #
477
+ # @param queue [::Google::Cloud::Tasks::V2beta3::Queue, ::Hash]
478
+ # Required. The queue to create or update.
479
+ #
480
+ # The queue's {::Google::Cloud::Tasks::V2beta3::Queue#name name} must be specified.
481
+ #
482
+ # Output only fields cannot be modified using UpdateQueue.
483
+ # Any value specified for an output only field will be ignored.
484
+ # The queue's {::Google::Cloud::Tasks::V2beta3::Queue#name name} cannot be changed.
485
+ # @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
486
+ # A mask used to specify which fields of the queue are being updated.
487
+ #
488
+ # If empty, then all fields will be updated.
489
+ # @yield [result, operation] Access the result along with the TransportOperation object
490
+ # @yieldparam result [::Google::Cloud::Tasks::V2beta3::Queue]
491
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
492
+ #
493
+ # @return [::Google::Cloud::Tasks::V2beta3::Queue]
494
+ #
495
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
496
+ def update_queue request, options = nil
497
+ raise ::ArgumentError, "request must be provided" if request.nil?
498
+
499
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Tasks::V2beta3::UpdateQueueRequest
500
+
501
+ # Converts hash and nil to an options object
502
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
503
+
504
+ # Customize the options with defaults
505
+ call_metadata = @config.rpcs.update_queue.metadata.to_h
506
+
507
+ # Set x-goog-api-client and x-goog-user-project headers
508
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
509
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
510
+ gapic_version: ::Google::Cloud::Tasks::V2beta3::VERSION,
511
+ transports_version_send: [:rest]
512
+
513
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
514
+
515
+ options.apply_defaults timeout: @config.rpcs.update_queue.timeout,
516
+ metadata: call_metadata,
517
+ retry_policy: @config.rpcs.update_queue.retry_policy
518
+
519
+ options.apply_defaults timeout: @config.timeout,
520
+ metadata: @config.metadata,
521
+ retry_policy: @config.retry_policy
522
+
523
+ @cloud_tasks_stub.update_queue request, options do |result, operation|
524
+ yield result, operation if block_given?
525
+ return result
526
+ end
527
+ rescue ::Gapic::Rest::Error => e
528
+ raise ::Google::Cloud::Error.from_error(e)
529
+ end
530
+
531
+ ##
532
+ # Deletes a queue.
533
+ #
534
+ # This command will delete the queue even if it has tasks in it.
535
+ #
536
+ # Note: If you delete a queue, a queue with the same name can't be created
537
+ # for 7 days.
538
+ #
539
+ # WARNING: Using this method may have unintended side effects if you are
540
+ # using an App Engine `queue.yaml` or `queue.xml` file to manage your queues.
541
+ # Read
542
+ # [Overview of Queue Management and
543
+ # queue.yaml](https://cloud.google.com/tasks/docs/queue-yaml) before using
544
+ # this method.
545
+ #
546
+ # @overload delete_queue(request, options = nil)
547
+ # Pass arguments to `delete_queue` via a request object, either of type
548
+ # {::Google::Cloud::Tasks::V2beta3::DeleteQueueRequest} or an equivalent Hash.
549
+ #
550
+ # @param request [::Google::Cloud::Tasks::V2beta3::DeleteQueueRequest, ::Hash]
551
+ # A request object representing the call parameters. Required. To specify no
552
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
553
+ # @param options [::Gapic::CallOptions, ::Hash]
554
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
555
+ #
556
+ # @overload delete_queue(name: nil)
557
+ # Pass arguments to `delete_queue` via keyword arguments. Note that at
558
+ # least one keyword argument is required. To specify no parameters, or to keep all
559
+ # the default parameter values, pass an empty Hash as a request object (see above).
560
+ #
561
+ # @param name [::String]
562
+ # Required. The queue name. For example:
563
+ # `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID`
564
+ # @yield [result, operation] Access the result along with the TransportOperation object
565
+ # @yieldparam result [::Google::Protobuf::Empty]
566
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
567
+ #
568
+ # @return [::Google::Protobuf::Empty]
569
+ #
570
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
571
+ def delete_queue request, options = nil
572
+ raise ::ArgumentError, "request must be provided" if request.nil?
573
+
574
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Tasks::V2beta3::DeleteQueueRequest
575
+
576
+ # Converts hash and nil to an options object
577
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
578
+
579
+ # Customize the options with defaults
580
+ call_metadata = @config.rpcs.delete_queue.metadata.to_h
581
+
582
+ # Set x-goog-api-client and x-goog-user-project headers
583
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
584
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
585
+ gapic_version: ::Google::Cloud::Tasks::V2beta3::VERSION,
586
+ transports_version_send: [:rest]
587
+
588
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
589
+
590
+ options.apply_defaults timeout: @config.rpcs.delete_queue.timeout,
591
+ metadata: call_metadata,
592
+ retry_policy: @config.rpcs.delete_queue.retry_policy
593
+
594
+ options.apply_defaults timeout: @config.timeout,
595
+ metadata: @config.metadata,
596
+ retry_policy: @config.retry_policy
597
+
598
+ @cloud_tasks_stub.delete_queue request, options do |result, operation|
599
+ yield result, operation if block_given?
600
+ return result
601
+ end
602
+ rescue ::Gapic::Rest::Error => e
603
+ raise ::Google::Cloud::Error.from_error(e)
604
+ end
605
+
606
+ ##
607
+ # Purges a queue by deleting all of its tasks.
608
+ #
609
+ # All tasks created before this method is called are permanently deleted.
610
+ #
611
+ # Purge operations can take up to one minute to take effect. Tasks
612
+ # might be dispatched before the purge takes effect. A purge is irreversible.
613
+ #
614
+ # @overload purge_queue(request, options = nil)
615
+ # Pass arguments to `purge_queue` via a request object, either of type
616
+ # {::Google::Cloud::Tasks::V2beta3::PurgeQueueRequest} or an equivalent Hash.
617
+ #
618
+ # @param request [::Google::Cloud::Tasks::V2beta3::PurgeQueueRequest, ::Hash]
619
+ # A request object representing the call parameters. Required. To specify no
620
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
621
+ # @param options [::Gapic::CallOptions, ::Hash]
622
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
623
+ #
624
+ # @overload purge_queue(name: nil)
625
+ # Pass arguments to `purge_queue` via keyword arguments. Note that at
626
+ # least one keyword argument is required. To specify no parameters, or to keep all
627
+ # the default parameter values, pass an empty Hash as a request object (see above).
628
+ #
629
+ # @param name [::String]
630
+ # Required. The queue name. For example:
631
+ # `projects/PROJECT_ID/location/LOCATION_ID/queues/QUEUE_ID`
632
+ # @yield [result, operation] Access the result along with the TransportOperation object
633
+ # @yieldparam result [::Google::Cloud::Tasks::V2beta3::Queue]
634
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
635
+ #
636
+ # @return [::Google::Cloud::Tasks::V2beta3::Queue]
637
+ #
638
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
639
+ def purge_queue request, options = nil
640
+ raise ::ArgumentError, "request must be provided" if request.nil?
641
+
642
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Tasks::V2beta3::PurgeQueueRequest
643
+
644
+ # Converts hash and nil to an options object
645
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
646
+
647
+ # Customize the options with defaults
648
+ call_metadata = @config.rpcs.purge_queue.metadata.to_h
649
+
650
+ # Set x-goog-api-client and x-goog-user-project headers
651
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
652
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
653
+ gapic_version: ::Google::Cloud::Tasks::V2beta3::VERSION,
654
+ transports_version_send: [:rest]
655
+
656
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
657
+
658
+ options.apply_defaults timeout: @config.rpcs.purge_queue.timeout,
659
+ metadata: call_metadata,
660
+ retry_policy: @config.rpcs.purge_queue.retry_policy
661
+
662
+ options.apply_defaults timeout: @config.timeout,
663
+ metadata: @config.metadata,
664
+ retry_policy: @config.retry_policy
665
+
666
+ @cloud_tasks_stub.purge_queue request, options do |result, operation|
667
+ yield result, operation if block_given?
668
+ return result
669
+ end
670
+ rescue ::Gapic::Rest::Error => e
671
+ raise ::Google::Cloud::Error.from_error(e)
672
+ end
673
+
674
+ ##
675
+ # Pauses the queue.
676
+ #
677
+ # If a queue is paused then the system will stop dispatching tasks
678
+ # until the queue is resumed via
679
+ # {::Google::Cloud::Tasks::V2beta3::CloudTasks::Rest::Client#resume_queue ResumeQueue}. Tasks can still be added
680
+ # when the queue is paused. A queue is paused if its
681
+ # {::Google::Cloud::Tasks::V2beta3::Queue#state state} is {::Google::Cloud::Tasks::V2beta3::Queue::State::PAUSED PAUSED}.
682
+ #
683
+ # @overload pause_queue(request, options = nil)
684
+ # Pass arguments to `pause_queue` via a request object, either of type
685
+ # {::Google::Cloud::Tasks::V2beta3::PauseQueueRequest} or an equivalent Hash.
686
+ #
687
+ # @param request [::Google::Cloud::Tasks::V2beta3::PauseQueueRequest, ::Hash]
688
+ # A request object representing the call parameters. Required. To specify no
689
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
690
+ # @param options [::Gapic::CallOptions, ::Hash]
691
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
692
+ #
693
+ # @overload pause_queue(name: nil)
694
+ # Pass arguments to `pause_queue` via keyword arguments. Note that at
695
+ # least one keyword argument is required. To specify no parameters, or to keep all
696
+ # the default parameter values, pass an empty Hash as a request object (see above).
697
+ #
698
+ # @param name [::String]
699
+ # Required. The queue name. For example:
700
+ # `projects/PROJECT_ID/location/LOCATION_ID/queues/QUEUE_ID`
701
+ # @yield [result, operation] Access the result along with the TransportOperation object
702
+ # @yieldparam result [::Google::Cloud::Tasks::V2beta3::Queue]
703
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
704
+ #
705
+ # @return [::Google::Cloud::Tasks::V2beta3::Queue]
706
+ #
707
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
708
+ def pause_queue request, options = nil
709
+ raise ::ArgumentError, "request must be provided" if request.nil?
710
+
711
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Tasks::V2beta3::PauseQueueRequest
712
+
713
+ # Converts hash and nil to an options object
714
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
715
+
716
+ # Customize the options with defaults
717
+ call_metadata = @config.rpcs.pause_queue.metadata.to_h
718
+
719
+ # Set x-goog-api-client and x-goog-user-project headers
720
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
721
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
722
+ gapic_version: ::Google::Cloud::Tasks::V2beta3::VERSION,
723
+ transports_version_send: [:rest]
724
+
725
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
726
+
727
+ options.apply_defaults timeout: @config.rpcs.pause_queue.timeout,
728
+ metadata: call_metadata,
729
+ retry_policy: @config.rpcs.pause_queue.retry_policy
730
+
731
+ options.apply_defaults timeout: @config.timeout,
732
+ metadata: @config.metadata,
733
+ retry_policy: @config.retry_policy
734
+
735
+ @cloud_tasks_stub.pause_queue request, options do |result, operation|
736
+ yield result, operation if block_given?
737
+ return result
738
+ end
739
+ rescue ::Gapic::Rest::Error => e
740
+ raise ::Google::Cloud::Error.from_error(e)
741
+ end
742
+
743
+ ##
744
+ # Resume a queue.
745
+ #
746
+ # This method resumes a queue after it has been
747
+ # {::Google::Cloud::Tasks::V2beta3::Queue::State::PAUSED PAUSED} or
748
+ # {::Google::Cloud::Tasks::V2beta3::Queue::State::DISABLED DISABLED}. The state of a queue is stored
749
+ # in the queue's {::Google::Cloud::Tasks::V2beta3::Queue#state state}; after calling this method it
750
+ # will be set to {::Google::Cloud::Tasks::V2beta3::Queue::State::RUNNING RUNNING}.
751
+ #
752
+ # WARNING: Resuming many high-QPS queues at the same time can
753
+ # lead to target overloading. If you are resuming high-QPS
754
+ # queues, follow the 500/50/5 pattern described in
755
+ # [Managing Cloud Tasks Scaling
756
+ # Risks](https://cloud.google.com/tasks/docs/manage-cloud-task-scaling).
757
+ #
758
+ # @overload resume_queue(request, options = nil)
759
+ # Pass arguments to `resume_queue` via a request object, either of type
760
+ # {::Google::Cloud::Tasks::V2beta3::ResumeQueueRequest} or an equivalent Hash.
761
+ #
762
+ # @param request [::Google::Cloud::Tasks::V2beta3::ResumeQueueRequest, ::Hash]
763
+ # A request object representing the call parameters. Required. To specify no
764
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
765
+ # @param options [::Gapic::CallOptions, ::Hash]
766
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
767
+ #
768
+ # @overload resume_queue(name: nil)
769
+ # Pass arguments to `resume_queue` via keyword arguments. Note that at
770
+ # least one keyword argument is required. To specify no parameters, or to keep all
771
+ # the default parameter values, pass an empty Hash as a request object (see above).
772
+ #
773
+ # @param name [::String]
774
+ # Required. The queue name. For example:
775
+ # `projects/PROJECT_ID/location/LOCATION_ID/queues/QUEUE_ID`
776
+ # @yield [result, operation] Access the result along with the TransportOperation object
777
+ # @yieldparam result [::Google::Cloud::Tasks::V2beta3::Queue]
778
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
779
+ #
780
+ # @return [::Google::Cloud::Tasks::V2beta3::Queue]
781
+ #
782
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
783
+ def resume_queue request, options = nil
784
+ raise ::ArgumentError, "request must be provided" if request.nil?
785
+
786
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Tasks::V2beta3::ResumeQueueRequest
787
+
788
+ # Converts hash and nil to an options object
789
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
790
+
791
+ # Customize the options with defaults
792
+ call_metadata = @config.rpcs.resume_queue.metadata.to_h
793
+
794
+ # Set x-goog-api-client and x-goog-user-project headers
795
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
796
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
797
+ gapic_version: ::Google::Cloud::Tasks::V2beta3::VERSION,
798
+ transports_version_send: [:rest]
799
+
800
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
801
+
802
+ options.apply_defaults timeout: @config.rpcs.resume_queue.timeout,
803
+ metadata: call_metadata,
804
+ retry_policy: @config.rpcs.resume_queue.retry_policy
805
+
806
+ options.apply_defaults timeout: @config.timeout,
807
+ metadata: @config.metadata,
808
+ retry_policy: @config.retry_policy
809
+
810
+ @cloud_tasks_stub.resume_queue request, options do |result, operation|
811
+ yield result, operation if block_given?
812
+ return result
813
+ end
814
+ rescue ::Gapic::Rest::Error => e
815
+ raise ::Google::Cloud::Error.from_error(e)
816
+ end
817
+
818
+ ##
819
+ # Gets the access control policy for a {::Google::Cloud::Tasks::V2beta3::Queue Queue}.
820
+ # Returns an empty policy if the resource exists and does not have a policy
821
+ # set.
822
+ #
823
+ # Authorization requires the following
824
+ # [Google IAM](https://cloud.google.com/iam) permission on the specified
825
+ # resource parent:
826
+ #
827
+ # * `cloudtasks.queues.getIamPolicy`
828
+ #
829
+ # @overload get_iam_policy(request, options = nil)
830
+ # Pass arguments to `get_iam_policy` via a request object, either of type
831
+ # {::Google::Iam::V1::GetIamPolicyRequest} or an equivalent Hash.
832
+ #
833
+ # @param request [::Google::Iam::V1::GetIamPolicyRequest, ::Hash]
834
+ # A request object representing the call parameters. Required. To specify no
835
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
836
+ # @param options [::Gapic::CallOptions, ::Hash]
837
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
838
+ #
839
+ # @overload get_iam_policy(resource: nil, options: nil)
840
+ # Pass arguments to `get_iam_policy` via keyword arguments. Note that at
841
+ # least one keyword argument is required. To specify no parameters, or to keep all
842
+ # the default parameter values, pass an empty Hash as a request object (see above).
843
+ #
844
+ # @param resource [::String]
845
+ # REQUIRED: The resource for which the policy is being requested.
846
+ # See the operation documentation for the appropriate value for this field.
847
+ # @param options [::Google::Iam::V1::GetPolicyOptions, ::Hash]
848
+ # OPTIONAL: A `GetPolicyOptions` object for specifying options to
849
+ # `GetIamPolicy`.
850
+ # @yield [result, operation] Access the result along with the TransportOperation object
851
+ # @yieldparam result [::Google::Iam::V1::Policy]
852
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
853
+ #
854
+ # @return [::Google::Iam::V1::Policy]
855
+ #
856
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
857
+ def get_iam_policy request, options = nil
858
+ raise ::ArgumentError, "request must be provided" if request.nil?
859
+
860
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Iam::V1::GetIamPolicyRequest
861
+
862
+ # Converts hash and nil to an options object
863
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
864
+
865
+ # Customize the options with defaults
866
+ call_metadata = @config.rpcs.get_iam_policy.metadata.to_h
867
+
868
+ # Set x-goog-api-client and x-goog-user-project headers
869
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
870
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
871
+ gapic_version: ::Google::Cloud::Tasks::V2beta3::VERSION,
872
+ transports_version_send: [:rest]
873
+
874
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
875
+
876
+ options.apply_defaults timeout: @config.rpcs.get_iam_policy.timeout,
877
+ metadata: call_metadata,
878
+ retry_policy: @config.rpcs.get_iam_policy.retry_policy
879
+
880
+ options.apply_defaults timeout: @config.timeout,
881
+ metadata: @config.metadata,
882
+ retry_policy: @config.retry_policy
883
+
884
+ @cloud_tasks_stub.get_iam_policy request, options do |result, operation|
885
+ yield result, operation if block_given?
886
+ return result
887
+ end
888
+ rescue ::Gapic::Rest::Error => e
889
+ raise ::Google::Cloud::Error.from_error(e)
890
+ end
891
+
892
+ ##
893
+ # Sets the access control policy for a {::Google::Cloud::Tasks::V2beta3::Queue Queue}. Replaces any existing
894
+ # policy.
895
+ #
896
+ # Note: The Cloud Console does not check queue-level IAM permissions yet.
897
+ # Project-level permissions are required to use the Cloud Console.
898
+ #
899
+ # Authorization requires the following
900
+ # [Google IAM](https://cloud.google.com/iam) permission on the specified
901
+ # resource parent:
902
+ #
903
+ # * `cloudtasks.queues.setIamPolicy`
904
+ #
905
+ # @overload set_iam_policy(request, options = nil)
906
+ # Pass arguments to `set_iam_policy` via a request object, either of type
907
+ # {::Google::Iam::V1::SetIamPolicyRequest} or an equivalent Hash.
908
+ #
909
+ # @param request [::Google::Iam::V1::SetIamPolicyRequest, ::Hash]
910
+ # A request object representing the call parameters. Required. To specify no
911
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
912
+ # @param options [::Gapic::CallOptions, ::Hash]
913
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
914
+ #
915
+ # @overload set_iam_policy(resource: nil, policy: nil, update_mask: nil)
916
+ # Pass arguments to `set_iam_policy` via keyword arguments. Note that at
917
+ # least one keyword argument is required. To specify no parameters, or to keep all
918
+ # the default parameter values, pass an empty Hash as a request object (see above).
919
+ #
920
+ # @param resource [::String]
921
+ # REQUIRED: The resource for which the policy is being specified.
922
+ # See the operation documentation for the appropriate value for this field.
923
+ # @param policy [::Google::Iam::V1::Policy, ::Hash]
924
+ # REQUIRED: The complete policy to be applied to the `resource`. The size of
925
+ # the policy is limited to a few 10s of KB. An empty policy is a
926
+ # valid policy but certain Cloud Platform services (such as Projects)
927
+ # might reject them.
928
+ # @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
929
+ # OPTIONAL: A FieldMask specifying which fields of the policy to modify. Only
930
+ # the fields in the mask will be modified. If no mask is provided, the
931
+ # following default mask is used:
932
+ #
933
+ # `paths: "bindings, etag"`
934
+ # @yield [result, operation] Access the result along with the TransportOperation object
935
+ # @yieldparam result [::Google::Iam::V1::Policy]
936
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
937
+ #
938
+ # @return [::Google::Iam::V1::Policy]
939
+ #
940
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
941
+ def set_iam_policy request, options = nil
942
+ raise ::ArgumentError, "request must be provided" if request.nil?
943
+
944
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Iam::V1::SetIamPolicyRequest
945
+
946
+ # Converts hash and nil to an options object
947
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
948
+
949
+ # Customize the options with defaults
950
+ call_metadata = @config.rpcs.set_iam_policy.metadata.to_h
951
+
952
+ # Set x-goog-api-client and x-goog-user-project headers
953
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
954
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
955
+ gapic_version: ::Google::Cloud::Tasks::V2beta3::VERSION,
956
+ transports_version_send: [:rest]
957
+
958
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
959
+
960
+ options.apply_defaults timeout: @config.rpcs.set_iam_policy.timeout,
961
+ metadata: call_metadata,
962
+ retry_policy: @config.rpcs.set_iam_policy.retry_policy
963
+
964
+ options.apply_defaults timeout: @config.timeout,
965
+ metadata: @config.metadata,
966
+ retry_policy: @config.retry_policy
967
+
968
+ @cloud_tasks_stub.set_iam_policy request, options do |result, operation|
969
+ yield result, operation if block_given?
970
+ return result
971
+ end
972
+ rescue ::Gapic::Rest::Error => e
973
+ raise ::Google::Cloud::Error.from_error(e)
974
+ end
975
+
976
+ ##
977
+ # Returns permissions that a caller has on a {::Google::Cloud::Tasks::V2beta3::Queue Queue}.
978
+ # If the resource does not exist, this will return an empty set of
979
+ # permissions, not a [NOT_FOUND][google.rpc.Code.NOT_FOUND] error.
980
+ #
981
+ # Note: This operation is designed to be used for building permission-aware
982
+ # UIs and command-line tools, not for authorization checking. This operation
983
+ # may "fail open" without warning.
984
+ #
985
+ # @overload test_iam_permissions(request, options = nil)
986
+ # Pass arguments to `test_iam_permissions` via a request object, either of type
987
+ # {::Google::Iam::V1::TestIamPermissionsRequest} or an equivalent Hash.
988
+ #
989
+ # @param request [::Google::Iam::V1::TestIamPermissionsRequest, ::Hash]
990
+ # A request object representing the call parameters. Required. To specify no
991
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
992
+ # @param options [::Gapic::CallOptions, ::Hash]
993
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
994
+ #
995
+ # @overload test_iam_permissions(resource: nil, permissions: nil)
996
+ # Pass arguments to `test_iam_permissions` via keyword arguments. Note that at
997
+ # least one keyword argument is required. To specify no parameters, or to keep all
998
+ # the default parameter values, pass an empty Hash as a request object (see above).
999
+ #
1000
+ # @param resource [::String]
1001
+ # REQUIRED: The resource for which the policy detail is being requested.
1002
+ # See the operation documentation for the appropriate value for this field.
1003
+ # @param permissions [::Array<::String>]
1004
+ # The set of permissions to check for the `resource`. Permissions with
1005
+ # wildcards (such as '*' or 'storage.*') are not allowed. For more
1006
+ # information see
1007
+ # [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions).
1008
+ # @yield [result, operation] Access the result along with the TransportOperation object
1009
+ # @yieldparam result [::Google::Iam::V1::TestIamPermissionsResponse]
1010
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
1011
+ #
1012
+ # @return [::Google::Iam::V1::TestIamPermissionsResponse]
1013
+ #
1014
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
1015
+ def test_iam_permissions request, options = nil
1016
+ raise ::ArgumentError, "request must be provided" if request.nil?
1017
+
1018
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Iam::V1::TestIamPermissionsRequest
1019
+
1020
+ # Converts hash and nil to an options object
1021
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1022
+
1023
+ # Customize the options with defaults
1024
+ call_metadata = @config.rpcs.test_iam_permissions.metadata.to_h
1025
+
1026
+ # Set x-goog-api-client and x-goog-user-project headers
1027
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1028
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1029
+ gapic_version: ::Google::Cloud::Tasks::V2beta3::VERSION,
1030
+ transports_version_send: [:rest]
1031
+
1032
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1033
+
1034
+ options.apply_defaults timeout: @config.rpcs.test_iam_permissions.timeout,
1035
+ metadata: call_metadata,
1036
+ retry_policy: @config.rpcs.test_iam_permissions.retry_policy
1037
+
1038
+ options.apply_defaults timeout: @config.timeout,
1039
+ metadata: @config.metadata,
1040
+ retry_policy: @config.retry_policy
1041
+
1042
+ @cloud_tasks_stub.test_iam_permissions request, options do |result, operation|
1043
+ yield result, operation if block_given?
1044
+ return result
1045
+ end
1046
+ rescue ::Gapic::Rest::Error => e
1047
+ raise ::Google::Cloud::Error.from_error(e)
1048
+ end
1049
+
1050
+ ##
1051
+ # Lists the tasks in a queue.
1052
+ #
1053
+ # By default, only the {::Google::Cloud::Tasks::V2beta3::Task::View::BASIC BASIC} view is retrieved
1054
+ # due to performance considerations;
1055
+ # {::Google::Cloud::Tasks::V2beta3::ListTasksRequest#response_view response_view} controls the
1056
+ # subset of information which is returned.
1057
+ #
1058
+ # The tasks may be returned in any order. The ordering may change at any
1059
+ # time.
1060
+ #
1061
+ # @overload list_tasks(request, options = nil)
1062
+ # Pass arguments to `list_tasks` via a request object, either of type
1063
+ # {::Google::Cloud::Tasks::V2beta3::ListTasksRequest} or an equivalent Hash.
1064
+ #
1065
+ # @param request [::Google::Cloud::Tasks::V2beta3::ListTasksRequest, ::Hash]
1066
+ # A request object representing the call parameters. Required. To specify no
1067
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1068
+ # @param options [::Gapic::CallOptions, ::Hash]
1069
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
1070
+ #
1071
+ # @overload list_tasks(parent: nil, response_view: nil, page_size: nil, page_token: nil)
1072
+ # Pass arguments to `list_tasks` via keyword arguments. Note that at
1073
+ # least one keyword argument is required. To specify no parameters, or to keep all
1074
+ # the default parameter values, pass an empty Hash as a request object (see above).
1075
+ #
1076
+ # @param parent [::String]
1077
+ # Required. The queue name. For example:
1078
+ # `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID`
1079
+ # @param response_view [::Google::Cloud::Tasks::V2beta3::Task::View]
1080
+ # The response_view specifies which subset of the {::Google::Cloud::Tasks::V2beta3::Task Task} will be
1081
+ # returned.
1082
+ #
1083
+ # By default response_view is {::Google::Cloud::Tasks::V2beta3::Task::View::BASIC BASIC}; not all
1084
+ # information is retrieved by default because some data, such as
1085
+ # payloads, might be desirable to return only when needed because
1086
+ # of its large size or because of the sensitivity of data that it
1087
+ # contains.
1088
+ #
1089
+ # Authorization for {::Google::Cloud::Tasks::V2beta3::Task::View::FULL FULL} requires
1090
+ # `cloudtasks.tasks.fullView` [Google IAM](https://cloud.google.com/iam/)
1091
+ # permission on the {::Google::Cloud::Tasks::V2beta3::Task Task} resource.
1092
+ # @param page_size [::Integer]
1093
+ # Maximum page size.
1094
+ #
1095
+ # Fewer tasks than requested might be returned, even if more tasks exist; use
1096
+ # {::Google::Cloud::Tasks::V2beta3::ListTasksResponse#next_page_token next_page_token} in the response to
1097
+ # determine if more tasks exist.
1098
+ #
1099
+ # The maximum page size is 1000. If unspecified, the page size will be the
1100
+ # maximum.
1101
+ # @param page_token [::String]
1102
+ # A token identifying the page of results to return.
1103
+ #
1104
+ # To request the first page results, page_token must be empty. To
1105
+ # request the next page of results, page_token must be the value of
1106
+ # {::Google::Cloud::Tasks::V2beta3::ListTasksResponse#next_page_token next_page_token} returned
1107
+ # from the previous call to {::Google::Cloud::Tasks::V2beta3::CloudTasks::Rest::Client#list_tasks ListTasks}
1108
+ # method.
1109
+ #
1110
+ # The page token is valid for only 2 hours.
1111
+ # @yield [result, operation] Access the result along with the TransportOperation object
1112
+ # @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Tasks::V2beta3::Task>]
1113
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
1114
+ #
1115
+ # @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Tasks::V2beta3::Task>]
1116
+ #
1117
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
1118
+ def list_tasks request, options = nil
1119
+ raise ::ArgumentError, "request must be provided" if request.nil?
1120
+
1121
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Tasks::V2beta3::ListTasksRequest
1122
+
1123
+ # Converts hash and nil to an options object
1124
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1125
+
1126
+ # Customize the options with defaults
1127
+ call_metadata = @config.rpcs.list_tasks.metadata.to_h
1128
+
1129
+ # Set x-goog-api-client and x-goog-user-project headers
1130
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1131
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1132
+ gapic_version: ::Google::Cloud::Tasks::V2beta3::VERSION,
1133
+ transports_version_send: [:rest]
1134
+
1135
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1136
+
1137
+ options.apply_defaults timeout: @config.rpcs.list_tasks.timeout,
1138
+ metadata: call_metadata,
1139
+ retry_policy: @config.rpcs.list_tasks.retry_policy
1140
+
1141
+ options.apply_defaults timeout: @config.timeout,
1142
+ metadata: @config.metadata,
1143
+ retry_policy: @config.retry_policy
1144
+
1145
+ @cloud_tasks_stub.list_tasks request, options do |result, operation|
1146
+ result = ::Gapic::Rest::PagedEnumerable.new @cloud_tasks_stub, :list_tasks, "tasks", request, result, options
1147
+ yield result, operation if block_given?
1148
+ return result
1149
+ end
1150
+ rescue ::Gapic::Rest::Error => e
1151
+ raise ::Google::Cloud::Error.from_error(e)
1152
+ end
1153
+
1154
+ ##
1155
+ # Gets a task.
1156
+ #
1157
+ # @overload get_task(request, options = nil)
1158
+ # Pass arguments to `get_task` via a request object, either of type
1159
+ # {::Google::Cloud::Tasks::V2beta3::GetTaskRequest} or an equivalent Hash.
1160
+ #
1161
+ # @param request [::Google::Cloud::Tasks::V2beta3::GetTaskRequest, ::Hash]
1162
+ # A request object representing the call parameters. Required. To specify no
1163
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1164
+ # @param options [::Gapic::CallOptions, ::Hash]
1165
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
1166
+ #
1167
+ # @overload get_task(name: nil, response_view: nil)
1168
+ # Pass arguments to `get_task` via keyword arguments. Note that at
1169
+ # least one keyword argument is required. To specify no parameters, or to keep all
1170
+ # the default parameter values, pass an empty Hash as a request object (see above).
1171
+ #
1172
+ # @param name [::String]
1173
+ # Required. The task name. For example:
1174
+ # `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID`
1175
+ # @param response_view [::Google::Cloud::Tasks::V2beta3::Task::View]
1176
+ # The response_view specifies which subset of the {::Google::Cloud::Tasks::V2beta3::Task Task} will be
1177
+ # returned.
1178
+ #
1179
+ # By default response_view is {::Google::Cloud::Tasks::V2beta3::Task::View::BASIC BASIC}; not all
1180
+ # information is retrieved by default because some data, such as
1181
+ # payloads, might be desirable to return only when needed because
1182
+ # of its large size or because of the sensitivity of data that it
1183
+ # contains.
1184
+ #
1185
+ # Authorization for {::Google::Cloud::Tasks::V2beta3::Task::View::FULL FULL} requires
1186
+ # `cloudtasks.tasks.fullView` [Google IAM](https://cloud.google.com/iam/)
1187
+ # permission on the {::Google::Cloud::Tasks::V2beta3::Task Task} resource.
1188
+ # @yield [result, operation] Access the result along with the TransportOperation object
1189
+ # @yieldparam result [::Google::Cloud::Tasks::V2beta3::Task]
1190
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
1191
+ #
1192
+ # @return [::Google::Cloud::Tasks::V2beta3::Task]
1193
+ #
1194
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
1195
+ def get_task request, options = nil
1196
+ raise ::ArgumentError, "request must be provided" if request.nil?
1197
+
1198
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Tasks::V2beta3::GetTaskRequest
1199
+
1200
+ # Converts hash and nil to an options object
1201
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1202
+
1203
+ # Customize the options with defaults
1204
+ call_metadata = @config.rpcs.get_task.metadata.to_h
1205
+
1206
+ # Set x-goog-api-client and x-goog-user-project headers
1207
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1208
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1209
+ gapic_version: ::Google::Cloud::Tasks::V2beta3::VERSION,
1210
+ transports_version_send: [:rest]
1211
+
1212
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1213
+
1214
+ options.apply_defaults timeout: @config.rpcs.get_task.timeout,
1215
+ metadata: call_metadata,
1216
+ retry_policy: @config.rpcs.get_task.retry_policy
1217
+
1218
+ options.apply_defaults timeout: @config.timeout,
1219
+ metadata: @config.metadata,
1220
+ retry_policy: @config.retry_policy
1221
+
1222
+ @cloud_tasks_stub.get_task request, options do |result, operation|
1223
+ yield result, operation if block_given?
1224
+ return result
1225
+ end
1226
+ rescue ::Gapic::Rest::Error => e
1227
+ raise ::Google::Cloud::Error.from_error(e)
1228
+ end
1229
+
1230
+ ##
1231
+ # Creates a task and adds it to a queue.
1232
+ #
1233
+ # Tasks cannot be updated after creation; there is no UpdateTask command.
1234
+ #
1235
+ # * The maximum task size is 100KB.
1236
+ #
1237
+ # @overload create_task(request, options = nil)
1238
+ # Pass arguments to `create_task` via a request object, either of type
1239
+ # {::Google::Cloud::Tasks::V2beta3::CreateTaskRequest} or an equivalent Hash.
1240
+ #
1241
+ # @param request [::Google::Cloud::Tasks::V2beta3::CreateTaskRequest, ::Hash]
1242
+ # A request object representing the call parameters. Required. To specify no
1243
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1244
+ # @param options [::Gapic::CallOptions, ::Hash]
1245
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
1246
+ #
1247
+ # @overload create_task(parent: nil, task: nil, response_view: nil)
1248
+ # Pass arguments to `create_task` via keyword arguments. Note that at
1249
+ # least one keyword argument is required. To specify no parameters, or to keep all
1250
+ # the default parameter values, pass an empty Hash as a request object (see above).
1251
+ #
1252
+ # @param parent [::String]
1253
+ # Required. The queue name. For example:
1254
+ # `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID`
1255
+ #
1256
+ # The queue must already exist.
1257
+ # @param task [::Google::Cloud::Tasks::V2beta3::Task, ::Hash]
1258
+ # Required. The task to add.
1259
+ #
1260
+ # Task names have the following format:
1261
+ # `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID`.
1262
+ # The user can optionally specify a task {::Google::Cloud::Tasks::V2beta3::Task#name name}. If a
1263
+ # name is not specified then the system will generate a random
1264
+ # unique task id, which will be set in the task returned in the
1265
+ # {::Google::Cloud::Tasks::V2beta3::Task#name response}.
1266
+ #
1267
+ # If {::Google::Cloud::Tasks::V2beta3::Task#schedule_time schedule_time} is not set or is in the
1268
+ # past then Cloud Tasks will set it to the current time.
1269
+ #
1270
+ # Task De-duplication:
1271
+ #
1272
+ # Explicitly specifying a task ID enables task de-duplication. If
1273
+ # a task's ID is identical to that of an existing task or a task
1274
+ # that was deleted or executed recently then the call will fail
1275
+ # with [ALREADY_EXISTS][google.rpc.Code.ALREADY_EXISTS].
1276
+ # If the task's queue was created using Cloud Tasks, then another task with
1277
+ # the same name can't be created for ~1hour after the original task was
1278
+ # deleted or executed. If the task's queue was created using queue.yaml or
1279
+ # queue.xml, then another task with the same name can't be created
1280
+ # for ~9days after the original task was deleted or executed.
1281
+ #
1282
+ # Because there is an extra lookup cost to identify duplicate task
1283
+ # names, these {::Google::Cloud::Tasks::V2beta3::CloudTasks::Rest::Client#create_task CreateTask} calls have significantly
1284
+ # increased latency. Using hashed strings for the task id or for
1285
+ # the prefix of the task id is recommended. Choosing task ids that
1286
+ # are sequential or have sequential prefixes, for example using a
1287
+ # timestamp, causes an increase in latency and error rates in all
1288
+ # task commands. The infrastructure relies on an approximately
1289
+ # uniform distribution of task ids to store and serve tasks
1290
+ # efficiently.
1291
+ # @param response_view [::Google::Cloud::Tasks::V2beta3::Task::View]
1292
+ # The response_view specifies which subset of the {::Google::Cloud::Tasks::V2beta3::Task Task} will be
1293
+ # returned.
1294
+ #
1295
+ # By default response_view is {::Google::Cloud::Tasks::V2beta3::Task::View::BASIC BASIC}; not all
1296
+ # information is retrieved by default because some data, such as
1297
+ # payloads, might be desirable to return only when needed because
1298
+ # of its large size or because of the sensitivity of data that it
1299
+ # contains.
1300
+ #
1301
+ # Authorization for {::Google::Cloud::Tasks::V2beta3::Task::View::FULL FULL} requires
1302
+ # `cloudtasks.tasks.fullView` [Google IAM](https://cloud.google.com/iam/)
1303
+ # permission on the {::Google::Cloud::Tasks::V2beta3::Task Task} resource.
1304
+ # @yield [result, operation] Access the result along with the TransportOperation object
1305
+ # @yieldparam result [::Google::Cloud::Tasks::V2beta3::Task]
1306
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
1307
+ #
1308
+ # @return [::Google::Cloud::Tasks::V2beta3::Task]
1309
+ #
1310
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
1311
+ def create_task request, options = nil
1312
+ raise ::ArgumentError, "request must be provided" if request.nil?
1313
+
1314
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Tasks::V2beta3::CreateTaskRequest
1315
+
1316
+ # Converts hash and nil to an options object
1317
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1318
+
1319
+ # Customize the options with defaults
1320
+ call_metadata = @config.rpcs.create_task.metadata.to_h
1321
+
1322
+ # Set x-goog-api-client and x-goog-user-project headers
1323
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1324
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1325
+ gapic_version: ::Google::Cloud::Tasks::V2beta3::VERSION,
1326
+ transports_version_send: [:rest]
1327
+
1328
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1329
+
1330
+ options.apply_defaults timeout: @config.rpcs.create_task.timeout,
1331
+ metadata: call_metadata,
1332
+ retry_policy: @config.rpcs.create_task.retry_policy
1333
+
1334
+ options.apply_defaults timeout: @config.timeout,
1335
+ metadata: @config.metadata,
1336
+ retry_policy: @config.retry_policy
1337
+
1338
+ @cloud_tasks_stub.create_task request, options do |result, operation|
1339
+ yield result, operation if block_given?
1340
+ return result
1341
+ end
1342
+ rescue ::Gapic::Rest::Error => e
1343
+ raise ::Google::Cloud::Error.from_error(e)
1344
+ end
1345
+
1346
+ ##
1347
+ # Deletes a task.
1348
+ #
1349
+ # A task can be deleted if it is scheduled or dispatched. A task
1350
+ # cannot be deleted if it has executed successfully or permanently
1351
+ # failed.
1352
+ #
1353
+ # @overload delete_task(request, options = nil)
1354
+ # Pass arguments to `delete_task` via a request object, either of type
1355
+ # {::Google::Cloud::Tasks::V2beta3::DeleteTaskRequest} or an equivalent Hash.
1356
+ #
1357
+ # @param request [::Google::Cloud::Tasks::V2beta3::DeleteTaskRequest, ::Hash]
1358
+ # A request object representing the call parameters. Required. To specify no
1359
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1360
+ # @param options [::Gapic::CallOptions, ::Hash]
1361
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
1362
+ #
1363
+ # @overload delete_task(name: nil)
1364
+ # Pass arguments to `delete_task` via keyword arguments. Note that at
1365
+ # least one keyword argument is required. To specify no parameters, or to keep all
1366
+ # the default parameter values, pass an empty Hash as a request object (see above).
1367
+ #
1368
+ # @param name [::String]
1369
+ # Required. The task name. For example:
1370
+ # `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID`
1371
+ # @yield [result, operation] Access the result along with the TransportOperation object
1372
+ # @yieldparam result [::Google::Protobuf::Empty]
1373
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
1374
+ #
1375
+ # @return [::Google::Protobuf::Empty]
1376
+ #
1377
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
1378
+ def delete_task request, options = nil
1379
+ raise ::ArgumentError, "request must be provided" if request.nil?
1380
+
1381
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Tasks::V2beta3::DeleteTaskRequest
1382
+
1383
+ # Converts hash and nil to an options object
1384
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1385
+
1386
+ # Customize the options with defaults
1387
+ call_metadata = @config.rpcs.delete_task.metadata.to_h
1388
+
1389
+ # Set x-goog-api-client and x-goog-user-project headers
1390
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1391
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1392
+ gapic_version: ::Google::Cloud::Tasks::V2beta3::VERSION,
1393
+ transports_version_send: [:rest]
1394
+
1395
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1396
+
1397
+ options.apply_defaults timeout: @config.rpcs.delete_task.timeout,
1398
+ metadata: call_metadata,
1399
+ retry_policy: @config.rpcs.delete_task.retry_policy
1400
+
1401
+ options.apply_defaults timeout: @config.timeout,
1402
+ metadata: @config.metadata,
1403
+ retry_policy: @config.retry_policy
1404
+
1405
+ @cloud_tasks_stub.delete_task request, options do |result, operation|
1406
+ yield result, operation if block_given?
1407
+ return result
1408
+ end
1409
+ rescue ::Gapic::Rest::Error => e
1410
+ raise ::Google::Cloud::Error.from_error(e)
1411
+ end
1412
+
1413
+ ##
1414
+ # Forces a task to run now.
1415
+ #
1416
+ # When this method is called, Cloud Tasks will dispatch the task, even if
1417
+ # the task is already running, the queue has reached its {::Google::Cloud::Tasks::V2beta3::RateLimits RateLimits} or
1418
+ # is {::Google::Cloud::Tasks::V2beta3::Queue::State::PAUSED PAUSED}.
1419
+ #
1420
+ # This command is meant to be used for manual debugging. For
1421
+ # example, {::Google::Cloud::Tasks::V2beta3::CloudTasks::Rest::Client#run_task RunTask} can be used to retry a failed
1422
+ # task after a fix has been made or to manually force a task to be
1423
+ # dispatched now.
1424
+ #
1425
+ # The dispatched task is returned. That is, the task that is returned
1426
+ # contains the [status][Task.status] after the task is dispatched but
1427
+ # before the task is received by its target.
1428
+ #
1429
+ # If Cloud Tasks receives a successful response from the task's
1430
+ # target, then the task will be deleted; otherwise the task's
1431
+ # {::Google::Cloud::Tasks::V2beta3::Task#schedule_time schedule_time} will be reset to the time that
1432
+ # {::Google::Cloud::Tasks::V2beta3::CloudTasks::Rest::Client#run_task RunTask} was called plus the retry delay specified
1433
+ # in the queue's {::Google::Cloud::Tasks::V2beta3::RetryConfig RetryConfig}.
1434
+ #
1435
+ # {::Google::Cloud::Tasks::V2beta3::CloudTasks::Rest::Client#run_task RunTask} returns
1436
+ # [NOT_FOUND][google.rpc.Code.NOT_FOUND] when it is called on a
1437
+ # task that has already succeeded or permanently failed.
1438
+ #
1439
+ # @overload run_task(request, options = nil)
1440
+ # Pass arguments to `run_task` via a request object, either of type
1441
+ # {::Google::Cloud::Tasks::V2beta3::RunTaskRequest} or an equivalent Hash.
1442
+ #
1443
+ # @param request [::Google::Cloud::Tasks::V2beta3::RunTaskRequest, ::Hash]
1444
+ # A request object representing the call parameters. Required. To specify no
1445
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1446
+ # @param options [::Gapic::CallOptions, ::Hash]
1447
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
1448
+ #
1449
+ # @overload run_task(name: nil, response_view: nil)
1450
+ # Pass arguments to `run_task` via keyword arguments. Note that at
1451
+ # least one keyword argument is required. To specify no parameters, or to keep all
1452
+ # the default parameter values, pass an empty Hash as a request object (see above).
1453
+ #
1454
+ # @param name [::String]
1455
+ # Required. The task name. For example:
1456
+ # `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID`
1457
+ # @param response_view [::Google::Cloud::Tasks::V2beta3::Task::View]
1458
+ # The response_view specifies which subset of the {::Google::Cloud::Tasks::V2beta3::Task Task} will be
1459
+ # returned.
1460
+ #
1461
+ # By default response_view is {::Google::Cloud::Tasks::V2beta3::Task::View::BASIC BASIC}; not all
1462
+ # information is retrieved by default because some data, such as
1463
+ # payloads, might be desirable to return only when needed because
1464
+ # of its large size or because of the sensitivity of data that it
1465
+ # contains.
1466
+ #
1467
+ # Authorization for {::Google::Cloud::Tasks::V2beta3::Task::View::FULL FULL} requires
1468
+ # `cloudtasks.tasks.fullView` [Google IAM](https://cloud.google.com/iam/)
1469
+ # permission on the {::Google::Cloud::Tasks::V2beta3::Task Task} resource.
1470
+ # @yield [result, operation] Access the result along with the TransportOperation object
1471
+ # @yieldparam result [::Google::Cloud::Tasks::V2beta3::Task]
1472
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
1473
+ #
1474
+ # @return [::Google::Cloud::Tasks::V2beta3::Task]
1475
+ #
1476
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
1477
+ def run_task request, options = nil
1478
+ raise ::ArgumentError, "request must be provided" if request.nil?
1479
+
1480
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Tasks::V2beta3::RunTaskRequest
1481
+
1482
+ # Converts hash and nil to an options object
1483
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1484
+
1485
+ # Customize the options with defaults
1486
+ call_metadata = @config.rpcs.run_task.metadata.to_h
1487
+
1488
+ # Set x-goog-api-client and x-goog-user-project headers
1489
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1490
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1491
+ gapic_version: ::Google::Cloud::Tasks::V2beta3::VERSION,
1492
+ transports_version_send: [:rest]
1493
+
1494
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1495
+
1496
+ options.apply_defaults timeout: @config.rpcs.run_task.timeout,
1497
+ metadata: call_metadata,
1498
+ retry_policy: @config.rpcs.run_task.retry_policy
1499
+
1500
+ options.apply_defaults timeout: @config.timeout,
1501
+ metadata: @config.metadata,
1502
+ retry_policy: @config.retry_policy
1503
+
1504
+ @cloud_tasks_stub.run_task request, options do |result, operation|
1505
+ yield result, operation if block_given?
1506
+ return result
1507
+ end
1508
+ rescue ::Gapic::Rest::Error => e
1509
+ raise ::Google::Cloud::Error.from_error(e)
1510
+ end
1511
+
1512
+ ##
1513
+ # Configuration class for the CloudTasks REST API.
1514
+ #
1515
+ # This class represents the configuration for CloudTasks REST,
1516
+ # providing control over timeouts, retry behavior, logging, transport
1517
+ # parameters, and other low-level controls. Certain parameters can also be
1518
+ # applied individually to specific RPCs. See
1519
+ # {::Google::Cloud::Tasks::V2beta3::CloudTasks::Rest::Client::Configuration::Rpcs}
1520
+ # for a list of RPCs that can be configured independently.
1521
+ #
1522
+ # Configuration can be applied globally to all clients, or to a single client
1523
+ # on construction.
1524
+ #
1525
+ # @example
1526
+ #
1527
+ # # Modify the global config, setting the timeout for
1528
+ # # list_queues to 20 seconds,
1529
+ # # and all remaining timeouts to 10 seconds.
1530
+ # ::Google::Cloud::Tasks::V2beta3::CloudTasks::Rest::Client.configure do |config|
1531
+ # config.timeout = 10.0
1532
+ # config.rpcs.list_queues.timeout = 20.0
1533
+ # end
1534
+ #
1535
+ # # Apply the above configuration only to a new client.
1536
+ # client = ::Google::Cloud::Tasks::V2beta3::CloudTasks::Rest::Client.new do |config|
1537
+ # config.timeout = 10.0
1538
+ # config.rpcs.list_queues.timeout = 20.0
1539
+ # end
1540
+ #
1541
+ # @!attribute [rw] endpoint
1542
+ # The hostname or hostname:port of the service endpoint.
1543
+ # Defaults to `"cloudtasks.googleapis.com"`.
1544
+ # @return [::String]
1545
+ # @!attribute [rw] credentials
1546
+ # Credentials to send with calls. You may provide any of the following types:
1547
+ # * (`String`) The path to a service account key file in JSON format
1548
+ # * (`Hash`) A service account key as a Hash
1549
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
1550
+ # (see the [googleauth docs](https://googleapis.dev/ruby/googleauth/latest/index.html))
1551
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
1552
+ # (see the [signet docs](https://googleapis.dev/ruby/signet/latest/Signet/OAuth2/Client.html))
1553
+ # * (`nil`) indicating no credentials
1554
+ # @return [::Object]
1555
+ # @!attribute [rw] scope
1556
+ # The OAuth scopes
1557
+ # @return [::Array<::String>]
1558
+ # @!attribute [rw] lib_name
1559
+ # The library name as recorded in instrumentation and logging
1560
+ # @return [::String]
1561
+ # @!attribute [rw] lib_version
1562
+ # The library version as recorded in instrumentation and logging
1563
+ # @return [::String]
1564
+ # @!attribute [rw] timeout
1565
+ # The call timeout in seconds.
1566
+ # @return [::Numeric]
1567
+ # @!attribute [rw] metadata
1568
+ # Additional headers to be sent with the call.
1569
+ # @return [::Hash{::Symbol=>::String}]
1570
+ # @!attribute [rw] retry_policy
1571
+ # The retry policy. The value is a hash with the following keys:
1572
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
1573
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
1574
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
1575
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
1576
+ # trigger a retry.
1577
+ # @return [::Hash]
1578
+ # @!attribute [rw] quota_project
1579
+ # A separate project against which to charge quota.
1580
+ # @return [::String]
1581
+ #
1582
+ class Configuration
1583
+ extend ::Gapic::Config
1584
+
1585
+ config_attr :endpoint, "cloudtasks.googleapis.com", ::String
1586
+ config_attr :credentials, nil do |value|
1587
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
1588
+ allowed.any? { |klass| klass === value }
1589
+ end
1590
+ config_attr :scope, nil, ::String, ::Array, nil
1591
+ config_attr :lib_name, nil, ::String, nil
1592
+ config_attr :lib_version, nil, ::String, nil
1593
+ config_attr :timeout, nil, ::Numeric, nil
1594
+ config_attr :metadata, nil, ::Hash, nil
1595
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
1596
+ config_attr :quota_project, nil, ::String, nil
1597
+
1598
+ # @private
1599
+ def initialize parent_config = nil
1600
+ @parent_config = parent_config unless parent_config.nil?
1601
+
1602
+ yield self if block_given?
1603
+ end
1604
+
1605
+ ##
1606
+ # Configurations for individual RPCs
1607
+ # @return [Rpcs]
1608
+ #
1609
+ def rpcs
1610
+ @rpcs ||= begin
1611
+ parent_rpcs = nil
1612
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
1613
+ Rpcs.new parent_rpcs
1614
+ end
1615
+ end
1616
+
1617
+ ##
1618
+ # Configuration RPC class for the CloudTasks API.
1619
+ #
1620
+ # Includes fields providing the configuration for each RPC in this service.
1621
+ # Each configuration object is of type `Gapic::Config::Method` and includes
1622
+ # the following configuration fields:
1623
+ #
1624
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
1625
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers
1626
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
1627
+ # include the following keys:
1628
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
1629
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
1630
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
1631
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
1632
+ # trigger a retry.
1633
+ #
1634
+ class Rpcs
1635
+ ##
1636
+ # RPC-specific configuration for `list_queues`
1637
+ # @return [::Gapic::Config::Method]
1638
+ #
1639
+ attr_reader :list_queues
1640
+ ##
1641
+ # RPC-specific configuration for `get_queue`
1642
+ # @return [::Gapic::Config::Method]
1643
+ #
1644
+ attr_reader :get_queue
1645
+ ##
1646
+ # RPC-specific configuration for `create_queue`
1647
+ # @return [::Gapic::Config::Method]
1648
+ #
1649
+ attr_reader :create_queue
1650
+ ##
1651
+ # RPC-specific configuration for `update_queue`
1652
+ # @return [::Gapic::Config::Method]
1653
+ #
1654
+ attr_reader :update_queue
1655
+ ##
1656
+ # RPC-specific configuration for `delete_queue`
1657
+ # @return [::Gapic::Config::Method]
1658
+ #
1659
+ attr_reader :delete_queue
1660
+ ##
1661
+ # RPC-specific configuration for `purge_queue`
1662
+ # @return [::Gapic::Config::Method]
1663
+ #
1664
+ attr_reader :purge_queue
1665
+ ##
1666
+ # RPC-specific configuration for `pause_queue`
1667
+ # @return [::Gapic::Config::Method]
1668
+ #
1669
+ attr_reader :pause_queue
1670
+ ##
1671
+ # RPC-specific configuration for `resume_queue`
1672
+ # @return [::Gapic::Config::Method]
1673
+ #
1674
+ attr_reader :resume_queue
1675
+ ##
1676
+ # RPC-specific configuration for `get_iam_policy`
1677
+ # @return [::Gapic::Config::Method]
1678
+ #
1679
+ attr_reader :get_iam_policy
1680
+ ##
1681
+ # RPC-specific configuration for `set_iam_policy`
1682
+ # @return [::Gapic::Config::Method]
1683
+ #
1684
+ attr_reader :set_iam_policy
1685
+ ##
1686
+ # RPC-specific configuration for `test_iam_permissions`
1687
+ # @return [::Gapic::Config::Method]
1688
+ #
1689
+ attr_reader :test_iam_permissions
1690
+ ##
1691
+ # RPC-specific configuration for `list_tasks`
1692
+ # @return [::Gapic::Config::Method]
1693
+ #
1694
+ attr_reader :list_tasks
1695
+ ##
1696
+ # RPC-specific configuration for `get_task`
1697
+ # @return [::Gapic::Config::Method]
1698
+ #
1699
+ attr_reader :get_task
1700
+ ##
1701
+ # RPC-specific configuration for `create_task`
1702
+ # @return [::Gapic::Config::Method]
1703
+ #
1704
+ attr_reader :create_task
1705
+ ##
1706
+ # RPC-specific configuration for `delete_task`
1707
+ # @return [::Gapic::Config::Method]
1708
+ #
1709
+ attr_reader :delete_task
1710
+ ##
1711
+ # RPC-specific configuration for `run_task`
1712
+ # @return [::Gapic::Config::Method]
1713
+ #
1714
+ attr_reader :run_task
1715
+
1716
+ # @private
1717
+ def initialize parent_rpcs = nil
1718
+ list_queues_config = parent_rpcs.list_queues if parent_rpcs.respond_to? :list_queues
1719
+ @list_queues = ::Gapic::Config::Method.new list_queues_config
1720
+ get_queue_config = parent_rpcs.get_queue if parent_rpcs.respond_to? :get_queue
1721
+ @get_queue = ::Gapic::Config::Method.new get_queue_config
1722
+ create_queue_config = parent_rpcs.create_queue if parent_rpcs.respond_to? :create_queue
1723
+ @create_queue = ::Gapic::Config::Method.new create_queue_config
1724
+ update_queue_config = parent_rpcs.update_queue if parent_rpcs.respond_to? :update_queue
1725
+ @update_queue = ::Gapic::Config::Method.new update_queue_config
1726
+ delete_queue_config = parent_rpcs.delete_queue if parent_rpcs.respond_to? :delete_queue
1727
+ @delete_queue = ::Gapic::Config::Method.new delete_queue_config
1728
+ purge_queue_config = parent_rpcs.purge_queue if parent_rpcs.respond_to? :purge_queue
1729
+ @purge_queue = ::Gapic::Config::Method.new purge_queue_config
1730
+ pause_queue_config = parent_rpcs.pause_queue if parent_rpcs.respond_to? :pause_queue
1731
+ @pause_queue = ::Gapic::Config::Method.new pause_queue_config
1732
+ resume_queue_config = parent_rpcs.resume_queue if parent_rpcs.respond_to? :resume_queue
1733
+ @resume_queue = ::Gapic::Config::Method.new resume_queue_config
1734
+ get_iam_policy_config = parent_rpcs.get_iam_policy if parent_rpcs.respond_to? :get_iam_policy
1735
+ @get_iam_policy = ::Gapic::Config::Method.new get_iam_policy_config
1736
+ set_iam_policy_config = parent_rpcs.set_iam_policy if parent_rpcs.respond_to? :set_iam_policy
1737
+ @set_iam_policy = ::Gapic::Config::Method.new set_iam_policy_config
1738
+ test_iam_permissions_config = parent_rpcs.test_iam_permissions if parent_rpcs.respond_to? :test_iam_permissions
1739
+ @test_iam_permissions = ::Gapic::Config::Method.new test_iam_permissions_config
1740
+ list_tasks_config = parent_rpcs.list_tasks if parent_rpcs.respond_to? :list_tasks
1741
+ @list_tasks = ::Gapic::Config::Method.new list_tasks_config
1742
+ get_task_config = parent_rpcs.get_task if parent_rpcs.respond_to? :get_task
1743
+ @get_task = ::Gapic::Config::Method.new get_task_config
1744
+ create_task_config = parent_rpcs.create_task if parent_rpcs.respond_to? :create_task
1745
+ @create_task = ::Gapic::Config::Method.new create_task_config
1746
+ delete_task_config = parent_rpcs.delete_task if parent_rpcs.respond_to? :delete_task
1747
+ @delete_task = ::Gapic::Config::Method.new delete_task_config
1748
+ run_task_config = parent_rpcs.run_task if parent_rpcs.respond_to? :run_task
1749
+ @run_task = ::Gapic::Config::Method.new run_task_config
1750
+
1751
+ yield self if block_given?
1752
+ end
1753
+ end
1754
+ end
1755
+ end
1756
+ end
1757
+ end
1758
+ end
1759
+ end
1760
+ end
1761
+ end