google-cloud-run-v2 0.4.0 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/AUTHENTICATION.md +6 -6
- data/README.md +4 -4
- data/lib/google/cloud/run/v2/condition_pb.rb +1 -0
- data/lib/google/cloud/run/v2/execution_pb.rb +79 -0
- data/lib/google/cloud/run/v2/execution_services_pb.rb +49 -0
- data/lib/google/cloud/run/v2/execution_template_pb.rb +29 -0
- data/lib/google/cloud/run/v2/executions/client.rb +635 -0
- data/lib/google/cloud/run/v2/executions/credentials.rb +47 -0
- data/lib/google/cloud/run/v2/executions/operations.rb +778 -0
- data/lib/google/cloud/run/v2/executions/paths.rb +73 -0
- data/lib/google/cloud/run/v2/executions.rb +50 -0
- data/lib/google/cloud/run/v2/job_pb.rb +105 -0
- data/lib/google/cloud/run/v2/job_services_pb.rb +65 -0
- data/lib/google/cloud/run/v2/jobs/client.rb +1259 -0
- data/lib/google/cloud/run/v2/jobs/credentials.rb +47 -0
- data/lib/google/cloud/run/v2/jobs/operations.rb +778 -0
- data/lib/google/cloud/run/v2/jobs/paths.rb +166 -0
- data/lib/google/cloud/run/v2/jobs.rb +50 -0
- data/lib/google/cloud/run/v2/k8s.min_pb.rb +6 -0
- data/lib/google/cloud/run/v2/revision_pb.rb +2 -0
- data/lib/google/cloud/run/v2/revision_services_pb.rb +2 -2
- data/lib/google/cloud/run/v2/revisions/client.rb +2 -2
- data/lib/google/cloud/run/v2/revisions/operations.rb +8 -0
- data/lib/google/cloud/run/v2/revisions.rb +1 -1
- data/lib/google/cloud/run/v2/service_services_pb.rb +2 -2
- data/lib/google/cloud/run/v2/services/client.rb +13 -10
- data/lib/google/cloud/run/v2/services/operations.rb +8 -0
- data/lib/google/cloud/run/v2/services.rb +1 -1
- data/lib/google/cloud/run/v2/task_pb.rb +82 -0
- data/lib/google/cloud/run/v2/task_services_pb.rb +47 -0
- data/lib/google/cloud/run/v2/task_template_pb.rb +36 -0
- data/lib/google/cloud/run/v2/tasks/client.rb +512 -0
- data/lib/google/cloud/run/v2/tasks/credentials.rb +47 -0
- data/lib/google/cloud/run/v2/tasks/paths.rb +77 -0
- data/lib/google/cloud/run/v2/tasks.rb +49 -0
- data/lib/google/cloud/run/v2/vendor_settings_pb.rb +6 -0
- data/lib/google/cloud/run/v2/version.rb +1 -1
- data/lib/google/cloud/run/v2.rb +6 -3
- data/proto_docs/google/api/client.rb +318 -0
- data/proto_docs/google/api/launch_stage.rb +3 -3
- data/proto_docs/google/cloud/run/v2/condition.rb +4 -0
- data/proto_docs/google/cloud/run/v2/execution.rb +233 -0
- data/proto_docs/google/cloud/run/v2/execution_template.rb +87 -0
- data/proto_docs/google/cloud/run/v2/job.rb +316 -0
- data/proto_docs/google/cloud/run/v2/k8s.min.rb +42 -15
- data/proto_docs/google/cloud/run/v2/revision.rb +19 -13
- data/proto_docs/google/cloud/run/v2/revision_template.rb +10 -0
- data/proto_docs/google/cloud/run/v2/service.rb +52 -39
- data/proto_docs/google/cloud/run/v2/task.rb +232 -0
- data/proto_docs/google/cloud/run/v2/task_template.rb +66 -0
- data/proto_docs/google/cloud/run/v2/vendor_settings.rb +14 -1
- data/proto_docs/google/rpc/status.rb +4 -2
- metadata +35 -7
@@ -0,0 +1,512 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2022 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/run/v2/task_pb"
|
21
|
+
require "google/cloud/location"
|
22
|
+
|
23
|
+
module Google
|
24
|
+
module Cloud
|
25
|
+
module Run
|
26
|
+
module V2
|
27
|
+
module Tasks
|
28
|
+
##
|
29
|
+
# Client for the Tasks service.
|
30
|
+
#
|
31
|
+
# Cloud Run Task Control Plane API.
|
32
|
+
#
|
33
|
+
class Client
|
34
|
+
include Paths
|
35
|
+
|
36
|
+
# @private
|
37
|
+
attr_reader :tasks_stub
|
38
|
+
|
39
|
+
##
|
40
|
+
# Configure the Tasks Client class.
|
41
|
+
#
|
42
|
+
# See {::Google::Cloud::Run::V2::Tasks::Client::Configuration}
|
43
|
+
# for a description of the configuration fields.
|
44
|
+
#
|
45
|
+
# @example
|
46
|
+
#
|
47
|
+
# # Modify the configuration for all Tasks clients
|
48
|
+
# ::Google::Cloud::Run::V2::Tasks::Client.configure do |config|
|
49
|
+
# config.timeout = 10.0
|
50
|
+
# end
|
51
|
+
#
|
52
|
+
# @yield [config] Configure the Client client.
|
53
|
+
# @yieldparam config [Client::Configuration]
|
54
|
+
#
|
55
|
+
# @return [Client::Configuration]
|
56
|
+
#
|
57
|
+
def self.configure
|
58
|
+
@configure ||= begin
|
59
|
+
namespace = ["Google", "Cloud", "Run", "V2"]
|
60
|
+
parent_config = while namespace.any?
|
61
|
+
parent_name = namespace.join "::"
|
62
|
+
parent_const = const_get parent_name
|
63
|
+
break parent_const.configure if parent_const.respond_to? :configure
|
64
|
+
namespace.pop
|
65
|
+
end
|
66
|
+
default_config = Client::Configuration.new parent_config
|
67
|
+
|
68
|
+
default_config
|
69
|
+
end
|
70
|
+
yield @configure if block_given?
|
71
|
+
@configure
|
72
|
+
end
|
73
|
+
|
74
|
+
##
|
75
|
+
# Configure the Tasks Client instance.
|
76
|
+
#
|
77
|
+
# The configuration is set to the derived mode, meaning that values can be changed,
|
78
|
+
# but structural changes (adding new fields, etc.) are not allowed. Structural changes
|
79
|
+
# should be made on {Client.configure}.
|
80
|
+
#
|
81
|
+
# See {::Google::Cloud::Run::V2::Tasks::Client::Configuration}
|
82
|
+
# for a description of the configuration fields.
|
83
|
+
#
|
84
|
+
# @yield [config] Configure the Client client.
|
85
|
+
# @yieldparam config [Client::Configuration]
|
86
|
+
#
|
87
|
+
# @return [Client::Configuration]
|
88
|
+
#
|
89
|
+
def configure
|
90
|
+
yield @config if block_given?
|
91
|
+
@config
|
92
|
+
end
|
93
|
+
|
94
|
+
##
|
95
|
+
# Create a new Tasks client object.
|
96
|
+
#
|
97
|
+
# @example
|
98
|
+
#
|
99
|
+
# # Create a client using the default configuration
|
100
|
+
# client = ::Google::Cloud::Run::V2::Tasks::Client.new
|
101
|
+
#
|
102
|
+
# # Create a client using a custom configuration
|
103
|
+
# client = ::Google::Cloud::Run::V2::Tasks::Client.new do |config|
|
104
|
+
# config.timeout = 10.0
|
105
|
+
# end
|
106
|
+
#
|
107
|
+
# @yield [config] Configure the Tasks client.
|
108
|
+
# @yieldparam config [Client::Configuration]
|
109
|
+
#
|
110
|
+
def initialize
|
111
|
+
# These require statements are intentionally placed here to initialize
|
112
|
+
# the gRPC module only when it's required.
|
113
|
+
# See https://github.com/googleapis/toolkit/issues/446
|
114
|
+
require "gapic/grpc"
|
115
|
+
require "google/cloud/run/v2/task_services_pb"
|
116
|
+
|
117
|
+
# Create the configuration object
|
118
|
+
@config = Configuration.new Client.configure
|
119
|
+
|
120
|
+
# Yield the configuration if needed
|
121
|
+
yield @config if block_given?
|
122
|
+
|
123
|
+
# Create credentials
|
124
|
+
credentials = @config.credentials
|
125
|
+
# Use self-signed JWT if the endpoint is unchanged from default,
|
126
|
+
# but only if the default endpoint does not have a region prefix.
|
127
|
+
enable_self_signed_jwt = @config.endpoint == Client.configure.endpoint &&
|
128
|
+
!@config.endpoint.split(".").first.include?("-")
|
129
|
+
credentials ||= Credentials.default scope: @config.scope,
|
130
|
+
enable_self_signed_jwt: enable_self_signed_jwt
|
131
|
+
if credentials.is_a?(::String) || credentials.is_a?(::Hash)
|
132
|
+
credentials = Credentials.new credentials, scope: @config.scope
|
133
|
+
end
|
134
|
+
@quota_project_id = @config.quota_project
|
135
|
+
@quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
|
136
|
+
|
137
|
+
@location_client = Google::Cloud::Location::Locations::Client.new do |config|
|
138
|
+
config.credentials = credentials
|
139
|
+
config.quota_project = @quota_project_id
|
140
|
+
config.endpoint = @config.endpoint
|
141
|
+
end
|
142
|
+
|
143
|
+
@tasks_stub = ::Gapic::ServiceStub.new(
|
144
|
+
::Google::Cloud::Run::V2::Tasks::Stub,
|
145
|
+
credentials: credentials,
|
146
|
+
endpoint: @config.endpoint,
|
147
|
+
channel_args: @config.channel_args,
|
148
|
+
interceptors: @config.interceptors
|
149
|
+
)
|
150
|
+
end
|
151
|
+
|
152
|
+
##
|
153
|
+
# Get the associated client for mix-in of the Locations.
|
154
|
+
#
|
155
|
+
# @return [Google::Cloud::Location::Locations::Client]
|
156
|
+
#
|
157
|
+
attr_reader :location_client
|
158
|
+
|
159
|
+
# Service calls
|
160
|
+
|
161
|
+
##
|
162
|
+
# Gets information about a Task.
|
163
|
+
#
|
164
|
+
# @overload get_task(request, options = nil)
|
165
|
+
# Pass arguments to `get_task` via a request object, either of type
|
166
|
+
# {::Google::Cloud::Run::V2::GetTaskRequest} or an equivalent Hash.
|
167
|
+
#
|
168
|
+
# @param request [::Google::Cloud::Run::V2::GetTaskRequest, ::Hash]
|
169
|
+
# A request object representing the call parameters. Required. To specify no
|
170
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
171
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
172
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
173
|
+
#
|
174
|
+
# @overload get_task(name: nil)
|
175
|
+
# Pass arguments to `get_task` via keyword arguments. Note that at
|
176
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
177
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
178
|
+
#
|
179
|
+
# @param name [::String]
|
180
|
+
# Required. The full name of the Task.
|
181
|
+
# Format:
|
182
|
+
# projects/\\{project}/locations/\\{location}/jobs/\\{job}/executions/\\{execution}/tasks/\\{task}
|
183
|
+
#
|
184
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
185
|
+
# @yieldparam response [::Google::Cloud::Run::V2::Task]
|
186
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
187
|
+
#
|
188
|
+
# @return [::Google::Cloud::Run::V2::Task]
|
189
|
+
#
|
190
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
191
|
+
#
|
192
|
+
# @example Basic example
|
193
|
+
# require "google/cloud/run/v2"
|
194
|
+
#
|
195
|
+
# # Create a client object. The client can be reused for multiple calls.
|
196
|
+
# client = Google::Cloud::Run::V2::Tasks::Client.new
|
197
|
+
#
|
198
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
199
|
+
# request = Google::Cloud::Run::V2::GetTaskRequest.new
|
200
|
+
#
|
201
|
+
# # Call the get_task method.
|
202
|
+
# result = client.get_task request
|
203
|
+
#
|
204
|
+
# # The returned object is of type Google::Cloud::Run::V2::Task.
|
205
|
+
# p result
|
206
|
+
#
|
207
|
+
def get_task request, options = nil
|
208
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
209
|
+
|
210
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Run::V2::GetTaskRequest
|
211
|
+
|
212
|
+
# Converts hash and nil to an options object
|
213
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
214
|
+
|
215
|
+
# Customize the options with defaults
|
216
|
+
metadata = @config.rpcs.get_task.metadata.to_h
|
217
|
+
|
218
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
219
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
220
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
221
|
+
gapic_version: ::Google::Cloud::Run::V2::VERSION
|
222
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
223
|
+
|
224
|
+
header_params = {}
|
225
|
+
if request.name
|
226
|
+
header_params["name"] = request.name
|
227
|
+
end
|
228
|
+
|
229
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
230
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
231
|
+
|
232
|
+
options.apply_defaults timeout: @config.rpcs.get_task.timeout,
|
233
|
+
metadata: metadata,
|
234
|
+
retry_policy: @config.rpcs.get_task.retry_policy
|
235
|
+
|
236
|
+
options.apply_defaults timeout: @config.timeout,
|
237
|
+
metadata: @config.metadata,
|
238
|
+
retry_policy: @config.retry_policy
|
239
|
+
|
240
|
+
@tasks_stub.call_rpc :get_task, request, options: options do |response, operation|
|
241
|
+
yield response, operation if block_given?
|
242
|
+
return response
|
243
|
+
end
|
244
|
+
rescue ::GRPC::BadStatus => e
|
245
|
+
raise ::Google::Cloud::Error.from_error(e)
|
246
|
+
end
|
247
|
+
|
248
|
+
##
|
249
|
+
# Lists Tasks from an Execution of a Job.
|
250
|
+
#
|
251
|
+
# @overload list_tasks(request, options = nil)
|
252
|
+
# Pass arguments to `list_tasks` via a request object, either of type
|
253
|
+
# {::Google::Cloud::Run::V2::ListTasksRequest} or an equivalent Hash.
|
254
|
+
#
|
255
|
+
# @param request [::Google::Cloud::Run::V2::ListTasksRequest, ::Hash]
|
256
|
+
# A request object representing the call parameters. Required. To specify no
|
257
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
258
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
259
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
260
|
+
#
|
261
|
+
# @overload list_tasks(parent: nil, page_size: nil, page_token: nil, show_deleted: nil)
|
262
|
+
# Pass arguments to `list_tasks` via keyword arguments. Note that at
|
263
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
264
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
265
|
+
#
|
266
|
+
# @param parent [::String]
|
267
|
+
# Required. The Execution from which the Tasks should be listed.
|
268
|
+
# To list all Tasks across Executions of a Job, use "-" instead of Execution
|
269
|
+
# name. To list all Tasks across Jobs, use "-" instead of Job name. Format:
|
270
|
+
# projects/\\{project}/locations/\\{location}/jobs/\\{job}/executions/\\{execution}
|
271
|
+
# @param page_size [::Integer]
|
272
|
+
# Maximum number of Tasks to return in this call.
|
273
|
+
# @param page_token [::String]
|
274
|
+
# A page token received from a previous call to ListTasks.
|
275
|
+
# All other parameters must match.
|
276
|
+
# @param show_deleted [::Boolean]
|
277
|
+
# If true, returns deleted (but unexpired) resources along with active ones.
|
278
|
+
#
|
279
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
280
|
+
# @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::Run::V2::Task>]
|
281
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
282
|
+
#
|
283
|
+
# @return [::Gapic::PagedEnumerable<::Google::Cloud::Run::V2::Task>]
|
284
|
+
#
|
285
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
286
|
+
#
|
287
|
+
# @example Basic example
|
288
|
+
# require "google/cloud/run/v2"
|
289
|
+
#
|
290
|
+
# # Create a client object. The client can be reused for multiple calls.
|
291
|
+
# client = Google::Cloud::Run::V2::Tasks::Client.new
|
292
|
+
#
|
293
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
294
|
+
# request = Google::Cloud::Run::V2::ListTasksRequest.new
|
295
|
+
#
|
296
|
+
# # Call the list_tasks method.
|
297
|
+
# result = client.list_tasks request
|
298
|
+
#
|
299
|
+
# # The returned object is of type Gapic::PagedEnumerable. You can
|
300
|
+
# # iterate over all elements by calling #each, and the enumerable
|
301
|
+
# # will lazily make API calls to fetch subsequent pages. Other
|
302
|
+
# # methods are also available for managing paging directly.
|
303
|
+
# result.each do |response|
|
304
|
+
# # Each element is of type ::Google::Cloud::Run::V2::Task.
|
305
|
+
# p response
|
306
|
+
# end
|
307
|
+
#
|
308
|
+
def list_tasks request, options = nil
|
309
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
310
|
+
|
311
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Run::V2::ListTasksRequest
|
312
|
+
|
313
|
+
# Converts hash and nil to an options object
|
314
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
315
|
+
|
316
|
+
# Customize the options with defaults
|
317
|
+
metadata = @config.rpcs.list_tasks.metadata.to_h
|
318
|
+
|
319
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
320
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
321
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
322
|
+
gapic_version: ::Google::Cloud::Run::V2::VERSION
|
323
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
324
|
+
|
325
|
+
header_params = {}
|
326
|
+
if request.parent
|
327
|
+
header_params["parent"] = request.parent
|
328
|
+
end
|
329
|
+
|
330
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
331
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
332
|
+
|
333
|
+
options.apply_defaults timeout: @config.rpcs.list_tasks.timeout,
|
334
|
+
metadata: metadata,
|
335
|
+
retry_policy: @config.rpcs.list_tasks.retry_policy
|
336
|
+
|
337
|
+
options.apply_defaults timeout: @config.timeout,
|
338
|
+
metadata: @config.metadata,
|
339
|
+
retry_policy: @config.retry_policy
|
340
|
+
|
341
|
+
@tasks_stub.call_rpc :list_tasks, request, options: options do |response, operation|
|
342
|
+
response = ::Gapic::PagedEnumerable.new @tasks_stub, :list_tasks, request, response, operation, options
|
343
|
+
yield response, operation if block_given?
|
344
|
+
return response
|
345
|
+
end
|
346
|
+
rescue ::GRPC::BadStatus => e
|
347
|
+
raise ::Google::Cloud::Error.from_error(e)
|
348
|
+
end
|
349
|
+
|
350
|
+
##
|
351
|
+
# Configuration class for the Tasks API.
|
352
|
+
#
|
353
|
+
# This class represents the configuration for Tasks,
|
354
|
+
# providing control over timeouts, retry behavior, logging, transport
|
355
|
+
# parameters, and other low-level controls. Certain parameters can also be
|
356
|
+
# applied individually to specific RPCs. See
|
357
|
+
# {::Google::Cloud::Run::V2::Tasks::Client::Configuration::Rpcs}
|
358
|
+
# for a list of RPCs that can be configured independently.
|
359
|
+
#
|
360
|
+
# Configuration can be applied globally to all clients, or to a single client
|
361
|
+
# on construction.
|
362
|
+
#
|
363
|
+
# @example
|
364
|
+
#
|
365
|
+
# # Modify the global config, setting the timeout for
|
366
|
+
# # get_task to 20 seconds,
|
367
|
+
# # and all remaining timeouts to 10 seconds.
|
368
|
+
# ::Google::Cloud::Run::V2::Tasks::Client.configure do |config|
|
369
|
+
# config.timeout = 10.0
|
370
|
+
# config.rpcs.get_task.timeout = 20.0
|
371
|
+
# end
|
372
|
+
#
|
373
|
+
# # Apply the above configuration only to a new client.
|
374
|
+
# client = ::Google::Cloud::Run::V2::Tasks::Client.new do |config|
|
375
|
+
# config.timeout = 10.0
|
376
|
+
# config.rpcs.get_task.timeout = 20.0
|
377
|
+
# end
|
378
|
+
#
|
379
|
+
# @!attribute [rw] endpoint
|
380
|
+
# The hostname or hostname:port of the service endpoint.
|
381
|
+
# Defaults to `"run.googleapis.com"`.
|
382
|
+
# @return [::String]
|
383
|
+
# @!attribute [rw] credentials
|
384
|
+
# Credentials to send with calls. You may provide any of the following types:
|
385
|
+
# * (`String`) The path to a service account key file in JSON format
|
386
|
+
# * (`Hash`) A service account key as a Hash
|
387
|
+
# * (`Google::Auth::Credentials`) A googleauth credentials object
|
388
|
+
# (see the [googleauth docs](https://googleapis.dev/ruby/googleauth/latest/index.html))
|
389
|
+
# * (`Signet::OAuth2::Client`) A signet oauth2 client object
|
390
|
+
# (see the [signet docs](https://googleapis.dev/ruby/signet/latest/Signet/OAuth2/Client.html))
|
391
|
+
# * (`GRPC::Core::Channel`) a gRPC channel with included credentials
|
392
|
+
# * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
|
393
|
+
# * (`nil`) indicating no credentials
|
394
|
+
# @return [::Object]
|
395
|
+
# @!attribute [rw] scope
|
396
|
+
# The OAuth scopes
|
397
|
+
# @return [::Array<::String>]
|
398
|
+
# @!attribute [rw] lib_name
|
399
|
+
# The library name as recorded in instrumentation and logging
|
400
|
+
# @return [::String]
|
401
|
+
# @!attribute [rw] lib_version
|
402
|
+
# The library version as recorded in instrumentation and logging
|
403
|
+
# @return [::String]
|
404
|
+
# @!attribute [rw] channel_args
|
405
|
+
# Extra parameters passed to the gRPC channel. Note: this is ignored if a
|
406
|
+
# `GRPC::Core::Channel` object is provided as the credential.
|
407
|
+
# @return [::Hash]
|
408
|
+
# @!attribute [rw] interceptors
|
409
|
+
# An array of interceptors that are run before calls are executed.
|
410
|
+
# @return [::Array<::GRPC::ClientInterceptor>]
|
411
|
+
# @!attribute [rw] timeout
|
412
|
+
# The call timeout in seconds.
|
413
|
+
# @return [::Numeric]
|
414
|
+
# @!attribute [rw] metadata
|
415
|
+
# Additional gRPC headers to be sent with the call.
|
416
|
+
# @return [::Hash{::Symbol=>::String}]
|
417
|
+
# @!attribute [rw] retry_policy
|
418
|
+
# The retry policy. The value is a hash with the following keys:
|
419
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
420
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
421
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
422
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
423
|
+
# trigger a retry.
|
424
|
+
# @return [::Hash]
|
425
|
+
# @!attribute [rw] quota_project
|
426
|
+
# A separate project against which to charge quota.
|
427
|
+
# @return [::String]
|
428
|
+
#
|
429
|
+
class Configuration
|
430
|
+
extend ::Gapic::Config
|
431
|
+
|
432
|
+
config_attr :endpoint, "run.googleapis.com", ::String
|
433
|
+
config_attr :credentials, nil do |value|
|
434
|
+
allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
|
435
|
+
allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
|
436
|
+
allowed.any? { |klass| klass === value }
|
437
|
+
end
|
438
|
+
config_attr :scope, nil, ::String, ::Array, nil
|
439
|
+
config_attr :lib_name, nil, ::String, nil
|
440
|
+
config_attr :lib_version, nil, ::String, nil
|
441
|
+
config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
|
442
|
+
config_attr :interceptors, nil, ::Array, nil
|
443
|
+
config_attr :timeout, nil, ::Numeric, nil
|
444
|
+
config_attr :metadata, nil, ::Hash, nil
|
445
|
+
config_attr :retry_policy, nil, ::Hash, ::Proc, nil
|
446
|
+
config_attr :quota_project, nil, ::String, nil
|
447
|
+
|
448
|
+
# @private
|
449
|
+
def initialize parent_config = nil
|
450
|
+
@parent_config = parent_config unless parent_config.nil?
|
451
|
+
|
452
|
+
yield self if block_given?
|
453
|
+
end
|
454
|
+
|
455
|
+
##
|
456
|
+
# Configurations for individual RPCs
|
457
|
+
# @return [Rpcs]
|
458
|
+
#
|
459
|
+
def rpcs
|
460
|
+
@rpcs ||= begin
|
461
|
+
parent_rpcs = nil
|
462
|
+
parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
|
463
|
+
Rpcs.new parent_rpcs
|
464
|
+
end
|
465
|
+
end
|
466
|
+
|
467
|
+
##
|
468
|
+
# Configuration RPC class for the Tasks API.
|
469
|
+
#
|
470
|
+
# Includes fields providing the configuration for each RPC in this service.
|
471
|
+
# Each configuration object is of type `Gapic::Config::Method` and includes
|
472
|
+
# the following configuration fields:
|
473
|
+
#
|
474
|
+
# * `timeout` (*type:* `Numeric`) - The call timeout in seconds
|
475
|
+
# * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
|
476
|
+
# * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
|
477
|
+
# include the following keys:
|
478
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
479
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
480
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
481
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
482
|
+
# trigger a retry.
|
483
|
+
#
|
484
|
+
class Rpcs
|
485
|
+
##
|
486
|
+
# RPC-specific configuration for `get_task`
|
487
|
+
# @return [::Gapic::Config::Method]
|
488
|
+
#
|
489
|
+
attr_reader :get_task
|
490
|
+
##
|
491
|
+
# RPC-specific configuration for `list_tasks`
|
492
|
+
# @return [::Gapic::Config::Method]
|
493
|
+
#
|
494
|
+
attr_reader :list_tasks
|
495
|
+
|
496
|
+
# @private
|
497
|
+
def initialize parent_rpcs = nil
|
498
|
+
get_task_config = parent_rpcs.get_task if parent_rpcs.respond_to? :get_task
|
499
|
+
@get_task = ::Gapic::Config::Method.new get_task_config
|
500
|
+
list_tasks_config = parent_rpcs.list_tasks if parent_rpcs.respond_to? :list_tasks
|
501
|
+
@list_tasks = ::Gapic::Config::Method.new list_tasks_config
|
502
|
+
|
503
|
+
yield self if block_given?
|
504
|
+
end
|
505
|
+
end
|
506
|
+
end
|
507
|
+
end
|
508
|
+
end
|
509
|
+
end
|
510
|
+
end
|
511
|
+
end
|
512
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2022 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 "googleauth"
|
20
|
+
|
21
|
+
module Google
|
22
|
+
module Cloud
|
23
|
+
module Run
|
24
|
+
module V2
|
25
|
+
module Tasks
|
26
|
+
# Credentials for the Tasks API.
|
27
|
+
class Credentials < ::Google::Auth::Credentials
|
28
|
+
self.scope = [
|
29
|
+
"https://www.googleapis.com/auth/cloud-platform"
|
30
|
+
]
|
31
|
+
self.env_vars = [
|
32
|
+
"GOOGLE_CLOUD_CREDENTIALS",
|
33
|
+
"GOOGLE_CLOUD_KEYFILE",
|
34
|
+
"GCLOUD_KEYFILE",
|
35
|
+
"GOOGLE_CLOUD_CREDENTIALS_JSON",
|
36
|
+
"GOOGLE_CLOUD_KEYFILE_JSON",
|
37
|
+
"GCLOUD_KEYFILE_JSON"
|
38
|
+
]
|
39
|
+
self.paths = [
|
40
|
+
"~/.config/google_cloud/application_default_credentials.json"
|
41
|
+
]
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,77 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2022 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
|
+
|
20
|
+
module Google
|
21
|
+
module Cloud
|
22
|
+
module Run
|
23
|
+
module V2
|
24
|
+
module Tasks
|
25
|
+
# Path helper methods for the Tasks API.
|
26
|
+
module Paths
|
27
|
+
##
|
28
|
+
# Create a fully-qualified Execution resource string.
|
29
|
+
#
|
30
|
+
# The resource will be in the following format:
|
31
|
+
#
|
32
|
+
# `projects/{project}/locations/{location}/jobs/{job}/executions/{execution}`
|
33
|
+
#
|
34
|
+
# @param project [String]
|
35
|
+
# @param location [String]
|
36
|
+
# @param job [String]
|
37
|
+
# @param execution [String]
|
38
|
+
#
|
39
|
+
# @return [::String]
|
40
|
+
def execution_path project:, location:, job:, execution:
|
41
|
+
raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
|
42
|
+
raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/"
|
43
|
+
raise ::ArgumentError, "job cannot contain /" if job.to_s.include? "/"
|
44
|
+
|
45
|
+
"projects/#{project}/locations/#{location}/jobs/#{job}/executions/#{execution}"
|
46
|
+
end
|
47
|
+
|
48
|
+
##
|
49
|
+
# Create a fully-qualified Task resource string.
|
50
|
+
#
|
51
|
+
# The resource will be in the following format:
|
52
|
+
#
|
53
|
+
# `projects/{project}/locations/{location}/jobs/{job}/executions/{execution}/tasks/{task}`
|
54
|
+
#
|
55
|
+
# @param project [String]
|
56
|
+
# @param location [String]
|
57
|
+
# @param job [String]
|
58
|
+
# @param execution [String]
|
59
|
+
# @param task [String]
|
60
|
+
#
|
61
|
+
# @return [::String]
|
62
|
+
def task_path project:, location:, job:, execution:, task:
|
63
|
+
raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
|
64
|
+
raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/"
|
65
|
+
raise ::ArgumentError, "job cannot contain /" if job.to_s.include? "/"
|
66
|
+
raise ::ArgumentError, "execution cannot contain /" if execution.to_s.include? "/"
|
67
|
+
|
68
|
+
"projects/#{project}/locations/#{location}/jobs/#{job}/executions/#{execution}/tasks/#{task}"
|
69
|
+
end
|
70
|
+
|
71
|
+
extend self
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2022 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/run/v2/version"
|
24
|
+
|
25
|
+
require "google/cloud/run/v2/tasks/credentials"
|
26
|
+
require "google/cloud/run/v2/tasks/paths"
|
27
|
+
require "google/cloud/run/v2/tasks/client"
|
28
|
+
|
29
|
+
module Google
|
30
|
+
module Cloud
|
31
|
+
module Run
|
32
|
+
module V2
|
33
|
+
##
|
34
|
+
# Cloud Run Task Control Plane API.
|
35
|
+
#
|
36
|
+
# @example Load this service and instantiate a gRPC client
|
37
|
+
#
|
38
|
+
# require "google/cloud/run/v2/tasks"
|
39
|
+
# client = ::Google::Cloud::Run::V2::Tasks::Client.new
|
40
|
+
#
|
41
|
+
module Tasks
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
helper_path = ::File.join __dir__, "tasks", "helpers.rb"
|
49
|
+
require "google/cloud/run/v2/tasks/helpers" if ::File.file? helper_path
|