google-cloud-tasks 1.5.1 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.yardopts +2 -1
- data/AUTHENTICATION.md +51 -54
- data/LICENSE.md +203 -0
- data/MIGRATING.md +274 -0
- data/README.md +37 -24
- data/lib/{google/cloud/tasks/v2beta2/doc/google/protobuf/empty.rb → google-cloud-tasks.rb} +4 -14
- data/lib/google/cloud/tasks.rb +82 -117
- data/lib/google/cloud/tasks/version.rb +6 -2
- metadata +104 -113
- data/LICENSE +0 -201
- data/lib/google/cloud/tasks/v2.rb +0 -147
- data/lib/google/cloud/tasks/v2/cloud_tasks_client.rb +0 -1233
- data/lib/google/cloud/tasks/v2/cloud_tasks_client_config.json +0 -106
- data/lib/google/cloud/tasks/v2/cloudtasks_pb.rb +0 -100
- data/lib/google/cloud/tasks/v2/cloudtasks_services_pb.rb +0 -203
- data/lib/google/cloud/tasks/v2/credentials.rb +0 -41
- data/lib/google/cloud/tasks/v2/doc/google/cloud/tasks/v2/cloudtasks.rb +0 -312
- data/lib/google/cloud/tasks/v2/doc/google/cloud/tasks/v2/queue.rb +0 -348
- data/lib/google/cloud/tasks/v2/doc/google/cloud/tasks/v2/target.rb +0 -414
- data/lib/google/cloud/tasks/v2/doc/google/cloud/tasks/v2/task.rb +0 -175
- data/lib/google/cloud/tasks/v2/doc/google/iam/v1/iam_policy.rb +0 -64
- data/lib/google/cloud/tasks/v2/doc/google/iam/v1/options.rb +0 -33
- data/lib/google/cloud/tasks/v2/doc/google/iam/v1/policy.rb +0 -151
- data/lib/google/cloud/tasks/v2/doc/google/protobuf/any.rb +0 -131
- data/lib/google/cloud/tasks/v2/doc/google/protobuf/duration.rb +0 -91
- data/lib/google/cloud/tasks/v2/doc/google/protobuf/empty.rb +0 -29
- data/lib/google/cloud/tasks/v2/doc/google/protobuf/field_mask.rb +0 -222
- data/lib/google/cloud/tasks/v2/doc/google/protobuf/timestamp.rb +0 -113
- data/lib/google/cloud/tasks/v2/doc/google/rpc/status.rb +0 -39
- data/lib/google/cloud/tasks/v2/doc/google/type/expr.rb +0 -45
- data/lib/google/cloud/tasks/v2/helpers.rb +0 -49
- data/lib/google/cloud/tasks/v2/queue_pb.rb +0 -56
- data/lib/google/cloud/tasks/v2/target_pb.rb +0 -66
- data/lib/google/cloud/tasks/v2/task_pb.rb +0 -51
- data/lib/google/cloud/tasks/v2beta2.rb +0 -147
- data/lib/google/cloud/tasks/v2beta2/cloud_tasks_client.rb +0 -1605
- data/lib/google/cloud/tasks/v2beta2/cloud_tasks_client_config.json +0 -126
- data/lib/google/cloud/tasks/v2beta2/cloudtasks_pb.rb +0 -133
- data/lib/google/cloud/tasks/v2beta2/cloudtasks_services_pb.rb +0 -258
- data/lib/google/cloud/tasks/v2beta2/credentials.rb +0 -41
- data/lib/google/cloud/tasks/v2beta2/doc/google/cloud/tasks/v2beta2/cloudtasks.rb +0 -483
- data/lib/google/cloud/tasks/v2beta2/doc/google/cloud/tasks/v2beta2/queue.rb +0 -336
- data/lib/google/cloud/tasks/v2beta2/doc/google/cloud/tasks/v2beta2/target.rb +0 -377
- data/lib/google/cloud/tasks/v2beta2/doc/google/cloud/tasks/v2beta2/task.rb +0 -166
- data/lib/google/cloud/tasks/v2beta2/doc/google/iam/v1/iam_policy.rb +0 -64
- data/lib/google/cloud/tasks/v2beta2/doc/google/iam/v1/options.rb +0 -33
- data/lib/google/cloud/tasks/v2beta2/doc/google/iam/v1/policy.rb +0 -151
- data/lib/google/cloud/tasks/v2beta2/doc/google/protobuf/any.rb +0 -131
- data/lib/google/cloud/tasks/v2beta2/doc/google/protobuf/duration.rb +0 -91
- data/lib/google/cloud/tasks/v2beta2/doc/google/protobuf/field_mask.rb +0 -222
- data/lib/google/cloud/tasks/v2beta2/doc/google/protobuf/timestamp.rb +0 -113
- data/lib/google/cloud/tasks/v2beta2/doc/google/rpc/status.rb +0 -39
- data/lib/google/cloud/tasks/v2beta2/doc/google/type/expr.rb +0 -45
- data/lib/google/cloud/tasks/v2beta2/helpers.rb +0 -49
- data/lib/google/cloud/tasks/v2beta2/queue_pb.rb +0 -58
- data/lib/google/cloud/tasks/v2beta2/target_pb.rb +0 -54
- data/lib/google/cloud/tasks/v2beta2/task_pb.rb +0 -54
- data/lib/google/cloud/tasks/v2beta3.rb +0 -147
- data/lib/google/cloud/tasks/v2beta3/cloud_tasks_client.rb +0 -1233
- data/lib/google/cloud/tasks/v2beta3/cloud_tasks_client_config.json +0 -106
- data/lib/google/cloud/tasks/v2beta3/cloudtasks_pb.rb +0 -101
- data/lib/google/cloud/tasks/v2beta3/cloudtasks_services_pb.rb +0 -203
- data/lib/google/cloud/tasks/v2beta3/credentials.rb +0 -41
- data/lib/google/cloud/tasks/v2beta3/doc/google/cloud/tasks/v2beta3/cloudtasks.rb +0 -312
- data/lib/google/cloud/tasks/v2beta3/doc/google/cloud/tasks/v2beta3/queue.rb +0 -342
- data/lib/google/cloud/tasks/v2beta3/doc/google/cloud/tasks/v2beta3/target.rb +0 -431
- data/lib/google/cloud/tasks/v2beta3/doc/google/cloud/tasks/v2beta3/task.rb +0 -177
- data/lib/google/cloud/tasks/v2beta3/doc/google/iam/v1/iam_policy.rb +0 -64
- data/lib/google/cloud/tasks/v2beta3/doc/google/iam/v1/options.rb +0 -33
- data/lib/google/cloud/tasks/v2beta3/doc/google/iam/v1/policy.rb +0 -151
- data/lib/google/cloud/tasks/v2beta3/doc/google/protobuf/any.rb +0 -131
- data/lib/google/cloud/tasks/v2beta3/doc/google/protobuf/duration.rb +0 -91
- data/lib/google/cloud/tasks/v2beta3/doc/google/protobuf/empty.rb +0 -29
- data/lib/google/cloud/tasks/v2beta3/doc/google/protobuf/field_mask.rb +0 -222
- data/lib/google/cloud/tasks/v2beta3/doc/google/protobuf/timestamp.rb +0 -113
- data/lib/google/cloud/tasks/v2beta3/doc/google/rpc/status.rb +0 -39
- data/lib/google/cloud/tasks/v2beta3/doc/google/type/expr.rb +0 -45
- data/lib/google/cloud/tasks/v2beta3/helpers.rb +0 -49
- data/lib/google/cloud/tasks/v2beta3/queue_pb.rb +0 -59
- data/lib/google/cloud/tasks/v2beta3/target_pb.rb +0 -69
- data/lib/google/cloud/tasks/v2beta3/task_pb.rb +0 -52
data/LICENSE
DELETED
@@ -1,201 +0,0 @@
|
|
1
|
-
Apache License
|
2
|
-
Version 2.0, January 2004
|
3
|
-
https://www.apache.org/licenses/
|
4
|
-
|
5
|
-
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
6
|
-
|
7
|
-
1. Definitions.
|
8
|
-
|
9
|
-
"License" shall mean the terms and conditions for use, reproduction,
|
10
|
-
and distribution as defined by Sections 1 through 9 of this document.
|
11
|
-
|
12
|
-
"Licensor" shall mean the copyright owner or entity authorized by
|
13
|
-
the copyright owner that is granting the License.
|
14
|
-
|
15
|
-
"Legal Entity" shall mean the union of the acting entity and all
|
16
|
-
other entities that control, are controlled by, or are under common
|
17
|
-
control with that entity. For the purposes of this definition,
|
18
|
-
"control" means (i) the power, direct or indirect, to cause the
|
19
|
-
direction or management of such entity, whether by contract or
|
20
|
-
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
21
|
-
outstanding shares, or (iii) beneficial ownership of such entity.
|
22
|
-
|
23
|
-
"You" (or "Your") shall mean an individual or Legal Entity
|
24
|
-
exercising permissions granted by this License.
|
25
|
-
|
26
|
-
"Source" form shall mean the preferred form for making modifications,
|
27
|
-
including but not limited to software source code, documentation
|
28
|
-
source, and configuration files.
|
29
|
-
|
30
|
-
"Object" form shall mean any form resulting from mechanical
|
31
|
-
transformation or translation of a Source form, including but
|
32
|
-
not limited to compiled object code, generated documentation,
|
33
|
-
and conversions to other media types.
|
34
|
-
|
35
|
-
"Work" shall mean the work of authorship, whether in Source or
|
36
|
-
Object form, made available under the License, as indicated by a
|
37
|
-
copyright notice that is included in or attached to the work
|
38
|
-
(an example is provided in the Appendix below).
|
39
|
-
|
40
|
-
"Derivative Works" shall mean any work, whether in Source or Object
|
41
|
-
form, that is based on (or derived from) the Work and for which the
|
42
|
-
editorial revisions, annotations, elaborations, or other modifications
|
43
|
-
represent, as a whole, an original work of authorship. For the purposes
|
44
|
-
of this License, Derivative Works shall not include works that remain
|
45
|
-
separable from, or merely link (or bind by name) to the interfaces of,
|
46
|
-
the Work and Derivative Works thereof.
|
47
|
-
|
48
|
-
"Contribution" shall mean any work of authorship, including
|
49
|
-
the original version of the Work and any modifications or additions
|
50
|
-
to that Work or Derivative Works thereof, that is intentionally
|
51
|
-
submitted to Licensor for inclusion in the Work by the copyright owner
|
52
|
-
or by an individual or Legal Entity authorized to submit on behalf of
|
53
|
-
the copyright owner. For the purposes of this definition, "submitted"
|
54
|
-
means any form of electronic, verbal, or written communication sent
|
55
|
-
to the Licensor or its representatives, including but not limited to
|
56
|
-
communication on electronic mailing lists, source code control systems,
|
57
|
-
and issue tracking systems that are managed by, or on behalf of, the
|
58
|
-
Licensor for the purpose of discussing and improving the Work, but
|
59
|
-
excluding communication that is conspicuously marked or otherwise
|
60
|
-
designated in writing by the copyright owner as "Not a Contribution."
|
61
|
-
|
62
|
-
"Contributor" shall mean Licensor and any individual or Legal Entity
|
63
|
-
on behalf of whom a Contribution has been received by Licensor and
|
64
|
-
subsequently incorporated within the Work.
|
65
|
-
|
66
|
-
2. Grant of Copyright License. Subject to the terms and conditions of
|
67
|
-
this License, each Contributor hereby grants to You a perpetual,
|
68
|
-
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
69
|
-
copyright license to reproduce, prepare Derivative Works of,
|
70
|
-
publicly display, publicly perform, sublicense, and distribute the
|
71
|
-
Work and such Derivative Works in Source or Object form.
|
72
|
-
|
73
|
-
3. Grant of Patent License. Subject to the terms and conditions of
|
74
|
-
this License, each Contributor hereby grants to You a perpetual,
|
75
|
-
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
76
|
-
(except as stated in this section) patent license to make, have made,
|
77
|
-
use, offer to sell, sell, import, and otherwise transfer the Work,
|
78
|
-
where such license applies only to those patent claims licensable
|
79
|
-
by such Contributor that are necessarily infringed by their
|
80
|
-
Contribution(s) alone or by combination of their Contribution(s)
|
81
|
-
with the Work to which such Contribution(s) was submitted. If You
|
82
|
-
institute patent litigation against any entity (including a
|
83
|
-
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
84
|
-
or a Contribution incorporated within the Work constitutes direct
|
85
|
-
or contributory patent infringement, then any patent licenses
|
86
|
-
granted to You under this License for that Work shall terminate
|
87
|
-
as of the date such litigation is filed.
|
88
|
-
|
89
|
-
4. Redistribution. You may reproduce and distribute copies of the
|
90
|
-
Work or Derivative Works thereof in any medium, with or without
|
91
|
-
modifications, and in Source or Object form, provided that You
|
92
|
-
meet the following conditions:
|
93
|
-
|
94
|
-
(a) You must give any other recipients of the Work or
|
95
|
-
Derivative Works a copy of this License; and
|
96
|
-
|
97
|
-
(b) You must cause any modified files to carry prominent notices
|
98
|
-
stating that You changed the files; and
|
99
|
-
|
100
|
-
(c) You must retain, in the Source form of any Derivative Works
|
101
|
-
that You distribute, all copyright, patent, trademark, and
|
102
|
-
attribution notices from the Source form of the Work,
|
103
|
-
excluding those notices that do not pertain to any part of
|
104
|
-
the Derivative Works; and
|
105
|
-
|
106
|
-
(d) If the Work includes a "NOTICE" text file as part of its
|
107
|
-
distribution, then any Derivative Works that You distribute must
|
108
|
-
include a readable copy of the attribution notices contained
|
109
|
-
within such NOTICE file, excluding those notices that do not
|
110
|
-
pertain to any part of the Derivative Works, in at least one
|
111
|
-
of the following places: within a NOTICE text file distributed
|
112
|
-
as part of the Derivative Works; within the Source form or
|
113
|
-
documentation, if provided along with the Derivative Works; or,
|
114
|
-
within a display generated by the Derivative Works, if and
|
115
|
-
wherever such third-party notices normally appear. The contents
|
116
|
-
of the NOTICE file are for informational purposes only and
|
117
|
-
do not modify the License. You may add Your own attribution
|
118
|
-
notices within Derivative Works that You distribute, alongside
|
119
|
-
or as an addendum to the NOTICE text from the Work, provided
|
120
|
-
that such additional attribution notices cannot be construed
|
121
|
-
as modifying the License.
|
122
|
-
|
123
|
-
You may add Your own copyright statement to Your modifications and
|
124
|
-
may provide additional or different license terms and conditions
|
125
|
-
for use, reproduction, or distribution of Your modifications, or
|
126
|
-
for any such Derivative Works as a whole, provided Your use,
|
127
|
-
reproduction, and distribution of the Work otherwise complies with
|
128
|
-
the conditions stated in this License.
|
129
|
-
|
130
|
-
5. Submission of Contributions. Unless You explicitly state otherwise,
|
131
|
-
any Contribution intentionally submitted for inclusion in the Work
|
132
|
-
by You to the Licensor shall be under the terms and conditions of
|
133
|
-
this License, without any additional terms or conditions.
|
134
|
-
Notwithstanding the above, nothing herein shall supersede or modify
|
135
|
-
the terms of any separate license agreement you may have executed
|
136
|
-
with Licensor regarding such Contributions.
|
137
|
-
|
138
|
-
6. Trademarks. This License does not grant permission to use the trade
|
139
|
-
names, trademarks, service marks, or product names of the Licensor,
|
140
|
-
except as required for reasonable and customary use in describing the
|
141
|
-
origin of the Work and reproducing the content of the NOTICE file.
|
142
|
-
|
143
|
-
7. Disclaimer of Warranty. Unless required by applicable law or
|
144
|
-
agreed to in writing, Licensor provides the Work (and each
|
145
|
-
Contributor provides its Contributions) on an "AS IS" BASIS,
|
146
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
147
|
-
implied, including, without limitation, any warranties or conditions
|
148
|
-
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
149
|
-
PARTICULAR PURPOSE. You are solely responsible for determining the
|
150
|
-
appropriateness of using or redistributing the Work and assume any
|
151
|
-
risks associated with Your exercise of permissions under this License.
|
152
|
-
|
153
|
-
8. Limitation of Liability. In no event and under no legal theory,
|
154
|
-
whether in tort (including negligence), contract, or otherwise,
|
155
|
-
unless required by applicable law (such as deliberate and grossly
|
156
|
-
negligent acts) or agreed to in writing, shall any Contributor be
|
157
|
-
liable to You for damages, including any direct, indirect, special,
|
158
|
-
incidental, or consequential damages of any character arising as a
|
159
|
-
result of this License or out of the use or inability to use the
|
160
|
-
Work (including but not limited to damages for loss of goodwill,
|
161
|
-
work stoppage, computer failure or malfunction, or any and all
|
162
|
-
other commercial damages or losses), even if such Contributor
|
163
|
-
has been advised of the possibility of such damages.
|
164
|
-
|
165
|
-
9. Accepting Warranty or Additional Liability. While redistributing
|
166
|
-
the Work or Derivative Works thereof, You may choose to offer,
|
167
|
-
and charge a fee for, acceptance of support, warranty, indemnity,
|
168
|
-
or other liability obligations and/or rights consistent with this
|
169
|
-
License. However, in accepting such obligations, You may act only
|
170
|
-
on Your own behalf and on Your sole responsibility, not on behalf
|
171
|
-
of any other Contributor, and only if You agree to indemnify,
|
172
|
-
defend, and hold each Contributor harmless for any liability
|
173
|
-
incurred by, or claims asserted against, such Contributor by reason
|
174
|
-
of your accepting any such warranty or additional liability.
|
175
|
-
|
176
|
-
END OF TERMS AND CONDITIONS
|
177
|
-
|
178
|
-
APPENDIX: How to apply the Apache License to your work.
|
179
|
-
|
180
|
-
To apply the Apache License to your work, attach the following
|
181
|
-
boilerplate notice, with the fields enclosed by brackets "[]"
|
182
|
-
replaced with your own identifying information. (Don't include
|
183
|
-
the brackets!) The text should be enclosed in the appropriate
|
184
|
-
comment syntax for the file format. We also recommend that a
|
185
|
-
file or class name and description of purpose be included on the
|
186
|
-
same "printed page" as the copyright notice for easier
|
187
|
-
identification within third-party archives.
|
188
|
-
|
189
|
-
Copyright [yyyy] [name of copyright owner]
|
190
|
-
|
191
|
-
Licensed under the Apache License, Version 2.0 (the "License");
|
192
|
-
you may not use this file except in compliance with the License.
|
193
|
-
You may obtain a copy of the License at
|
194
|
-
|
195
|
-
https://www.apache.org/licenses/LICENSE-2.0
|
196
|
-
|
197
|
-
Unless required by applicable law or agreed to in writing, software
|
198
|
-
distributed under the License is distributed on an "AS IS" BASIS,
|
199
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
200
|
-
See the License for the specific language governing permissions and
|
201
|
-
limitations under the License.
|
@@ -1,147 +0,0 @@
|
|
1
|
-
# Copyright 2020 Google LLC
|
2
|
-
#
|
3
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
-
# you may not use this file except in compliance with the License.
|
5
|
-
# You may obtain a copy of the License at
|
6
|
-
#
|
7
|
-
# https://www.apache.org/licenses/LICENSE-2.0
|
8
|
-
#
|
9
|
-
# Unless required by applicable law or agreed to in writing, software
|
10
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
-
# See the License for the specific language governing permissions and
|
13
|
-
# limitations under the License.
|
14
|
-
|
15
|
-
|
16
|
-
require "google/cloud/tasks/v2/cloud_tasks_client"
|
17
|
-
require "google/cloud/tasks/v2/helpers"
|
18
|
-
|
19
|
-
module Google
|
20
|
-
module Cloud
|
21
|
-
module Tasks
|
22
|
-
# rubocop:disable LineLength
|
23
|
-
|
24
|
-
##
|
25
|
-
# # Ruby Client for Cloud Tasks API
|
26
|
-
#
|
27
|
-
# [Cloud Tasks API][Product Documentation]:
|
28
|
-
# Manages the execution of large numbers of distributed requests.
|
29
|
-
# - [Product Documentation][]
|
30
|
-
#
|
31
|
-
# ## Quick Start
|
32
|
-
# In order to use this library, you first need to go through the following
|
33
|
-
# steps:
|
34
|
-
#
|
35
|
-
# 1. [Select or create a Cloud Platform project.](https://console.cloud.google.com/project)
|
36
|
-
# 2. [Enable billing for your project.](https://cloud.google.com/billing/docs/how-to/modify-project#enable_billing_for_a_project)
|
37
|
-
# 3. [Enable the Cloud Tasks API.](https://console.cloud.google.com/apis/library/tasks.googleapis.com)
|
38
|
-
# 4. [Setup Authentication.](https://googleapis.dev/ruby/google-cloud-tasks/latest/file.AUTHENTICATION.html)
|
39
|
-
#
|
40
|
-
# ### Installation
|
41
|
-
# ```
|
42
|
-
# $ gem install google-cloud-tasks
|
43
|
-
# ```
|
44
|
-
#
|
45
|
-
# ### Next Steps
|
46
|
-
# - Read the [Cloud Tasks API Product documentation][Product Documentation]
|
47
|
-
# to learn more about the product and see How-to Guides.
|
48
|
-
# - View this [repository's main README](https://github.com/googleapis/google-cloud-ruby/blob/master/README.md)
|
49
|
-
# to see the full list of Cloud APIs that we cover.
|
50
|
-
#
|
51
|
-
# [Product Documentation]: https://cloud.google.com/tasks
|
52
|
-
#
|
53
|
-
# ## Enabling Logging
|
54
|
-
#
|
55
|
-
# To enable logging for this library, set the logger for the underlying [gRPC](https://github.com/grpc/grpc/tree/master/src/ruby) library.
|
56
|
-
# The logger that you set may be a Ruby stdlib [`Logger`](https://ruby-doc.org/stdlib-2.5.0/libdoc/logger/rdoc/Logger.html) as shown below,
|
57
|
-
# or a [`Google::Cloud::Logging::Logger`](https://googleapis.dev/ruby/google-cloud-logging/latest)
|
58
|
-
# that will write logs to [Stackdriver Logging](https://cloud.google.com/logging/). See [grpc/logconfig.rb](https://github.com/grpc/grpc/blob/master/src/ruby/lib/grpc/logconfig.rb)
|
59
|
-
# and the gRPC [spec_helper.rb](https://github.com/grpc/grpc/blob/master/src/ruby/spec/spec_helper.rb) for additional information.
|
60
|
-
#
|
61
|
-
# Configuring a Ruby stdlib logger:
|
62
|
-
#
|
63
|
-
# ```ruby
|
64
|
-
# require "logger"
|
65
|
-
#
|
66
|
-
# module MyLogger
|
67
|
-
# LOGGER = Logger.new $stderr, level: Logger::WARN
|
68
|
-
# def logger
|
69
|
-
# LOGGER
|
70
|
-
# end
|
71
|
-
# end
|
72
|
-
#
|
73
|
-
# # Define a gRPC module-level logger method before grpc/logconfig.rb loads.
|
74
|
-
# module GRPC
|
75
|
-
# extend MyLogger
|
76
|
-
# end
|
77
|
-
# ```
|
78
|
-
#
|
79
|
-
module V2
|
80
|
-
# rubocop:enable LineLength
|
81
|
-
|
82
|
-
##
|
83
|
-
# Cloud Tasks allows developers to manage the execution of background
|
84
|
-
# work in their applications.
|
85
|
-
#
|
86
|
-
# @param credentials [Google::Auth::Credentials, String, Hash, GRPC::Core::Channel, GRPC::Core::ChannelCredentials, Proc]
|
87
|
-
# Provides the means for authenticating requests made by the client. This parameter can
|
88
|
-
# be many types.
|
89
|
-
# A `Google::Auth::Credentials` uses a the properties of its represented keyfile for
|
90
|
-
# authenticating requests made by this client.
|
91
|
-
# A `String` will be treated as the path to the keyfile to be used for the construction of
|
92
|
-
# credentials for this client.
|
93
|
-
# A `Hash` will be treated as the contents of a keyfile to be used for the construction of
|
94
|
-
# credentials for this client.
|
95
|
-
# A `GRPC::Core::Channel` will be used to make calls through.
|
96
|
-
# A `GRPC::Core::ChannelCredentials` for the setting up the RPC client. The channel credentials
|
97
|
-
# should already be composed with a `GRPC::Core::CallCredentials` object.
|
98
|
-
# A `Proc` will be used as an updater_proc for the Grpc channel. The proc transforms the
|
99
|
-
# metadata for requests, generally, to give OAuth credentials.
|
100
|
-
# @param scopes [Array<String>]
|
101
|
-
# The OAuth scopes for this service. This parameter is ignored if
|
102
|
-
# an updater_proc is supplied.
|
103
|
-
# @param client_config [Hash]
|
104
|
-
# A Hash for call options for each method. See
|
105
|
-
# Google::Gax#construct_settings for the structure of
|
106
|
-
# this data. Falls back to the default config if not specified
|
107
|
-
# or the specified config is missing data points.
|
108
|
-
# @param timeout [Numeric]
|
109
|
-
# The default timeout, in seconds, for calls made through this client.
|
110
|
-
# @param metadata [Hash]
|
111
|
-
# Default metadata to be sent with each request. This can be overridden on a per call basis.
|
112
|
-
# @param service_address [String]
|
113
|
-
# Override for the service hostname, or `nil` to leave as the default.
|
114
|
-
# @param service_port [Integer]
|
115
|
-
# Override for the service port, or `nil` to leave as the default.
|
116
|
-
# @param exception_transformer [Proc]
|
117
|
-
# An optional proc that intercepts any exceptions raised during an API call to inject
|
118
|
-
# custom error handling.
|
119
|
-
def self.new \
|
120
|
-
credentials: nil,
|
121
|
-
scopes: nil,
|
122
|
-
client_config: nil,
|
123
|
-
timeout: nil,
|
124
|
-
metadata: nil,
|
125
|
-
service_address: nil,
|
126
|
-
service_port: nil,
|
127
|
-
exception_transformer: nil,
|
128
|
-
lib_name: nil,
|
129
|
-
lib_version: nil
|
130
|
-
kwargs = {
|
131
|
-
credentials: credentials,
|
132
|
-
scopes: scopes,
|
133
|
-
client_config: client_config,
|
134
|
-
timeout: timeout,
|
135
|
-
metadata: metadata,
|
136
|
-
exception_transformer: exception_transformer,
|
137
|
-
lib_name: lib_name,
|
138
|
-
service_address: service_address,
|
139
|
-
service_port: service_port,
|
140
|
-
lib_version: lib_version
|
141
|
-
}.select { |_, v| v != nil }
|
142
|
-
Google::Cloud::Tasks::V2::CloudTasksClient.new(**kwargs)
|
143
|
-
end
|
144
|
-
end
|
145
|
-
end
|
146
|
-
end
|
147
|
-
end
|
@@ -1,1233 +0,0 @@
|
|
1
|
-
# Copyright 2020 Google LLC
|
2
|
-
#
|
3
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
-
# you may not use this file except in compliance with the License.
|
5
|
-
# You may obtain a copy of the License at
|
6
|
-
#
|
7
|
-
# https://www.apache.org/licenses/LICENSE-2.0
|
8
|
-
#
|
9
|
-
# Unless required by applicable law or agreed to in writing, software
|
10
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
-
# See the License for the specific language governing permissions and
|
13
|
-
# limitations under the License.
|
14
|
-
#
|
15
|
-
# EDITING INSTRUCTIONS
|
16
|
-
# This file was generated from the file
|
17
|
-
# https://github.com/googleapis/googleapis/blob/master/google/cloud/tasks/v2/cloudtasks.proto,
|
18
|
-
# and updates to that file get reflected here through a refresh process.
|
19
|
-
# For the short term, the refresh process will only be runnable by Google
|
20
|
-
# engineers.
|
21
|
-
|
22
|
-
|
23
|
-
require "json"
|
24
|
-
require "pathname"
|
25
|
-
|
26
|
-
require "google/gax"
|
27
|
-
|
28
|
-
require "google/cloud/tasks/v2/cloudtasks_pb"
|
29
|
-
require "google/cloud/tasks/v2/credentials"
|
30
|
-
require "google/cloud/tasks/version"
|
31
|
-
|
32
|
-
module Google
|
33
|
-
module Cloud
|
34
|
-
module Tasks
|
35
|
-
module V2
|
36
|
-
# Cloud Tasks allows developers to manage the execution of background
|
37
|
-
# work in their applications.
|
38
|
-
#
|
39
|
-
# @!attribute [r] cloud_tasks_stub
|
40
|
-
# @return [Google::Cloud::Tasks::V2::CloudTasks::Stub]
|
41
|
-
class CloudTasksClient
|
42
|
-
# @private
|
43
|
-
attr_reader :cloud_tasks_stub
|
44
|
-
|
45
|
-
# The default address of the service.
|
46
|
-
SERVICE_ADDRESS = "cloudtasks.googleapis.com".freeze
|
47
|
-
|
48
|
-
# The default port of the service.
|
49
|
-
DEFAULT_SERVICE_PORT = 443
|
50
|
-
|
51
|
-
# The default set of gRPC interceptors.
|
52
|
-
GRPC_INTERCEPTORS = []
|
53
|
-
|
54
|
-
DEFAULT_TIMEOUT = 30
|
55
|
-
|
56
|
-
PAGE_DESCRIPTORS = {
|
57
|
-
"list_queues" => Google::Gax::PageDescriptor.new(
|
58
|
-
"page_token",
|
59
|
-
"next_page_token",
|
60
|
-
"queues"),
|
61
|
-
"list_tasks" => Google::Gax::PageDescriptor.new(
|
62
|
-
"page_token",
|
63
|
-
"next_page_token",
|
64
|
-
"tasks")
|
65
|
-
}.freeze
|
66
|
-
|
67
|
-
private_constant :PAGE_DESCRIPTORS
|
68
|
-
|
69
|
-
# The scopes needed to make gRPC calls to all of the methods defined in
|
70
|
-
# this service.
|
71
|
-
ALL_SCOPES = [
|
72
|
-
"https://www.googleapis.com/auth/cloud-platform"
|
73
|
-
].freeze
|
74
|
-
|
75
|
-
|
76
|
-
LOCATION_PATH_TEMPLATE = Google::Gax::PathTemplate.new(
|
77
|
-
"projects/{project}/locations/{location}"
|
78
|
-
)
|
79
|
-
|
80
|
-
private_constant :LOCATION_PATH_TEMPLATE
|
81
|
-
|
82
|
-
QUEUE_PATH_TEMPLATE = Google::Gax::PathTemplate.new(
|
83
|
-
"projects/{project}/locations/{location}/queues/{queue}"
|
84
|
-
)
|
85
|
-
|
86
|
-
private_constant :QUEUE_PATH_TEMPLATE
|
87
|
-
|
88
|
-
TASK_PATH_TEMPLATE = Google::Gax::PathTemplate.new(
|
89
|
-
"projects/{project}/locations/{location}/queues/{queue}/tasks/{task}"
|
90
|
-
)
|
91
|
-
|
92
|
-
private_constant :TASK_PATH_TEMPLATE
|
93
|
-
|
94
|
-
# Returns a fully-qualified location resource name string.
|
95
|
-
# @param project [String]
|
96
|
-
# @param location [String]
|
97
|
-
# @return [String]
|
98
|
-
def self.location_path project, location
|
99
|
-
LOCATION_PATH_TEMPLATE.render(
|
100
|
-
:"project" => project,
|
101
|
-
:"location" => location
|
102
|
-
)
|
103
|
-
end
|
104
|
-
|
105
|
-
# Returns a fully-qualified queue resource name string.
|
106
|
-
# @param project [String]
|
107
|
-
# @param location [String]
|
108
|
-
# @param queue [String]
|
109
|
-
# @return [String]
|
110
|
-
def self.queue_path project, location, queue
|
111
|
-
QUEUE_PATH_TEMPLATE.render(
|
112
|
-
:"project" => project,
|
113
|
-
:"location" => location,
|
114
|
-
:"queue" => queue
|
115
|
-
)
|
116
|
-
end
|
117
|
-
|
118
|
-
# Returns a fully-qualified task resource name string.
|
119
|
-
# @param project [String]
|
120
|
-
# @param location [String]
|
121
|
-
# @param queue [String]
|
122
|
-
# @param task [String]
|
123
|
-
# @return [String]
|
124
|
-
def self.task_path project, location, queue, task
|
125
|
-
TASK_PATH_TEMPLATE.render(
|
126
|
-
:"project" => project,
|
127
|
-
:"location" => location,
|
128
|
-
:"queue" => queue,
|
129
|
-
:"task" => task
|
130
|
-
)
|
131
|
-
end
|
132
|
-
|
133
|
-
# @param credentials [Google::Auth::Credentials, String, Hash, GRPC::Core::Channel, GRPC::Core::ChannelCredentials, Proc]
|
134
|
-
# Provides the means for authenticating requests made by the client. This parameter can
|
135
|
-
# be many types.
|
136
|
-
# A `Google::Auth::Credentials` uses a the properties of its represented keyfile for
|
137
|
-
# authenticating requests made by this client.
|
138
|
-
# A `String` will be treated as the path to the keyfile to be used for the construction of
|
139
|
-
# credentials for this client.
|
140
|
-
# A `Hash` will be treated as the contents of a keyfile to be used for the construction of
|
141
|
-
# credentials for this client.
|
142
|
-
# A `GRPC::Core::Channel` will be used to make calls through.
|
143
|
-
# A `GRPC::Core::ChannelCredentials` for the setting up the RPC client. The channel credentials
|
144
|
-
# should already be composed with a `GRPC::Core::CallCredentials` object.
|
145
|
-
# A `Proc` will be used as an updater_proc for the Grpc channel. The proc transforms the
|
146
|
-
# metadata for requests, generally, to give OAuth credentials.
|
147
|
-
# @param scopes [Array<String>]
|
148
|
-
# The OAuth scopes for this service. This parameter is ignored if
|
149
|
-
# an updater_proc is supplied.
|
150
|
-
# @param client_config [Hash]
|
151
|
-
# A Hash for call options for each method. See
|
152
|
-
# Google::Gax#construct_settings for the structure of
|
153
|
-
# this data. Falls back to the default config if not specified
|
154
|
-
# or the specified config is missing data points.
|
155
|
-
# @param timeout [Numeric]
|
156
|
-
# The default timeout, in seconds, for calls made through this client.
|
157
|
-
# @param metadata [Hash]
|
158
|
-
# Default metadata to be sent with each request. This can be overridden on a per call basis.
|
159
|
-
# @param service_address [String]
|
160
|
-
# Override for the service hostname, or `nil` to leave as the default.
|
161
|
-
# @param service_port [Integer]
|
162
|
-
# Override for the service port, or `nil` to leave as the default.
|
163
|
-
# @param exception_transformer [Proc]
|
164
|
-
# An optional proc that intercepts any exceptions raised during an API call to inject
|
165
|
-
# custom error handling.
|
166
|
-
def initialize \
|
167
|
-
credentials: nil,
|
168
|
-
scopes: ALL_SCOPES,
|
169
|
-
client_config: {},
|
170
|
-
timeout: DEFAULT_TIMEOUT,
|
171
|
-
metadata: nil,
|
172
|
-
service_address: nil,
|
173
|
-
service_port: nil,
|
174
|
-
exception_transformer: nil,
|
175
|
-
lib_name: nil,
|
176
|
-
lib_version: ""
|
177
|
-
# These require statements are intentionally placed here to initialize
|
178
|
-
# the gRPC module only when it's required.
|
179
|
-
# See https://github.com/googleapis/toolkit/issues/446
|
180
|
-
require "google/gax/grpc"
|
181
|
-
require "google/cloud/tasks/v2/cloudtasks_services_pb"
|
182
|
-
|
183
|
-
credentials ||= Google::Cloud::Tasks::V2::Credentials.default
|
184
|
-
|
185
|
-
if credentials.is_a?(String) || credentials.is_a?(Hash)
|
186
|
-
updater_proc = Google::Cloud::Tasks::V2::Credentials.new(credentials).updater_proc
|
187
|
-
end
|
188
|
-
if credentials.is_a?(GRPC::Core::Channel)
|
189
|
-
channel = credentials
|
190
|
-
end
|
191
|
-
if credentials.is_a?(GRPC::Core::ChannelCredentials)
|
192
|
-
chan_creds = credentials
|
193
|
-
end
|
194
|
-
if credentials.is_a?(Proc)
|
195
|
-
updater_proc = credentials
|
196
|
-
end
|
197
|
-
if credentials.is_a?(Google::Auth::Credentials)
|
198
|
-
updater_proc = credentials.updater_proc
|
199
|
-
end
|
200
|
-
|
201
|
-
package_version = Google::Cloud::Tasks::VERSION
|
202
|
-
|
203
|
-
google_api_client = "gl-ruby/#{RUBY_VERSION}"
|
204
|
-
google_api_client << " #{lib_name}/#{lib_version}" if lib_name
|
205
|
-
google_api_client << " gapic/#{package_version} gax/#{Google::Gax::VERSION}"
|
206
|
-
google_api_client << " grpc/#{GRPC::VERSION}"
|
207
|
-
google_api_client.freeze
|
208
|
-
|
209
|
-
headers = { :"x-goog-api-client" => google_api_client }
|
210
|
-
if credentials.respond_to?(:quota_project_id) && credentials.quota_project_id
|
211
|
-
headers[:"x-goog-user-project"] = credentials.quota_project_id
|
212
|
-
end
|
213
|
-
headers.merge!(metadata) unless metadata.nil?
|
214
|
-
client_config_file = Pathname.new(__dir__).join(
|
215
|
-
"cloud_tasks_client_config.json"
|
216
|
-
)
|
217
|
-
defaults = client_config_file.open do |f|
|
218
|
-
Google::Gax.construct_settings(
|
219
|
-
"google.cloud.tasks.v2.CloudTasks",
|
220
|
-
JSON.parse(f.read),
|
221
|
-
client_config,
|
222
|
-
Google::Gax::Grpc::STATUS_CODE_NAMES,
|
223
|
-
timeout,
|
224
|
-
page_descriptors: PAGE_DESCRIPTORS,
|
225
|
-
errors: Google::Gax::Grpc::API_ERRORS,
|
226
|
-
metadata: headers
|
227
|
-
)
|
228
|
-
end
|
229
|
-
|
230
|
-
# Allow overriding the service path/port in subclasses.
|
231
|
-
service_path = service_address || self.class::SERVICE_ADDRESS
|
232
|
-
port = service_port || self.class::DEFAULT_SERVICE_PORT
|
233
|
-
interceptors = self.class::GRPC_INTERCEPTORS
|
234
|
-
@cloud_tasks_stub = Google::Gax::Grpc.create_stub(
|
235
|
-
service_path,
|
236
|
-
port,
|
237
|
-
chan_creds: chan_creds,
|
238
|
-
channel: channel,
|
239
|
-
updater_proc: updater_proc,
|
240
|
-
scopes: scopes,
|
241
|
-
interceptors: interceptors,
|
242
|
-
&Google::Cloud::Tasks::V2::CloudTasks::Stub.method(:new)
|
243
|
-
)
|
244
|
-
|
245
|
-
@list_queues = Google::Gax.create_api_call(
|
246
|
-
@cloud_tasks_stub.method(:list_queues),
|
247
|
-
defaults["list_queues"],
|
248
|
-
exception_transformer: exception_transformer,
|
249
|
-
params_extractor: proc do |request|
|
250
|
-
{'parent' => request.parent}
|
251
|
-
end
|
252
|
-
)
|
253
|
-
@get_queue = Google::Gax.create_api_call(
|
254
|
-
@cloud_tasks_stub.method(:get_queue),
|
255
|
-
defaults["get_queue"],
|
256
|
-
exception_transformer: exception_transformer,
|
257
|
-
params_extractor: proc do |request|
|
258
|
-
{'name' => request.name}
|
259
|
-
end
|
260
|
-
)
|
261
|
-
@create_queue = Google::Gax.create_api_call(
|
262
|
-
@cloud_tasks_stub.method(:create_queue),
|
263
|
-
defaults["create_queue"],
|
264
|
-
exception_transformer: exception_transformer,
|
265
|
-
params_extractor: proc do |request|
|
266
|
-
{'parent' => request.parent}
|
267
|
-
end
|
268
|
-
)
|
269
|
-
@update_queue = Google::Gax.create_api_call(
|
270
|
-
@cloud_tasks_stub.method(:update_queue),
|
271
|
-
defaults["update_queue"],
|
272
|
-
exception_transformer: exception_transformer,
|
273
|
-
params_extractor: proc do |request|
|
274
|
-
{'queue.name' => request.queue.name}
|
275
|
-
end
|
276
|
-
)
|
277
|
-
@delete_queue = Google::Gax.create_api_call(
|
278
|
-
@cloud_tasks_stub.method(:delete_queue),
|
279
|
-
defaults["delete_queue"],
|
280
|
-
exception_transformer: exception_transformer,
|
281
|
-
params_extractor: proc do |request|
|
282
|
-
{'name' => request.name}
|
283
|
-
end
|
284
|
-
)
|
285
|
-
@purge_queue = Google::Gax.create_api_call(
|
286
|
-
@cloud_tasks_stub.method(:purge_queue),
|
287
|
-
defaults["purge_queue"],
|
288
|
-
exception_transformer: exception_transformer,
|
289
|
-
params_extractor: proc do |request|
|
290
|
-
{'name' => request.name}
|
291
|
-
end
|
292
|
-
)
|
293
|
-
@pause_queue = Google::Gax.create_api_call(
|
294
|
-
@cloud_tasks_stub.method(:pause_queue),
|
295
|
-
defaults["pause_queue"],
|
296
|
-
exception_transformer: exception_transformer,
|
297
|
-
params_extractor: proc do |request|
|
298
|
-
{'name' => request.name}
|
299
|
-
end
|
300
|
-
)
|
301
|
-
@resume_queue = Google::Gax.create_api_call(
|
302
|
-
@cloud_tasks_stub.method(:resume_queue),
|
303
|
-
defaults["resume_queue"],
|
304
|
-
exception_transformer: exception_transformer,
|
305
|
-
params_extractor: proc do |request|
|
306
|
-
{'name' => request.name}
|
307
|
-
end
|
308
|
-
)
|
309
|
-
@get_iam_policy = Google::Gax.create_api_call(
|
310
|
-
@cloud_tasks_stub.method(:get_iam_policy),
|
311
|
-
defaults["get_iam_policy"],
|
312
|
-
exception_transformer: exception_transformer,
|
313
|
-
params_extractor: proc do |request|
|
314
|
-
{'resource' => request.resource}
|
315
|
-
end
|
316
|
-
)
|
317
|
-
@set_iam_policy = Google::Gax.create_api_call(
|
318
|
-
@cloud_tasks_stub.method(:set_iam_policy),
|
319
|
-
defaults["set_iam_policy"],
|
320
|
-
exception_transformer: exception_transformer,
|
321
|
-
params_extractor: proc do |request|
|
322
|
-
{'resource' => request.resource}
|
323
|
-
end
|
324
|
-
)
|
325
|
-
@test_iam_permissions = Google::Gax.create_api_call(
|
326
|
-
@cloud_tasks_stub.method(:test_iam_permissions),
|
327
|
-
defaults["test_iam_permissions"],
|
328
|
-
exception_transformer: exception_transformer,
|
329
|
-
params_extractor: proc do |request|
|
330
|
-
{'resource' => request.resource}
|
331
|
-
end
|
332
|
-
)
|
333
|
-
@list_tasks = Google::Gax.create_api_call(
|
334
|
-
@cloud_tasks_stub.method(:list_tasks),
|
335
|
-
defaults["list_tasks"],
|
336
|
-
exception_transformer: exception_transformer,
|
337
|
-
params_extractor: proc do |request|
|
338
|
-
{'parent' => request.parent}
|
339
|
-
end
|
340
|
-
)
|
341
|
-
@get_task = Google::Gax.create_api_call(
|
342
|
-
@cloud_tasks_stub.method(:get_task),
|
343
|
-
defaults["get_task"],
|
344
|
-
exception_transformer: exception_transformer,
|
345
|
-
params_extractor: proc do |request|
|
346
|
-
{'name' => request.name}
|
347
|
-
end
|
348
|
-
)
|
349
|
-
@create_task = Google::Gax.create_api_call(
|
350
|
-
@cloud_tasks_stub.method(:create_task),
|
351
|
-
defaults["create_task"],
|
352
|
-
exception_transformer: exception_transformer,
|
353
|
-
params_extractor: proc do |request|
|
354
|
-
{'parent' => request.parent}
|
355
|
-
end
|
356
|
-
)
|
357
|
-
@delete_task = Google::Gax.create_api_call(
|
358
|
-
@cloud_tasks_stub.method(:delete_task),
|
359
|
-
defaults["delete_task"],
|
360
|
-
exception_transformer: exception_transformer,
|
361
|
-
params_extractor: proc do |request|
|
362
|
-
{'name' => request.name}
|
363
|
-
end
|
364
|
-
)
|
365
|
-
@run_task = Google::Gax.create_api_call(
|
366
|
-
@cloud_tasks_stub.method(:run_task),
|
367
|
-
defaults["run_task"],
|
368
|
-
exception_transformer: exception_transformer,
|
369
|
-
params_extractor: proc do |request|
|
370
|
-
{'name' => request.name}
|
371
|
-
end
|
372
|
-
)
|
373
|
-
end
|
374
|
-
|
375
|
-
# Service calls
|
376
|
-
|
377
|
-
# Lists queues.
|
378
|
-
#
|
379
|
-
# Queues are returned in lexicographical order.
|
380
|
-
#
|
381
|
-
# @param parent [String]
|
382
|
-
# Required. The location name.
|
383
|
-
# For example: `projects/PROJECT_ID/locations/LOCATION_ID`
|
384
|
-
# @param filter [String]
|
385
|
-
# `filter` can be used to specify a subset of queues. Any {Google::Cloud::Tasks::V2::Queue Queue}
|
386
|
-
# field can be used as a filter and several operators as supported.
|
387
|
-
# For example: `<=, <, >=, >, !=, =, :`. The filter syntax is the same as
|
388
|
-
# described in
|
389
|
-
# [Stackdriver's Advanced Logs
|
390
|
-
# Filters](https://cloud.google.com/logging/docs/view/advanced_filters).
|
391
|
-
#
|
392
|
-
# Sample filter "state: PAUSED".
|
393
|
-
#
|
394
|
-
# Note that using filters might cause fewer queues than the
|
395
|
-
# requested page_size to be returned.
|
396
|
-
# @param page_size [Integer]
|
397
|
-
# The maximum number of resources contained in the underlying API
|
398
|
-
# response. If page streaming is performed per-resource, this
|
399
|
-
# parameter does not affect the return value. If page streaming is
|
400
|
-
# performed per-page, this determines the maximum number of
|
401
|
-
# resources in a page.
|
402
|
-
# @param options [Google::Gax::CallOptions]
|
403
|
-
# Overrides the default settings for this call, e.g, timeout,
|
404
|
-
# retries, etc.
|
405
|
-
# @yield [result, operation] Access the result along with the RPC operation
|
406
|
-
# @yieldparam result [Google::Gax::PagedEnumerable<Google::Cloud::Tasks::V2::Queue>]
|
407
|
-
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
408
|
-
# @return [Google::Gax::PagedEnumerable<Google::Cloud::Tasks::V2::Queue>]
|
409
|
-
# An enumerable of Google::Cloud::Tasks::V2::Queue instances.
|
410
|
-
# See Google::Gax::PagedEnumerable documentation for other
|
411
|
-
# operations such as per-page iteration or access to the response
|
412
|
-
# object.
|
413
|
-
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
414
|
-
# @example
|
415
|
-
# require "google/cloud/tasks"
|
416
|
-
#
|
417
|
-
# cloud_tasks_client = Google::Cloud::Tasks.new(version: :v2)
|
418
|
-
# formatted_parent = Google::Cloud::Tasks::V2::CloudTasksClient.location_path("[PROJECT]", "[LOCATION]")
|
419
|
-
#
|
420
|
-
# # Iterate over all results.
|
421
|
-
# cloud_tasks_client.list_queues(formatted_parent).each do |element|
|
422
|
-
# # Process element.
|
423
|
-
# end
|
424
|
-
#
|
425
|
-
# # Or iterate over results one page at a time.
|
426
|
-
# cloud_tasks_client.list_queues(formatted_parent).each_page do |page|
|
427
|
-
# # Process each page at a time.
|
428
|
-
# page.each do |element|
|
429
|
-
# # Process element.
|
430
|
-
# end
|
431
|
-
# end
|
432
|
-
|
433
|
-
def list_queues \
|
434
|
-
parent,
|
435
|
-
filter: nil,
|
436
|
-
page_size: nil,
|
437
|
-
options: nil,
|
438
|
-
&block
|
439
|
-
req = {
|
440
|
-
parent: parent,
|
441
|
-
filter: filter,
|
442
|
-
page_size: page_size
|
443
|
-
}.delete_if { |_, v| v.nil? }
|
444
|
-
req = Google::Gax::to_proto(req, Google::Cloud::Tasks::V2::ListQueuesRequest)
|
445
|
-
@list_queues.call(req, options, &block)
|
446
|
-
end
|
447
|
-
|
448
|
-
# Gets a queue.
|
449
|
-
#
|
450
|
-
# @param name [String]
|
451
|
-
# Required. The resource name of the queue. For example:
|
452
|
-
# `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID`
|
453
|
-
# @param options [Google::Gax::CallOptions]
|
454
|
-
# Overrides the default settings for this call, e.g, timeout,
|
455
|
-
# retries, etc.
|
456
|
-
# @yield [result, operation] Access the result along with the RPC operation
|
457
|
-
# @yieldparam result [Google::Cloud::Tasks::V2::Queue]
|
458
|
-
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
459
|
-
# @return [Google::Cloud::Tasks::V2::Queue]
|
460
|
-
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
461
|
-
# @example
|
462
|
-
# require "google/cloud/tasks"
|
463
|
-
#
|
464
|
-
# cloud_tasks_client = Google::Cloud::Tasks.new(version: :v2)
|
465
|
-
# formatted_name = Google::Cloud::Tasks::V2::CloudTasksClient.queue_path("[PROJECT]", "[LOCATION]", "[QUEUE]")
|
466
|
-
# response = cloud_tasks_client.get_queue(formatted_name)
|
467
|
-
|
468
|
-
def get_queue \
|
469
|
-
name,
|
470
|
-
options: nil,
|
471
|
-
&block
|
472
|
-
req = {
|
473
|
-
name: name
|
474
|
-
}.delete_if { |_, v| v.nil? }
|
475
|
-
req = Google::Gax::to_proto(req, Google::Cloud::Tasks::V2::GetQueueRequest)
|
476
|
-
@get_queue.call(req, options, &block)
|
477
|
-
end
|
478
|
-
|
479
|
-
# Creates a queue.
|
480
|
-
#
|
481
|
-
# Queues created with this method allow tasks to live for a maximum of 31
|
482
|
-
# days. After a task is 31 days old, the task will be deleted regardless of whether
|
483
|
-
# it was dispatched or not.
|
484
|
-
#
|
485
|
-
# WARNING: Using this method may have unintended side effects if you are
|
486
|
-
# using an App Engine `queue.yaml` or `queue.xml` file to manage your queues.
|
487
|
-
# Read
|
488
|
-
# [Overview of Queue Management and
|
489
|
-
# queue.yaml](https://cloud.google.com/tasks/docs/queue-yaml) before using
|
490
|
-
# this method.
|
491
|
-
#
|
492
|
-
# @param parent [String]
|
493
|
-
# Required. The location name in which the queue will be created.
|
494
|
-
# For example: `projects/PROJECT_ID/locations/LOCATION_ID`
|
495
|
-
#
|
496
|
-
# The list of allowed locations can be obtained by calling Cloud
|
497
|
-
# Tasks' implementation of
|
498
|
-
# {Google::Cloud::Location::Locations::ListLocations ListLocations}.
|
499
|
-
# @param queue [Google::Cloud::Tasks::V2::Queue | Hash]
|
500
|
-
# Required. The queue to create.
|
501
|
-
#
|
502
|
-
# {Google::Cloud::Tasks::V2::Queue#name Queue's name} cannot be the same as an existing queue.
|
503
|
-
# A hash of the same form as `Google::Cloud::Tasks::V2::Queue`
|
504
|
-
# can also be provided.
|
505
|
-
# @param options [Google::Gax::CallOptions]
|
506
|
-
# Overrides the default settings for this call, e.g, timeout,
|
507
|
-
# retries, etc.
|
508
|
-
# @yield [result, operation] Access the result along with the RPC operation
|
509
|
-
# @yieldparam result [Google::Cloud::Tasks::V2::Queue]
|
510
|
-
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
511
|
-
# @return [Google::Cloud::Tasks::V2::Queue]
|
512
|
-
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
513
|
-
# @example
|
514
|
-
# require "google/cloud/tasks"
|
515
|
-
#
|
516
|
-
# cloud_tasks_client = Google::Cloud::Tasks.new(version: :v2)
|
517
|
-
# formatted_parent = Google::Cloud::Tasks::V2::CloudTasksClient.location_path("[PROJECT]", "[LOCATION]")
|
518
|
-
#
|
519
|
-
# # TODO: Initialize `queue`:
|
520
|
-
# queue = {}
|
521
|
-
# response = cloud_tasks_client.create_queue(formatted_parent, queue)
|
522
|
-
|
523
|
-
def create_queue \
|
524
|
-
parent,
|
525
|
-
queue,
|
526
|
-
options: nil,
|
527
|
-
&block
|
528
|
-
req = {
|
529
|
-
parent: parent,
|
530
|
-
queue: queue
|
531
|
-
}.delete_if { |_, v| v.nil? }
|
532
|
-
req = Google::Gax::to_proto(req, Google::Cloud::Tasks::V2::CreateQueueRequest)
|
533
|
-
@create_queue.call(req, options, &block)
|
534
|
-
end
|
535
|
-
|
536
|
-
# Updates a queue.
|
537
|
-
#
|
538
|
-
# This method creates the queue if it does not exist and updates
|
539
|
-
# the queue if it does exist.
|
540
|
-
#
|
541
|
-
# Queues created with this method allow tasks to live for a maximum of 31
|
542
|
-
# days. After a task is 31 days old, the task will be deleted regardless of whether
|
543
|
-
# it was dispatched or not.
|
544
|
-
#
|
545
|
-
# WARNING: Using this method may have unintended side effects if you are
|
546
|
-
# using an App Engine `queue.yaml` or `queue.xml` file to manage your queues.
|
547
|
-
# Read
|
548
|
-
# [Overview of Queue Management and
|
549
|
-
# queue.yaml](https://cloud.google.com/tasks/docs/queue-yaml) before using
|
550
|
-
# this method.
|
551
|
-
#
|
552
|
-
# @param queue [Google::Cloud::Tasks::V2::Queue | Hash]
|
553
|
-
# Required. The queue to create or update.
|
554
|
-
#
|
555
|
-
# The queue's {Google::Cloud::Tasks::V2::Queue#name name} must be specified.
|
556
|
-
#
|
557
|
-
# Output only fields cannot be modified using UpdateQueue.
|
558
|
-
# Any value specified for an output only field will be ignored.
|
559
|
-
# The queue's {Google::Cloud::Tasks::V2::Queue#name name} cannot be changed.
|
560
|
-
# A hash of the same form as `Google::Cloud::Tasks::V2::Queue`
|
561
|
-
# can also be provided.
|
562
|
-
# @param update_mask [Google::Protobuf::FieldMask | Hash]
|
563
|
-
# A mask used to specify which fields of the queue are being updated.
|
564
|
-
#
|
565
|
-
# If empty, then all fields will be updated.
|
566
|
-
# A hash of the same form as `Google::Protobuf::FieldMask`
|
567
|
-
# can also be provided.
|
568
|
-
# @param options [Google::Gax::CallOptions]
|
569
|
-
# Overrides the default settings for this call, e.g, timeout,
|
570
|
-
# retries, etc.
|
571
|
-
# @yield [result, operation] Access the result along with the RPC operation
|
572
|
-
# @yieldparam result [Google::Cloud::Tasks::V2::Queue]
|
573
|
-
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
574
|
-
# @return [Google::Cloud::Tasks::V2::Queue]
|
575
|
-
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
576
|
-
# @example
|
577
|
-
# require "google/cloud/tasks"
|
578
|
-
#
|
579
|
-
# cloud_tasks_client = Google::Cloud::Tasks.new(version: :v2)
|
580
|
-
#
|
581
|
-
# # TODO: Initialize `queue`:
|
582
|
-
# queue = {}
|
583
|
-
# response = cloud_tasks_client.update_queue(queue)
|
584
|
-
|
585
|
-
def update_queue \
|
586
|
-
queue,
|
587
|
-
update_mask: nil,
|
588
|
-
options: nil,
|
589
|
-
&block
|
590
|
-
req = {
|
591
|
-
queue: queue,
|
592
|
-
update_mask: update_mask
|
593
|
-
}.delete_if { |_, v| v.nil? }
|
594
|
-
req = Google::Gax::to_proto(req, Google::Cloud::Tasks::V2::UpdateQueueRequest)
|
595
|
-
@update_queue.call(req, options, &block)
|
596
|
-
end
|
597
|
-
|
598
|
-
# Deletes a queue.
|
599
|
-
#
|
600
|
-
# This command will delete the queue even if it has tasks in it.
|
601
|
-
#
|
602
|
-
# Note: If you delete a queue, a queue with the same name can't be created
|
603
|
-
# for 7 days.
|
604
|
-
#
|
605
|
-
# WARNING: Using this method may have unintended side effects if you are
|
606
|
-
# using an App Engine `queue.yaml` or `queue.xml` file to manage your queues.
|
607
|
-
# Read
|
608
|
-
# [Overview of Queue Management and
|
609
|
-
# queue.yaml](https://cloud.google.com/tasks/docs/queue-yaml) before using
|
610
|
-
# this method.
|
611
|
-
#
|
612
|
-
# @param name [String]
|
613
|
-
# Required. The queue name. For example:
|
614
|
-
# `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID`
|
615
|
-
# @param options [Google::Gax::CallOptions]
|
616
|
-
# Overrides the default settings for this call, e.g, timeout,
|
617
|
-
# retries, etc.
|
618
|
-
# @yield [result, operation] Access the result along with the RPC operation
|
619
|
-
# @yieldparam result []
|
620
|
-
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
621
|
-
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
622
|
-
# @example
|
623
|
-
# require "google/cloud/tasks"
|
624
|
-
#
|
625
|
-
# cloud_tasks_client = Google::Cloud::Tasks.new(version: :v2)
|
626
|
-
# formatted_name = Google::Cloud::Tasks::V2::CloudTasksClient.queue_path("[PROJECT]", "[LOCATION]", "[QUEUE]")
|
627
|
-
# cloud_tasks_client.delete_queue(formatted_name)
|
628
|
-
|
629
|
-
def delete_queue \
|
630
|
-
name,
|
631
|
-
options: nil,
|
632
|
-
&block
|
633
|
-
req = {
|
634
|
-
name: name
|
635
|
-
}.delete_if { |_, v| v.nil? }
|
636
|
-
req = Google::Gax::to_proto(req, Google::Cloud::Tasks::V2::DeleteQueueRequest)
|
637
|
-
@delete_queue.call(req, options, &block)
|
638
|
-
nil
|
639
|
-
end
|
640
|
-
|
641
|
-
# Purges a queue by deleting all of its tasks.
|
642
|
-
#
|
643
|
-
# All tasks created before this method is called are permanently deleted.
|
644
|
-
#
|
645
|
-
# Purge operations can take up to one minute to take effect. Tasks
|
646
|
-
# might be dispatched before the purge takes effect. A purge is irreversible.
|
647
|
-
#
|
648
|
-
# @param name [String]
|
649
|
-
# Required. The queue name. For example:
|
650
|
-
# `projects/PROJECT_ID/location/LOCATION_ID/queues/QUEUE_ID`
|
651
|
-
# @param options [Google::Gax::CallOptions]
|
652
|
-
# Overrides the default settings for this call, e.g, timeout,
|
653
|
-
# retries, etc.
|
654
|
-
# @yield [result, operation] Access the result along with the RPC operation
|
655
|
-
# @yieldparam result [Google::Cloud::Tasks::V2::Queue]
|
656
|
-
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
657
|
-
# @return [Google::Cloud::Tasks::V2::Queue]
|
658
|
-
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
659
|
-
# @example
|
660
|
-
# require "google/cloud/tasks"
|
661
|
-
#
|
662
|
-
# cloud_tasks_client = Google::Cloud::Tasks.new(version: :v2)
|
663
|
-
# formatted_name = Google::Cloud::Tasks::V2::CloudTasksClient.queue_path("[PROJECT]", "[LOCATION]", "[QUEUE]")
|
664
|
-
# response = cloud_tasks_client.purge_queue(formatted_name)
|
665
|
-
|
666
|
-
def purge_queue \
|
667
|
-
name,
|
668
|
-
options: nil,
|
669
|
-
&block
|
670
|
-
req = {
|
671
|
-
name: name
|
672
|
-
}.delete_if { |_, v| v.nil? }
|
673
|
-
req = Google::Gax::to_proto(req, Google::Cloud::Tasks::V2::PurgeQueueRequest)
|
674
|
-
@purge_queue.call(req, options, &block)
|
675
|
-
end
|
676
|
-
|
677
|
-
# Pauses the queue.
|
678
|
-
#
|
679
|
-
# If a queue is paused then the system will stop dispatching tasks
|
680
|
-
# until the queue is resumed via
|
681
|
-
# {Google::Cloud::Tasks::V2::CloudTasks::ResumeQueue ResumeQueue}. Tasks can still be added
|
682
|
-
# when the queue is paused. A queue is paused if its
|
683
|
-
# {Google::Cloud::Tasks::V2::Queue#state state} is {Google::Cloud::Tasks::V2::Queue::State::PAUSED PAUSED}.
|
684
|
-
#
|
685
|
-
# @param name [String]
|
686
|
-
# Required. The queue name. For example:
|
687
|
-
# `projects/PROJECT_ID/location/LOCATION_ID/queues/QUEUE_ID`
|
688
|
-
# @param options [Google::Gax::CallOptions]
|
689
|
-
# Overrides the default settings for this call, e.g, timeout,
|
690
|
-
# retries, etc.
|
691
|
-
# @yield [result, operation] Access the result along with the RPC operation
|
692
|
-
# @yieldparam result [Google::Cloud::Tasks::V2::Queue]
|
693
|
-
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
694
|
-
# @return [Google::Cloud::Tasks::V2::Queue]
|
695
|
-
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
696
|
-
# @example
|
697
|
-
# require "google/cloud/tasks"
|
698
|
-
#
|
699
|
-
# cloud_tasks_client = Google::Cloud::Tasks.new(version: :v2)
|
700
|
-
# formatted_name = Google::Cloud::Tasks::V2::CloudTasksClient.queue_path("[PROJECT]", "[LOCATION]", "[QUEUE]")
|
701
|
-
# response = cloud_tasks_client.pause_queue(formatted_name)
|
702
|
-
|
703
|
-
def pause_queue \
|
704
|
-
name,
|
705
|
-
options: nil,
|
706
|
-
&block
|
707
|
-
req = {
|
708
|
-
name: name
|
709
|
-
}.delete_if { |_, v| v.nil? }
|
710
|
-
req = Google::Gax::to_proto(req, Google::Cloud::Tasks::V2::PauseQueueRequest)
|
711
|
-
@pause_queue.call(req, options, &block)
|
712
|
-
end
|
713
|
-
|
714
|
-
# Resume a queue.
|
715
|
-
#
|
716
|
-
# This method resumes a queue after it has been
|
717
|
-
# {Google::Cloud::Tasks::V2::Queue::State::PAUSED PAUSED} or
|
718
|
-
# {Google::Cloud::Tasks::V2::Queue::State::DISABLED DISABLED}. The state of a queue is stored
|
719
|
-
# in the queue's {Google::Cloud::Tasks::V2::Queue#state state}; after calling this method it
|
720
|
-
# will be set to {Google::Cloud::Tasks::V2::Queue::State::RUNNING RUNNING}.
|
721
|
-
#
|
722
|
-
# WARNING: Resuming many high-QPS queues at the same time can
|
723
|
-
# lead to target overloading. If you are resuming high-QPS
|
724
|
-
# queues, follow the 500/50/5 pattern described in
|
725
|
-
# [Managing Cloud Tasks Scaling
|
726
|
-
# Risks](https://cloud.google.com/tasks/docs/manage-cloud-task-scaling).
|
727
|
-
#
|
728
|
-
# @param name [String]
|
729
|
-
# Required. The queue name. For example:
|
730
|
-
# `projects/PROJECT_ID/location/LOCATION_ID/queues/QUEUE_ID`
|
731
|
-
# @param options [Google::Gax::CallOptions]
|
732
|
-
# Overrides the default settings for this call, e.g, timeout,
|
733
|
-
# retries, etc.
|
734
|
-
# @yield [result, operation] Access the result along with the RPC operation
|
735
|
-
# @yieldparam result [Google::Cloud::Tasks::V2::Queue]
|
736
|
-
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
737
|
-
# @return [Google::Cloud::Tasks::V2::Queue]
|
738
|
-
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
739
|
-
# @example
|
740
|
-
# require "google/cloud/tasks"
|
741
|
-
#
|
742
|
-
# cloud_tasks_client = Google::Cloud::Tasks.new(version: :v2)
|
743
|
-
# formatted_name = Google::Cloud::Tasks::V2::CloudTasksClient.queue_path("[PROJECT]", "[LOCATION]", "[QUEUE]")
|
744
|
-
# response = cloud_tasks_client.resume_queue(formatted_name)
|
745
|
-
|
746
|
-
def resume_queue \
|
747
|
-
name,
|
748
|
-
options: nil,
|
749
|
-
&block
|
750
|
-
req = {
|
751
|
-
name: name
|
752
|
-
}.delete_if { |_, v| v.nil? }
|
753
|
-
req = Google::Gax::to_proto(req, Google::Cloud::Tasks::V2::ResumeQueueRequest)
|
754
|
-
@resume_queue.call(req, options, &block)
|
755
|
-
end
|
756
|
-
|
757
|
-
# Gets the access control policy for a {Google::Cloud::Tasks::V2::Queue Queue}.
|
758
|
-
# Returns an empty policy if the resource exists and does not have a policy
|
759
|
-
# set.
|
760
|
-
#
|
761
|
-
# Authorization requires the following
|
762
|
-
# [Google IAM](https://cloud.google.com/iam) permission on the specified
|
763
|
-
# resource parent:
|
764
|
-
#
|
765
|
-
# * `cloudtasks.queues.getIamPolicy`
|
766
|
-
#
|
767
|
-
# @param resource [String]
|
768
|
-
# REQUIRED: The resource for which the policy is being requested.
|
769
|
-
# See the operation documentation for the appropriate value for this field.
|
770
|
-
# @param options_ [Google::Iam::V1::GetPolicyOptions | Hash]
|
771
|
-
# OPTIONAL: A `GetPolicyOptions` object for specifying options to
|
772
|
-
# `GetIamPolicy`. This field is only used by Cloud IAM.
|
773
|
-
# A hash of the same form as `Google::Iam::V1::GetPolicyOptions`
|
774
|
-
# can also be provided.
|
775
|
-
# @param options [Google::Gax::CallOptions]
|
776
|
-
# Overrides the default settings for this call, e.g, timeout,
|
777
|
-
# retries, etc.
|
778
|
-
# @yield [result, operation] Access the result along with the RPC operation
|
779
|
-
# @yieldparam result [Google::Iam::V1::Policy]
|
780
|
-
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
781
|
-
# @return [Google::Iam::V1::Policy]
|
782
|
-
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
783
|
-
# @example
|
784
|
-
# require "google/cloud/tasks"
|
785
|
-
#
|
786
|
-
# cloud_tasks_client = Google::Cloud::Tasks.new(version: :v2)
|
787
|
-
#
|
788
|
-
# # TODO: Initialize `resource`:
|
789
|
-
# resource = ''
|
790
|
-
# response = cloud_tasks_client.get_iam_policy(resource)
|
791
|
-
|
792
|
-
def get_iam_policy \
|
793
|
-
resource,
|
794
|
-
options_: nil,
|
795
|
-
options: nil,
|
796
|
-
&block
|
797
|
-
req = {
|
798
|
-
resource: resource,
|
799
|
-
options: options_
|
800
|
-
}.delete_if { |_, v| v.nil? }
|
801
|
-
req = Google::Gax::to_proto(req, Google::Iam::V1::GetIamPolicyRequest)
|
802
|
-
@get_iam_policy.call(req, options, &block)
|
803
|
-
end
|
804
|
-
|
805
|
-
# Sets the access control policy for a {Google::Cloud::Tasks::V2::Queue Queue}. Replaces any existing
|
806
|
-
# policy.
|
807
|
-
#
|
808
|
-
# Note: The Cloud Console does not check queue-level IAM permissions yet.
|
809
|
-
# Project-level permissions are required to use the Cloud Console.
|
810
|
-
#
|
811
|
-
# Authorization requires the following
|
812
|
-
# [Google IAM](https://cloud.google.com/iam) permission on the specified
|
813
|
-
# resource parent:
|
814
|
-
#
|
815
|
-
# * `cloudtasks.queues.setIamPolicy`
|
816
|
-
#
|
817
|
-
# @param resource [String]
|
818
|
-
# REQUIRED: The resource for which the policy is being specified.
|
819
|
-
# See the operation documentation for the appropriate value for this field.
|
820
|
-
# @param policy [Google::Iam::V1::Policy | Hash]
|
821
|
-
# REQUIRED: The complete policy to be applied to the `resource`. The size of
|
822
|
-
# the policy is limited to a few 10s of KB. An empty policy is a
|
823
|
-
# valid policy but certain Cloud Platform services (such as Projects)
|
824
|
-
# might reject them.
|
825
|
-
# A hash of the same form as `Google::Iam::V1::Policy`
|
826
|
-
# can also be provided.
|
827
|
-
# @param options [Google::Gax::CallOptions]
|
828
|
-
# Overrides the default settings for this call, e.g, timeout,
|
829
|
-
# retries, etc.
|
830
|
-
# @yield [result, operation] Access the result along with the RPC operation
|
831
|
-
# @yieldparam result [Google::Iam::V1::Policy]
|
832
|
-
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
833
|
-
# @return [Google::Iam::V1::Policy]
|
834
|
-
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
835
|
-
# @example
|
836
|
-
# require "google/cloud/tasks"
|
837
|
-
#
|
838
|
-
# cloud_tasks_client = Google::Cloud::Tasks.new(version: :v2)
|
839
|
-
#
|
840
|
-
# # TODO: Initialize `resource`:
|
841
|
-
# resource = ''
|
842
|
-
#
|
843
|
-
# # TODO: Initialize `policy`:
|
844
|
-
# policy = {}
|
845
|
-
# response = cloud_tasks_client.set_iam_policy(resource, policy)
|
846
|
-
|
847
|
-
def set_iam_policy \
|
848
|
-
resource,
|
849
|
-
policy,
|
850
|
-
options: nil,
|
851
|
-
&block
|
852
|
-
req = {
|
853
|
-
resource: resource,
|
854
|
-
policy: policy
|
855
|
-
}.delete_if { |_, v| v.nil? }
|
856
|
-
req = Google::Gax::to_proto(req, Google::Iam::V1::SetIamPolicyRequest)
|
857
|
-
@set_iam_policy.call(req, options, &block)
|
858
|
-
end
|
859
|
-
|
860
|
-
# Returns permissions that a caller has on a {Google::Cloud::Tasks::V2::Queue Queue}.
|
861
|
-
# If the resource does not exist, this will return an empty set of
|
862
|
-
# permissions, not a {Google::Rpc::Code::NOT_FOUND NOT_FOUND} error.
|
863
|
-
#
|
864
|
-
# Note: This operation is designed to be used for building permission-aware
|
865
|
-
# UIs and command-line tools, not for authorization checking. This operation
|
866
|
-
# may "fail open" without warning.
|
867
|
-
#
|
868
|
-
# @param resource [String]
|
869
|
-
# REQUIRED: The resource for which the policy detail is being requested.
|
870
|
-
# See the operation documentation for the appropriate value for this field.
|
871
|
-
# @param permissions [Array<String>]
|
872
|
-
# The set of permissions to check for the `resource`. Permissions with
|
873
|
-
# wildcards (such as '*' or 'storage.*') are not allowed. For more
|
874
|
-
# information see
|
875
|
-
# [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions).
|
876
|
-
# @param options [Google::Gax::CallOptions]
|
877
|
-
# Overrides the default settings for this call, e.g, timeout,
|
878
|
-
# retries, etc.
|
879
|
-
# @yield [result, operation] Access the result along with the RPC operation
|
880
|
-
# @yieldparam result [Google::Iam::V1::TestIamPermissionsResponse]
|
881
|
-
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
882
|
-
# @return [Google::Iam::V1::TestIamPermissionsResponse]
|
883
|
-
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
884
|
-
# @example
|
885
|
-
# require "google/cloud/tasks"
|
886
|
-
#
|
887
|
-
# cloud_tasks_client = Google::Cloud::Tasks.new(version: :v2)
|
888
|
-
#
|
889
|
-
# # TODO: Initialize `resource`:
|
890
|
-
# resource = ''
|
891
|
-
#
|
892
|
-
# # TODO: Initialize `permissions`:
|
893
|
-
# permissions = []
|
894
|
-
# response = cloud_tasks_client.test_iam_permissions(resource, permissions)
|
895
|
-
|
896
|
-
def test_iam_permissions \
|
897
|
-
resource,
|
898
|
-
permissions,
|
899
|
-
options: nil,
|
900
|
-
&block
|
901
|
-
req = {
|
902
|
-
resource: resource,
|
903
|
-
permissions: permissions
|
904
|
-
}.delete_if { |_, v| v.nil? }
|
905
|
-
req = Google::Gax::to_proto(req, Google::Iam::V1::TestIamPermissionsRequest)
|
906
|
-
@test_iam_permissions.call(req, options, &block)
|
907
|
-
end
|
908
|
-
|
909
|
-
# Lists the tasks in a queue.
|
910
|
-
#
|
911
|
-
# By default, only the {Google::Cloud::Tasks::V2::Task::View::BASIC BASIC} view is retrieved
|
912
|
-
# due to performance considerations;
|
913
|
-
# {Google::Cloud::Tasks::V2::ListTasksRequest#response_view response_view} controls the
|
914
|
-
# subset of information which is returned.
|
915
|
-
#
|
916
|
-
# The tasks may be returned in any order. The ordering may change at any
|
917
|
-
# time.
|
918
|
-
#
|
919
|
-
# @param parent [String]
|
920
|
-
# Required. The queue name. For example:
|
921
|
-
# `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID`
|
922
|
-
# @param response_view [Google::Cloud::Tasks::V2::Task::View]
|
923
|
-
# The response_view specifies which subset of the {Google::Cloud::Tasks::V2::Task Task} will be
|
924
|
-
# returned.
|
925
|
-
#
|
926
|
-
# By default response_view is {Google::Cloud::Tasks::V2::Task::View::BASIC BASIC}; not all
|
927
|
-
# information is retrieved by default because some data, such as
|
928
|
-
# payloads, might be desirable to return only when needed because
|
929
|
-
# of its large size or because of the sensitivity of data that it
|
930
|
-
# contains.
|
931
|
-
#
|
932
|
-
# Authorization for {Google::Cloud::Tasks::V2::Task::View::FULL FULL} requires
|
933
|
-
# `cloudtasks.tasks.fullView` [Google IAM](https://cloud.google.com/iam/)
|
934
|
-
# permission on the {Google::Cloud::Tasks::V2::Task Task} resource.
|
935
|
-
# @param page_size [Integer]
|
936
|
-
# The maximum number of resources contained in the underlying API
|
937
|
-
# response. If page streaming is performed per-resource, this
|
938
|
-
# parameter does not affect the return value. If page streaming is
|
939
|
-
# performed per-page, this determines the maximum number of
|
940
|
-
# resources in a page.
|
941
|
-
# @param options [Google::Gax::CallOptions]
|
942
|
-
# Overrides the default settings for this call, e.g, timeout,
|
943
|
-
# retries, etc.
|
944
|
-
# @yield [result, operation] Access the result along with the RPC operation
|
945
|
-
# @yieldparam result [Google::Gax::PagedEnumerable<Google::Cloud::Tasks::V2::Task>]
|
946
|
-
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
947
|
-
# @return [Google::Gax::PagedEnumerable<Google::Cloud::Tasks::V2::Task>]
|
948
|
-
# An enumerable of Google::Cloud::Tasks::V2::Task instances.
|
949
|
-
# See Google::Gax::PagedEnumerable documentation for other
|
950
|
-
# operations such as per-page iteration or access to the response
|
951
|
-
# object.
|
952
|
-
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
953
|
-
# @example
|
954
|
-
# require "google/cloud/tasks"
|
955
|
-
#
|
956
|
-
# cloud_tasks_client = Google::Cloud::Tasks.new(version: :v2)
|
957
|
-
# formatted_parent = Google::Cloud::Tasks::V2::CloudTasksClient.queue_path("[PROJECT]", "[LOCATION]", "[QUEUE]")
|
958
|
-
#
|
959
|
-
# # Iterate over all results.
|
960
|
-
# cloud_tasks_client.list_tasks(formatted_parent).each do |element|
|
961
|
-
# # Process element.
|
962
|
-
# end
|
963
|
-
#
|
964
|
-
# # Or iterate over results one page at a time.
|
965
|
-
# cloud_tasks_client.list_tasks(formatted_parent).each_page do |page|
|
966
|
-
# # Process each page at a time.
|
967
|
-
# page.each do |element|
|
968
|
-
# # Process element.
|
969
|
-
# end
|
970
|
-
# end
|
971
|
-
|
972
|
-
def list_tasks \
|
973
|
-
parent,
|
974
|
-
response_view: nil,
|
975
|
-
page_size: nil,
|
976
|
-
options: nil,
|
977
|
-
&block
|
978
|
-
req = {
|
979
|
-
parent: parent,
|
980
|
-
response_view: response_view,
|
981
|
-
page_size: page_size
|
982
|
-
}.delete_if { |_, v| v.nil? }
|
983
|
-
req = Google::Gax::to_proto(req, Google::Cloud::Tasks::V2::ListTasksRequest)
|
984
|
-
@list_tasks.call(req, options, &block)
|
985
|
-
end
|
986
|
-
|
987
|
-
# Gets a task.
|
988
|
-
#
|
989
|
-
# @param name [String]
|
990
|
-
# Required. The task name. For example:
|
991
|
-
# `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID`
|
992
|
-
# @param response_view [Google::Cloud::Tasks::V2::Task::View]
|
993
|
-
# The response_view specifies which subset of the {Google::Cloud::Tasks::V2::Task Task} will be
|
994
|
-
# returned.
|
995
|
-
#
|
996
|
-
# By default response_view is {Google::Cloud::Tasks::V2::Task::View::BASIC BASIC}; not all
|
997
|
-
# information is retrieved by default because some data, such as
|
998
|
-
# payloads, might be desirable to return only when needed because
|
999
|
-
# of its large size or because of the sensitivity of data that it
|
1000
|
-
# contains.
|
1001
|
-
#
|
1002
|
-
# Authorization for {Google::Cloud::Tasks::V2::Task::View::FULL FULL} requires
|
1003
|
-
# `cloudtasks.tasks.fullView` [Google IAM](https://cloud.google.com/iam/)
|
1004
|
-
# permission on the {Google::Cloud::Tasks::V2::Task Task} resource.
|
1005
|
-
# @param options [Google::Gax::CallOptions]
|
1006
|
-
# Overrides the default settings for this call, e.g, timeout,
|
1007
|
-
# retries, etc.
|
1008
|
-
# @yield [result, operation] Access the result along with the RPC operation
|
1009
|
-
# @yieldparam result [Google::Cloud::Tasks::V2::Task]
|
1010
|
-
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
1011
|
-
# @return [Google::Cloud::Tasks::V2::Task]
|
1012
|
-
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
1013
|
-
# @example
|
1014
|
-
# require "google/cloud/tasks"
|
1015
|
-
#
|
1016
|
-
# cloud_tasks_client = Google::Cloud::Tasks.new(version: :v2)
|
1017
|
-
# formatted_name = Google::Cloud::Tasks::V2::CloudTasksClient.task_path("[PROJECT]", "[LOCATION]", "[QUEUE]", "[TASK]")
|
1018
|
-
# response = cloud_tasks_client.get_task(formatted_name)
|
1019
|
-
|
1020
|
-
def get_task \
|
1021
|
-
name,
|
1022
|
-
response_view: nil,
|
1023
|
-
options: nil,
|
1024
|
-
&block
|
1025
|
-
req = {
|
1026
|
-
name: name,
|
1027
|
-
response_view: response_view
|
1028
|
-
}.delete_if { |_, v| v.nil? }
|
1029
|
-
req = Google::Gax::to_proto(req, Google::Cloud::Tasks::V2::GetTaskRequest)
|
1030
|
-
@get_task.call(req, options, &block)
|
1031
|
-
end
|
1032
|
-
|
1033
|
-
# Creates a task and adds it to a queue.
|
1034
|
-
#
|
1035
|
-
# Tasks cannot be updated after creation; there is no UpdateTask command.
|
1036
|
-
#
|
1037
|
-
# * The maximum task size is 100KB.
|
1038
|
-
#
|
1039
|
-
# @param parent [String]
|
1040
|
-
# Required. The queue name. For example:
|
1041
|
-
# `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID`
|
1042
|
-
#
|
1043
|
-
# The queue must already exist.
|
1044
|
-
# @param task [Google::Cloud::Tasks::V2::Task | Hash]
|
1045
|
-
# Required. The task to add.
|
1046
|
-
#
|
1047
|
-
# Task names have the following format:
|
1048
|
-
# `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID`.
|
1049
|
-
# The user can optionally specify a task {Google::Cloud::Tasks::V2::Task#name name}. If a
|
1050
|
-
# name is not specified then the system will generate a random
|
1051
|
-
# unique task id, which will be set in the task returned in the
|
1052
|
-
# {Google::Cloud::Tasks::V2::Task#name response}.
|
1053
|
-
#
|
1054
|
-
# If {Google::Cloud::Tasks::V2::Task#schedule_time schedule_time} is not set or is in the
|
1055
|
-
# past then Cloud Tasks will set it to the current time.
|
1056
|
-
#
|
1057
|
-
# Task De-duplication:
|
1058
|
-
#
|
1059
|
-
# Explicitly specifying a task ID enables task de-duplication. If
|
1060
|
-
# a task's ID is identical to that of an existing task or a task
|
1061
|
-
# that was deleted or executed recently then the call will fail
|
1062
|
-
# with {Google::Rpc::Code::ALREADY_EXISTS ALREADY_EXISTS}.
|
1063
|
-
# If the task's queue was created using Cloud Tasks, then another task with
|
1064
|
-
# the same name can't be created for ~1hour after the original task was
|
1065
|
-
# deleted or executed. If the task's queue was created using queue.yaml or
|
1066
|
-
# queue.xml, then another task with the same name can't be created
|
1067
|
-
# for ~9days after the original task was deleted or executed.
|
1068
|
-
#
|
1069
|
-
# Because there is an extra lookup cost to identify duplicate task
|
1070
|
-
# names, these {Google::Cloud::Tasks::V2::CloudTasks::CreateTask CreateTask} calls have significantly
|
1071
|
-
# increased latency. Using hashed strings for the task id or for
|
1072
|
-
# the prefix of the task id is recommended. Choosing task ids that
|
1073
|
-
# are sequential or have sequential prefixes, for example using a
|
1074
|
-
# timestamp, causes an increase in latency and error rates in all
|
1075
|
-
# task commands. The infrastructure relies on an approximately
|
1076
|
-
# uniform distribution of task ids to store and serve tasks
|
1077
|
-
# efficiently.
|
1078
|
-
# A hash of the same form as `Google::Cloud::Tasks::V2::Task`
|
1079
|
-
# can also be provided.
|
1080
|
-
# @param response_view [Google::Cloud::Tasks::V2::Task::View]
|
1081
|
-
# The response_view specifies which subset of the {Google::Cloud::Tasks::V2::Task Task} will be
|
1082
|
-
# returned.
|
1083
|
-
#
|
1084
|
-
# By default response_view is {Google::Cloud::Tasks::V2::Task::View::BASIC BASIC}; not all
|
1085
|
-
# information is retrieved by default because some data, such as
|
1086
|
-
# payloads, might be desirable to return only when needed because
|
1087
|
-
# of its large size or because of the sensitivity of data that it
|
1088
|
-
# contains.
|
1089
|
-
#
|
1090
|
-
# Authorization for {Google::Cloud::Tasks::V2::Task::View::FULL FULL} requires
|
1091
|
-
# `cloudtasks.tasks.fullView` [Google IAM](https://cloud.google.com/iam/)
|
1092
|
-
# permission on the {Google::Cloud::Tasks::V2::Task Task} resource.
|
1093
|
-
# @param options [Google::Gax::CallOptions]
|
1094
|
-
# Overrides the default settings for this call, e.g, timeout,
|
1095
|
-
# retries, etc.
|
1096
|
-
# @yield [result, operation] Access the result along with the RPC operation
|
1097
|
-
# @yieldparam result [Google::Cloud::Tasks::V2::Task]
|
1098
|
-
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
1099
|
-
# @return [Google::Cloud::Tasks::V2::Task]
|
1100
|
-
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
1101
|
-
# @example
|
1102
|
-
# require "google/cloud/tasks"
|
1103
|
-
#
|
1104
|
-
# cloud_tasks_client = Google::Cloud::Tasks.new(version: :v2)
|
1105
|
-
# formatted_parent = Google::Cloud::Tasks::V2::CloudTasksClient.queue_path("[PROJECT]", "[LOCATION]", "[QUEUE]")
|
1106
|
-
#
|
1107
|
-
# # TODO: Initialize `task`:
|
1108
|
-
# task = {}
|
1109
|
-
# response = cloud_tasks_client.create_task(formatted_parent, task)
|
1110
|
-
|
1111
|
-
def create_task \
|
1112
|
-
parent,
|
1113
|
-
task,
|
1114
|
-
response_view: nil,
|
1115
|
-
options: nil,
|
1116
|
-
&block
|
1117
|
-
req = {
|
1118
|
-
parent: parent,
|
1119
|
-
task: task,
|
1120
|
-
response_view: response_view
|
1121
|
-
}.delete_if { |_, v| v.nil? }
|
1122
|
-
req = Google::Gax::to_proto(req, Google::Cloud::Tasks::V2::CreateTaskRequest)
|
1123
|
-
@create_task.call(req, options, &block)
|
1124
|
-
end
|
1125
|
-
|
1126
|
-
# Deletes a task.
|
1127
|
-
#
|
1128
|
-
# A task can be deleted if it is scheduled or dispatched. A task
|
1129
|
-
# cannot be deleted if it has executed successfully or permanently
|
1130
|
-
# failed.
|
1131
|
-
#
|
1132
|
-
# @param name [String]
|
1133
|
-
# Required. The task name. For example:
|
1134
|
-
# `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID`
|
1135
|
-
# @param options [Google::Gax::CallOptions]
|
1136
|
-
# Overrides the default settings for this call, e.g, timeout,
|
1137
|
-
# retries, etc.
|
1138
|
-
# @yield [result, operation] Access the result along with the RPC operation
|
1139
|
-
# @yieldparam result []
|
1140
|
-
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
1141
|
-
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
1142
|
-
# @example
|
1143
|
-
# require "google/cloud/tasks"
|
1144
|
-
#
|
1145
|
-
# cloud_tasks_client = Google::Cloud::Tasks.new(version: :v2)
|
1146
|
-
# formatted_name = Google::Cloud::Tasks::V2::CloudTasksClient.task_path("[PROJECT]", "[LOCATION]", "[QUEUE]", "[TASK]")
|
1147
|
-
# cloud_tasks_client.delete_task(formatted_name)
|
1148
|
-
|
1149
|
-
def delete_task \
|
1150
|
-
name,
|
1151
|
-
options: nil,
|
1152
|
-
&block
|
1153
|
-
req = {
|
1154
|
-
name: name
|
1155
|
-
}.delete_if { |_, v| v.nil? }
|
1156
|
-
req = Google::Gax::to_proto(req, Google::Cloud::Tasks::V2::DeleteTaskRequest)
|
1157
|
-
@delete_task.call(req, options, &block)
|
1158
|
-
nil
|
1159
|
-
end
|
1160
|
-
|
1161
|
-
# Forces a task to run now.
|
1162
|
-
#
|
1163
|
-
# When this method is called, Cloud Tasks will dispatch the task, even if
|
1164
|
-
# the task is already running, the queue has reached its {Google::Cloud::Tasks::V2::RateLimits RateLimits} or
|
1165
|
-
# is {Google::Cloud::Tasks::V2::Queue::State::PAUSED PAUSED}.
|
1166
|
-
#
|
1167
|
-
# This command is meant to be used for manual debugging. For
|
1168
|
-
# example, {Google::Cloud::Tasks::V2::CloudTasks::RunTask RunTask} can be used to retry a failed
|
1169
|
-
# task after a fix has been made or to manually force a task to be
|
1170
|
-
# dispatched now.
|
1171
|
-
#
|
1172
|
-
# The dispatched task is returned. That is, the task that is returned
|
1173
|
-
# contains the {Task#status status} after the task is dispatched but
|
1174
|
-
# before the task is received by its target.
|
1175
|
-
#
|
1176
|
-
# If Cloud Tasks receives a successful response from the task's
|
1177
|
-
# target, then the task will be deleted; otherwise the task's
|
1178
|
-
# {Google::Cloud::Tasks::V2::Task#schedule_time schedule_time} will be reset to the time that
|
1179
|
-
# {Google::Cloud::Tasks::V2::CloudTasks::RunTask RunTask} was called plus the retry delay specified
|
1180
|
-
# in the queue's {Google::Cloud::Tasks::V2::RetryConfig RetryConfig}.
|
1181
|
-
#
|
1182
|
-
# {Google::Cloud::Tasks::V2::CloudTasks::RunTask RunTask} returns
|
1183
|
-
# {Google::Rpc::Code::NOT_FOUND NOT_FOUND} when it is called on a
|
1184
|
-
# task that has already succeeded or permanently failed.
|
1185
|
-
#
|
1186
|
-
# @param name [String]
|
1187
|
-
# Required. The task name. For example:
|
1188
|
-
# `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID`
|
1189
|
-
# @param response_view [Google::Cloud::Tasks::V2::Task::View]
|
1190
|
-
# The response_view specifies which subset of the {Google::Cloud::Tasks::V2::Task Task} will be
|
1191
|
-
# returned.
|
1192
|
-
#
|
1193
|
-
# By default response_view is {Google::Cloud::Tasks::V2::Task::View::BASIC BASIC}; not all
|
1194
|
-
# information is retrieved by default because some data, such as
|
1195
|
-
# payloads, might be desirable to return only when needed because
|
1196
|
-
# of its large size or because of the sensitivity of data that it
|
1197
|
-
# contains.
|
1198
|
-
#
|
1199
|
-
# Authorization for {Google::Cloud::Tasks::V2::Task::View::FULL FULL} requires
|
1200
|
-
# `cloudtasks.tasks.fullView` [Google IAM](https://cloud.google.com/iam/)
|
1201
|
-
# permission on the {Google::Cloud::Tasks::V2::Task Task} resource.
|
1202
|
-
# @param options [Google::Gax::CallOptions]
|
1203
|
-
# Overrides the default settings for this call, e.g, timeout,
|
1204
|
-
# retries, etc.
|
1205
|
-
# @yield [result, operation] Access the result along with the RPC operation
|
1206
|
-
# @yieldparam result [Google::Cloud::Tasks::V2::Task]
|
1207
|
-
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
1208
|
-
# @return [Google::Cloud::Tasks::V2::Task]
|
1209
|
-
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
1210
|
-
# @example
|
1211
|
-
# require "google/cloud/tasks"
|
1212
|
-
#
|
1213
|
-
# cloud_tasks_client = Google::Cloud::Tasks.new(version: :v2)
|
1214
|
-
# formatted_name = Google::Cloud::Tasks::V2::CloudTasksClient.task_path("[PROJECT]", "[LOCATION]", "[QUEUE]", "[TASK]")
|
1215
|
-
# response = cloud_tasks_client.run_task(formatted_name)
|
1216
|
-
|
1217
|
-
def run_task \
|
1218
|
-
name,
|
1219
|
-
response_view: nil,
|
1220
|
-
options: nil,
|
1221
|
-
&block
|
1222
|
-
req = {
|
1223
|
-
name: name,
|
1224
|
-
response_view: response_view
|
1225
|
-
}.delete_if { |_, v| v.nil? }
|
1226
|
-
req = Google::Gax::to_proto(req, Google::Cloud::Tasks::V2::RunTaskRequest)
|
1227
|
-
@run_task.call(req, options, &block)
|
1228
|
-
end
|
1229
|
-
end
|
1230
|
-
end
|
1231
|
-
end
|
1232
|
-
end
|
1233
|
-
end
|