google-cloud-tasks-v2beta2 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (36) hide show
  1. checksums.yaml +7 -0
  2. data/.yardopts +12 -0
  3. data/AUTHENTICATION.md +169 -0
  4. data/LICENSE.md +203 -0
  5. data/README.md +71 -0
  6. data/lib/google-cloud-tasks-v2beta2.rb +21 -0
  7. data/lib/google/cloud/common_resources_pb.rb +15 -0
  8. data/lib/google/cloud/tasks/v2beta2.rb +35 -0
  9. data/lib/google/cloud/tasks/v2beta2/cloud_tasks.rb +50 -0
  10. data/lib/google/cloud/tasks/v2beta2/cloud_tasks/client.rb +2324 -0
  11. data/lib/google/cloud/tasks/v2beta2/cloud_tasks/credentials.rb +51 -0
  12. data/lib/google/cloud/tasks/v2beta2/cloud_tasks/paths.rb +90 -0
  13. data/lib/google/cloud/tasks/v2beta2/cloudtasks_pb.rb +134 -0
  14. data/lib/google/cloud/tasks/v2beta2/cloudtasks_services_pb.rb +257 -0
  15. data/lib/google/cloud/tasks/v2beta2/queue_pb.rb +59 -0
  16. data/lib/google/cloud/tasks/v2beta2/target_pb.rb +55 -0
  17. data/lib/google/cloud/tasks/v2beta2/task_pb.rb +55 -0
  18. data/lib/google/cloud/tasks/v2beta2/version.rb +28 -0
  19. data/proto_docs/README.md +4 -0
  20. data/proto_docs/google/api/field_behavior.rb +59 -0
  21. data/proto_docs/google/api/resource.rb +247 -0
  22. data/proto_docs/google/cloud/tasks/v2beta2/cloudtasks.rb +547 -0
  23. data/proto_docs/google/cloud/tasks/v2beta2/queue.rb +349 -0
  24. data/proto_docs/google/cloud/tasks/v2beta2/target.rb +405 -0
  25. data/proto_docs/google/cloud/tasks/v2beta2/task.rb +179 -0
  26. data/proto_docs/google/iam/v1/iam_policy.rb +80 -0
  27. data/proto_docs/google/iam/v1/options.rb +40 -0
  28. data/proto_docs/google/iam/v1/policy.rb +248 -0
  29. data/proto_docs/google/protobuf/any.rb +138 -0
  30. data/proto_docs/google/protobuf/duration.rb +98 -0
  31. data/proto_docs/google/protobuf/empty.rb +36 -0
  32. data/proto_docs/google/protobuf/field_mask.rb +229 -0
  33. data/proto_docs/google/protobuf/timestamp.rb +120 -0
  34. data/proto_docs/google/rpc/status.rb +46 -0
  35. data/proto_docs/google/type/expr.rb +52 -0
  36. metadata +211 -0
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2020 Google LLC
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # https://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+ # Auto-generated by gapic-generator-ruby. DO NOT EDIT!
18
+
19
+ # This gem does not autoload during Bundler.require. To load this gem,
20
+ # issue explicit require statements for the packages desired, e.g.:
21
+ # require "google/cloud/tasks/v2beta2"
@@ -0,0 +1,15 @@
1
+ # Generated by the protocol buffer compiler. DO NOT EDIT!
2
+ # source: google/cloud/common_resources.proto
3
+
4
+ require 'google/protobuf'
5
+
6
+ require 'google/api/resource_pb'
7
+ Google::Protobuf::DescriptorPool.generated_pool.build do
8
+ add_file("google/cloud/common_resources.proto", :syntax => :proto3) do
9
+ end
10
+ end
11
+
12
+ module Google
13
+ module Cloud
14
+ end
15
+ end
@@ -0,0 +1,35 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2020 Google LLC
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # https://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+ # Auto-generated by gapic-generator-ruby. DO NOT EDIT!
18
+
19
+ require "google/cloud/tasks/v2beta2/cloud_tasks"
20
+ require "google/cloud/tasks/v2beta2/version"
21
+
22
+ module Google
23
+ module Cloud
24
+ module Tasks
25
+ ##
26
+ # To load this package, including all its services, and instantiate a client:
27
+ #
28
+ # require "google/cloud/tasks/v2beta2"
29
+ # client = ::Google::Cloud::Tasks::V2beta2::CloudTasks::Client.new
30
+ #
31
+ module V2beta2
32
+ end
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,50 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2020 Google LLC
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # https://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+ # Auto-generated by gapic-generator-ruby. DO NOT EDIT!
18
+
19
+ require "gapic/common"
20
+ require "gapic/config"
21
+ require "gapic/config/method"
22
+
23
+ require "google/cloud/tasks/v2beta2/version"
24
+
25
+ require "google/cloud/tasks/v2beta2/cloud_tasks/credentials"
26
+ require "google/cloud/tasks/v2beta2/cloud_tasks/paths"
27
+ require "google/cloud/tasks/v2beta2/cloud_tasks/client"
28
+
29
+ module Google
30
+ module Cloud
31
+ module Tasks
32
+ module V2beta2
33
+ ##
34
+ # Cloud Tasks allows developers to manage the execution of background
35
+ # work in their applications.
36
+ #
37
+ # To load this service and instantiate a client:
38
+ #
39
+ # require "google/cloud/tasks/v2beta2/cloud_tasks"
40
+ # client = ::Google::Cloud::Tasks::V2beta2::CloudTasks::Client.new
41
+ #
42
+ module CloudTasks
43
+ end
44
+ end
45
+ end
46
+ end
47
+ end
48
+
49
+ helper_path = ::File.join __dir__, "cloud_tasks", "helpers.rb"
50
+ require "google/cloud/tasks/v2beta2/cloud_tasks/helpers" if ::File.file? helper_path
@@ -0,0 +1,2324 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2020 Google LLC
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # https://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+ # Auto-generated by gapic-generator-ruby. DO NOT EDIT!
18
+
19
+ require "google/cloud/errors"
20
+ require "google/cloud/tasks/v2beta2/cloudtasks_pb"
21
+
22
+ module Google
23
+ module Cloud
24
+ module Tasks
25
+ module V2beta2
26
+ module CloudTasks
27
+ ##
28
+ # Client for the CloudTasks service.
29
+ #
30
+ # Cloud Tasks allows developers to manage the execution of background
31
+ # work in their applications.
32
+ #
33
+ class Client
34
+ include Paths
35
+
36
+ # @private
37
+ attr_reader :cloud_tasks_stub
38
+
39
+ ##
40
+ # Configure the CloudTasks Client class.
41
+ #
42
+ # See {::Google::Cloud::Tasks::V2beta2::CloudTasks::Client::Configuration}
43
+ # for a description of the configuration fields.
44
+ #
45
+ # ## Example
46
+ #
47
+ # To modify the configuration for all CloudTasks clients:
48
+ #
49
+ # ::Google::Cloud::Tasks::V2beta2::CloudTasks::Client.configure do |config|
50
+ # config.timeout = 10.0
51
+ # end
52
+ #
53
+ # @yield [config] Configure the Client client.
54
+ # @yieldparam config [Client::Configuration]
55
+ #
56
+ # @return [Client::Configuration]
57
+ #
58
+ def self.configure
59
+ @configure ||= begin
60
+ namespace = ["Google", "Cloud", "Tasks", "V2beta2"]
61
+ parent_config = while namespace.any?
62
+ parent_name = namespace.join "::"
63
+ parent_const = const_get parent_name
64
+ break parent_const.configure if parent_const&.respond_to? :configure
65
+ namespace.pop
66
+ end
67
+ default_config = Client::Configuration.new parent_config
68
+
69
+ default_config.rpcs.list_queues.timeout = 10.0
70
+ default_config.rpcs.list_queues.retry_policy = {
71
+ initial_delay: 0.1,
72
+ max_delay: 10.0,
73
+ multiplier: 1.3,
74
+ retry_codes: ["UNAVAILABLE", "DEADLINE_EXCEEDED"]
75
+ }
76
+
77
+ default_config.rpcs.get_queue.timeout = 10.0
78
+ default_config.rpcs.get_queue.retry_policy = {
79
+ initial_delay: 0.1,
80
+ max_delay: 10.0,
81
+ multiplier: 1.3,
82
+ retry_codes: ["UNAVAILABLE", "DEADLINE_EXCEEDED"]
83
+ }
84
+
85
+ default_config.rpcs.create_queue.timeout = 10.0
86
+
87
+ default_config.rpcs.update_queue.timeout = 10.0
88
+
89
+ default_config.rpcs.delete_queue.timeout = 10.0
90
+ default_config.rpcs.delete_queue.retry_policy = {
91
+ initial_delay: 0.1,
92
+ max_delay: 10.0,
93
+ multiplier: 1.3,
94
+ retry_codes: ["UNAVAILABLE", "DEADLINE_EXCEEDED"]
95
+ }
96
+
97
+ default_config.rpcs.purge_queue.timeout = 10.0
98
+
99
+ default_config.rpcs.pause_queue.timeout = 10.0
100
+
101
+ default_config.rpcs.resume_queue.timeout = 10.0
102
+
103
+ default_config.rpcs.get_iam_policy.timeout = 10.0
104
+ default_config.rpcs.get_iam_policy.retry_policy = {
105
+ initial_delay: 0.1,
106
+ max_delay: 10.0,
107
+ multiplier: 1.3,
108
+ retry_codes: ["UNAVAILABLE", "DEADLINE_EXCEEDED"]
109
+ }
110
+
111
+ default_config.rpcs.set_iam_policy.timeout = 10.0
112
+
113
+ default_config.rpcs.test_iam_permissions.timeout = 10.0
114
+ default_config.rpcs.test_iam_permissions.retry_policy = {
115
+ initial_delay: 0.1,
116
+ max_delay: 10.0,
117
+ multiplier: 1.3,
118
+ retry_codes: ["UNAVAILABLE", "DEADLINE_EXCEEDED"]
119
+ }
120
+
121
+ default_config.rpcs.list_tasks.timeout = 10.0
122
+ default_config.rpcs.list_tasks.retry_policy = {
123
+ initial_delay: 0.1,
124
+ max_delay: 10.0,
125
+ multiplier: 1.3,
126
+ retry_codes: ["UNAVAILABLE", "DEADLINE_EXCEEDED"]
127
+ }
128
+
129
+ default_config.rpcs.get_task.timeout = 10.0
130
+ default_config.rpcs.get_task.retry_policy = {
131
+ initial_delay: 0.1,
132
+ max_delay: 10.0,
133
+ multiplier: 1.3,
134
+ retry_codes: ["UNAVAILABLE", "DEADLINE_EXCEEDED"]
135
+ }
136
+
137
+ default_config.rpcs.create_task.timeout = 10.0
138
+
139
+ default_config.rpcs.delete_task.timeout = 10.0
140
+ default_config.rpcs.delete_task.retry_policy = {
141
+ initial_delay: 0.1,
142
+ max_delay: 10.0,
143
+ multiplier: 1.3,
144
+ retry_codes: ["UNAVAILABLE", "DEADLINE_EXCEEDED"]
145
+ }
146
+
147
+ default_config.rpcs.lease_tasks.timeout = 10.0
148
+
149
+ default_config.rpcs.acknowledge_task.timeout = 10.0
150
+
151
+ default_config.rpcs.renew_lease.timeout = 10.0
152
+
153
+ default_config.rpcs.cancel_lease.timeout = 10.0
154
+
155
+ default_config.rpcs.run_task.timeout = 10.0
156
+
157
+ default_config
158
+ end
159
+ yield @configure if block_given?
160
+ @configure
161
+ end
162
+
163
+ ##
164
+ # Configure the CloudTasks Client instance.
165
+ #
166
+ # The configuration is set to the derived mode, meaning that values can be changed,
167
+ # but structural changes (adding new fields, etc.) are not allowed. Structural changes
168
+ # should be made on {Client.configure}.
169
+ #
170
+ # See {::Google::Cloud::Tasks::V2beta2::CloudTasks::Client::Configuration}
171
+ # for a description of the configuration fields.
172
+ #
173
+ # @yield [config] Configure the Client client.
174
+ # @yieldparam config [Client::Configuration]
175
+ #
176
+ # @return [Client::Configuration]
177
+ #
178
+ def configure
179
+ yield @config if block_given?
180
+ @config
181
+ end
182
+
183
+ ##
184
+ # Create a new CloudTasks client object.
185
+ #
186
+ # ## Examples
187
+ #
188
+ # To create a new CloudTasks client with the default
189
+ # configuration:
190
+ #
191
+ # client = ::Google::Cloud::Tasks::V2beta2::CloudTasks::Client.new
192
+ #
193
+ # To create a new CloudTasks client with a custom
194
+ # configuration:
195
+ #
196
+ # client = ::Google::Cloud::Tasks::V2beta2::CloudTasks::Client.new do |config|
197
+ # config.timeout = 10.0
198
+ # end
199
+ #
200
+ # @yield [config] Configure the CloudTasks client.
201
+ # @yieldparam config [Client::Configuration]
202
+ #
203
+ def initialize
204
+ # These require statements are intentionally placed here to initialize
205
+ # the gRPC module only when it's required.
206
+ # See https://github.com/googleapis/toolkit/issues/446
207
+ require "gapic/grpc"
208
+ require "google/cloud/tasks/v2beta2/cloudtasks_services_pb"
209
+
210
+ # Create the configuration object
211
+ @config = Configuration.new Client.configure
212
+
213
+ # Yield the configuration if needed
214
+ yield @config if block_given?
215
+
216
+ # Create credentials
217
+ credentials = @config.credentials
218
+ credentials ||= Credentials.default scope: @config.scope
219
+ if credentials.is_a?(String) || credentials.is_a?(Hash)
220
+ credentials = Credentials.new credentials, scope: @config.scope
221
+ end
222
+ @quota_project_id = credentials.respond_to?(:quota_project_id) ? credentials.quota_project_id : nil
223
+
224
+ @cloud_tasks_stub = ::Gapic::ServiceStub.new(
225
+ ::Google::Cloud::Tasks::V2beta2::CloudTasks::Stub,
226
+ credentials: credentials,
227
+ endpoint: @config.endpoint,
228
+ channel_args: @config.channel_args,
229
+ interceptors: @config.interceptors
230
+ )
231
+ end
232
+
233
+ # Service calls
234
+
235
+ ##
236
+ # Lists queues.
237
+ #
238
+ # Queues are returned in lexicographical order.
239
+ #
240
+ # @overload list_queues(request, options = nil)
241
+ # Pass arguments to `list_queues` via a request object, either of type
242
+ # {::Google::Cloud::Tasks::V2beta2::ListQueuesRequest} or an equivalent Hash.
243
+ #
244
+ # @param request [::Google::Cloud::Tasks::V2beta2::ListQueuesRequest, ::Hash]
245
+ # A request object representing the call parameters. Required. To specify no
246
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
247
+ # @param options [::Gapic::CallOptions, ::Hash]
248
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
249
+ #
250
+ # @overload list_queues(parent: nil, filter: nil, page_size: nil, page_token: nil)
251
+ # Pass arguments to `list_queues` via keyword arguments. Note that at
252
+ # least one keyword argument is required. To specify no parameters, or to keep all
253
+ # the default parameter values, pass an empty Hash as a request object (see above).
254
+ #
255
+ # @param parent [::String]
256
+ # Required. The location name.
257
+ # For example: `projects/PROJECT_ID/locations/LOCATION_ID`
258
+ # @param filter [::String]
259
+ # `filter` can be used to specify a subset of queues. Any {::Google::Cloud::Tasks::V2beta2::Queue Queue}
260
+ # field can be used as a filter and several operators as supported.
261
+ # For example: `<=, <, >=, >, !=, =, :`. The filter syntax is the same as
262
+ # described in
263
+ # [Stackdriver's Advanced Logs
264
+ # Filters](https://cloud.google.com/logging/docs/view/advanced_filters).
265
+ #
266
+ # Sample filter "app_engine_http_target: *".
267
+ #
268
+ # Note that using filters might cause fewer queues than the
269
+ # requested_page size to be returned.
270
+ # @param page_size [::Integer]
271
+ # Requested page size.
272
+ #
273
+ # The maximum page size is 9800. If unspecified, the page size will
274
+ # be the maximum. Fewer queues than requested might be returned,
275
+ # even if more queues exist; use the
276
+ # {::Google::Cloud::Tasks::V2beta2::ListQueuesResponse#next_page_token next_page_token} in the
277
+ # response to determine if more queues exist.
278
+ # @param page_token [::String]
279
+ # A token identifying the page of results to return.
280
+ #
281
+ # To request the first page results, page_token must be empty. To
282
+ # request the next page of results, page_token must be the value of
283
+ # {::Google::Cloud::Tasks::V2beta2::ListQueuesResponse#next_page_token next_page_token} returned
284
+ # from the previous call to {::Google::Cloud::Tasks::V2beta2::CloudTasks::Client#list_queues ListQueues}
285
+ # method. It is an error to switch the value of the
286
+ # {::Google::Cloud::Tasks::V2beta2::ListQueuesRequest#filter filter} while iterating through pages.
287
+ #
288
+ # @yield [response, operation] Access the result along with the RPC operation
289
+ # @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::Tasks::V2beta2::Queue>]
290
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
291
+ #
292
+ # @return [::Gapic::PagedEnumerable<::Google::Cloud::Tasks::V2beta2::Queue>]
293
+ #
294
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
295
+ #
296
+ def list_queues request, options = nil
297
+ raise ::ArgumentError, "request must be provided" if request.nil?
298
+
299
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Tasks::V2beta2::ListQueuesRequest
300
+
301
+ # Converts hash and nil to an options object
302
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
303
+
304
+ # Customize the options with defaults
305
+ metadata = @config.rpcs.list_queues.metadata.to_h
306
+
307
+ # Set x-goog-api-client and x-goog-user-project headers
308
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
309
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
310
+ gapic_version: ::Google::Cloud::Tasks::V2beta2::VERSION
311
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
312
+
313
+ header_params = {
314
+ "parent" => request.parent
315
+ }
316
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
317
+ metadata[:"x-goog-request-params"] ||= request_params_header
318
+
319
+ options.apply_defaults timeout: @config.rpcs.list_queues.timeout,
320
+ metadata: metadata,
321
+ retry_policy: @config.rpcs.list_queues.retry_policy
322
+ options.apply_defaults metadata: @config.metadata,
323
+ retry_policy: @config.retry_policy
324
+
325
+ @cloud_tasks_stub.call_rpc :list_queues, request, options: options do |response, operation|
326
+ response = ::Gapic::PagedEnumerable.new @cloud_tasks_stub, :list_queues, request, response, operation, options
327
+ yield response, operation if block_given?
328
+ return response
329
+ end
330
+ rescue ::GRPC::BadStatus => e
331
+ raise ::Google::Cloud::Error.from_error(e)
332
+ end
333
+
334
+ ##
335
+ # Gets a queue.
336
+ #
337
+ # @overload get_queue(request, options = nil)
338
+ # Pass arguments to `get_queue` via a request object, either of type
339
+ # {::Google::Cloud::Tasks::V2beta2::GetQueueRequest} or an equivalent Hash.
340
+ #
341
+ # @param request [::Google::Cloud::Tasks::V2beta2::GetQueueRequest, ::Hash]
342
+ # A request object representing the call parameters. Required. To specify no
343
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
344
+ # @param options [::Gapic::CallOptions, ::Hash]
345
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
346
+ #
347
+ # @overload get_queue(name: nil)
348
+ # Pass arguments to `get_queue` via keyword arguments. Note that at
349
+ # least one keyword argument is required. To specify no parameters, or to keep all
350
+ # the default parameter values, pass an empty Hash as a request object (see above).
351
+ #
352
+ # @param name [::String]
353
+ # Required. The resource name of the queue. For example:
354
+ # `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID`
355
+ #
356
+ # @yield [response, operation] Access the result along with the RPC operation
357
+ # @yieldparam response [::Google::Cloud::Tasks::V2beta2::Queue]
358
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
359
+ #
360
+ # @return [::Google::Cloud::Tasks::V2beta2::Queue]
361
+ #
362
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
363
+ #
364
+ def get_queue request, options = nil
365
+ raise ::ArgumentError, "request must be provided" if request.nil?
366
+
367
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Tasks::V2beta2::GetQueueRequest
368
+
369
+ # Converts hash and nil to an options object
370
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
371
+
372
+ # Customize the options with defaults
373
+ metadata = @config.rpcs.get_queue.metadata.to_h
374
+
375
+ # Set x-goog-api-client and x-goog-user-project headers
376
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
377
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
378
+ gapic_version: ::Google::Cloud::Tasks::V2beta2::VERSION
379
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
380
+
381
+ header_params = {
382
+ "name" => request.name
383
+ }
384
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
385
+ metadata[:"x-goog-request-params"] ||= request_params_header
386
+
387
+ options.apply_defaults timeout: @config.rpcs.get_queue.timeout,
388
+ metadata: metadata,
389
+ retry_policy: @config.rpcs.get_queue.retry_policy
390
+ options.apply_defaults metadata: @config.metadata,
391
+ retry_policy: @config.retry_policy
392
+
393
+ @cloud_tasks_stub.call_rpc :get_queue, request, options: options do |response, operation|
394
+ yield response, operation if block_given?
395
+ return response
396
+ end
397
+ rescue ::GRPC::BadStatus => e
398
+ raise ::Google::Cloud::Error.from_error(e)
399
+ end
400
+
401
+ ##
402
+ # Creates a queue.
403
+ #
404
+ # Queues created with this method allow tasks to live for a maximum of 31
405
+ # days. After a task is 31 days old, the task will be deleted regardless of whether
406
+ # it was dispatched or not.
407
+ #
408
+ # WARNING: Using this method may have unintended side effects if you are
409
+ # using an App Engine `queue.yaml` or `queue.xml` file to manage your queues.
410
+ # Read
411
+ # [Overview of Queue Management and
412
+ # queue.yaml](https://cloud.google.com/tasks/docs/queue-yaml) before using
413
+ # this method.
414
+ #
415
+ # @overload create_queue(request, options = nil)
416
+ # Pass arguments to `create_queue` via a request object, either of type
417
+ # {::Google::Cloud::Tasks::V2beta2::CreateQueueRequest} or an equivalent Hash.
418
+ #
419
+ # @param request [::Google::Cloud::Tasks::V2beta2::CreateQueueRequest, ::Hash]
420
+ # A request object representing the call parameters. Required. To specify no
421
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
422
+ # @param options [::Gapic::CallOptions, ::Hash]
423
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
424
+ #
425
+ # @overload create_queue(parent: nil, queue: nil)
426
+ # Pass arguments to `create_queue` via keyword arguments. Note that at
427
+ # least one keyword argument is required. To specify no parameters, or to keep all
428
+ # the default parameter values, pass an empty Hash as a request object (see above).
429
+ #
430
+ # @param parent [::String]
431
+ # Required. The location name in which the queue will be created.
432
+ # For example: `projects/PROJECT_ID/locations/LOCATION_ID`
433
+ #
434
+ # The list of allowed locations can be obtained by calling Cloud
435
+ # Tasks' implementation of
436
+ # [ListLocations][google.cloud.location.Locations.ListLocations].
437
+ # @param queue [::Google::Cloud::Tasks::V2beta2::Queue, ::Hash]
438
+ # Required. The queue to create.
439
+ #
440
+ # [Queue's name][google.cloud.tasks.v2beta2.Queue.name] cannot be the same as an existing queue.
441
+ #
442
+ # @yield [response, operation] Access the result along with the RPC operation
443
+ # @yieldparam response [::Google::Cloud::Tasks::V2beta2::Queue]
444
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
445
+ #
446
+ # @return [::Google::Cloud::Tasks::V2beta2::Queue]
447
+ #
448
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
449
+ #
450
+ def create_queue request, options = nil
451
+ raise ::ArgumentError, "request must be provided" if request.nil?
452
+
453
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Tasks::V2beta2::CreateQueueRequest
454
+
455
+ # Converts hash and nil to an options object
456
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
457
+
458
+ # Customize the options with defaults
459
+ metadata = @config.rpcs.create_queue.metadata.to_h
460
+
461
+ # Set x-goog-api-client and x-goog-user-project headers
462
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
463
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
464
+ gapic_version: ::Google::Cloud::Tasks::V2beta2::VERSION
465
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
466
+
467
+ header_params = {
468
+ "parent" => request.parent
469
+ }
470
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
471
+ metadata[:"x-goog-request-params"] ||= request_params_header
472
+
473
+ options.apply_defaults timeout: @config.rpcs.create_queue.timeout,
474
+ metadata: metadata,
475
+ retry_policy: @config.rpcs.create_queue.retry_policy
476
+ options.apply_defaults metadata: @config.metadata,
477
+ retry_policy: @config.retry_policy
478
+
479
+ @cloud_tasks_stub.call_rpc :create_queue, request, options: options do |response, operation|
480
+ yield response, operation if block_given?
481
+ return response
482
+ end
483
+ rescue ::GRPC::BadStatus => e
484
+ raise ::Google::Cloud::Error.from_error(e)
485
+ end
486
+
487
+ ##
488
+ # Updates a queue.
489
+ #
490
+ # This method creates the queue if it does not exist and updates
491
+ # the queue if it does exist.
492
+ #
493
+ # Queues created with this method allow tasks to live for a maximum of 31
494
+ # days. After a task is 31 days old, the task will be deleted regardless of whether
495
+ # it was dispatched or not.
496
+ #
497
+ # WARNING: Using this method may have unintended side effects if you are
498
+ # using an App Engine `queue.yaml` or `queue.xml` file to manage your queues.
499
+ # Read
500
+ # [Overview of Queue Management and
501
+ # queue.yaml](https://cloud.google.com/tasks/docs/queue-yaml) before using
502
+ # this method.
503
+ #
504
+ # @overload update_queue(request, options = nil)
505
+ # Pass arguments to `update_queue` via a request object, either of type
506
+ # {::Google::Cloud::Tasks::V2beta2::UpdateQueueRequest} or an equivalent Hash.
507
+ #
508
+ # @param request [::Google::Cloud::Tasks::V2beta2::UpdateQueueRequest, ::Hash]
509
+ # A request object representing the call parameters. Required. To specify no
510
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
511
+ # @param options [::Gapic::CallOptions, ::Hash]
512
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
513
+ #
514
+ # @overload update_queue(queue: nil, update_mask: nil)
515
+ # Pass arguments to `update_queue` via keyword arguments. Note that at
516
+ # least one keyword argument is required. To specify no parameters, or to keep all
517
+ # the default parameter values, pass an empty Hash as a request object (see above).
518
+ #
519
+ # @param queue [::Google::Cloud::Tasks::V2beta2::Queue, ::Hash]
520
+ # Required. The queue to create or update.
521
+ #
522
+ # The queue's {::Google::Cloud::Tasks::V2beta2::Queue#name name} must be specified.
523
+ #
524
+ # Output only fields cannot be modified using UpdateQueue.
525
+ # Any value specified for an output only field will be ignored.
526
+ # The queue's {::Google::Cloud::Tasks::V2beta2::Queue#name name} cannot be changed.
527
+ # @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
528
+ # A mask used to specify which fields of the queue are being updated.
529
+ #
530
+ # If empty, then all fields will be updated.
531
+ #
532
+ # @yield [response, operation] Access the result along with the RPC operation
533
+ # @yieldparam response [::Google::Cloud::Tasks::V2beta2::Queue]
534
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
535
+ #
536
+ # @return [::Google::Cloud::Tasks::V2beta2::Queue]
537
+ #
538
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
539
+ #
540
+ def update_queue request, options = nil
541
+ raise ::ArgumentError, "request must be provided" if request.nil?
542
+
543
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Tasks::V2beta2::UpdateQueueRequest
544
+
545
+ # Converts hash and nil to an options object
546
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
547
+
548
+ # Customize the options with defaults
549
+ metadata = @config.rpcs.update_queue.metadata.to_h
550
+
551
+ # Set x-goog-api-client and x-goog-user-project headers
552
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
553
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
554
+ gapic_version: ::Google::Cloud::Tasks::V2beta2::VERSION
555
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
556
+
557
+ header_params = {
558
+ "queue.name" => request.queue.name
559
+ }
560
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
561
+ metadata[:"x-goog-request-params"] ||= request_params_header
562
+
563
+ options.apply_defaults timeout: @config.rpcs.update_queue.timeout,
564
+ metadata: metadata,
565
+ retry_policy: @config.rpcs.update_queue.retry_policy
566
+ options.apply_defaults metadata: @config.metadata,
567
+ retry_policy: @config.retry_policy
568
+
569
+ @cloud_tasks_stub.call_rpc :update_queue, request, options: options do |response, operation|
570
+ yield response, operation if block_given?
571
+ return response
572
+ end
573
+ rescue ::GRPC::BadStatus => e
574
+ raise ::Google::Cloud::Error.from_error(e)
575
+ end
576
+
577
+ ##
578
+ # Deletes a queue.
579
+ #
580
+ # This command will delete the queue even if it has tasks in it.
581
+ #
582
+ # Note: If you delete a queue, a queue with the same name can't be created
583
+ # for 7 days.
584
+ #
585
+ # WARNING: Using this method may have unintended side effects if you are
586
+ # using an App Engine `queue.yaml` or `queue.xml` file to manage your queues.
587
+ # Read
588
+ # [Overview of Queue Management and
589
+ # queue.yaml](https://cloud.google.com/tasks/docs/queue-yaml) before using
590
+ # this method.
591
+ #
592
+ # @overload delete_queue(request, options = nil)
593
+ # Pass arguments to `delete_queue` via a request object, either of type
594
+ # {::Google::Cloud::Tasks::V2beta2::DeleteQueueRequest} or an equivalent Hash.
595
+ #
596
+ # @param request [::Google::Cloud::Tasks::V2beta2::DeleteQueueRequest, ::Hash]
597
+ # A request object representing the call parameters. Required. To specify no
598
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
599
+ # @param options [::Gapic::CallOptions, ::Hash]
600
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
601
+ #
602
+ # @overload delete_queue(name: nil)
603
+ # Pass arguments to `delete_queue` via keyword arguments. Note that at
604
+ # least one keyword argument is required. To specify no parameters, or to keep all
605
+ # the default parameter values, pass an empty Hash as a request object (see above).
606
+ #
607
+ # @param name [::String]
608
+ # Required. The queue name. For example:
609
+ # `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID`
610
+ #
611
+ # @yield [response, operation] Access the result along with the RPC operation
612
+ # @yieldparam response [::Google::Protobuf::Empty]
613
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
614
+ #
615
+ # @return [::Google::Protobuf::Empty]
616
+ #
617
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
618
+ #
619
+ def delete_queue request, options = nil
620
+ raise ::ArgumentError, "request must be provided" if request.nil?
621
+
622
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Tasks::V2beta2::DeleteQueueRequest
623
+
624
+ # Converts hash and nil to an options object
625
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
626
+
627
+ # Customize the options with defaults
628
+ metadata = @config.rpcs.delete_queue.metadata.to_h
629
+
630
+ # Set x-goog-api-client and x-goog-user-project headers
631
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
632
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
633
+ gapic_version: ::Google::Cloud::Tasks::V2beta2::VERSION
634
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
635
+
636
+ header_params = {
637
+ "name" => request.name
638
+ }
639
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
640
+ metadata[:"x-goog-request-params"] ||= request_params_header
641
+
642
+ options.apply_defaults timeout: @config.rpcs.delete_queue.timeout,
643
+ metadata: metadata,
644
+ retry_policy: @config.rpcs.delete_queue.retry_policy
645
+ options.apply_defaults metadata: @config.metadata,
646
+ retry_policy: @config.retry_policy
647
+
648
+ @cloud_tasks_stub.call_rpc :delete_queue, request, options: options do |response, operation|
649
+ yield response, operation if block_given?
650
+ return response
651
+ end
652
+ rescue ::GRPC::BadStatus => e
653
+ raise ::Google::Cloud::Error.from_error(e)
654
+ end
655
+
656
+ ##
657
+ # Purges a queue by deleting all of its tasks.
658
+ #
659
+ # All tasks created before this method is called are permanently deleted.
660
+ #
661
+ # Purge operations can take up to one minute to take effect. Tasks
662
+ # might be dispatched before the purge takes effect. A purge is irreversible.
663
+ #
664
+ # @overload purge_queue(request, options = nil)
665
+ # Pass arguments to `purge_queue` via a request object, either of type
666
+ # {::Google::Cloud::Tasks::V2beta2::PurgeQueueRequest} or an equivalent Hash.
667
+ #
668
+ # @param request [::Google::Cloud::Tasks::V2beta2::PurgeQueueRequest, ::Hash]
669
+ # A request object representing the call parameters. Required. To specify no
670
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
671
+ # @param options [::Gapic::CallOptions, ::Hash]
672
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
673
+ #
674
+ # @overload purge_queue(name: nil)
675
+ # Pass arguments to `purge_queue` via keyword arguments. Note that at
676
+ # least one keyword argument is required. To specify no parameters, or to keep all
677
+ # the default parameter values, pass an empty Hash as a request object (see above).
678
+ #
679
+ # @param name [::String]
680
+ # Required. The queue name. For example:
681
+ # `projects/PROJECT_ID/location/LOCATION_ID/queues/QUEUE_ID`
682
+ #
683
+ # @yield [response, operation] Access the result along with the RPC operation
684
+ # @yieldparam response [::Google::Cloud::Tasks::V2beta2::Queue]
685
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
686
+ #
687
+ # @return [::Google::Cloud::Tasks::V2beta2::Queue]
688
+ #
689
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
690
+ #
691
+ def purge_queue request, options = nil
692
+ raise ::ArgumentError, "request must be provided" if request.nil?
693
+
694
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Tasks::V2beta2::PurgeQueueRequest
695
+
696
+ # Converts hash and nil to an options object
697
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
698
+
699
+ # Customize the options with defaults
700
+ metadata = @config.rpcs.purge_queue.metadata.to_h
701
+
702
+ # Set x-goog-api-client and x-goog-user-project headers
703
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
704
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
705
+ gapic_version: ::Google::Cloud::Tasks::V2beta2::VERSION
706
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
707
+
708
+ header_params = {
709
+ "name" => request.name
710
+ }
711
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
712
+ metadata[:"x-goog-request-params"] ||= request_params_header
713
+
714
+ options.apply_defaults timeout: @config.rpcs.purge_queue.timeout,
715
+ metadata: metadata,
716
+ retry_policy: @config.rpcs.purge_queue.retry_policy
717
+ options.apply_defaults metadata: @config.metadata,
718
+ retry_policy: @config.retry_policy
719
+
720
+ @cloud_tasks_stub.call_rpc :purge_queue, request, options: options do |response, operation|
721
+ yield response, operation if block_given?
722
+ return response
723
+ end
724
+ rescue ::GRPC::BadStatus => e
725
+ raise ::Google::Cloud::Error.from_error(e)
726
+ end
727
+
728
+ ##
729
+ # Pauses the queue.
730
+ #
731
+ # If a queue is paused then the system will stop dispatching tasks
732
+ # until the queue is resumed via
733
+ # {::Google::Cloud::Tasks::V2beta2::CloudTasks::Client#resume_queue ResumeQueue}. Tasks can still be added
734
+ # when the queue is paused. A queue is paused if its
735
+ # {::Google::Cloud::Tasks::V2beta2::Queue#state state} is {::Google::Cloud::Tasks::V2beta2::Queue::State::PAUSED PAUSED}.
736
+ #
737
+ # @overload pause_queue(request, options = nil)
738
+ # Pass arguments to `pause_queue` via a request object, either of type
739
+ # {::Google::Cloud::Tasks::V2beta2::PauseQueueRequest} or an equivalent Hash.
740
+ #
741
+ # @param request [::Google::Cloud::Tasks::V2beta2::PauseQueueRequest, ::Hash]
742
+ # A request object representing the call parameters. Required. To specify no
743
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
744
+ # @param options [::Gapic::CallOptions, ::Hash]
745
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
746
+ #
747
+ # @overload pause_queue(name: nil)
748
+ # Pass arguments to `pause_queue` via keyword arguments. Note that at
749
+ # least one keyword argument is required. To specify no parameters, or to keep all
750
+ # the default parameter values, pass an empty Hash as a request object (see above).
751
+ #
752
+ # @param name [::String]
753
+ # Required. The queue name. For example:
754
+ # `projects/PROJECT_ID/location/LOCATION_ID/queues/QUEUE_ID`
755
+ #
756
+ # @yield [response, operation] Access the result along with the RPC operation
757
+ # @yieldparam response [::Google::Cloud::Tasks::V2beta2::Queue]
758
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
759
+ #
760
+ # @return [::Google::Cloud::Tasks::V2beta2::Queue]
761
+ #
762
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
763
+ #
764
+ def pause_queue request, options = nil
765
+ raise ::ArgumentError, "request must be provided" if request.nil?
766
+
767
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Tasks::V2beta2::PauseQueueRequest
768
+
769
+ # Converts hash and nil to an options object
770
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
771
+
772
+ # Customize the options with defaults
773
+ metadata = @config.rpcs.pause_queue.metadata.to_h
774
+
775
+ # Set x-goog-api-client and x-goog-user-project headers
776
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
777
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
778
+ gapic_version: ::Google::Cloud::Tasks::V2beta2::VERSION
779
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
780
+
781
+ header_params = {
782
+ "name" => request.name
783
+ }
784
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
785
+ metadata[:"x-goog-request-params"] ||= request_params_header
786
+
787
+ options.apply_defaults timeout: @config.rpcs.pause_queue.timeout,
788
+ metadata: metadata,
789
+ retry_policy: @config.rpcs.pause_queue.retry_policy
790
+ options.apply_defaults metadata: @config.metadata,
791
+ retry_policy: @config.retry_policy
792
+
793
+ @cloud_tasks_stub.call_rpc :pause_queue, request, options: options do |response, operation|
794
+ yield response, operation if block_given?
795
+ return response
796
+ end
797
+ rescue ::GRPC::BadStatus => e
798
+ raise ::Google::Cloud::Error.from_error(e)
799
+ end
800
+
801
+ ##
802
+ # Resume a queue.
803
+ #
804
+ # This method resumes a queue after it has been
805
+ # {::Google::Cloud::Tasks::V2beta2::Queue::State::PAUSED PAUSED} or
806
+ # {::Google::Cloud::Tasks::V2beta2::Queue::State::DISABLED DISABLED}. The state of a queue is stored
807
+ # in the queue's {::Google::Cloud::Tasks::V2beta2::Queue#state state}; after calling this method it
808
+ # will be set to {::Google::Cloud::Tasks::V2beta2::Queue::State::RUNNING RUNNING}.
809
+ #
810
+ # WARNING: Resuming many high-QPS queues at the same time can
811
+ # lead to target overloading. If you are resuming high-QPS
812
+ # queues, follow the 500/50/5 pattern described in
813
+ # [Managing Cloud Tasks Scaling
814
+ # Risks](https://cloud.google.com/tasks/docs/manage-cloud-task-scaling).
815
+ #
816
+ # @overload resume_queue(request, options = nil)
817
+ # Pass arguments to `resume_queue` via a request object, either of type
818
+ # {::Google::Cloud::Tasks::V2beta2::ResumeQueueRequest} or an equivalent Hash.
819
+ #
820
+ # @param request [::Google::Cloud::Tasks::V2beta2::ResumeQueueRequest, ::Hash]
821
+ # A request object representing the call parameters. Required. To specify no
822
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
823
+ # @param options [::Gapic::CallOptions, ::Hash]
824
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
825
+ #
826
+ # @overload resume_queue(name: nil)
827
+ # Pass arguments to `resume_queue` via keyword arguments. Note that at
828
+ # least one keyword argument is required. To specify no parameters, or to keep all
829
+ # the default parameter values, pass an empty Hash as a request object (see above).
830
+ #
831
+ # @param name [::String]
832
+ # Required. The queue name. For example:
833
+ # `projects/PROJECT_ID/location/LOCATION_ID/queues/QUEUE_ID`
834
+ #
835
+ # @yield [response, operation] Access the result along with the RPC operation
836
+ # @yieldparam response [::Google::Cloud::Tasks::V2beta2::Queue]
837
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
838
+ #
839
+ # @return [::Google::Cloud::Tasks::V2beta2::Queue]
840
+ #
841
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
842
+ #
843
+ def resume_queue request, options = nil
844
+ raise ::ArgumentError, "request must be provided" if request.nil?
845
+
846
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Tasks::V2beta2::ResumeQueueRequest
847
+
848
+ # Converts hash and nil to an options object
849
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
850
+
851
+ # Customize the options with defaults
852
+ metadata = @config.rpcs.resume_queue.metadata.to_h
853
+
854
+ # Set x-goog-api-client and x-goog-user-project headers
855
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
856
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
857
+ gapic_version: ::Google::Cloud::Tasks::V2beta2::VERSION
858
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
859
+
860
+ header_params = {
861
+ "name" => request.name
862
+ }
863
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
864
+ metadata[:"x-goog-request-params"] ||= request_params_header
865
+
866
+ options.apply_defaults timeout: @config.rpcs.resume_queue.timeout,
867
+ metadata: metadata,
868
+ retry_policy: @config.rpcs.resume_queue.retry_policy
869
+ options.apply_defaults metadata: @config.metadata,
870
+ retry_policy: @config.retry_policy
871
+
872
+ @cloud_tasks_stub.call_rpc :resume_queue, request, options: options do |response, operation|
873
+ yield response, operation if block_given?
874
+ return response
875
+ end
876
+ rescue ::GRPC::BadStatus => e
877
+ raise ::Google::Cloud::Error.from_error(e)
878
+ end
879
+
880
+ ##
881
+ # Gets the access control policy for a {::Google::Cloud::Tasks::V2beta2::Queue Queue}.
882
+ # Returns an empty policy if the resource exists and does not have a policy
883
+ # set.
884
+ #
885
+ # Authorization requires the following
886
+ # [Google IAM](https://cloud.google.com/iam) permission on the specified
887
+ # resource parent:
888
+ #
889
+ # * `cloudtasks.queues.getIamPolicy`
890
+ #
891
+ # @overload get_iam_policy(request, options = nil)
892
+ # Pass arguments to `get_iam_policy` via a request object, either of type
893
+ # {::Google::Iam::V1::GetIamPolicyRequest} or an equivalent Hash.
894
+ #
895
+ # @param request [::Google::Iam::V1::GetIamPolicyRequest, ::Hash]
896
+ # A request object representing the call parameters. Required. To specify no
897
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
898
+ # @param options [::Gapic::CallOptions, ::Hash]
899
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
900
+ #
901
+ # @overload get_iam_policy(resource: nil, options: nil)
902
+ # Pass arguments to `get_iam_policy` via keyword arguments. Note that at
903
+ # least one keyword argument is required. To specify no parameters, or to keep all
904
+ # the default parameter values, pass an empty Hash as a request object (see above).
905
+ #
906
+ # @param resource [::String]
907
+ # REQUIRED: The resource for which the policy is being requested.
908
+ # See the operation documentation for the appropriate value for this field.
909
+ # @param options [::Google::Iam::V1::GetPolicyOptions, ::Hash]
910
+ # OPTIONAL: A `GetPolicyOptions` object for specifying options to
911
+ # `GetIamPolicy`. This field is only used by Cloud IAM.
912
+ #
913
+ # @yield [response, operation] Access the result along with the RPC operation
914
+ # @yieldparam response [::Google::Iam::V1::Policy]
915
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
916
+ #
917
+ # @return [::Google::Iam::V1::Policy]
918
+ #
919
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
920
+ #
921
+ def get_iam_policy request, options = nil
922
+ raise ::ArgumentError, "request must be provided" if request.nil?
923
+
924
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Iam::V1::GetIamPolicyRequest
925
+
926
+ # Converts hash and nil to an options object
927
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
928
+
929
+ # Customize the options with defaults
930
+ metadata = @config.rpcs.get_iam_policy.metadata.to_h
931
+
932
+ # Set x-goog-api-client and x-goog-user-project headers
933
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
934
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
935
+ gapic_version: ::Google::Cloud::Tasks::V2beta2::VERSION
936
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
937
+
938
+ header_params = {
939
+ "resource" => request.resource
940
+ }
941
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
942
+ metadata[:"x-goog-request-params"] ||= request_params_header
943
+
944
+ options.apply_defaults timeout: @config.rpcs.get_iam_policy.timeout,
945
+ metadata: metadata,
946
+ retry_policy: @config.rpcs.get_iam_policy.retry_policy
947
+ options.apply_defaults metadata: @config.metadata,
948
+ retry_policy: @config.retry_policy
949
+
950
+ @cloud_tasks_stub.call_rpc :get_iam_policy, request, options: options do |response, operation|
951
+ yield response, operation if block_given?
952
+ return response
953
+ end
954
+ rescue ::GRPC::BadStatus => e
955
+ raise ::Google::Cloud::Error.from_error(e)
956
+ end
957
+
958
+ ##
959
+ # Sets the access control policy for a {::Google::Cloud::Tasks::V2beta2::Queue Queue}. Replaces any existing
960
+ # policy.
961
+ #
962
+ # Note: The Cloud Console does not check queue-level IAM permissions yet.
963
+ # Project-level permissions are required to use the Cloud Console.
964
+ #
965
+ # Authorization requires the following
966
+ # [Google IAM](https://cloud.google.com/iam) permission on the specified
967
+ # resource parent:
968
+ #
969
+ # * `cloudtasks.queues.setIamPolicy`
970
+ #
971
+ # @overload set_iam_policy(request, options = nil)
972
+ # Pass arguments to `set_iam_policy` via a request object, either of type
973
+ # {::Google::Iam::V1::SetIamPolicyRequest} or an equivalent Hash.
974
+ #
975
+ # @param request [::Google::Iam::V1::SetIamPolicyRequest, ::Hash]
976
+ # A request object representing the call parameters. Required. To specify no
977
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
978
+ # @param options [::Gapic::CallOptions, ::Hash]
979
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
980
+ #
981
+ # @overload set_iam_policy(resource: nil, policy: nil)
982
+ # Pass arguments to `set_iam_policy` via keyword arguments. Note that at
983
+ # least one keyword argument is required. To specify no parameters, or to keep all
984
+ # the default parameter values, pass an empty Hash as a request object (see above).
985
+ #
986
+ # @param resource [::String]
987
+ # REQUIRED: The resource for which the policy is being specified.
988
+ # See the operation documentation for the appropriate value for this field.
989
+ # @param policy [::Google::Iam::V1::Policy, ::Hash]
990
+ # REQUIRED: The complete policy to be applied to the `resource`. The size of
991
+ # the policy is limited to a few 10s of KB. An empty policy is a
992
+ # valid policy but certain Cloud Platform services (such as Projects)
993
+ # might reject them.
994
+ #
995
+ # @yield [response, operation] Access the result along with the RPC operation
996
+ # @yieldparam response [::Google::Iam::V1::Policy]
997
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
998
+ #
999
+ # @return [::Google::Iam::V1::Policy]
1000
+ #
1001
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
1002
+ #
1003
+ def set_iam_policy request, options = nil
1004
+ raise ::ArgumentError, "request must be provided" if request.nil?
1005
+
1006
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Iam::V1::SetIamPolicyRequest
1007
+
1008
+ # Converts hash and nil to an options object
1009
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1010
+
1011
+ # Customize the options with defaults
1012
+ metadata = @config.rpcs.set_iam_policy.metadata.to_h
1013
+
1014
+ # Set x-goog-api-client and x-goog-user-project headers
1015
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1016
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1017
+ gapic_version: ::Google::Cloud::Tasks::V2beta2::VERSION
1018
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1019
+
1020
+ header_params = {
1021
+ "resource" => request.resource
1022
+ }
1023
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1024
+ metadata[:"x-goog-request-params"] ||= request_params_header
1025
+
1026
+ options.apply_defaults timeout: @config.rpcs.set_iam_policy.timeout,
1027
+ metadata: metadata,
1028
+ retry_policy: @config.rpcs.set_iam_policy.retry_policy
1029
+ options.apply_defaults metadata: @config.metadata,
1030
+ retry_policy: @config.retry_policy
1031
+
1032
+ @cloud_tasks_stub.call_rpc :set_iam_policy, request, options: options do |response, operation|
1033
+ yield response, operation if block_given?
1034
+ return response
1035
+ end
1036
+ rescue ::GRPC::BadStatus => e
1037
+ raise ::Google::Cloud::Error.from_error(e)
1038
+ end
1039
+
1040
+ ##
1041
+ # Returns permissions that a caller has on a {::Google::Cloud::Tasks::V2beta2::Queue Queue}.
1042
+ # If the resource does not exist, this will return an empty set of
1043
+ # permissions, not a [NOT_FOUND][google.rpc.Code.NOT_FOUND] error.
1044
+ #
1045
+ # Note: This operation is designed to be used for building permission-aware
1046
+ # UIs and command-line tools, not for authorization checking. This operation
1047
+ # may "fail open" without warning.
1048
+ #
1049
+ # @overload test_iam_permissions(request, options = nil)
1050
+ # Pass arguments to `test_iam_permissions` via a request object, either of type
1051
+ # {::Google::Iam::V1::TestIamPermissionsRequest} or an equivalent Hash.
1052
+ #
1053
+ # @param request [::Google::Iam::V1::TestIamPermissionsRequest, ::Hash]
1054
+ # A request object representing the call parameters. Required. To specify no
1055
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1056
+ # @param options [::Gapic::CallOptions, ::Hash]
1057
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
1058
+ #
1059
+ # @overload test_iam_permissions(resource: nil, permissions: nil)
1060
+ # Pass arguments to `test_iam_permissions` via keyword arguments. Note that at
1061
+ # least one keyword argument is required. To specify no parameters, or to keep all
1062
+ # the default parameter values, pass an empty Hash as a request object (see above).
1063
+ #
1064
+ # @param resource [::String]
1065
+ # REQUIRED: The resource for which the policy detail is being requested.
1066
+ # See the operation documentation for the appropriate value for this field.
1067
+ # @param permissions [::Array<::String>]
1068
+ # The set of permissions to check for the `resource`. Permissions with
1069
+ # wildcards (such as '*' or 'storage.*') are not allowed. For more
1070
+ # information see
1071
+ # [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions).
1072
+ #
1073
+ # @yield [response, operation] Access the result along with the RPC operation
1074
+ # @yieldparam response [::Google::Iam::V1::TestIamPermissionsResponse]
1075
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
1076
+ #
1077
+ # @return [::Google::Iam::V1::TestIamPermissionsResponse]
1078
+ #
1079
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
1080
+ #
1081
+ def test_iam_permissions request, options = nil
1082
+ raise ::ArgumentError, "request must be provided" if request.nil?
1083
+
1084
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Iam::V1::TestIamPermissionsRequest
1085
+
1086
+ # Converts hash and nil to an options object
1087
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1088
+
1089
+ # Customize the options with defaults
1090
+ metadata = @config.rpcs.test_iam_permissions.metadata.to_h
1091
+
1092
+ # Set x-goog-api-client and x-goog-user-project headers
1093
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1094
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1095
+ gapic_version: ::Google::Cloud::Tasks::V2beta2::VERSION
1096
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1097
+
1098
+ header_params = {
1099
+ "resource" => request.resource
1100
+ }
1101
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1102
+ metadata[:"x-goog-request-params"] ||= request_params_header
1103
+
1104
+ options.apply_defaults timeout: @config.rpcs.test_iam_permissions.timeout,
1105
+ metadata: metadata,
1106
+ retry_policy: @config.rpcs.test_iam_permissions.retry_policy
1107
+ options.apply_defaults metadata: @config.metadata,
1108
+ retry_policy: @config.retry_policy
1109
+
1110
+ @cloud_tasks_stub.call_rpc :test_iam_permissions, request, options: options do |response, operation|
1111
+ yield response, operation if block_given?
1112
+ return response
1113
+ end
1114
+ rescue ::GRPC::BadStatus => e
1115
+ raise ::Google::Cloud::Error.from_error(e)
1116
+ end
1117
+
1118
+ ##
1119
+ # Lists the tasks in a queue.
1120
+ #
1121
+ # By default, only the {::Google::Cloud::Tasks::V2beta2::Task::View::BASIC BASIC} view is retrieved
1122
+ # due to performance considerations;
1123
+ # {::Google::Cloud::Tasks::V2beta2::ListTasksRequest#response_view response_view} controls the
1124
+ # subset of information which is returned.
1125
+ #
1126
+ # The tasks may be returned in any order. The ordering may change at any
1127
+ # time.
1128
+ #
1129
+ # @overload list_tasks(request, options = nil)
1130
+ # Pass arguments to `list_tasks` via a request object, either of type
1131
+ # {::Google::Cloud::Tasks::V2beta2::ListTasksRequest} or an equivalent Hash.
1132
+ #
1133
+ # @param request [::Google::Cloud::Tasks::V2beta2::ListTasksRequest, ::Hash]
1134
+ # A request object representing the call parameters. Required. To specify no
1135
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1136
+ # @param options [::Gapic::CallOptions, ::Hash]
1137
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
1138
+ #
1139
+ # @overload list_tasks(parent: nil, response_view: nil, page_size: nil, page_token: nil)
1140
+ # Pass arguments to `list_tasks` via keyword arguments. Note that at
1141
+ # least one keyword argument is required. To specify no parameters, or to keep all
1142
+ # the default parameter values, pass an empty Hash as a request object (see above).
1143
+ #
1144
+ # @param parent [::String]
1145
+ # Required. The queue name. For example:
1146
+ # `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID`
1147
+ # @param response_view [::Google::Cloud::Tasks::V2beta2::Task::View]
1148
+ # The response_view specifies which subset of the {::Google::Cloud::Tasks::V2beta2::Task Task} will be
1149
+ # returned.
1150
+ #
1151
+ # By default response_view is {::Google::Cloud::Tasks::V2beta2::Task::View::BASIC BASIC}; not all
1152
+ # information is retrieved by default because some data, such as
1153
+ # payloads, might be desirable to return only when needed because
1154
+ # of its large size or because of the sensitivity of data that it
1155
+ # contains.
1156
+ #
1157
+ # Authorization for {::Google::Cloud::Tasks::V2beta2::Task::View::FULL FULL} requires
1158
+ # `cloudtasks.tasks.fullView` [Google IAM](https://cloud.google.com/iam/)
1159
+ # permission on the {::Google::Cloud::Tasks::V2beta2::Task Task} resource.
1160
+ # @param page_size [::Integer]
1161
+ # Maximum page size.
1162
+ #
1163
+ # Fewer tasks than requested might be returned, even if more tasks exist; use
1164
+ # {::Google::Cloud::Tasks::V2beta2::ListTasksResponse#next_page_token next_page_token} in the response to
1165
+ # determine if more tasks exist.
1166
+ #
1167
+ # The maximum page size is 1000. If unspecified, the page size will be the
1168
+ # maximum.
1169
+ # @param page_token [::String]
1170
+ # A token identifying the page of results to return.
1171
+ #
1172
+ # To request the first page results, page_token must be empty. To
1173
+ # request the next page of results, page_token must be the value of
1174
+ # {::Google::Cloud::Tasks::V2beta2::ListTasksResponse#next_page_token next_page_token} returned
1175
+ # from the previous call to {::Google::Cloud::Tasks::V2beta2::CloudTasks::Client#list_tasks ListTasks}
1176
+ # method.
1177
+ #
1178
+ # The page token is valid for only 2 hours.
1179
+ #
1180
+ # @yield [response, operation] Access the result along with the RPC operation
1181
+ # @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::Tasks::V2beta2::Task>]
1182
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
1183
+ #
1184
+ # @return [::Gapic::PagedEnumerable<::Google::Cloud::Tasks::V2beta2::Task>]
1185
+ #
1186
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
1187
+ #
1188
+ def list_tasks request, options = nil
1189
+ raise ::ArgumentError, "request must be provided" if request.nil?
1190
+
1191
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Tasks::V2beta2::ListTasksRequest
1192
+
1193
+ # Converts hash and nil to an options object
1194
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1195
+
1196
+ # Customize the options with defaults
1197
+ metadata = @config.rpcs.list_tasks.metadata.to_h
1198
+
1199
+ # Set x-goog-api-client and x-goog-user-project headers
1200
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1201
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1202
+ gapic_version: ::Google::Cloud::Tasks::V2beta2::VERSION
1203
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1204
+
1205
+ header_params = {
1206
+ "parent" => request.parent
1207
+ }
1208
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1209
+ metadata[:"x-goog-request-params"] ||= request_params_header
1210
+
1211
+ options.apply_defaults timeout: @config.rpcs.list_tasks.timeout,
1212
+ metadata: metadata,
1213
+ retry_policy: @config.rpcs.list_tasks.retry_policy
1214
+ options.apply_defaults metadata: @config.metadata,
1215
+ retry_policy: @config.retry_policy
1216
+
1217
+ @cloud_tasks_stub.call_rpc :list_tasks, request, options: options do |response, operation|
1218
+ response = ::Gapic::PagedEnumerable.new @cloud_tasks_stub, :list_tasks, request, response, operation, options
1219
+ yield response, operation if block_given?
1220
+ return response
1221
+ end
1222
+ rescue ::GRPC::BadStatus => e
1223
+ raise ::Google::Cloud::Error.from_error(e)
1224
+ end
1225
+
1226
+ ##
1227
+ # Gets a task.
1228
+ #
1229
+ # @overload get_task(request, options = nil)
1230
+ # Pass arguments to `get_task` via a request object, either of type
1231
+ # {::Google::Cloud::Tasks::V2beta2::GetTaskRequest} or an equivalent Hash.
1232
+ #
1233
+ # @param request [::Google::Cloud::Tasks::V2beta2::GetTaskRequest, ::Hash]
1234
+ # A request object representing the call parameters. Required. To specify no
1235
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1236
+ # @param options [::Gapic::CallOptions, ::Hash]
1237
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
1238
+ #
1239
+ # @overload get_task(name: nil, response_view: nil)
1240
+ # Pass arguments to `get_task` via keyword arguments. Note that at
1241
+ # least one keyword argument is required. To specify no parameters, or to keep all
1242
+ # the default parameter values, pass an empty Hash as a request object (see above).
1243
+ #
1244
+ # @param name [::String]
1245
+ # Required. The task name. For example:
1246
+ # `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID`
1247
+ # @param response_view [::Google::Cloud::Tasks::V2beta2::Task::View]
1248
+ # The response_view specifies which subset of the {::Google::Cloud::Tasks::V2beta2::Task Task} will be
1249
+ # returned.
1250
+ #
1251
+ # By default response_view is {::Google::Cloud::Tasks::V2beta2::Task::View::BASIC BASIC}; not all
1252
+ # information is retrieved by default because some data, such as
1253
+ # payloads, might be desirable to return only when needed because
1254
+ # of its large size or because of the sensitivity of data that it
1255
+ # contains.
1256
+ #
1257
+ # Authorization for {::Google::Cloud::Tasks::V2beta2::Task::View::FULL FULL} requires
1258
+ # `cloudtasks.tasks.fullView` [Google IAM](https://cloud.google.com/iam/)
1259
+ # permission on the {::Google::Cloud::Tasks::V2beta2::Task Task} resource.
1260
+ #
1261
+ # @yield [response, operation] Access the result along with the RPC operation
1262
+ # @yieldparam response [::Google::Cloud::Tasks::V2beta2::Task]
1263
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
1264
+ #
1265
+ # @return [::Google::Cloud::Tasks::V2beta2::Task]
1266
+ #
1267
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
1268
+ #
1269
+ def get_task request, options = nil
1270
+ raise ::ArgumentError, "request must be provided" if request.nil?
1271
+
1272
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Tasks::V2beta2::GetTaskRequest
1273
+
1274
+ # Converts hash and nil to an options object
1275
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1276
+
1277
+ # Customize the options with defaults
1278
+ metadata = @config.rpcs.get_task.metadata.to_h
1279
+
1280
+ # Set x-goog-api-client and x-goog-user-project headers
1281
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1282
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1283
+ gapic_version: ::Google::Cloud::Tasks::V2beta2::VERSION
1284
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1285
+
1286
+ header_params = {
1287
+ "name" => request.name
1288
+ }
1289
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1290
+ metadata[:"x-goog-request-params"] ||= request_params_header
1291
+
1292
+ options.apply_defaults timeout: @config.rpcs.get_task.timeout,
1293
+ metadata: metadata,
1294
+ retry_policy: @config.rpcs.get_task.retry_policy
1295
+ options.apply_defaults metadata: @config.metadata,
1296
+ retry_policy: @config.retry_policy
1297
+
1298
+ @cloud_tasks_stub.call_rpc :get_task, request, options: options do |response, operation|
1299
+ yield response, operation if block_given?
1300
+ return response
1301
+ end
1302
+ rescue ::GRPC::BadStatus => e
1303
+ raise ::Google::Cloud::Error.from_error(e)
1304
+ end
1305
+
1306
+ ##
1307
+ # Creates a task and adds it to a queue.
1308
+ #
1309
+ # Tasks cannot be updated after creation; there is no UpdateTask command.
1310
+ #
1311
+ # * For {::Google::Cloud::Tasks::V2beta2::AppEngineHttpTarget App Engine queues}, the maximum task size is
1312
+ # 100KB.
1313
+ # * For {::Google::Cloud::Tasks::V2beta2::PullTarget pull queues}, the maximum task size is 1MB.
1314
+ #
1315
+ # @overload create_task(request, options = nil)
1316
+ # Pass arguments to `create_task` via a request object, either of type
1317
+ # {::Google::Cloud::Tasks::V2beta2::CreateTaskRequest} or an equivalent Hash.
1318
+ #
1319
+ # @param request [::Google::Cloud::Tasks::V2beta2::CreateTaskRequest, ::Hash]
1320
+ # A request object representing the call parameters. Required. To specify no
1321
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1322
+ # @param options [::Gapic::CallOptions, ::Hash]
1323
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
1324
+ #
1325
+ # @overload create_task(parent: nil, task: nil, response_view: nil)
1326
+ # Pass arguments to `create_task` via keyword arguments. Note that at
1327
+ # least one keyword argument is required. To specify no parameters, or to keep all
1328
+ # the default parameter values, pass an empty Hash as a request object (see above).
1329
+ #
1330
+ # @param parent [::String]
1331
+ # Required. The queue name. For example:
1332
+ # `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID`
1333
+ #
1334
+ # The queue must already exist.
1335
+ # @param task [::Google::Cloud::Tasks::V2beta2::Task, ::Hash]
1336
+ # Required. The task to add.
1337
+ #
1338
+ # Task names have the following format:
1339
+ # `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID`.
1340
+ # The user can optionally specify a task {::Google::Cloud::Tasks::V2beta2::Task#name name}. If a
1341
+ # name is not specified then the system will generate a random
1342
+ # unique task id, which will be set in the task returned in the
1343
+ # {::Google::Cloud::Tasks::V2beta2::Task#name response}.
1344
+ #
1345
+ # If {::Google::Cloud::Tasks::V2beta2::Task#schedule_time schedule_time} is not set or is in the
1346
+ # past then Cloud Tasks will set it to the current time.
1347
+ #
1348
+ # Task De-duplication:
1349
+ #
1350
+ # Explicitly specifying a task ID enables task de-duplication. If
1351
+ # a task's ID is identical to that of an existing task or a task
1352
+ # that was deleted or completed recently then the call will fail
1353
+ # with [ALREADY_EXISTS][google.rpc.Code.ALREADY_EXISTS].
1354
+ # If the task's queue was created using Cloud Tasks, then another task with
1355
+ # the same name can't be created for ~1hour after the original task was
1356
+ # deleted or completed. If the task's queue was created using queue.yaml or
1357
+ # queue.xml, then another task with the same name can't be created
1358
+ # for ~9days after the original task was deleted or completed.
1359
+ #
1360
+ # Because there is an extra lookup cost to identify duplicate task
1361
+ # names, these {::Google::Cloud::Tasks::V2beta2::CloudTasks::Client#create_task CreateTask} calls have significantly
1362
+ # increased latency. Using hashed strings for the task id or for
1363
+ # the prefix of the task id is recommended. Choosing task ids that
1364
+ # are sequential or have sequential prefixes, for example using a
1365
+ # timestamp, causes an increase in latency and error rates in all
1366
+ # task commands. The infrastructure relies on an approximately
1367
+ # uniform distribution of task ids to store and serve tasks
1368
+ # efficiently.
1369
+ # @param response_view [::Google::Cloud::Tasks::V2beta2::Task::View]
1370
+ # The response_view specifies which subset of the {::Google::Cloud::Tasks::V2beta2::Task Task} will be
1371
+ # returned.
1372
+ #
1373
+ # By default response_view is {::Google::Cloud::Tasks::V2beta2::Task::View::BASIC BASIC}; not all
1374
+ # information is retrieved by default because some data, such as
1375
+ # payloads, might be desirable to return only when needed because
1376
+ # of its large size or because of the sensitivity of data that it
1377
+ # contains.
1378
+ #
1379
+ # Authorization for {::Google::Cloud::Tasks::V2beta2::Task::View::FULL FULL} requires
1380
+ # `cloudtasks.tasks.fullView` [Google IAM](https://cloud.google.com/iam/)
1381
+ # permission on the {::Google::Cloud::Tasks::V2beta2::Task Task} resource.
1382
+ #
1383
+ # @yield [response, operation] Access the result along with the RPC operation
1384
+ # @yieldparam response [::Google::Cloud::Tasks::V2beta2::Task]
1385
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
1386
+ #
1387
+ # @return [::Google::Cloud::Tasks::V2beta2::Task]
1388
+ #
1389
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
1390
+ #
1391
+ def create_task request, options = nil
1392
+ raise ::ArgumentError, "request must be provided" if request.nil?
1393
+
1394
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Tasks::V2beta2::CreateTaskRequest
1395
+
1396
+ # Converts hash and nil to an options object
1397
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1398
+
1399
+ # Customize the options with defaults
1400
+ metadata = @config.rpcs.create_task.metadata.to_h
1401
+
1402
+ # Set x-goog-api-client and x-goog-user-project headers
1403
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1404
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1405
+ gapic_version: ::Google::Cloud::Tasks::V2beta2::VERSION
1406
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1407
+
1408
+ header_params = {
1409
+ "parent" => request.parent
1410
+ }
1411
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1412
+ metadata[:"x-goog-request-params"] ||= request_params_header
1413
+
1414
+ options.apply_defaults timeout: @config.rpcs.create_task.timeout,
1415
+ metadata: metadata,
1416
+ retry_policy: @config.rpcs.create_task.retry_policy
1417
+ options.apply_defaults metadata: @config.metadata,
1418
+ retry_policy: @config.retry_policy
1419
+
1420
+ @cloud_tasks_stub.call_rpc :create_task, request, options: options do |response, operation|
1421
+ yield response, operation if block_given?
1422
+ return response
1423
+ end
1424
+ rescue ::GRPC::BadStatus => e
1425
+ raise ::Google::Cloud::Error.from_error(e)
1426
+ end
1427
+
1428
+ ##
1429
+ # Deletes a task.
1430
+ #
1431
+ # A task can be deleted if it is scheduled or dispatched. A task
1432
+ # cannot be deleted if it has completed successfully or permanently
1433
+ # failed.
1434
+ #
1435
+ # @overload delete_task(request, options = nil)
1436
+ # Pass arguments to `delete_task` via a request object, either of type
1437
+ # {::Google::Cloud::Tasks::V2beta2::DeleteTaskRequest} or an equivalent Hash.
1438
+ #
1439
+ # @param request [::Google::Cloud::Tasks::V2beta2::DeleteTaskRequest, ::Hash]
1440
+ # A request object representing the call parameters. Required. To specify no
1441
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1442
+ # @param options [::Gapic::CallOptions, ::Hash]
1443
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
1444
+ #
1445
+ # @overload delete_task(name: nil)
1446
+ # Pass arguments to `delete_task` via keyword arguments. Note that at
1447
+ # least one keyword argument is required. To specify no parameters, or to keep all
1448
+ # the default parameter values, pass an empty Hash as a request object (see above).
1449
+ #
1450
+ # @param name [::String]
1451
+ # Required. The task name. For example:
1452
+ # `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID`
1453
+ #
1454
+ # @yield [response, operation] Access the result along with the RPC operation
1455
+ # @yieldparam response [::Google::Protobuf::Empty]
1456
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
1457
+ #
1458
+ # @return [::Google::Protobuf::Empty]
1459
+ #
1460
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
1461
+ #
1462
+ def delete_task request, options = nil
1463
+ raise ::ArgumentError, "request must be provided" if request.nil?
1464
+
1465
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Tasks::V2beta2::DeleteTaskRequest
1466
+
1467
+ # Converts hash and nil to an options object
1468
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1469
+
1470
+ # Customize the options with defaults
1471
+ metadata = @config.rpcs.delete_task.metadata.to_h
1472
+
1473
+ # Set x-goog-api-client and x-goog-user-project headers
1474
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1475
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1476
+ gapic_version: ::Google::Cloud::Tasks::V2beta2::VERSION
1477
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1478
+
1479
+ header_params = {
1480
+ "name" => request.name
1481
+ }
1482
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1483
+ metadata[:"x-goog-request-params"] ||= request_params_header
1484
+
1485
+ options.apply_defaults timeout: @config.rpcs.delete_task.timeout,
1486
+ metadata: metadata,
1487
+ retry_policy: @config.rpcs.delete_task.retry_policy
1488
+ options.apply_defaults metadata: @config.metadata,
1489
+ retry_policy: @config.retry_policy
1490
+
1491
+ @cloud_tasks_stub.call_rpc :delete_task, request, options: options do |response, operation|
1492
+ yield response, operation if block_given?
1493
+ return response
1494
+ end
1495
+ rescue ::GRPC::BadStatus => e
1496
+ raise ::Google::Cloud::Error.from_error(e)
1497
+ end
1498
+
1499
+ ##
1500
+ # Leases tasks from a pull queue for
1501
+ # {::Google::Cloud::Tasks::V2beta2::LeaseTasksRequest#lease_duration lease_duration}.
1502
+ #
1503
+ # This method is invoked by the worker to obtain a lease. The
1504
+ # worker must acknowledge the task via
1505
+ # {::Google::Cloud::Tasks::V2beta2::CloudTasks::Client#acknowledge_task AcknowledgeTask} after they have
1506
+ # performed the work associated with the task.
1507
+ #
1508
+ # The {::Google::Cloud::Tasks::V2beta2::PullMessage#payload payload} is intended to store data that
1509
+ # the worker needs to perform the work associated with the task. To
1510
+ # return the payloads in the {::Google::Cloud::Tasks::V2beta2::LeaseTasksResponse response}, set
1511
+ # {::Google::Cloud::Tasks::V2beta2::LeaseTasksRequest#response_view response_view} to
1512
+ # {::Google::Cloud::Tasks::V2beta2::Task::View::FULL FULL}.
1513
+ #
1514
+ # A maximum of 10 qps of {::Google::Cloud::Tasks::V2beta2::CloudTasks::Client#lease_tasks LeaseTasks}
1515
+ # requests are allowed per
1516
+ # queue. [RESOURCE_EXHAUSTED][google.rpc.Code.RESOURCE_EXHAUSTED]
1517
+ # is returned when this limit is
1518
+ # exceeded. [RESOURCE_EXHAUSTED][google.rpc.Code.RESOURCE_EXHAUSTED]
1519
+ # is also returned when
1520
+ # {::Google::Cloud::Tasks::V2beta2::RateLimits#max_tasks_dispatched_per_second max_tasks_dispatched_per_second}
1521
+ # is exceeded.
1522
+ #
1523
+ # @overload lease_tasks(request, options = nil)
1524
+ # Pass arguments to `lease_tasks` via a request object, either of type
1525
+ # {::Google::Cloud::Tasks::V2beta2::LeaseTasksRequest} or an equivalent Hash.
1526
+ #
1527
+ # @param request [::Google::Cloud::Tasks::V2beta2::LeaseTasksRequest, ::Hash]
1528
+ # A request object representing the call parameters. Required. To specify no
1529
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1530
+ # @param options [::Gapic::CallOptions, ::Hash]
1531
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
1532
+ #
1533
+ # @overload lease_tasks(parent: nil, max_tasks: nil, lease_duration: nil, response_view: nil, filter: nil)
1534
+ # Pass arguments to `lease_tasks` via keyword arguments. Note that at
1535
+ # least one keyword argument is required. To specify no parameters, or to keep all
1536
+ # the default parameter values, pass an empty Hash as a request object (see above).
1537
+ #
1538
+ # @param parent [::String]
1539
+ # Required. The queue name. For example:
1540
+ # `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID`
1541
+ # @param max_tasks [::Integer]
1542
+ # The maximum number of tasks to lease.
1543
+ #
1544
+ # The system will make a best effort to return as close to as
1545
+ # `max_tasks` as possible.
1546
+ #
1547
+ # The largest that `max_tasks` can be is 1000.
1548
+ #
1549
+ # The maximum total size of a {::Google::Cloud::Tasks::V2beta2::LeaseTasksResponse lease tasks response} is
1550
+ # 32 MB. If the sum of all task sizes requested reaches this limit,
1551
+ # fewer tasks than requested are returned.
1552
+ # @param lease_duration [::Google::Protobuf::Duration, ::Hash]
1553
+ # Required. The duration of the lease.
1554
+ #
1555
+ # Each task returned in the {::Google::Cloud::Tasks::V2beta2::LeaseTasksResponse response} will
1556
+ # have its {::Google::Cloud::Tasks::V2beta2::Task#schedule_time schedule_time} set to the current
1557
+ # time plus the `lease_duration`. The task is leased until its
1558
+ # {::Google::Cloud::Tasks::V2beta2::Task#schedule_time schedule_time}; thus, the task will not be
1559
+ # returned to another {::Google::Cloud::Tasks::V2beta2::CloudTasks::Client#lease_tasks LeaseTasks} call
1560
+ # before its {::Google::Cloud::Tasks::V2beta2::Task#schedule_time schedule_time}.
1561
+ #
1562
+ #
1563
+ # After the worker has successfully finished the work associated
1564
+ # with the task, the worker must call via
1565
+ # {::Google::Cloud::Tasks::V2beta2::CloudTasks::Client#acknowledge_task AcknowledgeTask} before the
1566
+ # {::Google::Cloud::Tasks::V2beta2::Task#schedule_time schedule_time}. Otherwise the task will be
1567
+ # returned to a later {::Google::Cloud::Tasks::V2beta2::CloudTasks::Client#lease_tasks LeaseTasks} call so
1568
+ # that another worker can retry it.
1569
+ #
1570
+ # The maximum lease duration is 1 week.
1571
+ # `lease_duration` will be truncated to the nearest second.
1572
+ # @param response_view [::Google::Cloud::Tasks::V2beta2::Task::View]
1573
+ # The response_view specifies which subset of the {::Google::Cloud::Tasks::V2beta2::Task Task} will be
1574
+ # returned.
1575
+ #
1576
+ # By default response_view is {::Google::Cloud::Tasks::V2beta2::Task::View::BASIC BASIC}; not all
1577
+ # information is retrieved by default because some data, such as
1578
+ # payloads, might be desirable to return only when needed because
1579
+ # of its large size or because of the sensitivity of data that it
1580
+ # contains.
1581
+ #
1582
+ # Authorization for {::Google::Cloud::Tasks::V2beta2::Task::View::FULL FULL} requires
1583
+ # `cloudtasks.tasks.fullView` [Google IAM](https://cloud.google.com/iam/)
1584
+ # permission on the {::Google::Cloud::Tasks::V2beta2::Task Task} resource.
1585
+ # @param filter [::String]
1586
+ # `filter` can be used to specify a subset of tasks to lease.
1587
+ #
1588
+ # When `filter` is set to `tag=<my-tag>` then the
1589
+ # {::Google::Cloud::Tasks::V2beta2::LeaseTasksResponse response} will contain only tasks whose
1590
+ # {::Google::Cloud::Tasks::V2beta2::PullMessage#tag tag} is equal to `<my-tag>`. `<my-tag>` must be
1591
+ # less than 500 characters.
1592
+ #
1593
+ # When `filter` is set to `tag_function=oldest_tag()`, only tasks which have
1594
+ # the same tag as the task with the oldest
1595
+ # {::Google::Cloud::Tasks::V2beta2::Task#schedule_time schedule_time} will be returned.
1596
+ #
1597
+ # Grammar Syntax:
1598
+ #
1599
+ # * `filter = "tag=" tag | "tag_function=" function`
1600
+ #
1601
+ # * `tag = string`
1602
+ #
1603
+ # * `function = "oldest_tag()"`
1604
+ #
1605
+ # The `oldest_tag()` function returns tasks which have the same tag as the
1606
+ # oldest task (ordered by schedule time).
1607
+ #
1608
+ # SDK compatibility: Although the SDK allows tags to be either
1609
+ # string or
1610
+ # [bytes](https://cloud.google.com/appengine/docs/standard/java/javadoc/com/google/appengine/api/taskqueue/TaskOptions.html#tag-byte:A-),
1611
+ # only UTF-8 encoded tags can be used in Cloud Tasks. Tag which
1612
+ # aren't UTF-8 encoded can't be used in the
1613
+ # {::Google::Cloud::Tasks::V2beta2::LeaseTasksRequest#filter filter} and the task's
1614
+ # {::Google::Cloud::Tasks::V2beta2::PullMessage#tag tag} will be displayed as empty in Cloud Tasks.
1615
+ #
1616
+ # @yield [response, operation] Access the result along with the RPC operation
1617
+ # @yieldparam response [::Google::Cloud::Tasks::V2beta2::LeaseTasksResponse]
1618
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
1619
+ #
1620
+ # @return [::Google::Cloud::Tasks::V2beta2::LeaseTasksResponse]
1621
+ #
1622
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
1623
+ #
1624
+ def lease_tasks request, options = nil
1625
+ raise ::ArgumentError, "request must be provided" if request.nil?
1626
+
1627
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Tasks::V2beta2::LeaseTasksRequest
1628
+
1629
+ # Converts hash and nil to an options object
1630
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1631
+
1632
+ # Customize the options with defaults
1633
+ metadata = @config.rpcs.lease_tasks.metadata.to_h
1634
+
1635
+ # Set x-goog-api-client and x-goog-user-project headers
1636
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1637
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1638
+ gapic_version: ::Google::Cloud::Tasks::V2beta2::VERSION
1639
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1640
+
1641
+ header_params = {
1642
+ "parent" => request.parent
1643
+ }
1644
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1645
+ metadata[:"x-goog-request-params"] ||= request_params_header
1646
+
1647
+ options.apply_defaults timeout: @config.rpcs.lease_tasks.timeout,
1648
+ metadata: metadata,
1649
+ retry_policy: @config.rpcs.lease_tasks.retry_policy
1650
+ options.apply_defaults metadata: @config.metadata,
1651
+ retry_policy: @config.retry_policy
1652
+
1653
+ @cloud_tasks_stub.call_rpc :lease_tasks, request, options: options do |response, operation|
1654
+ yield response, operation if block_given?
1655
+ return response
1656
+ end
1657
+ rescue ::GRPC::BadStatus => e
1658
+ raise ::Google::Cloud::Error.from_error(e)
1659
+ end
1660
+
1661
+ ##
1662
+ # Acknowledges a pull task.
1663
+ #
1664
+ # The worker, that is, the entity that
1665
+ # {::Google::Cloud::Tasks::V2beta2::CloudTasks::Client#lease_tasks leased} this task must call this method
1666
+ # to indicate that the work associated with the task has finished.
1667
+ #
1668
+ # The worker must acknowledge a task within the
1669
+ # {::Google::Cloud::Tasks::V2beta2::LeaseTasksRequest#lease_duration lease_duration} or the lease
1670
+ # will expire and the task will become available to be leased
1671
+ # again. After the task is acknowledged, it will not be returned
1672
+ # by a later {::Google::Cloud::Tasks::V2beta2::CloudTasks::Client#lease_tasks LeaseTasks},
1673
+ # {::Google::Cloud::Tasks::V2beta2::CloudTasks::Client#get_task GetTask}, or
1674
+ # {::Google::Cloud::Tasks::V2beta2::CloudTasks::Client#list_tasks ListTasks}.
1675
+ #
1676
+ # @overload acknowledge_task(request, options = nil)
1677
+ # Pass arguments to `acknowledge_task` via a request object, either of type
1678
+ # {::Google::Cloud::Tasks::V2beta2::AcknowledgeTaskRequest} or an equivalent Hash.
1679
+ #
1680
+ # @param request [::Google::Cloud::Tasks::V2beta2::AcknowledgeTaskRequest, ::Hash]
1681
+ # A request object representing the call parameters. Required. To specify no
1682
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1683
+ # @param options [::Gapic::CallOptions, ::Hash]
1684
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
1685
+ #
1686
+ # @overload acknowledge_task(name: nil, schedule_time: nil)
1687
+ # Pass arguments to `acknowledge_task` via keyword arguments. Note that at
1688
+ # least one keyword argument is required. To specify no parameters, or to keep all
1689
+ # the default parameter values, pass an empty Hash as a request object (see above).
1690
+ #
1691
+ # @param name [::String]
1692
+ # Required. The task name. For example:
1693
+ # `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID`
1694
+ # @param schedule_time [::Google::Protobuf::Timestamp, ::Hash]
1695
+ # Required. The task's current schedule time, available in the
1696
+ # {::Google::Cloud::Tasks::V2beta2::Task#schedule_time schedule_time} returned by
1697
+ # {::Google::Cloud::Tasks::V2beta2::CloudTasks::Client#lease_tasks LeaseTasks} response or
1698
+ # {::Google::Cloud::Tasks::V2beta2::CloudTasks::Client#renew_lease RenewLease} response. This restriction is
1699
+ # to ensure that your worker currently holds the lease.
1700
+ #
1701
+ # @yield [response, operation] Access the result along with the RPC operation
1702
+ # @yieldparam response [::Google::Protobuf::Empty]
1703
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
1704
+ #
1705
+ # @return [::Google::Protobuf::Empty]
1706
+ #
1707
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
1708
+ #
1709
+ def acknowledge_task request, options = nil
1710
+ raise ::ArgumentError, "request must be provided" if request.nil?
1711
+
1712
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Tasks::V2beta2::AcknowledgeTaskRequest
1713
+
1714
+ # Converts hash and nil to an options object
1715
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1716
+
1717
+ # Customize the options with defaults
1718
+ metadata = @config.rpcs.acknowledge_task.metadata.to_h
1719
+
1720
+ # Set x-goog-api-client and x-goog-user-project headers
1721
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1722
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1723
+ gapic_version: ::Google::Cloud::Tasks::V2beta2::VERSION
1724
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1725
+
1726
+ header_params = {
1727
+ "name" => request.name
1728
+ }
1729
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1730
+ metadata[:"x-goog-request-params"] ||= request_params_header
1731
+
1732
+ options.apply_defaults timeout: @config.rpcs.acknowledge_task.timeout,
1733
+ metadata: metadata,
1734
+ retry_policy: @config.rpcs.acknowledge_task.retry_policy
1735
+ options.apply_defaults metadata: @config.metadata,
1736
+ retry_policy: @config.retry_policy
1737
+
1738
+ @cloud_tasks_stub.call_rpc :acknowledge_task, request, options: options do |response, operation|
1739
+ yield response, operation if block_given?
1740
+ return response
1741
+ end
1742
+ rescue ::GRPC::BadStatus => e
1743
+ raise ::Google::Cloud::Error.from_error(e)
1744
+ end
1745
+
1746
+ ##
1747
+ # Renew the current lease of a pull task.
1748
+ #
1749
+ # The worker can use this method to extend the lease by a new
1750
+ # duration, starting from now. The new task lease will be
1751
+ # returned in the task's {::Google::Cloud::Tasks::V2beta2::Task#schedule_time schedule_time}.
1752
+ #
1753
+ # @overload renew_lease(request, options = nil)
1754
+ # Pass arguments to `renew_lease` via a request object, either of type
1755
+ # {::Google::Cloud::Tasks::V2beta2::RenewLeaseRequest} or an equivalent Hash.
1756
+ #
1757
+ # @param request [::Google::Cloud::Tasks::V2beta2::RenewLeaseRequest, ::Hash]
1758
+ # A request object representing the call parameters. Required. To specify no
1759
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1760
+ # @param options [::Gapic::CallOptions, ::Hash]
1761
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
1762
+ #
1763
+ # @overload renew_lease(name: nil, schedule_time: nil, lease_duration: nil, response_view: nil)
1764
+ # Pass arguments to `renew_lease` via keyword arguments. Note that at
1765
+ # least one keyword argument is required. To specify no parameters, or to keep all
1766
+ # the default parameter values, pass an empty Hash as a request object (see above).
1767
+ #
1768
+ # @param name [::String]
1769
+ # Required. The task name. For example:
1770
+ # `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID`
1771
+ # @param schedule_time [::Google::Protobuf::Timestamp, ::Hash]
1772
+ # Required. The task's current schedule time, available in the
1773
+ # {::Google::Cloud::Tasks::V2beta2::Task#schedule_time schedule_time} returned by
1774
+ # {::Google::Cloud::Tasks::V2beta2::CloudTasks::Client#lease_tasks LeaseTasks} response or
1775
+ # {::Google::Cloud::Tasks::V2beta2::CloudTasks::Client#renew_lease RenewLease} response. This restriction is
1776
+ # to ensure that your worker currently holds the lease.
1777
+ # @param lease_duration [::Google::Protobuf::Duration, ::Hash]
1778
+ # Required. The desired new lease duration, starting from now.
1779
+ #
1780
+ #
1781
+ # The maximum lease duration is 1 week.
1782
+ # `lease_duration` will be truncated to the nearest second.
1783
+ # @param response_view [::Google::Cloud::Tasks::V2beta2::Task::View]
1784
+ # The response_view specifies which subset of the {::Google::Cloud::Tasks::V2beta2::Task Task} will be
1785
+ # returned.
1786
+ #
1787
+ # By default response_view is {::Google::Cloud::Tasks::V2beta2::Task::View::BASIC BASIC}; not all
1788
+ # information is retrieved by default because some data, such as
1789
+ # payloads, might be desirable to return only when needed because
1790
+ # of its large size or because of the sensitivity of data that it
1791
+ # contains.
1792
+ #
1793
+ # Authorization for {::Google::Cloud::Tasks::V2beta2::Task::View::FULL FULL} requires
1794
+ # `cloudtasks.tasks.fullView` [Google IAM](https://cloud.google.com/iam/)
1795
+ # permission on the {::Google::Cloud::Tasks::V2beta2::Task Task} resource.
1796
+ #
1797
+ # @yield [response, operation] Access the result along with the RPC operation
1798
+ # @yieldparam response [::Google::Cloud::Tasks::V2beta2::Task]
1799
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
1800
+ #
1801
+ # @return [::Google::Cloud::Tasks::V2beta2::Task]
1802
+ #
1803
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
1804
+ #
1805
+ def renew_lease request, options = nil
1806
+ raise ::ArgumentError, "request must be provided" if request.nil?
1807
+
1808
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Tasks::V2beta2::RenewLeaseRequest
1809
+
1810
+ # Converts hash and nil to an options object
1811
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1812
+
1813
+ # Customize the options with defaults
1814
+ metadata = @config.rpcs.renew_lease.metadata.to_h
1815
+
1816
+ # Set x-goog-api-client and x-goog-user-project headers
1817
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1818
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1819
+ gapic_version: ::Google::Cloud::Tasks::V2beta2::VERSION
1820
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1821
+
1822
+ header_params = {
1823
+ "name" => request.name
1824
+ }
1825
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1826
+ metadata[:"x-goog-request-params"] ||= request_params_header
1827
+
1828
+ options.apply_defaults timeout: @config.rpcs.renew_lease.timeout,
1829
+ metadata: metadata,
1830
+ retry_policy: @config.rpcs.renew_lease.retry_policy
1831
+ options.apply_defaults metadata: @config.metadata,
1832
+ retry_policy: @config.retry_policy
1833
+
1834
+ @cloud_tasks_stub.call_rpc :renew_lease, request, options: options do |response, operation|
1835
+ yield response, operation if block_given?
1836
+ return response
1837
+ end
1838
+ rescue ::GRPC::BadStatus => e
1839
+ raise ::Google::Cloud::Error.from_error(e)
1840
+ end
1841
+
1842
+ ##
1843
+ # Cancel a pull task's lease.
1844
+ #
1845
+ # The worker can use this method to cancel a task's lease by
1846
+ # setting its {::Google::Cloud::Tasks::V2beta2::Task#schedule_time schedule_time} to now. This will
1847
+ # make the task available to be leased to the next caller of
1848
+ # {::Google::Cloud::Tasks::V2beta2::CloudTasks::Client#lease_tasks LeaseTasks}.
1849
+ #
1850
+ # @overload cancel_lease(request, options = nil)
1851
+ # Pass arguments to `cancel_lease` via a request object, either of type
1852
+ # {::Google::Cloud::Tasks::V2beta2::CancelLeaseRequest} or an equivalent Hash.
1853
+ #
1854
+ # @param request [::Google::Cloud::Tasks::V2beta2::CancelLeaseRequest, ::Hash]
1855
+ # A request object representing the call parameters. Required. To specify no
1856
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1857
+ # @param options [::Gapic::CallOptions, ::Hash]
1858
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
1859
+ #
1860
+ # @overload cancel_lease(name: nil, schedule_time: nil, response_view: nil)
1861
+ # Pass arguments to `cancel_lease` via keyword arguments. Note that at
1862
+ # least one keyword argument is required. To specify no parameters, or to keep all
1863
+ # the default parameter values, pass an empty Hash as a request object (see above).
1864
+ #
1865
+ # @param name [::String]
1866
+ # Required. The task name. For example:
1867
+ # `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID`
1868
+ # @param schedule_time [::Google::Protobuf::Timestamp, ::Hash]
1869
+ # Required. The task's current schedule time, available in the
1870
+ # {::Google::Cloud::Tasks::V2beta2::Task#schedule_time schedule_time} returned by
1871
+ # {::Google::Cloud::Tasks::V2beta2::CloudTasks::Client#lease_tasks LeaseTasks} response or
1872
+ # {::Google::Cloud::Tasks::V2beta2::CloudTasks::Client#renew_lease RenewLease} response. This restriction is
1873
+ # to ensure that your worker currently holds the lease.
1874
+ # @param response_view [::Google::Cloud::Tasks::V2beta2::Task::View]
1875
+ # The response_view specifies which subset of the {::Google::Cloud::Tasks::V2beta2::Task Task} will be
1876
+ # returned.
1877
+ #
1878
+ # By default response_view is {::Google::Cloud::Tasks::V2beta2::Task::View::BASIC BASIC}; not all
1879
+ # information is retrieved by default because some data, such as
1880
+ # payloads, might be desirable to return only when needed because
1881
+ # of its large size or because of the sensitivity of data that it
1882
+ # contains.
1883
+ #
1884
+ # Authorization for {::Google::Cloud::Tasks::V2beta2::Task::View::FULL FULL} requires
1885
+ # `cloudtasks.tasks.fullView` [Google IAM](https://cloud.google.com/iam/)
1886
+ # permission on the {::Google::Cloud::Tasks::V2beta2::Task Task} resource.
1887
+ #
1888
+ # @yield [response, operation] Access the result along with the RPC operation
1889
+ # @yieldparam response [::Google::Cloud::Tasks::V2beta2::Task]
1890
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
1891
+ #
1892
+ # @return [::Google::Cloud::Tasks::V2beta2::Task]
1893
+ #
1894
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
1895
+ #
1896
+ def cancel_lease request, options = nil
1897
+ raise ::ArgumentError, "request must be provided" if request.nil?
1898
+
1899
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Tasks::V2beta2::CancelLeaseRequest
1900
+
1901
+ # Converts hash and nil to an options object
1902
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1903
+
1904
+ # Customize the options with defaults
1905
+ metadata = @config.rpcs.cancel_lease.metadata.to_h
1906
+
1907
+ # Set x-goog-api-client and x-goog-user-project headers
1908
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1909
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1910
+ gapic_version: ::Google::Cloud::Tasks::V2beta2::VERSION
1911
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1912
+
1913
+ header_params = {
1914
+ "name" => request.name
1915
+ }
1916
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1917
+ metadata[:"x-goog-request-params"] ||= request_params_header
1918
+
1919
+ options.apply_defaults timeout: @config.rpcs.cancel_lease.timeout,
1920
+ metadata: metadata,
1921
+ retry_policy: @config.rpcs.cancel_lease.retry_policy
1922
+ options.apply_defaults metadata: @config.metadata,
1923
+ retry_policy: @config.retry_policy
1924
+
1925
+ @cloud_tasks_stub.call_rpc :cancel_lease, request, options: options do |response, operation|
1926
+ yield response, operation if block_given?
1927
+ return response
1928
+ end
1929
+ rescue ::GRPC::BadStatus => e
1930
+ raise ::Google::Cloud::Error.from_error(e)
1931
+ end
1932
+
1933
+ ##
1934
+ # Forces a task to run now.
1935
+ #
1936
+ # When this method is called, Cloud Tasks will dispatch the task, even if
1937
+ # the task is already running, the queue has reached its {::Google::Cloud::Tasks::V2beta2::RateLimits RateLimits} or
1938
+ # is {::Google::Cloud::Tasks::V2beta2::Queue::State::PAUSED PAUSED}.
1939
+ #
1940
+ # This command is meant to be used for manual debugging. For
1941
+ # example, {::Google::Cloud::Tasks::V2beta2::CloudTasks::Client#run_task RunTask} can be used to retry a failed
1942
+ # task after a fix has been made or to manually force a task to be
1943
+ # dispatched now.
1944
+ #
1945
+ # The dispatched task is returned. That is, the task that is returned
1946
+ # contains the {::Google::Cloud::Tasks::V2beta2::Task#status status} after the task is dispatched but
1947
+ # before the task is received by its target.
1948
+ #
1949
+ # If Cloud Tasks receives a successful response from the task's
1950
+ # target, then the task will be deleted; otherwise the task's
1951
+ # {::Google::Cloud::Tasks::V2beta2::Task#schedule_time schedule_time} will be reset to the time that
1952
+ # {::Google::Cloud::Tasks::V2beta2::CloudTasks::Client#run_task RunTask} was called plus the retry delay specified
1953
+ # in the queue's {::Google::Cloud::Tasks::V2beta2::RetryConfig RetryConfig}.
1954
+ #
1955
+ # {::Google::Cloud::Tasks::V2beta2::CloudTasks::Client#run_task RunTask} returns
1956
+ # [NOT_FOUND][google.rpc.Code.NOT_FOUND] when it is called on a
1957
+ # task that has already succeeded or permanently failed.
1958
+ #
1959
+ # {::Google::Cloud::Tasks::V2beta2::CloudTasks::Client#run_task RunTask} cannot be called on a
1960
+ # {::Google::Cloud::Tasks::V2beta2::PullMessage pull task}.
1961
+ #
1962
+ # @overload run_task(request, options = nil)
1963
+ # Pass arguments to `run_task` via a request object, either of type
1964
+ # {::Google::Cloud::Tasks::V2beta2::RunTaskRequest} or an equivalent Hash.
1965
+ #
1966
+ # @param request [::Google::Cloud::Tasks::V2beta2::RunTaskRequest, ::Hash]
1967
+ # A request object representing the call parameters. Required. To specify no
1968
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1969
+ # @param options [::Gapic::CallOptions, ::Hash]
1970
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
1971
+ #
1972
+ # @overload run_task(name: nil, response_view: nil)
1973
+ # Pass arguments to `run_task` via keyword arguments. Note that at
1974
+ # least one keyword argument is required. To specify no parameters, or to keep all
1975
+ # the default parameter values, pass an empty Hash as a request object (see above).
1976
+ #
1977
+ # @param name [::String]
1978
+ # Required. The task name. For example:
1979
+ # `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID`
1980
+ # @param response_view [::Google::Cloud::Tasks::V2beta2::Task::View]
1981
+ # The response_view specifies which subset of the {::Google::Cloud::Tasks::V2beta2::Task Task} will be
1982
+ # returned.
1983
+ #
1984
+ # By default response_view is {::Google::Cloud::Tasks::V2beta2::Task::View::BASIC BASIC}; not all
1985
+ # information is retrieved by default because some data, such as
1986
+ # payloads, might be desirable to return only when needed because
1987
+ # of its large size or because of the sensitivity of data that it
1988
+ # contains.
1989
+ #
1990
+ # Authorization for {::Google::Cloud::Tasks::V2beta2::Task::View::FULL FULL} requires
1991
+ # `cloudtasks.tasks.fullView` [Google IAM](https://cloud.google.com/iam/)
1992
+ # permission on the {::Google::Cloud::Tasks::V2beta2::Task Task} resource.
1993
+ #
1994
+ # @yield [response, operation] Access the result along with the RPC operation
1995
+ # @yieldparam response [::Google::Cloud::Tasks::V2beta2::Task]
1996
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
1997
+ #
1998
+ # @return [::Google::Cloud::Tasks::V2beta2::Task]
1999
+ #
2000
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
2001
+ #
2002
+ def run_task request, options = nil
2003
+ raise ::ArgumentError, "request must be provided" if request.nil?
2004
+
2005
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Tasks::V2beta2::RunTaskRequest
2006
+
2007
+ # Converts hash and nil to an options object
2008
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
2009
+
2010
+ # Customize the options with defaults
2011
+ metadata = @config.rpcs.run_task.metadata.to_h
2012
+
2013
+ # Set x-goog-api-client and x-goog-user-project headers
2014
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
2015
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
2016
+ gapic_version: ::Google::Cloud::Tasks::V2beta2::VERSION
2017
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
2018
+
2019
+ header_params = {
2020
+ "name" => request.name
2021
+ }
2022
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
2023
+ metadata[:"x-goog-request-params"] ||= request_params_header
2024
+
2025
+ options.apply_defaults timeout: @config.rpcs.run_task.timeout,
2026
+ metadata: metadata,
2027
+ retry_policy: @config.rpcs.run_task.retry_policy
2028
+ options.apply_defaults metadata: @config.metadata,
2029
+ retry_policy: @config.retry_policy
2030
+
2031
+ @cloud_tasks_stub.call_rpc :run_task, request, options: options do |response, operation|
2032
+ yield response, operation if block_given?
2033
+ return response
2034
+ end
2035
+ rescue ::GRPC::BadStatus => e
2036
+ raise ::Google::Cloud::Error.from_error(e)
2037
+ end
2038
+
2039
+ ##
2040
+ # Configuration class for the CloudTasks API.
2041
+ #
2042
+ # This class represents the configuration for CloudTasks,
2043
+ # providing control over timeouts, retry behavior, logging, transport
2044
+ # parameters, and other low-level controls. Certain parameters can also be
2045
+ # applied individually to specific RPCs. See
2046
+ # {::Google::Cloud::Tasks::V2beta2::CloudTasks::Client::Configuration::Rpcs}
2047
+ # for a list of RPCs that can be configured independently.
2048
+ #
2049
+ # Configuration can be applied globally to all clients, or to a single client
2050
+ # on construction.
2051
+ #
2052
+ # # Examples
2053
+ #
2054
+ # To modify the global config, setting the timeout for list_queues
2055
+ # to 20 seconds, and all remaining timeouts to 10 seconds:
2056
+ #
2057
+ # ::Google::Cloud::Tasks::V2beta2::CloudTasks::Client.configure do |config|
2058
+ # config.timeout = 10.0
2059
+ # config.rpcs.list_queues.timeout = 20.0
2060
+ # end
2061
+ #
2062
+ # To apply the above configuration only to a new client:
2063
+ #
2064
+ # client = ::Google::Cloud::Tasks::V2beta2::CloudTasks::Client.new do |config|
2065
+ # config.timeout = 10.0
2066
+ # config.rpcs.list_queues.timeout = 20.0
2067
+ # end
2068
+ #
2069
+ # @!attribute [rw] endpoint
2070
+ # The hostname or hostname:port of the service endpoint.
2071
+ # Defaults to `"cloudtasks.googleapis.com"`.
2072
+ # @return [::String]
2073
+ # @!attribute [rw] credentials
2074
+ # Credentials to send with calls. You may provide any of the following types:
2075
+ # * (`String`) The path to a service account key file in JSON format
2076
+ # * (`Hash`) A service account key as a Hash
2077
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
2078
+ # (see the [googleauth docs](https://googleapis.dev/ruby/googleauth/latest/index.html))
2079
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
2080
+ # (see the [signet docs](https://googleapis.dev/ruby/signet/latest/Signet/OAuth2/Client.html))
2081
+ # * (`GRPC::Core::Channel`) a gRPC channel with included credentials
2082
+ # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
2083
+ # * (`nil`) indicating no credentials
2084
+ # @return [::Object]
2085
+ # @!attribute [rw] scope
2086
+ # The OAuth scopes
2087
+ # @return [::Array<::String>]
2088
+ # @!attribute [rw] lib_name
2089
+ # The library name as recorded in instrumentation and logging
2090
+ # @return [::String]
2091
+ # @!attribute [rw] lib_version
2092
+ # The library version as recorded in instrumentation and logging
2093
+ # @return [::String]
2094
+ # @!attribute [rw] channel_args
2095
+ # Extra parameters passed to the gRPC channel. Note: this is ignored if a
2096
+ # `GRPC::Core::Channel` object is provided as the credential.
2097
+ # @return [::Hash]
2098
+ # @!attribute [rw] interceptors
2099
+ # An array of interceptors that are run before calls are executed.
2100
+ # @return [::Array<::GRPC::ClientInterceptor>]
2101
+ # @!attribute [rw] timeout
2102
+ # The call timeout in seconds.
2103
+ # @return [::Numeric]
2104
+ # @!attribute [rw] metadata
2105
+ # Additional gRPC headers to be sent with the call.
2106
+ # @return [::Hash{::Symbol=>::String}]
2107
+ # @!attribute [rw] retry_policy
2108
+ # The retry policy. The value is a hash with the following keys:
2109
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
2110
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
2111
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
2112
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
2113
+ # trigger a retry.
2114
+ # @return [::Hash]
2115
+ #
2116
+ class Configuration
2117
+ extend ::Gapic::Config
2118
+
2119
+ config_attr :endpoint, "cloudtasks.googleapis.com", String
2120
+ config_attr :credentials, nil do |value|
2121
+ allowed = [::String, ::Hash, ::Proc, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
2122
+ allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
2123
+ allowed.any? { |klass| klass === value }
2124
+ end
2125
+ config_attr :scope, nil, ::String, ::Array, nil
2126
+ config_attr :lib_name, nil, ::String, nil
2127
+ config_attr :lib_version, nil, ::String, nil
2128
+ config_attr(:channel_args, { "grpc.service_config_disable_resolution"=>1 }, ::Hash, nil)
2129
+ config_attr :interceptors, nil, ::Array, nil
2130
+ config_attr :timeout, nil, ::Numeric, nil
2131
+ config_attr :metadata, nil, ::Hash, nil
2132
+ config_attr :retry_policy, nil, ::Hash, Proc, nil
2133
+
2134
+ # @private
2135
+ def initialize parent_config = nil
2136
+ @parent_config = parent_config unless parent_config.nil?
2137
+
2138
+ yield self if block_given?
2139
+ end
2140
+
2141
+ ##
2142
+ # Configurations for individual RPCs
2143
+ # @return [Rpcs]
2144
+ #
2145
+ def rpcs
2146
+ @rpcs ||= begin
2147
+ parent_rpcs = nil
2148
+ parent_rpcs = @parent_config.rpcs if @parent_config&.respond_to? :rpcs
2149
+ Rpcs.new parent_rpcs
2150
+ end
2151
+ end
2152
+
2153
+ ##
2154
+ # Configuration RPC class for the CloudTasks API.
2155
+ #
2156
+ # Includes fields providing the configuration for each RPC in this service.
2157
+ # Each configuration object is of type `Gapic::Config::Method` and includes
2158
+ # the following configuration fields:
2159
+ #
2160
+ # * `timeout` (*type:* `Numeric`) - The call timeout in milliseconds
2161
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
2162
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
2163
+ # include the following keys:
2164
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
2165
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
2166
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
2167
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
2168
+ # trigger a retry.
2169
+ #
2170
+ class Rpcs
2171
+ ##
2172
+ # RPC-specific configuration for `list_queues`
2173
+ # @return [::Gapic::Config::Method]
2174
+ #
2175
+ attr_reader :list_queues
2176
+ ##
2177
+ # RPC-specific configuration for `get_queue`
2178
+ # @return [::Gapic::Config::Method]
2179
+ #
2180
+ attr_reader :get_queue
2181
+ ##
2182
+ # RPC-specific configuration for `create_queue`
2183
+ # @return [::Gapic::Config::Method]
2184
+ #
2185
+ attr_reader :create_queue
2186
+ ##
2187
+ # RPC-specific configuration for `update_queue`
2188
+ # @return [::Gapic::Config::Method]
2189
+ #
2190
+ attr_reader :update_queue
2191
+ ##
2192
+ # RPC-specific configuration for `delete_queue`
2193
+ # @return [::Gapic::Config::Method]
2194
+ #
2195
+ attr_reader :delete_queue
2196
+ ##
2197
+ # RPC-specific configuration for `purge_queue`
2198
+ # @return [::Gapic::Config::Method]
2199
+ #
2200
+ attr_reader :purge_queue
2201
+ ##
2202
+ # RPC-specific configuration for `pause_queue`
2203
+ # @return [::Gapic::Config::Method]
2204
+ #
2205
+ attr_reader :pause_queue
2206
+ ##
2207
+ # RPC-specific configuration for `resume_queue`
2208
+ # @return [::Gapic::Config::Method]
2209
+ #
2210
+ attr_reader :resume_queue
2211
+ ##
2212
+ # RPC-specific configuration for `get_iam_policy`
2213
+ # @return [::Gapic::Config::Method]
2214
+ #
2215
+ attr_reader :get_iam_policy
2216
+ ##
2217
+ # RPC-specific configuration for `set_iam_policy`
2218
+ # @return [::Gapic::Config::Method]
2219
+ #
2220
+ attr_reader :set_iam_policy
2221
+ ##
2222
+ # RPC-specific configuration for `test_iam_permissions`
2223
+ # @return [::Gapic::Config::Method]
2224
+ #
2225
+ attr_reader :test_iam_permissions
2226
+ ##
2227
+ # RPC-specific configuration for `list_tasks`
2228
+ # @return [::Gapic::Config::Method]
2229
+ #
2230
+ attr_reader :list_tasks
2231
+ ##
2232
+ # RPC-specific configuration for `get_task`
2233
+ # @return [::Gapic::Config::Method]
2234
+ #
2235
+ attr_reader :get_task
2236
+ ##
2237
+ # RPC-specific configuration for `create_task`
2238
+ # @return [::Gapic::Config::Method]
2239
+ #
2240
+ attr_reader :create_task
2241
+ ##
2242
+ # RPC-specific configuration for `delete_task`
2243
+ # @return [::Gapic::Config::Method]
2244
+ #
2245
+ attr_reader :delete_task
2246
+ ##
2247
+ # RPC-specific configuration for `lease_tasks`
2248
+ # @return [::Gapic::Config::Method]
2249
+ #
2250
+ attr_reader :lease_tasks
2251
+ ##
2252
+ # RPC-specific configuration for `acknowledge_task`
2253
+ # @return [::Gapic::Config::Method]
2254
+ #
2255
+ attr_reader :acknowledge_task
2256
+ ##
2257
+ # RPC-specific configuration for `renew_lease`
2258
+ # @return [::Gapic::Config::Method]
2259
+ #
2260
+ attr_reader :renew_lease
2261
+ ##
2262
+ # RPC-specific configuration for `cancel_lease`
2263
+ # @return [::Gapic::Config::Method]
2264
+ #
2265
+ attr_reader :cancel_lease
2266
+ ##
2267
+ # RPC-specific configuration for `run_task`
2268
+ # @return [::Gapic::Config::Method]
2269
+ #
2270
+ attr_reader :run_task
2271
+
2272
+ # @private
2273
+ def initialize parent_rpcs = nil
2274
+ list_queues_config = parent_rpcs&.list_queues if parent_rpcs&.respond_to? :list_queues
2275
+ @list_queues = ::Gapic::Config::Method.new list_queues_config
2276
+ get_queue_config = parent_rpcs&.get_queue if parent_rpcs&.respond_to? :get_queue
2277
+ @get_queue = ::Gapic::Config::Method.new get_queue_config
2278
+ create_queue_config = parent_rpcs&.create_queue if parent_rpcs&.respond_to? :create_queue
2279
+ @create_queue = ::Gapic::Config::Method.new create_queue_config
2280
+ update_queue_config = parent_rpcs&.update_queue if parent_rpcs&.respond_to? :update_queue
2281
+ @update_queue = ::Gapic::Config::Method.new update_queue_config
2282
+ delete_queue_config = parent_rpcs&.delete_queue if parent_rpcs&.respond_to? :delete_queue
2283
+ @delete_queue = ::Gapic::Config::Method.new delete_queue_config
2284
+ purge_queue_config = parent_rpcs&.purge_queue if parent_rpcs&.respond_to? :purge_queue
2285
+ @purge_queue = ::Gapic::Config::Method.new purge_queue_config
2286
+ pause_queue_config = parent_rpcs&.pause_queue if parent_rpcs&.respond_to? :pause_queue
2287
+ @pause_queue = ::Gapic::Config::Method.new pause_queue_config
2288
+ resume_queue_config = parent_rpcs&.resume_queue if parent_rpcs&.respond_to? :resume_queue
2289
+ @resume_queue = ::Gapic::Config::Method.new resume_queue_config
2290
+ get_iam_policy_config = parent_rpcs&.get_iam_policy if parent_rpcs&.respond_to? :get_iam_policy
2291
+ @get_iam_policy = ::Gapic::Config::Method.new get_iam_policy_config
2292
+ set_iam_policy_config = parent_rpcs&.set_iam_policy if parent_rpcs&.respond_to? :set_iam_policy
2293
+ @set_iam_policy = ::Gapic::Config::Method.new set_iam_policy_config
2294
+ test_iam_permissions_config = parent_rpcs&.test_iam_permissions if parent_rpcs&.respond_to? :test_iam_permissions
2295
+ @test_iam_permissions = ::Gapic::Config::Method.new test_iam_permissions_config
2296
+ list_tasks_config = parent_rpcs&.list_tasks if parent_rpcs&.respond_to? :list_tasks
2297
+ @list_tasks = ::Gapic::Config::Method.new list_tasks_config
2298
+ get_task_config = parent_rpcs&.get_task if parent_rpcs&.respond_to? :get_task
2299
+ @get_task = ::Gapic::Config::Method.new get_task_config
2300
+ create_task_config = parent_rpcs&.create_task if parent_rpcs&.respond_to? :create_task
2301
+ @create_task = ::Gapic::Config::Method.new create_task_config
2302
+ delete_task_config = parent_rpcs&.delete_task if parent_rpcs&.respond_to? :delete_task
2303
+ @delete_task = ::Gapic::Config::Method.new delete_task_config
2304
+ lease_tasks_config = parent_rpcs&.lease_tasks if parent_rpcs&.respond_to? :lease_tasks
2305
+ @lease_tasks = ::Gapic::Config::Method.new lease_tasks_config
2306
+ acknowledge_task_config = parent_rpcs&.acknowledge_task if parent_rpcs&.respond_to? :acknowledge_task
2307
+ @acknowledge_task = ::Gapic::Config::Method.new acknowledge_task_config
2308
+ renew_lease_config = parent_rpcs&.renew_lease if parent_rpcs&.respond_to? :renew_lease
2309
+ @renew_lease = ::Gapic::Config::Method.new renew_lease_config
2310
+ cancel_lease_config = parent_rpcs&.cancel_lease if parent_rpcs&.respond_to? :cancel_lease
2311
+ @cancel_lease = ::Gapic::Config::Method.new cancel_lease_config
2312
+ run_task_config = parent_rpcs&.run_task if parent_rpcs&.respond_to? :run_task
2313
+ @run_task = ::Gapic::Config::Method.new run_task_config
2314
+
2315
+ yield self if block_given?
2316
+ end
2317
+ end
2318
+ end
2319
+ end
2320
+ end
2321
+ end
2322
+ end
2323
+ end
2324
+ end