google-cloud-run-v2 0.4.0 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/AUTHENTICATION.md +6 -6
- data/README.md +3 -3
- data/lib/google/cloud/run/v2/execution_pb.rb +76 -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 +770 -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 +104 -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 +770 -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_services_pb.rb +2 -2
- data/lib/google/cloud/run/v2/revisions/client.rb +2 -2
- 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/task_pb.rb +81 -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/version.rb +1 -1
- data/lib/google/cloud/run/v2.rb +4 -1
- data/proto_docs/google/cloud/run/v2/execution.rb +223 -0
- data/proto_docs/google/cloud/run/v2/execution_template.rb +76 -0
- data/proto_docs/google/cloud/run/v2/job.rb +308 -0
- data/proto_docs/google/cloud/run/v2/k8s.min.rb +29 -7
- data/proto_docs/google/cloud/run/v2/service.rb +11 -8
- data/proto_docs/google/cloud/run/v2/task.rb +229 -0
- data/proto_docs/google/cloud/run/v2/task_template.rb +66 -0
- data/proto_docs/google/cloud/run/v2/vendor_settings.rb +2 -1
- metadata +29 -2
@@ -0,0 +1,635 @@
|
|
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/execution_pb"
|
21
|
+
require "google/cloud/location"
|
22
|
+
|
23
|
+
module Google
|
24
|
+
module Cloud
|
25
|
+
module Run
|
26
|
+
module V2
|
27
|
+
module Executions
|
28
|
+
##
|
29
|
+
# Client for the Executions service.
|
30
|
+
#
|
31
|
+
# Cloud Run Execution Control Plane API.
|
32
|
+
#
|
33
|
+
class Client
|
34
|
+
include Paths
|
35
|
+
|
36
|
+
# @private
|
37
|
+
attr_reader :executions_stub
|
38
|
+
|
39
|
+
##
|
40
|
+
# Configure the Executions Client class.
|
41
|
+
#
|
42
|
+
# See {::Google::Cloud::Run::V2::Executions::Client::Configuration}
|
43
|
+
# for a description of the configuration fields.
|
44
|
+
#
|
45
|
+
# @example
|
46
|
+
#
|
47
|
+
# # Modify the configuration for all Executions clients
|
48
|
+
# ::Google::Cloud::Run::V2::Executions::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 Executions 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::Executions::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 Executions client object.
|
96
|
+
#
|
97
|
+
# @example
|
98
|
+
#
|
99
|
+
# # Create a client using the default configuration
|
100
|
+
# client = ::Google::Cloud::Run::V2::Executions::Client.new
|
101
|
+
#
|
102
|
+
# # Create a client using a custom configuration
|
103
|
+
# client = ::Google::Cloud::Run::V2::Executions::Client.new do |config|
|
104
|
+
# config.timeout = 10.0
|
105
|
+
# end
|
106
|
+
#
|
107
|
+
# @yield [config] Configure the Executions 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/execution_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
|
+
@operations_client = Operations.new do |config|
|
138
|
+
config.credentials = credentials
|
139
|
+
config.quota_project = @quota_project_id
|
140
|
+
config.endpoint = @config.endpoint
|
141
|
+
end
|
142
|
+
|
143
|
+
@location_client = Google::Cloud::Location::Locations::Client.new do |config|
|
144
|
+
config.credentials = credentials
|
145
|
+
config.quota_project = @quota_project_id
|
146
|
+
config.endpoint = @config.endpoint
|
147
|
+
end
|
148
|
+
|
149
|
+
@executions_stub = ::Gapic::ServiceStub.new(
|
150
|
+
::Google::Cloud::Run::V2::Executions::Stub,
|
151
|
+
credentials: credentials,
|
152
|
+
endpoint: @config.endpoint,
|
153
|
+
channel_args: @config.channel_args,
|
154
|
+
interceptors: @config.interceptors
|
155
|
+
)
|
156
|
+
end
|
157
|
+
|
158
|
+
##
|
159
|
+
# Get the associated client for long-running operations.
|
160
|
+
#
|
161
|
+
# @return [::Google::Cloud::Run::V2::Executions::Operations]
|
162
|
+
#
|
163
|
+
attr_reader :operations_client
|
164
|
+
|
165
|
+
##
|
166
|
+
# Get the associated client for mix-in of the Locations.
|
167
|
+
#
|
168
|
+
# @return [Google::Cloud::Location::Locations::Client]
|
169
|
+
#
|
170
|
+
attr_reader :location_client
|
171
|
+
|
172
|
+
# Service calls
|
173
|
+
|
174
|
+
##
|
175
|
+
# Gets information about an Execution.
|
176
|
+
#
|
177
|
+
# @overload get_execution(request, options = nil)
|
178
|
+
# Pass arguments to `get_execution` via a request object, either of type
|
179
|
+
# {::Google::Cloud::Run::V2::GetExecutionRequest} or an equivalent Hash.
|
180
|
+
#
|
181
|
+
# @param request [::Google::Cloud::Run::V2::GetExecutionRequest, ::Hash]
|
182
|
+
# A request object representing the call parameters. Required. To specify no
|
183
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
184
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
185
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
186
|
+
#
|
187
|
+
# @overload get_execution(name: nil)
|
188
|
+
# Pass arguments to `get_execution` via keyword arguments. Note that at
|
189
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
190
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
191
|
+
#
|
192
|
+
# @param name [::String]
|
193
|
+
# Required. The full name of the Execution.
|
194
|
+
# Format:
|
195
|
+
# projects/\\{project}/locations/\\{location}/jobs/\\{job}/executions/\\{execution},
|
196
|
+
# where \\{project} can be project id or number.
|
197
|
+
#
|
198
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
199
|
+
# @yieldparam response [::Google::Cloud::Run::V2::Execution]
|
200
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
201
|
+
#
|
202
|
+
# @return [::Google::Cloud::Run::V2::Execution]
|
203
|
+
#
|
204
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
205
|
+
#
|
206
|
+
# @example Basic example
|
207
|
+
# require "google/cloud/run/v2"
|
208
|
+
#
|
209
|
+
# # Create a client object. The client can be reused for multiple calls.
|
210
|
+
# client = Google::Cloud::Run::V2::Executions::Client.new
|
211
|
+
#
|
212
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
213
|
+
# request = Google::Cloud::Run::V2::GetExecutionRequest.new
|
214
|
+
#
|
215
|
+
# # Call the get_execution method.
|
216
|
+
# result = client.get_execution request
|
217
|
+
#
|
218
|
+
# # The returned object is of type Google::Cloud::Run::V2::Execution.
|
219
|
+
# p result
|
220
|
+
#
|
221
|
+
def get_execution request, options = nil
|
222
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
223
|
+
|
224
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Run::V2::GetExecutionRequest
|
225
|
+
|
226
|
+
# Converts hash and nil to an options object
|
227
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
228
|
+
|
229
|
+
# Customize the options with defaults
|
230
|
+
metadata = @config.rpcs.get_execution.metadata.to_h
|
231
|
+
|
232
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
233
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
234
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
235
|
+
gapic_version: ::Google::Cloud::Run::V2::VERSION
|
236
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
237
|
+
|
238
|
+
header_params = {}
|
239
|
+
if request.name
|
240
|
+
header_params["name"] = request.name
|
241
|
+
end
|
242
|
+
|
243
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
244
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
245
|
+
|
246
|
+
options.apply_defaults timeout: @config.rpcs.get_execution.timeout,
|
247
|
+
metadata: metadata,
|
248
|
+
retry_policy: @config.rpcs.get_execution.retry_policy
|
249
|
+
|
250
|
+
options.apply_defaults timeout: @config.timeout,
|
251
|
+
metadata: @config.metadata,
|
252
|
+
retry_policy: @config.retry_policy
|
253
|
+
|
254
|
+
@executions_stub.call_rpc :get_execution, request, options: options do |response, operation|
|
255
|
+
yield response, operation if block_given?
|
256
|
+
return response
|
257
|
+
end
|
258
|
+
rescue ::GRPC::BadStatus => e
|
259
|
+
raise ::Google::Cloud::Error.from_error(e)
|
260
|
+
end
|
261
|
+
|
262
|
+
##
|
263
|
+
# Lists Executions from a Job.
|
264
|
+
#
|
265
|
+
# @overload list_executions(request, options = nil)
|
266
|
+
# Pass arguments to `list_executions` via a request object, either of type
|
267
|
+
# {::Google::Cloud::Run::V2::ListExecutionsRequest} or an equivalent Hash.
|
268
|
+
#
|
269
|
+
# @param request [::Google::Cloud::Run::V2::ListExecutionsRequest, ::Hash]
|
270
|
+
# A request object representing the call parameters. Required. To specify no
|
271
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
272
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
273
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
274
|
+
#
|
275
|
+
# @overload list_executions(parent: nil, page_size: nil, page_token: nil, show_deleted: nil)
|
276
|
+
# Pass arguments to `list_executions` via keyword arguments. Note that at
|
277
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
278
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
279
|
+
#
|
280
|
+
# @param parent [::String]
|
281
|
+
# Required. The Execution from which the Executions should be listed.
|
282
|
+
# To list all Executions across Jobs, use "-" instead of Job name.
|
283
|
+
# Format: projects/\\{project}/locations/\\{location}/jobs/\\{job}, where \\{project}
|
284
|
+
# can be project id or number.
|
285
|
+
# @param page_size [::Integer]
|
286
|
+
# Maximum number of Executions to return in this call.
|
287
|
+
# @param page_token [::String]
|
288
|
+
# A page token received from a previous call to ListExecutions.
|
289
|
+
# All other parameters must match.
|
290
|
+
# @param show_deleted [::Boolean]
|
291
|
+
# If true, returns deleted (but unexpired) resources along with active ones.
|
292
|
+
#
|
293
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
294
|
+
# @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::Run::V2::Execution>]
|
295
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
296
|
+
#
|
297
|
+
# @return [::Gapic::PagedEnumerable<::Google::Cloud::Run::V2::Execution>]
|
298
|
+
#
|
299
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
300
|
+
#
|
301
|
+
# @example Basic example
|
302
|
+
# require "google/cloud/run/v2"
|
303
|
+
#
|
304
|
+
# # Create a client object. The client can be reused for multiple calls.
|
305
|
+
# client = Google::Cloud::Run::V2::Executions::Client.new
|
306
|
+
#
|
307
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
308
|
+
# request = Google::Cloud::Run::V2::ListExecutionsRequest.new
|
309
|
+
#
|
310
|
+
# # Call the list_executions method.
|
311
|
+
# result = client.list_executions request
|
312
|
+
#
|
313
|
+
# # The returned object is of type Gapic::PagedEnumerable. You can
|
314
|
+
# # iterate over all elements by calling #each, and the enumerable
|
315
|
+
# # will lazily make API calls to fetch subsequent pages. Other
|
316
|
+
# # methods are also available for managing paging directly.
|
317
|
+
# result.each do |response|
|
318
|
+
# # Each element is of type ::Google::Cloud::Run::V2::Execution.
|
319
|
+
# p response
|
320
|
+
# end
|
321
|
+
#
|
322
|
+
def list_executions request, options = nil
|
323
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
324
|
+
|
325
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Run::V2::ListExecutionsRequest
|
326
|
+
|
327
|
+
# Converts hash and nil to an options object
|
328
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
329
|
+
|
330
|
+
# Customize the options with defaults
|
331
|
+
metadata = @config.rpcs.list_executions.metadata.to_h
|
332
|
+
|
333
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
334
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
335
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
336
|
+
gapic_version: ::Google::Cloud::Run::V2::VERSION
|
337
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
338
|
+
|
339
|
+
header_params = {}
|
340
|
+
if request.parent
|
341
|
+
header_params["parent"] = request.parent
|
342
|
+
end
|
343
|
+
|
344
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
345
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
346
|
+
|
347
|
+
options.apply_defaults timeout: @config.rpcs.list_executions.timeout,
|
348
|
+
metadata: metadata,
|
349
|
+
retry_policy: @config.rpcs.list_executions.retry_policy
|
350
|
+
|
351
|
+
options.apply_defaults timeout: @config.timeout,
|
352
|
+
metadata: @config.metadata,
|
353
|
+
retry_policy: @config.retry_policy
|
354
|
+
|
355
|
+
@executions_stub.call_rpc :list_executions, request, options: options do |response, operation|
|
356
|
+
response = ::Gapic::PagedEnumerable.new @executions_stub, :list_executions, request, response, operation, options
|
357
|
+
yield response, operation if block_given?
|
358
|
+
return response
|
359
|
+
end
|
360
|
+
rescue ::GRPC::BadStatus => e
|
361
|
+
raise ::Google::Cloud::Error.from_error(e)
|
362
|
+
end
|
363
|
+
|
364
|
+
##
|
365
|
+
# Deletes an Execution.
|
366
|
+
#
|
367
|
+
# @overload delete_execution(request, options = nil)
|
368
|
+
# Pass arguments to `delete_execution` via a request object, either of type
|
369
|
+
# {::Google::Cloud::Run::V2::DeleteExecutionRequest} or an equivalent Hash.
|
370
|
+
#
|
371
|
+
# @param request [::Google::Cloud::Run::V2::DeleteExecutionRequest, ::Hash]
|
372
|
+
# A request object representing the call parameters. Required. To specify no
|
373
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
374
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
375
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
376
|
+
#
|
377
|
+
# @overload delete_execution(name: nil, validate_only: nil, etag: nil)
|
378
|
+
# Pass arguments to `delete_execution` via keyword arguments. Note that at
|
379
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
380
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
381
|
+
#
|
382
|
+
# @param name [::String]
|
383
|
+
# Required. The name of the Execution to delete.
|
384
|
+
# Format:
|
385
|
+
# projects/\\{project}/locations/\\{location}/jobs/\\{job}/executions/\\{execution},
|
386
|
+
# where \\{project} can be project id or number.
|
387
|
+
# @param validate_only [::Boolean]
|
388
|
+
# Indicates that the request should be validated without actually
|
389
|
+
# deleting any resources.
|
390
|
+
# @param etag [::String]
|
391
|
+
# A system-generated fingerprint for this version of the resource.
|
392
|
+
# This may be used to detect modification conflict during updates.
|
393
|
+
#
|
394
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
395
|
+
# @yieldparam response [::Gapic::Operation]
|
396
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
397
|
+
#
|
398
|
+
# @return [::Gapic::Operation]
|
399
|
+
#
|
400
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
401
|
+
#
|
402
|
+
# @example Basic example
|
403
|
+
# require "google/cloud/run/v2"
|
404
|
+
#
|
405
|
+
# # Create a client object. The client can be reused for multiple calls.
|
406
|
+
# client = Google::Cloud::Run::V2::Executions::Client.new
|
407
|
+
#
|
408
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
409
|
+
# request = Google::Cloud::Run::V2::DeleteExecutionRequest.new
|
410
|
+
#
|
411
|
+
# # Call the delete_execution method.
|
412
|
+
# result = client.delete_execution request
|
413
|
+
#
|
414
|
+
# # The returned object is of type Gapic::Operation. You can use this
|
415
|
+
# # object to check the status of an operation, cancel it, or wait
|
416
|
+
# # for results. Here is how to block until completion:
|
417
|
+
# result.wait_until_done! timeout: 60
|
418
|
+
# if result.response?
|
419
|
+
# p result.response
|
420
|
+
# else
|
421
|
+
# puts "Error!"
|
422
|
+
# end
|
423
|
+
#
|
424
|
+
def delete_execution request, options = nil
|
425
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
426
|
+
|
427
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Run::V2::DeleteExecutionRequest
|
428
|
+
|
429
|
+
# Converts hash and nil to an options object
|
430
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
431
|
+
|
432
|
+
# Customize the options with defaults
|
433
|
+
metadata = @config.rpcs.delete_execution.metadata.to_h
|
434
|
+
|
435
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
436
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
437
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
438
|
+
gapic_version: ::Google::Cloud::Run::V2::VERSION
|
439
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
440
|
+
|
441
|
+
header_params = {}
|
442
|
+
if request.name
|
443
|
+
header_params["name"] = request.name
|
444
|
+
end
|
445
|
+
|
446
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
447
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
448
|
+
|
449
|
+
options.apply_defaults timeout: @config.rpcs.delete_execution.timeout,
|
450
|
+
metadata: metadata,
|
451
|
+
retry_policy: @config.rpcs.delete_execution.retry_policy
|
452
|
+
|
453
|
+
options.apply_defaults timeout: @config.timeout,
|
454
|
+
metadata: @config.metadata,
|
455
|
+
retry_policy: @config.retry_policy
|
456
|
+
|
457
|
+
@executions_stub.call_rpc :delete_execution, request, options: options do |response, operation|
|
458
|
+
response = ::Gapic::Operation.new response, @operations_client, options: options
|
459
|
+
yield response, operation if block_given?
|
460
|
+
return response
|
461
|
+
end
|
462
|
+
rescue ::GRPC::BadStatus => e
|
463
|
+
raise ::Google::Cloud::Error.from_error(e)
|
464
|
+
end
|
465
|
+
|
466
|
+
##
|
467
|
+
# Configuration class for the Executions API.
|
468
|
+
#
|
469
|
+
# This class represents the configuration for Executions,
|
470
|
+
# providing control over timeouts, retry behavior, logging, transport
|
471
|
+
# parameters, and other low-level controls. Certain parameters can also be
|
472
|
+
# applied individually to specific RPCs. See
|
473
|
+
# {::Google::Cloud::Run::V2::Executions::Client::Configuration::Rpcs}
|
474
|
+
# for a list of RPCs that can be configured independently.
|
475
|
+
#
|
476
|
+
# Configuration can be applied globally to all clients, or to a single client
|
477
|
+
# on construction.
|
478
|
+
#
|
479
|
+
# @example
|
480
|
+
#
|
481
|
+
# # Modify the global config, setting the timeout for
|
482
|
+
# # get_execution to 20 seconds,
|
483
|
+
# # and all remaining timeouts to 10 seconds.
|
484
|
+
# ::Google::Cloud::Run::V2::Executions::Client.configure do |config|
|
485
|
+
# config.timeout = 10.0
|
486
|
+
# config.rpcs.get_execution.timeout = 20.0
|
487
|
+
# end
|
488
|
+
#
|
489
|
+
# # Apply the above configuration only to a new client.
|
490
|
+
# client = ::Google::Cloud::Run::V2::Executions::Client.new do |config|
|
491
|
+
# config.timeout = 10.0
|
492
|
+
# config.rpcs.get_execution.timeout = 20.0
|
493
|
+
# end
|
494
|
+
#
|
495
|
+
# @!attribute [rw] endpoint
|
496
|
+
# The hostname or hostname:port of the service endpoint.
|
497
|
+
# Defaults to `"run.googleapis.com"`.
|
498
|
+
# @return [::String]
|
499
|
+
# @!attribute [rw] credentials
|
500
|
+
# Credentials to send with calls. You may provide any of the following types:
|
501
|
+
# * (`String`) The path to a service account key file in JSON format
|
502
|
+
# * (`Hash`) A service account key as a Hash
|
503
|
+
# * (`Google::Auth::Credentials`) A googleauth credentials object
|
504
|
+
# (see the [googleauth docs](https://googleapis.dev/ruby/googleauth/latest/index.html))
|
505
|
+
# * (`Signet::OAuth2::Client`) A signet oauth2 client object
|
506
|
+
# (see the [signet docs](https://googleapis.dev/ruby/signet/latest/Signet/OAuth2/Client.html))
|
507
|
+
# * (`GRPC::Core::Channel`) a gRPC channel with included credentials
|
508
|
+
# * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
|
509
|
+
# * (`nil`) indicating no credentials
|
510
|
+
# @return [::Object]
|
511
|
+
# @!attribute [rw] scope
|
512
|
+
# The OAuth scopes
|
513
|
+
# @return [::Array<::String>]
|
514
|
+
# @!attribute [rw] lib_name
|
515
|
+
# The library name as recorded in instrumentation and logging
|
516
|
+
# @return [::String]
|
517
|
+
# @!attribute [rw] lib_version
|
518
|
+
# The library version as recorded in instrumentation and logging
|
519
|
+
# @return [::String]
|
520
|
+
# @!attribute [rw] channel_args
|
521
|
+
# Extra parameters passed to the gRPC channel. Note: this is ignored if a
|
522
|
+
# `GRPC::Core::Channel` object is provided as the credential.
|
523
|
+
# @return [::Hash]
|
524
|
+
# @!attribute [rw] interceptors
|
525
|
+
# An array of interceptors that are run before calls are executed.
|
526
|
+
# @return [::Array<::GRPC::ClientInterceptor>]
|
527
|
+
# @!attribute [rw] timeout
|
528
|
+
# The call timeout in seconds.
|
529
|
+
# @return [::Numeric]
|
530
|
+
# @!attribute [rw] metadata
|
531
|
+
# Additional gRPC headers to be sent with the call.
|
532
|
+
# @return [::Hash{::Symbol=>::String}]
|
533
|
+
# @!attribute [rw] retry_policy
|
534
|
+
# The retry policy. The value is a hash with the following keys:
|
535
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
536
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
537
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
538
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
539
|
+
# trigger a retry.
|
540
|
+
# @return [::Hash]
|
541
|
+
# @!attribute [rw] quota_project
|
542
|
+
# A separate project against which to charge quota.
|
543
|
+
# @return [::String]
|
544
|
+
#
|
545
|
+
class Configuration
|
546
|
+
extend ::Gapic::Config
|
547
|
+
|
548
|
+
config_attr :endpoint, "run.googleapis.com", ::String
|
549
|
+
config_attr :credentials, nil do |value|
|
550
|
+
allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
|
551
|
+
allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
|
552
|
+
allowed.any? { |klass| klass === value }
|
553
|
+
end
|
554
|
+
config_attr :scope, nil, ::String, ::Array, nil
|
555
|
+
config_attr :lib_name, nil, ::String, nil
|
556
|
+
config_attr :lib_version, nil, ::String, nil
|
557
|
+
config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
|
558
|
+
config_attr :interceptors, nil, ::Array, nil
|
559
|
+
config_attr :timeout, nil, ::Numeric, nil
|
560
|
+
config_attr :metadata, nil, ::Hash, nil
|
561
|
+
config_attr :retry_policy, nil, ::Hash, ::Proc, nil
|
562
|
+
config_attr :quota_project, nil, ::String, nil
|
563
|
+
|
564
|
+
# @private
|
565
|
+
def initialize parent_config = nil
|
566
|
+
@parent_config = parent_config unless parent_config.nil?
|
567
|
+
|
568
|
+
yield self if block_given?
|
569
|
+
end
|
570
|
+
|
571
|
+
##
|
572
|
+
# Configurations for individual RPCs
|
573
|
+
# @return [Rpcs]
|
574
|
+
#
|
575
|
+
def rpcs
|
576
|
+
@rpcs ||= begin
|
577
|
+
parent_rpcs = nil
|
578
|
+
parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
|
579
|
+
Rpcs.new parent_rpcs
|
580
|
+
end
|
581
|
+
end
|
582
|
+
|
583
|
+
##
|
584
|
+
# Configuration RPC class for the Executions API.
|
585
|
+
#
|
586
|
+
# Includes fields providing the configuration for each RPC in this service.
|
587
|
+
# Each configuration object is of type `Gapic::Config::Method` and includes
|
588
|
+
# the following configuration fields:
|
589
|
+
#
|
590
|
+
# * `timeout` (*type:* `Numeric`) - The call timeout in seconds
|
591
|
+
# * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
|
592
|
+
# * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
|
593
|
+
# include the following keys:
|
594
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
595
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
596
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
597
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
598
|
+
# trigger a retry.
|
599
|
+
#
|
600
|
+
class Rpcs
|
601
|
+
##
|
602
|
+
# RPC-specific configuration for `get_execution`
|
603
|
+
# @return [::Gapic::Config::Method]
|
604
|
+
#
|
605
|
+
attr_reader :get_execution
|
606
|
+
##
|
607
|
+
# RPC-specific configuration for `list_executions`
|
608
|
+
# @return [::Gapic::Config::Method]
|
609
|
+
#
|
610
|
+
attr_reader :list_executions
|
611
|
+
##
|
612
|
+
# RPC-specific configuration for `delete_execution`
|
613
|
+
# @return [::Gapic::Config::Method]
|
614
|
+
#
|
615
|
+
attr_reader :delete_execution
|
616
|
+
|
617
|
+
# @private
|
618
|
+
def initialize parent_rpcs = nil
|
619
|
+
get_execution_config = parent_rpcs.get_execution if parent_rpcs.respond_to? :get_execution
|
620
|
+
@get_execution = ::Gapic::Config::Method.new get_execution_config
|
621
|
+
list_executions_config = parent_rpcs.list_executions if parent_rpcs.respond_to? :list_executions
|
622
|
+
@list_executions = ::Gapic::Config::Method.new list_executions_config
|
623
|
+
delete_execution_config = parent_rpcs.delete_execution if parent_rpcs.respond_to? :delete_execution
|
624
|
+
@delete_execution = ::Gapic::Config::Method.new delete_execution_config
|
625
|
+
|
626
|
+
yield self if block_given?
|
627
|
+
end
|
628
|
+
end
|
629
|
+
end
|
630
|
+
end
|
631
|
+
end
|
632
|
+
end
|
633
|
+
end
|
634
|
+
end
|
635
|
+
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 Executions
|
26
|
+
# Credentials for the Executions 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
|