google-apis-cloudtasks_v2beta3 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,788 @@
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 CloudtasksV2beta3
23
+ # Cloud Tasks API
24
+ #
25
+ # Manages the execution of large numbers of distributed requests.
26
+ #
27
+ # @example
28
+ # require 'google/apis/cloudtasks_v2beta3'
29
+ #
30
+ # Cloudtasks = Google::Apis::CloudtasksV2beta3 # 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_v2beta3',
48
+ client_version: Google::Apis::CloudtasksV2beta3::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::CloudtasksV2beta3::Location] parsed result object
65
+ # @yieldparam err [StandardError] error object if request failed
66
+ #
67
+ # @return [Google::Apis::CloudtasksV2beta3::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, 'v2beta3/{+name}', options)
74
+ command.response_representation = Google::Apis::CloudtasksV2beta3::Location::Representation
75
+ command.response_class = Google::Apis::CloudtasksV2beta3::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::CloudtasksV2beta3::ListLocationsResponse] parsed result object
101
+ # @yieldparam err [StandardError] error object if request failed
102
+ #
103
+ # @return [Google::Apis::CloudtasksV2beta3::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, 'v2beta3/{+name}/locations', options)
110
+ command.response_representation = Google::Apis::CloudtasksV2beta3::ListLocationsResponse::Representation
111
+ command.response_class = Google::Apis::CloudtasksV2beta3::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::CloudtasksV2beta3::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::CloudtasksV2beta3::Queue] parsed result object
143
+ # @yieldparam err [StandardError] error object if request failed
144
+ #
145
+ # @return [Google::Apis::CloudtasksV2beta3::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, 'v2beta3/{+parent}/queues', options)
152
+ command.request_representation = Google::Apis::CloudtasksV2beta3::Queue::Representation
153
+ command.request_object = queue_object
154
+ command.response_representation = Google::Apis::CloudtasksV2beta3::Queue::Representation
155
+ command.response_class = Google::Apis::CloudtasksV2beta3::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::CloudtasksV2beta3::Empty] parsed result object
181
+ # @yieldparam err [StandardError] error object if request failed
182
+ #
183
+ # @return [Google::Apis::CloudtasksV2beta3::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, 'v2beta3/{+name}', options)
190
+ command.response_representation = Google::Apis::CloudtasksV2beta3::Empty::Representation
191
+ command.response_class = Google::Apis::CloudtasksV2beta3::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::CloudtasksV2beta3::Queue] parsed result object
218
+ # @yieldparam err [StandardError] error object if request failed
219
+ #
220
+ # @return [Google::Apis::CloudtasksV2beta3::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, 'v2beta3/{+name}', options)
227
+ command.response_representation = Google::Apis::CloudtasksV2beta3::Queue::Representation
228
+ command.response_class = Google::Apis::CloudtasksV2beta3::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::CloudtasksV2beta3::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::CloudtasksV2beta3::Policy] parsed result object
254
+ # @yieldparam err [StandardError] error object if request failed
255
+ #
256
+ # @return [Google::Apis::CloudtasksV2beta3::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, 'v2beta3/{+resource}:getIamPolicy', options)
263
+ command.request_representation = Google::Apis::CloudtasksV2beta3::GetIamPolicyRequest::Representation
264
+ command.request_object = get_iam_policy_request_object
265
+ command.response_representation = Google::Apis::CloudtasksV2beta3::Policy::Representation
266
+ command.response_class = Google::Apis::CloudtasksV2beta3::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 "state: PAUSED". Note that using filters
283
+ # 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 on the queues that the
297
+ # API returns. If the mask is not present all fields will be returned except [
298
+ # Queue.stats], if the mask is set to "*" all fields including [Queue.stats]
299
+ # will be returned, otherwise only the fields explicitly specified in the mask
300
+ # will be 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::CloudtasksV2beta3::ListQueuesResponse] parsed result object
311
+ # @yieldparam err [StandardError] error object if request failed
312
+ #
313
+ # @return [Google::Apis::CloudtasksV2beta3::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, 'v2beta3/{+parent}/queues', options)
320
+ command.response_representation = Google::Apis::CloudtasksV2beta3::ListQueuesResponse::Representation
321
+ command.response_class = Google::Apis::CloudtasksV2beta3::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::CloudtasksV2beta3::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::CloudtasksV2beta3::Queue] parsed result object
366
+ # @yieldparam err [StandardError] error object if request failed
367
+ #
368
+ # @return [Google::Apis::CloudtasksV2beta3::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, 'v2beta3/{+name}', options)
375
+ command.request_representation = Google::Apis::CloudtasksV2beta3::Queue::Representation
376
+ command.request_object = queue_object
377
+ command.response_representation = Google::Apis::CloudtasksV2beta3::Queue::Representation
378
+ command.response_class = Google::Apis::CloudtasksV2beta3::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::CloudtasksV2beta3::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::CloudtasksV2beta3::Queue] parsed result object
403
+ # @yieldparam err [StandardError] error object if request failed
404
+ #
405
+ # @return [Google::Apis::CloudtasksV2beta3::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, 'v2beta3/{+name}:pause', options)
412
+ command.request_representation = Google::Apis::CloudtasksV2beta3::PauseQueueRequest::Representation
413
+ command.request_object = pause_queue_request_object
414
+ command.response_representation = Google::Apis::CloudtasksV2beta3::Queue::Representation
415
+ command.response_class = Google::Apis::CloudtasksV2beta3::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::CloudtasksV2beta3::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::CloudtasksV2beta3::Queue] parsed result object
440
+ # @yieldparam err [StandardError] error object if request failed
441
+ #
442
+ # @return [Google::Apis::CloudtasksV2beta3::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, 'v2beta3/{+name}:purge', options)
449
+ command.request_representation = Google::Apis::CloudtasksV2beta3::PurgeQueueRequest::Representation
450
+ command.request_object = purge_queue_request_object
451
+ command.response_representation = Google::Apis::CloudtasksV2beta3::Queue::Representation
452
+ command.response_class = Google::Apis::CloudtasksV2beta3::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::CloudtasksV2beta3::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::CloudtasksV2beta3::Queue] parsed result object
479
+ # @yieldparam err [StandardError] error object if request failed
480
+ #
481
+ # @return [Google::Apis::CloudtasksV2beta3::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, 'v2beta3/{+name}:resume', options)
488
+ command.request_representation = Google::Apis::CloudtasksV2beta3::ResumeQueueRequest::Representation
489
+ command.request_object = resume_queue_request_object
490
+ command.response_representation = Google::Apis::CloudtasksV2beta3::Queue::Representation
491
+ command.response_class = Google::Apis::CloudtasksV2beta3::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::CloudtasksV2beta3::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::CloudtasksV2beta3::Policy] parsed result object
517
+ # @yieldparam err [StandardError] error object if request failed
518
+ #
519
+ # @return [Google::Apis::CloudtasksV2beta3::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, 'v2beta3/{+resource}:setIamPolicy', options)
526
+ command.request_representation = Google::Apis::CloudtasksV2beta3::SetIamPolicyRequest::Representation
527
+ command.request_object = set_iam_policy_request_object
528
+ command.response_representation = Google::Apis::CloudtasksV2beta3::Policy::Representation
529
+ command.response_class = Google::Apis::CloudtasksV2beta3::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::CloudtasksV2beta3::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::CloudtasksV2beta3::TestIamPermissionsResponse] parsed result object
555
+ # @yieldparam err [StandardError] error object if request failed
556
+ #
557
+ # @return [Google::Apis::CloudtasksV2beta3::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, 'v2beta3/{+resource}:testIamPermissions', options)
564
+ command.request_representation = Google::Apis::CloudtasksV2beta3::TestIamPermissionsRequest::Representation
565
+ command.request_object = test_iam_permissions_request_object
566
+ command.response_representation = Google::Apis::CloudtasksV2beta3::TestIamPermissionsResponse::Representation
567
+ command.response_class = Google::Apis::CloudtasksV2beta3::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
+ # Creates a task and adds it to a queue. Tasks cannot be updated after creation;
575
+ # there is no UpdateTask command. * The maximum task size is 100KB.
576
+ # @param [String] parent
577
+ # Required. The queue name. For example: `projects/PROJECT_ID/locations/
578
+ # LOCATION_ID/queues/QUEUE_ID` The queue must already exist.
579
+ # @param [Google::Apis::CloudtasksV2beta3::CreateTaskRequest] create_task_request_object
580
+ # @param [String] fields
581
+ # Selector specifying which fields to include in a partial response.
582
+ # @param [String] quota_user
583
+ # Available to use for quota purposes for server-side applications. Can be any
584
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
585
+ # @param [Google::Apis::RequestOptions] options
586
+ # Request-specific options
587
+ #
588
+ # @yield [result, err] Result & error if block supplied
589
+ # @yieldparam result [Google::Apis::CloudtasksV2beta3::Task] parsed result object
590
+ # @yieldparam err [StandardError] error object if request failed
591
+ #
592
+ # @return [Google::Apis::CloudtasksV2beta3::Task]
593
+ #
594
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
595
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
596
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
597
+ def create_task(parent, create_task_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
598
+ command = make_simple_command(:post, 'v2beta3/{+parent}/tasks', options)
599
+ command.request_representation = Google::Apis::CloudtasksV2beta3::CreateTaskRequest::Representation
600
+ command.request_object = create_task_request_object
601
+ command.response_representation = Google::Apis::CloudtasksV2beta3::Task::Representation
602
+ command.response_class = Google::Apis::CloudtasksV2beta3::Task
603
+ command.params['parent'] = parent unless parent.nil?
604
+ command.query['fields'] = fields unless fields.nil?
605
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
606
+ execute_or_queue_command(command, &block)
607
+ end
608
+
609
+ # Deletes a task. A task can be deleted if it is scheduled or dispatched. A task
610
+ # cannot be deleted if it has executed successfully or permanently failed.
611
+ # @param [String] name
612
+ # Required. The task name. For example: `projects/PROJECT_ID/locations/
613
+ # LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID`
614
+ # @param [String] fields
615
+ # Selector specifying which fields to include in a partial response.
616
+ # @param [String] quota_user
617
+ # Available to use for quota purposes for server-side applications. Can be any
618
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
619
+ # @param [Google::Apis::RequestOptions] options
620
+ # Request-specific options
621
+ #
622
+ # @yield [result, err] Result & error if block supplied
623
+ # @yieldparam result [Google::Apis::CloudtasksV2beta3::Empty] parsed result object
624
+ # @yieldparam err [StandardError] error object if request failed
625
+ #
626
+ # @return [Google::Apis::CloudtasksV2beta3::Empty]
627
+ #
628
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
629
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
630
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
631
+ def delete_project_location_queue_task(name, fields: nil, quota_user: nil, options: nil, &block)
632
+ command = make_simple_command(:delete, 'v2beta3/{+name}', options)
633
+ command.response_representation = Google::Apis::CloudtasksV2beta3::Empty::Representation
634
+ command.response_class = Google::Apis::CloudtasksV2beta3::Empty
635
+ command.params['name'] = name unless name.nil?
636
+ command.query['fields'] = fields unless fields.nil?
637
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
638
+ execute_or_queue_command(command, &block)
639
+ end
640
+
641
+ # Gets a task.
642
+ # @param [String] name
643
+ # Required. The task name. For example: `projects/PROJECT_ID/locations/
644
+ # LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID`
645
+ # @param [String] response_view
646
+ # The response_view specifies which subset of the Task will be returned. By
647
+ # default response_view is BASIC; not all information is retrieved by default
648
+ # because some data, such as payloads, might be desirable to return only when
649
+ # needed because of its large size or because of the sensitivity of data that it
650
+ # contains. Authorization for FULL requires `cloudtasks.tasks.fullView` [Google
651
+ # IAM](https://cloud.google.com/iam/) permission on the Task resource.
652
+ # @param [String] fields
653
+ # Selector specifying which fields to include in a partial response.
654
+ # @param [String] quota_user
655
+ # Available to use for quota purposes for server-side applications. Can be any
656
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
657
+ # @param [Google::Apis::RequestOptions] options
658
+ # Request-specific options
659
+ #
660
+ # @yield [result, err] Result & error if block supplied
661
+ # @yieldparam result [Google::Apis::CloudtasksV2beta3::Task] parsed result object
662
+ # @yieldparam err [StandardError] error object if request failed
663
+ #
664
+ # @return [Google::Apis::CloudtasksV2beta3::Task]
665
+ #
666
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
667
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
668
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
669
+ def get_project_location_queue_task(name, response_view: nil, fields: nil, quota_user: nil, options: nil, &block)
670
+ command = make_simple_command(:get, 'v2beta3/{+name}', options)
671
+ command.response_representation = Google::Apis::CloudtasksV2beta3::Task::Representation
672
+ command.response_class = Google::Apis::CloudtasksV2beta3::Task
673
+ command.params['name'] = name unless name.nil?
674
+ command.query['responseView'] = response_view unless response_view.nil?
675
+ command.query['fields'] = fields unless fields.nil?
676
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
677
+ execute_or_queue_command(command, &block)
678
+ end
679
+
680
+ # Lists the tasks in a queue. By default, only the BASIC view is retrieved due
681
+ # to performance considerations; response_view controls the subset of
682
+ # information which is returned. The tasks may be returned in any order. The
683
+ # ordering may change at any time.
684
+ # @param [String] parent
685
+ # Required. The queue name. For example: `projects/PROJECT_ID/locations/
686
+ # LOCATION_ID/queues/QUEUE_ID`
687
+ # @param [Fixnum] page_size
688
+ # Maximum page size. Fewer tasks than requested might be returned, even if more
689
+ # tasks exist; use next_page_token in the response to determine if more tasks
690
+ # exist. The maximum page size is 1000. If unspecified, the page size will be
691
+ # the maximum.
692
+ # @param [String] page_token
693
+ # A token identifying the page of results to return. To request the first page
694
+ # results, page_token must be empty. To request the next page of results,
695
+ # page_token must be the value of next_page_token returned from the previous
696
+ # call to ListTasks method. The page token is valid for only 2 hours.
697
+ # @param [String] response_view
698
+ # The response_view specifies which subset of the Task will be returned. By
699
+ # default response_view is BASIC; not all information is retrieved by default
700
+ # because some data, such as payloads, might be desirable to return only when
701
+ # needed because of its large size or because of the sensitivity of data that it
702
+ # contains. Authorization for FULL requires `cloudtasks.tasks.fullView` [Google
703
+ # IAM](https://cloud.google.com/iam/) permission on the Task resource.
704
+ # @param [String] fields
705
+ # Selector specifying which fields to include in a partial response.
706
+ # @param [String] quota_user
707
+ # Available to use for quota purposes for server-side applications. Can be any
708
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
709
+ # @param [Google::Apis::RequestOptions] options
710
+ # Request-specific options
711
+ #
712
+ # @yield [result, err] Result & error if block supplied
713
+ # @yieldparam result [Google::Apis::CloudtasksV2beta3::ListTasksResponse] parsed result object
714
+ # @yieldparam err [StandardError] error object if request failed
715
+ #
716
+ # @return [Google::Apis::CloudtasksV2beta3::ListTasksResponse]
717
+ #
718
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
719
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
720
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
721
+ def list_project_location_queue_tasks(parent, page_size: nil, page_token: nil, response_view: nil, fields: nil, quota_user: nil, options: nil, &block)
722
+ command = make_simple_command(:get, 'v2beta3/{+parent}/tasks', options)
723
+ command.response_representation = Google::Apis::CloudtasksV2beta3::ListTasksResponse::Representation
724
+ command.response_class = Google::Apis::CloudtasksV2beta3::ListTasksResponse
725
+ command.params['parent'] = parent unless parent.nil?
726
+ command.query['pageSize'] = page_size unless page_size.nil?
727
+ command.query['pageToken'] = page_token unless page_token.nil?
728
+ command.query['responseView'] = response_view unless response_view.nil?
729
+ command.query['fields'] = fields unless fields.nil?
730
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
731
+ execute_or_queue_command(command, &block)
732
+ end
733
+
734
+ # Forces a task to run now. When this method is called, Cloud Tasks will
735
+ # dispatch the task, even if the task is already running, the queue has reached
736
+ # its RateLimits or is PAUSED. This command is meant to be used for manual
737
+ # debugging. For example, RunTask can be used to retry a failed task after a fix
738
+ # has been made or to manually force a task to be dispatched now. The dispatched
739
+ # task is returned. That is, the task that is returned contains the status after
740
+ # the task is dispatched but before the task is received by its target. If Cloud
741
+ # Tasks receives a successful response from the task's target, then the task
742
+ # will be deleted; otherwise the task's schedule_time will be reset to the time
743
+ # that RunTask was called plus the retry delay specified in the queue's
744
+ # RetryConfig. RunTask returns NOT_FOUND when it is called on a task that has
745
+ # already succeeded or permanently failed.
746
+ # @param [String] name
747
+ # Required. The task name. For example: `projects/PROJECT_ID/locations/
748
+ # LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID`
749
+ # @param [Google::Apis::CloudtasksV2beta3::RunTaskRequest] run_task_request_object
750
+ # @param [String] fields
751
+ # Selector specifying which fields to include in a partial response.
752
+ # @param [String] quota_user
753
+ # Available to use for quota purposes for server-side applications. Can be any
754
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
755
+ # @param [Google::Apis::RequestOptions] options
756
+ # Request-specific options
757
+ #
758
+ # @yield [result, err] Result & error if block supplied
759
+ # @yieldparam result [Google::Apis::CloudtasksV2beta3::Task] parsed result object
760
+ # @yieldparam err [StandardError] error object if request failed
761
+ #
762
+ # @return [Google::Apis::CloudtasksV2beta3::Task]
763
+ #
764
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
765
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
766
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
767
+ def run_task(name, run_task_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
768
+ command = make_simple_command(:post, 'v2beta3/{+name}:run', options)
769
+ command.request_representation = Google::Apis::CloudtasksV2beta3::RunTaskRequest::Representation
770
+ command.request_object = run_task_request_object
771
+ command.response_representation = Google::Apis::CloudtasksV2beta3::Task::Representation
772
+ command.response_class = Google::Apis::CloudtasksV2beta3::Task
773
+ command.params['name'] = name unless name.nil?
774
+ command.query['fields'] = fields unless fields.nil?
775
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
776
+ execute_or_queue_command(command, &block)
777
+ end
778
+
779
+ protected
780
+
781
+ def apply_command_defaults(command)
782
+ command.query['key'] = key unless key.nil?
783
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
784
+ end
785
+ end
786
+ end
787
+ end
788
+ end