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