google-cloud-app_engine-v1 0.5.0 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/AUTHENTICATION.md +1 -1
- data/README.md +2 -2
- data/lib/google/appengine/v1/appengine_pb.rb +0 -1
- data/lib/google/cloud/app_engine/v1/applications/client.rb +12 -12
- data/lib/google/cloud/app_engine/v1/applications/operations.rb +12 -14
- data/lib/google/cloud/app_engine/v1/applications/rest/client.rb +589 -0
- data/lib/google/cloud/app_engine/v1/applications/rest/operations.rb +793 -0
- data/lib/google/cloud/app_engine/v1/applications/rest/service_stub.rb +285 -0
- data/lib/google/cloud/app_engine/v1/applications/rest.rb +52 -0
- data/lib/google/cloud/app_engine/v1/applications.rb +7 -1
- data/lib/google/cloud/app_engine/v1/authorized_certificates/client.rb +4 -6
- data/lib/google/cloud/app_engine/v1/authorized_certificates/rest/client.rb +643 -0
- data/lib/google/cloud/app_engine/v1/authorized_certificates/rest/service_stub.rb +345 -0
- data/lib/google/cloud/app_engine/v1/authorized_certificates/rest.rb +52 -0
- data/lib/google/cloud/app_engine/v1/authorized_certificates.rb +7 -1
- data/lib/google/cloud/app_engine/v1/authorized_domains/client.rb +4 -6
- data/lib/google/cloud/app_engine/v1/authorized_domains/rest/client.rb +349 -0
- data/lib/google/cloud/app_engine/v1/authorized_domains/rest/service_stub.rb +107 -0
- data/lib/google/cloud/app_engine/v1/authorized_domains/rest.rb +53 -0
- data/lib/google/cloud/app_engine/v1/authorized_domains.rb +7 -1
- data/lib/google/cloud/app_engine/v1/domain_mappings/client.rb +16 -18
- data/lib/google/cloud/app_engine/v1/domain_mappings/operations.rb +12 -14
- data/lib/google/cloud/app_engine/v1/domain_mappings/rest/client.rb +659 -0
- data/lib/google/cloud/app_engine/v1/domain_mappings/rest/operations.rb +793 -0
- data/lib/google/cloud/app_engine/v1/domain_mappings/rest/service_stub.rb +345 -0
- data/lib/google/cloud/app_engine/v1/domain_mappings/rest.rb +52 -0
- data/lib/google/cloud/app_engine/v1/domain_mappings.rb +7 -1
- data/lib/google/cloud/app_engine/v1/firewall/client.rb +4 -6
- data/lib/google/cloud/app_engine/v1/firewall/rest/client.rb +732 -0
- data/lib/google/cloud/app_engine/v1/firewall/rest/service_stub.rb +405 -0
- data/lib/google/cloud/app_engine/v1/firewall/rest.rb +60 -0
- data/lib/google/cloud/app_engine/v1/firewall.rb +7 -1
- data/lib/google/cloud/app_engine/v1/instances/client.rb +12 -14
- data/lib/google/cloud/app_engine/v1/instances/operations.rb +12 -14
- data/lib/google/cloud/app_engine/v1/instances/rest/client.rb +602 -0
- data/lib/google/cloud/app_engine/v1/instances/rest/operations.rb +793 -0
- data/lib/google/cloud/app_engine/v1/instances/rest/service_stub.rb +285 -0
- data/lib/google/cloud/app_engine/v1/instances/rest.rb +52 -0
- data/lib/google/cloud/app_engine/v1/instances.rb +7 -1
- data/lib/google/cloud/app_engine/v1/rest.rb +44 -0
- data/lib/google/cloud/app_engine/v1/services/client.rb +12 -14
- data/lib/google/cloud/app_engine/v1/services/operations.rb +12 -14
- data/lib/google/cloud/app_engine/v1/services/rest/client.rb +587 -0
- data/lib/google/cloud/app_engine/v1/services/rest/operations.rb +793 -0
- data/lib/google/cloud/app_engine/v1/services/rest/service_stub.rb +285 -0
- data/lib/google/cloud/app_engine/v1/services/rest.rb +52 -0
- data/lib/google/cloud/app_engine/v1/services.rb +7 -1
- data/lib/google/cloud/app_engine/v1/version.rb +1 -1
- data/lib/google/cloud/app_engine/v1/versions/client.rb +16 -18
- data/lib/google/cloud/app_engine/v1/versions/operations.rb +12 -14
- data/lib/google/cloud/app_engine/v1/versions/rest/client.rb +692 -0
- data/lib/google/cloud/app_engine/v1/versions/rest/operations.rb +793 -0
- data/lib/google/cloud/app_engine/v1/versions/rest/service_stub.rb +345 -0
- data/lib/google/cloud/app_engine/v1/versions/rest.rb +52 -0
- data/lib/google/cloud/app_engine/v1/versions.rb +7 -1
- data/lib/google/cloud/app_engine/v1.rb +7 -2
- data/proto_docs/google/api/client.rb +318 -0
- data/proto_docs/google/api/launch_stage.rb +71 -0
- data/proto_docs/google/protobuf/empty.rb +0 -2
- data/proto_docs/google/rpc/status.rb +4 -2
- metadata +40 -8
@@ -0,0 +1,602 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2023 Google LLC
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
# you may not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# https://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
16
|
+
|
17
|
+
# Auto-generated by gapic-generator-ruby. DO NOT EDIT!
|
18
|
+
|
19
|
+
require "google/cloud/errors"
|
20
|
+
require "google/appengine/v1/appengine_pb"
|
21
|
+
require "google/cloud/app_engine/v1/instances/rest/service_stub"
|
22
|
+
|
23
|
+
module Google
|
24
|
+
module Cloud
|
25
|
+
module AppEngine
|
26
|
+
module V1
|
27
|
+
module Instances
|
28
|
+
module Rest
|
29
|
+
##
|
30
|
+
# REST client for the Instances service.
|
31
|
+
#
|
32
|
+
# Manages instances of a version.
|
33
|
+
#
|
34
|
+
class Client
|
35
|
+
# @private
|
36
|
+
attr_reader :instances_stub
|
37
|
+
|
38
|
+
##
|
39
|
+
# Configure the Instances Client class.
|
40
|
+
#
|
41
|
+
# See {::Google::Cloud::AppEngine::V1::Instances::Rest::Client::Configuration}
|
42
|
+
# for a description of the configuration fields.
|
43
|
+
#
|
44
|
+
# @example
|
45
|
+
#
|
46
|
+
# # Modify the configuration for all Instances clients
|
47
|
+
# ::Google::Cloud::AppEngine::V1::Instances::Rest::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", "AppEngine", "V1"]
|
59
|
+
parent_config = while namespace.any?
|
60
|
+
parent_name = namespace.join "::"
|
61
|
+
parent_const = const_get parent_name
|
62
|
+
break parent_const.configure if parent_const.respond_to? :configure
|
63
|
+
namespace.pop
|
64
|
+
end
|
65
|
+
default_config = Client::Configuration.new parent_config
|
66
|
+
|
67
|
+
default_config
|
68
|
+
end
|
69
|
+
yield @configure if block_given?
|
70
|
+
@configure
|
71
|
+
end
|
72
|
+
|
73
|
+
##
|
74
|
+
# Configure the Instances Client instance.
|
75
|
+
#
|
76
|
+
# The configuration is set to the derived mode, meaning that values can be changed,
|
77
|
+
# but structural changes (adding new fields, etc.) are not allowed. Structural changes
|
78
|
+
# should be made on {Client.configure}.
|
79
|
+
#
|
80
|
+
# See {::Google::Cloud::AppEngine::V1::Instances::Rest::Client::Configuration}
|
81
|
+
# for a description of the configuration fields.
|
82
|
+
#
|
83
|
+
# @yield [config] Configure the Client client.
|
84
|
+
# @yieldparam config [Client::Configuration]
|
85
|
+
#
|
86
|
+
# @return [Client::Configuration]
|
87
|
+
#
|
88
|
+
def configure
|
89
|
+
yield @config if block_given?
|
90
|
+
@config
|
91
|
+
end
|
92
|
+
|
93
|
+
##
|
94
|
+
# Create a new Instances REST client object.
|
95
|
+
#
|
96
|
+
# @example
|
97
|
+
#
|
98
|
+
# # Create a client using the default configuration
|
99
|
+
# client = ::Google::Cloud::AppEngine::V1::Instances::Rest::Client.new
|
100
|
+
#
|
101
|
+
# # Create a client using a custom configuration
|
102
|
+
# client = ::Google::Cloud::AppEngine::V1::Instances::Rest::Client.new do |config|
|
103
|
+
# config.timeout = 10.0
|
104
|
+
# end
|
105
|
+
#
|
106
|
+
# @yield [config] Configure the Instances client.
|
107
|
+
# @yieldparam config [Client::Configuration]
|
108
|
+
#
|
109
|
+
def initialize
|
110
|
+
# Create the configuration object
|
111
|
+
@config = Configuration.new Client.configure
|
112
|
+
|
113
|
+
# Yield the configuration if needed
|
114
|
+
yield @config if block_given?
|
115
|
+
|
116
|
+
# Create credentials
|
117
|
+
credentials = @config.credentials
|
118
|
+
# Use self-signed JWT if the endpoint is unchanged from default,
|
119
|
+
# but only if the default endpoint does not have a region prefix.
|
120
|
+
enable_self_signed_jwt = @config.endpoint == Client.configure.endpoint &&
|
121
|
+
!@config.endpoint.split(".").first.include?("-")
|
122
|
+
credentials ||= Credentials.default scope: @config.scope,
|
123
|
+
enable_self_signed_jwt: enable_self_signed_jwt
|
124
|
+
if credentials.is_a?(::String) || credentials.is_a?(::Hash)
|
125
|
+
credentials = Credentials.new credentials, scope: @config.scope
|
126
|
+
end
|
127
|
+
|
128
|
+
@quota_project_id = @config.quota_project
|
129
|
+
@quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
|
130
|
+
|
131
|
+
@operations_client = ::Google::Cloud::AppEngine::V1::Instances::Rest::Operations.new do |config|
|
132
|
+
config.credentials = credentials
|
133
|
+
config.quota_project = @quota_project_id
|
134
|
+
config.endpoint = @config.endpoint
|
135
|
+
end
|
136
|
+
|
137
|
+
@instances_stub = ::Google::Cloud::AppEngine::V1::Instances::Rest::ServiceStub.new endpoint: @config.endpoint, credentials: credentials
|
138
|
+
end
|
139
|
+
|
140
|
+
##
|
141
|
+
# Get the associated client for long-running operations.
|
142
|
+
#
|
143
|
+
# @return [::Google::Cloud::AppEngine::V1::Instances::Rest::Operations]
|
144
|
+
#
|
145
|
+
attr_reader :operations_client
|
146
|
+
|
147
|
+
# Service calls
|
148
|
+
|
149
|
+
##
|
150
|
+
# Lists the instances of a version.
|
151
|
+
#
|
152
|
+
# Tip: To aggregate details about instances over time, see the
|
153
|
+
# [Stackdriver Monitoring API](https://cloud.google.com/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list).
|
154
|
+
#
|
155
|
+
# @overload list_instances(request, options = nil)
|
156
|
+
# Pass arguments to `list_instances` via a request object, either of type
|
157
|
+
# {::Google::Cloud::AppEngine::V1::ListInstancesRequest} or an equivalent Hash.
|
158
|
+
#
|
159
|
+
# @param request [::Google::Cloud::AppEngine::V1::ListInstancesRequest, ::Hash]
|
160
|
+
# A request object representing the call parameters. Required. To specify no
|
161
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
162
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
163
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
164
|
+
#
|
165
|
+
# @overload list_instances(parent: nil, page_size: nil, page_token: nil)
|
166
|
+
# Pass arguments to `list_instances` via keyword arguments. Note that at
|
167
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
168
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
169
|
+
#
|
170
|
+
# @param parent [::String]
|
171
|
+
# Name of the parent Version resource. Example:
|
172
|
+
# `apps/myapp/services/default/versions/v1`.
|
173
|
+
# @param page_size [::Integer]
|
174
|
+
# Maximum results to return per page.
|
175
|
+
# @param page_token [::String]
|
176
|
+
# Continuation token for fetching the next page of results.
|
177
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
178
|
+
# @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Cloud::AppEngine::V1::Instance>]
|
179
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
180
|
+
#
|
181
|
+
# @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::AppEngine::V1::Instance>]
|
182
|
+
#
|
183
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
184
|
+
def list_instances request, options = nil
|
185
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
186
|
+
|
187
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::AppEngine::V1::ListInstancesRequest
|
188
|
+
|
189
|
+
# Converts hash and nil to an options object
|
190
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
191
|
+
|
192
|
+
# Customize the options with defaults
|
193
|
+
call_metadata = @config.rpcs.list_instances.metadata.to_h
|
194
|
+
|
195
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
196
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
197
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
198
|
+
gapic_version: ::Google::Cloud::AppEngine::V1::VERSION,
|
199
|
+
transports_version_send: [:rest]
|
200
|
+
|
201
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
202
|
+
|
203
|
+
options.apply_defaults timeout: @config.rpcs.list_instances.timeout,
|
204
|
+
metadata: call_metadata,
|
205
|
+
retry_policy: @config.rpcs.list_instances.retry_policy
|
206
|
+
|
207
|
+
options.apply_defaults timeout: @config.timeout,
|
208
|
+
metadata: @config.metadata,
|
209
|
+
retry_policy: @config.retry_policy
|
210
|
+
|
211
|
+
@instances_stub.list_instances request, options do |result, operation|
|
212
|
+
result = ::Gapic::Rest::PagedEnumerable.new @instances_stub, :list_instances, "instances", request, result, options
|
213
|
+
yield result, operation if block_given?
|
214
|
+
return result
|
215
|
+
end
|
216
|
+
rescue ::Gapic::Rest::Error => e
|
217
|
+
raise ::Google::Cloud::Error.from_error(e)
|
218
|
+
end
|
219
|
+
|
220
|
+
##
|
221
|
+
# Gets instance information.
|
222
|
+
#
|
223
|
+
# @overload get_instance(request, options = nil)
|
224
|
+
# Pass arguments to `get_instance` via a request object, either of type
|
225
|
+
# {::Google::Cloud::AppEngine::V1::GetInstanceRequest} or an equivalent Hash.
|
226
|
+
#
|
227
|
+
# @param request [::Google::Cloud::AppEngine::V1::GetInstanceRequest, ::Hash]
|
228
|
+
# A request object representing the call parameters. Required. To specify no
|
229
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
230
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
231
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
232
|
+
#
|
233
|
+
# @overload get_instance(name: nil)
|
234
|
+
# Pass arguments to `get_instance` via keyword arguments. Note that at
|
235
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
236
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
237
|
+
#
|
238
|
+
# @param name [::String]
|
239
|
+
# Name of the resource requested. Example:
|
240
|
+
# `apps/myapp/services/default/versions/v1/instances/instance-1`.
|
241
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
242
|
+
# @yieldparam result [::Google::Cloud::AppEngine::V1::Instance]
|
243
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
244
|
+
#
|
245
|
+
# @return [::Google::Cloud::AppEngine::V1::Instance]
|
246
|
+
#
|
247
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
248
|
+
def get_instance request, options = nil
|
249
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
250
|
+
|
251
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::AppEngine::V1::GetInstanceRequest
|
252
|
+
|
253
|
+
# Converts hash and nil to an options object
|
254
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
255
|
+
|
256
|
+
# Customize the options with defaults
|
257
|
+
call_metadata = @config.rpcs.get_instance.metadata.to_h
|
258
|
+
|
259
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
260
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
261
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
262
|
+
gapic_version: ::Google::Cloud::AppEngine::V1::VERSION,
|
263
|
+
transports_version_send: [:rest]
|
264
|
+
|
265
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
266
|
+
|
267
|
+
options.apply_defaults timeout: @config.rpcs.get_instance.timeout,
|
268
|
+
metadata: call_metadata,
|
269
|
+
retry_policy: @config.rpcs.get_instance.retry_policy
|
270
|
+
|
271
|
+
options.apply_defaults timeout: @config.timeout,
|
272
|
+
metadata: @config.metadata,
|
273
|
+
retry_policy: @config.retry_policy
|
274
|
+
|
275
|
+
@instances_stub.get_instance request, options do |result, operation|
|
276
|
+
yield result, operation if block_given?
|
277
|
+
return result
|
278
|
+
end
|
279
|
+
rescue ::Gapic::Rest::Error => e
|
280
|
+
raise ::Google::Cloud::Error.from_error(e)
|
281
|
+
end
|
282
|
+
|
283
|
+
##
|
284
|
+
# Stops a running instance.
|
285
|
+
#
|
286
|
+
# The instance might be automatically recreated based on the scaling settings
|
287
|
+
# of the version. For more information, see "How Instances are Managed"
|
288
|
+
# ([standard environment](https://cloud.google.com/appengine/docs/standard/python/how-instances-are-managed) |
|
289
|
+
# [flexible environment](https://cloud.google.com/appengine/docs/flexible/python/how-instances-are-managed)).
|
290
|
+
#
|
291
|
+
# To ensure that instances are not re-created and avoid getting billed, you
|
292
|
+
# can stop all instances within the target version by changing the serving
|
293
|
+
# status of the version to `STOPPED` with the
|
294
|
+
# [`apps.services.versions.patch`](https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps.services.versions/patch)
|
295
|
+
# method.
|
296
|
+
#
|
297
|
+
# @overload delete_instance(request, options = nil)
|
298
|
+
# Pass arguments to `delete_instance` via a request object, either of type
|
299
|
+
# {::Google::Cloud::AppEngine::V1::DeleteInstanceRequest} or an equivalent Hash.
|
300
|
+
#
|
301
|
+
# @param request [::Google::Cloud::AppEngine::V1::DeleteInstanceRequest, ::Hash]
|
302
|
+
# A request object representing the call parameters. Required. To specify no
|
303
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
304
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
305
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
306
|
+
#
|
307
|
+
# @overload delete_instance(name: nil)
|
308
|
+
# Pass arguments to `delete_instance` via keyword arguments. Note that at
|
309
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
310
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
311
|
+
#
|
312
|
+
# @param name [::String]
|
313
|
+
# Name of the resource requested. Example:
|
314
|
+
# `apps/myapp/services/default/versions/v1/instances/instance-1`.
|
315
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
316
|
+
# @yieldparam result [::Gapic::Operation]
|
317
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
318
|
+
#
|
319
|
+
# @return [::Gapic::Operation]
|
320
|
+
#
|
321
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
322
|
+
def delete_instance request, options = nil
|
323
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
324
|
+
|
325
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::AppEngine::V1::DeleteInstanceRequest
|
326
|
+
|
327
|
+
# Converts hash and nil to an options object
|
328
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
329
|
+
|
330
|
+
# Customize the options with defaults
|
331
|
+
call_metadata = @config.rpcs.delete_instance.metadata.to_h
|
332
|
+
|
333
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
334
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
335
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
336
|
+
gapic_version: ::Google::Cloud::AppEngine::V1::VERSION,
|
337
|
+
transports_version_send: [:rest]
|
338
|
+
|
339
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
340
|
+
|
341
|
+
options.apply_defaults timeout: @config.rpcs.delete_instance.timeout,
|
342
|
+
metadata: call_metadata,
|
343
|
+
retry_policy: @config.rpcs.delete_instance.retry_policy
|
344
|
+
|
345
|
+
options.apply_defaults timeout: @config.timeout,
|
346
|
+
metadata: @config.metadata,
|
347
|
+
retry_policy: @config.retry_policy
|
348
|
+
|
349
|
+
@instances_stub.delete_instance request, options do |result, operation|
|
350
|
+
result = ::Gapic::Operation.new result, @operations_client, options: options
|
351
|
+
yield result, operation if block_given?
|
352
|
+
return result
|
353
|
+
end
|
354
|
+
rescue ::Gapic::Rest::Error => e
|
355
|
+
raise ::Google::Cloud::Error.from_error(e)
|
356
|
+
end
|
357
|
+
|
358
|
+
##
|
359
|
+
# Enables debugging on a VM instance. This allows you to use the SSH
|
360
|
+
# command to connect to the virtual machine where the instance lives.
|
361
|
+
# While in "debug mode", the instance continues to serve live traffic.
|
362
|
+
# You should delete the instance when you are done debugging and then
|
363
|
+
# allow the system to take over and determine if another instance
|
364
|
+
# should be started.
|
365
|
+
#
|
366
|
+
# Only applicable for instances in App Engine flexible environment.
|
367
|
+
#
|
368
|
+
# @overload debug_instance(request, options = nil)
|
369
|
+
# Pass arguments to `debug_instance` via a request object, either of type
|
370
|
+
# {::Google::Cloud::AppEngine::V1::DebugInstanceRequest} or an equivalent Hash.
|
371
|
+
#
|
372
|
+
# @param request [::Google::Cloud::AppEngine::V1::DebugInstanceRequest, ::Hash]
|
373
|
+
# A request object representing the call parameters. Required. To specify no
|
374
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
375
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
376
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
377
|
+
#
|
378
|
+
# @overload debug_instance(name: nil, ssh_key: nil)
|
379
|
+
# Pass arguments to `debug_instance` via keyword arguments. Note that at
|
380
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
381
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
382
|
+
#
|
383
|
+
# @param name [::String]
|
384
|
+
# Name of the resource requested. Example:
|
385
|
+
# `apps/myapp/services/default/versions/v1/instances/instance-1`.
|
386
|
+
# @param ssh_key [::String]
|
387
|
+
# Public SSH key to add to the instance. Examples:
|
388
|
+
#
|
389
|
+
# * `[USERNAME]:ssh-rsa [KEY_VALUE] [USERNAME]`
|
390
|
+
# * `[USERNAME]:ssh-rsa [KEY_VALUE] google-ssh {"userName":"[USERNAME]","expireOn":"[EXPIRE_TIME]"}`
|
391
|
+
#
|
392
|
+
# For more information, see
|
393
|
+
# [Adding and Removing SSH Keys](https://cloud.google.com/compute/docs/instances/adding-removing-ssh-keys).
|
394
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
395
|
+
# @yieldparam result [::Gapic::Operation]
|
396
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
397
|
+
#
|
398
|
+
# @return [::Gapic::Operation]
|
399
|
+
#
|
400
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
401
|
+
def debug_instance request, options = nil
|
402
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
403
|
+
|
404
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::AppEngine::V1::DebugInstanceRequest
|
405
|
+
|
406
|
+
# Converts hash and nil to an options object
|
407
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
408
|
+
|
409
|
+
# Customize the options with defaults
|
410
|
+
call_metadata = @config.rpcs.debug_instance.metadata.to_h
|
411
|
+
|
412
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
413
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
414
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
415
|
+
gapic_version: ::Google::Cloud::AppEngine::V1::VERSION,
|
416
|
+
transports_version_send: [:rest]
|
417
|
+
|
418
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
419
|
+
|
420
|
+
options.apply_defaults timeout: @config.rpcs.debug_instance.timeout,
|
421
|
+
metadata: call_metadata,
|
422
|
+
retry_policy: @config.rpcs.debug_instance.retry_policy
|
423
|
+
|
424
|
+
options.apply_defaults timeout: @config.timeout,
|
425
|
+
metadata: @config.metadata,
|
426
|
+
retry_policy: @config.retry_policy
|
427
|
+
|
428
|
+
@instances_stub.debug_instance request, options do |result, operation|
|
429
|
+
result = ::Gapic::Operation.new result, @operations_client, options: options
|
430
|
+
yield result, operation if block_given?
|
431
|
+
return result
|
432
|
+
end
|
433
|
+
rescue ::Gapic::Rest::Error => e
|
434
|
+
raise ::Google::Cloud::Error.from_error(e)
|
435
|
+
end
|
436
|
+
|
437
|
+
##
|
438
|
+
# Configuration class for the Instances REST API.
|
439
|
+
#
|
440
|
+
# This class represents the configuration for Instances REST,
|
441
|
+
# providing control over timeouts, retry behavior, logging, transport
|
442
|
+
# parameters, and other low-level controls. Certain parameters can also be
|
443
|
+
# applied individually to specific RPCs. See
|
444
|
+
# {::Google::Cloud::AppEngine::V1::Instances::Rest::Client::Configuration::Rpcs}
|
445
|
+
# for a list of RPCs that can be configured independently.
|
446
|
+
#
|
447
|
+
# Configuration can be applied globally to all clients, or to a single client
|
448
|
+
# on construction.
|
449
|
+
#
|
450
|
+
# @example
|
451
|
+
#
|
452
|
+
# # Modify the global config, setting the timeout for
|
453
|
+
# # list_instances to 20 seconds,
|
454
|
+
# # and all remaining timeouts to 10 seconds.
|
455
|
+
# ::Google::Cloud::AppEngine::V1::Instances::Rest::Client.configure do |config|
|
456
|
+
# config.timeout = 10.0
|
457
|
+
# config.rpcs.list_instances.timeout = 20.0
|
458
|
+
# end
|
459
|
+
#
|
460
|
+
# # Apply the above configuration only to a new client.
|
461
|
+
# client = ::Google::Cloud::AppEngine::V1::Instances::Rest::Client.new do |config|
|
462
|
+
# config.timeout = 10.0
|
463
|
+
# config.rpcs.list_instances.timeout = 20.0
|
464
|
+
# end
|
465
|
+
#
|
466
|
+
# @!attribute [rw] endpoint
|
467
|
+
# The hostname or hostname:port of the service endpoint.
|
468
|
+
# Defaults to `"appengine.googleapis.com"`.
|
469
|
+
# @return [::String]
|
470
|
+
# @!attribute [rw] credentials
|
471
|
+
# Credentials to send with calls. You may provide any of the following types:
|
472
|
+
# * (`String`) The path to a service account key file in JSON format
|
473
|
+
# * (`Hash`) A service account key as a Hash
|
474
|
+
# * (`Google::Auth::Credentials`) A googleauth credentials object
|
475
|
+
# (see the [googleauth docs](https://googleapis.dev/ruby/googleauth/latest/index.html))
|
476
|
+
# * (`Signet::OAuth2::Client`) A signet oauth2 client object
|
477
|
+
# (see the [signet docs](https://googleapis.dev/ruby/signet/latest/Signet/OAuth2/Client.html))
|
478
|
+
# * (`nil`) indicating no credentials
|
479
|
+
# @return [::Object]
|
480
|
+
# @!attribute [rw] scope
|
481
|
+
# The OAuth scopes
|
482
|
+
# @return [::Array<::String>]
|
483
|
+
# @!attribute [rw] lib_name
|
484
|
+
# The library name as recorded in instrumentation and logging
|
485
|
+
# @return [::String]
|
486
|
+
# @!attribute [rw] lib_version
|
487
|
+
# The library version as recorded in instrumentation and logging
|
488
|
+
# @return [::String]
|
489
|
+
# @!attribute [rw] timeout
|
490
|
+
# The call timeout in seconds.
|
491
|
+
# @return [::Numeric]
|
492
|
+
# @!attribute [rw] metadata
|
493
|
+
# Additional headers to be sent with the call.
|
494
|
+
# @return [::Hash{::Symbol=>::String}]
|
495
|
+
# @!attribute [rw] retry_policy
|
496
|
+
# The retry policy. The value is a hash with the following keys:
|
497
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
498
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
499
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
500
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
501
|
+
# trigger a retry.
|
502
|
+
# @return [::Hash]
|
503
|
+
# @!attribute [rw] quota_project
|
504
|
+
# A separate project against which to charge quota.
|
505
|
+
# @return [::String]
|
506
|
+
#
|
507
|
+
class Configuration
|
508
|
+
extend ::Gapic::Config
|
509
|
+
|
510
|
+
config_attr :endpoint, "appengine.googleapis.com", ::String
|
511
|
+
config_attr :credentials, nil do |value|
|
512
|
+
allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
|
513
|
+
allowed.any? { |klass| klass === value }
|
514
|
+
end
|
515
|
+
config_attr :scope, nil, ::String, ::Array, nil
|
516
|
+
config_attr :lib_name, nil, ::String, nil
|
517
|
+
config_attr :lib_version, nil, ::String, nil
|
518
|
+
config_attr :timeout, nil, ::Numeric, nil
|
519
|
+
config_attr :metadata, nil, ::Hash, nil
|
520
|
+
config_attr :retry_policy, nil, ::Hash, ::Proc, nil
|
521
|
+
config_attr :quota_project, nil, ::String, nil
|
522
|
+
|
523
|
+
# @private
|
524
|
+
def initialize parent_config = nil
|
525
|
+
@parent_config = parent_config unless parent_config.nil?
|
526
|
+
|
527
|
+
yield self if block_given?
|
528
|
+
end
|
529
|
+
|
530
|
+
##
|
531
|
+
# Configurations for individual RPCs
|
532
|
+
# @return [Rpcs]
|
533
|
+
#
|
534
|
+
def rpcs
|
535
|
+
@rpcs ||= begin
|
536
|
+
parent_rpcs = nil
|
537
|
+
parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
|
538
|
+
Rpcs.new parent_rpcs
|
539
|
+
end
|
540
|
+
end
|
541
|
+
|
542
|
+
##
|
543
|
+
# Configuration RPC class for the Instances API.
|
544
|
+
#
|
545
|
+
# Includes fields providing the configuration for each RPC in this service.
|
546
|
+
# Each configuration object is of type `Gapic::Config::Method` and includes
|
547
|
+
# the following configuration fields:
|
548
|
+
#
|
549
|
+
# * `timeout` (*type:* `Numeric`) - The call timeout in seconds
|
550
|
+
# * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers
|
551
|
+
# * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
|
552
|
+
# include the following keys:
|
553
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
554
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
555
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
556
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
557
|
+
# trigger a retry.
|
558
|
+
#
|
559
|
+
class Rpcs
|
560
|
+
##
|
561
|
+
# RPC-specific configuration for `list_instances`
|
562
|
+
# @return [::Gapic::Config::Method]
|
563
|
+
#
|
564
|
+
attr_reader :list_instances
|
565
|
+
##
|
566
|
+
# RPC-specific configuration for `get_instance`
|
567
|
+
# @return [::Gapic::Config::Method]
|
568
|
+
#
|
569
|
+
attr_reader :get_instance
|
570
|
+
##
|
571
|
+
# RPC-specific configuration for `delete_instance`
|
572
|
+
# @return [::Gapic::Config::Method]
|
573
|
+
#
|
574
|
+
attr_reader :delete_instance
|
575
|
+
##
|
576
|
+
# RPC-specific configuration for `debug_instance`
|
577
|
+
# @return [::Gapic::Config::Method]
|
578
|
+
#
|
579
|
+
attr_reader :debug_instance
|
580
|
+
|
581
|
+
# @private
|
582
|
+
def initialize parent_rpcs = nil
|
583
|
+
list_instances_config = parent_rpcs.list_instances if parent_rpcs.respond_to? :list_instances
|
584
|
+
@list_instances = ::Gapic::Config::Method.new list_instances_config
|
585
|
+
get_instance_config = parent_rpcs.get_instance if parent_rpcs.respond_to? :get_instance
|
586
|
+
@get_instance = ::Gapic::Config::Method.new get_instance_config
|
587
|
+
delete_instance_config = parent_rpcs.delete_instance if parent_rpcs.respond_to? :delete_instance
|
588
|
+
@delete_instance = ::Gapic::Config::Method.new delete_instance_config
|
589
|
+
debug_instance_config = parent_rpcs.debug_instance if parent_rpcs.respond_to? :debug_instance
|
590
|
+
@debug_instance = ::Gapic::Config::Method.new debug_instance_config
|
591
|
+
|
592
|
+
yield self if block_given?
|
593
|
+
end
|
594
|
+
end
|
595
|
+
end
|
596
|
+
end
|
597
|
+
end
|
598
|
+
end
|
599
|
+
end
|
600
|
+
end
|
601
|
+
end
|
602
|
+
end
|