google-cloud-run-v2 0.6.0 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/google/cloud/run/v2/executions/client.rb +8 -10
- data/lib/google/cloud/run/v2/executions/operations.rb +12 -14
- data/lib/google/cloud/run/v2/executions/rest/client.rb +533 -0
- data/lib/google/cloud/run/v2/executions/rest/operations.rb +935 -0
- data/lib/google/cloud/run/v2/executions/rest/service_stub.rb +225 -0
- data/lib/google/cloud/run/v2/executions/rest.rb +53 -0
- data/lib/google/cloud/run/v2/executions.rb +6 -0
- data/lib/google/cloud/run/v2/jobs/client.rb +20 -22
- data/lib/google/cloud/run/v2/jobs/operations.rb +12 -14
- data/lib/google/cloud/run/v2/jobs/rest/client.rb +998 -0
- data/lib/google/cloud/run/v2/jobs/rest/operations.rb +935 -0
- data/lib/google/cloud/run/v2/jobs/rest/service_stub.rb +584 -0
- data/lib/google/cloud/run/v2/jobs/rest.rb +53 -0
- data/lib/google/cloud/run/v2/jobs.rb +6 -0
- data/lib/google/cloud/run/v2/rest.rb +41 -0
- data/lib/google/cloud/run/v2/revisions/client.rb +8 -10
- data/lib/google/cloud/run/v2/revisions/operations.rb +12 -14
- data/lib/google/cloud/run/v2/revisions/rest/client.rb +531 -0
- data/lib/google/cloud/run/v2/revisions/rest/operations.rb +935 -0
- data/lib/google/cloud/run/v2/revisions/rest/service_stub.rb +225 -0
- data/lib/google/cloud/run/v2/revisions/rest.rb +53 -0
- data/lib/google/cloud/run/v2/revisions.rb +6 -0
- data/lib/google/cloud/run/v2/services/client.rb +16 -18
- data/lib/google/cloud/run/v2/services/operations.rb +12 -14
- data/lib/google/cloud/run/v2/services/rest/client.rb +940 -0
- data/lib/google/cloud/run/v2/services/rest/operations.rb +935 -0
- data/lib/google/cloud/run/v2/services/rest/service_stub.rb +524 -0
- data/lib/google/cloud/run/v2/services/rest.rb +53 -0
- data/lib/google/cloud/run/v2/services.rb +6 -0
- data/lib/google/cloud/run/v2/tasks/client.rb +4 -6
- data/lib/google/cloud/run/v2/tasks/rest/client.rb +440 -0
- data/lib/google/cloud/run/v2/tasks/rest/service_stub.rb +166 -0
- data/lib/google/cloud/run/v2/tasks/rest.rb +52 -0
- data/lib/google/cloud/run/v2/tasks.rb +6 -0
- data/lib/google/cloud/run/v2/version.rb +1 -1
- data/lib/google/cloud/run/v2.rb +5 -0
- metadata +32 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dad9ebca7de61efcf37ebddd0ad35e1c845a9203af957e0c4a8bf478f5f11f7a
|
4
|
+
data.tar.gz: 0dfabe3ddcce1d289a81ec7ab6afe0862f3653547fbc7f8235da0ce7dd349c35
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7ff5076a3dc534a09454dab52616222bc40ce36cf629a0046581e3c2b1aaad9be5da50da3260316f1e57b3305145702632c87a18b10b3a009545d6ffec10e0cb
|
7
|
+
data.tar.gz: 2d2e7554e6b12a99276bdf127ffbf2b82d805fc50e1f71dd6885ef7644741e8f9dc349f45124fdc694deae60781def5cc74c327f74ee3f791b8a991225fc07b9
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# Ruby Client for the Cloud Run V2 API
|
2
2
|
|
3
|
-
|
3
|
+
Deploy and manage user provided container images that scale automatically based on incoming requests. The Cloud Run Admin API v1 follows the Knative Serving API specification, while v2 is aligned with Google Cloud AIP-based API standards, as described in https://google.aip.dev/.
|
4
4
|
|
5
5
|
Cloud Run deploys and manages user provided container images that scale automatically based on incoming requests.
|
6
6
|
|
@@ -310,13 +310,11 @@ module Google
|
|
310
310
|
# # Call the list_executions method.
|
311
311
|
# result = client.list_executions request
|
312
312
|
#
|
313
|
-
# # The returned object is of type Gapic::PagedEnumerable. You can
|
314
|
-
# #
|
315
|
-
#
|
316
|
-
# # methods are also available for managing paging directly.
|
317
|
-
# result.each do |response|
|
313
|
+
# # The returned object is of type Gapic::PagedEnumerable. You can iterate
|
314
|
+
# # over elements, and API calls will be issued to fetch pages as needed.
|
315
|
+
# result.each do |item|
|
318
316
|
# # Each element is of type ::Google::Cloud::Run::V2::Execution.
|
319
|
-
# p
|
317
|
+
# p item
|
320
318
|
# end
|
321
319
|
#
|
322
320
|
def list_executions request, options = nil
|
@@ -411,14 +409,14 @@ module Google
|
|
411
409
|
# # Call the delete_execution method.
|
412
410
|
# result = client.delete_execution request
|
413
411
|
#
|
414
|
-
# # The returned object is of type Gapic::Operation. You can use
|
415
|
-
# #
|
416
|
-
# #
|
412
|
+
# # The returned object is of type Gapic::Operation. You can use it to
|
413
|
+
# # check the status of an operation, cancel it, or wait for results.
|
414
|
+
# # Here is how to wait for a response.
|
417
415
|
# result.wait_until_done! timeout: 60
|
418
416
|
# if result.response?
|
419
417
|
# p result.response
|
420
418
|
# else
|
421
|
-
# puts "
|
419
|
+
# puts "No response received."
|
422
420
|
# end
|
423
421
|
#
|
424
422
|
def delete_execution request, options = nil
|
@@ -158,13 +158,11 @@ module Google
|
|
158
158
|
# # Call the list_operations method.
|
159
159
|
# result = client.list_operations request
|
160
160
|
#
|
161
|
-
# # The returned object is of type Gapic::PagedEnumerable. You can
|
162
|
-
# #
|
163
|
-
#
|
164
|
-
# # methods are also available for managing paging directly.
|
165
|
-
# result.each do |response|
|
161
|
+
# # The returned object is of type Gapic::PagedEnumerable. You can iterate
|
162
|
+
# # over elements, and API calls will be issued to fetch pages as needed.
|
163
|
+
# result.each do |item|
|
166
164
|
# # Each element is of type ::Google::Longrunning::Operation.
|
167
|
-
# p
|
165
|
+
# p item
|
168
166
|
# end
|
169
167
|
#
|
170
168
|
def list_operations request, options = nil
|
@@ -253,14 +251,14 @@ module Google
|
|
253
251
|
# # Call the get_operation method.
|
254
252
|
# result = client.get_operation request
|
255
253
|
#
|
256
|
-
# # The returned object is of type Gapic::Operation. You can use
|
257
|
-
# #
|
258
|
-
# #
|
254
|
+
# # The returned object is of type Gapic::Operation. You can use it to
|
255
|
+
# # check the status of an operation, cancel it, or wait for results.
|
256
|
+
# # Here is how to wait for a response.
|
259
257
|
# result.wait_until_done! timeout: 60
|
260
258
|
# if result.response?
|
261
259
|
# p result.response
|
262
260
|
# else
|
263
|
-
# puts "
|
261
|
+
# puts "No response received."
|
264
262
|
# end
|
265
263
|
#
|
266
264
|
def get_operation request, options = nil
|
@@ -540,14 +538,14 @@ module Google
|
|
540
538
|
# # Call the wait_operation method.
|
541
539
|
# result = client.wait_operation request
|
542
540
|
#
|
543
|
-
# # The returned object is of type Gapic::Operation. You can use
|
544
|
-
# #
|
545
|
-
# #
|
541
|
+
# # The returned object is of type Gapic::Operation. You can use it to
|
542
|
+
# # check the status of an operation, cancel it, or wait for results.
|
543
|
+
# # Here is how to wait for a response.
|
546
544
|
# result.wait_until_done! timeout: 60
|
547
545
|
# if result.response?
|
548
546
|
# p result.response
|
549
547
|
# else
|
550
|
-
# puts "
|
548
|
+
# puts "No response received."
|
551
549
|
# end
|
552
550
|
#
|
553
551
|
def wait_operation request, options = nil
|
@@ -0,0 +1,533 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2023 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/run/v2/executions/rest/service_stub"
|
22
|
+
require "google/cloud/location/rest"
|
23
|
+
|
24
|
+
module Google
|
25
|
+
module Cloud
|
26
|
+
module Run
|
27
|
+
module V2
|
28
|
+
module Executions
|
29
|
+
module Rest
|
30
|
+
##
|
31
|
+
# REST client for the Executions service.
|
32
|
+
#
|
33
|
+
# Cloud Run Execution Control Plane API.
|
34
|
+
#
|
35
|
+
class Client
|
36
|
+
include Paths
|
37
|
+
|
38
|
+
# @private
|
39
|
+
attr_reader :executions_stub
|
40
|
+
|
41
|
+
##
|
42
|
+
# Configure the Executions Client class.
|
43
|
+
#
|
44
|
+
# See {::Google::Cloud::Run::V2::Executions::Rest::Client::Configuration}
|
45
|
+
# for a description of the configuration fields.
|
46
|
+
#
|
47
|
+
# @example
|
48
|
+
#
|
49
|
+
# # Modify the configuration for all Executions clients
|
50
|
+
# ::Google::Cloud::Run::V2::Executions::Rest::Client.configure do |config|
|
51
|
+
# config.timeout = 10.0
|
52
|
+
# end
|
53
|
+
#
|
54
|
+
# @yield [config] Configure the Client client.
|
55
|
+
# @yieldparam config [Client::Configuration]
|
56
|
+
#
|
57
|
+
# @return [Client::Configuration]
|
58
|
+
#
|
59
|
+
def self.configure
|
60
|
+
@configure ||= begin
|
61
|
+
namespace = ["Google", "Cloud", "Run", "V2"]
|
62
|
+
parent_config = while namespace.any?
|
63
|
+
parent_name = namespace.join "::"
|
64
|
+
parent_const = const_get parent_name
|
65
|
+
break parent_const.configure if parent_const.respond_to? :configure
|
66
|
+
namespace.pop
|
67
|
+
end
|
68
|
+
default_config = Client::Configuration.new parent_config
|
69
|
+
|
70
|
+
default_config
|
71
|
+
end
|
72
|
+
yield @configure if block_given?
|
73
|
+
@configure
|
74
|
+
end
|
75
|
+
|
76
|
+
##
|
77
|
+
# Configure the Executions Client instance.
|
78
|
+
#
|
79
|
+
# The configuration is set to the derived mode, meaning that values can be changed,
|
80
|
+
# but structural changes (adding new fields, etc.) are not allowed. Structural changes
|
81
|
+
# should be made on {Client.configure}.
|
82
|
+
#
|
83
|
+
# See {::Google::Cloud::Run::V2::Executions::Rest::Client::Configuration}
|
84
|
+
# for a description of the configuration fields.
|
85
|
+
#
|
86
|
+
# @yield [config] Configure the Client client.
|
87
|
+
# @yieldparam config [Client::Configuration]
|
88
|
+
#
|
89
|
+
# @return [Client::Configuration]
|
90
|
+
#
|
91
|
+
def configure
|
92
|
+
yield @config if block_given?
|
93
|
+
@config
|
94
|
+
end
|
95
|
+
|
96
|
+
##
|
97
|
+
# Create a new Executions REST client object.
|
98
|
+
#
|
99
|
+
# @example
|
100
|
+
#
|
101
|
+
# # Create a client using the default configuration
|
102
|
+
# client = ::Google::Cloud::Run::V2::Executions::Rest::Client.new
|
103
|
+
#
|
104
|
+
# # Create a client using a custom configuration
|
105
|
+
# client = ::Google::Cloud::Run::V2::Executions::Rest::Client.new do |config|
|
106
|
+
# config.timeout = 10.0
|
107
|
+
# end
|
108
|
+
#
|
109
|
+
# @yield [config] Configure the Executions client.
|
110
|
+
# @yieldparam config [Client::Configuration]
|
111
|
+
#
|
112
|
+
def initialize
|
113
|
+
# Create the configuration object
|
114
|
+
@config = Configuration.new Client.configure
|
115
|
+
|
116
|
+
# Yield the configuration if needed
|
117
|
+
yield @config if block_given?
|
118
|
+
|
119
|
+
# Create credentials
|
120
|
+
credentials = @config.credentials
|
121
|
+
# Use self-signed JWT if the endpoint is unchanged from default,
|
122
|
+
# but only if the default endpoint does not have a region prefix.
|
123
|
+
enable_self_signed_jwt = @config.endpoint == Client.configure.endpoint &&
|
124
|
+
!@config.endpoint.split(".").first.include?("-")
|
125
|
+
credentials ||= Credentials.default scope: @config.scope,
|
126
|
+
enable_self_signed_jwt: enable_self_signed_jwt
|
127
|
+
if credentials.is_a?(::String) || credentials.is_a?(::Hash)
|
128
|
+
credentials = Credentials.new credentials, scope: @config.scope
|
129
|
+
end
|
130
|
+
|
131
|
+
@quota_project_id = @config.quota_project
|
132
|
+
@quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
|
133
|
+
|
134
|
+
@operations_client = ::Google::Cloud::Run::V2::Executions::Rest::Operations.new do |config|
|
135
|
+
config.credentials = credentials
|
136
|
+
config.quota_project = @quota_project_id
|
137
|
+
config.endpoint = @config.endpoint
|
138
|
+
end
|
139
|
+
|
140
|
+
@location_client = Google::Cloud::Location::Locations::Rest::Client.new do |config|
|
141
|
+
config.credentials = credentials
|
142
|
+
config.quota_project = @quota_project_id
|
143
|
+
config.endpoint = @config.endpoint
|
144
|
+
end
|
145
|
+
|
146
|
+
@executions_stub = ::Google::Cloud::Run::V2::Executions::Rest::ServiceStub.new endpoint: @config.endpoint, credentials: credentials
|
147
|
+
end
|
148
|
+
|
149
|
+
##
|
150
|
+
# Get the associated client for long-running operations.
|
151
|
+
#
|
152
|
+
# @return [::Google::Cloud::Run::V2::Executions::Rest::Operations]
|
153
|
+
#
|
154
|
+
attr_reader :operations_client
|
155
|
+
|
156
|
+
##
|
157
|
+
# Get the associated client for mix-in of the Locations.
|
158
|
+
#
|
159
|
+
# @return [Google::Cloud::Location::Locations::Rest::Client]
|
160
|
+
#
|
161
|
+
attr_reader :location_client
|
162
|
+
|
163
|
+
# Service calls
|
164
|
+
|
165
|
+
##
|
166
|
+
# Gets information about an Execution.
|
167
|
+
#
|
168
|
+
# @overload get_execution(request, options = nil)
|
169
|
+
# Pass arguments to `get_execution` via a request object, either of type
|
170
|
+
# {::Google::Cloud::Run::V2::GetExecutionRequest} or an equivalent Hash.
|
171
|
+
#
|
172
|
+
# @param request [::Google::Cloud::Run::V2::GetExecutionRequest, ::Hash]
|
173
|
+
# A request object representing the call parameters. Required. To specify no
|
174
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
175
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
176
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
177
|
+
#
|
178
|
+
# @overload get_execution(name: nil)
|
179
|
+
# Pass arguments to `get_execution` via keyword arguments. Note that at
|
180
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
181
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
182
|
+
#
|
183
|
+
# @param name [::String]
|
184
|
+
# Required. The full name of the Execution.
|
185
|
+
# Format:
|
186
|
+
# projects/\\{project}/locations/\\{location}/jobs/\\{job}/executions/\\{execution},
|
187
|
+
# where \\{project} can be project id or number.
|
188
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
189
|
+
# @yieldparam result [::Google::Cloud::Run::V2::Execution]
|
190
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
191
|
+
#
|
192
|
+
# @return [::Google::Cloud::Run::V2::Execution]
|
193
|
+
#
|
194
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
195
|
+
def get_execution request, options = nil
|
196
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
197
|
+
|
198
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Run::V2::GetExecutionRequest
|
199
|
+
|
200
|
+
# Converts hash and nil to an options object
|
201
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
202
|
+
|
203
|
+
# Customize the options with defaults
|
204
|
+
call_metadata = @config.rpcs.get_execution.metadata.to_h
|
205
|
+
|
206
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
207
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
208
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
209
|
+
gapic_version: ::Google::Cloud::Run::V2::VERSION,
|
210
|
+
transports_version_send: [:rest]
|
211
|
+
|
212
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
213
|
+
|
214
|
+
options.apply_defaults timeout: @config.rpcs.get_execution.timeout,
|
215
|
+
metadata: call_metadata,
|
216
|
+
retry_policy: @config.rpcs.get_execution.retry_policy
|
217
|
+
|
218
|
+
options.apply_defaults timeout: @config.timeout,
|
219
|
+
metadata: @config.metadata,
|
220
|
+
retry_policy: @config.retry_policy
|
221
|
+
|
222
|
+
@executions_stub.get_execution request, options do |result, operation|
|
223
|
+
yield result, operation if block_given?
|
224
|
+
return result
|
225
|
+
end
|
226
|
+
rescue ::Gapic::Rest::Error => e
|
227
|
+
raise ::Google::Cloud::Error.from_error(e)
|
228
|
+
end
|
229
|
+
|
230
|
+
##
|
231
|
+
# Lists Executions from a Job.
|
232
|
+
#
|
233
|
+
# @overload list_executions(request, options = nil)
|
234
|
+
# Pass arguments to `list_executions` via a request object, either of type
|
235
|
+
# {::Google::Cloud::Run::V2::ListExecutionsRequest} or an equivalent Hash.
|
236
|
+
#
|
237
|
+
# @param request [::Google::Cloud::Run::V2::ListExecutionsRequest, ::Hash]
|
238
|
+
# A request object representing the call parameters. Required. To specify no
|
239
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
240
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
241
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
242
|
+
#
|
243
|
+
# @overload list_executions(parent: nil, page_size: nil, page_token: nil, show_deleted: nil)
|
244
|
+
# Pass arguments to `list_executions` via keyword arguments. Note that at
|
245
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
246
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
247
|
+
#
|
248
|
+
# @param parent [::String]
|
249
|
+
# Required. The Execution from which the Executions should be listed.
|
250
|
+
# To list all Executions across Jobs, use "-" instead of Job name.
|
251
|
+
# Format: projects/\\{project}/locations/\\{location}/jobs/\\{job}, where \\{project}
|
252
|
+
# can be project id or number.
|
253
|
+
# @param page_size [::Integer]
|
254
|
+
# Maximum number of Executions to return in this call.
|
255
|
+
# @param page_token [::String]
|
256
|
+
# A page token received from a previous call to ListExecutions.
|
257
|
+
# All other parameters must match.
|
258
|
+
# @param show_deleted [::Boolean]
|
259
|
+
# If true, returns deleted (but unexpired) resources along with active ones.
|
260
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
261
|
+
# @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Run::V2::Execution>]
|
262
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
263
|
+
#
|
264
|
+
# @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Run::V2::Execution>]
|
265
|
+
#
|
266
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
267
|
+
def list_executions request, options = nil
|
268
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
269
|
+
|
270
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Run::V2::ListExecutionsRequest
|
271
|
+
|
272
|
+
# Converts hash and nil to an options object
|
273
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
274
|
+
|
275
|
+
# Customize the options with defaults
|
276
|
+
call_metadata = @config.rpcs.list_executions.metadata.to_h
|
277
|
+
|
278
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
279
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
280
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
281
|
+
gapic_version: ::Google::Cloud::Run::V2::VERSION,
|
282
|
+
transports_version_send: [:rest]
|
283
|
+
|
284
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
285
|
+
|
286
|
+
options.apply_defaults timeout: @config.rpcs.list_executions.timeout,
|
287
|
+
metadata: call_metadata,
|
288
|
+
retry_policy: @config.rpcs.list_executions.retry_policy
|
289
|
+
|
290
|
+
options.apply_defaults timeout: @config.timeout,
|
291
|
+
metadata: @config.metadata,
|
292
|
+
retry_policy: @config.retry_policy
|
293
|
+
|
294
|
+
@executions_stub.list_executions request, options do |result, operation|
|
295
|
+
result = ::Gapic::Rest::PagedEnumerable.new @executions_stub, :list_executions, "executions", request, result, options
|
296
|
+
yield result, operation if block_given?
|
297
|
+
return result
|
298
|
+
end
|
299
|
+
rescue ::Gapic::Rest::Error => e
|
300
|
+
raise ::Google::Cloud::Error.from_error(e)
|
301
|
+
end
|
302
|
+
|
303
|
+
##
|
304
|
+
# Deletes an Execution.
|
305
|
+
#
|
306
|
+
# @overload delete_execution(request, options = nil)
|
307
|
+
# Pass arguments to `delete_execution` via a request object, either of type
|
308
|
+
# {::Google::Cloud::Run::V2::DeleteExecutionRequest} or an equivalent Hash.
|
309
|
+
#
|
310
|
+
# @param request [::Google::Cloud::Run::V2::DeleteExecutionRequest, ::Hash]
|
311
|
+
# A request object representing the call parameters. Required. To specify no
|
312
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
313
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
314
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
315
|
+
#
|
316
|
+
# @overload delete_execution(name: nil, validate_only: nil, etag: nil)
|
317
|
+
# Pass arguments to `delete_execution` via keyword arguments. Note that at
|
318
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
319
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
320
|
+
#
|
321
|
+
# @param name [::String]
|
322
|
+
# Required. The name of the Execution to delete.
|
323
|
+
# Format:
|
324
|
+
# projects/\\{project}/locations/\\{location}/jobs/\\{job}/executions/\\{execution},
|
325
|
+
# where \\{project} can be project id or number.
|
326
|
+
# @param validate_only [::Boolean]
|
327
|
+
# Indicates that the request should be validated without actually
|
328
|
+
# deleting any resources.
|
329
|
+
# @param etag [::String]
|
330
|
+
# A system-generated fingerprint for this version of the resource.
|
331
|
+
# This may be used to detect modification conflict during updates.
|
332
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
333
|
+
# @yieldparam result [::Gapic::Operation]
|
334
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
335
|
+
#
|
336
|
+
# @return [::Gapic::Operation]
|
337
|
+
#
|
338
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
339
|
+
def delete_execution request, options = nil
|
340
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
341
|
+
|
342
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Run::V2::DeleteExecutionRequest
|
343
|
+
|
344
|
+
# Converts hash and nil to an options object
|
345
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
346
|
+
|
347
|
+
# Customize the options with defaults
|
348
|
+
call_metadata = @config.rpcs.delete_execution.metadata.to_h
|
349
|
+
|
350
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
351
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
352
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
353
|
+
gapic_version: ::Google::Cloud::Run::V2::VERSION,
|
354
|
+
transports_version_send: [:rest]
|
355
|
+
|
356
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
357
|
+
|
358
|
+
options.apply_defaults timeout: @config.rpcs.delete_execution.timeout,
|
359
|
+
metadata: call_metadata,
|
360
|
+
retry_policy: @config.rpcs.delete_execution.retry_policy
|
361
|
+
|
362
|
+
options.apply_defaults timeout: @config.timeout,
|
363
|
+
metadata: @config.metadata,
|
364
|
+
retry_policy: @config.retry_policy
|
365
|
+
|
366
|
+
@executions_stub.delete_execution request, options do |result, operation|
|
367
|
+
result = ::Gapic::Operation.new result, @operations_client, options: options
|
368
|
+
yield result, operation if block_given?
|
369
|
+
return result
|
370
|
+
end
|
371
|
+
rescue ::Gapic::Rest::Error => e
|
372
|
+
raise ::Google::Cloud::Error.from_error(e)
|
373
|
+
end
|
374
|
+
|
375
|
+
##
|
376
|
+
# Configuration class for the Executions REST API.
|
377
|
+
#
|
378
|
+
# This class represents the configuration for Executions REST,
|
379
|
+
# providing control over timeouts, retry behavior, logging, transport
|
380
|
+
# parameters, and other low-level controls. Certain parameters can also be
|
381
|
+
# applied individually to specific RPCs. See
|
382
|
+
# {::Google::Cloud::Run::V2::Executions::Rest::Client::Configuration::Rpcs}
|
383
|
+
# for a list of RPCs that can be configured independently.
|
384
|
+
#
|
385
|
+
# Configuration can be applied globally to all clients, or to a single client
|
386
|
+
# on construction.
|
387
|
+
#
|
388
|
+
# @example
|
389
|
+
#
|
390
|
+
# # Modify the global config, setting the timeout for
|
391
|
+
# # get_execution to 20 seconds,
|
392
|
+
# # and all remaining timeouts to 10 seconds.
|
393
|
+
# ::Google::Cloud::Run::V2::Executions::Rest::Client.configure do |config|
|
394
|
+
# config.timeout = 10.0
|
395
|
+
# config.rpcs.get_execution.timeout = 20.0
|
396
|
+
# end
|
397
|
+
#
|
398
|
+
# # Apply the above configuration only to a new client.
|
399
|
+
# client = ::Google::Cloud::Run::V2::Executions::Rest::Client.new do |config|
|
400
|
+
# config.timeout = 10.0
|
401
|
+
# config.rpcs.get_execution.timeout = 20.0
|
402
|
+
# end
|
403
|
+
#
|
404
|
+
# @!attribute [rw] endpoint
|
405
|
+
# The hostname or hostname:port of the service endpoint.
|
406
|
+
# Defaults to `"run.googleapis.com"`.
|
407
|
+
# @return [::String]
|
408
|
+
# @!attribute [rw] credentials
|
409
|
+
# Credentials to send with calls. You may provide any of the following types:
|
410
|
+
# * (`String`) The path to a service account key file in JSON format
|
411
|
+
# * (`Hash`) A service account key as a Hash
|
412
|
+
# * (`Google::Auth::Credentials`) A googleauth credentials object
|
413
|
+
# (see the [googleauth docs](https://googleapis.dev/ruby/googleauth/latest/index.html))
|
414
|
+
# * (`Signet::OAuth2::Client`) A signet oauth2 client object
|
415
|
+
# (see the [signet docs](https://googleapis.dev/ruby/signet/latest/Signet/OAuth2/Client.html))
|
416
|
+
# * (`nil`) indicating no credentials
|
417
|
+
# @return [::Object]
|
418
|
+
# @!attribute [rw] scope
|
419
|
+
# The OAuth scopes
|
420
|
+
# @return [::Array<::String>]
|
421
|
+
# @!attribute [rw] lib_name
|
422
|
+
# The library name as recorded in instrumentation and logging
|
423
|
+
# @return [::String]
|
424
|
+
# @!attribute [rw] lib_version
|
425
|
+
# The library version as recorded in instrumentation and logging
|
426
|
+
# @return [::String]
|
427
|
+
# @!attribute [rw] timeout
|
428
|
+
# The call timeout in seconds.
|
429
|
+
# @return [::Numeric]
|
430
|
+
# @!attribute [rw] metadata
|
431
|
+
# Additional headers to be sent with the call.
|
432
|
+
# @return [::Hash{::Symbol=>::String}]
|
433
|
+
# @!attribute [rw] retry_policy
|
434
|
+
# The retry policy. The value is a hash with the following keys:
|
435
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
436
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
437
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
438
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
439
|
+
# trigger a retry.
|
440
|
+
# @return [::Hash]
|
441
|
+
# @!attribute [rw] quota_project
|
442
|
+
# A separate project against which to charge quota.
|
443
|
+
# @return [::String]
|
444
|
+
#
|
445
|
+
class Configuration
|
446
|
+
extend ::Gapic::Config
|
447
|
+
|
448
|
+
config_attr :endpoint, "run.googleapis.com", ::String
|
449
|
+
config_attr :credentials, nil do |value|
|
450
|
+
allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
|
451
|
+
allowed.any? { |klass| klass === value }
|
452
|
+
end
|
453
|
+
config_attr :scope, nil, ::String, ::Array, nil
|
454
|
+
config_attr :lib_name, nil, ::String, nil
|
455
|
+
config_attr :lib_version, nil, ::String, nil
|
456
|
+
config_attr :timeout, nil, ::Numeric, nil
|
457
|
+
config_attr :metadata, nil, ::Hash, nil
|
458
|
+
config_attr :retry_policy, nil, ::Hash, ::Proc, nil
|
459
|
+
config_attr :quota_project, nil, ::String, nil
|
460
|
+
|
461
|
+
# @private
|
462
|
+
def initialize parent_config = nil
|
463
|
+
@parent_config = parent_config unless parent_config.nil?
|
464
|
+
|
465
|
+
yield self if block_given?
|
466
|
+
end
|
467
|
+
|
468
|
+
##
|
469
|
+
# Configurations for individual RPCs
|
470
|
+
# @return [Rpcs]
|
471
|
+
#
|
472
|
+
def rpcs
|
473
|
+
@rpcs ||= begin
|
474
|
+
parent_rpcs = nil
|
475
|
+
parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
|
476
|
+
Rpcs.new parent_rpcs
|
477
|
+
end
|
478
|
+
end
|
479
|
+
|
480
|
+
##
|
481
|
+
# Configuration RPC class for the Executions API.
|
482
|
+
#
|
483
|
+
# Includes fields providing the configuration for each RPC in this service.
|
484
|
+
# Each configuration object is of type `Gapic::Config::Method` and includes
|
485
|
+
# the following configuration fields:
|
486
|
+
#
|
487
|
+
# * `timeout` (*type:* `Numeric`) - The call timeout in seconds
|
488
|
+
# * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers
|
489
|
+
# * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
|
490
|
+
# include the following keys:
|
491
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
492
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
493
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
494
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
495
|
+
# trigger a retry.
|
496
|
+
#
|
497
|
+
class Rpcs
|
498
|
+
##
|
499
|
+
# RPC-specific configuration for `get_execution`
|
500
|
+
# @return [::Gapic::Config::Method]
|
501
|
+
#
|
502
|
+
attr_reader :get_execution
|
503
|
+
##
|
504
|
+
# RPC-specific configuration for `list_executions`
|
505
|
+
# @return [::Gapic::Config::Method]
|
506
|
+
#
|
507
|
+
attr_reader :list_executions
|
508
|
+
##
|
509
|
+
# RPC-specific configuration for `delete_execution`
|
510
|
+
# @return [::Gapic::Config::Method]
|
511
|
+
#
|
512
|
+
attr_reader :delete_execution
|
513
|
+
|
514
|
+
# @private
|
515
|
+
def initialize parent_rpcs = nil
|
516
|
+
get_execution_config = parent_rpcs.get_execution if parent_rpcs.respond_to? :get_execution
|
517
|
+
@get_execution = ::Gapic::Config::Method.new get_execution_config
|
518
|
+
list_executions_config = parent_rpcs.list_executions if parent_rpcs.respond_to? :list_executions
|
519
|
+
@list_executions = ::Gapic::Config::Method.new list_executions_config
|
520
|
+
delete_execution_config = parent_rpcs.delete_execution if parent_rpcs.respond_to? :delete_execution
|
521
|
+
@delete_execution = ::Gapic::Config::Method.new delete_execution_config
|
522
|
+
|
523
|
+
yield self if block_given?
|
524
|
+
end
|
525
|
+
end
|
526
|
+
end
|
527
|
+
end
|
528
|
+
end
|
529
|
+
end
|
530
|
+
end
|
531
|
+
end
|
532
|
+
end
|
533
|
+
end
|