google-cloud-tasks 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +40 -4
- data/lib/google/cloud/tasks/v2beta2.rb +37 -4
- data/lib/google/cloud/tasks/v2beta2/cloud_tasks_client.rb +258 -76
- data/lib/google/cloud/tasks/v2beta2/cloud_tasks_client_config.json +1 -1
- data/lib/google/cloud/tasks/v2beta2/cloudtasks_pb.rb +1 -0
- data/lib/google/cloud/tasks/v2beta2/cloudtasks_services_pb.rb +0 -10
- data/lib/google/cloud/tasks/{credentials.rb → v2beta2/credentials.rb} +9 -7
- data/lib/google/cloud/tasks/v2beta2/doc/google/cloud/tasks/v2beta2/cloudtasks.rb +529 -0
- data/lib/google/cloud/tasks/v2beta2/doc/google/cloud/tasks/v2beta2/queue.rb +3 -3
- data/lib/google/cloud/tasks/v2beta2/doc/google/cloud/tasks/v2beta2/target.rb +2 -8
- data/lib/google/cloud/tasks/v2beta2/doc/google/cloud/tasks/v2beta2/task.rb +2 -2
- data/lib/google/cloud/tasks/v2beta2/doc/google/iam/v1/iam_policy.rb +62 -0
- data/lib/google/cloud/tasks/v2beta2/doc/google/protobuf/empty.rb +28 -0
- data/lib/google/cloud/tasks/v2beta2/doc/overview.rb +28 -4
- metadata +6 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c6a6e80523ba6a460a469dc750ee2c4e7d4b1cbd393fbde1ce12e8b1d242ad39
|
4
|
+
data.tar.gz: 85059077d19e7f765d23dc19dea8dc54cbbb4716bb86cc07c1054ac975ef306c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 939db52ab4d06f963ffa2de187f5e813a73fd7fd6238bf8124806937fb7d62e45dacf998d5716cc03e51bde39f996afd4f6639f924687208211caa8d048a8366
|
7
|
+
data.tar.gz: 0b800c3c88f5df5dac578b1f72fd75ae12e715da8facf4f7beaaa735cb089a9a6a13c0dbd375b8076fae0316c3e6a5f9f070fa4f9a29953babd602ba3c1c3b81
|
data/README.md
CHANGED
@@ -1,8 +1,7 @@
|
|
1
1
|
# Ruby Client for Cloud Tasks API ([Alpha](https://github.com/GoogleCloudPlatform/google-cloud-ruby#versioning))
|
2
2
|
|
3
3
|
[Cloud Tasks API][Product Documentation]:
|
4
|
-
Manages the execution of large numbers of distributed requests.
|
5
|
-
is in Alpha.
|
4
|
+
Manages the execution of large numbers of distributed requests.
|
6
5
|
- [Client Library Documentation][]
|
7
6
|
- [Product Documentation][]
|
8
7
|
|
@@ -12,7 +11,7 @@ steps:
|
|
12
11
|
|
13
12
|
1. [Select or create a Cloud Platform project.](https://console.cloud.google.com/project)
|
14
13
|
2. [Enable billing for your project.](https://cloud.google.com/billing/docs/how-to/modify-project#enable_billing_for_a_project)
|
15
|
-
3. [Enable the Cloud Tasks API.](https://console.cloud.google.com/apis/api/
|
14
|
+
3. [Enable the Cloud Tasks API.](https://console.cloud.google.com/apis/api/tasks)
|
16
15
|
4. [Setup Authentication.](https://googlecloudplatform.github.io/google-cloud-ruby/#/docs/google-cloud/master/guides/authentication)
|
17
16
|
|
18
17
|
### Installation
|
@@ -29,4 +28,41 @@ $ gem install google-cloud-tasks
|
|
29
28
|
to see the full list of Cloud APIs that we cover.
|
30
29
|
|
31
30
|
[Client Library Documentation]: https://googlecloudplatform.github.io/google-cloud-ruby/#/docs/google-cloud-tasks/latest/google/cloud/tasks/v2beta2
|
32
|
-
[Product Documentation]: https://cloud.google.com/
|
31
|
+
[Product Documentation]: https://cloud.google.com/tasks
|
32
|
+
|
33
|
+
## Enabling Logging
|
34
|
+
|
35
|
+
To enable logging for this library, set the logger for the underlying [gRPC](https://github.com/grpc/grpc/tree/master/src/ruby) library.
|
36
|
+
The logger that you set may be a Ruby stdlib [`Logger`](https://ruby-doc.org/stdlib-2.5.0/libdoc/logger/rdoc/Logger.html) as shown below,
|
37
|
+
or a [`Google::Cloud::Logging::Logger`](https://googlecloudplatform.github.io/google-cloud-ruby/#/docs/google-cloud-logging/latest/google/cloud/logging/logger)
|
38
|
+
that will write logs to [Stackdriver Logging](https://cloud.google.com/logging/). See [grpc/logconfig.rb](https://github.com/grpc/grpc/blob/master/src/ruby/lib/grpc/logconfig.rb)
|
39
|
+
and the gRPC [spec_helper.rb](https://github.com/grpc/grpc/blob/master/src/ruby/spec/spec_helper.rb) for additional information.
|
40
|
+
|
41
|
+
Configuring a Ruby stdlib logger:
|
42
|
+
|
43
|
+
```ruby
|
44
|
+
require "logger"
|
45
|
+
|
46
|
+
module MyLogger
|
47
|
+
LOGGER = Logger.new $stderr, level: Logger::WARN
|
48
|
+
def logger
|
49
|
+
LOGGER
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
# Define a gRPC module-level logger method before grpc/logconfig.rb loads.
|
54
|
+
module GRPC
|
55
|
+
extend MyLogger
|
56
|
+
end
|
57
|
+
```
|
58
|
+
|
59
|
+
## Supported Ruby Versions
|
60
|
+
|
61
|
+
This library is supported on Ruby 2.3+.
|
62
|
+
|
63
|
+
Google provides official support for Ruby versions that are actively supported
|
64
|
+
by Ruby Core—that is, Ruby versions that are either in normal maintenance or
|
65
|
+
in security maintenance, and not end of life. Currently, this means Ruby 2.3
|
66
|
+
and later. Older versions of Ruby _may_ still work, but are unsupported and not
|
67
|
+
recommended. See https://www.ruby-lang.org/en/downloads/branches/ for details
|
68
|
+
about the Ruby support schedule.
|
@@ -22,8 +22,7 @@ module Google
|
|
22
22
|
# # Ruby Client for Cloud Tasks API ([Alpha](https://github.com/GoogleCloudPlatform/google-cloud-ruby#versioning))
|
23
23
|
#
|
24
24
|
# [Cloud Tasks API][Product Documentation]:
|
25
|
-
# Manages the execution of large numbers of distributed requests.
|
26
|
-
# is in Alpha.
|
25
|
+
# Manages the execution of large numbers of distributed requests.
|
27
26
|
# - [Product Documentation][]
|
28
27
|
#
|
29
28
|
# ## Quick Start
|
@@ -32,7 +31,7 @@ module Google
|
|
32
31
|
#
|
33
32
|
# 1. [Select or create a Cloud Platform project.](https://console.cloud.google.com/project)
|
34
33
|
# 2. [Enable billing for your project.](https://cloud.google.com/billing/docs/how-to/modify-project#enable_billing_for_a_project)
|
35
|
-
# 3. [Enable the Cloud Tasks API.](https://console.cloud.google.com/apis/api/
|
34
|
+
# 3. [Enable the Cloud Tasks API.](https://console.cloud.google.com/apis/api/tasks)
|
36
35
|
# 4. [Setup Authentication.](https://googlecloudplatform.github.io/google-cloud-ruby/#/docs/google-cloud/master/guides/authentication)
|
37
36
|
#
|
38
37
|
# ### Next Steps
|
@@ -41,8 +40,33 @@ module Google
|
|
41
40
|
# - View this [repository's main README](https://github.com/GoogleCloudPlatform/google-cloud-ruby/blob/master/README.md)
|
42
41
|
# to see the full list of Cloud APIs that we cover.
|
43
42
|
#
|
44
|
-
# [Product Documentation]: https://cloud.google.com/
|
43
|
+
# [Product Documentation]: https://cloud.google.com/tasks
|
45
44
|
#
|
45
|
+
# ## Enabling Logging
|
46
|
+
#
|
47
|
+
# To enable logging for this library, set the logger for the underlying [gRPC](https://github.com/grpc/grpc/tree/master/src/ruby) library.
|
48
|
+
# The logger that you set may be a Ruby stdlib [`Logger`](https://ruby-doc.org/stdlib-2.5.0/libdoc/logger/rdoc/Logger.html) as shown below,
|
49
|
+
# or a [`Google::Cloud::Logging::Logger`](https://googlecloudplatform.github.io/google-cloud-ruby/#/docs/google-cloud-logging/latest/google/cloud/logging/logger)
|
50
|
+
# that will write logs to [Stackdriver Logging](https://cloud.google.com/logging/). See [grpc/logconfig.rb](https://github.com/grpc/grpc/blob/master/src/ruby/lib/grpc/logconfig.rb)
|
51
|
+
# and the gRPC [spec_helper.rb](https://github.com/grpc/grpc/blob/master/src/ruby/spec/spec_helper.rb) for additional information.
|
52
|
+
#
|
53
|
+
# Configuring a Ruby stdlib logger:
|
54
|
+
#
|
55
|
+
# ```ruby
|
56
|
+
# require "logger"
|
57
|
+
#
|
58
|
+
# module MyLogger
|
59
|
+
# LOGGER = Logger.new $stderr, level: Logger::WARN
|
60
|
+
# def logger
|
61
|
+
# LOGGER
|
62
|
+
# end
|
63
|
+
# end
|
64
|
+
#
|
65
|
+
# # Define a gRPC module-level logger method before grpc/logconfig.rb loads.
|
66
|
+
# module GRPC
|
67
|
+
# extend MyLogger
|
68
|
+
# end
|
69
|
+
# ```
|
46
70
|
#
|
47
71
|
module Tasks
|
48
72
|
module V2beta2
|
@@ -76,11 +100,18 @@ module Google
|
|
76
100
|
# or the specified config is missing data points.
|
77
101
|
# @param timeout [Numeric]
|
78
102
|
# The default timeout, in seconds, for calls made through this client.
|
103
|
+
# @param metadata [Hash]
|
104
|
+
# Default metadata to be sent with each request. This can be overridden on a per call basis.
|
105
|
+
# @param exception_transformer [Proc]
|
106
|
+
# An optional proc that intercepts any exceptions raised during an API call to inject
|
107
|
+
# custom error handling.
|
79
108
|
def self.new \
|
80
109
|
credentials: nil,
|
81
110
|
scopes: nil,
|
82
111
|
client_config: nil,
|
83
112
|
timeout: nil,
|
113
|
+
metadata: nil,
|
114
|
+
exception_transformer: nil,
|
84
115
|
lib_name: nil,
|
85
116
|
lib_version: nil
|
86
117
|
kwargs = {
|
@@ -88,6 +119,8 @@ module Google
|
|
88
119
|
scopes: scopes,
|
89
120
|
client_config: client_config,
|
90
121
|
timeout: timeout,
|
122
|
+
metadata: metadata,
|
123
|
+
exception_transformer: exception_transformer,
|
91
124
|
lib_name: lib_name,
|
92
125
|
lib_version: lib_version
|
93
126
|
}.select { |_, v| v != nil }
|
@@ -25,7 +25,7 @@ require "pathname"
|
|
25
25
|
require "google/gax"
|
26
26
|
|
27
27
|
require "google/cloud/tasks/v2beta2/cloudtasks_pb"
|
28
|
-
require "google/cloud/tasks/credentials"
|
28
|
+
require "google/cloud/tasks/v2beta2/credentials"
|
29
29
|
|
30
30
|
module Google
|
31
31
|
module Cloud
|
@@ -45,6 +45,9 @@ module Google
|
|
45
45
|
# The default port of the service.
|
46
46
|
DEFAULT_SERVICE_PORT = 443
|
47
47
|
|
48
|
+
# The default set of gRPC interceptors.
|
49
|
+
GRPC_INTERCEPTORS = []
|
50
|
+
|
48
51
|
DEFAULT_TIMEOUT = 30
|
49
52
|
|
50
53
|
PAGE_DESCRIPTORS = {
|
@@ -67,6 +70,12 @@ module Google
|
|
67
70
|
].freeze
|
68
71
|
|
69
72
|
|
73
|
+
PROJECT_PATH_TEMPLATE = Google::Gax::PathTemplate.new(
|
74
|
+
"projects/{project}"
|
75
|
+
)
|
76
|
+
|
77
|
+
private_constant :PROJECT_PATH_TEMPLATE
|
78
|
+
|
70
79
|
LOCATION_PATH_TEMPLATE = Google::Gax::PathTemplate.new(
|
71
80
|
"projects/{project}/locations/{location}"
|
72
81
|
)
|
@@ -85,6 +94,15 @@ module Google
|
|
85
94
|
|
86
95
|
private_constant :TASK_PATH_TEMPLATE
|
87
96
|
|
97
|
+
# Returns a fully-qualified project resource name string.
|
98
|
+
# @param project [String]
|
99
|
+
# @return [String]
|
100
|
+
def self.project_path project
|
101
|
+
PROJECT_PATH_TEMPLATE.render(
|
102
|
+
:"project" => project
|
103
|
+
)
|
104
|
+
end
|
105
|
+
|
88
106
|
# Returns a fully-qualified location resource name string.
|
89
107
|
# @param project [String]
|
90
108
|
# @param location [String]
|
@@ -148,11 +166,18 @@ module Google
|
|
148
166
|
# or the specified config is missing data points.
|
149
167
|
# @param timeout [Numeric]
|
150
168
|
# The default timeout, in seconds, for calls made through this client.
|
169
|
+
# @param metadata [Hash]
|
170
|
+
# Default metadata to be sent with each request. This can be overridden on a per call basis.
|
171
|
+
# @param exception_transformer [Proc]
|
172
|
+
# An optional proc that intercepts any exceptions raised during an API call to inject
|
173
|
+
# custom error handling.
|
151
174
|
def initialize \
|
152
175
|
credentials: nil,
|
153
176
|
scopes: ALL_SCOPES,
|
154
177
|
client_config: {},
|
155
178
|
timeout: DEFAULT_TIMEOUT,
|
179
|
+
metadata: nil,
|
180
|
+
exception_transformer: nil,
|
156
181
|
lib_name: nil,
|
157
182
|
lib_version: ""
|
158
183
|
# These require statements are intentionally placed here to initialize
|
@@ -161,10 +186,10 @@ module Google
|
|
161
186
|
require "google/gax/grpc"
|
162
187
|
require "google/cloud/tasks/v2beta2/cloudtasks_services_pb"
|
163
188
|
|
164
|
-
credentials ||= Google::Cloud::Tasks::Credentials.default
|
189
|
+
credentials ||= Google::Cloud::Tasks::V2beta2::Credentials.default
|
165
190
|
|
166
191
|
if credentials.is_a?(String) || credentials.is_a?(Hash)
|
167
|
-
updater_proc = Google::Cloud::Tasks::Credentials.new(credentials).updater_proc
|
192
|
+
updater_proc = Google::Cloud::Tasks::V2beta2::Credentials.new(credentials).updater_proc
|
168
193
|
end
|
169
194
|
if credentials.is_a?(GRPC::Core::Channel)
|
170
195
|
channel = credentials
|
@@ -188,6 +213,7 @@ module Google
|
|
188
213
|
google_api_client.freeze
|
189
214
|
|
190
215
|
headers = { :"x-goog-api-client" => google_api_client }
|
216
|
+
headers.merge!(metadata) unless metadata.nil?
|
191
217
|
client_config_file = Pathname.new(__dir__).join(
|
192
218
|
"cloud_tasks_client_config.json"
|
193
219
|
)
|
@@ -200,13 +226,14 @@ module Google
|
|
200
226
|
timeout,
|
201
227
|
page_descriptors: PAGE_DESCRIPTORS,
|
202
228
|
errors: Google::Gax::Grpc::API_ERRORS,
|
203
|
-
|
229
|
+
metadata: headers
|
204
230
|
)
|
205
231
|
end
|
206
232
|
|
207
233
|
# Allow overriding the service path/port in subclasses.
|
208
234
|
service_path = self.class::SERVICE_ADDRESS
|
209
235
|
port = self.class::DEFAULT_SERVICE_PORT
|
236
|
+
interceptors = self.class::GRPC_INTERCEPTORS
|
210
237
|
@cloud_tasks_stub = Google::Gax::Grpc.create_stub(
|
211
238
|
service_path,
|
212
239
|
port,
|
@@ -214,88 +241,169 @@ module Google
|
|
214
241
|
channel: channel,
|
215
242
|
updater_proc: updater_proc,
|
216
243
|
scopes: scopes,
|
244
|
+
interceptors: interceptors,
|
217
245
|
&Google::Cloud::Tasks::V2beta2::CloudTasks::Stub.method(:new)
|
218
246
|
)
|
219
247
|
|
220
248
|
@list_queues = Google::Gax.create_api_call(
|
221
249
|
@cloud_tasks_stub.method(:list_queues),
|
222
|
-
defaults["list_queues"]
|
250
|
+
defaults["list_queues"],
|
251
|
+
exception_transformer: exception_transformer,
|
252
|
+
params_extractor: proc do |request|
|
253
|
+
{'parent' => request.parent}
|
254
|
+
end
|
223
255
|
)
|
224
256
|
@get_queue = Google::Gax.create_api_call(
|
225
257
|
@cloud_tasks_stub.method(:get_queue),
|
226
|
-
defaults["get_queue"]
|
258
|
+
defaults["get_queue"],
|
259
|
+
exception_transformer: exception_transformer,
|
260
|
+
params_extractor: proc do |request|
|
261
|
+
{'name' => request.name}
|
262
|
+
end
|
227
263
|
)
|
228
264
|
@create_queue = Google::Gax.create_api_call(
|
229
265
|
@cloud_tasks_stub.method(:create_queue),
|
230
|
-
defaults["create_queue"]
|
266
|
+
defaults["create_queue"],
|
267
|
+
exception_transformer: exception_transformer,
|
268
|
+
params_extractor: proc do |request|
|
269
|
+
{'parent' => request.parent}
|
270
|
+
end
|
231
271
|
)
|
232
272
|
@update_queue = Google::Gax.create_api_call(
|
233
273
|
@cloud_tasks_stub.method(:update_queue),
|
234
|
-
defaults["update_queue"]
|
274
|
+
defaults["update_queue"],
|
275
|
+
exception_transformer: exception_transformer,
|
276
|
+
params_extractor: proc do |request|
|
277
|
+
{'queue.name' => request.queue.name}
|
278
|
+
end
|
235
279
|
)
|
236
280
|
@delete_queue = Google::Gax.create_api_call(
|
237
281
|
@cloud_tasks_stub.method(:delete_queue),
|
238
|
-
defaults["delete_queue"]
|
282
|
+
defaults["delete_queue"],
|
283
|
+
exception_transformer: exception_transformer,
|
284
|
+
params_extractor: proc do |request|
|
285
|
+
{'name' => request.name}
|
286
|
+
end
|
239
287
|
)
|
240
288
|
@purge_queue = Google::Gax.create_api_call(
|
241
289
|
@cloud_tasks_stub.method(:purge_queue),
|
242
|
-
defaults["purge_queue"]
|
290
|
+
defaults["purge_queue"],
|
291
|
+
exception_transformer: exception_transformer,
|
292
|
+
params_extractor: proc do |request|
|
293
|
+
{'name' => request.name}
|
294
|
+
end
|
243
295
|
)
|
244
296
|
@pause_queue = Google::Gax.create_api_call(
|
245
297
|
@cloud_tasks_stub.method(:pause_queue),
|
246
|
-
defaults["pause_queue"]
|
298
|
+
defaults["pause_queue"],
|
299
|
+
exception_transformer: exception_transformer,
|
300
|
+
params_extractor: proc do |request|
|
301
|
+
{'name' => request.name}
|
302
|
+
end
|
247
303
|
)
|
248
304
|
@resume_queue = Google::Gax.create_api_call(
|
249
305
|
@cloud_tasks_stub.method(:resume_queue),
|
250
|
-
defaults["resume_queue"]
|
306
|
+
defaults["resume_queue"],
|
307
|
+
exception_transformer: exception_transformer,
|
308
|
+
params_extractor: proc do |request|
|
309
|
+
{'name' => request.name}
|
310
|
+
end
|
251
311
|
)
|
252
312
|
@get_iam_policy = Google::Gax.create_api_call(
|
253
313
|
@cloud_tasks_stub.method(:get_iam_policy),
|
254
|
-
defaults["get_iam_policy"]
|
314
|
+
defaults["get_iam_policy"],
|
315
|
+
exception_transformer: exception_transformer,
|
316
|
+
params_extractor: proc do |request|
|
317
|
+
{'resource' => request.resource}
|
318
|
+
end
|
255
319
|
)
|
256
320
|
@set_iam_policy = Google::Gax.create_api_call(
|
257
321
|
@cloud_tasks_stub.method(:set_iam_policy),
|
258
|
-
defaults["set_iam_policy"]
|
322
|
+
defaults["set_iam_policy"],
|
323
|
+
exception_transformer: exception_transformer,
|
324
|
+
params_extractor: proc do |request|
|
325
|
+
{'resource' => request.resource}
|
326
|
+
end
|
259
327
|
)
|
260
328
|
@test_iam_permissions = Google::Gax.create_api_call(
|
261
329
|
@cloud_tasks_stub.method(:test_iam_permissions),
|
262
|
-
defaults["test_iam_permissions"]
|
330
|
+
defaults["test_iam_permissions"],
|
331
|
+
exception_transformer: exception_transformer,
|
332
|
+
params_extractor: proc do |request|
|
333
|
+
{'resource' => request.resource}
|
334
|
+
end
|
263
335
|
)
|
264
336
|
@list_tasks = Google::Gax.create_api_call(
|
265
337
|
@cloud_tasks_stub.method(:list_tasks),
|
266
|
-
defaults["list_tasks"]
|
338
|
+
defaults["list_tasks"],
|
339
|
+
exception_transformer: exception_transformer,
|
340
|
+
params_extractor: proc do |request|
|
341
|
+
{'parent' => request.parent}
|
342
|
+
end
|
267
343
|
)
|
268
344
|
@get_task = Google::Gax.create_api_call(
|
269
345
|
@cloud_tasks_stub.method(:get_task),
|
270
|
-
defaults["get_task"]
|
346
|
+
defaults["get_task"],
|
347
|
+
exception_transformer: exception_transformer,
|
348
|
+
params_extractor: proc do |request|
|
349
|
+
{'name' => request.name}
|
350
|
+
end
|
271
351
|
)
|
272
352
|
@create_task = Google::Gax.create_api_call(
|
273
353
|
@cloud_tasks_stub.method(:create_task),
|
274
|
-
defaults["create_task"]
|
354
|
+
defaults["create_task"],
|
355
|
+
exception_transformer: exception_transformer,
|
356
|
+
params_extractor: proc do |request|
|
357
|
+
{'parent' => request.parent}
|
358
|
+
end
|
275
359
|
)
|
276
360
|
@delete_task = Google::Gax.create_api_call(
|
277
361
|
@cloud_tasks_stub.method(:delete_task),
|
278
|
-
defaults["delete_task"]
|
362
|
+
defaults["delete_task"],
|
363
|
+
exception_transformer: exception_transformer,
|
364
|
+
params_extractor: proc do |request|
|
365
|
+
{'name' => request.name}
|
366
|
+
end
|
279
367
|
)
|
280
368
|
@lease_tasks = Google::Gax.create_api_call(
|
281
369
|
@cloud_tasks_stub.method(:lease_tasks),
|
282
|
-
defaults["lease_tasks"]
|
370
|
+
defaults["lease_tasks"],
|
371
|
+
exception_transformer: exception_transformer,
|
372
|
+
params_extractor: proc do |request|
|
373
|
+
{'parent' => request.parent}
|
374
|
+
end
|
283
375
|
)
|
284
376
|
@acknowledge_task = Google::Gax.create_api_call(
|
285
377
|
@cloud_tasks_stub.method(:acknowledge_task),
|
286
|
-
defaults["acknowledge_task"]
|
378
|
+
defaults["acknowledge_task"],
|
379
|
+
exception_transformer: exception_transformer,
|
380
|
+
params_extractor: proc do |request|
|
381
|
+
{'name' => request.name}
|
382
|
+
end
|
287
383
|
)
|
288
384
|
@renew_lease = Google::Gax.create_api_call(
|
289
385
|
@cloud_tasks_stub.method(:renew_lease),
|
290
|
-
defaults["renew_lease"]
|
386
|
+
defaults["renew_lease"],
|
387
|
+
exception_transformer: exception_transformer,
|
388
|
+
params_extractor: proc do |request|
|
389
|
+
{'name' => request.name}
|
390
|
+
end
|
291
391
|
)
|
292
392
|
@cancel_lease = Google::Gax.create_api_call(
|
293
393
|
@cloud_tasks_stub.method(:cancel_lease),
|
294
|
-
defaults["cancel_lease"]
|
394
|
+
defaults["cancel_lease"],
|
395
|
+
exception_transformer: exception_transformer,
|
396
|
+
params_extractor: proc do |request|
|
397
|
+
{'name' => request.name}
|
398
|
+
end
|
295
399
|
)
|
296
400
|
@run_task = Google::Gax.create_api_call(
|
297
401
|
@cloud_tasks_stub.method(:run_task),
|
298
|
-
defaults["run_task"]
|
402
|
+
defaults["run_task"],
|
403
|
+
exception_transformer: exception_transformer,
|
404
|
+
params_extractor: proc do |request|
|
405
|
+
{'name' => request.name}
|
406
|
+
end
|
299
407
|
)
|
300
408
|
end
|
301
409
|
|
@@ -330,6 +438,9 @@ module Google
|
|
330
438
|
# @param options [Google::Gax::CallOptions]
|
331
439
|
# Overrides the default settings for this call, e.g, timeout,
|
332
440
|
# retries, etc.
|
441
|
+
# @yield [result, operation] Access the result along with the RPC operation
|
442
|
+
# @yieldparam result [Google::Gax::PagedEnumerable<Google::Cloud::Tasks::V2beta2::Queue>]
|
443
|
+
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
333
444
|
# @return [Google::Gax::PagedEnumerable<Google::Cloud::Tasks::V2beta2::Queue>]
|
334
445
|
# An enumerable of Google::Cloud::Tasks::V2beta2::Queue instances.
|
335
446
|
# See Google::Gax::PagedEnumerable documentation for other
|
@@ -359,14 +470,15 @@ module Google
|
|
359
470
|
parent,
|
360
471
|
filter: nil,
|
361
472
|
page_size: nil,
|
362
|
-
options: nil
|
473
|
+
options: nil,
|
474
|
+
&block
|
363
475
|
req = {
|
364
476
|
parent: parent,
|
365
477
|
filter: filter,
|
366
478
|
page_size: page_size
|
367
479
|
}.delete_if { |_, v| v.nil? }
|
368
480
|
req = Google::Gax::to_proto(req, Google::Cloud::Tasks::V2beta2::ListQueuesRequest)
|
369
|
-
@list_queues.call(req, options)
|
481
|
+
@list_queues.call(req, options, &block)
|
370
482
|
end
|
371
483
|
|
372
484
|
# Gets a queue.
|
@@ -379,6 +491,9 @@ module Google
|
|
379
491
|
# @param options [Google::Gax::CallOptions]
|
380
492
|
# Overrides the default settings for this call, e.g, timeout,
|
381
493
|
# retries, etc.
|
494
|
+
# @yield [result, operation] Access the result along with the RPC operation
|
495
|
+
# @yieldparam result [Google::Cloud::Tasks::V2beta2::Queue]
|
496
|
+
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
382
497
|
# @return [Google::Cloud::Tasks::V2beta2::Queue]
|
383
498
|
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
384
499
|
# @example
|
@@ -390,12 +505,13 @@ module Google
|
|
390
505
|
|
391
506
|
def get_queue \
|
392
507
|
name,
|
393
|
-
options: nil
|
508
|
+
options: nil,
|
509
|
+
&block
|
394
510
|
req = {
|
395
511
|
name: name
|
396
512
|
}.delete_if { |_, v| v.nil? }
|
397
513
|
req = Google::Gax::to_proto(req, Google::Cloud::Tasks::V2beta2::GetQueueRequest)
|
398
|
-
@get_queue.call(req, options)
|
514
|
+
@get_queue.call(req, options, &block)
|
399
515
|
end
|
400
516
|
|
401
517
|
# Creates a queue.
|
@@ -430,6 +546,9 @@ module Google
|
|
430
546
|
# @param options [Google::Gax::CallOptions]
|
431
547
|
# Overrides the default settings for this call, e.g, timeout,
|
432
548
|
# retries, etc.
|
549
|
+
# @yield [result, operation] Access the result along with the RPC operation
|
550
|
+
# @yieldparam result [Google::Cloud::Tasks::V2beta2::Queue]
|
551
|
+
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
433
552
|
# @return [Google::Cloud::Tasks::V2beta2::Queue]
|
434
553
|
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
435
554
|
# @example
|
@@ -445,13 +564,14 @@ module Google
|
|
445
564
|
def create_queue \
|
446
565
|
parent,
|
447
566
|
queue,
|
448
|
-
options: nil
|
567
|
+
options: nil,
|
568
|
+
&block
|
449
569
|
req = {
|
450
570
|
parent: parent,
|
451
571
|
queue: queue
|
452
572
|
}.delete_if { |_, v| v.nil? }
|
453
573
|
req = Google::Gax::to_proto(req, Google::Cloud::Tasks::V2beta2::CreateQueueRequest)
|
454
|
-
@create_queue.call(req, options)
|
574
|
+
@create_queue.call(req, options, &block)
|
455
575
|
end
|
456
576
|
|
457
577
|
# Updates a queue.
|
@@ -490,6 +610,9 @@ module Google
|
|
490
610
|
# @param options [Google::Gax::CallOptions]
|
491
611
|
# Overrides the default settings for this call, e.g, timeout,
|
492
612
|
# retries, etc.
|
613
|
+
# @yield [result, operation] Access the result along with the RPC operation
|
614
|
+
# @yieldparam result [Google::Cloud::Tasks::V2beta2::Queue]
|
615
|
+
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
493
616
|
# @return [Google::Cloud::Tasks::V2beta2::Queue]
|
494
617
|
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
495
618
|
# @example
|
@@ -504,13 +627,14 @@ module Google
|
|
504
627
|
def update_queue \
|
505
628
|
queue,
|
506
629
|
update_mask: nil,
|
507
|
-
options: nil
|
630
|
+
options: nil,
|
631
|
+
&block
|
508
632
|
req = {
|
509
633
|
queue: queue,
|
510
634
|
update_mask: update_mask
|
511
635
|
}.delete_if { |_, v| v.nil? }
|
512
636
|
req = Google::Gax::to_proto(req, Google::Cloud::Tasks::V2beta2::UpdateQueueRequest)
|
513
|
-
@update_queue.call(req, options)
|
637
|
+
@update_queue.call(req, options, &block)
|
514
638
|
end
|
515
639
|
|
516
640
|
# Deletes a queue.
|
@@ -534,6 +658,9 @@ module Google
|
|
534
658
|
# @param options [Google::Gax::CallOptions]
|
535
659
|
# Overrides the default settings for this call, e.g, timeout,
|
536
660
|
# retries, etc.
|
661
|
+
# @yield [result, operation] Access the result along with the RPC operation
|
662
|
+
# @yieldparam result []
|
663
|
+
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
537
664
|
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
538
665
|
# @example
|
539
666
|
# require "google/cloud/tasks/v2beta2"
|
@@ -544,12 +671,13 @@ module Google
|
|
544
671
|
|
545
672
|
def delete_queue \
|
546
673
|
name,
|
547
|
-
options: nil
|
674
|
+
options: nil,
|
675
|
+
&block
|
548
676
|
req = {
|
549
677
|
name: name
|
550
678
|
}.delete_if { |_, v| v.nil? }
|
551
679
|
req = Google::Gax::to_proto(req, Google::Cloud::Tasks::V2beta2::DeleteQueueRequest)
|
552
|
-
@delete_queue.call(req, options)
|
680
|
+
@delete_queue.call(req, options, &block)
|
553
681
|
nil
|
554
682
|
end
|
555
683
|
|
@@ -568,6 +696,9 @@ module Google
|
|
568
696
|
# @param options [Google::Gax::CallOptions]
|
569
697
|
# Overrides the default settings for this call, e.g, timeout,
|
570
698
|
# retries, etc.
|
699
|
+
# @yield [result, operation] Access the result along with the RPC operation
|
700
|
+
# @yieldparam result [Google::Cloud::Tasks::V2beta2::Queue]
|
701
|
+
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
571
702
|
# @return [Google::Cloud::Tasks::V2beta2::Queue]
|
572
703
|
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
573
704
|
# @example
|
@@ -579,12 +710,13 @@ module Google
|
|
579
710
|
|
580
711
|
def purge_queue \
|
581
712
|
name,
|
582
|
-
options: nil
|
713
|
+
options: nil,
|
714
|
+
&block
|
583
715
|
req = {
|
584
716
|
name: name
|
585
717
|
}.delete_if { |_, v| v.nil? }
|
586
718
|
req = Google::Gax::to_proto(req, Google::Cloud::Tasks::V2beta2::PurgeQueueRequest)
|
587
|
-
@purge_queue.call(req, options)
|
719
|
+
@purge_queue.call(req, options, &block)
|
588
720
|
end
|
589
721
|
|
590
722
|
# Pauses the queue.
|
@@ -603,6 +735,9 @@ module Google
|
|
603
735
|
# @param options [Google::Gax::CallOptions]
|
604
736
|
# Overrides the default settings for this call, e.g, timeout,
|
605
737
|
# retries, etc.
|
738
|
+
# @yield [result, operation] Access the result along with the RPC operation
|
739
|
+
# @yieldparam result [Google::Cloud::Tasks::V2beta2::Queue]
|
740
|
+
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
606
741
|
# @return [Google::Cloud::Tasks::V2beta2::Queue]
|
607
742
|
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
608
743
|
# @example
|
@@ -614,12 +749,13 @@ module Google
|
|
614
749
|
|
615
750
|
def pause_queue \
|
616
751
|
name,
|
617
|
-
options: nil
|
752
|
+
options: nil,
|
753
|
+
&block
|
618
754
|
req = {
|
619
755
|
name: name
|
620
756
|
}.delete_if { |_, v| v.nil? }
|
621
757
|
req = Google::Gax::to_proto(req, Google::Cloud::Tasks::V2beta2::PauseQueueRequest)
|
622
|
-
@pause_queue.call(req, options)
|
758
|
+
@pause_queue.call(req, options, &block)
|
623
759
|
end
|
624
760
|
|
625
761
|
# Resume a queue.
|
@@ -643,6 +779,9 @@ module Google
|
|
643
779
|
# @param options [Google::Gax::CallOptions]
|
644
780
|
# Overrides the default settings for this call, e.g, timeout,
|
645
781
|
# retries, etc.
|
782
|
+
# @yield [result, operation] Access the result along with the RPC operation
|
783
|
+
# @yieldparam result [Google::Cloud::Tasks::V2beta2::Queue]
|
784
|
+
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
646
785
|
# @return [Google::Cloud::Tasks::V2beta2::Queue]
|
647
786
|
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
648
787
|
# @example
|
@@ -654,12 +793,13 @@ module Google
|
|
654
793
|
|
655
794
|
def resume_queue \
|
656
795
|
name,
|
657
|
-
options: nil
|
796
|
+
options: nil,
|
797
|
+
&block
|
658
798
|
req = {
|
659
799
|
name: name
|
660
800
|
}.delete_if { |_, v| v.nil? }
|
661
801
|
req = Google::Gax::to_proto(req, Google::Cloud::Tasks::V2beta2::ResumeQueueRequest)
|
662
|
-
@resume_queue.call(req, options)
|
802
|
+
@resume_queue.call(req, options, &block)
|
663
803
|
end
|
664
804
|
|
665
805
|
# Gets the access control policy for a {Google::Cloud::Tasks::V2beta2::Queue Queue}.
|
@@ -678,6 +818,9 @@ module Google
|
|
678
818
|
# @param options [Google::Gax::CallOptions]
|
679
819
|
# Overrides the default settings for this call, e.g, timeout,
|
680
820
|
# retries, etc.
|
821
|
+
# @yield [result, operation] Access the result along with the RPC operation
|
822
|
+
# @yieldparam result [Google::Iam::V1::Policy]
|
823
|
+
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
681
824
|
# @return [Google::Iam::V1::Policy]
|
682
825
|
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
683
826
|
# @example
|
@@ -689,12 +832,13 @@ module Google
|
|
689
832
|
|
690
833
|
def get_iam_policy \
|
691
834
|
resource,
|
692
|
-
options: nil
|
835
|
+
options: nil,
|
836
|
+
&block
|
693
837
|
req = {
|
694
838
|
resource: resource
|
695
839
|
}.delete_if { |_, v| v.nil? }
|
696
840
|
req = Google::Gax::to_proto(req, Google::Iam::V1::GetIamPolicyRequest)
|
697
|
-
@get_iam_policy.call(req, options)
|
841
|
+
@get_iam_policy.call(req, options, &block)
|
698
842
|
end
|
699
843
|
|
700
844
|
# Sets the access control policy for a {Google::Cloud::Tasks::V2beta2::Queue Queue}. Replaces any existing
|
@@ -722,6 +866,9 @@ module Google
|
|
722
866
|
# @param options [Google::Gax::CallOptions]
|
723
867
|
# Overrides the default settings for this call, e.g, timeout,
|
724
868
|
# retries, etc.
|
869
|
+
# @yield [result, operation] Access the result along with the RPC operation
|
870
|
+
# @yieldparam result [Google::Iam::V1::Policy]
|
871
|
+
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
725
872
|
# @return [Google::Iam::V1::Policy]
|
726
873
|
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
727
874
|
# @example
|
@@ -737,13 +884,14 @@ module Google
|
|
737
884
|
def set_iam_policy \
|
738
885
|
resource,
|
739
886
|
policy,
|
740
|
-
options: nil
|
887
|
+
options: nil,
|
888
|
+
&block
|
741
889
|
req = {
|
742
890
|
resource: resource,
|
743
891
|
policy: policy
|
744
892
|
}.delete_if { |_, v| v.nil? }
|
745
893
|
req = Google::Gax::to_proto(req, Google::Iam::V1::SetIamPolicyRequest)
|
746
|
-
@set_iam_policy.call(req, options)
|
894
|
+
@set_iam_policy.call(req, options, &block)
|
747
895
|
end
|
748
896
|
|
749
897
|
# Returns permissions that a caller has on a {Google::Cloud::Tasks::V2beta2::Queue Queue}.
|
@@ -766,6 +914,9 @@ module Google
|
|
766
914
|
# @param options [Google::Gax::CallOptions]
|
767
915
|
# Overrides the default settings for this call, e.g, timeout,
|
768
916
|
# retries, etc.
|
917
|
+
# @yield [result, operation] Access the result along with the RPC operation
|
918
|
+
# @yieldparam result [Google::Iam::V1::TestIamPermissionsResponse]
|
919
|
+
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
769
920
|
# @return [Google::Iam::V1::TestIamPermissionsResponse]
|
770
921
|
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
771
922
|
# @example
|
@@ -781,13 +932,14 @@ module Google
|
|
781
932
|
def test_iam_permissions \
|
782
933
|
resource,
|
783
934
|
permissions,
|
784
|
-
options: nil
|
935
|
+
options: nil,
|
936
|
+
&block
|
785
937
|
req = {
|
786
938
|
resource: resource,
|
787
939
|
permissions: permissions
|
788
940
|
}.delete_if { |_, v| v.nil? }
|
789
941
|
req = Google::Gax::to_proto(req, Google::Iam::V1::TestIamPermissionsRequest)
|
790
|
-
@test_iam_permissions.call(req, options)
|
942
|
+
@test_iam_permissions.call(req, options, &block)
|
791
943
|
end
|
792
944
|
|
793
945
|
# Lists the tasks in a queue.
|
@@ -829,6 +981,9 @@ module Google
|
|
829
981
|
# @param options [Google::Gax::CallOptions]
|
830
982
|
# Overrides the default settings for this call, e.g, timeout,
|
831
983
|
# retries, etc.
|
984
|
+
# @yield [result, operation] Access the result along with the RPC operation
|
985
|
+
# @yieldparam result [Google::Gax::PagedEnumerable<Google::Cloud::Tasks::V2beta2::Task>]
|
986
|
+
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
832
987
|
# @return [Google::Gax::PagedEnumerable<Google::Cloud::Tasks::V2beta2::Task>]
|
833
988
|
# An enumerable of Google::Cloud::Tasks::V2beta2::Task instances.
|
834
989
|
# See Google::Gax::PagedEnumerable documentation for other
|
@@ -859,7 +1014,8 @@ module Google
|
|
859
1014
|
response_view: nil,
|
860
1015
|
order_by: nil,
|
861
1016
|
page_size: nil,
|
862
|
-
options: nil
|
1017
|
+
options: nil,
|
1018
|
+
&block
|
863
1019
|
req = {
|
864
1020
|
parent: parent,
|
865
1021
|
response_view: response_view,
|
@@ -867,7 +1023,7 @@ module Google
|
|
867
1023
|
page_size: page_size
|
868
1024
|
}.delete_if { |_, v| v.nil? }
|
869
1025
|
req = Google::Gax::to_proto(req, Google::Cloud::Tasks::V2beta2::ListTasksRequest)
|
870
|
-
@list_tasks.call(req, options)
|
1026
|
+
@list_tasks.call(req, options, &block)
|
871
1027
|
end
|
872
1028
|
|
873
1029
|
# Gets a task.
|
@@ -893,6 +1049,9 @@ module Google
|
|
893
1049
|
# @param options [Google::Gax::CallOptions]
|
894
1050
|
# Overrides the default settings for this call, e.g, timeout,
|
895
1051
|
# retries, etc.
|
1052
|
+
# @yield [result, operation] Access the result along with the RPC operation
|
1053
|
+
# @yieldparam result [Google::Cloud::Tasks::V2beta2::Task]
|
1054
|
+
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
896
1055
|
# @return [Google::Cloud::Tasks::V2beta2::Task]
|
897
1056
|
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
898
1057
|
# @example
|
@@ -905,22 +1064,18 @@ module Google
|
|
905
1064
|
def get_task \
|
906
1065
|
name,
|
907
1066
|
response_view: nil,
|
908
|
-
options: nil
|
1067
|
+
options: nil,
|
1068
|
+
&block
|
909
1069
|
req = {
|
910
1070
|
name: name,
|
911
1071
|
response_view: response_view
|
912
1072
|
}.delete_if { |_, v| v.nil? }
|
913
1073
|
req = Google::Gax::to_proto(req, Google::Cloud::Tasks::V2beta2::GetTaskRequest)
|
914
|
-
@get_task.call(req, options)
|
1074
|
+
@get_task.call(req, options, &block)
|
915
1075
|
end
|
916
1076
|
|
917
1077
|
# Creates a task and adds it to a queue.
|
918
1078
|
#
|
919
|
-
# To add multiple tasks at the same time, use
|
920
|
-
# [HTTP batching](https://cloud.google.com/storage/docs/json_api/v1/how-tos/batch)
|
921
|
-
# or the batching documentation for your client library, for example
|
922
|
-
# https://developers.google.com/api-client-library/python/guide/batch.
|
923
|
-
#
|
924
1079
|
# Tasks cannot be updated after creation; there is no UpdateTask command.
|
925
1080
|
#
|
926
1081
|
# * For [App Engine queues](https://cloud.google.comgoogle.cloud.tasks.v2beta2.AppEngineHttpTarget),
|
@@ -989,6 +1144,9 @@ module Google
|
|
989
1144
|
# @param options [Google::Gax::CallOptions]
|
990
1145
|
# Overrides the default settings for this call, e.g, timeout,
|
991
1146
|
# retries, etc.
|
1147
|
+
# @yield [result, operation] Access the result along with the RPC operation
|
1148
|
+
# @yieldparam result [Google::Cloud::Tasks::V2beta2::Task]
|
1149
|
+
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
992
1150
|
# @return [Google::Cloud::Tasks::V2beta2::Task]
|
993
1151
|
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
994
1152
|
# @example
|
@@ -1005,14 +1163,15 @@ module Google
|
|
1005
1163
|
parent,
|
1006
1164
|
task,
|
1007
1165
|
response_view: nil,
|
1008
|
-
options: nil
|
1166
|
+
options: nil,
|
1167
|
+
&block
|
1009
1168
|
req = {
|
1010
1169
|
parent: parent,
|
1011
1170
|
task: task,
|
1012
1171
|
response_view: response_view
|
1013
1172
|
}.delete_if { |_, v| v.nil? }
|
1014
1173
|
req = Google::Gax::to_proto(req, Google::Cloud::Tasks::V2beta2::CreateTaskRequest)
|
1015
|
-
@create_task.call(req, options)
|
1174
|
+
@create_task.call(req, options, &block)
|
1016
1175
|
end
|
1017
1176
|
|
1018
1177
|
# Deletes a task.
|
@@ -1029,6 +1188,9 @@ module Google
|
|
1029
1188
|
# @param options [Google::Gax::CallOptions]
|
1030
1189
|
# Overrides the default settings for this call, e.g, timeout,
|
1031
1190
|
# retries, etc.
|
1191
|
+
# @yield [result, operation] Access the result along with the RPC operation
|
1192
|
+
# @yieldparam result []
|
1193
|
+
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
1032
1194
|
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
1033
1195
|
# @example
|
1034
1196
|
# require "google/cloud/tasks/v2beta2"
|
@@ -1039,12 +1201,13 @@ module Google
|
|
1039
1201
|
|
1040
1202
|
def delete_task \
|
1041
1203
|
name,
|
1042
|
-
options: nil
|
1204
|
+
options: nil,
|
1205
|
+
&block
|
1043
1206
|
req = {
|
1044
1207
|
name: name
|
1045
1208
|
}.delete_if { |_, v| v.nil? }
|
1046
1209
|
req = Google::Gax::to_proto(req, Google::Cloud::Tasks::V2beta2::DeleteTaskRequest)
|
1047
|
-
@delete_task.call(req, options)
|
1210
|
+
@delete_task.call(req, options, &block)
|
1048
1211
|
nil
|
1049
1212
|
end
|
1050
1213
|
|
@@ -1089,8 +1252,12 @@ module Google
|
|
1089
1252
|
# A hash of the same form as `Google::Protobuf::Duration`
|
1090
1253
|
# can also be provided.
|
1091
1254
|
# @param max_tasks [Integer]
|
1092
|
-
# The maximum number of tasks to lease.
|
1093
|
-
#
|
1255
|
+
# The maximum number of tasks to lease.
|
1256
|
+
#
|
1257
|
+
# The system will make a best effort to return as close to as
|
1258
|
+
# +max_tasks+ as possible.
|
1259
|
+
#
|
1260
|
+
# The largest that +max_tasks+ can be is 1000.
|
1094
1261
|
# @param response_view [Google::Cloud::Tasks::V2beta2::Task::View]
|
1095
1262
|
# The response_view specifies which subset of the {Google::Cloud::Tasks::V2beta2::Task Task} will be
|
1096
1263
|
# returned.
|
@@ -1137,6 +1304,9 @@ module Google
|
|
1137
1304
|
# @param options [Google::Gax::CallOptions]
|
1138
1305
|
# Overrides the default settings for this call, e.g, timeout,
|
1139
1306
|
# retries, etc.
|
1307
|
+
# @yield [result, operation] Access the result along with the RPC operation
|
1308
|
+
# @yieldparam result [Google::Cloud::Tasks::V2beta2::LeaseTasksResponse]
|
1309
|
+
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
1140
1310
|
# @return [Google::Cloud::Tasks::V2beta2::LeaseTasksResponse]
|
1141
1311
|
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
1142
1312
|
# @example
|
@@ -1155,7 +1325,8 @@ module Google
|
|
1155
1325
|
max_tasks: nil,
|
1156
1326
|
response_view: nil,
|
1157
1327
|
filter: nil,
|
1158
|
-
options: nil
|
1328
|
+
options: nil,
|
1329
|
+
&block
|
1159
1330
|
req = {
|
1160
1331
|
parent: parent,
|
1161
1332
|
lease_duration: lease_duration,
|
@@ -1164,7 +1335,7 @@ module Google
|
|
1164
1335
|
filter: filter
|
1165
1336
|
}.delete_if { |_, v| v.nil? }
|
1166
1337
|
req = Google::Gax::to_proto(req, Google::Cloud::Tasks::V2beta2::LeaseTasksRequest)
|
1167
|
-
@lease_tasks.call(req, options)
|
1338
|
+
@lease_tasks.call(req, options, &block)
|
1168
1339
|
end
|
1169
1340
|
|
1170
1341
|
# Acknowledges a pull task.
|
@@ -1181,11 +1352,6 @@ module Google
|
|
1181
1352
|
# {Google::Cloud::Tasks::V2beta2::CloudTasks::GetTask GetTask}, or
|
1182
1353
|
# {Google::Cloud::Tasks::V2beta2::CloudTasks::ListTasks ListTasks}.
|
1183
1354
|
#
|
1184
|
-
# To acknowledge multiple tasks at the same time, use
|
1185
|
-
# [HTTP batching](https://cloud.google.com/storage/docs/json_api/v1/how-tos/batch)
|
1186
|
-
# or the batching documentation for your client library, for example
|
1187
|
-
# https://developers.google.com/api-client-library/python/guide/batch.
|
1188
|
-
#
|
1189
1355
|
# @param name [String]
|
1190
1356
|
# Required.
|
1191
1357
|
#
|
@@ -1204,6 +1370,9 @@ module Google
|
|
1204
1370
|
# @param options [Google::Gax::CallOptions]
|
1205
1371
|
# Overrides the default settings for this call, e.g, timeout,
|
1206
1372
|
# retries, etc.
|
1373
|
+
# @yield [result, operation] Access the result along with the RPC operation
|
1374
|
+
# @yieldparam result []
|
1375
|
+
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
1207
1376
|
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
1208
1377
|
# @example
|
1209
1378
|
# require "google/cloud/tasks/v2beta2"
|
@@ -1218,13 +1387,14 @@ module Google
|
|
1218
1387
|
def acknowledge_task \
|
1219
1388
|
name,
|
1220
1389
|
schedule_time,
|
1221
|
-
options: nil
|
1390
|
+
options: nil,
|
1391
|
+
&block
|
1222
1392
|
req = {
|
1223
1393
|
name: name,
|
1224
1394
|
schedule_time: schedule_time
|
1225
1395
|
}.delete_if { |_, v| v.nil? }
|
1226
1396
|
req = Google::Gax::to_proto(req, Google::Cloud::Tasks::V2beta2::AcknowledgeTaskRequest)
|
1227
|
-
@acknowledge_task.call(req, options)
|
1397
|
+
@acknowledge_task.call(req, options, &block)
|
1228
1398
|
nil
|
1229
1399
|
end
|
1230
1400
|
|
@@ -1275,6 +1445,9 @@ module Google
|
|
1275
1445
|
# @param options [Google::Gax::CallOptions]
|
1276
1446
|
# Overrides the default settings for this call, e.g, timeout,
|
1277
1447
|
# retries, etc.
|
1448
|
+
# @yield [result, operation] Access the result along with the RPC operation
|
1449
|
+
# @yieldparam result [Google::Cloud::Tasks::V2beta2::Task]
|
1450
|
+
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
1278
1451
|
# @return [Google::Cloud::Tasks::V2beta2::Task]
|
1279
1452
|
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
1280
1453
|
# @example
|
@@ -1295,7 +1468,8 @@ module Google
|
|
1295
1468
|
schedule_time,
|
1296
1469
|
lease_duration,
|
1297
1470
|
response_view: nil,
|
1298
|
-
options: nil
|
1471
|
+
options: nil,
|
1472
|
+
&block
|
1299
1473
|
req = {
|
1300
1474
|
name: name,
|
1301
1475
|
schedule_time: schedule_time,
|
@@ -1303,7 +1477,7 @@ module Google
|
|
1303
1477
|
response_view: response_view
|
1304
1478
|
}.delete_if { |_, v| v.nil? }
|
1305
1479
|
req = Google::Gax::to_proto(req, Google::Cloud::Tasks::V2beta2::RenewLeaseRequest)
|
1306
|
-
@renew_lease.call(req, options)
|
1480
|
+
@renew_lease.call(req, options, &block)
|
1307
1481
|
end
|
1308
1482
|
|
1309
1483
|
# Cancel a pull task's lease.
|
@@ -1344,6 +1518,9 @@ module Google
|
|
1344
1518
|
# @param options [Google::Gax::CallOptions]
|
1345
1519
|
# Overrides the default settings for this call, e.g, timeout,
|
1346
1520
|
# retries, etc.
|
1521
|
+
# @yield [result, operation] Access the result along with the RPC operation
|
1522
|
+
# @yieldparam result [Google::Cloud::Tasks::V2beta2::Task]
|
1523
|
+
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
1347
1524
|
# @return [Google::Cloud::Tasks::V2beta2::Task]
|
1348
1525
|
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
1349
1526
|
# @example
|
@@ -1360,14 +1537,15 @@ module Google
|
|
1360
1537
|
name,
|
1361
1538
|
schedule_time,
|
1362
1539
|
response_view: nil,
|
1363
|
-
options: nil
|
1540
|
+
options: nil,
|
1541
|
+
&block
|
1364
1542
|
req = {
|
1365
1543
|
name: name,
|
1366
1544
|
schedule_time: schedule_time,
|
1367
1545
|
response_view: response_view
|
1368
1546
|
}.delete_if { |_, v| v.nil? }
|
1369
1547
|
req = Google::Gax::to_proto(req, Google::Cloud::Tasks::V2beta2::CancelLeaseRequest)
|
1370
|
-
@cancel_lease.call(req, options)
|
1548
|
+
@cancel_lease.call(req, options, &block)
|
1371
1549
|
end
|
1372
1550
|
|
1373
1551
|
# Forces a task to run now.
|
@@ -1419,6 +1597,9 @@ module Google
|
|
1419
1597
|
# @param options [Google::Gax::CallOptions]
|
1420
1598
|
# Overrides the default settings for this call, e.g, timeout,
|
1421
1599
|
# retries, etc.
|
1600
|
+
# @yield [result, operation] Access the result along with the RPC operation
|
1601
|
+
# @yieldparam result [Google::Cloud::Tasks::V2beta2::Task]
|
1602
|
+
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
1422
1603
|
# @return [Google::Cloud::Tasks::V2beta2::Task]
|
1423
1604
|
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
1424
1605
|
# @example
|
@@ -1431,13 +1612,14 @@ module Google
|
|
1431
1612
|
def run_task \
|
1432
1613
|
name,
|
1433
1614
|
response_view: nil,
|
1434
|
-
options: nil
|
1615
|
+
options: nil,
|
1616
|
+
&block
|
1435
1617
|
req = {
|
1436
1618
|
name: name,
|
1437
1619
|
response_view: response_view
|
1438
1620
|
}.delete_if { |_, v| v.nil? }
|
1439
1621
|
req = Google::Gax::to_proto(req, Google::Cloud::Tasks::V2beta2::RunTaskRequest)
|
1440
|
-
@run_task.call(req, options)
|
1622
|
+
@run_task.call(req, options, &block)
|
1441
1623
|
end
|
1442
1624
|
end
|
1443
1625
|
end
|