google-cloud-run-v2 0.28.1 → 0.29.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/build_pb.rb +4 -25
- data/lib/google/cloud/run/v2/builds/client.rb +11 -1
- data/lib/google/cloud/run/v2/builds/rest/client.rb +11 -1
- data/lib/google/cloud/run/v2/condition_pb.rb +3 -25
- data/lib/google/cloud/run/v2/container_status_pb.rb +21 -0
- data/lib/google/cloud/run/v2/execution_pb.rb +2 -26
- data/lib/google/cloud/run/v2/execution_template_pb.rb +2 -24
- data/lib/google/cloud/run/v2/executions/client.rb +2 -0
- data/lib/google/cloud/run/v2/executions/operations.rb +2 -0
- data/lib/google/cloud/run/v2/executions/rest/client.rb +2 -0
- data/lib/google/cloud/run/v2/executions/rest/operations.rb +2 -0
- data/lib/google/cloud/run/v2/instance_pb.rb +42 -0
- data/lib/google/cloud/run/v2/instance_services_pb.rb +55 -0
- data/lib/google/cloud/run/v2/instance_split_pb.rb +2 -23
- data/lib/google/cloud/run/v2/instances/client.rb +1059 -0
- data/lib/google/cloud/run/v2/instances/credentials.rb +47 -0
- data/lib/google/cloud/run/v2/instances/operations.rb +851 -0
- data/lib/google/cloud/run/v2/instances/paths.rb +178 -0
- data/lib/google/cloud/run/v2/instances/rest/client.rb +962 -0
- data/lib/google/cloud/run/v2/instances/rest/operations.rb +1095 -0
- data/lib/google/cloud/run/v2/instances/rest/service_stub.rb +450 -0
- data/lib/google/cloud/run/v2/instances/rest.rb +53 -0
- data/lib/google/cloud/run/v2/instances.rb +56 -0
- data/lib/google/cloud/run/v2/job_pb.rb +3 -30
- data/lib/google/cloud/run/v2/jobs/client.rb +2 -0
- data/lib/google/cloud/run/v2/jobs/operations.rb +2 -0
- data/lib/google/cloud/run/v2/jobs/rest/client.rb +2 -0
- data/lib/google/cloud/run/v2/jobs/rest/operations.rb +2 -0
- data/lib/google/cloud/run/v2/k8s.min_pb.rb +5 -24
- data/lib/google/cloud/run/v2/rest.rb +1 -0
- data/lib/google/cloud/run/v2/revision_pb.rb +2 -29
- data/lib/google/cloud/run/v2/revision_template_pb.rb +2 -26
- data/lib/google/cloud/run/v2/revisions/client.rb +2 -0
- data/lib/google/cloud/run/v2/revisions/operations.rb +2 -0
- data/lib/google/cloud/run/v2/revisions/rest/client.rb +2 -0
- data/lib/google/cloud/run/v2/revisions/rest/operations.rb +2 -0
- data/lib/google/cloud/run/v2/service_pb.rb +4 -30
- data/lib/google/cloud/run/v2/services/client.rb +2 -0
- data/lib/google/cloud/run/v2/services/operations.rb +2 -0
- data/lib/google/cloud/run/v2/services/rest/client.rb +2 -0
- data/lib/google/cloud/run/v2/services/rest/operations.rb +2 -0
- data/lib/google/cloud/run/v2/status_pb.rb +2 -23
- data/lib/google/cloud/run/v2/task_pb.rb +2 -29
- data/lib/google/cloud/run/v2/task_template_pb.rb +2 -26
- data/lib/google/cloud/run/v2/tasks/client.rb +2 -0
- data/lib/google/cloud/run/v2/tasks/rest/client.rb +2 -0
- data/lib/google/cloud/run/v2/traffic_target_pb.rb +2 -23
- data/lib/google/cloud/run/v2/vendor_settings_pb.rb +3 -24
- data/lib/google/cloud/run/v2/version.rb +1 -1
- data/lib/google/cloud/run/v2/worker_pool_pb.rb +3 -30
- data/lib/google/cloud/run/v2/worker_pool_revision_template_pb.rb +3 -27
- data/lib/google/cloud/run/v2/worker_pools/client.rb +2 -0
- data/lib/google/cloud/run/v2/worker_pools/operations.rb +2 -0
- data/lib/google/cloud/run/v2/worker_pools/rest/client.rb +2 -0
- data/lib/google/cloud/run/v2/worker_pools/rest/operations.rb +2 -0
- data/lib/google/cloud/run/v2.rb +1 -0
- data/proto_docs/google/api/client.rb +149 -29
- data/proto_docs/google/api/routing.rb +7 -3
- data/proto_docs/google/cloud/run/v2/build.rb +11 -0
- data/proto_docs/google/cloud/run/v2/condition.rb +3 -0
- data/proto_docs/google/cloud/run/v2/container_status.rb +42 -0
- data/proto_docs/google/cloud/run/v2/instance.rb +328 -0
- data/proto_docs/google/cloud/run/v2/job.rb +2 -2
- data/proto_docs/google/cloud/run/v2/k8s.min.rb +37 -2
- data/proto_docs/google/cloud/run/v2/service.rb +32 -7
- data/proto_docs/google/cloud/run/v2/vendor_settings.rb +5 -0
- data/proto_docs/google/cloud/run/v2/worker_pool.rb +23 -22
- data/proto_docs/google/cloud/run/v2/worker_pool_revision_template.rb +3 -0
- metadata +18 -4
|
@@ -0,0 +1,962 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# Copyright 2026 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/instance_pb"
|
|
21
|
+
require "google/cloud/run/v2/instances/rest/service_stub"
|
|
22
|
+
require "google/cloud/location/rest"
|
|
23
|
+
|
|
24
|
+
module Google
|
|
25
|
+
module Cloud
|
|
26
|
+
module Run
|
|
27
|
+
module V2
|
|
28
|
+
module Instances
|
|
29
|
+
module Rest
|
|
30
|
+
##
|
|
31
|
+
# REST client for the Instances service.
|
|
32
|
+
#
|
|
33
|
+
# The Cloud Run Instances API allows you to manage Cloud Run Instances.
|
|
34
|
+
#
|
|
35
|
+
class Client
|
|
36
|
+
# @private
|
|
37
|
+
API_VERSION = ""
|
|
38
|
+
|
|
39
|
+
# @private
|
|
40
|
+
DEFAULT_ENDPOINT_TEMPLATE = "run.$UNIVERSE_DOMAIN$"
|
|
41
|
+
|
|
42
|
+
include Paths
|
|
43
|
+
|
|
44
|
+
# @private
|
|
45
|
+
attr_reader :instances_stub
|
|
46
|
+
|
|
47
|
+
##
|
|
48
|
+
# Configure the Instances Client class.
|
|
49
|
+
#
|
|
50
|
+
# See {::Google::Cloud::Run::V2::Instances::Rest::Client::Configuration}
|
|
51
|
+
# for a description of the configuration fields.
|
|
52
|
+
#
|
|
53
|
+
# @example
|
|
54
|
+
#
|
|
55
|
+
# # Modify the configuration for all Instances clients
|
|
56
|
+
# ::Google::Cloud::Run::V2::Instances::Rest::Client.configure do |config|
|
|
57
|
+
# config.timeout = 10.0
|
|
58
|
+
# end
|
|
59
|
+
#
|
|
60
|
+
# @yield [config] Configure the Client client.
|
|
61
|
+
# @yieldparam config [Client::Configuration]
|
|
62
|
+
#
|
|
63
|
+
# @return [Client::Configuration]
|
|
64
|
+
#
|
|
65
|
+
def self.configure
|
|
66
|
+
@configure ||= begin
|
|
67
|
+
namespace = ["Google", "Cloud", "Run", "V2"]
|
|
68
|
+
parent_config = while namespace.any?
|
|
69
|
+
parent_name = namespace.join "::"
|
|
70
|
+
parent_const = const_get parent_name
|
|
71
|
+
break parent_const.configure if parent_const.respond_to? :configure
|
|
72
|
+
namespace.pop
|
|
73
|
+
end
|
|
74
|
+
default_config = Client::Configuration.new parent_config
|
|
75
|
+
|
|
76
|
+
default_config
|
|
77
|
+
end
|
|
78
|
+
yield @configure if block_given?
|
|
79
|
+
@configure
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
##
|
|
83
|
+
# Configure the Instances Client instance.
|
|
84
|
+
#
|
|
85
|
+
# The configuration is set to the derived mode, meaning that values can be changed,
|
|
86
|
+
# but structural changes (adding new fields, etc.) are not allowed. Structural changes
|
|
87
|
+
# should be made on {Client.configure}.
|
|
88
|
+
#
|
|
89
|
+
# See {::Google::Cloud::Run::V2::Instances::Rest::Client::Configuration}
|
|
90
|
+
# for a description of the configuration fields.
|
|
91
|
+
#
|
|
92
|
+
# @yield [config] Configure the Client client.
|
|
93
|
+
# @yieldparam config [Client::Configuration]
|
|
94
|
+
#
|
|
95
|
+
# @return [Client::Configuration]
|
|
96
|
+
#
|
|
97
|
+
def configure
|
|
98
|
+
yield @config if block_given?
|
|
99
|
+
@config
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
##
|
|
103
|
+
# The effective universe domain
|
|
104
|
+
#
|
|
105
|
+
# @return [String]
|
|
106
|
+
#
|
|
107
|
+
def universe_domain
|
|
108
|
+
@instances_stub.universe_domain
|
|
109
|
+
end
|
|
110
|
+
|
|
111
|
+
##
|
|
112
|
+
# Create a new Instances REST client object.
|
|
113
|
+
#
|
|
114
|
+
# @example
|
|
115
|
+
#
|
|
116
|
+
# # Create a client using the default configuration
|
|
117
|
+
# client = ::Google::Cloud::Run::V2::Instances::Rest::Client.new
|
|
118
|
+
#
|
|
119
|
+
# # Create a client using a custom configuration
|
|
120
|
+
# client = ::Google::Cloud::Run::V2::Instances::Rest::Client.new do |config|
|
|
121
|
+
# config.timeout = 10.0
|
|
122
|
+
# end
|
|
123
|
+
#
|
|
124
|
+
# @yield [config] Configure the Instances client.
|
|
125
|
+
# @yieldparam config [Client::Configuration]
|
|
126
|
+
#
|
|
127
|
+
def initialize
|
|
128
|
+
# Create the configuration object
|
|
129
|
+
@config = Configuration.new Client.configure
|
|
130
|
+
|
|
131
|
+
# Yield the configuration if needed
|
|
132
|
+
yield @config if block_given?
|
|
133
|
+
|
|
134
|
+
# Create credentials
|
|
135
|
+
credentials = @config.credentials
|
|
136
|
+
# Use self-signed JWT if the endpoint is unchanged from default,
|
|
137
|
+
# but only if the default endpoint does not have a region prefix.
|
|
138
|
+
enable_self_signed_jwt = @config.endpoint.nil? ||
|
|
139
|
+
(@config.endpoint == Configuration::DEFAULT_ENDPOINT &&
|
|
140
|
+
!@config.endpoint.split(".").first.include?("-"))
|
|
141
|
+
credentials ||= Credentials.default scope: @config.scope,
|
|
142
|
+
enable_self_signed_jwt: enable_self_signed_jwt
|
|
143
|
+
if credentials.is_a?(::String) || credentials.is_a?(::Hash)
|
|
144
|
+
credentials = Credentials.new credentials, scope: @config.scope
|
|
145
|
+
end
|
|
146
|
+
|
|
147
|
+
@quota_project_id = @config.quota_project
|
|
148
|
+
@quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
|
|
149
|
+
|
|
150
|
+
@operations_client = ::Google::Cloud::Run::V2::Instances::Rest::Operations.new do |config|
|
|
151
|
+
config.credentials = credentials
|
|
152
|
+
config.quota_project = @quota_project_id
|
|
153
|
+
config.endpoint = @config.endpoint
|
|
154
|
+
config.universe_domain = @config.universe_domain
|
|
155
|
+
end
|
|
156
|
+
|
|
157
|
+
@instances_stub = ::Google::Cloud::Run::V2::Instances::Rest::ServiceStub.new(
|
|
158
|
+
endpoint: @config.endpoint,
|
|
159
|
+
endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
|
|
160
|
+
universe_domain: @config.universe_domain,
|
|
161
|
+
credentials: credentials,
|
|
162
|
+
logger: @config.logger
|
|
163
|
+
)
|
|
164
|
+
|
|
165
|
+
@instances_stub.logger(stub: true)&.info do |entry|
|
|
166
|
+
entry.set_system_name
|
|
167
|
+
entry.set_service
|
|
168
|
+
entry.message = "Created client for #{entry.service}"
|
|
169
|
+
entry.set_credentials_fields credentials
|
|
170
|
+
entry.set "customEndpoint", @config.endpoint if @config.endpoint
|
|
171
|
+
entry.set "defaultTimeout", @config.timeout if @config.timeout
|
|
172
|
+
entry.set "quotaProject", @quota_project_id if @quota_project_id
|
|
173
|
+
end
|
|
174
|
+
|
|
175
|
+
@location_client = Google::Cloud::Location::Locations::Rest::Client.new do |config|
|
|
176
|
+
config.credentials = credentials
|
|
177
|
+
config.quota_project = @quota_project_id
|
|
178
|
+
config.endpoint = @instances_stub.endpoint
|
|
179
|
+
config.universe_domain = @instances_stub.universe_domain
|
|
180
|
+
config.logger = @instances_stub.logger if config.respond_to? :logger=
|
|
181
|
+
end
|
|
182
|
+
end
|
|
183
|
+
|
|
184
|
+
##
|
|
185
|
+
# Get the associated client for long-running operations.
|
|
186
|
+
#
|
|
187
|
+
# @return [::Google::Cloud::Run::V2::Instances::Rest::Operations]
|
|
188
|
+
#
|
|
189
|
+
attr_reader :operations_client
|
|
190
|
+
|
|
191
|
+
##
|
|
192
|
+
# Get the associated client for mix-in of the Locations.
|
|
193
|
+
#
|
|
194
|
+
# @return [Google::Cloud::Location::Locations::Rest::Client]
|
|
195
|
+
#
|
|
196
|
+
attr_reader :location_client
|
|
197
|
+
|
|
198
|
+
##
|
|
199
|
+
# The logger used for request/response debug logging.
|
|
200
|
+
#
|
|
201
|
+
# @return [Logger]
|
|
202
|
+
#
|
|
203
|
+
def logger
|
|
204
|
+
@instances_stub.logger
|
|
205
|
+
end
|
|
206
|
+
|
|
207
|
+
# Service calls
|
|
208
|
+
|
|
209
|
+
##
|
|
210
|
+
# Creates an Instance.
|
|
211
|
+
#
|
|
212
|
+
# @overload create_instance(request, options = nil)
|
|
213
|
+
# Pass arguments to `create_instance` via a request object, either of type
|
|
214
|
+
# {::Google::Cloud::Run::V2::CreateInstanceRequest} or an equivalent Hash.
|
|
215
|
+
#
|
|
216
|
+
# @param request [::Google::Cloud::Run::V2::CreateInstanceRequest, ::Hash]
|
|
217
|
+
# A request object representing the call parameters. Required. To specify no
|
|
218
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
|
219
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
|
220
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
|
221
|
+
#
|
|
222
|
+
# @overload create_instance(parent: nil, instance: nil, instance_id: nil, validate_only: nil)
|
|
223
|
+
# Pass arguments to `create_instance` via keyword arguments. Note that at
|
|
224
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
|
225
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
|
226
|
+
#
|
|
227
|
+
# @param parent [::String]
|
|
228
|
+
# @param instance [::Google::Cloud::Run::V2::Instance, ::Hash]
|
|
229
|
+
# @param instance_id [::String]
|
|
230
|
+
# Required. The unique identifier for the Instance. It must begin with
|
|
231
|
+
# letter, and cannot end with hyphen; must contain fewer than 50 characters.
|
|
232
|
+
# The name of the instance becomes \\{parent}/instances/\\{instance_id}.
|
|
233
|
+
# @param validate_only [::Boolean]
|
|
234
|
+
# Optional. Indicates that the request should be validated and default values
|
|
235
|
+
# populated, without persisting the request or creating any resources.
|
|
236
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
|
237
|
+
# @yieldparam result [::Gapic::Operation]
|
|
238
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
|
239
|
+
#
|
|
240
|
+
# @return [::Gapic::Operation]
|
|
241
|
+
#
|
|
242
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
|
243
|
+
#
|
|
244
|
+
# @example Basic example
|
|
245
|
+
# require "google/cloud/run/v2"
|
|
246
|
+
#
|
|
247
|
+
# # Create a client object. The client can be reused for multiple calls.
|
|
248
|
+
# client = Google::Cloud::Run::V2::Instances::Rest::Client.new
|
|
249
|
+
#
|
|
250
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
|
251
|
+
# request = Google::Cloud::Run::V2::CreateInstanceRequest.new
|
|
252
|
+
#
|
|
253
|
+
# # Call the create_instance method.
|
|
254
|
+
# result = client.create_instance request
|
|
255
|
+
#
|
|
256
|
+
# # The returned object is of type Gapic::Operation. You can use it to
|
|
257
|
+
# # check the status of an operation, cancel it, or wait for results.
|
|
258
|
+
# # Here is how to wait for a response.
|
|
259
|
+
# result.wait_until_done! timeout: 60
|
|
260
|
+
# if result.response?
|
|
261
|
+
# p result.response
|
|
262
|
+
# else
|
|
263
|
+
# puts "No response received."
|
|
264
|
+
# end
|
|
265
|
+
#
|
|
266
|
+
def create_instance 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::CreateInstanceRequest
|
|
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.create_instance.metadata.to_h
|
|
276
|
+
|
|
277
|
+
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version 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-api-version"] = API_VERSION unless API_VERSION.empty?
|
|
284
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
|
285
|
+
|
|
286
|
+
options.apply_defaults timeout: @config.rpcs.create_instance.timeout,
|
|
287
|
+
metadata: call_metadata,
|
|
288
|
+
retry_policy: @config.rpcs.create_instance.retry_policy
|
|
289
|
+
|
|
290
|
+
options.apply_defaults timeout: @config.timeout,
|
|
291
|
+
metadata: @config.metadata,
|
|
292
|
+
retry_policy: @config.retry_policy
|
|
293
|
+
|
|
294
|
+
@instances_stub.create_instance request, options do |result, operation|
|
|
295
|
+
result = ::Gapic::Operation.new result, @operations_client, options: options
|
|
296
|
+
yield result, operation if block_given?
|
|
297
|
+
throw :response, result
|
|
298
|
+
end
|
|
299
|
+
rescue ::Gapic::Rest::Error => e
|
|
300
|
+
raise ::Google::Cloud::Error.from_error(e)
|
|
301
|
+
end
|
|
302
|
+
|
|
303
|
+
##
|
|
304
|
+
# Deletes a Instance
|
|
305
|
+
#
|
|
306
|
+
# @overload delete_instance(request, options = nil)
|
|
307
|
+
# Pass arguments to `delete_instance` via a request object, either of type
|
|
308
|
+
# {::Google::Cloud::Run::V2::DeleteInstanceRequest} or an equivalent Hash.
|
|
309
|
+
#
|
|
310
|
+
# @param request [::Google::Cloud::Run::V2::DeleteInstanceRequest, ::Hash]
|
|
311
|
+
# A request object representing the call parameters. Required. To specify no
|
|
312
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
|
313
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
|
314
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
|
315
|
+
#
|
|
316
|
+
# @overload delete_instance(name: nil, validate_only: nil, etag: nil)
|
|
317
|
+
# Pass arguments to `delete_instance` via keyword arguments. Note that at
|
|
318
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
|
319
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
|
320
|
+
#
|
|
321
|
+
# @param name [::String]
|
|
322
|
+
# @param validate_only [::Boolean]
|
|
323
|
+
# Optional. Indicates that the request should be validated without actually
|
|
324
|
+
# deleting any resources.
|
|
325
|
+
# @param etag [::String]
|
|
326
|
+
# Optional. A system-generated fingerprint for this version of the
|
|
327
|
+
# resource. May be used to detect modification conflict during updates.
|
|
328
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
|
329
|
+
# @yieldparam result [::Gapic::Operation]
|
|
330
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
|
331
|
+
#
|
|
332
|
+
# @return [::Gapic::Operation]
|
|
333
|
+
#
|
|
334
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
|
335
|
+
#
|
|
336
|
+
# @example Basic example
|
|
337
|
+
# require "google/cloud/run/v2"
|
|
338
|
+
#
|
|
339
|
+
# # Create a client object. The client can be reused for multiple calls.
|
|
340
|
+
# client = Google::Cloud::Run::V2::Instances::Rest::Client.new
|
|
341
|
+
#
|
|
342
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
|
343
|
+
# request = Google::Cloud::Run::V2::DeleteInstanceRequest.new
|
|
344
|
+
#
|
|
345
|
+
# # Call the delete_instance method.
|
|
346
|
+
# result = client.delete_instance request
|
|
347
|
+
#
|
|
348
|
+
# # The returned object is of type Gapic::Operation. You can use it to
|
|
349
|
+
# # check the status of an operation, cancel it, or wait for results.
|
|
350
|
+
# # Here is how to wait for a response.
|
|
351
|
+
# result.wait_until_done! timeout: 60
|
|
352
|
+
# if result.response?
|
|
353
|
+
# p result.response
|
|
354
|
+
# else
|
|
355
|
+
# puts "No response received."
|
|
356
|
+
# end
|
|
357
|
+
#
|
|
358
|
+
def delete_instance request, options = nil
|
|
359
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
|
360
|
+
|
|
361
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Run::V2::DeleteInstanceRequest
|
|
362
|
+
|
|
363
|
+
# Converts hash and nil to an options object
|
|
364
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
|
365
|
+
|
|
366
|
+
# Customize the options with defaults
|
|
367
|
+
call_metadata = @config.rpcs.delete_instance.metadata.to_h
|
|
368
|
+
|
|
369
|
+
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
|
|
370
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
|
371
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
|
372
|
+
gapic_version: ::Google::Cloud::Run::V2::VERSION,
|
|
373
|
+
transports_version_send: [:rest]
|
|
374
|
+
|
|
375
|
+
call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
|
|
376
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
|
377
|
+
|
|
378
|
+
options.apply_defaults timeout: @config.rpcs.delete_instance.timeout,
|
|
379
|
+
metadata: call_metadata,
|
|
380
|
+
retry_policy: @config.rpcs.delete_instance.retry_policy
|
|
381
|
+
|
|
382
|
+
options.apply_defaults timeout: @config.timeout,
|
|
383
|
+
metadata: @config.metadata,
|
|
384
|
+
retry_policy: @config.retry_policy
|
|
385
|
+
|
|
386
|
+
@instances_stub.delete_instance request, options do |result, operation|
|
|
387
|
+
result = ::Gapic::Operation.new result, @operations_client, options: options
|
|
388
|
+
yield result, operation if block_given?
|
|
389
|
+
throw :response, result
|
|
390
|
+
end
|
|
391
|
+
rescue ::Gapic::Rest::Error => e
|
|
392
|
+
raise ::Google::Cloud::Error.from_error(e)
|
|
393
|
+
end
|
|
394
|
+
|
|
395
|
+
##
|
|
396
|
+
# Gets a Instance
|
|
397
|
+
#
|
|
398
|
+
# @overload get_instance(request, options = nil)
|
|
399
|
+
# Pass arguments to `get_instance` via a request object, either of type
|
|
400
|
+
# {::Google::Cloud::Run::V2::GetInstanceRequest} or an equivalent Hash.
|
|
401
|
+
#
|
|
402
|
+
# @param request [::Google::Cloud::Run::V2::GetInstanceRequest, ::Hash]
|
|
403
|
+
# A request object representing the call parameters. Required. To specify no
|
|
404
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
|
405
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
|
406
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
|
407
|
+
#
|
|
408
|
+
# @overload get_instance(name: nil)
|
|
409
|
+
# Pass arguments to `get_instance` via keyword arguments. Note that at
|
|
410
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
|
411
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
|
412
|
+
#
|
|
413
|
+
# @param name [::String]
|
|
414
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
|
415
|
+
# @yieldparam result [::Google::Cloud::Run::V2::Instance]
|
|
416
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
|
417
|
+
#
|
|
418
|
+
# @return [::Google::Cloud::Run::V2::Instance]
|
|
419
|
+
#
|
|
420
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
|
421
|
+
#
|
|
422
|
+
# @example Basic example
|
|
423
|
+
# require "google/cloud/run/v2"
|
|
424
|
+
#
|
|
425
|
+
# # Create a client object. The client can be reused for multiple calls.
|
|
426
|
+
# client = Google::Cloud::Run::V2::Instances::Rest::Client.new
|
|
427
|
+
#
|
|
428
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
|
429
|
+
# request = Google::Cloud::Run::V2::GetInstanceRequest.new
|
|
430
|
+
#
|
|
431
|
+
# # Call the get_instance method.
|
|
432
|
+
# result = client.get_instance request
|
|
433
|
+
#
|
|
434
|
+
# # The returned object is of type Google::Cloud::Run::V2::Instance.
|
|
435
|
+
# p result
|
|
436
|
+
#
|
|
437
|
+
def get_instance request, options = nil
|
|
438
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
|
439
|
+
|
|
440
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Run::V2::GetInstanceRequest
|
|
441
|
+
|
|
442
|
+
# Converts hash and nil to an options object
|
|
443
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
|
444
|
+
|
|
445
|
+
# Customize the options with defaults
|
|
446
|
+
call_metadata = @config.rpcs.get_instance.metadata.to_h
|
|
447
|
+
|
|
448
|
+
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
|
|
449
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
|
450
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
|
451
|
+
gapic_version: ::Google::Cloud::Run::V2::VERSION,
|
|
452
|
+
transports_version_send: [:rest]
|
|
453
|
+
|
|
454
|
+
call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
|
|
455
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
|
456
|
+
|
|
457
|
+
options.apply_defaults timeout: @config.rpcs.get_instance.timeout,
|
|
458
|
+
metadata: call_metadata,
|
|
459
|
+
retry_policy: @config.rpcs.get_instance.retry_policy
|
|
460
|
+
|
|
461
|
+
options.apply_defaults timeout: @config.timeout,
|
|
462
|
+
metadata: @config.metadata,
|
|
463
|
+
retry_policy: @config.retry_policy
|
|
464
|
+
|
|
465
|
+
@instances_stub.get_instance request, options do |result, operation|
|
|
466
|
+
yield result, operation if block_given?
|
|
467
|
+
end
|
|
468
|
+
rescue ::Gapic::Rest::Error => e
|
|
469
|
+
raise ::Google::Cloud::Error.from_error(e)
|
|
470
|
+
end
|
|
471
|
+
|
|
472
|
+
##
|
|
473
|
+
# Lists Instances. Results are sorted by creation time, descending.
|
|
474
|
+
#
|
|
475
|
+
# @overload list_instances(request, options = nil)
|
|
476
|
+
# Pass arguments to `list_instances` via a request object, either of type
|
|
477
|
+
# {::Google::Cloud::Run::V2::ListInstancesRequest} or an equivalent Hash.
|
|
478
|
+
#
|
|
479
|
+
# @param request [::Google::Cloud::Run::V2::ListInstancesRequest, ::Hash]
|
|
480
|
+
# A request object representing the call parameters. Required. To specify no
|
|
481
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
|
482
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
|
483
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
|
484
|
+
#
|
|
485
|
+
# @overload list_instances(parent: nil, page_size: nil, page_token: nil, show_deleted: nil)
|
|
486
|
+
# Pass arguments to `list_instances` via keyword arguments. Note that at
|
|
487
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
|
488
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
|
489
|
+
#
|
|
490
|
+
# @param parent [::String]
|
|
491
|
+
# Required. The location and project to list resources on.
|
|
492
|
+
# Format: projects/\\{project}/locations/\\{location}, where \\{project} can be
|
|
493
|
+
# project id or number.
|
|
494
|
+
# @param page_size [::Integer]
|
|
495
|
+
# Optional. Maximum number of Instances to return in this call.
|
|
496
|
+
# @param page_token [::String]
|
|
497
|
+
# Optional. A page token received from a previous call to ListInstances.
|
|
498
|
+
# All other parameters must match.
|
|
499
|
+
# @param show_deleted [::Boolean]
|
|
500
|
+
# Optional. If true, returns deleted (but unexpired) resources along with
|
|
501
|
+
# active ones.
|
|
502
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
|
503
|
+
# @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Run::V2::Instance>]
|
|
504
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
|
505
|
+
#
|
|
506
|
+
# @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Run::V2::Instance>]
|
|
507
|
+
#
|
|
508
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
|
509
|
+
#
|
|
510
|
+
# @example Basic example
|
|
511
|
+
# require "google/cloud/run/v2"
|
|
512
|
+
#
|
|
513
|
+
# # Create a client object. The client can be reused for multiple calls.
|
|
514
|
+
# client = Google::Cloud::Run::V2::Instances::Rest::Client.new
|
|
515
|
+
#
|
|
516
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
|
517
|
+
# request = Google::Cloud::Run::V2::ListInstancesRequest.new
|
|
518
|
+
#
|
|
519
|
+
# # Call the list_instances method.
|
|
520
|
+
# result = client.list_instances request
|
|
521
|
+
#
|
|
522
|
+
# # The returned object is of type Gapic::PagedEnumerable. You can iterate
|
|
523
|
+
# # over elements, and API calls will be issued to fetch pages as needed.
|
|
524
|
+
# result.each do |item|
|
|
525
|
+
# # Each element is of type ::Google::Cloud::Run::V2::Instance.
|
|
526
|
+
# p item
|
|
527
|
+
# end
|
|
528
|
+
#
|
|
529
|
+
def list_instances request, options = nil
|
|
530
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
|
531
|
+
|
|
532
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Run::V2::ListInstancesRequest
|
|
533
|
+
|
|
534
|
+
# Converts hash and nil to an options object
|
|
535
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
|
536
|
+
|
|
537
|
+
# Customize the options with defaults
|
|
538
|
+
call_metadata = @config.rpcs.list_instances.metadata.to_h
|
|
539
|
+
|
|
540
|
+
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
|
|
541
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
|
542
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
|
543
|
+
gapic_version: ::Google::Cloud::Run::V2::VERSION,
|
|
544
|
+
transports_version_send: [:rest]
|
|
545
|
+
|
|
546
|
+
call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
|
|
547
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
|
548
|
+
|
|
549
|
+
options.apply_defaults timeout: @config.rpcs.list_instances.timeout,
|
|
550
|
+
metadata: call_metadata,
|
|
551
|
+
retry_policy: @config.rpcs.list_instances.retry_policy
|
|
552
|
+
|
|
553
|
+
options.apply_defaults timeout: @config.timeout,
|
|
554
|
+
metadata: @config.metadata,
|
|
555
|
+
retry_policy: @config.retry_policy
|
|
556
|
+
|
|
557
|
+
@instances_stub.list_instances request, options do |result, operation|
|
|
558
|
+
result = ::Gapic::Rest::PagedEnumerable.new @instances_stub, :list_instances, "instances", request, result, options
|
|
559
|
+
yield result, operation if block_given?
|
|
560
|
+
throw :response, result
|
|
561
|
+
end
|
|
562
|
+
rescue ::Gapic::Rest::Error => e
|
|
563
|
+
raise ::Google::Cloud::Error.from_error(e)
|
|
564
|
+
end
|
|
565
|
+
|
|
566
|
+
##
|
|
567
|
+
# Stops an Instance.
|
|
568
|
+
#
|
|
569
|
+
# @overload stop_instance(request, options = nil)
|
|
570
|
+
# Pass arguments to `stop_instance` via a request object, either of type
|
|
571
|
+
# {::Google::Cloud::Run::V2::StopInstanceRequest} or an equivalent Hash.
|
|
572
|
+
#
|
|
573
|
+
# @param request [::Google::Cloud::Run::V2::StopInstanceRequest, ::Hash]
|
|
574
|
+
# A request object representing the call parameters. Required. To specify no
|
|
575
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
|
576
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
|
577
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
|
578
|
+
#
|
|
579
|
+
# @overload stop_instance(name: nil, validate_only: nil, etag: nil)
|
|
580
|
+
# Pass arguments to `stop_instance` via keyword arguments. Note that at
|
|
581
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
|
582
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
|
583
|
+
#
|
|
584
|
+
# @param name [::String]
|
|
585
|
+
# Required. The name of the Instance to stop.
|
|
586
|
+
# Format:
|
|
587
|
+
# `projects/{project}/locations/{location}/instances/{instance}`,
|
|
588
|
+
# where `{project}` can be project id or number.
|
|
589
|
+
# @param validate_only [::Boolean]
|
|
590
|
+
# Optional. Indicates that the request should be validated without actually
|
|
591
|
+
# stopping any resources.
|
|
592
|
+
# @param etag [::String]
|
|
593
|
+
# Optional. A system-generated fingerprint for this version of the resource.
|
|
594
|
+
# This may be used to detect modification conflict during updates.
|
|
595
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
|
596
|
+
# @yieldparam result [::Gapic::Operation]
|
|
597
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
|
598
|
+
#
|
|
599
|
+
# @return [::Gapic::Operation]
|
|
600
|
+
#
|
|
601
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
|
602
|
+
#
|
|
603
|
+
# @example Basic example
|
|
604
|
+
# require "google/cloud/run/v2"
|
|
605
|
+
#
|
|
606
|
+
# # Create a client object. The client can be reused for multiple calls.
|
|
607
|
+
# client = Google::Cloud::Run::V2::Instances::Rest::Client.new
|
|
608
|
+
#
|
|
609
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
|
610
|
+
# request = Google::Cloud::Run::V2::StopInstanceRequest.new
|
|
611
|
+
#
|
|
612
|
+
# # Call the stop_instance method.
|
|
613
|
+
# result = client.stop_instance request
|
|
614
|
+
#
|
|
615
|
+
# # The returned object is of type Gapic::Operation. You can use it to
|
|
616
|
+
# # check the status of an operation, cancel it, or wait for results.
|
|
617
|
+
# # Here is how to wait for a response.
|
|
618
|
+
# result.wait_until_done! timeout: 60
|
|
619
|
+
# if result.response?
|
|
620
|
+
# p result.response
|
|
621
|
+
# else
|
|
622
|
+
# puts "No response received."
|
|
623
|
+
# end
|
|
624
|
+
#
|
|
625
|
+
def stop_instance request, options = nil
|
|
626
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
|
627
|
+
|
|
628
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Run::V2::StopInstanceRequest
|
|
629
|
+
|
|
630
|
+
# Converts hash and nil to an options object
|
|
631
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
|
632
|
+
|
|
633
|
+
# Customize the options with defaults
|
|
634
|
+
call_metadata = @config.rpcs.stop_instance.metadata.to_h
|
|
635
|
+
|
|
636
|
+
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
|
|
637
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
|
638
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
|
639
|
+
gapic_version: ::Google::Cloud::Run::V2::VERSION,
|
|
640
|
+
transports_version_send: [:rest]
|
|
641
|
+
|
|
642
|
+
call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
|
|
643
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
|
644
|
+
|
|
645
|
+
options.apply_defaults timeout: @config.rpcs.stop_instance.timeout,
|
|
646
|
+
metadata: call_metadata,
|
|
647
|
+
retry_policy: @config.rpcs.stop_instance.retry_policy
|
|
648
|
+
|
|
649
|
+
options.apply_defaults timeout: @config.timeout,
|
|
650
|
+
metadata: @config.metadata,
|
|
651
|
+
retry_policy: @config.retry_policy
|
|
652
|
+
|
|
653
|
+
@instances_stub.stop_instance request, options do |result, operation|
|
|
654
|
+
result = ::Gapic::Operation.new result, @operations_client, options: options
|
|
655
|
+
yield result, operation if block_given?
|
|
656
|
+
throw :response, result
|
|
657
|
+
end
|
|
658
|
+
rescue ::Gapic::Rest::Error => e
|
|
659
|
+
raise ::Google::Cloud::Error.from_error(e)
|
|
660
|
+
end
|
|
661
|
+
|
|
662
|
+
##
|
|
663
|
+
# Starts an Instance.
|
|
664
|
+
#
|
|
665
|
+
# @overload start_instance(request, options = nil)
|
|
666
|
+
# Pass arguments to `start_instance` via a request object, either of type
|
|
667
|
+
# {::Google::Cloud::Run::V2::StartInstanceRequest} or an equivalent Hash.
|
|
668
|
+
#
|
|
669
|
+
# @param request [::Google::Cloud::Run::V2::StartInstanceRequest, ::Hash]
|
|
670
|
+
# A request object representing the call parameters. Required. To specify no
|
|
671
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
|
672
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
|
673
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
|
674
|
+
#
|
|
675
|
+
# @overload start_instance(name: nil, validate_only: nil, etag: nil)
|
|
676
|
+
# Pass arguments to `start_instance` via keyword arguments. Note that at
|
|
677
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
|
678
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
|
679
|
+
#
|
|
680
|
+
# @param name [::String]
|
|
681
|
+
# Required. The name of the Instance to stop.
|
|
682
|
+
# Format:
|
|
683
|
+
# `projects/{project}/locations/{location}/instances/{instance}`,
|
|
684
|
+
# where `{project}` can be project id or number.
|
|
685
|
+
# @param validate_only [::Boolean]
|
|
686
|
+
# Optional. Indicates that the request should be validated without actually
|
|
687
|
+
# stopping any resources.
|
|
688
|
+
# @param etag [::String]
|
|
689
|
+
# Optional. A system-generated fingerprint for this version of the resource.
|
|
690
|
+
# This may be used to detect modification conflict during updates.
|
|
691
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
|
692
|
+
# @yieldparam result [::Gapic::Operation]
|
|
693
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
|
694
|
+
#
|
|
695
|
+
# @return [::Gapic::Operation]
|
|
696
|
+
#
|
|
697
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
|
698
|
+
#
|
|
699
|
+
# @example Basic example
|
|
700
|
+
# require "google/cloud/run/v2"
|
|
701
|
+
#
|
|
702
|
+
# # Create a client object. The client can be reused for multiple calls.
|
|
703
|
+
# client = Google::Cloud::Run::V2::Instances::Rest::Client.new
|
|
704
|
+
#
|
|
705
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
|
706
|
+
# request = Google::Cloud::Run::V2::StartInstanceRequest.new
|
|
707
|
+
#
|
|
708
|
+
# # Call the start_instance method.
|
|
709
|
+
# result = client.start_instance request
|
|
710
|
+
#
|
|
711
|
+
# # The returned object is of type Gapic::Operation. You can use it to
|
|
712
|
+
# # check the status of an operation, cancel it, or wait for results.
|
|
713
|
+
# # Here is how to wait for a response.
|
|
714
|
+
# result.wait_until_done! timeout: 60
|
|
715
|
+
# if result.response?
|
|
716
|
+
# p result.response
|
|
717
|
+
# else
|
|
718
|
+
# puts "No response received."
|
|
719
|
+
# end
|
|
720
|
+
#
|
|
721
|
+
def start_instance request, options = nil
|
|
722
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
|
723
|
+
|
|
724
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Run::V2::StartInstanceRequest
|
|
725
|
+
|
|
726
|
+
# Converts hash and nil to an options object
|
|
727
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
|
728
|
+
|
|
729
|
+
# Customize the options with defaults
|
|
730
|
+
call_metadata = @config.rpcs.start_instance.metadata.to_h
|
|
731
|
+
|
|
732
|
+
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
|
|
733
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
|
734
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
|
735
|
+
gapic_version: ::Google::Cloud::Run::V2::VERSION,
|
|
736
|
+
transports_version_send: [:rest]
|
|
737
|
+
|
|
738
|
+
call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
|
|
739
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
|
740
|
+
|
|
741
|
+
options.apply_defaults timeout: @config.rpcs.start_instance.timeout,
|
|
742
|
+
metadata: call_metadata,
|
|
743
|
+
retry_policy: @config.rpcs.start_instance.retry_policy
|
|
744
|
+
|
|
745
|
+
options.apply_defaults timeout: @config.timeout,
|
|
746
|
+
metadata: @config.metadata,
|
|
747
|
+
retry_policy: @config.retry_policy
|
|
748
|
+
|
|
749
|
+
@instances_stub.start_instance request, options do |result, operation|
|
|
750
|
+
result = ::Gapic::Operation.new result, @operations_client, options: options
|
|
751
|
+
yield result, operation if block_given?
|
|
752
|
+
throw :response, result
|
|
753
|
+
end
|
|
754
|
+
rescue ::Gapic::Rest::Error => e
|
|
755
|
+
raise ::Google::Cloud::Error.from_error(e)
|
|
756
|
+
end
|
|
757
|
+
|
|
758
|
+
##
|
|
759
|
+
# Configuration class for the Instances REST API.
|
|
760
|
+
#
|
|
761
|
+
# This class represents the configuration for Instances REST,
|
|
762
|
+
# providing control over timeouts, retry behavior, logging, transport
|
|
763
|
+
# parameters, and other low-level controls. Certain parameters can also be
|
|
764
|
+
# applied individually to specific RPCs. See
|
|
765
|
+
# {::Google::Cloud::Run::V2::Instances::Rest::Client::Configuration::Rpcs}
|
|
766
|
+
# for a list of RPCs that can be configured independently.
|
|
767
|
+
#
|
|
768
|
+
# Configuration can be applied globally to all clients, or to a single client
|
|
769
|
+
# on construction.
|
|
770
|
+
#
|
|
771
|
+
# @example
|
|
772
|
+
#
|
|
773
|
+
# # Modify the global config, setting the timeout for
|
|
774
|
+
# # create_instance to 20 seconds,
|
|
775
|
+
# # and all remaining timeouts to 10 seconds.
|
|
776
|
+
# ::Google::Cloud::Run::V2::Instances::Rest::Client.configure do |config|
|
|
777
|
+
# config.timeout = 10.0
|
|
778
|
+
# config.rpcs.create_instance.timeout = 20.0
|
|
779
|
+
# end
|
|
780
|
+
#
|
|
781
|
+
# # Apply the above configuration only to a new client.
|
|
782
|
+
# client = ::Google::Cloud::Run::V2::Instances::Rest::Client.new do |config|
|
|
783
|
+
# config.timeout = 10.0
|
|
784
|
+
# config.rpcs.create_instance.timeout = 20.0
|
|
785
|
+
# end
|
|
786
|
+
#
|
|
787
|
+
# @!attribute [rw] endpoint
|
|
788
|
+
# A custom service endpoint, as a hostname or hostname:port. The default is
|
|
789
|
+
# nil, indicating to use the default endpoint in the current universe domain.
|
|
790
|
+
# @return [::String,nil]
|
|
791
|
+
# @!attribute [rw] credentials
|
|
792
|
+
# Credentials to send with calls. You may provide any of the following types:
|
|
793
|
+
# * (`String`) The path to a service account key file in JSON format
|
|
794
|
+
# * (`Hash`) A service account key as a Hash
|
|
795
|
+
# * (`Google::Auth::Credentials`) A googleauth credentials object
|
|
796
|
+
# (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
|
|
797
|
+
# * (`Signet::OAuth2::Client`) A signet oauth2 client object
|
|
798
|
+
# (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
|
|
799
|
+
# * (`nil`) indicating no credentials
|
|
800
|
+
#
|
|
801
|
+
# Warning: If you accept a credential configuration (JSON file or Hash) from an
|
|
802
|
+
# external source for authentication to Google Cloud, you must validate it before
|
|
803
|
+
# providing it to a Google API client library. Providing an unvalidated credential
|
|
804
|
+
# configuration to Google APIs can compromise the security of your systems and data.
|
|
805
|
+
# For more information, refer to [Validate credential configurations from external
|
|
806
|
+
# sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials).
|
|
807
|
+
# @return [::Object]
|
|
808
|
+
# @!attribute [rw] scope
|
|
809
|
+
# The OAuth scopes
|
|
810
|
+
# @return [::Array<::String>]
|
|
811
|
+
# @!attribute [rw] lib_name
|
|
812
|
+
# The library name as recorded in instrumentation and logging
|
|
813
|
+
# @return [::String]
|
|
814
|
+
# @!attribute [rw] lib_version
|
|
815
|
+
# The library version as recorded in instrumentation and logging
|
|
816
|
+
# @return [::String]
|
|
817
|
+
# @!attribute [rw] timeout
|
|
818
|
+
# The call timeout in seconds.
|
|
819
|
+
# @return [::Numeric]
|
|
820
|
+
# @!attribute [rw] metadata
|
|
821
|
+
# Additional headers to be sent with the call.
|
|
822
|
+
# @return [::Hash{::Symbol=>::String}]
|
|
823
|
+
# @!attribute [rw] retry_policy
|
|
824
|
+
# The retry policy. The value is a hash with the following keys:
|
|
825
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
|
826
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
|
827
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
|
828
|
+
# * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0.
|
|
829
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
|
830
|
+
# trigger a retry.
|
|
831
|
+
# @return [::Hash]
|
|
832
|
+
# @!attribute [rw] quota_project
|
|
833
|
+
# A separate project against which to charge quota.
|
|
834
|
+
# @return [::String]
|
|
835
|
+
# @!attribute [rw] universe_domain
|
|
836
|
+
# The universe domain within which to make requests. This determines the
|
|
837
|
+
# default endpoint URL. The default value of nil uses the environment
|
|
838
|
+
# universe (usually the default "googleapis.com" universe).
|
|
839
|
+
# @return [::String,nil]
|
|
840
|
+
# @!attribute [rw] logger
|
|
841
|
+
# A custom logger to use for request/response debug logging, or the value
|
|
842
|
+
# `:default` (the default) to construct a default logger, or `nil` to
|
|
843
|
+
# explicitly disable logging.
|
|
844
|
+
# @return [::Logger,:default,nil]
|
|
845
|
+
#
|
|
846
|
+
class Configuration
|
|
847
|
+
extend ::Gapic::Config
|
|
848
|
+
|
|
849
|
+
# @private
|
|
850
|
+
# The endpoint specific to the default "googleapis.com" universe. Deprecated.
|
|
851
|
+
DEFAULT_ENDPOINT = "run.googleapis.com"
|
|
852
|
+
|
|
853
|
+
config_attr :endpoint, nil, ::String, nil
|
|
854
|
+
config_attr :credentials, nil do |value|
|
|
855
|
+
allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Google::Auth::BaseClient, ::Signet::OAuth2::Client, nil]
|
|
856
|
+
allowed.any? { |klass| klass === value }
|
|
857
|
+
end
|
|
858
|
+
config_attr :scope, nil, ::String, ::Array, nil
|
|
859
|
+
config_attr :lib_name, nil, ::String, nil
|
|
860
|
+
config_attr :lib_version, nil, ::String, nil
|
|
861
|
+
config_attr :timeout, nil, ::Numeric, nil
|
|
862
|
+
config_attr :metadata, nil, ::Hash, nil
|
|
863
|
+
config_attr :retry_policy, nil, ::Hash, ::Proc, nil
|
|
864
|
+
config_attr :quota_project, nil, ::String, nil
|
|
865
|
+
config_attr :universe_domain, nil, ::String, nil
|
|
866
|
+
config_attr :logger, :default, ::Logger, nil, :default
|
|
867
|
+
|
|
868
|
+
# @private
|
|
869
|
+
def initialize parent_config = nil
|
|
870
|
+
@parent_config = parent_config unless parent_config.nil?
|
|
871
|
+
|
|
872
|
+
yield self if block_given?
|
|
873
|
+
end
|
|
874
|
+
|
|
875
|
+
##
|
|
876
|
+
# Configurations for individual RPCs
|
|
877
|
+
# @return [Rpcs]
|
|
878
|
+
#
|
|
879
|
+
def rpcs
|
|
880
|
+
@rpcs ||= begin
|
|
881
|
+
parent_rpcs = nil
|
|
882
|
+
parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
|
|
883
|
+
Rpcs.new parent_rpcs
|
|
884
|
+
end
|
|
885
|
+
end
|
|
886
|
+
|
|
887
|
+
##
|
|
888
|
+
# Configuration RPC class for the Instances API.
|
|
889
|
+
#
|
|
890
|
+
# Includes fields providing the configuration for each RPC in this service.
|
|
891
|
+
# Each configuration object is of type `Gapic::Config::Method` and includes
|
|
892
|
+
# the following configuration fields:
|
|
893
|
+
#
|
|
894
|
+
# * `timeout` (*type:* `Numeric`) - The call timeout in seconds
|
|
895
|
+
# * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers
|
|
896
|
+
# * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
|
|
897
|
+
# include the following keys:
|
|
898
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
|
899
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
|
900
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
|
901
|
+
# * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0.
|
|
902
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
|
903
|
+
# trigger a retry.
|
|
904
|
+
#
|
|
905
|
+
class Rpcs
|
|
906
|
+
##
|
|
907
|
+
# RPC-specific configuration for `create_instance`
|
|
908
|
+
# @return [::Gapic::Config::Method]
|
|
909
|
+
#
|
|
910
|
+
attr_reader :create_instance
|
|
911
|
+
##
|
|
912
|
+
# RPC-specific configuration for `delete_instance`
|
|
913
|
+
# @return [::Gapic::Config::Method]
|
|
914
|
+
#
|
|
915
|
+
attr_reader :delete_instance
|
|
916
|
+
##
|
|
917
|
+
# RPC-specific configuration for `get_instance`
|
|
918
|
+
# @return [::Gapic::Config::Method]
|
|
919
|
+
#
|
|
920
|
+
attr_reader :get_instance
|
|
921
|
+
##
|
|
922
|
+
# RPC-specific configuration for `list_instances`
|
|
923
|
+
# @return [::Gapic::Config::Method]
|
|
924
|
+
#
|
|
925
|
+
attr_reader :list_instances
|
|
926
|
+
##
|
|
927
|
+
# RPC-specific configuration for `stop_instance`
|
|
928
|
+
# @return [::Gapic::Config::Method]
|
|
929
|
+
#
|
|
930
|
+
attr_reader :stop_instance
|
|
931
|
+
##
|
|
932
|
+
# RPC-specific configuration for `start_instance`
|
|
933
|
+
# @return [::Gapic::Config::Method]
|
|
934
|
+
#
|
|
935
|
+
attr_reader :start_instance
|
|
936
|
+
|
|
937
|
+
# @private
|
|
938
|
+
def initialize parent_rpcs = nil
|
|
939
|
+
create_instance_config = parent_rpcs.create_instance if parent_rpcs.respond_to? :create_instance
|
|
940
|
+
@create_instance = ::Gapic::Config::Method.new create_instance_config
|
|
941
|
+
delete_instance_config = parent_rpcs.delete_instance if parent_rpcs.respond_to? :delete_instance
|
|
942
|
+
@delete_instance = ::Gapic::Config::Method.new delete_instance_config
|
|
943
|
+
get_instance_config = parent_rpcs.get_instance if parent_rpcs.respond_to? :get_instance
|
|
944
|
+
@get_instance = ::Gapic::Config::Method.new get_instance_config
|
|
945
|
+
list_instances_config = parent_rpcs.list_instances if parent_rpcs.respond_to? :list_instances
|
|
946
|
+
@list_instances = ::Gapic::Config::Method.new list_instances_config
|
|
947
|
+
stop_instance_config = parent_rpcs.stop_instance if parent_rpcs.respond_to? :stop_instance
|
|
948
|
+
@stop_instance = ::Gapic::Config::Method.new stop_instance_config
|
|
949
|
+
start_instance_config = parent_rpcs.start_instance if parent_rpcs.respond_to? :start_instance
|
|
950
|
+
@start_instance = ::Gapic::Config::Method.new start_instance_config
|
|
951
|
+
|
|
952
|
+
yield self if block_given?
|
|
953
|
+
end
|
|
954
|
+
end
|
|
955
|
+
end
|
|
956
|
+
end
|
|
957
|
+
end
|
|
958
|
+
end
|
|
959
|
+
end
|
|
960
|
+
end
|
|
961
|
+
end
|
|
962
|
+
end
|