google-cloud-app_engine-v1 0.1.0

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