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,1154 @@
|
|
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/service_pb"
|
21
|
+
|
22
|
+
module Google
|
23
|
+
module Cloud
|
24
|
+
module Run
|
25
|
+
module V2
|
26
|
+
module Services
|
27
|
+
##
|
28
|
+
# Client for the Services service.
|
29
|
+
#
|
30
|
+
# Cloud Run Service Control Plane API
|
31
|
+
#
|
32
|
+
class Client
|
33
|
+
include Paths
|
34
|
+
|
35
|
+
# @private
|
36
|
+
attr_reader :services_stub
|
37
|
+
|
38
|
+
##
|
39
|
+
# Configure the Services Client class.
|
40
|
+
#
|
41
|
+
# See {::Google::Cloud::Run::V2::Services::Client::Configuration}
|
42
|
+
# for a description of the configuration fields.
|
43
|
+
#
|
44
|
+
# @example
|
45
|
+
#
|
46
|
+
# # Modify the configuration for all Services clients
|
47
|
+
# ::Google::Cloud::Run::V2::Services::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.rpcs.create_service.timeout = 15.0
|
68
|
+
|
69
|
+
default_config.rpcs.get_service.timeout = 10.0
|
70
|
+
default_config.rpcs.get_service.retry_policy = {
|
71
|
+
initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
|
72
|
+
}
|
73
|
+
|
74
|
+
default_config.rpcs.list_services.timeout = 10.0
|
75
|
+
default_config.rpcs.list_services.retry_policy = {
|
76
|
+
initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
|
77
|
+
}
|
78
|
+
|
79
|
+
default_config.rpcs.update_service.timeout = 15.0
|
80
|
+
|
81
|
+
default_config.rpcs.delete_service.timeout = 10.0
|
82
|
+
|
83
|
+
default_config
|
84
|
+
end
|
85
|
+
yield @configure if block_given?
|
86
|
+
@configure
|
87
|
+
end
|
88
|
+
|
89
|
+
##
|
90
|
+
# Configure the Services Client instance.
|
91
|
+
#
|
92
|
+
# The configuration is set to the derived mode, meaning that values can be changed,
|
93
|
+
# but structural changes (adding new fields, etc.) are not allowed. Structural changes
|
94
|
+
# should be made on {Client.configure}.
|
95
|
+
#
|
96
|
+
# See {::Google::Cloud::Run::V2::Services::Client::Configuration}
|
97
|
+
# for a description of the configuration fields.
|
98
|
+
#
|
99
|
+
# @yield [config] Configure the Client client.
|
100
|
+
# @yieldparam config [Client::Configuration]
|
101
|
+
#
|
102
|
+
# @return [Client::Configuration]
|
103
|
+
#
|
104
|
+
def configure
|
105
|
+
yield @config if block_given?
|
106
|
+
@config
|
107
|
+
end
|
108
|
+
|
109
|
+
##
|
110
|
+
# Create a new Services client object.
|
111
|
+
#
|
112
|
+
# @example
|
113
|
+
#
|
114
|
+
# # Create a client using the default configuration
|
115
|
+
# client = ::Google::Cloud::Run::V2::Services::Client.new
|
116
|
+
#
|
117
|
+
# # Create a client using a custom configuration
|
118
|
+
# client = ::Google::Cloud::Run::V2::Services::Client.new do |config|
|
119
|
+
# config.timeout = 10.0
|
120
|
+
# end
|
121
|
+
#
|
122
|
+
# @yield [config] Configure the Services client.
|
123
|
+
# @yieldparam config [Client::Configuration]
|
124
|
+
#
|
125
|
+
def initialize
|
126
|
+
# These require statements are intentionally placed here to initialize
|
127
|
+
# the gRPC module only when it's required.
|
128
|
+
# See https://github.com/googleapis/toolkit/issues/446
|
129
|
+
require "gapic/grpc"
|
130
|
+
require "google/cloud/run/v2/service_services_pb"
|
131
|
+
|
132
|
+
# Create the configuration object
|
133
|
+
@config = Configuration.new Client.configure
|
134
|
+
|
135
|
+
# Yield the configuration if needed
|
136
|
+
yield @config if block_given?
|
137
|
+
|
138
|
+
# Create credentials
|
139
|
+
credentials = @config.credentials
|
140
|
+
# Use self-signed JWT if the endpoint is unchanged from default,
|
141
|
+
# but only if the default endpoint does not have a region prefix.
|
142
|
+
enable_self_signed_jwt = @config.endpoint == Client.configure.endpoint &&
|
143
|
+
!@config.endpoint.split(".").first.include?("-")
|
144
|
+
credentials ||= Credentials.default scope: @config.scope,
|
145
|
+
enable_self_signed_jwt: enable_self_signed_jwt
|
146
|
+
if credentials.is_a?(::String) || credentials.is_a?(::Hash)
|
147
|
+
credentials = Credentials.new credentials, scope: @config.scope
|
148
|
+
end
|
149
|
+
@quota_project_id = @config.quota_project
|
150
|
+
@quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
|
151
|
+
|
152
|
+
@operations_client = Operations.new do |config|
|
153
|
+
config.credentials = credentials
|
154
|
+
config.quota_project = @quota_project_id
|
155
|
+
config.endpoint = @config.endpoint
|
156
|
+
end
|
157
|
+
|
158
|
+
@services_stub = ::Gapic::ServiceStub.new(
|
159
|
+
::Google::Cloud::Run::V2::Services::Stub,
|
160
|
+
credentials: credentials,
|
161
|
+
endpoint: @config.endpoint,
|
162
|
+
channel_args: @config.channel_args,
|
163
|
+
interceptors: @config.interceptors
|
164
|
+
)
|
165
|
+
end
|
166
|
+
|
167
|
+
##
|
168
|
+
# Get the associated client for long-running operations.
|
169
|
+
#
|
170
|
+
# @return [::Google::Cloud::Run::V2::Services::Operations]
|
171
|
+
#
|
172
|
+
attr_reader :operations_client
|
173
|
+
|
174
|
+
# Service calls
|
175
|
+
|
176
|
+
##
|
177
|
+
# Creates a new Service in a given project and location.
|
178
|
+
#
|
179
|
+
# @overload create_service(request, options = nil)
|
180
|
+
# Pass arguments to `create_service` via a request object, either of type
|
181
|
+
# {::Google::Cloud::Run::V2::CreateServiceRequest} or an equivalent Hash.
|
182
|
+
#
|
183
|
+
# @param request [::Google::Cloud::Run::V2::CreateServiceRequest, ::Hash]
|
184
|
+
# A request object representing the call parameters. Required. To specify no
|
185
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
186
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
187
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
188
|
+
#
|
189
|
+
# @overload create_service(parent: nil, service: nil, service_id: nil, validate_only: nil)
|
190
|
+
# Pass arguments to `create_service` via keyword arguments. Note that at
|
191
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
192
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
193
|
+
#
|
194
|
+
# @param parent [::String]
|
195
|
+
# Required. The location and project in which this service should be created.
|
196
|
+
# Format: projects/\\{projectnumber}/locations/\\{location}
|
197
|
+
# @param service [::Google::Cloud::Run::V2::Service, ::Hash]
|
198
|
+
# Required. The Service instance to create.
|
199
|
+
# @param service_id [::String]
|
200
|
+
# Required. The unique identifier for the Service. The name of the service becomes
|
201
|
+
# \\{parent}/services/\\{service_id}.
|
202
|
+
# @param validate_only [::Boolean]
|
203
|
+
# Indicates that the request should be validated and default values
|
204
|
+
# populated, without persisting the request or creating any resources.
|
205
|
+
#
|
206
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
207
|
+
# @yieldparam response [::Gapic::Operation]
|
208
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
209
|
+
#
|
210
|
+
# @return [::Gapic::Operation]
|
211
|
+
#
|
212
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
213
|
+
#
|
214
|
+
# @example Basic example
|
215
|
+
# require "google/cloud/run/v2"
|
216
|
+
#
|
217
|
+
# # Create a client object. The client can be reused for multiple calls.
|
218
|
+
# client = Google::Cloud::Run::V2::Services::Client.new
|
219
|
+
#
|
220
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
221
|
+
# request = Google::Cloud::Run::V2::CreateServiceRequest.new
|
222
|
+
#
|
223
|
+
# # Call the create_service method.
|
224
|
+
# result = client.create_service request
|
225
|
+
#
|
226
|
+
# # The returned object is of type Gapic::Operation. You can use this
|
227
|
+
# # object to check the status of an operation, cancel it, or wait
|
228
|
+
# # for results. Here is how to block until completion:
|
229
|
+
# result.wait_until_done! timeout: 60
|
230
|
+
# if result.response?
|
231
|
+
# p result.response
|
232
|
+
# else
|
233
|
+
# puts "Error!"
|
234
|
+
# end
|
235
|
+
#
|
236
|
+
def create_service request, options = nil
|
237
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
238
|
+
|
239
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Run::V2::CreateServiceRequest
|
240
|
+
|
241
|
+
# Converts hash and nil to an options object
|
242
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
243
|
+
|
244
|
+
# Customize the options with defaults
|
245
|
+
metadata = @config.rpcs.create_service.metadata.to_h
|
246
|
+
|
247
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
248
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
249
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
250
|
+
gapic_version: ::Google::Cloud::Run::V2::VERSION
|
251
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
252
|
+
|
253
|
+
header_params = {}
|
254
|
+
if request.parent
|
255
|
+
header_params["parent"] = request.parent
|
256
|
+
end
|
257
|
+
|
258
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
259
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
260
|
+
|
261
|
+
options.apply_defaults timeout: @config.rpcs.create_service.timeout,
|
262
|
+
metadata: metadata,
|
263
|
+
retry_policy: @config.rpcs.create_service.retry_policy
|
264
|
+
|
265
|
+
options.apply_defaults timeout: @config.timeout,
|
266
|
+
metadata: @config.metadata,
|
267
|
+
retry_policy: @config.retry_policy
|
268
|
+
|
269
|
+
@services_stub.call_rpc :create_service, request, options: options do |response, operation|
|
270
|
+
response = ::Gapic::Operation.new response, @operations_client, options: options
|
271
|
+
yield response, operation if block_given?
|
272
|
+
return response
|
273
|
+
end
|
274
|
+
rescue ::GRPC::BadStatus => e
|
275
|
+
raise ::Google::Cloud::Error.from_error(e)
|
276
|
+
end
|
277
|
+
|
278
|
+
##
|
279
|
+
# Gets information about a Service.
|
280
|
+
#
|
281
|
+
# @overload get_service(request, options = nil)
|
282
|
+
# Pass arguments to `get_service` via a request object, either of type
|
283
|
+
# {::Google::Cloud::Run::V2::GetServiceRequest} or an equivalent Hash.
|
284
|
+
#
|
285
|
+
# @param request [::Google::Cloud::Run::V2::GetServiceRequest, ::Hash]
|
286
|
+
# A request object representing the call parameters. Required. To specify no
|
287
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
288
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
289
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
290
|
+
#
|
291
|
+
# @overload get_service(name: nil)
|
292
|
+
# Pass arguments to `get_service` via keyword arguments. Note that at
|
293
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
294
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
295
|
+
#
|
296
|
+
# @param name [::String]
|
297
|
+
# Required. The full name of the Service.
|
298
|
+
# Format: projects/\\{projectnumber}/locations/\\{location}/services/\\{service}
|
299
|
+
#
|
300
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
301
|
+
# @yieldparam response [::Google::Cloud::Run::V2::Service]
|
302
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
303
|
+
#
|
304
|
+
# @return [::Google::Cloud::Run::V2::Service]
|
305
|
+
#
|
306
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
307
|
+
#
|
308
|
+
# @example Basic example
|
309
|
+
# require "google/cloud/run/v2"
|
310
|
+
#
|
311
|
+
# # Create a client object. The client can be reused for multiple calls.
|
312
|
+
# client = Google::Cloud::Run::V2::Services::Client.new
|
313
|
+
#
|
314
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
315
|
+
# request = Google::Cloud::Run::V2::GetServiceRequest.new
|
316
|
+
#
|
317
|
+
# # Call the get_service method.
|
318
|
+
# result = client.get_service request
|
319
|
+
#
|
320
|
+
# # The returned object is of type Google::Cloud::Run::V2::Service.
|
321
|
+
# p result
|
322
|
+
#
|
323
|
+
def get_service request, options = nil
|
324
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
325
|
+
|
326
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Run::V2::GetServiceRequest
|
327
|
+
|
328
|
+
# Converts hash and nil to an options object
|
329
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
330
|
+
|
331
|
+
# Customize the options with defaults
|
332
|
+
metadata = @config.rpcs.get_service.metadata.to_h
|
333
|
+
|
334
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
335
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
336
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
337
|
+
gapic_version: ::Google::Cloud::Run::V2::VERSION
|
338
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
339
|
+
|
340
|
+
header_params = {}
|
341
|
+
if request.name
|
342
|
+
header_params["name"] = request.name
|
343
|
+
end
|
344
|
+
|
345
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
346
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
347
|
+
|
348
|
+
options.apply_defaults timeout: @config.rpcs.get_service.timeout,
|
349
|
+
metadata: metadata,
|
350
|
+
retry_policy: @config.rpcs.get_service.retry_policy
|
351
|
+
|
352
|
+
options.apply_defaults timeout: @config.timeout,
|
353
|
+
metadata: @config.metadata,
|
354
|
+
retry_policy: @config.retry_policy
|
355
|
+
|
356
|
+
@services_stub.call_rpc :get_service, request, options: options do |response, operation|
|
357
|
+
yield response, operation if block_given?
|
358
|
+
return response
|
359
|
+
end
|
360
|
+
rescue ::GRPC::BadStatus => e
|
361
|
+
raise ::Google::Cloud::Error.from_error(e)
|
362
|
+
end
|
363
|
+
|
364
|
+
##
|
365
|
+
# List Services.
|
366
|
+
#
|
367
|
+
# @overload list_services(request, options = nil)
|
368
|
+
# Pass arguments to `list_services` via a request object, either of type
|
369
|
+
# {::Google::Cloud::Run::V2::ListServicesRequest} or an equivalent Hash.
|
370
|
+
#
|
371
|
+
# @param request [::Google::Cloud::Run::V2::ListServicesRequest, ::Hash]
|
372
|
+
# A request object representing the call parameters. Required. To specify no
|
373
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
374
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
375
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
376
|
+
#
|
377
|
+
# @overload list_services(parent: nil, page_size: nil, page_token: nil, show_deleted: nil)
|
378
|
+
# Pass arguments to `list_services` via keyword arguments. Note that at
|
379
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
380
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
381
|
+
#
|
382
|
+
# @param parent [::String]
|
383
|
+
# Required. The location and project to list resources on.
|
384
|
+
# Location must be a valid GCP region, and may not be the "-" wildcard.
|
385
|
+
# Format: projects/\\{projectnumber}/locations/\\{location}
|
386
|
+
# @param page_size [::Integer]
|
387
|
+
# Maximum number of Services to return in this call.
|
388
|
+
# @param page_token [::String]
|
389
|
+
# A page token received from a previous call to ListServices.
|
390
|
+
# All other parameters must match.
|
391
|
+
# @param show_deleted [::Boolean]
|
392
|
+
# If true, returns deleted (but unexpired) resources along with active ones.
|
393
|
+
#
|
394
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
395
|
+
# @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::Run::V2::Service>]
|
396
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
397
|
+
#
|
398
|
+
# @return [::Gapic::PagedEnumerable<::Google::Cloud::Run::V2::Service>]
|
399
|
+
#
|
400
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
401
|
+
#
|
402
|
+
# @example Basic example
|
403
|
+
# require "google/cloud/run/v2"
|
404
|
+
#
|
405
|
+
# # Create a client object. The client can be reused for multiple calls.
|
406
|
+
# client = Google::Cloud::Run::V2::Services::Client.new
|
407
|
+
#
|
408
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
409
|
+
# request = Google::Cloud::Run::V2::ListServicesRequest.new
|
410
|
+
#
|
411
|
+
# # Call the list_services method.
|
412
|
+
# result = client.list_services request
|
413
|
+
#
|
414
|
+
# # The returned object is of type Gapic::PagedEnumerable. You can
|
415
|
+
# # iterate over all elements by calling #each, and the enumerable
|
416
|
+
# # will lazily make API calls to fetch subsequent pages. Other
|
417
|
+
# # methods are also available for managing paging directly.
|
418
|
+
# result.each do |response|
|
419
|
+
# # Each element is of type ::Google::Cloud::Run::V2::Service.
|
420
|
+
# p response
|
421
|
+
# end
|
422
|
+
#
|
423
|
+
def list_services request, options = nil
|
424
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
425
|
+
|
426
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Run::V2::ListServicesRequest
|
427
|
+
|
428
|
+
# Converts hash and nil to an options object
|
429
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
430
|
+
|
431
|
+
# Customize the options with defaults
|
432
|
+
metadata = @config.rpcs.list_services.metadata.to_h
|
433
|
+
|
434
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
435
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
436
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
437
|
+
gapic_version: ::Google::Cloud::Run::V2::VERSION
|
438
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
439
|
+
|
440
|
+
header_params = {}
|
441
|
+
if request.parent
|
442
|
+
header_params["parent"] = request.parent
|
443
|
+
end
|
444
|
+
|
445
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
446
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
447
|
+
|
448
|
+
options.apply_defaults timeout: @config.rpcs.list_services.timeout,
|
449
|
+
metadata: metadata,
|
450
|
+
retry_policy: @config.rpcs.list_services.retry_policy
|
451
|
+
|
452
|
+
options.apply_defaults timeout: @config.timeout,
|
453
|
+
metadata: @config.metadata,
|
454
|
+
retry_policy: @config.retry_policy
|
455
|
+
|
456
|
+
@services_stub.call_rpc :list_services, request, options: options do |response, operation|
|
457
|
+
response = ::Gapic::PagedEnumerable.new @services_stub, :list_services, request, response, operation, options
|
458
|
+
yield response, operation if block_given?
|
459
|
+
return response
|
460
|
+
end
|
461
|
+
rescue ::GRPC::BadStatus => e
|
462
|
+
raise ::Google::Cloud::Error.from_error(e)
|
463
|
+
end
|
464
|
+
|
465
|
+
##
|
466
|
+
# Updates a Service.
|
467
|
+
#
|
468
|
+
# @overload update_service(request, options = nil)
|
469
|
+
# Pass arguments to `update_service` via a request object, either of type
|
470
|
+
# {::Google::Cloud::Run::V2::UpdateServiceRequest} or an equivalent Hash.
|
471
|
+
#
|
472
|
+
# @param request [::Google::Cloud::Run::V2::UpdateServiceRequest, ::Hash]
|
473
|
+
# A request object representing the call parameters. Required. To specify no
|
474
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
475
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
476
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
477
|
+
#
|
478
|
+
# @overload update_service(service: nil, update_mask: nil, validate_only: nil, allow_missing: nil)
|
479
|
+
# Pass arguments to `update_service` via keyword arguments. Note that at
|
480
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
481
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
482
|
+
#
|
483
|
+
# @param service [::Google::Cloud::Run::V2::Service, ::Hash]
|
484
|
+
# Required. The Service to be updated.
|
485
|
+
# @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
|
486
|
+
# The list of fields to be updated.
|
487
|
+
# @param validate_only [::Boolean]
|
488
|
+
# Indicates that the request should be validated and default values
|
489
|
+
# populated, without persisting the request or updating any resources.
|
490
|
+
# @param allow_missing [::Boolean]
|
491
|
+
# If set to true, and if the Service does not exist, it will create a new
|
492
|
+
# one. Caller must have both create and update permissions for this call if
|
493
|
+
# this is set to true.
|
494
|
+
#
|
495
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
496
|
+
# @yieldparam response [::Gapic::Operation]
|
497
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
498
|
+
#
|
499
|
+
# @return [::Gapic::Operation]
|
500
|
+
#
|
501
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
502
|
+
#
|
503
|
+
# @example Basic example
|
504
|
+
# require "google/cloud/run/v2"
|
505
|
+
#
|
506
|
+
# # Create a client object. The client can be reused for multiple calls.
|
507
|
+
# client = Google::Cloud::Run::V2::Services::Client.new
|
508
|
+
#
|
509
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
510
|
+
# request = Google::Cloud::Run::V2::UpdateServiceRequest.new
|
511
|
+
#
|
512
|
+
# # Call the update_service method.
|
513
|
+
# result = client.update_service request
|
514
|
+
#
|
515
|
+
# # The returned object is of type Gapic::Operation. You can use this
|
516
|
+
# # object to check the status of an operation, cancel it, or wait
|
517
|
+
# # for results. Here is how to block until completion:
|
518
|
+
# result.wait_until_done! timeout: 60
|
519
|
+
# if result.response?
|
520
|
+
# p result.response
|
521
|
+
# else
|
522
|
+
# puts "Error!"
|
523
|
+
# end
|
524
|
+
#
|
525
|
+
def update_service request, options = nil
|
526
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
527
|
+
|
528
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Run::V2::UpdateServiceRequest
|
529
|
+
|
530
|
+
# Converts hash and nil to an options object
|
531
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
532
|
+
|
533
|
+
# Customize the options with defaults
|
534
|
+
metadata = @config.rpcs.update_service.metadata.to_h
|
535
|
+
|
536
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
537
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
538
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
539
|
+
gapic_version: ::Google::Cloud::Run::V2::VERSION
|
540
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
541
|
+
|
542
|
+
header_params = {}
|
543
|
+
if request.service&.name
|
544
|
+
header_params["service.name"] = request.service.name
|
545
|
+
end
|
546
|
+
|
547
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
548
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
549
|
+
|
550
|
+
options.apply_defaults timeout: @config.rpcs.update_service.timeout,
|
551
|
+
metadata: metadata,
|
552
|
+
retry_policy: @config.rpcs.update_service.retry_policy
|
553
|
+
|
554
|
+
options.apply_defaults timeout: @config.timeout,
|
555
|
+
metadata: @config.metadata,
|
556
|
+
retry_policy: @config.retry_policy
|
557
|
+
|
558
|
+
@services_stub.call_rpc :update_service, request, options: options do |response, operation|
|
559
|
+
response = ::Gapic::Operation.new response, @operations_client, options: options
|
560
|
+
yield response, operation if block_given?
|
561
|
+
return response
|
562
|
+
end
|
563
|
+
rescue ::GRPC::BadStatus => e
|
564
|
+
raise ::Google::Cloud::Error.from_error(e)
|
565
|
+
end
|
566
|
+
|
567
|
+
##
|
568
|
+
# Deletes a Service.
|
569
|
+
# This will cause the Service to stop serving traffic and will delete all
|
570
|
+
# revisions.
|
571
|
+
#
|
572
|
+
# @overload delete_service(request, options = nil)
|
573
|
+
# Pass arguments to `delete_service` via a request object, either of type
|
574
|
+
# {::Google::Cloud::Run::V2::DeleteServiceRequest} or an equivalent Hash.
|
575
|
+
#
|
576
|
+
# @param request [::Google::Cloud::Run::V2::DeleteServiceRequest, ::Hash]
|
577
|
+
# A request object representing the call parameters. Required. To specify no
|
578
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
579
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
580
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
581
|
+
#
|
582
|
+
# @overload delete_service(name: nil, validate_only: nil, etag: nil)
|
583
|
+
# Pass arguments to `delete_service` via keyword arguments. Note that at
|
584
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
585
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
586
|
+
#
|
587
|
+
# @param name [::String]
|
588
|
+
# Required. The full name of the Service.
|
589
|
+
# Format: projects/\\{projectnumber}/locations/\\{location}/services/\\{service}
|
590
|
+
# @param validate_only [::Boolean]
|
591
|
+
# Indicates that the request should be validated without actually
|
592
|
+
# deleting any resources.
|
593
|
+
# @param etag [::String]
|
594
|
+
# A system-generated fingerprint for this version of the
|
595
|
+
# resource. May be used to detect modification conflict during updates.
|
596
|
+
#
|
597
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
598
|
+
# @yieldparam response [::Gapic::Operation]
|
599
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
600
|
+
#
|
601
|
+
# @return [::Gapic::Operation]
|
602
|
+
#
|
603
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
604
|
+
#
|
605
|
+
# @example Basic example
|
606
|
+
# require "google/cloud/run/v2"
|
607
|
+
#
|
608
|
+
# # Create a client object. The client can be reused for multiple calls.
|
609
|
+
# client = Google::Cloud::Run::V2::Services::Client.new
|
610
|
+
#
|
611
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
612
|
+
# request = Google::Cloud::Run::V2::DeleteServiceRequest.new
|
613
|
+
#
|
614
|
+
# # Call the delete_service method.
|
615
|
+
# result = client.delete_service request
|
616
|
+
#
|
617
|
+
# # The returned object is of type Gapic::Operation. You can use this
|
618
|
+
# # object to check the status of an operation, cancel it, or wait
|
619
|
+
# # for results. Here is how to block until completion:
|
620
|
+
# result.wait_until_done! timeout: 60
|
621
|
+
# if result.response?
|
622
|
+
# p result.response
|
623
|
+
# else
|
624
|
+
# puts "Error!"
|
625
|
+
# end
|
626
|
+
#
|
627
|
+
def delete_service request, options = nil
|
628
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
629
|
+
|
630
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Run::V2::DeleteServiceRequest
|
631
|
+
|
632
|
+
# Converts hash and nil to an options object
|
633
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
634
|
+
|
635
|
+
# Customize the options with defaults
|
636
|
+
metadata = @config.rpcs.delete_service.metadata.to_h
|
637
|
+
|
638
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
639
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
640
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
641
|
+
gapic_version: ::Google::Cloud::Run::V2::VERSION
|
642
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
643
|
+
|
644
|
+
header_params = {}
|
645
|
+
if request.name
|
646
|
+
header_params["name"] = request.name
|
647
|
+
end
|
648
|
+
|
649
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
650
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
651
|
+
|
652
|
+
options.apply_defaults timeout: @config.rpcs.delete_service.timeout,
|
653
|
+
metadata: metadata,
|
654
|
+
retry_policy: @config.rpcs.delete_service.retry_policy
|
655
|
+
|
656
|
+
options.apply_defaults timeout: @config.timeout,
|
657
|
+
metadata: @config.metadata,
|
658
|
+
retry_policy: @config.retry_policy
|
659
|
+
|
660
|
+
@services_stub.call_rpc :delete_service, request, options: options do |response, operation|
|
661
|
+
response = ::Gapic::Operation.new response, @operations_client, options: options
|
662
|
+
yield response, operation if block_given?
|
663
|
+
return response
|
664
|
+
end
|
665
|
+
rescue ::GRPC::BadStatus => e
|
666
|
+
raise ::Google::Cloud::Error.from_error(e)
|
667
|
+
end
|
668
|
+
|
669
|
+
##
|
670
|
+
# Get the IAM Access Control policy currently in effect for the given
|
671
|
+
# Cloud Run Service. This result does not include any inherited policies.
|
672
|
+
#
|
673
|
+
# @overload get_iam_policy(request, options = nil)
|
674
|
+
# Pass arguments to `get_iam_policy` via a request object, either of type
|
675
|
+
# {::Google::Iam::V1::GetIamPolicyRequest} or an equivalent Hash.
|
676
|
+
#
|
677
|
+
# @param request [::Google::Iam::V1::GetIamPolicyRequest, ::Hash]
|
678
|
+
# A request object representing the call parameters. Required. To specify no
|
679
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
680
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
681
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
682
|
+
#
|
683
|
+
# @overload get_iam_policy(resource: nil, options: nil)
|
684
|
+
# Pass arguments to `get_iam_policy` via keyword arguments. Note that at
|
685
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
686
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
687
|
+
#
|
688
|
+
# @param resource [::String]
|
689
|
+
# REQUIRED: The resource for which the policy is being requested.
|
690
|
+
# See the operation documentation for the appropriate value for this field.
|
691
|
+
# @param options [::Google::Iam::V1::GetPolicyOptions, ::Hash]
|
692
|
+
# OPTIONAL: A `GetPolicyOptions` object for specifying options to
|
693
|
+
# `GetIamPolicy`.
|
694
|
+
#
|
695
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
696
|
+
# @yieldparam response [::Google::Iam::V1::Policy]
|
697
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
698
|
+
#
|
699
|
+
# @return [::Google::Iam::V1::Policy]
|
700
|
+
#
|
701
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
702
|
+
#
|
703
|
+
# @example Basic example
|
704
|
+
# require "google/cloud/run/v2"
|
705
|
+
#
|
706
|
+
# # Create a client object. The client can be reused for multiple calls.
|
707
|
+
# client = Google::Cloud::Run::V2::Services::Client.new
|
708
|
+
#
|
709
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
710
|
+
# request = Google::Iam::V1::GetIamPolicyRequest.new
|
711
|
+
#
|
712
|
+
# # Call the get_iam_policy method.
|
713
|
+
# result = client.get_iam_policy request
|
714
|
+
#
|
715
|
+
# # The returned object is of type Google::Iam::V1::Policy.
|
716
|
+
# p result
|
717
|
+
#
|
718
|
+
def get_iam_policy request, options = nil
|
719
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
720
|
+
|
721
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Iam::V1::GetIamPolicyRequest
|
722
|
+
|
723
|
+
# Converts hash and nil to an options object
|
724
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
725
|
+
|
726
|
+
# Customize the options with defaults
|
727
|
+
metadata = @config.rpcs.get_iam_policy.metadata.to_h
|
728
|
+
|
729
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
730
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
731
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
732
|
+
gapic_version: ::Google::Cloud::Run::V2::VERSION
|
733
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
734
|
+
|
735
|
+
header_params = {}
|
736
|
+
if request.resource
|
737
|
+
header_params["resource"] = request.resource
|
738
|
+
end
|
739
|
+
|
740
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
741
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
742
|
+
|
743
|
+
options.apply_defaults timeout: @config.rpcs.get_iam_policy.timeout,
|
744
|
+
metadata: metadata,
|
745
|
+
retry_policy: @config.rpcs.get_iam_policy.retry_policy
|
746
|
+
|
747
|
+
options.apply_defaults timeout: @config.timeout,
|
748
|
+
metadata: @config.metadata,
|
749
|
+
retry_policy: @config.retry_policy
|
750
|
+
|
751
|
+
@services_stub.call_rpc :get_iam_policy, request, options: options do |response, operation|
|
752
|
+
yield response, operation if block_given?
|
753
|
+
return response
|
754
|
+
end
|
755
|
+
rescue ::GRPC::BadStatus => e
|
756
|
+
raise ::Google::Cloud::Error.from_error(e)
|
757
|
+
end
|
758
|
+
|
759
|
+
##
|
760
|
+
# Sets the IAM Access control policy for the specified Service. Overwrites
|
761
|
+
# any existing policy.
|
762
|
+
#
|
763
|
+
# @overload set_iam_policy(request, options = nil)
|
764
|
+
# Pass arguments to `set_iam_policy` via a request object, either of type
|
765
|
+
# {::Google::Iam::V1::SetIamPolicyRequest} or an equivalent Hash.
|
766
|
+
#
|
767
|
+
# @param request [::Google::Iam::V1::SetIamPolicyRequest, ::Hash]
|
768
|
+
# A request object representing the call parameters. Required. To specify no
|
769
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
770
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
771
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
772
|
+
#
|
773
|
+
# @overload set_iam_policy(resource: nil, policy: nil, update_mask: nil)
|
774
|
+
# Pass arguments to `set_iam_policy` via keyword arguments. Note that at
|
775
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
776
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
777
|
+
#
|
778
|
+
# @param resource [::String]
|
779
|
+
# REQUIRED: The resource for which the policy is being specified.
|
780
|
+
# See the operation documentation for the appropriate value for this field.
|
781
|
+
# @param policy [::Google::Iam::V1::Policy, ::Hash]
|
782
|
+
# REQUIRED: The complete policy to be applied to the `resource`. The size of
|
783
|
+
# the policy is limited to a few 10s of KB. An empty policy is a
|
784
|
+
# valid policy but certain Cloud Platform services (such as Projects)
|
785
|
+
# might reject them.
|
786
|
+
# @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
|
787
|
+
# OPTIONAL: A FieldMask specifying which fields of the policy to modify. Only
|
788
|
+
# the fields in the mask will be modified. If no mask is provided, the
|
789
|
+
# following default mask is used:
|
790
|
+
#
|
791
|
+
# `paths: "bindings, etag"`
|
792
|
+
#
|
793
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
794
|
+
# @yieldparam response [::Google::Iam::V1::Policy]
|
795
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
796
|
+
#
|
797
|
+
# @return [::Google::Iam::V1::Policy]
|
798
|
+
#
|
799
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
800
|
+
#
|
801
|
+
# @example Basic example
|
802
|
+
# require "google/cloud/run/v2"
|
803
|
+
#
|
804
|
+
# # Create a client object. The client can be reused for multiple calls.
|
805
|
+
# client = Google::Cloud::Run::V2::Services::Client.new
|
806
|
+
#
|
807
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
808
|
+
# request = Google::Iam::V1::SetIamPolicyRequest.new
|
809
|
+
#
|
810
|
+
# # Call the set_iam_policy method.
|
811
|
+
# result = client.set_iam_policy request
|
812
|
+
#
|
813
|
+
# # The returned object is of type Google::Iam::V1::Policy.
|
814
|
+
# p result
|
815
|
+
#
|
816
|
+
def set_iam_policy request, options = nil
|
817
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
818
|
+
|
819
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Iam::V1::SetIamPolicyRequest
|
820
|
+
|
821
|
+
# Converts hash and nil to an options object
|
822
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
823
|
+
|
824
|
+
# Customize the options with defaults
|
825
|
+
metadata = @config.rpcs.set_iam_policy.metadata.to_h
|
826
|
+
|
827
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
828
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
829
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
830
|
+
gapic_version: ::Google::Cloud::Run::V2::VERSION
|
831
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
832
|
+
|
833
|
+
header_params = {}
|
834
|
+
if request.resource
|
835
|
+
header_params["resource"] = request.resource
|
836
|
+
end
|
837
|
+
|
838
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
839
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
840
|
+
|
841
|
+
options.apply_defaults timeout: @config.rpcs.set_iam_policy.timeout,
|
842
|
+
metadata: metadata,
|
843
|
+
retry_policy: @config.rpcs.set_iam_policy.retry_policy
|
844
|
+
|
845
|
+
options.apply_defaults timeout: @config.timeout,
|
846
|
+
metadata: @config.metadata,
|
847
|
+
retry_policy: @config.retry_policy
|
848
|
+
|
849
|
+
@services_stub.call_rpc :set_iam_policy, request, options: options do |response, operation|
|
850
|
+
yield response, operation if block_given?
|
851
|
+
return response
|
852
|
+
end
|
853
|
+
rescue ::GRPC::BadStatus => e
|
854
|
+
raise ::Google::Cloud::Error.from_error(e)
|
855
|
+
end
|
856
|
+
|
857
|
+
##
|
858
|
+
# Returns permissions that a caller has on the specified Project.
|
859
|
+
#
|
860
|
+
# There are no permissions required for making this API call.
|
861
|
+
#
|
862
|
+
# @overload test_iam_permissions(request, options = nil)
|
863
|
+
# Pass arguments to `test_iam_permissions` via a request object, either of type
|
864
|
+
# {::Google::Iam::V1::TestIamPermissionsRequest} or an equivalent Hash.
|
865
|
+
#
|
866
|
+
# @param request [::Google::Iam::V1::TestIamPermissionsRequest, ::Hash]
|
867
|
+
# A request object representing the call parameters. Required. To specify no
|
868
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
869
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
870
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
871
|
+
#
|
872
|
+
# @overload test_iam_permissions(resource: nil, permissions: nil)
|
873
|
+
# Pass arguments to `test_iam_permissions` via keyword arguments. Note that at
|
874
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
875
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
876
|
+
#
|
877
|
+
# @param resource [::String]
|
878
|
+
# REQUIRED: The resource for which the policy detail is being requested.
|
879
|
+
# See the operation documentation for the appropriate value for this field.
|
880
|
+
# @param permissions [::Array<::String>]
|
881
|
+
# The set of permissions to check for the `resource`. Permissions with
|
882
|
+
# wildcards (such as '*' or 'storage.*') are not allowed. For more
|
883
|
+
# information see
|
884
|
+
# [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions).
|
885
|
+
#
|
886
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
887
|
+
# @yieldparam response [::Google::Iam::V1::TestIamPermissionsResponse]
|
888
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
889
|
+
#
|
890
|
+
# @return [::Google::Iam::V1::TestIamPermissionsResponse]
|
891
|
+
#
|
892
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
893
|
+
#
|
894
|
+
# @example Basic example
|
895
|
+
# require "google/cloud/run/v2"
|
896
|
+
#
|
897
|
+
# # Create a client object. The client can be reused for multiple calls.
|
898
|
+
# client = Google::Cloud::Run::V2::Services::Client.new
|
899
|
+
#
|
900
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
901
|
+
# request = Google::Iam::V1::TestIamPermissionsRequest.new
|
902
|
+
#
|
903
|
+
# # Call the test_iam_permissions method.
|
904
|
+
# result = client.test_iam_permissions request
|
905
|
+
#
|
906
|
+
# # The returned object is of type Google::Iam::V1::TestIamPermissionsResponse.
|
907
|
+
# p result
|
908
|
+
#
|
909
|
+
def test_iam_permissions request, options = nil
|
910
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
911
|
+
|
912
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Iam::V1::TestIamPermissionsRequest
|
913
|
+
|
914
|
+
# Converts hash and nil to an options object
|
915
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
916
|
+
|
917
|
+
# Customize the options with defaults
|
918
|
+
metadata = @config.rpcs.test_iam_permissions.metadata.to_h
|
919
|
+
|
920
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
921
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
922
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
923
|
+
gapic_version: ::Google::Cloud::Run::V2::VERSION
|
924
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
925
|
+
|
926
|
+
header_params = {}
|
927
|
+
if request.resource
|
928
|
+
header_params["resource"] = request.resource
|
929
|
+
end
|
930
|
+
|
931
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
932
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
933
|
+
|
934
|
+
options.apply_defaults timeout: @config.rpcs.test_iam_permissions.timeout,
|
935
|
+
metadata: metadata,
|
936
|
+
retry_policy: @config.rpcs.test_iam_permissions.retry_policy
|
937
|
+
|
938
|
+
options.apply_defaults timeout: @config.timeout,
|
939
|
+
metadata: @config.metadata,
|
940
|
+
retry_policy: @config.retry_policy
|
941
|
+
|
942
|
+
@services_stub.call_rpc :test_iam_permissions, request, options: options do |response, operation|
|
943
|
+
yield response, operation if block_given?
|
944
|
+
return response
|
945
|
+
end
|
946
|
+
rescue ::GRPC::BadStatus => e
|
947
|
+
raise ::Google::Cloud::Error.from_error(e)
|
948
|
+
end
|
949
|
+
|
950
|
+
##
|
951
|
+
# Configuration class for the Services API.
|
952
|
+
#
|
953
|
+
# This class represents the configuration for Services,
|
954
|
+
# providing control over timeouts, retry behavior, logging, transport
|
955
|
+
# parameters, and other low-level controls. Certain parameters can also be
|
956
|
+
# applied individually to specific RPCs. See
|
957
|
+
# {::Google::Cloud::Run::V2::Services::Client::Configuration::Rpcs}
|
958
|
+
# for a list of RPCs that can be configured independently.
|
959
|
+
#
|
960
|
+
# Configuration can be applied globally to all clients, or to a single client
|
961
|
+
# on construction.
|
962
|
+
#
|
963
|
+
# @example
|
964
|
+
#
|
965
|
+
# # Modify the global config, setting the timeout for
|
966
|
+
# # create_service to 20 seconds,
|
967
|
+
# # and all remaining timeouts to 10 seconds.
|
968
|
+
# ::Google::Cloud::Run::V2::Services::Client.configure do |config|
|
969
|
+
# config.timeout = 10.0
|
970
|
+
# config.rpcs.create_service.timeout = 20.0
|
971
|
+
# end
|
972
|
+
#
|
973
|
+
# # Apply the above configuration only to a new client.
|
974
|
+
# client = ::Google::Cloud::Run::V2::Services::Client.new do |config|
|
975
|
+
# config.timeout = 10.0
|
976
|
+
# config.rpcs.create_service.timeout = 20.0
|
977
|
+
# end
|
978
|
+
#
|
979
|
+
# @!attribute [rw] endpoint
|
980
|
+
# The hostname or hostname:port of the service endpoint.
|
981
|
+
# Defaults to `"run.googleapis.com"`.
|
982
|
+
# @return [::String]
|
983
|
+
# @!attribute [rw] credentials
|
984
|
+
# Credentials to send with calls. You may provide any of the following types:
|
985
|
+
# * (`String`) The path to a service account key file in JSON format
|
986
|
+
# * (`Hash`) A service account key as a Hash
|
987
|
+
# * (`Google::Auth::Credentials`) A googleauth credentials object
|
988
|
+
# (see the [googleauth docs](https://googleapis.dev/ruby/googleauth/latest/index.html))
|
989
|
+
# * (`Signet::OAuth2::Client`) A signet oauth2 client object
|
990
|
+
# (see the [signet docs](https://googleapis.dev/ruby/signet/latest/Signet/OAuth2/Client.html))
|
991
|
+
# * (`GRPC::Core::Channel`) a gRPC channel with included credentials
|
992
|
+
# * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
|
993
|
+
# * (`nil`) indicating no credentials
|
994
|
+
# @return [::Object]
|
995
|
+
# @!attribute [rw] scope
|
996
|
+
# The OAuth scopes
|
997
|
+
# @return [::Array<::String>]
|
998
|
+
# @!attribute [rw] lib_name
|
999
|
+
# The library name as recorded in instrumentation and logging
|
1000
|
+
# @return [::String]
|
1001
|
+
# @!attribute [rw] lib_version
|
1002
|
+
# The library version as recorded in instrumentation and logging
|
1003
|
+
# @return [::String]
|
1004
|
+
# @!attribute [rw] channel_args
|
1005
|
+
# Extra parameters passed to the gRPC channel. Note: this is ignored if a
|
1006
|
+
# `GRPC::Core::Channel` object is provided as the credential.
|
1007
|
+
# @return [::Hash]
|
1008
|
+
# @!attribute [rw] interceptors
|
1009
|
+
# An array of interceptors that are run before calls are executed.
|
1010
|
+
# @return [::Array<::GRPC::ClientInterceptor>]
|
1011
|
+
# @!attribute [rw] timeout
|
1012
|
+
# The call timeout in seconds.
|
1013
|
+
# @return [::Numeric]
|
1014
|
+
# @!attribute [rw] metadata
|
1015
|
+
# Additional gRPC headers to be sent with the call.
|
1016
|
+
# @return [::Hash{::Symbol=>::String}]
|
1017
|
+
# @!attribute [rw] retry_policy
|
1018
|
+
# The retry policy. The value is a hash with the following keys:
|
1019
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
1020
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
1021
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
1022
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
1023
|
+
# trigger a retry.
|
1024
|
+
# @return [::Hash]
|
1025
|
+
# @!attribute [rw] quota_project
|
1026
|
+
# A separate project against which to charge quota.
|
1027
|
+
# @return [::String]
|
1028
|
+
#
|
1029
|
+
class Configuration
|
1030
|
+
extend ::Gapic::Config
|
1031
|
+
|
1032
|
+
config_attr :endpoint, "run.googleapis.com", ::String
|
1033
|
+
config_attr :credentials, nil do |value|
|
1034
|
+
allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
|
1035
|
+
allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
|
1036
|
+
allowed.any? { |klass| klass === value }
|
1037
|
+
end
|
1038
|
+
config_attr :scope, nil, ::String, ::Array, nil
|
1039
|
+
config_attr :lib_name, nil, ::String, nil
|
1040
|
+
config_attr :lib_version, nil, ::String, nil
|
1041
|
+
config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
|
1042
|
+
config_attr :interceptors, nil, ::Array, nil
|
1043
|
+
config_attr :timeout, nil, ::Numeric, nil
|
1044
|
+
config_attr :metadata, nil, ::Hash, nil
|
1045
|
+
config_attr :retry_policy, nil, ::Hash, ::Proc, nil
|
1046
|
+
config_attr :quota_project, nil, ::String, nil
|
1047
|
+
|
1048
|
+
# @private
|
1049
|
+
def initialize parent_config = nil
|
1050
|
+
@parent_config = parent_config unless parent_config.nil?
|
1051
|
+
|
1052
|
+
yield self if block_given?
|
1053
|
+
end
|
1054
|
+
|
1055
|
+
##
|
1056
|
+
# Configurations for individual RPCs
|
1057
|
+
# @return [Rpcs]
|
1058
|
+
#
|
1059
|
+
def rpcs
|
1060
|
+
@rpcs ||= begin
|
1061
|
+
parent_rpcs = nil
|
1062
|
+
parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
|
1063
|
+
Rpcs.new parent_rpcs
|
1064
|
+
end
|
1065
|
+
end
|
1066
|
+
|
1067
|
+
##
|
1068
|
+
# Configuration RPC class for the Services API.
|
1069
|
+
#
|
1070
|
+
# Includes fields providing the configuration for each RPC in this service.
|
1071
|
+
# Each configuration object is of type `Gapic::Config::Method` and includes
|
1072
|
+
# the following configuration fields:
|
1073
|
+
#
|
1074
|
+
# * `timeout` (*type:* `Numeric`) - The call timeout in seconds
|
1075
|
+
# * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
|
1076
|
+
# * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
|
1077
|
+
# include the following keys:
|
1078
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
1079
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
1080
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
1081
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
1082
|
+
# trigger a retry.
|
1083
|
+
#
|
1084
|
+
class Rpcs
|
1085
|
+
##
|
1086
|
+
# RPC-specific configuration for `create_service`
|
1087
|
+
# @return [::Gapic::Config::Method]
|
1088
|
+
#
|
1089
|
+
attr_reader :create_service
|
1090
|
+
##
|
1091
|
+
# RPC-specific configuration for `get_service`
|
1092
|
+
# @return [::Gapic::Config::Method]
|
1093
|
+
#
|
1094
|
+
attr_reader :get_service
|
1095
|
+
##
|
1096
|
+
# RPC-specific configuration for `list_services`
|
1097
|
+
# @return [::Gapic::Config::Method]
|
1098
|
+
#
|
1099
|
+
attr_reader :list_services
|
1100
|
+
##
|
1101
|
+
# RPC-specific configuration for `update_service`
|
1102
|
+
# @return [::Gapic::Config::Method]
|
1103
|
+
#
|
1104
|
+
attr_reader :update_service
|
1105
|
+
##
|
1106
|
+
# RPC-specific configuration for `delete_service`
|
1107
|
+
# @return [::Gapic::Config::Method]
|
1108
|
+
#
|
1109
|
+
attr_reader :delete_service
|
1110
|
+
##
|
1111
|
+
# RPC-specific configuration for `get_iam_policy`
|
1112
|
+
# @return [::Gapic::Config::Method]
|
1113
|
+
#
|
1114
|
+
attr_reader :get_iam_policy
|
1115
|
+
##
|
1116
|
+
# RPC-specific configuration for `set_iam_policy`
|
1117
|
+
# @return [::Gapic::Config::Method]
|
1118
|
+
#
|
1119
|
+
attr_reader :set_iam_policy
|
1120
|
+
##
|
1121
|
+
# RPC-specific configuration for `test_iam_permissions`
|
1122
|
+
# @return [::Gapic::Config::Method]
|
1123
|
+
#
|
1124
|
+
attr_reader :test_iam_permissions
|
1125
|
+
|
1126
|
+
# @private
|
1127
|
+
def initialize parent_rpcs = nil
|
1128
|
+
create_service_config = parent_rpcs.create_service if parent_rpcs.respond_to? :create_service
|
1129
|
+
@create_service = ::Gapic::Config::Method.new create_service_config
|
1130
|
+
get_service_config = parent_rpcs.get_service if parent_rpcs.respond_to? :get_service
|
1131
|
+
@get_service = ::Gapic::Config::Method.new get_service_config
|
1132
|
+
list_services_config = parent_rpcs.list_services if parent_rpcs.respond_to? :list_services
|
1133
|
+
@list_services = ::Gapic::Config::Method.new list_services_config
|
1134
|
+
update_service_config = parent_rpcs.update_service if parent_rpcs.respond_to? :update_service
|
1135
|
+
@update_service = ::Gapic::Config::Method.new update_service_config
|
1136
|
+
delete_service_config = parent_rpcs.delete_service if parent_rpcs.respond_to? :delete_service
|
1137
|
+
@delete_service = ::Gapic::Config::Method.new delete_service_config
|
1138
|
+
get_iam_policy_config = parent_rpcs.get_iam_policy if parent_rpcs.respond_to? :get_iam_policy
|
1139
|
+
@get_iam_policy = ::Gapic::Config::Method.new get_iam_policy_config
|
1140
|
+
set_iam_policy_config = parent_rpcs.set_iam_policy if parent_rpcs.respond_to? :set_iam_policy
|
1141
|
+
@set_iam_policy = ::Gapic::Config::Method.new set_iam_policy_config
|
1142
|
+
test_iam_permissions_config = parent_rpcs.test_iam_permissions if parent_rpcs.respond_to? :test_iam_permissions
|
1143
|
+
@test_iam_permissions = ::Gapic::Config::Method.new test_iam_permissions_config
|
1144
|
+
|
1145
|
+
yield self if block_given?
|
1146
|
+
end
|
1147
|
+
end
|
1148
|
+
end
|
1149
|
+
end
|
1150
|
+
end
|
1151
|
+
end
|
1152
|
+
end
|
1153
|
+
end
|
1154
|
+
end
|