google-cloud-run-v2 0.6.0 → 0.7.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/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
@@ -0,0 +1,41 @@
|
|
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/run/v2/executions/rest"
|
20
|
+
require "google/cloud/run/v2/jobs/rest"
|
21
|
+
require "google/cloud/run/v2/revisions/rest"
|
22
|
+
require "google/cloud/run/v2/services/rest"
|
23
|
+
require "google/cloud/run/v2/tasks/rest"
|
24
|
+
require "google/cloud/run/v2/version"
|
25
|
+
|
26
|
+
module Google
|
27
|
+
module Cloud
|
28
|
+
module Run
|
29
|
+
##
|
30
|
+
# To load just the REST part of this package, including all its services, and instantiate a REST client:
|
31
|
+
#
|
32
|
+
# @example
|
33
|
+
#
|
34
|
+
# require "google/cloud/run/v2/rest"
|
35
|
+
# client = ::Google::Cloud::Run::V2::Executions::Rest::Client.new
|
36
|
+
#
|
37
|
+
module V2
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
@@ -312,13 +312,11 @@ module Google
|
|
312
312
|
# # Call the list_revisions method.
|
313
313
|
# result = client.list_revisions request
|
314
314
|
#
|
315
|
-
# # The returned object is of type Gapic::PagedEnumerable. You can
|
316
|
-
# #
|
317
|
-
#
|
318
|
-
# # methods are also available for managing paging directly.
|
319
|
-
# result.each do |response|
|
315
|
+
# # The returned object is of type Gapic::PagedEnumerable. You can iterate
|
316
|
+
# # over elements, and API calls will be issued to fetch pages as needed.
|
317
|
+
# result.each do |item|
|
320
318
|
# # Each element is of type ::Google::Cloud::Run::V2::Revision.
|
321
|
-
# p
|
319
|
+
# p item
|
322
320
|
# end
|
323
321
|
#
|
324
322
|
def list_revisions request, options = nil
|
@@ -415,14 +413,14 @@ module Google
|
|
415
413
|
# # Call the delete_revision method.
|
416
414
|
# result = client.delete_revision request
|
417
415
|
#
|
418
|
-
# # The returned object is of type Gapic::Operation. You can use
|
419
|
-
# #
|
420
|
-
# #
|
416
|
+
# # The returned object is of type Gapic::Operation. You can use it to
|
417
|
+
# # check the status of an operation, cancel it, or wait for results.
|
418
|
+
# # Here is how to wait for a response.
|
421
419
|
# result.wait_until_done! timeout: 60
|
422
420
|
# if result.response?
|
423
421
|
# p result.response
|
424
422
|
# else
|
425
|
-
# puts "
|
423
|
+
# puts "No response received."
|
426
424
|
# end
|
427
425
|
#
|
428
426
|
def delete_revision 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,531 @@
|
|
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/revision_pb"
|
21
|
+
require "google/cloud/run/v2/revisions/rest/service_stub"
|
22
|
+
require "google/cloud/location/rest"
|
23
|
+
|
24
|
+
module Google
|
25
|
+
module Cloud
|
26
|
+
module Run
|
27
|
+
module V2
|
28
|
+
module Revisions
|
29
|
+
module Rest
|
30
|
+
##
|
31
|
+
# REST client for the Revisions service.
|
32
|
+
#
|
33
|
+
# Cloud Run Revision Control Plane API.
|
34
|
+
#
|
35
|
+
class Client
|
36
|
+
include Paths
|
37
|
+
|
38
|
+
# @private
|
39
|
+
attr_reader :revisions_stub
|
40
|
+
|
41
|
+
##
|
42
|
+
# Configure the Revisions Client class.
|
43
|
+
#
|
44
|
+
# See {::Google::Cloud::Run::V2::Revisions::Rest::Client::Configuration}
|
45
|
+
# for a description of the configuration fields.
|
46
|
+
#
|
47
|
+
# @example
|
48
|
+
#
|
49
|
+
# # Modify the configuration for all Revisions clients
|
50
|
+
# ::Google::Cloud::Run::V2::Revisions::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 Revisions 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::Revisions::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 Revisions REST client object.
|
98
|
+
#
|
99
|
+
# @example
|
100
|
+
#
|
101
|
+
# # Create a client using the default configuration
|
102
|
+
# client = ::Google::Cloud::Run::V2::Revisions::Rest::Client.new
|
103
|
+
#
|
104
|
+
# # Create a client using a custom configuration
|
105
|
+
# client = ::Google::Cloud::Run::V2::Revisions::Rest::Client.new do |config|
|
106
|
+
# config.timeout = 10.0
|
107
|
+
# end
|
108
|
+
#
|
109
|
+
# @yield [config] Configure the Revisions 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::Revisions::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
|
+
@revisions_stub = ::Google::Cloud::Run::V2::Revisions::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::Revisions::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 a Revision.
|
167
|
+
#
|
168
|
+
# @overload get_revision(request, options = nil)
|
169
|
+
# Pass arguments to `get_revision` via a request object, either of type
|
170
|
+
# {::Google::Cloud::Run::V2::GetRevisionRequest} or an equivalent Hash.
|
171
|
+
#
|
172
|
+
# @param request [::Google::Cloud::Run::V2::GetRevisionRequest, ::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_revision(name: nil)
|
179
|
+
# Pass arguments to `get_revision` 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 Revision.
|
185
|
+
# Format:
|
186
|
+
# projects/\\{project}/locations/\\{location}/services/\\{service}/revisions/\\{revision}
|
187
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
188
|
+
# @yieldparam result [::Google::Cloud::Run::V2::Revision]
|
189
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
190
|
+
#
|
191
|
+
# @return [::Google::Cloud::Run::V2::Revision]
|
192
|
+
#
|
193
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
194
|
+
def get_revision request, options = nil
|
195
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
196
|
+
|
197
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Run::V2::GetRevisionRequest
|
198
|
+
|
199
|
+
# Converts hash and nil to an options object
|
200
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
201
|
+
|
202
|
+
# Customize the options with defaults
|
203
|
+
call_metadata = @config.rpcs.get_revision.metadata.to_h
|
204
|
+
|
205
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
206
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
207
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
208
|
+
gapic_version: ::Google::Cloud::Run::V2::VERSION,
|
209
|
+
transports_version_send: [:rest]
|
210
|
+
|
211
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
212
|
+
|
213
|
+
options.apply_defaults timeout: @config.rpcs.get_revision.timeout,
|
214
|
+
metadata: call_metadata,
|
215
|
+
retry_policy: @config.rpcs.get_revision.retry_policy
|
216
|
+
|
217
|
+
options.apply_defaults timeout: @config.timeout,
|
218
|
+
metadata: @config.metadata,
|
219
|
+
retry_policy: @config.retry_policy
|
220
|
+
|
221
|
+
@revisions_stub.get_revision request, options do |result, operation|
|
222
|
+
yield result, operation if block_given?
|
223
|
+
return result
|
224
|
+
end
|
225
|
+
rescue ::Gapic::Rest::Error => e
|
226
|
+
raise ::Google::Cloud::Error.from_error(e)
|
227
|
+
end
|
228
|
+
|
229
|
+
##
|
230
|
+
# Lists Revisions from a given Service, or from a given location.
|
231
|
+
#
|
232
|
+
# @overload list_revisions(request, options = nil)
|
233
|
+
# Pass arguments to `list_revisions` via a request object, either of type
|
234
|
+
# {::Google::Cloud::Run::V2::ListRevisionsRequest} or an equivalent Hash.
|
235
|
+
#
|
236
|
+
# @param request [::Google::Cloud::Run::V2::ListRevisionsRequest, ::Hash]
|
237
|
+
# A request object representing the call parameters. Required. To specify no
|
238
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
239
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
240
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
241
|
+
#
|
242
|
+
# @overload list_revisions(parent: nil, page_size: nil, page_token: nil, show_deleted: nil)
|
243
|
+
# Pass arguments to `list_revisions` via keyword arguments. Note that at
|
244
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
245
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
246
|
+
#
|
247
|
+
# @param parent [::String]
|
248
|
+
# Required. The Service from which the Revisions should be listed.
|
249
|
+
# To list all Revisions across Services, use "-" instead of Service name.
|
250
|
+
# Format:
|
251
|
+
# projects/\\{project}/locations/\\{location}/services/\\{service}
|
252
|
+
# @param page_size [::Integer]
|
253
|
+
# Maximum number of revisions to return in this call.
|
254
|
+
# @param page_token [::String]
|
255
|
+
# A page token received from a previous call to ListRevisions.
|
256
|
+
# All other parameters must match.
|
257
|
+
# @param show_deleted [::Boolean]
|
258
|
+
# If true, returns deleted (but unexpired) resources along with active ones.
|
259
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
260
|
+
# @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Run::V2::Revision>]
|
261
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
262
|
+
#
|
263
|
+
# @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Run::V2::Revision>]
|
264
|
+
#
|
265
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
266
|
+
def list_revisions request, options = nil
|
267
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
268
|
+
|
269
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Run::V2::ListRevisionsRequest
|
270
|
+
|
271
|
+
# Converts hash and nil to an options object
|
272
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
273
|
+
|
274
|
+
# Customize the options with defaults
|
275
|
+
call_metadata = @config.rpcs.list_revisions.metadata.to_h
|
276
|
+
|
277
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
278
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
279
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
280
|
+
gapic_version: ::Google::Cloud::Run::V2::VERSION,
|
281
|
+
transports_version_send: [:rest]
|
282
|
+
|
283
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
284
|
+
|
285
|
+
options.apply_defaults timeout: @config.rpcs.list_revisions.timeout,
|
286
|
+
metadata: call_metadata,
|
287
|
+
retry_policy: @config.rpcs.list_revisions.retry_policy
|
288
|
+
|
289
|
+
options.apply_defaults timeout: @config.timeout,
|
290
|
+
metadata: @config.metadata,
|
291
|
+
retry_policy: @config.retry_policy
|
292
|
+
|
293
|
+
@revisions_stub.list_revisions request, options do |result, operation|
|
294
|
+
result = ::Gapic::Rest::PagedEnumerable.new @revisions_stub, :list_revisions, "revisions", request, result, options
|
295
|
+
yield result, operation if block_given?
|
296
|
+
return result
|
297
|
+
end
|
298
|
+
rescue ::Gapic::Rest::Error => e
|
299
|
+
raise ::Google::Cloud::Error.from_error(e)
|
300
|
+
end
|
301
|
+
|
302
|
+
##
|
303
|
+
# Deletes a Revision.
|
304
|
+
#
|
305
|
+
# @overload delete_revision(request, options = nil)
|
306
|
+
# Pass arguments to `delete_revision` via a request object, either of type
|
307
|
+
# {::Google::Cloud::Run::V2::DeleteRevisionRequest} or an equivalent Hash.
|
308
|
+
#
|
309
|
+
# @param request [::Google::Cloud::Run::V2::DeleteRevisionRequest, ::Hash]
|
310
|
+
# A request object representing the call parameters. Required. To specify no
|
311
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
312
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
313
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
314
|
+
#
|
315
|
+
# @overload delete_revision(name: nil, validate_only: nil, etag: nil)
|
316
|
+
# Pass arguments to `delete_revision` via keyword arguments. Note that at
|
317
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
318
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
319
|
+
#
|
320
|
+
# @param name [::String]
|
321
|
+
# Required. The name of the Revision to delete.
|
322
|
+
# Format:
|
323
|
+
# projects/\\{project}/locations/\\{location}/services/\\{service}/revisions/\\{revision}
|
324
|
+
# @param validate_only [::Boolean]
|
325
|
+
# Indicates that the request should be validated without actually
|
326
|
+
# deleting any resources.
|
327
|
+
# @param etag [::String]
|
328
|
+
# A system-generated fingerprint for this version of the
|
329
|
+
# resource. This may be used to detect modification conflict during updates.
|
330
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
331
|
+
# @yieldparam result [::Gapic::Operation]
|
332
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
333
|
+
#
|
334
|
+
# @return [::Gapic::Operation]
|
335
|
+
#
|
336
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
337
|
+
def delete_revision request, options = nil
|
338
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
339
|
+
|
340
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Run::V2::DeleteRevisionRequest
|
341
|
+
|
342
|
+
# Converts hash and nil to an options object
|
343
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
344
|
+
|
345
|
+
# Customize the options with defaults
|
346
|
+
call_metadata = @config.rpcs.delete_revision.metadata.to_h
|
347
|
+
|
348
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
349
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
350
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
351
|
+
gapic_version: ::Google::Cloud::Run::V2::VERSION,
|
352
|
+
transports_version_send: [:rest]
|
353
|
+
|
354
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
355
|
+
|
356
|
+
options.apply_defaults timeout: @config.rpcs.delete_revision.timeout,
|
357
|
+
metadata: call_metadata,
|
358
|
+
retry_policy: @config.rpcs.delete_revision.retry_policy
|
359
|
+
|
360
|
+
options.apply_defaults timeout: @config.timeout,
|
361
|
+
metadata: @config.metadata,
|
362
|
+
retry_policy: @config.retry_policy
|
363
|
+
|
364
|
+
@revisions_stub.delete_revision request, options do |result, operation|
|
365
|
+
result = ::Gapic::Operation.new result, @operations_client, options: options
|
366
|
+
yield result, operation if block_given?
|
367
|
+
return result
|
368
|
+
end
|
369
|
+
rescue ::Gapic::Rest::Error => e
|
370
|
+
raise ::Google::Cloud::Error.from_error(e)
|
371
|
+
end
|
372
|
+
|
373
|
+
##
|
374
|
+
# Configuration class for the Revisions REST API.
|
375
|
+
#
|
376
|
+
# This class represents the configuration for Revisions REST,
|
377
|
+
# providing control over timeouts, retry behavior, logging, transport
|
378
|
+
# parameters, and other low-level controls. Certain parameters can also be
|
379
|
+
# applied individually to specific RPCs. See
|
380
|
+
# {::Google::Cloud::Run::V2::Revisions::Rest::Client::Configuration::Rpcs}
|
381
|
+
# for a list of RPCs that can be configured independently.
|
382
|
+
#
|
383
|
+
# Configuration can be applied globally to all clients, or to a single client
|
384
|
+
# on construction.
|
385
|
+
#
|
386
|
+
# @example
|
387
|
+
#
|
388
|
+
# # Modify the global config, setting the timeout for
|
389
|
+
# # get_revision to 20 seconds,
|
390
|
+
# # and all remaining timeouts to 10 seconds.
|
391
|
+
# ::Google::Cloud::Run::V2::Revisions::Rest::Client.configure do |config|
|
392
|
+
# config.timeout = 10.0
|
393
|
+
# config.rpcs.get_revision.timeout = 20.0
|
394
|
+
# end
|
395
|
+
#
|
396
|
+
# # Apply the above configuration only to a new client.
|
397
|
+
# client = ::Google::Cloud::Run::V2::Revisions::Rest::Client.new do |config|
|
398
|
+
# config.timeout = 10.0
|
399
|
+
# config.rpcs.get_revision.timeout = 20.0
|
400
|
+
# end
|
401
|
+
#
|
402
|
+
# @!attribute [rw] endpoint
|
403
|
+
# The hostname or hostname:port of the service endpoint.
|
404
|
+
# Defaults to `"run.googleapis.com"`.
|
405
|
+
# @return [::String]
|
406
|
+
# @!attribute [rw] credentials
|
407
|
+
# Credentials to send with calls. You may provide any of the following types:
|
408
|
+
# * (`String`) The path to a service account key file in JSON format
|
409
|
+
# * (`Hash`) A service account key as a Hash
|
410
|
+
# * (`Google::Auth::Credentials`) A googleauth credentials object
|
411
|
+
# (see the [googleauth docs](https://googleapis.dev/ruby/googleauth/latest/index.html))
|
412
|
+
# * (`Signet::OAuth2::Client`) A signet oauth2 client object
|
413
|
+
# (see the [signet docs](https://googleapis.dev/ruby/signet/latest/Signet/OAuth2/Client.html))
|
414
|
+
# * (`nil`) indicating no credentials
|
415
|
+
# @return [::Object]
|
416
|
+
# @!attribute [rw] scope
|
417
|
+
# The OAuth scopes
|
418
|
+
# @return [::Array<::String>]
|
419
|
+
# @!attribute [rw] lib_name
|
420
|
+
# The library name as recorded in instrumentation and logging
|
421
|
+
# @return [::String]
|
422
|
+
# @!attribute [rw] lib_version
|
423
|
+
# The library version as recorded in instrumentation and logging
|
424
|
+
# @return [::String]
|
425
|
+
# @!attribute [rw] timeout
|
426
|
+
# The call timeout in seconds.
|
427
|
+
# @return [::Numeric]
|
428
|
+
# @!attribute [rw] metadata
|
429
|
+
# Additional headers to be sent with the call.
|
430
|
+
# @return [::Hash{::Symbol=>::String}]
|
431
|
+
# @!attribute [rw] retry_policy
|
432
|
+
# The retry policy. The value is a hash with the following keys:
|
433
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
434
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
435
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
436
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
437
|
+
# trigger a retry.
|
438
|
+
# @return [::Hash]
|
439
|
+
# @!attribute [rw] quota_project
|
440
|
+
# A separate project against which to charge quota.
|
441
|
+
# @return [::String]
|
442
|
+
#
|
443
|
+
class Configuration
|
444
|
+
extend ::Gapic::Config
|
445
|
+
|
446
|
+
config_attr :endpoint, "run.googleapis.com", ::String
|
447
|
+
config_attr :credentials, nil do |value|
|
448
|
+
allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
|
449
|
+
allowed.any? { |klass| klass === value }
|
450
|
+
end
|
451
|
+
config_attr :scope, nil, ::String, ::Array, nil
|
452
|
+
config_attr :lib_name, nil, ::String, nil
|
453
|
+
config_attr :lib_version, nil, ::String, nil
|
454
|
+
config_attr :timeout, nil, ::Numeric, nil
|
455
|
+
config_attr :metadata, nil, ::Hash, nil
|
456
|
+
config_attr :retry_policy, nil, ::Hash, ::Proc, nil
|
457
|
+
config_attr :quota_project, nil, ::String, nil
|
458
|
+
|
459
|
+
# @private
|
460
|
+
def initialize parent_config = nil
|
461
|
+
@parent_config = parent_config unless parent_config.nil?
|
462
|
+
|
463
|
+
yield self if block_given?
|
464
|
+
end
|
465
|
+
|
466
|
+
##
|
467
|
+
# Configurations for individual RPCs
|
468
|
+
# @return [Rpcs]
|
469
|
+
#
|
470
|
+
def rpcs
|
471
|
+
@rpcs ||= begin
|
472
|
+
parent_rpcs = nil
|
473
|
+
parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
|
474
|
+
Rpcs.new parent_rpcs
|
475
|
+
end
|
476
|
+
end
|
477
|
+
|
478
|
+
##
|
479
|
+
# Configuration RPC class for the Revisions API.
|
480
|
+
#
|
481
|
+
# Includes fields providing the configuration for each RPC in this service.
|
482
|
+
# Each configuration object is of type `Gapic::Config::Method` and includes
|
483
|
+
# the following configuration fields:
|
484
|
+
#
|
485
|
+
# * `timeout` (*type:* `Numeric`) - The call timeout in seconds
|
486
|
+
# * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers
|
487
|
+
# * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
|
488
|
+
# include the following keys:
|
489
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
490
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
491
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
492
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
493
|
+
# trigger a retry.
|
494
|
+
#
|
495
|
+
class Rpcs
|
496
|
+
##
|
497
|
+
# RPC-specific configuration for `get_revision`
|
498
|
+
# @return [::Gapic::Config::Method]
|
499
|
+
#
|
500
|
+
attr_reader :get_revision
|
501
|
+
##
|
502
|
+
# RPC-specific configuration for `list_revisions`
|
503
|
+
# @return [::Gapic::Config::Method]
|
504
|
+
#
|
505
|
+
attr_reader :list_revisions
|
506
|
+
##
|
507
|
+
# RPC-specific configuration for `delete_revision`
|
508
|
+
# @return [::Gapic::Config::Method]
|
509
|
+
#
|
510
|
+
attr_reader :delete_revision
|
511
|
+
|
512
|
+
# @private
|
513
|
+
def initialize parent_rpcs = nil
|
514
|
+
get_revision_config = parent_rpcs.get_revision if parent_rpcs.respond_to? :get_revision
|
515
|
+
@get_revision = ::Gapic::Config::Method.new get_revision_config
|
516
|
+
list_revisions_config = parent_rpcs.list_revisions if parent_rpcs.respond_to? :list_revisions
|
517
|
+
@list_revisions = ::Gapic::Config::Method.new list_revisions_config
|
518
|
+
delete_revision_config = parent_rpcs.delete_revision if parent_rpcs.respond_to? :delete_revision
|
519
|
+
@delete_revision = ::Gapic::Config::Method.new delete_revision_config
|
520
|
+
|
521
|
+
yield self if block_given?
|
522
|
+
end
|
523
|
+
end
|
524
|
+
end
|
525
|
+
end
|
526
|
+
end
|
527
|
+
end
|
528
|
+
end
|
529
|
+
end
|
530
|
+
end
|
531
|
+
end
|