google-cloud-tasks-v2 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.yardopts +12 -0
- data/AUTHENTICATION.md +169 -0
- data/LICENSE.md +203 -0
- data/README.md +71 -0
- data/lib/google-cloud-tasks-v2.rb +21 -0
- data/lib/google/cloud/common_resources_pb.rb +15 -0
- data/lib/google/cloud/tasks/v2.rb +35 -0
- data/lib/google/cloud/tasks/v2/cloud_tasks.rb +50 -0
- data/lib/google/cloud/tasks/v2/cloud_tasks/client.rb +1849 -0
- data/lib/google/cloud/tasks/v2/cloud_tasks/credentials.rb +51 -0
- data/lib/google/cloud/tasks/v2/cloud_tasks/paths.rb +90 -0
- data/lib/google/cloud/tasks/v2/cloudtasks_pb.rb +102 -0
- data/lib/google/cloud/tasks/v2/cloudtasks_services_pb.rb +202 -0
- data/lib/google/cloud/tasks/v2/queue_pb.rb +58 -0
- data/lib/google/cloud/tasks/v2/target_pb.rb +67 -0
- data/lib/google/cloud/tasks/v2/task_pb.rb +53 -0
- data/lib/google/cloud/tasks/v2/version.rb +28 -0
- data/proto_docs/README.md +4 -0
- data/proto_docs/google/api/field_behavior.rb +59 -0
- data/proto_docs/google/api/resource.rb +247 -0
- data/proto_docs/google/cloud/tasks/v2/cloudtasks.rb +361 -0
- data/proto_docs/google/cloud/tasks/v2/queue.rb +364 -0
- data/proto_docs/google/cloud/tasks/v2/target.rb +451 -0
- data/proto_docs/google/cloud/tasks/v2/task.rb +185 -0
- data/proto_docs/google/iam/v1/iam_policy.rb +80 -0
- data/proto_docs/google/iam/v1/options.rb +40 -0
- data/proto_docs/google/iam/v1/policy.rb +248 -0
- data/proto_docs/google/protobuf/any.rb +138 -0
- data/proto_docs/google/protobuf/duration.rb +98 -0
- data/proto_docs/google/protobuf/empty.rb +36 -0
- data/proto_docs/google/protobuf/field_mask.rb +229 -0
- data/proto_docs/google/protobuf/timestamp.rb +120 -0
- data/proto_docs/google/rpc/status.rb +46 -0
- data/proto_docs/google/type/expr.rb +52 -0
- 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/v2"
|
@@ -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/v2/cloud_tasks"
|
20
|
+
require "google/cloud/tasks/v2/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/v2"
|
29
|
+
# client = ::Google::Cloud::Tasks::V2::CloudTasks::Client.new
|
30
|
+
#
|
31
|
+
module V2
|
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/v2/version"
|
24
|
+
|
25
|
+
require "google/cloud/tasks/v2/cloud_tasks/credentials"
|
26
|
+
require "google/cloud/tasks/v2/cloud_tasks/paths"
|
27
|
+
require "google/cloud/tasks/v2/cloud_tasks/client"
|
28
|
+
|
29
|
+
module Google
|
30
|
+
module Cloud
|
31
|
+
module Tasks
|
32
|
+
module V2
|
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/v2/cloud_tasks"
|
40
|
+
# client = ::Google::Cloud::Tasks::V2::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/v2/cloud_tasks/helpers" if ::File.file? helper_path
|
@@ -0,0 +1,1849 @@
|
|
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/v2/cloudtasks_pb"
|
21
|
+
|
22
|
+
module Google
|
23
|
+
module Cloud
|
24
|
+
module Tasks
|
25
|
+
module V2
|
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::V2::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::V2::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", "V2"]
|
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: ["DEADLINE_EXCEEDED", "UNAVAILABLE"]
|
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: ["DEADLINE_EXCEEDED", "UNAVAILABLE"]
|
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: ["DEADLINE_EXCEEDED", "UNAVAILABLE"]
|
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: ["DEADLINE_EXCEEDED", "UNAVAILABLE"]
|
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: ["DEADLINE_EXCEEDED", "UNAVAILABLE"]
|
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: ["DEADLINE_EXCEEDED", "UNAVAILABLE"]
|
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: ["DEADLINE_EXCEEDED", "UNAVAILABLE"]
|
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: ["DEADLINE_EXCEEDED", "UNAVAILABLE"]
|
145
|
+
}
|
146
|
+
|
147
|
+
default_config.rpcs.run_task.timeout = 10.0
|
148
|
+
|
149
|
+
default_config
|
150
|
+
end
|
151
|
+
yield @configure if block_given?
|
152
|
+
@configure
|
153
|
+
end
|
154
|
+
|
155
|
+
##
|
156
|
+
# Configure the CloudTasks Client instance.
|
157
|
+
#
|
158
|
+
# The configuration is set to the derived mode, meaning that values can be changed,
|
159
|
+
# but structural changes (adding new fields, etc.) are not allowed. Structural changes
|
160
|
+
# should be made on {Client.configure}.
|
161
|
+
#
|
162
|
+
# See {::Google::Cloud::Tasks::V2::CloudTasks::Client::Configuration}
|
163
|
+
# for a description of the configuration fields.
|
164
|
+
#
|
165
|
+
# @yield [config] Configure the Client client.
|
166
|
+
# @yieldparam config [Client::Configuration]
|
167
|
+
#
|
168
|
+
# @return [Client::Configuration]
|
169
|
+
#
|
170
|
+
def configure
|
171
|
+
yield @config if block_given?
|
172
|
+
@config
|
173
|
+
end
|
174
|
+
|
175
|
+
##
|
176
|
+
# Create a new CloudTasks client object.
|
177
|
+
#
|
178
|
+
# ## Examples
|
179
|
+
#
|
180
|
+
# To create a new CloudTasks client with the default
|
181
|
+
# configuration:
|
182
|
+
#
|
183
|
+
# client = ::Google::Cloud::Tasks::V2::CloudTasks::Client.new
|
184
|
+
#
|
185
|
+
# To create a new CloudTasks client with a custom
|
186
|
+
# configuration:
|
187
|
+
#
|
188
|
+
# client = ::Google::Cloud::Tasks::V2::CloudTasks::Client.new do |config|
|
189
|
+
# config.timeout = 10.0
|
190
|
+
# end
|
191
|
+
#
|
192
|
+
# @yield [config] Configure the CloudTasks client.
|
193
|
+
# @yieldparam config [Client::Configuration]
|
194
|
+
#
|
195
|
+
def initialize
|
196
|
+
# These require statements are intentionally placed here to initialize
|
197
|
+
# the gRPC module only when it's required.
|
198
|
+
# See https://github.com/googleapis/toolkit/issues/446
|
199
|
+
require "gapic/grpc"
|
200
|
+
require "google/cloud/tasks/v2/cloudtasks_services_pb"
|
201
|
+
|
202
|
+
# Create the configuration object
|
203
|
+
@config = Configuration.new Client.configure
|
204
|
+
|
205
|
+
# Yield the configuration if needed
|
206
|
+
yield @config if block_given?
|
207
|
+
|
208
|
+
# Create credentials
|
209
|
+
credentials = @config.credentials
|
210
|
+
credentials ||= Credentials.default scope: @config.scope
|
211
|
+
if credentials.is_a?(String) || credentials.is_a?(Hash)
|
212
|
+
credentials = Credentials.new credentials, scope: @config.scope
|
213
|
+
end
|
214
|
+
@quota_project_id = credentials.respond_to?(:quota_project_id) ? credentials.quota_project_id : nil
|
215
|
+
|
216
|
+
@cloud_tasks_stub = ::Gapic::ServiceStub.new(
|
217
|
+
::Google::Cloud::Tasks::V2::CloudTasks::Stub,
|
218
|
+
credentials: credentials,
|
219
|
+
endpoint: @config.endpoint,
|
220
|
+
channel_args: @config.channel_args,
|
221
|
+
interceptors: @config.interceptors
|
222
|
+
)
|
223
|
+
end
|
224
|
+
|
225
|
+
# Service calls
|
226
|
+
|
227
|
+
##
|
228
|
+
# Lists queues.
|
229
|
+
#
|
230
|
+
# Queues are returned in lexicographical order.
|
231
|
+
#
|
232
|
+
# @overload list_queues(request, options = nil)
|
233
|
+
# Pass arguments to `list_queues` via a request object, either of type
|
234
|
+
# {::Google::Cloud::Tasks::V2::ListQueuesRequest} or an equivalent Hash.
|
235
|
+
#
|
236
|
+
# @param request [::Google::Cloud::Tasks::V2::ListQueuesRequest, ::Hash]
|
237
|
+
# A request object representing the call parameters. Required. To specify no
|
238
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
239
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
240
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
241
|
+
#
|
242
|
+
# @overload list_queues(parent: nil, filter: nil, page_size: nil, page_token: nil)
|
243
|
+
# Pass arguments to `list_queues` via keyword arguments. Note that at
|
244
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
245
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
246
|
+
#
|
247
|
+
# @param parent [::String]
|
248
|
+
# Required. The location name.
|
249
|
+
# For example: `projects/PROJECT_ID/locations/LOCATION_ID`
|
250
|
+
# @param filter [::String]
|
251
|
+
# `filter` can be used to specify a subset of queues. Any {::Google::Cloud::Tasks::V2::Queue Queue}
|
252
|
+
# field can be used as a filter and several operators as supported.
|
253
|
+
# For example: `<=, <, >=, >, !=, =, :`. The filter syntax is the same as
|
254
|
+
# described in
|
255
|
+
# [Stackdriver's Advanced Logs
|
256
|
+
# Filters](https://cloud.google.com/logging/docs/view/advanced_filters).
|
257
|
+
#
|
258
|
+
# Sample filter "state: PAUSED".
|
259
|
+
#
|
260
|
+
# Note that using filters might cause fewer queues than the
|
261
|
+
# requested page_size to be returned.
|
262
|
+
# @param page_size [::Integer]
|
263
|
+
# Requested page size.
|
264
|
+
#
|
265
|
+
# The maximum page size is 9800. If unspecified, the page size will
|
266
|
+
# be the maximum. Fewer queues than requested might be returned,
|
267
|
+
# even if more queues exist; use the
|
268
|
+
# {::Google::Cloud::Tasks::V2::ListQueuesResponse#next_page_token next_page_token} in the
|
269
|
+
# response to determine if more queues exist.
|
270
|
+
# @param page_token [::String]
|
271
|
+
# A token identifying the page of results to return.
|
272
|
+
#
|
273
|
+
# To request the first page results, page_token must be empty. To
|
274
|
+
# request the next page of results, page_token must be the value of
|
275
|
+
# {::Google::Cloud::Tasks::V2::ListQueuesResponse#next_page_token next_page_token} returned
|
276
|
+
# from the previous call to {::Google::Cloud::Tasks::V2::CloudTasks::Client#list_queues ListQueues}
|
277
|
+
# method. It is an error to switch the value of the
|
278
|
+
# {::Google::Cloud::Tasks::V2::ListQueuesRequest#filter filter} while iterating through pages.
|
279
|
+
#
|
280
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
281
|
+
# @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::Tasks::V2::Queue>]
|
282
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
283
|
+
#
|
284
|
+
# @return [::Gapic::PagedEnumerable<::Google::Cloud::Tasks::V2::Queue>]
|
285
|
+
#
|
286
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
287
|
+
#
|
288
|
+
def list_queues request, options = nil
|
289
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
290
|
+
|
291
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Tasks::V2::ListQueuesRequest
|
292
|
+
|
293
|
+
# Converts hash and nil to an options object
|
294
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
295
|
+
|
296
|
+
# Customize the options with defaults
|
297
|
+
metadata = @config.rpcs.list_queues.metadata.to_h
|
298
|
+
|
299
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
300
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
301
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
302
|
+
gapic_version: ::Google::Cloud::Tasks::V2::VERSION
|
303
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
304
|
+
|
305
|
+
header_params = {
|
306
|
+
"parent" => request.parent
|
307
|
+
}
|
308
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
309
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
310
|
+
|
311
|
+
options.apply_defaults timeout: @config.rpcs.list_queues.timeout,
|
312
|
+
metadata: metadata,
|
313
|
+
retry_policy: @config.rpcs.list_queues.retry_policy
|
314
|
+
options.apply_defaults metadata: @config.metadata,
|
315
|
+
retry_policy: @config.retry_policy
|
316
|
+
|
317
|
+
@cloud_tasks_stub.call_rpc :list_queues, request, options: options do |response, operation|
|
318
|
+
response = ::Gapic::PagedEnumerable.new @cloud_tasks_stub, :list_queues, request, response, operation, options
|
319
|
+
yield response, operation if block_given?
|
320
|
+
return response
|
321
|
+
end
|
322
|
+
rescue ::GRPC::BadStatus => e
|
323
|
+
raise ::Google::Cloud::Error.from_error(e)
|
324
|
+
end
|
325
|
+
|
326
|
+
##
|
327
|
+
# Gets a queue.
|
328
|
+
#
|
329
|
+
# @overload get_queue(request, options = nil)
|
330
|
+
# Pass arguments to `get_queue` via a request object, either of type
|
331
|
+
# {::Google::Cloud::Tasks::V2::GetQueueRequest} or an equivalent Hash.
|
332
|
+
#
|
333
|
+
# @param request [::Google::Cloud::Tasks::V2::GetQueueRequest, ::Hash]
|
334
|
+
# A request object representing the call parameters. Required. To specify no
|
335
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
336
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
337
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
338
|
+
#
|
339
|
+
# @overload get_queue(name: nil)
|
340
|
+
# Pass arguments to `get_queue` via keyword arguments. Note that at
|
341
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
342
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
343
|
+
#
|
344
|
+
# @param name [::String]
|
345
|
+
# Required. The resource name of the queue. For example:
|
346
|
+
# `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID`
|
347
|
+
#
|
348
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
349
|
+
# @yieldparam response [::Google::Cloud::Tasks::V2::Queue]
|
350
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
351
|
+
#
|
352
|
+
# @return [::Google::Cloud::Tasks::V2::Queue]
|
353
|
+
#
|
354
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
355
|
+
#
|
356
|
+
def get_queue request, options = nil
|
357
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
358
|
+
|
359
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Tasks::V2::GetQueueRequest
|
360
|
+
|
361
|
+
# Converts hash and nil to an options object
|
362
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
363
|
+
|
364
|
+
# Customize the options with defaults
|
365
|
+
metadata = @config.rpcs.get_queue.metadata.to_h
|
366
|
+
|
367
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
368
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
369
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
370
|
+
gapic_version: ::Google::Cloud::Tasks::V2::VERSION
|
371
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
372
|
+
|
373
|
+
header_params = {
|
374
|
+
"name" => request.name
|
375
|
+
}
|
376
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
377
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
378
|
+
|
379
|
+
options.apply_defaults timeout: @config.rpcs.get_queue.timeout,
|
380
|
+
metadata: metadata,
|
381
|
+
retry_policy: @config.rpcs.get_queue.retry_policy
|
382
|
+
options.apply_defaults metadata: @config.metadata,
|
383
|
+
retry_policy: @config.retry_policy
|
384
|
+
|
385
|
+
@cloud_tasks_stub.call_rpc :get_queue, request, options: options do |response, operation|
|
386
|
+
yield response, operation if block_given?
|
387
|
+
return response
|
388
|
+
end
|
389
|
+
rescue ::GRPC::BadStatus => e
|
390
|
+
raise ::Google::Cloud::Error.from_error(e)
|
391
|
+
end
|
392
|
+
|
393
|
+
##
|
394
|
+
# Creates a queue.
|
395
|
+
#
|
396
|
+
# Queues created with this method allow tasks to live for a maximum of 31
|
397
|
+
# days. After a task is 31 days old, the task will be deleted regardless of whether
|
398
|
+
# it was dispatched or not.
|
399
|
+
#
|
400
|
+
# WARNING: Using this method may have unintended side effects if you are
|
401
|
+
# using an App Engine `queue.yaml` or `queue.xml` file to manage your queues.
|
402
|
+
# Read
|
403
|
+
# [Overview of Queue Management and
|
404
|
+
# queue.yaml](https://cloud.google.com/tasks/docs/queue-yaml) before using
|
405
|
+
# this method.
|
406
|
+
#
|
407
|
+
# @overload create_queue(request, options = nil)
|
408
|
+
# Pass arguments to `create_queue` via a request object, either of type
|
409
|
+
# {::Google::Cloud::Tasks::V2::CreateQueueRequest} or an equivalent Hash.
|
410
|
+
#
|
411
|
+
# @param request [::Google::Cloud::Tasks::V2::CreateQueueRequest, ::Hash]
|
412
|
+
# A request object representing the call parameters. Required. To specify no
|
413
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
414
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
415
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
416
|
+
#
|
417
|
+
# @overload create_queue(parent: nil, queue: nil)
|
418
|
+
# Pass arguments to `create_queue` via keyword arguments. Note that at
|
419
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
420
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
421
|
+
#
|
422
|
+
# @param parent [::String]
|
423
|
+
# Required. The location name in which the queue will be created.
|
424
|
+
# For example: `projects/PROJECT_ID/locations/LOCATION_ID`
|
425
|
+
#
|
426
|
+
# The list of allowed locations can be obtained by calling Cloud
|
427
|
+
# Tasks' implementation of
|
428
|
+
# [ListLocations][google.cloud.location.Locations.ListLocations].
|
429
|
+
# @param queue [::Google::Cloud::Tasks::V2::Queue, ::Hash]
|
430
|
+
# Required. The queue to create.
|
431
|
+
#
|
432
|
+
# [Queue's name][google.cloud.tasks.v2.Queue.name] cannot be the same as an existing queue.
|
433
|
+
#
|
434
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
435
|
+
# @yieldparam response [::Google::Cloud::Tasks::V2::Queue]
|
436
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
437
|
+
#
|
438
|
+
# @return [::Google::Cloud::Tasks::V2::Queue]
|
439
|
+
#
|
440
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
441
|
+
#
|
442
|
+
def create_queue request, options = nil
|
443
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
444
|
+
|
445
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Tasks::V2::CreateQueueRequest
|
446
|
+
|
447
|
+
# Converts hash and nil to an options object
|
448
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
449
|
+
|
450
|
+
# Customize the options with defaults
|
451
|
+
metadata = @config.rpcs.create_queue.metadata.to_h
|
452
|
+
|
453
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
454
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
455
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
456
|
+
gapic_version: ::Google::Cloud::Tasks::V2::VERSION
|
457
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
458
|
+
|
459
|
+
header_params = {
|
460
|
+
"parent" => request.parent
|
461
|
+
}
|
462
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
463
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
464
|
+
|
465
|
+
options.apply_defaults timeout: @config.rpcs.create_queue.timeout,
|
466
|
+
metadata: metadata,
|
467
|
+
retry_policy: @config.rpcs.create_queue.retry_policy
|
468
|
+
options.apply_defaults metadata: @config.metadata,
|
469
|
+
retry_policy: @config.retry_policy
|
470
|
+
|
471
|
+
@cloud_tasks_stub.call_rpc :create_queue, request, options: options do |response, operation|
|
472
|
+
yield response, operation if block_given?
|
473
|
+
return response
|
474
|
+
end
|
475
|
+
rescue ::GRPC::BadStatus => e
|
476
|
+
raise ::Google::Cloud::Error.from_error(e)
|
477
|
+
end
|
478
|
+
|
479
|
+
##
|
480
|
+
# Updates a queue.
|
481
|
+
#
|
482
|
+
# This method creates the queue if it does not exist and updates
|
483
|
+
# the queue if it does exist.
|
484
|
+
#
|
485
|
+
# Queues created with this method allow tasks to live for a maximum of 31
|
486
|
+
# days. After a task is 31 days old, the task will be deleted regardless of whether
|
487
|
+
# it was dispatched or not.
|
488
|
+
#
|
489
|
+
# WARNING: Using this method may have unintended side effects if you are
|
490
|
+
# using an App Engine `queue.yaml` or `queue.xml` file to manage your queues.
|
491
|
+
# Read
|
492
|
+
# [Overview of Queue Management and
|
493
|
+
# queue.yaml](https://cloud.google.com/tasks/docs/queue-yaml) before using
|
494
|
+
# this method.
|
495
|
+
#
|
496
|
+
# @overload update_queue(request, options = nil)
|
497
|
+
# Pass arguments to `update_queue` via a request object, either of type
|
498
|
+
# {::Google::Cloud::Tasks::V2::UpdateQueueRequest} or an equivalent Hash.
|
499
|
+
#
|
500
|
+
# @param request [::Google::Cloud::Tasks::V2::UpdateQueueRequest, ::Hash]
|
501
|
+
# A request object representing the call parameters. Required. To specify no
|
502
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
503
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
504
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
505
|
+
#
|
506
|
+
# @overload update_queue(queue: nil, update_mask: nil)
|
507
|
+
# Pass arguments to `update_queue` via keyword arguments. Note that at
|
508
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
509
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
510
|
+
#
|
511
|
+
# @param queue [::Google::Cloud::Tasks::V2::Queue, ::Hash]
|
512
|
+
# Required. The queue to create or update.
|
513
|
+
#
|
514
|
+
# The queue's {::Google::Cloud::Tasks::V2::Queue#name name} must be specified.
|
515
|
+
#
|
516
|
+
# Output only fields cannot be modified using UpdateQueue.
|
517
|
+
# Any value specified for an output only field will be ignored.
|
518
|
+
# The queue's {::Google::Cloud::Tasks::V2::Queue#name name} cannot be changed.
|
519
|
+
# @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
|
520
|
+
# A mask used to specify which fields of the queue are being updated.
|
521
|
+
#
|
522
|
+
# If empty, then all fields will be updated.
|
523
|
+
#
|
524
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
525
|
+
# @yieldparam response [::Google::Cloud::Tasks::V2::Queue]
|
526
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
527
|
+
#
|
528
|
+
# @return [::Google::Cloud::Tasks::V2::Queue]
|
529
|
+
#
|
530
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
531
|
+
#
|
532
|
+
def update_queue request, options = nil
|
533
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
534
|
+
|
535
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Tasks::V2::UpdateQueueRequest
|
536
|
+
|
537
|
+
# Converts hash and nil to an options object
|
538
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
539
|
+
|
540
|
+
# Customize the options with defaults
|
541
|
+
metadata = @config.rpcs.update_queue.metadata.to_h
|
542
|
+
|
543
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
544
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
545
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
546
|
+
gapic_version: ::Google::Cloud::Tasks::V2::VERSION
|
547
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
548
|
+
|
549
|
+
header_params = {
|
550
|
+
"queue.name" => request.queue.name
|
551
|
+
}
|
552
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
553
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
554
|
+
|
555
|
+
options.apply_defaults timeout: @config.rpcs.update_queue.timeout,
|
556
|
+
metadata: metadata,
|
557
|
+
retry_policy: @config.rpcs.update_queue.retry_policy
|
558
|
+
options.apply_defaults metadata: @config.metadata,
|
559
|
+
retry_policy: @config.retry_policy
|
560
|
+
|
561
|
+
@cloud_tasks_stub.call_rpc :update_queue, request, options: options do |response, operation|
|
562
|
+
yield response, operation if block_given?
|
563
|
+
return response
|
564
|
+
end
|
565
|
+
rescue ::GRPC::BadStatus => e
|
566
|
+
raise ::Google::Cloud::Error.from_error(e)
|
567
|
+
end
|
568
|
+
|
569
|
+
##
|
570
|
+
# Deletes a queue.
|
571
|
+
#
|
572
|
+
# This command will delete the queue even if it has tasks in it.
|
573
|
+
#
|
574
|
+
# Note: If you delete a queue, a queue with the same name can't be created
|
575
|
+
# for 7 days.
|
576
|
+
#
|
577
|
+
# WARNING: Using this method may have unintended side effects if you are
|
578
|
+
# using an App Engine `queue.yaml` or `queue.xml` file to manage your queues.
|
579
|
+
# Read
|
580
|
+
# [Overview of Queue Management and
|
581
|
+
# queue.yaml](https://cloud.google.com/tasks/docs/queue-yaml) before using
|
582
|
+
# this method.
|
583
|
+
#
|
584
|
+
# @overload delete_queue(request, options = nil)
|
585
|
+
# Pass arguments to `delete_queue` via a request object, either of type
|
586
|
+
# {::Google::Cloud::Tasks::V2::DeleteQueueRequest} or an equivalent Hash.
|
587
|
+
#
|
588
|
+
# @param request [::Google::Cloud::Tasks::V2::DeleteQueueRequest, ::Hash]
|
589
|
+
# A request object representing the call parameters. Required. To specify no
|
590
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
591
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
592
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
593
|
+
#
|
594
|
+
# @overload delete_queue(name: nil)
|
595
|
+
# Pass arguments to `delete_queue` via keyword arguments. Note that at
|
596
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
597
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
598
|
+
#
|
599
|
+
# @param name [::String]
|
600
|
+
# Required. The queue name. For example:
|
601
|
+
# `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID`
|
602
|
+
#
|
603
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
604
|
+
# @yieldparam response [::Google::Protobuf::Empty]
|
605
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
606
|
+
#
|
607
|
+
# @return [::Google::Protobuf::Empty]
|
608
|
+
#
|
609
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
610
|
+
#
|
611
|
+
def delete_queue request, options = nil
|
612
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
613
|
+
|
614
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Tasks::V2::DeleteQueueRequest
|
615
|
+
|
616
|
+
# Converts hash and nil to an options object
|
617
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
618
|
+
|
619
|
+
# Customize the options with defaults
|
620
|
+
metadata = @config.rpcs.delete_queue.metadata.to_h
|
621
|
+
|
622
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
623
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
624
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
625
|
+
gapic_version: ::Google::Cloud::Tasks::V2::VERSION
|
626
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
627
|
+
|
628
|
+
header_params = {
|
629
|
+
"name" => request.name
|
630
|
+
}
|
631
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
632
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
633
|
+
|
634
|
+
options.apply_defaults timeout: @config.rpcs.delete_queue.timeout,
|
635
|
+
metadata: metadata,
|
636
|
+
retry_policy: @config.rpcs.delete_queue.retry_policy
|
637
|
+
options.apply_defaults metadata: @config.metadata,
|
638
|
+
retry_policy: @config.retry_policy
|
639
|
+
|
640
|
+
@cloud_tasks_stub.call_rpc :delete_queue, request, options: options do |response, operation|
|
641
|
+
yield response, operation if block_given?
|
642
|
+
return response
|
643
|
+
end
|
644
|
+
rescue ::GRPC::BadStatus => e
|
645
|
+
raise ::Google::Cloud::Error.from_error(e)
|
646
|
+
end
|
647
|
+
|
648
|
+
##
|
649
|
+
# Purges a queue by deleting all of its tasks.
|
650
|
+
#
|
651
|
+
# All tasks created before this method is called are permanently deleted.
|
652
|
+
#
|
653
|
+
# Purge operations can take up to one minute to take effect. Tasks
|
654
|
+
# might be dispatched before the purge takes effect. A purge is irreversible.
|
655
|
+
#
|
656
|
+
# @overload purge_queue(request, options = nil)
|
657
|
+
# Pass arguments to `purge_queue` via a request object, either of type
|
658
|
+
# {::Google::Cloud::Tasks::V2::PurgeQueueRequest} or an equivalent Hash.
|
659
|
+
#
|
660
|
+
# @param request [::Google::Cloud::Tasks::V2::PurgeQueueRequest, ::Hash]
|
661
|
+
# A request object representing the call parameters. Required. To specify no
|
662
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
663
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
664
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
665
|
+
#
|
666
|
+
# @overload purge_queue(name: nil)
|
667
|
+
# Pass arguments to `purge_queue` via keyword arguments. Note that at
|
668
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
669
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
670
|
+
#
|
671
|
+
# @param name [::String]
|
672
|
+
# Required. The queue name. For example:
|
673
|
+
# `projects/PROJECT_ID/location/LOCATION_ID/queues/QUEUE_ID`
|
674
|
+
#
|
675
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
676
|
+
# @yieldparam response [::Google::Cloud::Tasks::V2::Queue]
|
677
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
678
|
+
#
|
679
|
+
# @return [::Google::Cloud::Tasks::V2::Queue]
|
680
|
+
#
|
681
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
682
|
+
#
|
683
|
+
def purge_queue request, options = nil
|
684
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
685
|
+
|
686
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Tasks::V2::PurgeQueueRequest
|
687
|
+
|
688
|
+
# Converts hash and nil to an options object
|
689
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
690
|
+
|
691
|
+
# Customize the options with defaults
|
692
|
+
metadata = @config.rpcs.purge_queue.metadata.to_h
|
693
|
+
|
694
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
695
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
696
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
697
|
+
gapic_version: ::Google::Cloud::Tasks::V2::VERSION
|
698
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
699
|
+
|
700
|
+
header_params = {
|
701
|
+
"name" => request.name
|
702
|
+
}
|
703
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
704
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
705
|
+
|
706
|
+
options.apply_defaults timeout: @config.rpcs.purge_queue.timeout,
|
707
|
+
metadata: metadata,
|
708
|
+
retry_policy: @config.rpcs.purge_queue.retry_policy
|
709
|
+
options.apply_defaults metadata: @config.metadata,
|
710
|
+
retry_policy: @config.retry_policy
|
711
|
+
|
712
|
+
@cloud_tasks_stub.call_rpc :purge_queue, request, options: options do |response, operation|
|
713
|
+
yield response, operation if block_given?
|
714
|
+
return response
|
715
|
+
end
|
716
|
+
rescue ::GRPC::BadStatus => e
|
717
|
+
raise ::Google::Cloud::Error.from_error(e)
|
718
|
+
end
|
719
|
+
|
720
|
+
##
|
721
|
+
# Pauses the queue.
|
722
|
+
#
|
723
|
+
# If a queue is paused then the system will stop dispatching tasks
|
724
|
+
# until the queue is resumed via
|
725
|
+
# {::Google::Cloud::Tasks::V2::CloudTasks::Client#resume_queue ResumeQueue}. Tasks can still be added
|
726
|
+
# when the queue is paused. A queue is paused if its
|
727
|
+
# {::Google::Cloud::Tasks::V2::Queue#state state} is {::Google::Cloud::Tasks::V2::Queue::State::PAUSED PAUSED}.
|
728
|
+
#
|
729
|
+
# @overload pause_queue(request, options = nil)
|
730
|
+
# Pass arguments to `pause_queue` via a request object, either of type
|
731
|
+
# {::Google::Cloud::Tasks::V2::PauseQueueRequest} or an equivalent Hash.
|
732
|
+
#
|
733
|
+
# @param request [::Google::Cloud::Tasks::V2::PauseQueueRequest, ::Hash]
|
734
|
+
# A request object representing the call parameters. Required. To specify no
|
735
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
736
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
737
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
738
|
+
#
|
739
|
+
# @overload pause_queue(name: nil)
|
740
|
+
# Pass arguments to `pause_queue` via keyword arguments. Note that at
|
741
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
742
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
743
|
+
#
|
744
|
+
# @param name [::String]
|
745
|
+
# Required. The queue name. For example:
|
746
|
+
# `projects/PROJECT_ID/location/LOCATION_ID/queues/QUEUE_ID`
|
747
|
+
#
|
748
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
749
|
+
# @yieldparam response [::Google::Cloud::Tasks::V2::Queue]
|
750
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
751
|
+
#
|
752
|
+
# @return [::Google::Cloud::Tasks::V2::Queue]
|
753
|
+
#
|
754
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
755
|
+
#
|
756
|
+
def pause_queue request, options = nil
|
757
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
758
|
+
|
759
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Tasks::V2::PauseQueueRequest
|
760
|
+
|
761
|
+
# Converts hash and nil to an options object
|
762
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
763
|
+
|
764
|
+
# Customize the options with defaults
|
765
|
+
metadata = @config.rpcs.pause_queue.metadata.to_h
|
766
|
+
|
767
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
768
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
769
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
770
|
+
gapic_version: ::Google::Cloud::Tasks::V2::VERSION
|
771
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
772
|
+
|
773
|
+
header_params = {
|
774
|
+
"name" => request.name
|
775
|
+
}
|
776
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
777
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
778
|
+
|
779
|
+
options.apply_defaults timeout: @config.rpcs.pause_queue.timeout,
|
780
|
+
metadata: metadata,
|
781
|
+
retry_policy: @config.rpcs.pause_queue.retry_policy
|
782
|
+
options.apply_defaults metadata: @config.metadata,
|
783
|
+
retry_policy: @config.retry_policy
|
784
|
+
|
785
|
+
@cloud_tasks_stub.call_rpc :pause_queue, request, options: options do |response, operation|
|
786
|
+
yield response, operation if block_given?
|
787
|
+
return response
|
788
|
+
end
|
789
|
+
rescue ::GRPC::BadStatus => e
|
790
|
+
raise ::Google::Cloud::Error.from_error(e)
|
791
|
+
end
|
792
|
+
|
793
|
+
##
|
794
|
+
# Resume a queue.
|
795
|
+
#
|
796
|
+
# This method resumes a queue after it has been
|
797
|
+
# {::Google::Cloud::Tasks::V2::Queue::State::PAUSED PAUSED} or
|
798
|
+
# {::Google::Cloud::Tasks::V2::Queue::State::DISABLED DISABLED}. The state of a queue is stored
|
799
|
+
# in the queue's {::Google::Cloud::Tasks::V2::Queue#state state}; after calling this method it
|
800
|
+
# will be set to {::Google::Cloud::Tasks::V2::Queue::State::RUNNING RUNNING}.
|
801
|
+
#
|
802
|
+
# WARNING: Resuming many high-QPS queues at the same time can
|
803
|
+
# lead to target overloading. If you are resuming high-QPS
|
804
|
+
# queues, follow the 500/50/5 pattern described in
|
805
|
+
# [Managing Cloud Tasks Scaling
|
806
|
+
# Risks](https://cloud.google.com/tasks/docs/manage-cloud-task-scaling).
|
807
|
+
#
|
808
|
+
# @overload resume_queue(request, options = nil)
|
809
|
+
# Pass arguments to `resume_queue` via a request object, either of type
|
810
|
+
# {::Google::Cloud::Tasks::V2::ResumeQueueRequest} or an equivalent Hash.
|
811
|
+
#
|
812
|
+
# @param request [::Google::Cloud::Tasks::V2::ResumeQueueRequest, ::Hash]
|
813
|
+
# A request object representing the call parameters. Required. To specify no
|
814
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
815
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
816
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
817
|
+
#
|
818
|
+
# @overload resume_queue(name: nil)
|
819
|
+
# Pass arguments to `resume_queue` via keyword arguments. Note that at
|
820
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
821
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
822
|
+
#
|
823
|
+
# @param name [::String]
|
824
|
+
# Required. The queue name. For example:
|
825
|
+
# `projects/PROJECT_ID/location/LOCATION_ID/queues/QUEUE_ID`
|
826
|
+
#
|
827
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
828
|
+
# @yieldparam response [::Google::Cloud::Tasks::V2::Queue]
|
829
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
830
|
+
#
|
831
|
+
# @return [::Google::Cloud::Tasks::V2::Queue]
|
832
|
+
#
|
833
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
834
|
+
#
|
835
|
+
def resume_queue request, options = nil
|
836
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
837
|
+
|
838
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Tasks::V2::ResumeQueueRequest
|
839
|
+
|
840
|
+
# Converts hash and nil to an options object
|
841
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
842
|
+
|
843
|
+
# Customize the options with defaults
|
844
|
+
metadata = @config.rpcs.resume_queue.metadata.to_h
|
845
|
+
|
846
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
847
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
848
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
849
|
+
gapic_version: ::Google::Cloud::Tasks::V2::VERSION
|
850
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
851
|
+
|
852
|
+
header_params = {
|
853
|
+
"name" => request.name
|
854
|
+
}
|
855
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
856
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
857
|
+
|
858
|
+
options.apply_defaults timeout: @config.rpcs.resume_queue.timeout,
|
859
|
+
metadata: metadata,
|
860
|
+
retry_policy: @config.rpcs.resume_queue.retry_policy
|
861
|
+
options.apply_defaults metadata: @config.metadata,
|
862
|
+
retry_policy: @config.retry_policy
|
863
|
+
|
864
|
+
@cloud_tasks_stub.call_rpc :resume_queue, request, options: options do |response, operation|
|
865
|
+
yield response, operation if block_given?
|
866
|
+
return response
|
867
|
+
end
|
868
|
+
rescue ::GRPC::BadStatus => e
|
869
|
+
raise ::Google::Cloud::Error.from_error(e)
|
870
|
+
end
|
871
|
+
|
872
|
+
##
|
873
|
+
# Gets the access control policy for a {::Google::Cloud::Tasks::V2::Queue Queue}.
|
874
|
+
# Returns an empty policy if the resource exists and does not have a policy
|
875
|
+
# set.
|
876
|
+
#
|
877
|
+
# Authorization requires the following
|
878
|
+
# [Google IAM](https://cloud.google.com/iam) permission on the specified
|
879
|
+
# resource parent:
|
880
|
+
#
|
881
|
+
# * `cloudtasks.queues.getIamPolicy`
|
882
|
+
#
|
883
|
+
# @overload get_iam_policy(request, options = nil)
|
884
|
+
# Pass arguments to `get_iam_policy` via a request object, either of type
|
885
|
+
# {::Google::Iam::V1::GetIamPolicyRequest} or an equivalent Hash.
|
886
|
+
#
|
887
|
+
# @param request [::Google::Iam::V1::GetIamPolicyRequest, ::Hash]
|
888
|
+
# A request object representing the call parameters. Required. To specify no
|
889
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
890
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
891
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
892
|
+
#
|
893
|
+
# @overload get_iam_policy(resource: nil, options: nil)
|
894
|
+
# Pass arguments to `get_iam_policy` via keyword arguments. Note that at
|
895
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
896
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
897
|
+
#
|
898
|
+
# @param resource [::String]
|
899
|
+
# REQUIRED: The resource for which the policy is being requested.
|
900
|
+
# See the operation documentation for the appropriate value for this field.
|
901
|
+
# @param options [::Google::Iam::V1::GetPolicyOptions, ::Hash]
|
902
|
+
# OPTIONAL: A `GetPolicyOptions` object for specifying options to
|
903
|
+
# `GetIamPolicy`. This field is only used by Cloud IAM.
|
904
|
+
#
|
905
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
906
|
+
# @yieldparam response [::Google::Iam::V1::Policy]
|
907
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
908
|
+
#
|
909
|
+
# @return [::Google::Iam::V1::Policy]
|
910
|
+
#
|
911
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
912
|
+
#
|
913
|
+
def get_iam_policy request, options = nil
|
914
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
915
|
+
|
916
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Iam::V1::GetIamPolicyRequest
|
917
|
+
|
918
|
+
# Converts hash and nil to an options object
|
919
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
920
|
+
|
921
|
+
# Customize the options with defaults
|
922
|
+
metadata = @config.rpcs.get_iam_policy.metadata.to_h
|
923
|
+
|
924
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
925
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
926
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
927
|
+
gapic_version: ::Google::Cloud::Tasks::V2::VERSION
|
928
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
929
|
+
|
930
|
+
header_params = {
|
931
|
+
"resource" => request.resource
|
932
|
+
}
|
933
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
934
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
935
|
+
|
936
|
+
options.apply_defaults timeout: @config.rpcs.get_iam_policy.timeout,
|
937
|
+
metadata: metadata,
|
938
|
+
retry_policy: @config.rpcs.get_iam_policy.retry_policy
|
939
|
+
options.apply_defaults metadata: @config.metadata,
|
940
|
+
retry_policy: @config.retry_policy
|
941
|
+
|
942
|
+
@cloud_tasks_stub.call_rpc :get_iam_policy, request, options: options do |response, operation|
|
943
|
+
yield response, operation if block_given?
|
944
|
+
return response
|
945
|
+
end
|
946
|
+
rescue ::GRPC::BadStatus => e
|
947
|
+
raise ::Google::Cloud::Error.from_error(e)
|
948
|
+
end
|
949
|
+
|
950
|
+
##
|
951
|
+
# Sets the access control policy for a {::Google::Cloud::Tasks::V2::Queue Queue}. Replaces any existing
|
952
|
+
# policy.
|
953
|
+
#
|
954
|
+
# Note: The Cloud Console does not check queue-level IAM permissions yet.
|
955
|
+
# Project-level permissions are required to use the Cloud Console.
|
956
|
+
#
|
957
|
+
# Authorization requires the following
|
958
|
+
# [Google IAM](https://cloud.google.com/iam) permission on the specified
|
959
|
+
# resource parent:
|
960
|
+
#
|
961
|
+
# * `cloudtasks.queues.setIamPolicy`
|
962
|
+
#
|
963
|
+
# @overload set_iam_policy(request, options = nil)
|
964
|
+
# Pass arguments to `set_iam_policy` via a request object, either of type
|
965
|
+
# {::Google::Iam::V1::SetIamPolicyRequest} or an equivalent Hash.
|
966
|
+
#
|
967
|
+
# @param request [::Google::Iam::V1::SetIamPolicyRequest, ::Hash]
|
968
|
+
# A request object representing the call parameters. Required. To specify no
|
969
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
970
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
971
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
972
|
+
#
|
973
|
+
# @overload set_iam_policy(resource: nil, policy: nil)
|
974
|
+
# Pass arguments to `set_iam_policy` via keyword arguments. Note that at
|
975
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
976
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
977
|
+
#
|
978
|
+
# @param resource [::String]
|
979
|
+
# REQUIRED: The resource for which the policy is being specified.
|
980
|
+
# See the operation documentation for the appropriate value for this field.
|
981
|
+
# @param policy [::Google::Iam::V1::Policy, ::Hash]
|
982
|
+
# REQUIRED: The complete policy to be applied to the `resource`. The size of
|
983
|
+
# the policy is limited to a few 10s of KB. An empty policy is a
|
984
|
+
# valid policy but certain Cloud Platform services (such as Projects)
|
985
|
+
# might reject them.
|
986
|
+
#
|
987
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
988
|
+
# @yieldparam response [::Google::Iam::V1::Policy]
|
989
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
990
|
+
#
|
991
|
+
# @return [::Google::Iam::V1::Policy]
|
992
|
+
#
|
993
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
994
|
+
#
|
995
|
+
def set_iam_policy request, options = nil
|
996
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
997
|
+
|
998
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Iam::V1::SetIamPolicyRequest
|
999
|
+
|
1000
|
+
# Converts hash and nil to an options object
|
1001
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
1002
|
+
|
1003
|
+
# Customize the options with defaults
|
1004
|
+
metadata = @config.rpcs.set_iam_policy.metadata.to_h
|
1005
|
+
|
1006
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
1007
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
1008
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
1009
|
+
gapic_version: ::Google::Cloud::Tasks::V2::VERSION
|
1010
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
1011
|
+
|
1012
|
+
header_params = {
|
1013
|
+
"resource" => request.resource
|
1014
|
+
}
|
1015
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
1016
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
1017
|
+
|
1018
|
+
options.apply_defaults timeout: @config.rpcs.set_iam_policy.timeout,
|
1019
|
+
metadata: metadata,
|
1020
|
+
retry_policy: @config.rpcs.set_iam_policy.retry_policy
|
1021
|
+
options.apply_defaults metadata: @config.metadata,
|
1022
|
+
retry_policy: @config.retry_policy
|
1023
|
+
|
1024
|
+
@cloud_tasks_stub.call_rpc :set_iam_policy, request, options: options do |response, operation|
|
1025
|
+
yield response, operation if block_given?
|
1026
|
+
return response
|
1027
|
+
end
|
1028
|
+
rescue ::GRPC::BadStatus => e
|
1029
|
+
raise ::Google::Cloud::Error.from_error(e)
|
1030
|
+
end
|
1031
|
+
|
1032
|
+
##
|
1033
|
+
# Returns permissions that a caller has on a {::Google::Cloud::Tasks::V2::Queue Queue}.
|
1034
|
+
# If the resource does not exist, this will return an empty set of
|
1035
|
+
# permissions, not a [NOT_FOUND][google.rpc.Code.NOT_FOUND] error.
|
1036
|
+
#
|
1037
|
+
# Note: This operation is designed to be used for building permission-aware
|
1038
|
+
# UIs and command-line tools, not for authorization checking. This operation
|
1039
|
+
# may "fail open" without warning.
|
1040
|
+
#
|
1041
|
+
# @overload test_iam_permissions(request, options = nil)
|
1042
|
+
# Pass arguments to `test_iam_permissions` via a request object, either of type
|
1043
|
+
# {::Google::Iam::V1::TestIamPermissionsRequest} or an equivalent Hash.
|
1044
|
+
#
|
1045
|
+
# @param request [::Google::Iam::V1::TestIamPermissionsRequest, ::Hash]
|
1046
|
+
# A request object representing the call parameters. Required. To specify no
|
1047
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
1048
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
1049
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
1050
|
+
#
|
1051
|
+
# @overload test_iam_permissions(resource: nil, permissions: nil)
|
1052
|
+
# Pass arguments to `test_iam_permissions` via keyword arguments. Note that at
|
1053
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
1054
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
1055
|
+
#
|
1056
|
+
# @param resource [::String]
|
1057
|
+
# REQUIRED: The resource for which the policy detail is being requested.
|
1058
|
+
# See the operation documentation for the appropriate value for this field.
|
1059
|
+
# @param permissions [::Array<::String>]
|
1060
|
+
# The set of permissions to check for the `resource`. Permissions with
|
1061
|
+
# wildcards (such as '*' or 'storage.*') are not allowed. For more
|
1062
|
+
# information see
|
1063
|
+
# [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions).
|
1064
|
+
#
|
1065
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
1066
|
+
# @yieldparam response [::Google::Iam::V1::TestIamPermissionsResponse]
|
1067
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
1068
|
+
#
|
1069
|
+
# @return [::Google::Iam::V1::TestIamPermissionsResponse]
|
1070
|
+
#
|
1071
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
1072
|
+
#
|
1073
|
+
def test_iam_permissions request, options = nil
|
1074
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
1075
|
+
|
1076
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Iam::V1::TestIamPermissionsRequest
|
1077
|
+
|
1078
|
+
# Converts hash and nil to an options object
|
1079
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
1080
|
+
|
1081
|
+
# Customize the options with defaults
|
1082
|
+
metadata = @config.rpcs.test_iam_permissions.metadata.to_h
|
1083
|
+
|
1084
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
1085
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
1086
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
1087
|
+
gapic_version: ::Google::Cloud::Tasks::V2::VERSION
|
1088
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
1089
|
+
|
1090
|
+
header_params = {
|
1091
|
+
"resource" => request.resource
|
1092
|
+
}
|
1093
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
1094
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
1095
|
+
|
1096
|
+
options.apply_defaults timeout: @config.rpcs.test_iam_permissions.timeout,
|
1097
|
+
metadata: metadata,
|
1098
|
+
retry_policy: @config.rpcs.test_iam_permissions.retry_policy
|
1099
|
+
options.apply_defaults metadata: @config.metadata,
|
1100
|
+
retry_policy: @config.retry_policy
|
1101
|
+
|
1102
|
+
@cloud_tasks_stub.call_rpc :test_iam_permissions, request, options: options do |response, operation|
|
1103
|
+
yield response, operation if block_given?
|
1104
|
+
return response
|
1105
|
+
end
|
1106
|
+
rescue ::GRPC::BadStatus => e
|
1107
|
+
raise ::Google::Cloud::Error.from_error(e)
|
1108
|
+
end
|
1109
|
+
|
1110
|
+
##
|
1111
|
+
# Lists the tasks in a queue.
|
1112
|
+
#
|
1113
|
+
# By default, only the {::Google::Cloud::Tasks::V2::Task::View::BASIC BASIC} view is retrieved
|
1114
|
+
# due to performance considerations;
|
1115
|
+
# {::Google::Cloud::Tasks::V2::ListTasksRequest#response_view response_view} controls the
|
1116
|
+
# subset of information which is returned.
|
1117
|
+
#
|
1118
|
+
# The tasks may be returned in any order. The ordering may change at any
|
1119
|
+
# time.
|
1120
|
+
#
|
1121
|
+
# @overload list_tasks(request, options = nil)
|
1122
|
+
# Pass arguments to `list_tasks` via a request object, either of type
|
1123
|
+
# {::Google::Cloud::Tasks::V2::ListTasksRequest} or an equivalent Hash.
|
1124
|
+
#
|
1125
|
+
# @param request [::Google::Cloud::Tasks::V2::ListTasksRequest, ::Hash]
|
1126
|
+
# A request object representing the call parameters. Required. To specify no
|
1127
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
1128
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
1129
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
1130
|
+
#
|
1131
|
+
# @overload list_tasks(parent: nil, response_view: nil, page_size: nil, page_token: nil)
|
1132
|
+
# Pass arguments to `list_tasks` via keyword arguments. Note that at
|
1133
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
1134
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
1135
|
+
#
|
1136
|
+
# @param parent [::String]
|
1137
|
+
# Required. The queue name. For example:
|
1138
|
+
# `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID`
|
1139
|
+
# @param response_view [::Google::Cloud::Tasks::V2::Task::View]
|
1140
|
+
# The response_view specifies which subset of the {::Google::Cloud::Tasks::V2::Task Task} will be
|
1141
|
+
# returned.
|
1142
|
+
#
|
1143
|
+
# By default response_view is {::Google::Cloud::Tasks::V2::Task::View::BASIC BASIC}; not all
|
1144
|
+
# information is retrieved by default because some data, such as
|
1145
|
+
# payloads, might be desirable to return only when needed because
|
1146
|
+
# of its large size or because of the sensitivity of data that it
|
1147
|
+
# contains.
|
1148
|
+
#
|
1149
|
+
# Authorization for {::Google::Cloud::Tasks::V2::Task::View::FULL FULL} requires
|
1150
|
+
# `cloudtasks.tasks.fullView` [Google IAM](https://cloud.google.com/iam/)
|
1151
|
+
# permission on the {::Google::Cloud::Tasks::V2::Task Task} resource.
|
1152
|
+
# @param page_size [::Integer]
|
1153
|
+
# Maximum page size.
|
1154
|
+
#
|
1155
|
+
# Fewer tasks than requested might be returned, even if more tasks exist; use
|
1156
|
+
# {::Google::Cloud::Tasks::V2::ListTasksResponse#next_page_token next_page_token} in the response to
|
1157
|
+
# determine if more tasks exist.
|
1158
|
+
#
|
1159
|
+
# The maximum page size is 1000. If unspecified, the page size will be the
|
1160
|
+
# maximum.
|
1161
|
+
# @param page_token [::String]
|
1162
|
+
# A token identifying the page of results to return.
|
1163
|
+
#
|
1164
|
+
# To request the first page results, page_token must be empty. To
|
1165
|
+
# request the next page of results, page_token must be the value of
|
1166
|
+
# {::Google::Cloud::Tasks::V2::ListTasksResponse#next_page_token next_page_token} returned
|
1167
|
+
# from the previous call to {::Google::Cloud::Tasks::V2::CloudTasks::Client#list_tasks ListTasks}
|
1168
|
+
# method.
|
1169
|
+
#
|
1170
|
+
# The page token is valid for only 2 hours.
|
1171
|
+
#
|
1172
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
1173
|
+
# @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::Tasks::V2::Task>]
|
1174
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
1175
|
+
#
|
1176
|
+
# @return [::Gapic::PagedEnumerable<::Google::Cloud::Tasks::V2::Task>]
|
1177
|
+
#
|
1178
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
1179
|
+
#
|
1180
|
+
def list_tasks request, options = nil
|
1181
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
1182
|
+
|
1183
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Tasks::V2::ListTasksRequest
|
1184
|
+
|
1185
|
+
# Converts hash and nil to an options object
|
1186
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
1187
|
+
|
1188
|
+
# Customize the options with defaults
|
1189
|
+
metadata = @config.rpcs.list_tasks.metadata.to_h
|
1190
|
+
|
1191
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
1192
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
1193
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
1194
|
+
gapic_version: ::Google::Cloud::Tasks::V2::VERSION
|
1195
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
1196
|
+
|
1197
|
+
header_params = {
|
1198
|
+
"parent" => request.parent
|
1199
|
+
}
|
1200
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
1201
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
1202
|
+
|
1203
|
+
options.apply_defaults timeout: @config.rpcs.list_tasks.timeout,
|
1204
|
+
metadata: metadata,
|
1205
|
+
retry_policy: @config.rpcs.list_tasks.retry_policy
|
1206
|
+
options.apply_defaults metadata: @config.metadata,
|
1207
|
+
retry_policy: @config.retry_policy
|
1208
|
+
|
1209
|
+
@cloud_tasks_stub.call_rpc :list_tasks, request, options: options do |response, operation|
|
1210
|
+
response = ::Gapic::PagedEnumerable.new @cloud_tasks_stub, :list_tasks, request, response, operation, options
|
1211
|
+
yield response, operation if block_given?
|
1212
|
+
return response
|
1213
|
+
end
|
1214
|
+
rescue ::GRPC::BadStatus => e
|
1215
|
+
raise ::Google::Cloud::Error.from_error(e)
|
1216
|
+
end
|
1217
|
+
|
1218
|
+
##
|
1219
|
+
# Gets a task.
|
1220
|
+
#
|
1221
|
+
# @overload get_task(request, options = nil)
|
1222
|
+
# Pass arguments to `get_task` via a request object, either of type
|
1223
|
+
# {::Google::Cloud::Tasks::V2::GetTaskRequest} or an equivalent Hash.
|
1224
|
+
#
|
1225
|
+
# @param request [::Google::Cloud::Tasks::V2::GetTaskRequest, ::Hash]
|
1226
|
+
# A request object representing the call parameters. Required. To specify no
|
1227
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
1228
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
1229
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
1230
|
+
#
|
1231
|
+
# @overload get_task(name: nil, response_view: nil)
|
1232
|
+
# Pass arguments to `get_task` via keyword arguments. Note that at
|
1233
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
1234
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
1235
|
+
#
|
1236
|
+
# @param name [::String]
|
1237
|
+
# Required. The task name. For example:
|
1238
|
+
# `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID`
|
1239
|
+
# @param response_view [::Google::Cloud::Tasks::V2::Task::View]
|
1240
|
+
# The response_view specifies which subset of the {::Google::Cloud::Tasks::V2::Task Task} will be
|
1241
|
+
# returned.
|
1242
|
+
#
|
1243
|
+
# By default response_view is {::Google::Cloud::Tasks::V2::Task::View::BASIC BASIC}; not all
|
1244
|
+
# information is retrieved by default because some data, such as
|
1245
|
+
# payloads, might be desirable to return only when needed because
|
1246
|
+
# of its large size or because of the sensitivity of data that it
|
1247
|
+
# contains.
|
1248
|
+
#
|
1249
|
+
# Authorization for {::Google::Cloud::Tasks::V2::Task::View::FULL FULL} requires
|
1250
|
+
# `cloudtasks.tasks.fullView` [Google IAM](https://cloud.google.com/iam/)
|
1251
|
+
# permission on the {::Google::Cloud::Tasks::V2::Task Task} resource.
|
1252
|
+
#
|
1253
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
1254
|
+
# @yieldparam response [::Google::Cloud::Tasks::V2::Task]
|
1255
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
1256
|
+
#
|
1257
|
+
# @return [::Google::Cloud::Tasks::V2::Task]
|
1258
|
+
#
|
1259
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
1260
|
+
#
|
1261
|
+
def get_task request, options = nil
|
1262
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
1263
|
+
|
1264
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Tasks::V2::GetTaskRequest
|
1265
|
+
|
1266
|
+
# Converts hash and nil to an options object
|
1267
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
1268
|
+
|
1269
|
+
# Customize the options with defaults
|
1270
|
+
metadata = @config.rpcs.get_task.metadata.to_h
|
1271
|
+
|
1272
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
1273
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
1274
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
1275
|
+
gapic_version: ::Google::Cloud::Tasks::V2::VERSION
|
1276
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
1277
|
+
|
1278
|
+
header_params = {
|
1279
|
+
"name" => request.name
|
1280
|
+
}
|
1281
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
1282
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
1283
|
+
|
1284
|
+
options.apply_defaults timeout: @config.rpcs.get_task.timeout,
|
1285
|
+
metadata: metadata,
|
1286
|
+
retry_policy: @config.rpcs.get_task.retry_policy
|
1287
|
+
options.apply_defaults metadata: @config.metadata,
|
1288
|
+
retry_policy: @config.retry_policy
|
1289
|
+
|
1290
|
+
@cloud_tasks_stub.call_rpc :get_task, request, options: options do |response, operation|
|
1291
|
+
yield response, operation if block_given?
|
1292
|
+
return response
|
1293
|
+
end
|
1294
|
+
rescue ::GRPC::BadStatus => e
|
1295
|
+
raise ::Google::Cloud::Error.from_error(e)
|
1296
|
+
end
|
1297
|
+
|
1298
|
+
##
|
1299
|
+
# Creates a task and adds it to a queue.
|
1300
|
+
#
|
1301
|
+
# Tasks cannot be updated after creation; there is no UpdateTask command.
|
1302
|
+
#
|
1303
|
+
# * The maximum task size is 100KB.
|
1304
|
+
#
|
1305
|
+
# @overload create_task(request, options = nil)
|
1306
|
+
# Pass arguments to `create_task` via a request object, either of type
|
1307
|
+
# {::Google::Cloud::Tasks::V2::CreateTaskRequest} or an equivalent Hash.
|
1308
|
+
#
|
1309
|
+
# @param request [::Google::Cloud::Tasks::V2::CreateTaskRequest, ::Hash]
|
1310
|
+
# A request object representing the call parameters. Required. To specify no
|
1311
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
1312
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
1313
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
1314
|
+
#
|
1315
|
+
# @overload create_task(parent: nil, task: nil, response_view: nil)
|
1316
|
+
# Pass arguments to `create_task` via keyword arguments. Note that at
|
1317
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
1318
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
1319
|
+
#
|
1320
|
+
# @param parent [::String]
|
1321
|
+
# Required. The queue name. For example:
|
1322
|
+
# `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID`
|
1323
|
+
#
|
1324
|
+
# The queue must already exist.
|
1325
|
+
# @param task [::Google::Cloud::Tasks::V2::Task, ::Hash]
|
1326
|
+
# Required. The task to add.
|
1327
|
+
#
|
1328
|
+
# Task names have the following format:
|
1329
|
+
# `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID`.
|
1330
|
+
# The user can optionally specify a task {::Google::Cloud::Tasks::V2::Task#name name}. If a
|
1331
|
+
# name is not specified then the system will generate a random
|
1332
|
+
# unique task id, which will be set in the task returned in the
|
1333
|
+
# {::Google::Cloud::Tasks::V2::Task#name response}.
|
1334
|
+
#
|
1335
|
+
# If {::Google::Cloud::Tasks::V2::Task#schedule_time schedule_time} is not set or is in the
|
1336
|
+
# past then Cloud Tasks will set it to the current time.
|
1337
|
+
#
|
1338
|
+
# Task De-duplication:
|
1339
|
+
#
|
1340
|
+
# Explicitly specifying a task ID enables task de-duplication. If
|
1341
|
+
# a task's ID is identical to that of an existing task or a task
|
1342
|
+
# that was deleted or executed recently then the call will fail
|
1343
|
+
# with [ALREADY_EXISTS][google.rpc.Code.ALREADY_EXISTS].
|
1344
|
+
# If the task's queue was created using Cloud Tasks, then another task with
|
1345
|
+
# the same name can't be created for ~1hour after the original task was
|
1346
|
+
# deleted or executed. If the task's queue was created using queue.yaml or
|
1347
|
+
# queue.xml, then another task with the same name can't be created
|
1348
|
+
# for ~9days after the original task was deleted or executed.
|
1349
|
+
#
|
1350
|
+
# Because there is an extra lookup cost to identify duplicate task
|
1351
|
+
# names, these {::Google::Cloud::Tasks::V2::CloudTasks::Client#create_task CreateTask} calls have significantly
|
1352
|
+
# increased latency. Using hashed strings for the task id or for
|
1353
|
+
# the prefix of the task id is recommended. Choosing task ids that
|
1354
|
+
# are sequential or have sequential prefixes, for example using a
|
1355
|
+
# timestamp, causes an increase in latency and error rates in all
|
1356
|
+
# task commands. The infrastructure relies on an approximately
|
1357
|
+
# uniform distribution of task ids to store and serve tasks
|
1358
|
+
# efficiently.
|
1359
|
+
# @param response_view [::Google::Cloud::Tasks::V2::Task::View]
|
1360
|
+
# The response_view specifies which subset of the {::Google::Cloud::Tasks::V2::Task Task} will be
|
1361
|
+
# returned.
|
1362
|
+
#
|
1363
|
+
# By default response_view is {::Google::Cloud::Tasks::V2::Task::View::BASIC BASIC}; not all
|
1364
|
+
# information is retrieved by default because some data, such as
|
1365
|
+
# payloads, might be desirable to return only when needed because
|
1366
|
+
# of its large size or because of the sensitivity of data that it
|
1367
|
+
# contains.
|
1368
|
+
#
|
1369
|
+
# Authorization for {::Google::Cloud::Tasks::V2::Task::View::FULL FULL} requires
|
1370
|
+
# `cloudtasks.tasks.fullView` [Google IAM](https://cloud.google.com/iam/)
|
1371
|
+
# permission on the {::Google::Cloud::Tasks::V2::Task Task} resource.
|
1372
|
+
#
|
1373
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
1374
|
+
# @yieldparam response [::Google::Cloud::Tasks::V2::Task]
|
1375
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
1376
|
+
#
|
1377
|
+
# @return [::Google::Cloud::Tasks::V2::Task]
|
1378
|
+
#
|
1379
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
1380
|
+
#
|
1381
|
+
def create_task request, options = nil
|
1382
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
1383
|
+
|
1384
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Tasks::V2::CreateTaskRequest
|
1385
|
+
|
1386
|
+
# Converts hash and nil to an options object
|
1387
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
1388
|
+
|
1389
|
+
# Customize the options with defaults
|
1390
|
+
metadata = @config.rpcs.create_task.metadata.to_h
|
1391
|
+
|
1392
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
1393
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
1394
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
1395
|
+
gapic_version: ::Google::Cloud::Tasks::V2::VERSION
|
1396
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
1397
|
+
|
1398
|
+
header_params = {
|
1399
|
+
"parent" => request.parent
|
1400
|
+
}
|
1401
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
1402
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
1403
|
+
|
1404
|
+
options.apply_defaults timeout: @config.rpcs.create_task.timeout,
|
1405
|
+
metadata: metadata,
|
1406
|
+
retry_policy: @config.rpcs.create_task.retry_policy
|
1407
|
+
options.apply_defaults metadata: @config.metadata,
|
1408
|
+
retry_policy: @config.retry_policy
|
1409
|
+
|
1410
|
+
@cloud_tasks_stub.call_rpc :create_task, request, options: options do |response, operation|
|
1411
|
+
yield response, operation if block_given?
|
1412
|
+
return response
|
1413
|
+
end
|
1414
|
+
rescue ::GRPC::BadStatus => e
|
1415
|
+
raise ::Google::Cloud::Error.from_error(e)
|
1416
|
+
end
|
1417
|
+
|
1418
|
+
##
|
1419
|
+
# Deletes a task.
|
1420
|
+
#
|
1421
|
+
# A task can be deleted if it is scheduled or dispatched. A task
|
1422
|
+
# cannot be deleted if it has executed successfully or permanently
|
1423
|
+
# failed.
|
1424
|
+
#
|
1425
|
+
# @overload delete_task(request, options = nil)
|
1426
|
+
# Pass arguments to `delete_task` via a request object, either of type
|
1427
|
+
# {::Google::Cloud::Tasks::V2::DeleteTaskRequest} or an equivalent Hash.
|
1428
|
+
#
|
1429
|
+
# @param request [::Google::Cloud::Tasks::V2::DeleteTaskRequest, ::Hash]
|
1430
|
+
# A request object representing the call parameters. Required. To specify no
|
1431
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
1432
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
1433
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
1434
|
+
#
|
1435
|
+
# @overload delete_task(name: nil)
|
1436
|
+
# Pass arguments to `delete_task` via keyword arguments. Note that at
|
1437
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
1438
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
1439
|
+
#
|
1440
|
+
# @param name [::String]
|
1441
|
+
# Required. The task name. For example:
|
1442
|
+
# `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID`
|
1443
|
+
#
|
1444
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
1445
|
+
# @yieldparam response [::Google::Protobuf::Empty]
|
1446
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
1447
|
+
#
|
1448
|
+
# @return [::Google::Protobuf::Empty]
|
1449
|
+
#
|
1450
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
1451
|
+
#
|
1452
|
+
def delete_task request, options = nil
|
1453
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
1454
|
+
|
1455
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Tasks::V2::DeleteTaskRequest
|
1456
|
+
|
1457
|
+
# Converts hash and nil to an options object
|
1458
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
1459
|
+
|
1460
|
+
# Customize the options with defaults
|
1461
|
+
metadata = @config.rpcs.delete_task.metadata.to_h
|
1462
|
+
|
1463
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
1464
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
1465
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
1466
|
+
gapic_version: ::Google::Cloud::Tasks::V2::VERSION
|
1467
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
1468
|
+
|
1469
|
+
header_params = {
|
1470
|
+
"name" => request.name
|
1471
|
+
}
|
1472
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
1473
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
1474
|
+
|
1475
|
+
options.apply_defaults timeout: @config.rpcs.delete_task.timeout,
|
1476
|
+
metadata: metadata,
|
1477
|
+
retry_policy: @config.rpcs.delete_task.retry_policy
|
1478
|
+
options.apply_defaults metadata: @config.metadata,
|
1479
|
+
retry_policy: @config.retry_policy
|
1480
|
+
|
1481
|
+
@cloud_tasks_stub.call_rpc :delete_task, request, options: options do |response, operation|
|
1482
|
+
yield response, operation if block_given?
|
1483
|
+
return response
|
1484
|
+
end
|
1485
|
+
rescue ::GRPC::BadStatus => e
|
1486
|
+
raise ::Google::Cloud::Error.from_error(e)
|
1487
|
+
end
|
1488
|
+
|
1489
|
+
##
|
1490
|
+
# Forces a task to run now.
|
1491
|
+
#
|
1492
|
+
# When this method is called, Cloud Tasks will dispatch the task, even if
|
1493
|
+
# the task is already running, the queue has reached its {::Google::Cloud::Tasks::V2::RateLimits RateLimits} or
|
1494
|
+
# is {::Google::Cloud::Tasks::V2::Queue::State::PAUSED PAUSED}.
|
1495
|
+
#
|
1496
|
+
# This command is meant to be used for manual debugging. For
|
1497
|
+
# example, {::Google::Cloud::Tasks::V2::CloudTasks::Client#run_task RunTask} can be used to retry a failed
|
1498
|
+
# task after a fix has been made or to manually force a task to be
|
1499
|
+
# dispatched now.
|
1500
|
+
#
|
1501
|
+
# The dispatched task is returned. That is, the task that is returned
|
1502
|
+
# contains the [status][Task.status] after the task is dispatched but
|
1503
|
+
# before the task is received by its target.
|
1504
|
+
#
|
1505
|
+
# If Cloud Tasks receives a successful response from the task's
|
1506
|
+
# target, then the task will be deleted; otherwise the task's
|
1507
|
+
# {::Google::Cloud::Tasks::V2::Task#schedule_time schedule_time} will be reset to the time that
|
1508
|
+
# {::Google::Cloud::Tasks::V2::CloudTasks::Client#run_task RunTask} was called plus the retry delay specified
|
1509
|
+
# in the queue's {::Google::Cloud::Tasks::V2::RetryConfig RetryConfig}.
|
1510
|
+
#
|
1511
|
+
# {::Google::Cloud::Tasks::V2::CloudTasks::Client#run_task RunTask} returns
|
1512
|
+
# [NOT_FOUND][google.rpc.Code.NOT_FOUND] when it is called on a
|
1513
|
+
# task that has already succeeded or permanently failed.
|
1514
|
+
#
|
1515
|
+
# @overload run_task(request, options = nil)
|
1516
|
+
# Pass arguments to `run_task` via a request object, either of type
|
1517
|
+
# {::Google::Cloud::Tasks::V2::RunTaskRequest} or an equivalent Hash.
|
1518
|
+
#
|
1519
|
+
# @param request [::Google::Cloud::Tasks::V2::RunTaskRequest, ::Hash]
|
1520
|
+
# A request object representing the call parameters. Required. To specify no
|
1521
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
1522
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
1523
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
1524
|
+
#
|
1525
|
+
# @overload run_task(name: nil, response_view: nil)
|
1526
|
+
# Pass arguments to `run_task` via keyword arguments. Note that at
|
1527
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
1528
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
1529
|
+
#
|
1530
|
+
# @param name [::String]
|
1531
|
+
# Required. The task name. For example:
|
1532
|
+
# `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID`
|
1533
|
+
# @param response_view [::Google::Cloud::Tasks::V2::Task::View]
|
1534
|
+
# The response_view specifies which subset of the {::Google::Cloud::Tasks::V2::Task Task} will be
|
1535
|
+
# returned.
|
1536
|
+
#
|
1537
|
+
# By default response_view is {::Google::Cloud::Tasks::V2::Task::View::BASIC BASIC}; not all
|
1538
|
+
# information is retrieved by default because some data, such as
|
1539
|
+
# payloads, might be desirable to return only when needed because
|
1540
|
+
# of its large size or because of the sensitivity of data that it
|
1541
|
+
# contains.
|
1542
|
+
#
|
1543
|
+
# Authorization for {::Google::Cloud::Tasks::V2::Task::View::FULL FULL} requires
|
1544
|
+
# `cloudtasks.tasks.fullView` [Google IAM](https://cloud.google.com/iam/)
|
1545
|
+
# permission on the {::Google::Cloud::Tasks::V2::Task Task} resource.
|
1546
|
+
#
|
1547
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
1548
|
+
# @yieldparam response [::Google::Cloud::Tasks::V2::Task]
|
1549
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
1550
|
+
#
|
1551
|
+
# @return [::Google::Cloud::Tasks::V2::Task]
|
1552
|
+
#
|
1553
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
1554
|
+
#
|
1555
|
+
def run_task request, options = nil
|
1556
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
1557
|
+
|
1558
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Tasks::V2::RunTaskRequest
|
1559
|
+
|
1560
|
+
# Converts hash and nil to an options object
|
1561
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
1562
|
+
|
1563
|
+
# Customize the options with defaults
|
1564
|
+
metadata = @config.rpcs.run_task.metadata.to_h
|
1565
|
+
|
1566
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
1567
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
1568
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
1569
|
+
gapic_version: ::Google::Cloud::Tasks::V2::VERSION
|
1570
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
1571
|
+
|
1572
|
+
header_params = {
|
1573
|
+
"name" => request.name
|
1574
|
+
}
|
1575
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
1576
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
1577
|
+
|
1578
|
+
options.apply_defaults timeout: @config.rpcs.run_task.timeout,
|
1579
|
+
metadata: metadata,
|
1580
|
+
retry_policy: @config.rpcs.run_task.retry_policy
|
1581
|
+
options.apply_defaults metadata: @config.metadata,
|
1582
|
+
retry_policy: @config.retry_policy
|
1583
|
+
|
1584
|
+
@cloud_tasks_stub.call_rpc :run_task, request, options: options do |response, operation|
|
1585
|
+
yield response, operation if block_given?
|
1586
|
+
return response
|
1587
|
+
end
|
1588
|
+
rescue ::GRPC::BadStatus => e
|
1589
|
+
raise ::Google::Cloud::Error.from_error(e)
|
1590
|
+
end
|
1591
|
+
|
1592
|
+
##
|
1593
|
+
# Configuration class for the CloudTasks API.
|
1594
|
+
#
|
1595
|
+
# This class represents the configuration for CloudTasks,
|
1596
|
+
# providing control over timeouts, retry behavior, logging, transport
|
1597
|
+
# parameters, and other low-level controls. Certain parameters can also be
|
1598
|
+
# applied individually to specific RPCs. See
|
1599
|
+
# {::Google::Cloud::Tasks::V2::CloudTasks::Client::Configuration::Rpcs}
|
1600
|
+
# for a list of RPCs that can be configured independently.
|
1601
|
+
#
|
1602
|
+
# Configuration can be applied globally to all clients, or to a single client
|
1603
|
+
# on construction.
|
1604
|
+
#
|
1605
|
+
# # Examples
|
1606
|
+
#
|
1607
|
+
# To modify the global config, setting the timeout for list_queues
|
1608
|
+
# to 20 seconds, and all remaining timeouts to 10 seconds:
|
1609
|
+
#
|
1610
|
+
# ::Google::Cloud::Tasks::V2::CloudTasks::Client.configure do |config|
|
1611
|
+
# config.timeout = 10.0
|
1612
|
+
# config.rpcs.list_queues.timeout = 20.0
|
1613
|
+
# end
|
1614
|
+
#
|
1615
|
+
# To apply the above configuration only to a new client:
|
1616
|
+
#
|
1617
|
+
# client = ::Google::Cloud::Tasks::V2::CloudTasks::Client.new do |config|
|
1618
|
+
# config.timeout = 10.0
|
1619
|
+
# config.rpcs.list_queues.timeout = 20.0
|
1620
|
+
# end
|
1621
|
+
#
|
1622
|
+
# @!attribute [rw] endpoint
|
1623
|
+
# The hostname or hostname:port of the service endpoint.
|
1624
|
+
# Defaults to `"cloudtasks.googleapis.com"`.
|
1625
|
+
# @return [::String]
|
1626
|
+
# @!attribute [rw] credentials
|
1627
|
+
# Credentials to send with calls. You may provide any of the following types:
|
1628
|
+
# * (`String`) The path to a service account key file in JSON format
|
1629
|
+
# * (`Hash`) A service account key as a Hash
|
1630
|
+
# * (`Google::Auth::Credentials`) A googleauth credentials object
|
1631
|
+
# (see the [googleauth docs](https://googleapis.dev/ruby/googleauth/latest/index.html))
|
1632
|
+
# * (`Signet::OAuth2::Client`) A signet oauth2 client object
|
1633
|
+
# (see the [signet docs](https://googleapis.dev/ruby/signet/latest/Signet/OAuth2/Client.html))
|
1634
|
+
# * (`GRPC::Core::Channel`) a gRPC channel with included credentials
|
1635
|
+
# * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
|
1636
|
+
# * (`nil`) indicating no credentials
|
1637
|
+
# @return [::Object]
|
1638
|
+
# @!attribute [rw] scope
|
1639
|
+
# The OAuth scopes
|
1640
|
+
# @return [::Array<::String>]
|
1641
|
+
# @!attribute [rw] lib_name
|
1642
|
+
# The library name as recorded in instrumentation and logging
|
1643
|
+
# @return [::String]
|
1644
|
+
# @!attribute [rw] lib_version
|
1645
|
+
# The library version as recorded in instrumentation and logging
|
1646
|
+
# @return [::String]
|
1647
|
+
# @!attribute [rw] channel_args
|
1648
|
+
# Extra parameters passed to the gRPC channel. Note: this is ignored if a
|
1649
|
+
# `GRPC::Core::Channel` object is provided as the credential.
|
1650
|
+
# @return [::Hash]
|
1651
|
+
# @!attribute [rw] interceptors
|
1652
|
+
# An array of interceptors that are run before calls are executed.
|
1653
|
+
# @return [::Array<::GRPC::ClientInterceptor>]
|
1654
|
+
# @!attribute [rw] timeout
|
1655
|
+
# The call timeout in seconds.
|
1656
|
+
# @return [::Numeric]
|
1657
|
+
# @!attribute [rw] metadata
|
1658
|
+
# Additional gRPC headers to be sent with the call.
|
1659
|
+
# @return [::Hash{::Symbol=>::String}]
|
1660
|
+
# @!attribute [rw] retry_policy
|
1661
|
+
# The retry policy. The value is a hash with the following keys:
|
1662
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
1663
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
1664
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
1665
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
1666
|
+
# trigger a retry.
|
1667
|
+
# @return [::Hash]
|
1668
|
+
#
|
1669
|
+
class Configuration
|
1670
|
+
extend ::Gapic::Config
|
1671
|
+
|
1672
|
+
config_attr :endpoint, "cloudtasks.googleapis.com", String
|
1673
|
+
config_attr :credentials, nil do |value|
|
1674
|
+
allowed = [::String, ::Hash, ::Proc, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
|
1675
|
+
allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
|
1676
|
+
allowed.any? { |klass| klass === value }
|
1677
|
+
end
|
1678
|
+
config_attr :scope, nil, ::String, ::Array, nil
|
1679
|
+
config_attr :lib_name, nil, ::String, nil
|
1680
|
+
config_attr :lib_version, nil, ::String, nil
|
1681
|
+
config_attr(:channel_args, { "grpc.service_config_disable_resolution"=>1 }, ::Hash, nil)
|
1682
|
+
config_attr :interceptors, nil, ::Array, nil
|
1683
|
+
config_attr :timeout, nil, ::Numeric, nil
|
1684
|
+
config_attr :metadata, nil, ::Hash, nil
|
1685
|
+
config_attr :retry_policy, nil, ::Hash, Proc, nil
|
1686
|
+
|
1687
|
+
# @private
|
1688
|
+
def initialize parent_config = nil
|
1689
|
+
@parent_config = parent_config unless parent_config.nil?
|
1690
|
+
|
1691
|
+
yield self if block_given?
|
1692
|
+
end
|
1693
|
+
|
1694
|
+
##
|
1695
|
+
# Configurations for individual RPCs
|
1696
|
+
# @return [Rpcs]
|
1697
|
+
#
|
1698
|
+
def rpcs
|
1699
|
+
@rpcs ||= begin
|
1700
|
+
parent_rpcs = nil
|
1701
|
+
parent_rpcs = @parent_config.rpcs if @parent_config&.respond_to? :rpcs
|
1702
|
+
Rpcs.new parent_rpcs
|
1703
|
+
end
|
1704
|
+
end
|
1705
|
+
|
1706
|
+
##
|
1707
|
+
# Configuration RPC class for the CloudTasks API.
|
1708
|
+
#
|
1709
|
+
# Includes fields providing the configuration for each RPC in this service.
|
1710
|
+
# Each configuration object is of type `Gapic::Config::Method` and includes
|
1711
|
+
# the following configuration fields:
|
1712
|
+
#
|
1713
|
+
# * `timeout` (*type:* `Numeric`) - The call timeout in milliseconds
|
1714
|
+
# * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
|
1715
|
+
# * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
|
1716
|
+
# include the following keys:
|
1717
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
1718
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
1719
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
1720
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
1721
|
+
# trigger a retry.
|
1722
|
+
#
|
1723
|
+
class Rpcs
|
1724
|
+
##
|
1725
|
+
# RPC-specific configuration for `list_queues`
|
1726
|
+
# @return [::Gapic::Config::Method]
|
1727
|
+
#
|
1728
|
+
attr_reader :list_queues
|
1729
|
+
##
|
1730
|
+
# RPC-specific configuration for `get_queue`
|
1731
|
+
# @return [::Gapic::Config::Method]
|
1732
|
+
#
|
1733
|
+
attr_reader :get_queue
|
1734
|
+
##
|
1735
|
+
# RPC-specific configuration for `create_queue`
|
1736
|
+
# @return [::Gapic::Config::Method]
|
1737
|
+
#
|
1738
|
+
attr_reader :create_queue
|
1739
|
+
##
|
1740
|
+
# RPC-specific configuration for `update_queue`
|
1741
|
+
# @return [::Gapic::Config::Method]
|
1742
|
+
#
|
1743
|
+
attr_reader :update_queue
|
1744
|
+
##
|
1745
|
+
# RPC-specific configuration for `delete_queue`
|
1746
|
+
# @return [::Gapic::Config::Method]
|
1747
|
+
#
|
1748
|
+
attr_reader :delete_queue
|
1749
|
+
##
|
1750
|
+
# RPC-specific configuration for `purge_queue`
|
1751
|
+
# @return [::Gapic::Config::Method]
|
1752
|
+
#
|
1753
|
+
attr_reader :purge_queue
|
1754
|
+
##
|
1755
|
+
# RPC-specific configuration for `pause_queue`
|
1756
|
+
# @return [::Gapic::Config::Method]
|
1757
|
+
#
|
1758
|
+
attr_reader :pause_queue
|
1759
|
+
##
|
1760
|
+
# RPC-specific configuration for `resume_queue`
|
1761
|
+
# @return [::Gapic::Config::Method]
|
1762
|
+
#
|
1763
|
+
attr_reader :resume_queue
|
1764
|
+
##
|
1765
|
+
# RPC-specific configuration for `get_iam_policy`
|
1766
|
+
# @return [::Gapic::Config::Method]
|
1767
|
+
#
|
1768
|
+
attr_reader :get_iam_policy
|
1769
|
+
##
|
1770
|
+
# RPC-specific configuration for `set_iam_policy`
|
1771
|
+
# @return [::Gapic::Config::Method]
|
1772
|
+
#
|
1773
|
+
attr_reader :set_iam_policy
|
1774
|
+
##
|
1775
|
+
# RPC-specific configuration for `test_iam_permissions`
|
1776
|
+
# @return [::Gapic::Config::Method]
|
1777
|
+
#
|
1778
|
+
attr_reader :test_iam_permissions
|
1779
|
+
##
|
1780
|
+
# RPC-specific configuration for `list_tasks`
|
1781
|
+
# @return [::Gapic::Config::Method]
|
1782
|
+
#
|
1783
|
+
attr_reader :list_tasks
|
1784
|
+
##
|
1785
|
+
# RPC-specific configuration for `get_task`
|
1786
|
+
# @return [::Gapic::Config::Method]
|
1787
|
+
#
|
1788
|
+
attr_reader :get_task
|
1789
|
+
##
|
1790
|
+
# RPC-specific configuration for `create_task`
|
1791
|
+
# @return [::Gapic::Config::Method]
|
1792
|
+
#
|
1793
|
+
attr_reader :create_task
|
1794
|
+
##
|
1795
|
+
# RPC-specific configuration for `delete_task`
|
1796
|
+
# @return [::Gapic::Config::Method]
|
1797
|
+
#
|
1798
|
+
attr_reader :delete_task
|
1799
|
+
##
|
1800
|
+
# RPC-specific configuration for `run_task`
|
1801
|
+
# @return [::Gapic::Config::Method]
|
1802
|
+
#
|
1803
|
+
attr_reader :run_task
|
1804
|
+
|
1805
|
+
# @private
|
1806
|
+
def initialize parent_rpcs = nil
|
1807
|
+
list_queues_config = parent_rpcs&.list_queues if parent_rpcs&.respond_to? :list_queues
|
1808
|
+
@list_queues = ::Gapic::Config::Method.new list_queues_config
|
1809
|
+
get_queue_config = parent_rpcs&.get_queue if parent_rpcs&.respond_to? :get_queue
|
1810
|
+
@get_queue = ::Gapic::Config::Method.new get_queue_config
|
1811
|
+
create_queue_config = parent_rpcs&.create_queue if parent_rpcs&.respond_to? :create_queue
|
1812
|
+
@create_queue = ::Gapic::Config::Method.new create_queue_config
|
1813
|
+
update_queue_config = parent_rpcs&.update_queue if parent_rpcs&.respond_to? :update_queue
|
1814
|
+
@update_queue = ::Gapic::Config::Method.new update_queue_config
|
1815
|
+
delete_queue_config = parent_rpcs&.delete_queue if parent_rpcs&.respond_to? :delete_queue
|
1816
|
+
@delete_queue = ::Gapic::Config::Method.new delete_queue_config
|
1817
|
+
purge_queue_config = parent_rpcs&.purge_queue if parent_rpcs&.respond_to? :purge_queue
|
1818
|
+
@purge_queue = ::Gapic::Config::Method.new purge_queue_config
|
1819
|
+
pause_queue_config = parent_rpcs&.pause_queue if parent_rpcs&.respond_to? :pause_queue
|
1820
|
+
@pause_queue = ::Gapic::Config::Method.new pause_queue_config
|
1821
|
+
resume_queue_config = parent_rpcs&.resume_queue if parent_rpcs&.respond_to? :resume_queue
|
1822
|
+
@resume_queue = ::Gapic::Config::Method.new resume_queue_config
|
1823
|
+
get_iam_policy_config = parent_rpcs&.get_iam_policy if parent_rpcs&.respond_to? :get_iam_policy
|
1824
|
+
@get_iam_policy = ::Gapic::Config::Method.new get_iam_policy_config
|
1825
|
+
set_iam_policy_config = parent_rpcs&.set_iam_policy if parent_rpcs&.respond_to? :set_iam_policy
|
1826
|
+
@set_iam_policy = ::Gapic::Config::Method.new set_iam_policy_config
|
1827
|
+
test_iam_permissions_config = parent_rpcs&.test_iam_permissions if parent_rpcs&.respond_to? :test_iam_permissions
|
1828
|
+
@test_iam_permissions = ::Gapic::Config::Method.new test_iam_permissions_config
|
1829
|
+
list_tasks_config = parent_rpcs&.list_tasks if parent_rpcs&.respond_to? :list_tasks
|
1830
|
+
@list_tasks = ::Gapic::Config::Method.new list_tasks_config
|
1831
|
+
get_task_config = parent_rpcs&.get_task if parent_rpcs&.respond_to? :get_task
|
1832
|
+
@get_task = ::Gapic::Config::Method.new get_task_config
|
1833
|
+
create_task_config = parent_rpcs&.create_task if parent_rpcs&.respond_to? :create_task
|
1834
|
+
@create_task = ::Gapic::Config::Method.new create_task_config
|
1835
|
+
delete_task_config = parent_rpcs&.delete_task if parent_rpcs&.respond_to? :delete_task
|
1836
|
+
@delete_task = ::Gapic::Config::Method.new delete_task_config
|
1837
|
+
run_task_config = parent_rpcs&.run_task if parent_rpcs&.respond_to? :run_task
|
1838
|
+
@run_task = ::Gapic::Config::Method.new run_task_config
|
1839
|
+
|
1840
|
+
yield self if block_given?
|
1841
|
+
end
|
1842
|
+
end
|
1843
|
+
end
|
1844
|
+
end
|
1845
|
+
end
|
1846
|
+
end
|
1847
|
+
end
|
1848
|
+
end
|
1849
|
+
end
|