google-apis-cloudtasks_v2beta2 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,943 @@
1
+ # Copyright 2020 Google LLC
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ require 'google/apis/core/base_service'
16
+ require 'google/apis/core/json_representation'
17
+ require 'google/apis/core/hashable'
18
+ require 'google/apis/errors'
19
+
20
+ module Google
21
+ module Apis
22
+ module CloudtasksV2beta2
23
+ # Cloud Tasks API
24
+ #
25
+ # Manages the execution of large numbers of distributed requests.
26
+ #
27
+ # @example
28
+ # require 'google/apis/cloudtasks_v2beta2'
29
+ #
30
+ # Cloudtasks = Google::Apis::CloudtasksV2beta2 # Alias the module
31
+ # service = Cloudtasks::CloudTasksService.new
32
+ #
33
+ # @see https://cloud.google.com/tasks/
34
+ class CloudTasksService < Google::Apis::Core::BaseService
35
+ # @return [String]
36
+ # API key. Your API key identifies your project and provides you with API access,
37
+ # quota, and reports. Required unless you provide an OAuth 2.0 token.
38
+ attr_accessor :key
39
+
40
+ # @return [String]
41
+ # Available to use for quota purposes for server-side applications. Can be any
42
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
43
+ attr_accessor :quota_user
44
+
45
+ def initialize
46
+ super('https://cloudtasks.googleapis.com/', '',
47
+ client_name: 'google-apis-cloudtasks_v2beta2',
48
+ client_version: Google::Apis::CloudtasksV2beta2::GEM_VERSION)
49
+ @batch_path = 'batch'
50
+ end
51
+
52
+ # Gets information about a location.
53
+ # @param [String] name
54
+ # Resource name for the location.
55
+ # @param [String] fields
56
+ # Selector specifying which fields to include in a partial response.
57
+ # @param [String] quota_user
58
+ # Available to use for quota purposes for server-side applications. Can be any
59
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
60
+ # @param [Google::Apis::RequestOptions] options
61
+ # Request-specific options
62
+ #
63
+ # @yield [result, err] Result & error if block supplied
64
+ # @yieldparam result [Google::Apis::CloudtasksV2beta2::Location] parsed result object
65
+ # @yieldparam err [StandardError] error object if request failed
66
+ #
67
+ # @return [Google::Apis::CloudtasksV2beta2::Location]
68
+ #
69
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
70
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
71
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
72
+ def get_project_location(name, fields: nil, quota_user: nil, options: nil, &block)
73
+ command = make_simple_command(:get, 'v2beta2/{+name}', options)
74
+ command.response_representation = Google::Apis::CloudtasksV2beta2::Location::Representation
75
+ command.response_class = Google::Apis::CloudtasksV2beta2::Location
76
+ command.params['name'] = name unless name.nil?
77
+ command.query['fields'] = fields unless fields.nil?
78
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
79
+ execute_or_queue_command(command, &block)
80
+ end
81
+
82
+ # Lists information about the supported locations for this service.
83
+ # @param [String] name
84
+ # The resource that owns the locations collection, if applicable.
85
+ # @param [String] filter
86
+ # The standard list filter.
87
+ # @param [Fixnum] page_size
88
+ # The standard list page size.
89
+ # @param [String] page_token
90
+ # The standard list page token.
91
+ # @param [String] fields
92
+ # Selector specifying which fields to include in a partial response.
93
+ # @param [String] quota_user
94
+ # Available to use for quota purposes for server-side applications. Can be any
95
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
96
+ # @param [Google::Apis::RequestOptions] options
97
+ # Request-specific options
98
+ #
99
+ # @yield [result, err] Result & error if block supplied
100
+ # @yieldparam result [Google::Apis::CloudtasksV2beta2::ListLocationsResponse] parsed result object
101
+ # @yieldparam err [StandardError] error object if request failed
102
+ #
103
+ # @return [Google::Apis::CloudtasksV2beta2::ListLocationsResponse]
104
+ #
105
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
106
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
107
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
108
+ def list_project_locations(name, filter: nil, page_size: nil, page_token: nil, fields: nil, quota_user: nil, options: nil, &block)
109
+ command = make_simple_command(:get, 'v2beta2/{+name}/locations', options)
110
+ command.response_representation = Google::Apis::CloudtasksV2beta2::ListLocationsResponse::Representation
111
+ command.response_class = Google::Apis::CloudtasksV2beta2::ListLocationsResponse
112
+ command.params['name'] = name unless name.nil?
113
+ command.query['filter'] = filter unless filter.nil?
114
+ command.query['pageSize'] = page_size unless page_size.nil?
115
+ command.query['pageToken'] = page_token unless page_token.nil?
116
+ command.query['fields'] = fields unless fields.nil?
117
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
118
+ execute_or_queue_command(command, &block)
119
+ end
120
+
121
+ # Creates a queue. Queues created with this method allow tasks to live for a
122
+ # maximum of 31 days. After a task is 31 days old, the task will be deleted
123
+ # regardless of whether it was dispatched or not. WARNING: Using this method may
124
+ # have unintended side effects if you are using an App Engine `queue.yaml` or `
125
+ # queue.xml` file to manage your queues. Read [Overview of Queue Management and
126
+ # queue.yaml](https://cloud.google.com/tasks/docs/queue-yaml) before using this
127
+ # method.
128
+ # @param [String] parent
129
+ # Required. The location name in which the queue will be created. For example: `
130
+ # projects/PROJECT_ID/locations/LOCATION_ID` The list of allowed locations can
131
+ # be obtained by calling Cloud Tasks' implementation of ListLocations.
132
+ # @param [Google::Apis::CloudtasksV2beta2::Queue] queue_object
133
+ # @param [String] fields
134
+ # Selector specifying which fields to include in a partial response.
135
+ # @param [String] quota_user
136
+ # Available to use for quota purposes for server-side applications. Can be any
137
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
138
+ # @param [Google::Apis::RequestOptions] options
139
+ # Request-specific options
140
+ #
141
+ # @yield [result, err] Result & error if block supplied
142
+ # @yieldparam result [Google::Apis::CloudtasksV2beta2::Queue] parsed result object
143
+ # @yieldparam err [StandardError] error object if request failed
144
+ #
145
+ # @return [Google::Apis::CloudtasksV2beta2::Queue]
146
+ #
147
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
148
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
149
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
150
+ def create_project_location_queue(parent, queue_object = nil, fields: nil, quota_user: nil, options: nil, &block)
151
+ command = make_simple_command(:post, 'v2beta2/{+parent}/queues', options)
152
+ command.request_representation = Google::Apis::CloudtasksV2beta2::Queue::Representation
153
+ command.request_object = queue_object
154
+ command.response_representation = Google::Apis::CloudtasksV2beta2::Queue::Representation
155
+ command.response_class = Google::Apis::CloudtasksV2beta2::Queue
156
+ command.params['parent'] = parent unless parent.nil?
157
+ command.query['fields'] = fields unless fields.nil?
158
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
159
+ execute_or_queue_command(command, &block)
160
+ end
161
+
162
+ # Deletes a queue. This command will delete the queue even if it has tasks in it.
163
+ # Note: If you delete a queue, a queue with the same name can't be created for
164
+ # 7 days. WARNING: Using this method may have unintended side effects if you are
165
+ # using an App Engine `queue.yaml` or `queue.xml` file to manage your queues.
166
+ # Read [Overview of Queue Management and queue.yaml](https://cloud.google.com/
167
+ # tasks/docs/queue-yaml) before using this method.
168
+ # @param [String] name
169
+ # Required. The queue name. For example: `projects/PROJECT_ID/locations/
170
+ # LOCATION_ID/queues/QUEUE_ID`
171
+ # @param [String] fields
172
+ # Selector specifying which fields to include in a partial response.
173
+ # @param [String] quota_user
174
+ # Available to use for quota purposes for server-side applications. Can be any
175
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
176
+ # @param [Google::Apis::RequestOptions] options
177
+ # Request-specific options
178
+ #
179
+ # @yield [result, err] Result & error if block supplied
180
+ # @yieldparam result [Google::Apis::CloudtasksV2beta2::Empty] parsed result object
181
+ # @yieldparam err [StandardError] error object if request failed
182
+ #
183
+ # @return [Google::Apis::CloudtasksV2beta2::Empty]
184
+ #
185
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
186
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
187
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
188
+ def delete_project_location_queue(name, fields: nil, quota_user: nil, options: nil, &block)
189
+ command = make_simple_command(:delete, 'v2beta2/{+name}', options)
190
+ command.response_representation = Google::Apis::CloudtasksV2beta2::Empty::Representation
191
+ command.response_class = Google::Apis::CloudtasksV2beta2::Empty
192
+ command.params['name'] = name unless name.nil?
193
+ command.query['fields'] = fields unless fields.nil?
194
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
195
+ execute_or_queue_command(command, &block)
196
+ end
197
+
198
+ # Gets a queue.
199
+ # @param [String] name
200
+ # Required. The resource name of the queue. For example: `projects/PROJECT_ID/
201
+ # locations/LOCATION_ID/queues/QUEUE_ID`
202
+ # @param [String] read_mask
203
+ # Optional. Read mask is used for a more granular control over what the API
204
+ # returns. If the mask is not present all fields will be returned except [Queue.
205
+ # stats], if the mask is set to "*" all fields including [Queue.stats] will be
206
+ # returned, otherwise only the fields explicitly specified in the mask will be
207
+ # returned.
208
+ # @param [String] fields
209
+ # Selector specifying which fields to include in a partial response.
210
+ # @param [String] quota_user
211
+ # Available to use for quota purposes for server-side applications. Can be any
212
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
213
+ # @param [Google::Apis::RequestOptions] options
214
+ # Request-specific options
215
+ #
216
+ # @yield [result, err] Result & error if block supplied
217
+ # @yieldparam result [Google::Apis::CloudtasksV2beta2::Queue] parsed result object
218
+ # @yieldparam err [StandardError] error object if request failed
219
+ #
220
+ # @return [Google::Apis::CloudtasksV2beta2::Queue]
221
+ #
222
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
223
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
224
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
225
+ def get_project_location_queue(name, read_mask: nil, fields: nil, quota_user: nil, options: nil, &block)
226
+ command = make_simple_command(:get, 'v2beta2/{+name}', options)
227
+ command.response_representation = Google::Apis::CloudtasksV2beta2::Queue::Representation
228
+ command.response_class = Google::Apis::CloudtasksV2beta2::Queue
229
+ command.params['name'] = name unless name.nil?
230
+ command.query['readMask'] = read_mask unless read_mask.nil?
231
+ command.query['fields'] = fields unless fields.nil?
232
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
233
+ execute_or_queue_command(command, &block)
234
+ end
235
+
236
+ # Gets the access control policy for a Queue. Returns an empty policy if the
237
+ # resource exists and does not have a policy set. Authorization requires the
238
+ # following [Google IAM](https://cloud.google.com/iam) permission on the
239
+ # specified resource parent: * `cloudtasks.queues.getIamPolicy`
240
+ # @param [String] resource
241
+ # REQUIRED: The resource for which the policy is being requested. See the
242
+ # operation documentation for the appropriate value for this field.
243
+ # @param [Google::Apis::CloudtasksV2beta2::GetIamPolicyRequest] get_iam_policy_request_object
244
+ # @param [String] fields
245
+ # Selector specifying which fields to include in a partial response.
246
+ # @param [String] quota_user
247
+ # Available to use for quota purposes for server-side applications. Can be any
248
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
249
+ # @param [Google::Apis::RequestOptions] options
250
+ # Request-specific options
251
+ #
252
+ # @yield [result, err] Result & error if block supplied
253
+ # @yieldparam result [Google::Apis::CloudtasksV2beta2::Policy] parsed result object
254
+ # @yieldparam err [StandardError] error object if request failed
255
+ #
256
+ # @return [Google::Apis::CloudtasksV2beta2::Policy]
257
+ #
258
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
259
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
260
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
261
+ def get_queue_iam_policy(resource, get_iam_policy_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
262
+ command = make_simple_command(:post, 'v2beta2/{+resource}:getIamPolicy', options)
263
+ command.request_representation = Google::Apis::CloudtasksV2beta2::GetIamPolicyRequest::Representation
264
+ command.request_object = get_iam_policy_request_object
265
+ command.response_representation = Google::Apis::CloudtasksV2beta2::Policy::Representation
266
+ command.response_class = Google::Apis::CloudtasksV2beta2::Policy
267
+ command.params['resource'] = resource unless resource.nil?
268
+ command.query['fields'] = fields unless fields.nil?
269
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
270
+ execute_or_queue_command(command, &block)
271
+ end
272
+
273
+ # Lists queues. Queues are returned in lexicographical order.
274
+ # @param [String] parent
275
+ # Required. The location name. For example: `projects/PROJECT_ID/locations/
276
+ # LOCATION_ID`
277
+ # @param [String] filter
278
+ # `filter` can be used to specify a subset of queues. Any Queue field can be
279
+ # used as a filter and several operators as supported. For example: `<=, <, >=, >
280
+ # , !=, =, :`. The filter syntax is the same as described in [Stackdriver's
281
+ # Advanced Logs Filters](https://cloud.google.com/logging/docs/view/
282
+ # advanced_filters). Sample filter "app_engine_http_target: *". Note that using
283
+ # filters might cause fewer queues than the requested_page size to be returned.
284
+ # @param [Fixnum] page_size
285
+ # Requested page size. The maximum page size is 9800. If unspecified, the page
286
+ # size will be the maximum. Fewer queues than requested might be returned, even
287
+ # if more queues exist; use the next_page_token in the response to determine if
288
+ # more queues exist.
289
+ # @param [String] page_token
290
+ # A token identifying the page of results to return. To request the first page
291
+ # results, page_token must be empty. To request the next page of results,
292
+ # page_token must be the value of next_page_token returned from the previous
293
+ # call to ListQueues method. It is an error to switch the value of the filter
294
+ # while iterating through pages.
295
+ # @param [String] read_mask
296
+ # Optional. Read mask is used for a more granular control over what the API
297
+ # returns. If the mask is not present all fields will be returned except [Queue.
298
+ # stats], if the mask is set to "*" all fields including [Queue.stats] will be
299
+ # returned, otherwise only the fields explicitly specified in the mask will be
300
+ # returned.
301
+ # @param [String] fields
302
+ # Selector specifying which fields to include in a partial response.
303
+ # @param [String] quota_user
304
+ # Available to use for quota purposes for server-side applications. Can be any
305
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
306
+ # @param [Google::Apis::RequestOptions] options
307
+ # Request-specific options
308
+ #
309
+ # @yield [result, err] Result & error if block supplied
310
+ # @yieldparam result [Google::Apis::CloudtasksV2beta2::ListQueuesResponse] parsed result object
311
+ # @yieldparam err [StandardError] error object if request failed
312
+ #
313
+ # @return [Google::Apis::CloudtasksV2beta2::ListQueuesResponse]
314
+ #
315
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
316
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
317
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
318
+ def list_project_location_queues(parent, filter: nil, page_size: nil, page_token: nil, read_mask: nil, fields: nil, quota_user: nil, options: nil, &block)
319
+ command = make_simple_command(:get, 'v2beta2/{+parent}/queues', options)
320
+ command.response_representation = Google::Apis::CloudtasksV2beta2::ListQueuesResponse::Representation
321
+ command.response_class = Google::Apis::CloudtasksV2beta2::ListQueuesResponse
322
+ command.params['parent'] = parent unless parent.nil?
323
+ command.query['filter'] = filter unless filter.nil?
324
+ command.query['pageSize'] = page_size unless page_size.nil?
325
+ command.query['pageToken'] = page_token unless page_token.nil?
326
+ command.query['readMask'] = read_mask unless read_mask.nil?
327
+ command.query['fields'] = fields unless fields.nil?
328
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
329
+ execute_or_queue_command(command, &block)
330
+ end
331
+
332
+ # Updates a queue. This method creates the queue if it does not exist and
333
+ # updates the queue if it does exist. Queues created with this method allow
334
+ # tasks to live for a maximum of 31 days. After a task is 31 days old, the task
335
+ # will be deleted regardless of whether it was dispatched or not. WARNING: Using
336
+ # this method may have unintended side effects if you are using an App Engine `
337
+ # queue.yaml` or `queue.xml` file to manage your queues. Read [Overview of Queue
338
+ # Management and queue.yaml](https://cloud.google.com/tasks/docs/queue-yaml)
339
+ # before using this method.
340
+ # @param [String] name
341
+ # Caller-specified and required in CreateQueue, after which it becomes output
342
+ # only. The queue name. The queue name must have the following format: `projects/
343
+ # PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID` * `PROJECT_ID` can contain
344
+ # letters ([A-Za-z]), numbers ([0-9]), hyphens (-), colons (:), or periods (.).
345
+ # For more information, see [Identifying projects](https://cloud.google.com/
346
+ # resource-manager/docs/creating-managing-projects#identifying_projects) * `
347
+ # LOCATION_ID` is the canonical ID for the queue's location. The list of
348
+ # available locations can be obtained by calling ListLocations. For more
349
+ # information, see https://cloud.google.com/about/locations/. * `QUEUE_ID` can
350
+ # contain letters ([A-Za-z]), numbers ([0-9]), or hyphens (-). The maximum
351
+ # length is 100 characters.
352
+ # @param [Google::Apis::CloudtasksV2beta2::Queue] queue_object
353
+ # @param [String] update_mask
354
+ # A mask used to specify which fields of the queue are being updated. If empty,
355
+ # then all fields will be updated.
356
+ # @param [String] fields
357
+ # Selector specifying which fields to include in a partial response.
358
+ # @param [String] quota_user
359
+ # Available to use for quota purposes for server-side applications. Can be any
360
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
361
+ # @param [Google::Apis::RequestOptions] options
362
+ # Request-specific options
363
+ #
364
+ # @yield [result, err] Result & error if block supplied
365
+ # @yieldparam result [Google::Apis::CloudtasksV2beta2::Queue] parsed result object
366
+ # @yieldparam err [StandardError] error object if request failed
367
+ #
368
+ # @return [Google::Apis::CloudtasksV2beta2::Queue]
369
+ #
370
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
371
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
372
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
373
+ def patch_project_location_queue(name, queue_object = nil, update_mask: nil, fields: nil, quota_user: nil, options: nil, &block)
374
+ command = make_simple_command(:patch, 'v2beta2/{+name}', options)
375
+ command.request_representation = Google::Apis::CloudtasksV2beta2::Queue::Representation
376
+ command.request_object = queue_object
377
+ command.response_representation = Google::Apis::CloudtasksV2beta2::Queue::Representation
378
+ command.response_class = Google::Apis::CloudtasksV2beta2::Queue
379
+ command.params['name'] = name unless name.nil?
380
+ command.query['updateMask'] = update_mask unless update_mask.nil?
381
+ command.query['fields'] = fields unless fields.nil?
382
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
383
+ execute_or_queue_command(command, &block)
384
+ end
385
+
386
+ # Pauses the queue. If a queue is paused then the system will stop dispatching
387
+ # tasks until the queue is resumed via ResumeQueue. Tasks can still be added
388
+ # when the queue is paused. A queue is paused if its state is PAUSED.
389
+ # @param [String] name
390
+ # Required. The queue name. For example: `projects/PROJECT_ID/location/
391
+ # LOCATION_ID/queues/QUEUE_ID`
392
+ # @param [Google::Apis::CloudtasksV2beta2::PauseQueueRequest] pause_queue_request_object
393
+ # @param [String] fields
394
+ # Selector specifying which fields to include in a partial response.
395
+ # @param [String] quota_user
396
+ # Available to use for quota purposes for server-side applications. Can be any
397
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
398
+ # @param [Google::Apis::RequestOptions] options
399
+ # Request-specific options
400
+ #
401
+ # @yield [result, err] Result & error if block supplied
402
+ # @yieldparam result [Google::Apis::CloudtasksV2beta2::Queue] parsed result object
403
+ # @yieldparam err [StandardError] error object if request failed
404
+ #
405
+ # @return [Google::Apis::CloudtasksV2beta2::Queue]
406
+ #
407
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
408
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
409
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
410
+ def pause_queue(name, pause_queue_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
411
+ command = make_simple_command(:post, 'v2beta2/{+name}:pause', options)
412
+ command.request_representation = Google::Apis::CloudtasksV2beta2::PauseQueueRequest::Representation
413
+ command.request_object = pause_queue_request_object
414
+ command.response_representation = Google::Apis::CloudtasksV2beta2::Queue::Representation
415
+ command.response_class = Google::Apis::CloudtasksV2beta2::Queue
416
+ command.params['name'] = name unless name.nil?
417
+ command.query['fields'] = fields unless fields.nil?
418
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
419
+ execute_or_queue_command(command, &block)
420
+ end
421
+
422
+ # Purges a queue by deleting all of its tasks. All tasks created before this
423
+ # method is called are permanently deleted. Purge operations can take up to one
424
+ # minute to take effect. Tasks might be dispatched before the purge takes effect.
425
+ # A purge is irreversible.
426
+ # @param [String] name
427
+ # Required. The queue name. For example: `projects/PROJECT_ID/location/
428
+ # LOCATION_ID/queues/QUEUE_ID`
429
+ # @param [Google::Apis::CloudtasksV2beta2::PurgeQueueRequest] purge_queue_request_object
430
+ # @param [String] fields
431
+ # Selector specifying which fields to include in a partial response.
432
+ # @param [String] quota_user
433
+ # Available to use for quota purposes for server-side applications. Can be any
434
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
435
+ # @param [Google::Apis::RequestOptions] options
436
+ # Request-specific options
437
+ #
438
+ # @yield [result, err] Result & error if block supplied
439
+ # @yieldparam result [Google::Apis::CloudtasksV2beta2::Queue] parsed result object
440
+ # @yieldparam err [StandardError] error object if request failed
441
+ #
442
+ # @return [Google::Apis::CloudtasksV2beta2::Queue]
443
+ #
444
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
445
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
446
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
447
+ def purge_queue(name, purge_queue_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
448
+ command = make_simple_command(:post, 'v2beta2/{+name}:purge', options)
449
+ command.request_representation = Google::Apis::CloudtasksV2beta2::PurgeQueueRequest::Representation
450
+ command.request_object = purge_queue_request_object
451
+ command.response_representation = Google::Apis::CloudtasksV2beta2::Queue::Representation
452
+ command.response_class = Google::Apis::CloudtasksV2beta2::Queue
453
+ command.params['name'] = name unless name.nil?
454
+ command.query['fields'] = fields unless fields.nil?
455
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
456
+ execute_or_queue_command(command, &block)
457
+ end
458
+
459
+ # Resume a queue. This method resumes a queue after it has been PAUSED or
460
+ # DISABLED. The state of a queue is stored in the queue's state; after calling
461
+ # this method it will be set to RUNNING. WARNING: Resuming many high-QPS queues
462
+ # at the same time can lead to target overloading. If you are resuming high-QPS
463
+ # queues, follow the 500/50/5 pattern described in [Managing Cloud Tasks Scaling
464
+ # Risks](https://cloud.google.com/tasks/docs/manage-cloud-task-scaling).
465
+ # @param [String] name
466
+ # Required. The queue name. For example: `projects/PROJECT_ID/location/
467
+ # LOCATION_ID/queues/QUEUE_ID`
468
+ # @param [Google::Apis::CloudtasksV2beta2::ResumeQueueRequest] resume_queue_request_object
469
+ # @param [String] fields
470
+ # Selector specifying which fields to include in a partial response.
471
+ # @param [String] quota_user
472
+ # Available to use for quota purposes for server-side applications. Can be any
473
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
474
+ # @param [Google::Apis::RequestOptions] options
475
+ # Request-specific options
476
+ #
477
+ # @yield [result, err] Result & error if block supplied
478
+ # @yieldparam result [Google::Apis::CloudtasksV2beta2::Queue] parsed result object
479
+ # @yieldparam err [StandardError] error object if request failed
480
+ #
481
+ # @return [Google::Apis::CloudtasksV2beta2::Queue]
482
+ #
483
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
484
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
485
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
486
+ def resume_queue(name, resume_queue_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
487
+ command = make_simple_command(:post, 'v2beta2/{+name}:resume', options)
488
+ command.request_representation = Google::Apis::CloudtasksV2beta2::ResumeQueueRequest::Representation
489
+ command.request_object = resume_queue_request_object
490
+ command.response_representation = Google::Apis::CloudtasksV2beta2::Queue::Representation
491
+ command.response_class = Google::Apis::CloudtasksV2beta2::Queue
492
+ command.params['name'] = name unless name.nil?
493
+ command.query['fields'] = fields unless fields.nil?
494
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
495
+ execute_or_queue_command(command, &block)
496
+ end
497
+
498
+ # Sets the access control policy for a Queue. Replaces any existing policy. Note:
499
+ # The Cloud Console does not check queue-level IAM permissions yet. Project-
500
+ # level permissions are required to use the Cloud Console. Authorization
501
+ # requires the following [Google IAM](https://cloud.google.com/iam) permission
502
+ # on the specified resource parent: * `cloudtasks.queues.setIamPolicy`
503
+ # @param [String] resource
504
+ # REQUIRED: The resource for which the policy is being specified. See the
505
+ # operation documentation for the appropriate value for this field.
506
+ # @param [Google::Apis::CloudtasksV2beta2::SetIamPolicyRequest] set_iam_policy_request_object
507
+ # @param [String] fields
508
+ # Selector specifying which fields to include in a partial response.
509
+ # @param [String] quota_user
510
+ # Available to use for quota purposes for server-side applications. Can be any
511
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
512
+ # @param [Google::Apis::RequestOptions] options
513
+ # Request-specific options
514
+ #
515
+ # @yield [result, err] Result & error if block supplied
516
+ # @yieldparam result [Google::Apis::CloudtasksV2beta2::Policy] parsed result object
517
+ # @yieldparam err [StandardError] error object if request failed
518
+ #
519
+ # @return [Google::Apis::CloudtasksV2beta2::Policy]
520
+ #
521
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
522
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
523
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
524
+ def set_queue_iam_policy(resource, set_iam_policy_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
525
+ command = make_simple_command(:post, 'v2beta2/{+resource}:setIamPolicy', options)
526
+ command.request_representation = Google::Apis::CloudtasksV2beta2::SetIamPolicyRequest::Representation
527
+ command.request_object = set_iam_policy_request_object
528
+ command.response_representation = Google::Apis::CloudtasksV2beta2::Policy::Representation
529
+ command.response_class = Google::Apis::CloudtasksV2beta2::Policy
530
+ command.params['resource'] = resource unless resource.nil?
531
+ command.query['fields'] = fields unless fields.nil?
532
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
533
+ execute_or_queue_command(command, &block)
534
+ end
535
+
536
+ # Returns permissions that a caller has on a Queue. If the resource does not
537
+ # exist, this will return an empty set of permissions, not a NOT_FOUND error.
538
+ # Note: This operation is designed to be used for building permission-aware UIs
539
+ # and command-line tools, not for authorization checking. This operation may "
540
+ # fail open" without warning.
541
+ # @param [String] resource
542
+ # REQUIRED: The resource for which the policy detail is being requested. See the
543
+ # operation documentation for the appropriate value for this field.
544
+ # @param [Google::Apis::CloudtasksV2beta2::TestIamPermissionsRequest] test_iam_permissions_request_object
545
+ # @param [String] fields
546
+ # Selector specifying which fields to include in a partial response.
547
+ # @param [String] quota_user
548
+ # Available to use for quota purposes for server-side applications. Can be any
549
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
550
+ # @param [Google::Apis::RequestOptions] options
551
+ # Request-specific options
552
+ #
553
+ # @yield [result, err] Result & error if block supplied
554
+ # @yieldparam result [Google::Apis::CloudtasksV2beta2::TestIamPermissionsResponse] parsed result object
555
+ # @yieldparam err [StandardError] error object if request failed
556
+ #
557
+ # @return [Google::Apis::CloudtasksV2beta2::TestIamPermissionsResponse]
558
+ #
559
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
560
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
561
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
562
+ def test_queue_iam_permissions(resource, test_iam_permissions_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
563
+ command = make_simple_command(:post, 'v2beta2/{+resource}:testIamPermissions', options)
564
+ command.request_representation = Google::Apis::CloudtasksV2beta2::TestIamPermissionsRequest::Representation
565
+ command.request_object = test_iam_permissions_request_object
566
+ command.response_representation = Google::Apis::CloudtasksV2beta2::TestIamPermissionsResponse::Representation
567
+ command.response_class = Google::Apis::CloudtasksV2beta2::TestIamPermissionsResponse
568
+ command.params['resource'] = resource unless resource.nil?
569
+ command.query['fields'] = fields unless fields.nil?
570
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
571
+ execute_or_queue_command(command, &block)
572
+ end
573
+
574
+ # Acknowledges a pull task. The worker, that is, the entity that leased this
575
+ # task must call this method to indicate that the work associated with the task
576
+ # has finished. The worker must acknowledge a task within the lease_duration or
577
+ # the lease will expire and the task will become available to be leased again.
578
+ # After the task is acknowledged, it will not be returned by a later LeaseTasks,
579
+ # GetTask, or ListTasks.
580
+ # @param [String] name
581
+ # Required. The task name. For example: `projects/PROJECT_ID/locations/
582
+ # LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID`
583
+ # @param [Google::Apis::CloudtasksV2beta2::AcknowledgeTaskRequest] acknowledge_task_request_object
584
+ # @param [String] fields
585
+ # Selector specifying which fields to include in a partial response.
586
+ # @param [String] quota_user
587
+ # Available to use for quota purposes for server-side applications. Can be any
588
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
589
+ # @param [Google::Apis::RequestOptions] options
590
+ # Request-specific options
591
+ #
592
+ # @yield [result, err] Result & error if block supplied
593
+ # @yieldparam result [Google::Apis::CloudtasksV2beta2::Empty] parsed result object
594
+ # @yieldparam err [StandardError] error object if request failed
595
+ #
596
+ # @return [Google::Apis::CloudtasksV2beta2::Empty]
597
+ #
598
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
599
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
600
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
601
+ def acknowledge_task(name, acknowledge_task_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
602
+ command = make_simple_command(:post, 'v2beta2/{+name}:acknowledge', options)
603
+ command.request_representation = Google::Apis::CloudtasksV2beta2::AcknowledgeTaskRequest::Representation
604
+ command.request_object = acknowledge_task_request_object
605
+ command.response_representation = Google::Apis::CloudtasksV2beta2::Empty::Representation
606
+ command.response_class = Google::Apis::CloudtasksV2beta2::Empty
607
+ command.params['name'] = name unless name.nil?
608
+ command.query['fields'] = fields unless fields.nil?
609
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
610
+ execute_or_queue_command(command, &block)
611
+ end
612
+
613
+ # Cancel a pull task's lease. The worker can use this method to cancel a task's
614
+ # lease by setting its schedule_time to now. This will make the task available
615
+ # to be leased to the next caller of LeaseTasks.
616
+ # @param [String] name
617
+ # Required. The task name. For example: `projects/PROJECT_ID/locations/
618
+ # LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID`
619
+ # @param [Google::Apis::CloudtasksV2beta2::CancelLeaseRequest] cancel_lease_request_object
620
+ # @param [String] fields
621
+ # Selector specifying which fields to include in a partial response.
622
+ # @param [String] quota_user
623
+ # Available to use for quota purposes for server-side applications. Can be any
624
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
625
+ # @param [Google::Apis::RequestOptions] options
626
+ # Request-specific options
627
+ #
628
+ # @yield [result, err] Result & error if block supplied
629
+ # @yieldparam result [Google::Apis::CloudtasksV2beta2::Task] parsed result object
630
+ # @yieldparam err [StandardError] error object if request failed
631
+ #
632
+ # @return [Google::Apis::CloudtasksV2beta2::Task]
633
+ #
634
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
635
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
636
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
637
+ def cancel_task_lease(name, cancel_lease_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
638
+ command = make_simple_command(:post, 'v2beta2/{+name}:cancelLease', options)
639
+ command.request_representation = Google::Apis::CloudtasksV2beta2::CancelLeaseRequest::Representation
640
+ command.request_object = cancel_lease_request_object
641
+ command.response_representation = Google::Apis::CloudtasksV2beta2::Task::Representation
642
+ command.response_class = Google::Apis::CloudtasksV2beta2::Task
643
+ command.params['name'] = name unless name.nil?
644
+ command.query['fields'] = fields unless fields.nil?
645
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
646
+ execute_or_queue_command(command, &block)
647
+ end
648
+
649
+ # Creates a task and adds it to a queue. Tasks cannot be updated after creation;
650
+ # there is no UpdateTask command. * For App Engine queues, the maximum task size
651
+ # is 100KB. * For pull queues, the maximum task size is 1MB.
652
+ # @param [String] parent
653
+ # Required. The queue name. For example: `projects/PROJECT_ID/locations/
654
+ # LOCATION_ID/queues/QUEUE_ID` The queue must already exist.
655
+ # @param [Google::Apis::CloudtasksV2beta2::CreateTaskRequest] create_task_request_object
656
+ # @param [String] fields
657
+ # Selector specifying which fields to include in a partial response.
658
+ # @param [String] quota_user
659
+ # Available to use for quota purposes for server-side applications. Can be any
660
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
661
+ # @param [Google::Apis::RequestOptions] options
662
+ # Request-specific options
663
+ #
664
+ # @yield [result, err] Result & error if block supplied
665
+ # @yieldparam result [Google::Apis::CloudtasksV2beta2::Task] parsed result object
666
+ # @yieldparam err [StandardError] error object if request failed
667
+ #
668
+ # @return [Google::Apis::CloudtasksV2beta2::Task]
669
+ #
670
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
671
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
672
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
673
+ def create_task(parent, create_task_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
674
+ command = make_simple_command(:post, 'v2beta2/{+parent}/tasks', options)
675
+ command.request_representation = Google::Apis::CloudtasksV2beta2::CreateTaskRequest::Representation
676
+ command.request_object = create_task_request_object
677
+ command.response_representation = Google::Apis::CloudtasksV2beta2::Task::Representation
678
+ command.response_class = Google::Apis::CloudtasksV2beta2::Task
679
+ command.params['parent'] = parent unless parent.nil?
680
+ command.query['fields'] = fields unless fields.nil?
681
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
682
+ execute_or_queue_command(command, &block)
683
+ end
684
+
685
+ # Deletes a task. A task can be deleted if it is scheduled or dispatched. A task
686
+ # cannot be deleted if it has completed successfully or permanently failed.
687
+ # @param [String] name
688
+ # Required. The task name. For example: `projects/PROJECT_ID/locations/
689
+ # LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID`
690
+ # @param [String] fields
691
+ # Selector specifying which fields to include in a partial response.
692
+ # @param [String] quota_user
693
+ # Available to use for quota purposes for server-side applications. Can be any
694
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
695
+ # @param [Google::Apis::RequestOptions] options
696
+ # Request-specific options
697
+ #
698
+ # @yield [result, err] Result & error if block supplied
699
+ # @yieldparam result [Google::Apis::CloudtasksV2beta2::Empty] parsed result object
700
+ # @yieldparam err [StandardError] error object if request failed
701
+ #
702
+ # @return [Google::Apis::CloudtasksV2beta2::Empty]
703
+ #
704
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
705
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
706
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
707
+ def delete_project_location_queue_task(name, fields: nil, quota_user: nil, options: nil, &block)
708
+ command = make_simple_command(:delete, 'v2beta2/{+name}', options)
709
+ command.response_representation = Google::Apis::CloudtasksV2beta2::Empty::Representation
710
+ command.response_class = Google::Apis::CloudtasksV2beta2::Empty
711
+ command.params['name'] = name unless name.nil?
712
+ command.query['fields'] = fields unless fields.nil?
713
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
714
+ execute_or_queue_command(command, &block)
715
+ end
716
+
717
+ # Gets a task.
718
+ # @param [String] name
719
+ # Required. The task name. For example: `projects/PROJECT_ID/locations/
720
+ # LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID`
721
+ # @param [String] response_view
722
+ # The response_view specifies which subset of the Task will be returned. By
723
+ # default response_view is BASIC; not all information is retrieved by default
724
+ # because some data, such as payloads, might be desirable to return only when
725
+ # needed because of its large size or because of the sensitivity of data that it
726
+ # contains. Authorization for FULL requires `cloudtasks.tasks.fullView` [Google
727
+ # IAM](https://cloud.google.com/iam/) permission on the Task resource.
728
+ # @param [String] fields
729
+ # Selector specifying which fields to include in a partial response.
730
+ # @param [String] quota_user
731
+ # Available to use for quota purposes for server-side applications. Can be any
732
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
733
+ # @param [Google::Apis::RequestOptions] options
734
+ # Request-specific options
735
+ #
736
+ # @yield [result, err] Result & error if block supplied
737
+ # @yieldparam result [Google::Apis::CloudtasksV2beta2::Task] parsed result object
738
+ # @yieldparam err [StandardError] error object if request failed
739
+ #
740
+ # @return [Google::Apis::CloudtasksV2beta2::Task]
741
+ #
742
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
743
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
744
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
745
+ def get_project_location_queue_task(name, response_view: nil, fields: nil, quota_user: nil, options: nil, &block)
746
+ command = make_simple_command(:get, 'v2beta2/{+name}', options)
747
+ command.response_representation = Google::Apis::CloudtasksV2beta2::Task::Representation
748
+ command.response_class = Google::Apis::CloudtasksV2beta2::Task
749
+ command.params['name'] = name unless name.nil?
750
+ command.query['responseView'] = response_view unless response_view.nil?
751
+ command.query['fields'] = fields unless fields.nil?
752
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
753
+ execute_or_queue_command(command, &block)
754
+ end
755
+
756
+ # Leases tasks from a pull queue for lease_duration. This method is invoked by
757
+ # the worker to obtain a lease. The worker must acknowledge the task via
758
+ # AcknowledgeTask after they have performed the work associated with the task.
759
+ # The payload is intended to store data that the worker needs to perform the
760
+ # work associated with the task. To return the payloads in the response, set
761
+ # response_view to FULL. A maximum of 10 qps of LeaseTasks requests are allowed
762
+ # per queue. RESOURCE_EXHAUSTED is returned when this limit is exceeded.
763
+ # RESOURCE_EXHAUSTED is also returned when max_tasks_dispatched_per_second is
764
+ # exceeded.
765
+ # @param [String] parent
766
+ # Required. The queue name. For example: `projects/PROJECT_ID/locations/
767
+ # LOCATION_ID/queues/QUEUE_ID`
768
+ # @param [Google::Apis::CloudtasksV2beta2::LeaseTasksRequest] lease_tasks_request_object
769
+ # @param [String] fields
770
+ # Selector specifying which fields to include in a partial response.
771
+ # @param [String] quota_user
772
+ # Available to use for quota purposes for server-side applications. Can be any
773
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
774
+ # @param [Google::Apis::RequestOptions] options
775
+ # Request-specific options
776
+ #
777
+ # @yield [result, err] Result & error if block supplied
778
+ # @yieldparam result [Google::Apis::CloudtasksV2beta2::LeaseTasksResponse] parsed result object
779
+ # @yieldparam err [StandardError] error object if request failed
780
+ #
781
+ # @return [Google::Apis::CloudtasksV2beta2::LeaseTasksResponse]
782
+ #
783
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
784
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
785
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
786
+ def lease_tasks(parent, lease_tasks_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
787
+ command = make_simple_command(:post, 'v2beta2/{+parent}/tasks:lease', options)
788
+ command.request_representation = Google::Apis::CloudtasksV2beta2::LeaseTasksRequest::Representation
789
+ command.request_object = lease_tasks_request_object
790
+ command.response_representation = Google::Apis::CloudtasksV2beta2::LeaseTasksResponse::Representation
791
+ command.response_class = Google::Apis::CloudtasksV2beta2::LeaseTasksResponse
792
+ command.params['parent'] = parent unless parent.nil?
793
+ command.query['fields'] = fields unless fields.nil?
794
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
795
+ execute_or_queue_command(command, &block)
796
+ end
797
+
798
+ # Lists the tasks in a queue. By default, only the BASIC view is retrieved due
799
+ # to performance considerations; response_view controls the subset of
800
+ # information which is returned. The tasks may be returned in any order. The
801
+ # ordering may change at any time.
802
+ # @param [String] parent
803
+ # Required. The queue name. For example: `projects/PROJECT_ID/locations/
804
+ # LOCATION_ID/queues/QUEUE_ID`
805
+ # @param [Fixnum] page_size
806
+ # Maximum page size. Fewer tasks than requested might be returned, even if more
807
+ # tasks exist; use next_page_token in the response to determine if more tasks
808
+ # exist. The maximum page size is 1000. If unspecified, the page size will be
809
+ # the maximum.
810
+ # @param [String] page_token
811
+ # A token identifying the page of results to return. To request the first page
812
+ # results, page_token must be empty. To request the next page of results,
813
+ # page_token must be the value of next_page_token returned from the previous
814
+ # call to ListTasks method. The page token is valid for only 2 hours.
815
+ # @param [String] response_view
816
+ # The response_view specifies which subset of the Task will be returned. By
817
+ # default response_view is BASIC; not all information is retrieved by default
818
+ # because some data, such as payloads, might be desirable to return only when
819
+ # needed because of its large size or because of the sensitivity of data that it
820
+ # contains. Authorization for FULL requires `cloudtasks.tasks.fullView` [Google
821
+ # IAM](https://cloud.google.com/iam/) permission on the Task resource.
822
+ # @param [String] fields
823
+ # Selector specifying which fields to include in a partial response.
824
+ # @param [String] quota_user
825
+ # Available to use for quota purposes for server-side applications. Can be any
826
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
827
+ # @param [Google::Apis::RequestOptions] options
828
+ # Request-specific options
829
+ #
830
+ # @yield [result, err] Result & error if block supplied
831
+ # @yieldparam result [Google::Apis::CloudtasksV2beta2::ListTasksResponse] parsed result object
832
+ # @yieldparam err [StandardError] error object if request failed
833
+ #
834
+ # @return [Google::Apis::CloudtasksV2beta2::ListTasksResponse]
835
+ #
836
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
837
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
838
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
839
+ def list_project_location_queue_tasks(parent, page_size: nil, page_token: nil, response_view: nil, fields: nil, quota_user: nil, options: nil, &block)
840
+ command = make_simple_command(:get, 'v2beta2/{+parent}/tasks', options)
841
+ command.response_representation = Google::Apis::CloudtasksV2beta2::ListTasksResponse::Representation
842
+ command.response_class = Google::Apis::CloudtasksV2beta2::ListTasksResponse
843
+ command.params['parent'] = parent unless parent.nil?
844
+ command.query['pageSize'] = page_size unless page_size.nil?
845
+ command.query['pageToken'] = page_token unless page_token.nil?
846
+ command.query['responseView'] = response_view unless response_view.nil?
847
+ command.query['fields'] = fields unless fields.nil?
848
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
849
+ execute_or_queue_command(command, &block)
850
+ end
851
+
852
+ # Renew the current lease of a pull task. The worker can use this method to
853
+ # extend the lease by a new duration, starting from now. The new task lease will
854
+ # be returned in the task's schedule_time.
855
+ # @param [String] name
856
+ # Required. The task name. For example: `projects/PROJECT_ID/locations/
857
+ # LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID`
858
+ # @param [Google::Apis::CloudtasksV2beta2::RenewLeaseRequest] renew_lease_request_object
859
+ # @param [String] fields
860
+ # Selector specifying which fields to include in a partial response.
861
+ # @param [String] quota_user
862
+ # Available to use for quota purposes for server-side applications. Can be any
863
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
864
+ # @param [Google::Apis::RequestOptions] options
865
+ # Request-specific options
866
+ #
867
+ # @yield [result, err] Result & error if block supplied
868
+ # @yieldparam result [Google::Apis::CloudtasksV2beta2::Task] parsed result object
869
+ # @yieldparam err [StandardError] error object if request failed
870
+ #
871
+ # @return [Google::Apis::CloudtasksV2beta2::Task]
872
+ #
873
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
874
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
875
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
876
+ def renew_task_lease(name, renew_lease_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
877
+ command = make_simple_command(:post, 'v2beta2/{+name}:renewLease', options)
878
+ command.request_representation = Google::Apis::CloudtasksV2beta2::RenewLeaseRequest::Representation
879
+ command.request_object = renew_lease_request_object
880
+ command.response_representation = Google::Apis::CloudtasksV2beta2::Task::Representation
881
+ command.response_class = Google::Apis::CloudtasksV2beta2::Task
882
+ command.params['name'] = name unless name.nil?
883
+ command.query['fields'] = fields unless fields.nil?
884
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
885
+ execute_or_queue_command(command, &block)
886
+ end
887
+
888
+ # Forces a task to run now. When this method is called, Cloud Tasks will
889
+ # dispatch the task, even if the task is already running, the queue has reached
890
+ # its RateLimits or is PAUSED. This command is meant to be used for manual
891
+ # debugging. For example, RunTask can be used to retry a failed task after a fix
892
+ # has been made or to manually force a task to be dispatched now. The dispatched
893
+ # task is returned. That is, the task that is returned contains the status after
894
+ # the task is dispatched but before the task is received by its target. If Cloud
895
+ # Tasks receives a successful response from the task's target, then the task
896
+ # will be deleted; otherwise the task's schedule_time will be reset to the time
897
+ # that RunTask was called plus the retry delay specified in the queue's
898
+ # RetryConfig. RunTask returns NOT_FOUND when it is called on a task that has
899
+ # already succeeded or permanently failed. RunTask cannot be called on a pull
900
+ # task.
901
+ # @param [String] name
902
+ # Required. The task name. For example: `projects/PROJECT_ID/locations/
903
+ # LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID`
904
+ # @param [Google::Apis::CloudtasksV2beta2::RunTaskRequest] run_task_request_object
905
+ # @param [String] fields
906
+ # Selector specifying which fields to include in a partial response.
907
+ # @param [String] quota_user
908
+ # Available to use for quota purposes for server-side applications. Can be any
909
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
910
+ # @param [Google::Apis::RequestOptions] options
911
+ # Request-specific options
912
+ #
913
+ # @yield [result, err] Result & error if block supplied
914
+ # @yieldparam result [Google::Apis::CloudtasksV2beta2::Task] parsed result object
915
+ # @yieldparam err [StandardError] error object if request failed
916
+ #
917
+ # @return [Google::Apis::CloudtasksV2beta2::Task]
918
+ #
919
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
920
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
921
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
922
+ def run_task(name, run_task_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
923
+ command = make_simple_command(:post, 'v2beta2/{+name}:run', options)
924
+ command.request_representation = Google::Apis::CloudtasksV2beta2::RunTaskRequest::Representation
925
+ command.request_object = run_task_request_object
926
+ command.response_representation = Google::Apis::CloudtasksV2beta2::Task::Representation
927
+ command.response_class = Google::Apis::CloudtasksV2beta2::Task
928
+ command.params['name'] = name unless name.nil?
929
+ command.query['fields'] = fields unless fields.nil?
930
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
931
+ execute_or_queue_command(command, &block)
932
+ end
933
+
934
+ protected
935
+
936
+ def apply_command_defaults(command)
937
+ command.query['key'] = key unless key.nil?
938
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
939
+ end
940
+ end
941
+ end
942
+ end
943
+ end