google-apis-cloudtasks_v2 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,774 @@
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 CloudtasksV2
23
+ # Cloud Tasks API
24
+ #
25
+ # Manages the execution of large numbers of distributed requests.
26
+ #
27
+ # @example
28
+ # require 'google/apis/cloudtasks_v2'
29
+ #
30
+ # Cloudtasks = Google::Apis::CloudtasksV2 # 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_v2',
48
+ client_version: Google::Apis::CloudtasksV2::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::CloudtasksV2::Location] parsed result object
65
+ # @yieldparam err [StandardError] error object if request failed
66
+ #
67
+ # @return [Google::Apis::CloudtasksV2::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, 'v2/{+name}', options)
74
+ command.response_representation = Google::Apis::CloudtasksV2::Location::Representation
75
+ command.response_class = Google::Apis::CloudtasksV2::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::CloudtasksV2::ListLocationsResponse] parsed result object
101
+ # @yieldparam err [StandardError] error object if request failed
102
+ #
103
+ # @return [Google::Apis::CloudtasksV2::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, 'v2/{+name}/locations', options)
110
+ command.response_representation = Google::Apis::CloudtasksV2::ListLocationsResponse::Representation
111
+ command.response_class = Google::Apis::CloudtasksV2::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::CloudtasksV2::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::CloudtasksV2::Queue] parsed result object
143
+ # @yieldparam err [StandardError] error object if request failed
144
+ #
145
+ # @return [Google::Apis::CloudtasksV2::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, 'v2/{+parent}/queues', options)
152
+ command.request_representation = Google::Apis::CloudtasksV2::Queue::Representation
153
+ command.request_object = queue_object
154
+ command.response_representation = Google::Apis::CloudtasksV2::Queue::Representation
155
+ command.response_class = Google::Apis::CloudtasksV2::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::CloudtasksV2::Empty] parsed result object
181
+ # @yieldparam err [StandardError] error object if request failed
182
+ #
183
+ # @return [Google::Apis::CloudtasksV2::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, 'v2/{+name}', options)
190
+ command.response_representation = Google::Apis::CloudtasksV2::Empty::Representation
191
+ command.response_class = Google::Apis::CloudtasksV2::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] fields
203
+ # Selector specifying which fields to include in a partial response.
204
+ # @param [String] quota_user
205
+ # Available to use for quota purposes for server-side applications. Can be any
206
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
207
+ # @param [Google::Apis::RequestOptions] options
208
+ # Request-specific options
209
+ #
210
+ # @yield [result, err] Result & error if block supplied
211
+ # @yieldparam result [Google::Apis::CloudtasksV2::Queue] parsed result object
212
+ # @yieldparam err [StandardError] error object if request failed
213
+ #
214
+ # @return [Google::Apis::CloudtasksV2::Queue]
215
+ #
216
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
217
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
218
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
219
+ def get_project_location_queue(name, fields: nil, quota_user: nil, options: nil, &block)
220
+ command = make_simple_command(:get, 'v2/{+name}', options)
221
+ command.response_representation = Google::Apis::CloudtasksV2::Queue::Representation
222
+ command.response_class = Google::Apis::CloudtasksV2::Queue
223
+ command.params['name'] = name unless name.nil?
224
+ command.query['fields'] = fields unless fields.nil?
225
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
226
+ execute_or_queue_command(command, &block)
227
+ end
228
+
229
+ # Gets the access control policy for a Queue. Returns an empty policy if the
230
+ # resource exists and does not have a policy set. Authorization requires the
231
+ # following [Google IAM](https://cloud.google.com/iam) permission on the
232
+ # specified resource parent: * `cloudtasks.queues.getIamPolicy`
233
+ # @param [String] resource
234
+ # REQUIRED: The resource for which the policy is being requested. See the
235
+ # operation documentation for the appropriate value for this field.
236
+ # @param [Google::Apis::CloudtasksV2::GetIamPolicyRequest] get_iam_policy_request_object
237
+ # @param [String] fields
238
+ # Selector specifying which fields to include in a partial response.
239
+ # @param [String] quota_user
240
+ # Available to use for quota purposes for server-side applications. Can be any
241
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
242
+ # @param [Google::Apis::RequestOptions] options
243
+ # Request-specific options
244
+ #
245
+ # @yield [result, err] Result & error if block supplied
246
+ # @yieldparam result [Google::Apis::CloudtasksV2::Policy] parsed result object
247
+ # @yieldparam err [StandardError] error object if request failed
248
+ #
249
+ # @return [Google::Apis::CloudtasksV2::Policy]
250
+ #
251
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
252
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
253
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
254
+ def get_queue_iam_policy(resource, get_iam_policy_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
255
+ command = make_simple_command(:post, 'v2/{+resource}:getIamPolicy', options)
256
+ command.request_representation = Google::Apis::CloudtasksV2::GetIamPolicyRequest::Representation
257
+ command.request_object = get_iam_policy_request_object
258
+ command.response_representation = Google::Apis::CloudtasksV2::Policy::Representation
259
+ command.response_class = Google::Apis::CloudtasksV2::Policy
260
+ command.params['resource'] = resource unless resource.nil?
261
+ command.query['fields'] = fields unless fields.nil?
262
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
263
+ execute_or_queue_command(command, &block)
264
+ end
265
+
266
+ # Lists queues. Queues are returned in lexicographical order.
267
+ # @param [String] parent
268
+ # Required. The location name. For example: `projects/PROJECT_ID/locations/
269
+ # LOCATION_ID`
270
+ # @param [String] filter
271
+ # `filter` can be used to specify a subset of queues. Any Queue field can be
272
+ # used as a filter and several operators as supported. For example: `<=, <, >=, >
273
+ # , !=, =, :`. The filter syntax is the same as described in [Stackdriver's
274
+ # Advanced Logs Filters](https://cloud.google.com/logging/docs/view/
275
+ # advanced_filters). Sample filter "state: PAUSED". Note that using filters
276
+ # might cause fewer queues than the requested page_size to be returned.
277
+ # @param [Fixnum] page_size
278
+ # Requested page size. The maximum page size is 9800. If unspecified, the page
279
+ # size will be the maximum. Fewer queues than requested might be returned, even
280
+ # if more queues exist; use the next_page_token in the response to determine if
281
+ # more queues exist.
282
+ # @param [String] page_token
283
+ # A token identifying the page of results to return. To request the first page
284
+ # results, page_token must be empty. To request the next page of results,
285
+ # page_token must be the value of next_page_token returned from the previous
286
+ # call to ListQueues method. It is an error to switch the value of the filter
287
+ # while iterating through pages.
288
+ # @param [String] fields
289
+ # Selector specifying which fields to include in a partial response.
290
+ # @param [String] quota_user
291
+ # Available to use for quota purposes for server-side applications. Can be any
292
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
293
+ # @param [Google::Apis::RequestOptions] options
294
+ # Request-specific options
295
+ #
296
+ # @yield [result, err] Result & error if block supplied
297
+ # @yieldparam result [Google::Apis::CloudtasksV2::ListQueuesResponse] parsed result object
298
+ # @yieldparam err [StandardError] error object if request failed
299
+ #
300
+ # @return [Google::Apis::CloudtasksV2::ListQueuesResponse]
301
+ #
302
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
303
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
304
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
305
+ def list_project_location_queues(parent, filter: nil, page_size: nil, page_token: nil, fields: nil, quota_user: nil, options: nil, &block)
306
+ command = make_simple_command(:get, 'v2/{+parent}/queues', options)
307
+ command.response_representation = Google::Apis::CloudtasksV2::ListQueuesResponse::Representation
308
+ command.response_class = Google::Apis::CloudtasksV2::ListQueuesResponse
309
+ command.params['parent'] = parent unless parent.nil?
310
+ command.query['filter'] = filter unless filter.nil?
311
+ command.query['pageSize'] = page_size unless page_size.nil?
312
+ command.query['pageToken'] = page_token unless page_token.nil?
313
+ command.query['fields'] = fields unless fields.nil?
314
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
315
+ execute_or_queue_command(command, &block)
316
+ end
317
+
318
+ # Updates a queue. This method creates the queue if it does not exist and
319
+ # updates the queue if it does exist. Queues created with this method allow
320
+ # tasks to live for a maximum of 31 days. After a task is 31 days old, the task
321
+ # will be deleted regardless of whether it was dispatched or not. WARNING: Using
322
+ # this method may have unintended side effects if you are using an App Engine `
323
+ # queue.yaml` or `queue.xml` file to manage your queues. Read [Overview of Queue
324
+ # Management and queue.yaml](https://cloud.google.com/tasks/docs/queue-yaml)
325
+ # before using this method.
326
+ # @param [String] name
327
+ # Caller-specified and required in CreateQueue, after which it becomes output
328
+ # only. The queue name. The queue name must have the following format: `projects/
329
+ # PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID` * `PROJECT_ID` can contain
330
+ # letters ([A-Za-z]), numbers ([0-9]), hyphens (-), colons (:), or periods (.).
331
+ # For more information, see [Identifying projects](https://cloud.google.com/
332
+ # resource-manager/docs/creating-managing-projects#identifying_projects) * `
333
+ # LOCATION_ID` is the canonical ID for the queue's location. The list of
334
+ # available locations can be obtained by calling ListLocations. For more
335
+ # information, see https://cloud.google.com/about/locations/. * `QUEUE_ID` can
336
+ # contain letters ([A-Za-z]), numbers ([0-9]), or hyphens (-). The maximum
337
+ # length is 100 characters.
338
+ # @param [Google::Apis::CloudtasksV2::Queue] queue_object
339
+ # @param [String] update_mask
340
+ # A mask used to specify which fields of the queue are being updated. If empty,
341
+ # then all fields will be updated.
342
+ # @param [String] fields
343
+ # Selector specifying which fields to include in a partial response.
344
+ # @param [String] quota_user
345
+ # Available to use for quota purposes for server-side applications. Can be any
346
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
347
+ # @param [Google::Apis::RequestOptions] options
348
+ # Request-specific options
349
+ #
350
+ # @yield [result, err] Result & error if block supplied
351
+ # @yieldparam result [Google::Apis::CloudtasksV2::Queue] parsed result object
352
+ # @yieldparam err [StandardError] error object if request failed
353
+ #
354
+ # @return [Google::Apis::CloudtasksV2::Queue]
355
+ #
356
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
357
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
358
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
359
+ def patch_project_location_queue(name, queue_object = nil, update_mask: nil, fields: nil, quota_user: nil, options: nil, &block)
360
+ command = make_simple_command(:patch, 'v2/{+name}', options)
361
+ command.request_representation = Google::Apis::CloudtasksV2::Queue::Representation
362
+ command.request_object = queue_object
363
+ command.response_representation = Google::Apis::CloudtasksV2::Queue::Representation
364
+ command.response_class = Google::Apis::CloudtasksV2::Queue
365
+ command.params['name'] = name unless name.nil?
366
+ command.query['updateMask'] = update_mask unless update_mask.nil?
367
+ command.query['fields'] = fields unless fields.nil?
368
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
369
+ execute_or_queue_command(command, &block)
370
+ end
371
+
372
+ # Pauses the queue. If a queue is paused then the system will stop dispatching
373
+ # tasks until the queue is resumed via ResumeQueue. Tasks can still be added
374
+ # when the queue is paused. A queue is paused if its state is PAUSED.
375
+ # @param [String] name
376
+ # Required. The queue name. For example: `projects/PROJECT_ID/location/
377
+ # LOCATION_ID/queues/QUEUE_ID`
378
+ # @param [Google::Apis::CloudtasksV2::PauseQueueRequest] pause_queue_request_object
379
+ # @param [String] fields
380
+ # Selector specifying which fields to include in a partial response.
381
+ # @param [String] quota_user
382
+ # Available to use for quota purposes for server-side applications. Can be any
383
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
384
+ # @param [Google::Apis::RequestOptions] options
385
+ # Request-specific options
386
+ #
387
+ # @yield [result, err] Result & error if block supplied
388
+ # @yieldparam result [Google::Apis::CloudtasksV2::Queue] parsed result object
389
+ # @yieldparam err [StandardError] error object if request failed
390
+ #
391
+ # @return [Google::Apis::CloudtasksV2::Queue]
392
+ #
393
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
394
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
395
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
396
+ def pause_queue(name, pause_queue_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
397
+ command = make_simple_command(:post, 'v2/{+name}:pause', options)
398
+ command.request_representation = Google::Apis::CloudtasksV2::PauseQueueRequest::Representation
399
+ command.request_object = pause_queue_request_object
400
+ command.response_representation = Google::Apis::CloudtasksV2::Queue::Representation
401
+ command.response_class = Google::Apis::CloudtasksV2::Queue
402
+ command.params['name'] = name unless name.nil?
403
+ command.query['fields'] = fields unless fields.nil?
404
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
405
+ execute_or_queue_command(command, &block)
406
+ end
407
+
408
+ # Purges a queue by deleting all of its tasks. All tasks created before this
409
+ # method is called are permanently deleted. Purge operations can take up to one
410
+ # minute to take effect. Tasks might be dispatched before the purge takes effect.
411
+ # A purge is irreversible.
412
+ # @param [String] name
413
+ # Required. The queue name. For example: `projects/PROJECT_ID/location/
414
+ # LOCATION_ID/queues/QUEUE_ID`
415
+ # @param [Google::Apis::CloudtasksV2::PurgeQueueRequest] purge_queue_request_object
416
+ # @param [String] fields
417
+ # Selector specifying which fields to include in a partial response.
418
+ # @param [String] quota_user
419
+ # Available to use for quota purposes for server-side applications. Can be any
420
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
421
+ # @param [Google::Apis::RequestOptions] options
422
+ # Request-specific options
423
+ #
424
+ # @yield [result, err] Result & error if block supplied
425
+ # @yieldparam result [Google::Apis::CloudtasksV2::Queue] parsed result object
426
+ # @yieldparam err [StandardError] error object if request failed
427
+ #
428
+ # @return [Google::Apis::CloudtasksV2::Queue]
429
+ #
430
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
431
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
432
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
433
+ def purge_queue(name, purge_queue_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
434
+ command = make_simple_command(:post, 'v2/{+name}:purge', options)
435
+ command.request_representation = Google::Apis::CloudtasksV2::PurgeQueueRequest::Representation
436
+ command.request_object = purge_queue_request_object
437
+ command.response_representation = Google::Apis::CloudtasksV2::Queue::Representation
438
+ command.response_class = Google::Apis::CloudtasksV2::Queue
439
+ command.params['name'] = name unless name.nil?
440
+ command.query['fields'] = fields unless fields.nil?
441
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
442
+ execute_or_queue_command(command, &block)
443
+ end
444
+
445
+ # Resume a queue. This method resumes a queue after it has been PAUSED or
446
+ # DISABLED. The state of a queue is stored in the queue's state; after calling
447
+ # this method it will be set to RUNNING. WARNING: Resuming many high-QPS queues
448
+ # at the same time can lead to target overloading. If you are resuming high-QPS
449
+ # queues, follow the 500/50/5 pattern described in [Managing Cloud Tasks Scaling
450
+ # Risks](https://cloud.google.com/tasks/docs/manage-cloud-task-scaling).
451
+ # @param [String] name
452
+ # Required. The queue name. For example: `projects/PROJECT_ID/location/
453
+ # LOCATION_ID/queues/QUEUE_ID`
454
+ # @param [Google::Apis::CloudtasksV2::ResumeQueueRequest] resume_queue_request_object
455
+ # @param [String] fields
456
+ # Selector specifying which fields to include in a partial response.
457
+ # @param [String] quota_user
458
+ # Available to use for quota purposes for server-side applications. Can be any
459
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
460
+ # @param [Google::Apis::RequestOptions] options
461
+ # Request-specific options
462
+ #
463
+ # @yield [result, err] Result & error if block supplied
464
+ # @yieldparam result [Google::Apis::CloudtasksV2::Queue] parsed result object
465
+ # @yieldparam err [StandardError] error object if request failed
466
+ #
467
+ # @return [Google::Apis::CloudtasksV2::Queue]
468
+ #
469
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
470
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
471
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
472
+ def resume_queue(name, resume_queue_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
473
+ command = make_simple_command(:post, 'v2/{+name}:resume', options)
474
+ command.request_representation = Google::Apis::CloudtasksV2::ResumeQueueRequest::Representation
475
+ command.request_object = resume_queue_request_object
476
+ command.response_representation = Google::Apis::CloudtasksV2::Queue::Representation
477
+ command.response_class = Google::Apis::CloudtasksV2::Queue
478
+ command.params['name'] = name unless name.nil?
479
+ command.query['fields'] = fields unless fields.nil?
480
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
481
+ execute_or_queue_command(command, &block)
482
+ end
483
+
484
+ # Sets the access control policy for a Queue. Replaces any existing policy. Note:
485
+ # The Cloud Console does not check queue-level IAM permissions yet. Project-
486
+ # level permissions are required to use the Cloud Console. Authorization
487
+ # requires the following [Google IAM](https://cloud.google.com/iam) permission
488
+ # on the specified resource parent: * `cloudtasks.queues.setIamPolicy`
489
+ # @param [String] resource
490
+ # REQUIRED: The resource for which the policy is being specified. See the
491
+ # operation documentation for the appropriate value for this field.
492
+ # @param [Google::Apis::CloudtasksV2::SetIamPolicyRequest] set_iam_policy_request_object
493
+ # @param [String] fields
494
+ # Selector specifying which fields to include in a partial response.
495
+ # @param [String] quota_user
496
+ # Available to use for quota purposes for server-side applications. Can be any
497
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
498
+ # @param [Google::Apis::RequestOptions] options
499
+ # Request-specific options
500
+ #
501
+ # @yield [result, err] Result & error if block supplied
502
+ # @yieldparam result [Google::Apis::CloudtasksV2::Policy] parsed result object
503
+ # @yieldparam err [StandardError] error object if request failed
504
+ #
505
+ # @return [Google::Apis::CloudtasksV2::Policy]
506
+ #
507
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
508
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
509
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
510
+ def set_queue_iam_policy(resource, set_iam_policy_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
511
+ command = make_simple_command(:post, 'v2/{+resource}:setIamPolicy', options)
512
+ command.request_representation = Google::Apis::CloudtasksV2::SetIamPolicyRequest::Representation
513
+ command.request_object = set_iam_policy_request_object
514
+ command.response_representation = Google::Apis::CloudtasksV2::Policy::Representation
515
+ command.response_class = Google::Apis::CloudtasksV2::Policy
516
+ command.params['resource'] = resource unless resource.nil?
517
+ command.query['fields'] = fields unless fields.nil?
518
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
519
+ execute_or_queue_command(command, &block)
520
+ end
521
+
522
+ # Returns permissions that a caller has on a Queue. If the resource does not
523
+ # exist, this will return an empty set of permissions, not a NOT_FOUND error.
524
+ # Note: This operation is designed to be used for building permission-aware UIs
525
+ # and command-line tools, not for authorization checking. This operation may "
526
+ # fail open" without warning.
527
+ # @param [String] resource
528
+ # REQUIRED: The resource for which the policy detail is being requested. See the
529
+ # operation documentation for the appropriate value for this field.
530
+ # @param [Google::Apis::CloudtasksV2::TestIamPermissionsRequest] test_iam_permissions_request_object
531
+ # @param [String] fields
532
+ # Selector specifying which fields to include in a partial response.
533
+ # @param [String] quota_user
534
+ # Available to use for quota purposes for server-side applications. Can be any
535
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
536
+ # @param [Google::Apis::RequestOptions] options
537
+ # Request-specific options
538
+ #
539
+ # @yield [result, err] Result & error if block supplied
540
+ # @yieldparam result [Google::Apis::CloudtasksV2::TestIamPermissionsResponse] parsed result object
541
+ # @yieldparam err [StandardError] error object if request failed
542
+ #
543
+ # @return [Google::Apis::CloudtasksV2::TestIamPermissionsResponse]
544
+ #
545
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
546
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
547
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
548
+ def test_queue_iam_permissions(resource, test_iam_permissions_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
549
+ command = make_simple_command(:post, 'v2/{+resource}:testIamPermissions', options)
550
+ command.request_representation = Google::Apis::CloudtasksV2::TestIamPermissionsRequest::Representation
551
+ command.request_object = test_iam_permissions_request_object
552
+ command.response_representation = Google::Apis::CloudtasksV2::TestIamPermissionsResponse::Representation
553
+ command.response_class = Google::Apis::CloudtasksV2::TestIamPermissionsResponse
554
+ command.params['resource'] = resource unless resource.nil?
555
+ command.query['fields'] = fields unless fields.nil?
556
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
557
+ execute_or_queue_command(command, &block)
558
+ end
559
+
560
+ # Creates a task and adds it to a queue. Tasks cannot be updated after creation;
561
+ # there is no UpdateTask command. * The maximum task size is 100KB.
562
+ # @param [String] parent
563
+ # Required. The queue name. For example: `projects/PROJECT_ID/locations/
564
+ # LOCATION_ID/queues/QUEUE_ID` The queue must already exist.
565
+ # @param [Google::Apis::CloudtasksV2::CreateTaskRequest] create_task_request_object
566
+ # @param [String] fields
567
+ # Selector specifying which fields to include in a partial response.
568
+ # @param [String] quota_user
569
+ # Available to use for quota purposes for server-side applications. Can be any
570
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
571
+ # @param [Google::Apis::RequestOptions] options
572
+ # Request-specific options
573
+ #
574
+ # @yield [result, err] Result & error if block supplied
575
+ # @yieldparam result [Google::Apis::CloudtasksV2::Task] parsed result object
576
+ # @yieldparam err [StandardError] error object if request failed
577
+ #
578
+ # @return [Google::Apis::CloudtasksV2::Task]
579
+ #
580
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
581
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
582
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
583
+ def create_task(parent, create_task_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
584
+ command = make_simple_command(:post, 'v2/{+parent}/tasks', options)
585
+ command.request_representation = Google::Apis::CloudtasksV2::CreateTaskRequest::Representation
586
+ command.request_object = create_task_request_object
587
+ command.response_representation = Google::Apis::CloudtasksV2::Task::Representation
588
+ command.response_class = Google::Apis::CloudtasksV2::Task
589
+ command.params['parent'] = parent unless parent.nil?
590
+ command.query['fields'] = fields unless fields.nil?
591
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
592
+ execute_or_queue_command(command, &block)
593
+ end
594
+
595
+ # Deletes a task. A task can be deleted if it is scheduled or dispatched. A task
596
+ # cannot be deleted if it has executed successfully or permanently failed.
597
+ # @param [String] name
598
+ # Required. The task name. For example: `projects/PROJECT_ID/locations/
599
+ # LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID`
600
+ # @param [String] fields
601
+ # Selector specifying which fields to include in a partial response.
602
+ # @param [String] quota_user
603
+ # Available to use for quota purposes for server-side applications. Can be any
604
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
605
+ # @param [Google::Apis::RequestOptions] options
606
+ # Request-specific options
607
+ #
608
+ # @yield [result, err] Result & error if block supplied
609
+ # @yieldparam result [Google::Apis::CloudtasksV2::Empty] parsed result object
610
+ # @yieldparam err [StandardError] error object if request failed
611
+ #
612
+ # @return [Google::Apis::CloudtasksV2::Empty]
613
+ #
614
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
615
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
616
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
617
+ def delete_project_location_queue_task(name, fields: nil, quota_user: nil, options: nil, &block)
618
+ command = make_simple_command(:delete, 'v2/{+name}', options)
619
+ command.response_representation = Google::Apis::CloudtasksV2::Empty::Representation
620
+ command.response_class = Google::Apis::CloudtasksV2::Empty
621
+ command.params['name'] = name unless name.nil?
622
+ command.query['fields'] = fields unless fields.nil?
623
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
624
+ execute_or_queue_command(command, &block)
625
+ end
626
+
627
+ # Gets a task.
628
+ # @param [String] name
629
+ # Required. The task name. For example: `projects/PROJECT_ID/locations/
630
+ # LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID`
631
+ # @param [String] response_view
632
+ # The response_view specifies which subset of the Task will be returned. By
633
+ # default response_view is BASIC; not all information is retrieved by default
634
+ # because some data, such as payloads, might be desirable to return only when
635
+ # needed because of its large size or because of the sensitivity of data that it
636
+ # contains. Authorization for FULL requires `cloudtasks.tasks.fullView` [Google
637
+ # IAM](https://cloud.google.com/iam/) permission on the Task resource.
638
+ # @param [String] fields
639
+ # Selector specifying which fields to include in a partial response.
640
+ # @param [String] quota_user
641
+ # Available to use for quota purposes for server-side applications. Can be any
642
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
643
+ # @param [Google::Apis::RequestOptions] options
644
+ # Request-specific options
645
+ #
646
+ # @yield [result, err] Result & error if block supplied
647
+ # @yieldparam result [Google::Apis::CloudtasksV2::Task] parsed result object
648
+ # @yieldparam err [StandardError] error object if request failed
649
+ #
650
+ # @return [Google::Apis::CloudtasksV2::Task]
651
+ #
652
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
653
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
654
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
655
+ def get_project_location_queue_task(name, response_view: nil, fields: nil, quota_user: nil, options: nil, &block)
656
+ command = make_simple_command(:get, 'v2/{+name}', options)
657
+ command.response_representation = Google::Apis::CloudtasksV2::Task::Representation
658
+ command.response_class = Google::Apis::CloudtasksV2::Task
659
+ command.params['name'] = name unless name.nil?
660
+ command.query['responseView'] = response_view unless response_view.nil?
661
+ command.query['fields'] = fields unless fields.nil?
662
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
663
+ execute_or_queue_command(command, &block)
664
+ end
665
+
666
+ # Lists the tasks in a queue. By default, only the BASIC view is retrieved due
667
+ # to performance considerations; response_view controls the subset of
668
+ # information which is returned. The tasks may be returned in any order. The
669
+ # ordering may change at any time.
670
+ # @param [String] parent
671
+ # Required. The queue name. For example: `projects/PROJECT_ID/locations/
672
+ # LOCATION_ID/queues/QUEUE_ID`
673
+ # @param [Fixnum] page_size
674
+ # Maximum page size. Fewer tasks than requested might be returned, even if more
675
+ # tasks exist; use next_page_token in the response to determine if more tasks
676
+ # exist. The maximum page size is 1000. If unspecified, the page size will be
677
+ # the maximum.
678
+ # @param [String] page_token
679
+ # A token identifying the page of results to return. To request the first page
680
+ # results, page_token must be empty. To request the next page of results,
681
+ # page_token must be the value of next_page_token returned from the previous
682
+ # call to ListTasks method. The page token is valid for only 2 hours.
683
+ # @param [String] response_view
684
+ # The response_view specifies which subset of the Task will be returned. By
685
+ # default response_view is BASIC; not all information is retrieved by default
686
+ # because some data, such as payloads, might be desirable to return only when
687
+ # needed because of its large size or because of the sensitivity of data that it
688
+ # contains. Authorization for FULL requires `cloudtasks.tasks.fullView` [Google
689
+ # IAM](https://cloud.google.com/iam/) permission on the Task resource.
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::CloudtasksV2::ListTasksResponse] parsed result object
700
+ # @yieldparam err [StandardError] error object if request failed
701
+ #
702
+ # @return [Google::Apis::CloudtasksV2::ListTasksResponse]
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 list_project_location_queue_tasks(parent, page_size: nil, page_token: nil, response_view: nil, fields: nil, quota_user: nil, options: nil, &block)
708
+ command = make_simple_command(:get, 'v2/{+parent}/tasks', options)
709
+ command.response_representation = Google::Apis::CloudtasksV2::ListTasksResponse::Representation
710
+ command.response_class = Google::Apis::CloudtasksV2::ListTasksResponse
711
+ command.params['parent'] = parent unless parent.nil?
712
+ command.query['pageSize'] = page_size unless page_size.nil?
713
+ command.query['pageToken'] = page_token unless page_token.nil?
714
+ command.query['responseView'] = response_view unless response_view.nil?
715
+ command.query['fields'] = fields unless fields.nil?
716
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
717
+ execute_or_queue_command(command, &block)
718
+ end
719
+
720
+ # Forces a task to run now. When this method is called, Cloud Tasks will
721
+ # dispatch the task, even if the task is already running, the queue has reached
722
+ # its RateLimits or is PAUSED. This command is meant to be used for manual
723
+ # debugging. For example, RunTask can be used to retry a failed task after a fix
724
+ # has been made or to manually force a task to be dispatched now. The dispatched
725
+ # task is returned. That is, the task that is returned contains the status after
726
+ # the task is dispatched but before the task is received by its target. If Cloud
727
+ # Tasks receives a successful response from the task's target, then the task
728
+ # will be deleted; otherwise the task's schedule_time will be reset to the time
729
+ # that RunTask was called plus the retry delay specified in the queue's
730
+ # RetryConfig. RunTask returns NOT_FOUND when it is called on a task that has
731
+ # already succeeded or permanently failed.
732
+ # @param [String] name
733
+ # Required. The task name. For example: `projects/PROJECT_ID/locations/
734
+ # LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID`
735
+ # @param [Google::Apis::CloudtasksV2::RunTaskRequest] run_task_request_object
736
+ # @param [String] fields
737
+ # Selector specifying which fields to include in a partial response.
738
+ # @param [String] quota_user
739
+ # Available to use for quota purposes for server-side applications. Can be any
740
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
741
+ # @param [Google::Apis::RequestOptions] options
742
+ # Request-specific options
743
+ #
744
+ # @yield [result, err] Result & error if block supplied
745
+ # @yieldparam result [Google::Apis::CloudtasksV2::Task] parsed result object
746
+ # @yieldparam err [StandardError] error object if request failed
747
+ #
748
+ # @return [Google::Apis::CloudtasksV2::Task]
749
+ #
750
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
751
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
752
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
753
+ def run_task(name, run_task_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
754
+ command = make_simple_command(:post, 'v2/{+name}:run', options)
755
+ command.request_representation = Google::Apis::CloudtasksV2::RunTaskRequest::Representation
756
+ command.request_object = run_task_request_object
757
+ command.response_representation = Google::Apis::CloudtasksV2::Task::Representation
758
+ command.response_class = Google::Apis::CloudtasksV2::Task
759
+ command.params['name'] = name unless name.nil?
760
+ command.query['fields'] = fields unless fields.nil?
761
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
762
+ execute_or_queue_command(command, &block)
763
+ end
764
+
765
+ protected
766
+
767
+ def apply_command_defaults(command)
768
+ command.query['key'] = key unless key.nil?
769
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
770
+ end
771
+ end
772
+ end
773
+ end
774
+ end