google-cloud-alloy_db-v1 0.a → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (40) hide show
  1. checksums.yaml +4 -4
  2. data/.yardopts +12 -0
  3. data/AUTHENTICATION.md +149 -0
  4. data/README.md +144 -8
  5. data/lib/google/cloud/alloy_db/v1/alloy_db_admin/client.rb +2693 -0
  6. data/lib/google/cloud/alloy_db/v1/alloy_db_admin/credentials.rb +47 -0
  7. data/lib/google/cloud/alloy_db/v1/alloy_db_admin/operations.rb +768 -0
  8. data/lib/google/cloud/alloy_db/v1/alloy_db_admin/paths.rb +149 -0
  9. data/lib/google/cloud/alloy_db/v1/alloy_db_admin/rest/client.rb +2111 -0
  10. data/lib/google/cloud/alloy_db/v1/alloy_db_admin/rest/operations.rb +793 -0
  11. data/lib/google/cloud/alloy_db/v1/alloy_db_admin/rest/service_stub.rb +1238 -0
  12. data/lib/google/cloud/alloy_db/v1/alloy_db_admin/rest.rb +54 -0
  13. data/lib/google/cloud/alloy_db/v1/alloy_db_admin.rb +56 -0
  14. data/lib/google/cloud/alloy_db/v1/bindings_override.rb +102 -0
  15. data/lib/google/cloud/alloy_db/v1/rest.rb +38 -0
  16. data/lib/google/cloud/alloy_db/v1/version.rb +8 -3
  17. data/lib/google/cloud/alloy_db/v1.rb +45 -0
  18. data/lib/google/cloud/alloydb/v1/resources_pb.rb +312 -0
  19. data/lib/google/cloud/alloydb/v1/service_pb.rb +237 -0
  20. data/lib/google/cloud/alloydb/v1/service_services_pb.rb +97 -0
  21. data/lib/google-cloud-alloy_db-v1.rb +21 -0
  22. data/proto_docs/README.md +4 -0
  23. data/proto_docs/google/api/client.rb +324 -0
  24. data/proto_docs/google/api/field_behavior.rb +71 -0
  25. data/proto_docs/google/api/launch_stage.rb +71 -0
  26. data/proto_docs/google/api/resource.rb +222 -0
  27. data/proto_docs/google/cloud/alloydb/v1/resources.rb +985 -0
  28. data/proto_docs/google/cloud/alloydb/v1/service.rb +815 -0
  29. data/proto_docs/google/longrunning/operations.rb +164 -0
  30. data/proto_docs/google/protobuf/any.rb +141 -0
  31. data/proto_docs/google/protobuf/duration.rb +98 -0
  32. data/proto_docs/google/protobuf/empty.rb +34 -0
  33. data/proto_docs/google/protobuf/field_mask.rb +229 -0
  34. data/proto_docs/google/protobuf/timestamp.rb +129 -0
  35. data/proto_docs/google/protobuf/wrappers.rb +121 -0
  36. data/proto_docs/google/rpc/status.rb +48 -0
  37. data/proto_docs/google/type/dayofweek.rb +49 -0
  38. data/proto_docs/google/type/expr.rb +75 -0
  39. data/proto_docs/google/type/timeofday.rb +45 -0
  40. metadata +250 -12
@@ -0,0 +1,2693 @@
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/cloud/alloydb/v1/service_pb"
21
+ require "google/cloud/location"
22
+ require "google/iam/v1"
23
+
24
+ module Google
25
+ module Cloud
26
+ module AlloyDB
27
+ module V1
28
+ module AlloyDBAdmin
29
+ ##
30
+ # Client for the AlloyDBAdmin service.
31
+ #
32
+ # Service describing handlers for resources
33
+ #
34
+ class Client
35
+ include Paths
36
+
37
+ # @private
38
+ attr_reader :alloy_db_admin_stub
39
+
40
+ ##
41
+ # Configure the AlloyDBAdmin Client class.
42
+ #
43
+ # See {::Google::Cloud::AlloyDB::V1::AlloyDBAdmin::Client::Configuration}
44
+ # for a description of the configuration fields.
45
+ #
46
+ # @example
47
+ #
48
+ # # Modify the configuration for all AlloyDBAdmin clients
49
+ # ::Google::Cloud::AlloyDB::V1::AlloyDBAdmin::Client.configure do |config|
50
+ # config.timeout = 10.0
51
+ # end
52
+ #
53
+ # @yield [config] Configure the Client client.
54
+ # @yieldparam config [Client::Configuration]
55
+ #
56
+ # @return [Client::Configuration]
57
+ #
58
+ def self.configure
59
+ @configure ||= begin
60
+ namespace = ["Google", "Cloud", "AlloyDB", "V1"]
61
+ parent_config = while namespace.any?
62
+ parent_name = namespace.join "::"
63
+ parent_const = const_get parent_name
64
+ break parent_const.configure if parent_const.respond_to? :configure
65
+ namespace.pop
66
+ end
67
+ default_config = Client::Configuration.new parent_config
68
+
69
+ default_config.timeout = 60.0
70
+
71
+ default_config.rpcs.list_clusters.timeout = 60.0
72
+ default_config.rpcs.list_clusters.retry_policy = {
73
+ initial_delay: 1.0, max_delay: 60.0, multiplier: 1.3, retry_codes: [14]
74
+ }
75
+
76
+ default_config.rpcs.get_cluster.timeout = 60.0
77
+ default_config.rpcs.get_cluster.retry_policy = {
78
+ initial_delay: 1.0, max_delay: 60.0, multiplier: 1.3, retry_codes: [14]
79
+ }
80
+
81
+ default_config.rpcs.list_instances.timeout = 60.0
82
+ default_config.rpcs.list_instances.retry_policy = {
83
+ initial_delay: 1.0, max_delay: 60.0, multiplier: 1.3, retry_codes: [14]
84
+ }
85
+
86
+ default_config.rpcs.get_instance.timeout = 60.0
87
+ default_config.rpcs.get_instance.retry_policy = {
88
+ initial_delay: 1.0, max_delay: 60.0, multiplier: 1.3, retry_codes: [14]
89
+ }
90
+
91
+ default_config.rpcs.list_backups.timeout = 60.0
92
+ default_config.rpcs.list_backups.retry_policy = {
93
+ initial_delay: 1.0, max_delay: 60.0, multiplier: 1.3, retry_codes: [14]
94
+ }
95
+
96
+ default_config.rpcs.get_backup.timeout = 60.0
97
+ default_config.rpcs.get_backup.retry_policy = {
98
+ initial_delay: 1.0, max_delay: 60.0, multiplier: 1.3, retry_codes: [14]
99
+ }
100
+
101
+ default_config.rpcs.list_supported_database_flags.timeout = 60.0
102
+ default_config.rpcs.list_supported_database_flags.retry_policy = {
103
+ initial_delay: 1.0, max_delay: 60.0, multiplier: 1.3, retry_codes: [14]
104
+ }
105
+
106
+ default_config
107
+ end
108
+ yield @configure if block_given?
109
+ @configure
110
+ end
111
+
112
+ ##
113
+ # Configure the AlloyDBAdmin Client instance.
114
+ #
115
+ # The configuration is set to the derived mode, meaning that values can be changed,
116
+ # but structural changes (adding new fields, etc.) are not allowed. Structural changes
117
+ # should be made on {Client.configure}.
118
+ #
119
+ # See {::Google::Cloud::AlloyDB::V1::AlloyDBAdmin::Client::Configuration}
120
+ # for a description of the configuration fields.
121
+ #
122
+ # @yield [config] Configure the Client client.
123
+ # @yieldparam config [Client::Configuration]
124
+ #
125
+ # @return [Client::Configuration]
126
+ #
127
+ def configure
128
+ yield @config if block_given?
129
+ @config
130
+ end
131
+
132
+ ##
133
+ # Create a new AlloyDBAdmin client object.
134
+ #
135
+ # @example
136
+ #
137
+ # # Create a client using the default configuration
138
+ # client = ::Google::Cloud::AlloyDB::V1::AlloyDBAdmin::Client.new
139
+ #
140
+ # # Create a client using a custom configuration
141
+ # client = ::Google::Cloud::AlloyDB::V1::AlloyDBAdmin::Client.new do |config|
142
+ # config.timeout = 10.0
143
+ # end
144
+ #
145
+ # @yield [config] Configure the AlloyDBAdmin client.
146
+ # @yieldparam config [Client::Configuration]
147
+ #
148
+ def initialize
149
+ # These require statements are intentionally placed here to initialize
150
+ # the gRPC module only when it's required.
151
+ # See https://github.com/googleapis/toolkit/issues/446
152
+ require "gapic/grpc"
153
+ require "google/cloud/alloydb/v1/service_services_pb"
154
+
155
+ # Create the configuration object
156
+ @config = Configuration.new Client.configure
157
+
158
+ # Yield the configuration if needed
159
+ yield @config if block_given?
160
+
161
+ # Create credentials
162
+ credentials = @config.credentials
163
+ # Use self-signed JWT if the endpoint is unchanged from default,
164
+ # but only if the default endpoint does not have a region prefix.
165
+ enable_self_signed_jwt = @config.endpoint == Client.configure.endpoint &&
166
+ !@config.endpoint.split(".").first.include?("-")
167
+ credentials ||= Credentials.default scope: @config.scope,
168
+ enable_self_signed_jwt: enable_self_signed_jwt
169
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
170
+ credentials = Credentials.new credentials, scope: @config.scope
171
+ end
172
+ @quota_project_id = @config.quota_project
173
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
174
+
175
+ @operations_client = Operations.new do |config|
176
+ config.credentials = credentials
177
+ config.quota_project = @quota_project_id
178
+ config.endpoint = @config.endpoint
179
+ end
180
+
181
+ @location_client = Google::Cloud::Location::Locations::Client.new do |config|
182
+ config.credentials = credentials
183
+ config.quota_project = @quota_project_id
184
+ config.endpoint = @config.endpoint
185
+ end
186
+
187
+ @iam_policy_client = Google::Iam::V1::IAMPolicy::Client.new do |config|
188
+ config.credentials = credentials
189
+ config.quota_project = @quota_project_id
190
+ config.endpoint = @config.endpoint
191
+ end
192
+
193
+ @alloy_db_admin_stub = ::Gapic::ServiceStub.new(
194
+ ::Google::Cloud::AlloyDB::V1::AlloyDBAdmin::Stub,
195
+ credentials: credentials,
196
+ endpoint: @config.endpoint,
197
+ channel_args: @config.channel_args,
198
+ interceptors: @config.interceptors
199
+ )
200
+ end
201
+
202
+ ##
203
+ # Get the associated client for long-running operations.
204
+ #
205
+ # @return [::Google::Cloud::AlloyDB::V1::AlloyDBAdmin::Operations]
206
+ #
207
+ attr_reader :operations_client
208
+
209
+ ##
210
+ # Get the associated client for mix-in of the Locations.
211
+ #
212
+ # @return [Google::Cloud::Location::Locations::Client]
213
+ #
214
+ attr_reader :location_client
215
+
216
+ ##
217
+ # Get the associated client for mix-in of the IAMPolicy.
218
+ #
219
+ # @return [Google::Iam::V1::IAMPolicy::Client]
220
+ #
221
+ attr_reader :iam_policy_client
222
+
223
+ # Service calls
224
+
225
+ ##
226
+ # Lists Clusters in a given project and location.
227
+ #
228
+ # @overload list_clusters(request, options = nil)
229
+ # Pass arguments to `list_clusters` via a request object, either of type
230
+ # {::Google::Cloud::AlloyDB::V1::ListClustersRequest} or an equivalent Hash.
231
+ #
232
+ # @param request [::Google::Cloud::AlloyDB::V1::ListClustersRequest, ::Hash]
233
+ # A request object representing the call parameters. Required. To specify no
234
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
235
+ # @param options [::Gapic::CallOptions, ::Hash]
236
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
237
+ #
238
+ # @overload list_clusters(parent: nil, page_size: nil, page_token: nil, filter: nil, order_by: nil)
239
+ # Pass arguments to `list_clusters` via keyword arguments. Note that at
240
+ # least one keyword argument is required. To specify no parameters, or to keep all
241
+ # the default parameter values, pass an empty Hash as a request object (see above).
242
+ #
243
+ # @param parent [::String]
244
+ # Required. The name of the parent resource. For the required format, see the
245
+ # comment on the Cluster.name field. Additionally, you can perform an
246
+ # aggregated list operation by specifying a value with the following format:
247
+ # * projects/\\{project}/locations/-
248
+ # @param page_size [::Integer]
249
+ # Optional. Requested page size. Server may return fewer items than
250
+ # requested. If unspecified, server will pick an appropriate default.
251
+ # @param page_token [::String]
252
+ # A token identifying a page of results the server should return.
253
+ # @param filter [::String]
254
+ # Optional. Filtering results
255
+ # @param order_by [::String]
256
+ # Optional. Hint for how to order the results
257
+ #
258
+ # @yield [response, operation] Access the result along with the RPC operation
259
+ # @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::AlloyDB::V1::Cluster>]
260
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
261
+ #
262
+ # @return [::Gapic::PagedEnumerable<::Google::Cloud::AlloyDB::V1::Cluster>]
263
+ #
264
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
265
+ #
266
+ # @example Basic example
267
+ # require "google/cloud/alloy_db/v1"
268
+ #
269
+ # # Create a client object. The client can be reused for multiple calls.
270
+ # client = Google::Cloud::AlloyDB::V1::AlloyDBAdmin::Client.new
271
+ #
272
+ # # Create a request. To set request fields, pass in keyword arguments.
273
+ # request = Google::Cloud::AlloyDB::V1::ListClustersRequest.new
274
+ #
275
+ # # Call the list_clusters method.
276
+ # result = client.list_clusters request
277
+ #
278
+ # # The returned object is of type Gapic::PagedEnumerable. You can iterate
279
+ # # over elements, and API calls will be issued to fetch pages as needed.
280
+ # result.each do |item|
281
+ # # Each element is of type ::Google::Cloud::AlloyDB::V1::Cluster.
282
+ # p item
283
+ # end
284
+ #
285
+ def list_clusters request, options = nil
286
+ raise ::ArgumentError, "request must be provided" if request.nil?
287
+
288
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::AlloyDB::V1::ListClustersRequest
289
+
290
+ # Converts hash and nil to an options object
291
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
292
+
293
+ # Customize the options with defaults
294
+ metadata = @config.rpcs.list_clusters.metadata.to_h
295
+
296
+ # Set x-goog-api-client and x-goog-user-project headers
297
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
298
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
299
+ gapic_version: ::Google::Cloud::AlloyDB::V1::VERSION
300
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
301
+
302
+ header_params = {}
303
+ if request.parent
304
+ header_params["parent"] = request.parent
305
+ end
306
+
307
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
308
+ metadata[:"x-goog-request-params"] ||= request_params_header
309
+
310
+ options.apply_defaults timeout: @config.rpcs.list_clusters.timeout,
311
+ metadata: metadata,
312
+ retry_policy: @config.rpcs.list_clusters.retry_policy
313
+
314
+ options.apply_defaults timeout: @config.timeout,
315
+ metadata: @config.metadata,
316
+ retry_policy: @config.retry_policy
317
+
318
+ @alloy_db_admin_stub.call_rpc :list_clusters, request, options: options do |response, operation|
319
+ response = ::Gapic::PagedEnumerable.new @alloy_db_admin_stub, :list_clusters, request, response, operation, options
320
+ yield response, operation if block_given?
321
+ return response
322
+ end
323
+ rescue ::GRPC::BadStatus => e
324
+ raise ::Google::Cloud::Error.from_error(e)
325
+ end
326
+
327
+ ##
328
+ # Gets details of a single Cluster.
329
+ #
330
+ # @overload get_cluster(request, options = nil)
331
+ # Pass arguments to `get_cluster` via a request object, either of type
332
+ # {::Google::Cloud::AlloyDB::V1::GetClusterRequest} or an equivalent Hash.
333
+ #
334
+ # @param request [::Google::Cloud::AlloyDB::V1::GetClusterRequest, ::Hash]
335
+ # A request object representing the call parameters. Required. To specify no
336
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
337
+ # @param options [::Gapic::CallOptions, ::Hash]
338
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
339
+ #
340
+ # @overload get_cluster(name: nil)
341
+ # Pass arguments to `get_cluster` via keyword arguments. Note that at
342
+ # least one keyword argument is required. To specify no parameters, or to keep all
343
+ # the default parameter values, pass an empty Hash as a request object (see above).
344
+ #
345
+ # @param name [::String]
346
+ # Required. The name of the resource. For the required format, see the
347
+ # comment on the Cluster.name field.
348
+ #
349
+ # @yield [response, operation] Access the result along with the RPC operation
350
+ # @yieldparam response [::Google::Cloud::AlloyDB::V1::Cluster]
351
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
352
+ #
353
+ # @return [::Google::Cloud::AlloyDB::V1::Cluster]
354
+ #
355
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
356
+ #
357
+ # @example Basic example
358
+ # require "google/cloud/alloy_db/v1"
359
+ #
360
+ # # Create a client object. The client can be reused for multiple calls.
361
+ # client = Google::Cloud::AlloyDB::V1::AlloyDBAdmin::Client.new
362
+ #
363
+ # # Create a request. To set request fields, pass in keyword arguments.
364
+ # request = Google::Cloud::AlloyDB::V1::GetClusterRequest.new
365
+ #
366
+ # # Call the get_cluster method.
367
+ # result = client.get_cluster request
368
+ #
369
+ # # The returned object is of type Google::Cloud::AlloyDB::V1::Cluster.
370
+ # p result
371
+ #
372
+ def get_cluster request, options = nil
373
+ raise ::ArgumentError, "request must be provided" if request.nil?
374
+
375
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::AlloyDB::V1::GetClusterRequest
376
+
377
+ # Converts hash and nil to an options object
378
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
379
+
380
+ # Customize the options with defaults
381
+ metadata = @config.rpcs.get_cluster.metadata.to_h
382
+
383
+ # Set x-goog-api-client and x-goog-user-project headers
384
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
385
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
386
+ gapic_version: ::Google::Cloud::AlloyDB::V1::VERSION
387
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
388
+
389
+ header_params = {}
390
+ if request.name
391
+ header_params["name"] = request.name
392
+ end
393
+
394
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
395
+ metadata[:"x-goog-request-params"] ||= request_params_header
396
+
397
+ options.apply_defaults timeout: @config.rpcs.get_cluster.timeout,
398
+ metadata: metadata,
399
+ retry_policy: @config.rpcs.get_cluster.retry_policy
400
+
401
+ options.apply_defaults timeout: @config.timeout,
402
+ metadata: @config.metadata,
403
+ retry_policy: @config.retry_policy
404
+
405
+ @alloy_db_admin_stub.call_rpc :get_cluster, request, options: options do |response, operation|
406
+ yield response, operation if block_given?
407
+ return response
408
+ end
409
+ rescue ::GRPC::BadStatus => e
410
+ raise ::Google::Cloud::Error.from_error(e)
411
+ end
412
+
413
+ ##
414
+ # Creates a new Cluster in a given project and location.
415
+ #
416
+ # @overload create_cluster(request, options = nil)
417
+ # Pass arguments to `create_cluster` via a request object, either of type
418
+ # {::Google::Cloud::AlloyDB::V1::CreateClusterRequest} or an equivalent Hash.
419
+ #
420
+ # @param request [::Google::Cloud::AlloyDB::V1::CreateClusterRequest, ::Hash]
421
+ # A request object representing the call parameters. Required. To specify no
422
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
423
+ # @param options [::Gapic::CallOptions, ::Hash]
424
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
425
+ #
426
+ # @overload create_cluster(parent: nil, cluster_id: nil, cluster: nil, request_id: nil, validate_only: nil)
427
+ # Pass arguments to `create_cluster` via keyword arguments. Note that at
428
+ # least one keyword argument is required. To specify no parameters, or to keep all
429
+ # the default parameter values, pass an empty Hash as a request object (see above).
430
+ #
431
+ # @param parent [::String]
432
+ # Required. The name of the parent resource. For the required format, see the
433
+ # comment on the Cluster.name field.
434
+ # @param cluster_id [::String]
435
+ # Required. ID of the requesting object.
436
+ # @param cluster [::Google::Cloud::AlloyDB::V1::Cluster, ::Hash]
437
+ # Required. The resource being created
438
+ # @param request_id [::String]
439
+ # Optional. An optional request ID to identify requests. Specify a unique
440
+ # request ID so that if you must retry your request, the server will know to
441
+ # ignore the request if it has already been completed. The server will
442
+ # guarantee that for at least 60 minutes since the first request.
443
+ #
444
+ # For example, consider a situation where you make an initial request and
445
+ # the request times out. If you make the request again with the same request
446
+ # ID, the server can check if original operation with the same request ID
447
+ # was received, and if so, will ignore the second request. This prevents
448
+ # clients from accidentally creating duplicate commitments.
449
+ #
450
+ # The request ID must be a valid UUID with the exception that zero UUID is
451
+ # not supported (00000000-0000-0000-0000-000000000000).
452
+ # @param validate_only [::Boolean]
453
+ # Optional. If set, performs request validation (e.g. permission checks and
454
+ # any other type of validation), but do not actually execute the create
455
+ # request.
456
+ #
457
+ # @yield [response, operation] Access the result along with the RPC operation
458
+ # @yieldparam response [::Gapic::Operation]
459
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
460
+ #
461
+ # @return [::Gapic::Operation]
462
+ #
463
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
464
+ #
465
+ # @example Basic example
466
+ # require "google/cloud/alloy_db/v1"
467
+ #
468
+ # # Create a client object. The client can be reused for multiple calls.
469
+ # client = Google::Cloud::AlloyDB::V1::AlloyDBAdmin::Client.new
470
+ #
471
+ # # Create a request. To set request fields, pass in keyword arguments.
472
+ # request = Google::Cloud::AlloyDB::V1::CreateClusterRequest.new
473
+ #
474
+ # # Call the create_cluster method.
475
+ # result = client.create_cluster request
476
+ #
477
+ # # The returned object is of type Gapic::Operation. You can use it to
478
+ # # check the status of an operation, cancel it, or wait for results.
479
+ # # Here is how to wait for a response.
480
+ # result.wait_until_done! timeout: 60
481
+ # if result.response?
482
+ # p result.response
483
+ # else
484
+ # puts "No response received."
485
+ # end
486
+ #
487
+ def create_cluster request, options = nil
488
+ raise ::ArgumentError, "request must be provided" if request.nil?
489
+
490
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::AlloyDB::V1::CreateClusterRequest
491
+
492
+ # Converts hash and nil to an options object
493
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
494
+
495
+ # Customize the options with defaults
496
+ metadata = @config.rpcs.create_cluster.metadata.to_h
497
+
498
+ # Set x-goog-api-client and x-goog-user-project headers
499
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
500
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
501
+ gapic_version: ::Google::Cloud::AlloyDB::V1::VERSION
502
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
503
+
504
+ header_params = {}
505
+ if request.parent
506
+ header_params["parent"] = request.parent
507
+ end
508
+
509
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
510
+ metadata[:"x-goog-request-params"] ||= request_params_header
511
+
512
+ options.apply_defaults timeout: @config.rpcs.create_cluster.timeout,
513
+ metadata: metadata,
514
+ retry_policy: @config.rpcs.create_cluster.retry_policy
515
+
516
+ options.apply_defaults timeout: @config.timeout,
517
+ metadata: @config.metadata,
518
+ retry_policy: @config.retry_policy
519
+
520
+ @alloy_db_admin_stub.call_rpc :create_cluster, request, options: options do |response, operation|
521
+ response = ::Gapic::Operation.new response, @operations_client, options: options
522
+ yield response, operation if block_given?
523
+ return response
524
+ end
525
+ rescue ::GRPC::BadStatus => e
526
+ raise ::Google::Cloud::Error.from_error(e)
527
+ end
528
+
529
+ ##
530
+ # Updates the parameters of a single Cluster.
531
+ #
532
+ # @overload update_cluster(request, options = nil)
533
+ # Pass arguments to `update_cluster` via a request object, either of type
534
+ # {::Google::Cloud::AlloyDB::V1::UpdateClusterRequest} or an equivalent Hash.
535
+ #
536
+ # @param request [::Google::Cloud::AlloyDB::V1::UpdateClusterRequest, ::Hash]
537
+ # A request object representing the call parameters. Required. To specify no
538
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
539
+ # @param options [::Gapic::CallOptions, ::Hash]
540
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
541
+ #
542
+ # @overload update_cluster(update_mask: nil, cluster: nil, request_id: nil, validate_only: nil, allow_missing: nil)
543
+ # Pass arguments to `update_cluster` via keyword arguments. Note that at
544
+ # least one keyword argument is required. To specify no parameters, or to keep all
545
+ # the default parameter values, pass an empty Hash as a request object (see above).
546
+ #
547
+ # @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
548
+ # Optional. Field mask is used to specify the fields to be overwritten in the
549
+ # Cluster resource by the update.
550
+ # The fields specified in the update_mask are relative to the resource, not
551
+ # the full request. A field will be overwritten if it is in the mask. If the
552
+ # user does not provide a mask then all fields will be overwritten.
553
+ # @param cluster [::Google::Cloud::AlloyDB::V1::Cluster, ::Hash]
554
+ # Required. The resource being updated
555
+ # @param request_id [::String]
556
+ # Optional. An optional request ID to identify requests. Specify a unique
557
+ # request ID so that if you must retry your request, the server will know to
558
+ # ignore the request if it has already been completed. The server will
559
+ # guarantee that for at least 60 minutes since the first request.
560
+ #
561
+ # For example, consider a situation where you make an initial request and
562
+ # the request times out. If you make the request again with the same request
563
+ # ID, the server can check if original operation with the same request ID
564
+ # was received, and if so, will ignore the second request. This prevents
565
+ # clients from accidentally creating duplicate commitments.
566
+ #
567
+ # The request ID must be a valid UUID with the exception that zero UUID is
568
+ # not supported (00000000-0000-0000-0000-000000000000).
569
+ # @param validate_only [::Boolean]
570
+ # Optional. If set, performs request validation (e.g. permission checks and
571
+ # any other type of validation), but do not actually execute the update
572
+ # request.
573
+ # @param allow_missing [::Boolean]
574
+ # Optional. If set to true, update succeeds even if cluster is not found. In
575
+ # that case, a new cluster is created and `update_mask` is ignored.
576
+ #
577
+ # @yield [response, operation] Access the result along with the RPC operation
578
+ # @yieldparam response [::Gapic::Operation]
579
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
580
+ #
581
+ # @return [::Gapic::Operation]
582
+ #
583
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
584
+ #
585
+ # @example Basic example
586
+ # require "google/cloud/alloy_db/v1"
587
+ #
588
+ # # Create a client object. The client can be reused for multiple calls.
589
+ # client = Google::Cloud::AlloyDB::V1::AlloyDBAdmin::Client.new
590
+ #
591
+ # # Create a request. To set request fields, pass in keyword arguments.
592
+ # request = Google::Cloud::AlloyDB::V1::UpdateClusterRequest.new
593
+ #
594
+ # # Call the update_cluster method.
595
+ # result = client.update_cluster request
596
+ #
597
+ # # The returned object is of type Gapic::Operation. You can use it to
598
+ # # check the status of an operation, cancel it, or wait for results.
599
+ # # Here is how to wait for a response.
600
+ # result.wait_until_done! timeout: 60
601
+ # if result.response?
602
+ # p result.response
603
+ # else
604
+ # puts "No response received."
605
+ # end
606
+ #
607
+ def update_cluster request, options = nil
608
+ raise ::ArgumentError, "request must be provided" if request.nil?
609
+
610
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::AlloyDB::V1::UpdateClusterRequest
611
+
612
+ # Converts hash and nil to an options object
613
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
614
+
615
+ # Customize the options with defaults
616
+ metadata = @config.rpcs.update_cluster.metadata.to_h
617
+
618
+ # Set x-goog-api-client and x-goog-user-project headers
619
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
620
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
621
+ gapic_version: ::Google::Cloud::AlloyDB::V1::VERSION
622
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
623
+
624
+ header_params = {}
625
+ if request.cluster&.name
626
+ header_params["cluster.name"] = request.cluster.name
627
+ end
628
+
629
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
630
+ metadata[:"x-goog-request-params"] ||= request_params_header
631
+
632
+ options.apply_defaults timeout: @config.rpcs.update_cluster.timeout,
633
+ metadata: metadata,
634
+ retry_policy: @config.rpcs.update_cluster.retry_policy
635
+
636
+ options.apply_defaults timeout: @config.timeout,
637
+ metadata: @config.metadata,
638
+ retry_policy: @config.retry_policy
639
+
640
+ @alloy_db_admin_stub.call_rpc :update_cluster, request, options: options do |response, operation|
641
+ response = ::Gapic::Operation.new response, @operations_client, options: options
642
+ yield response, operation if block_given?
643
+ return response
644
+ end
645
+ rescue ::GRPC::BadStatus => e
646
+ raise ::Google::Cloud::Error.from_error(e)
647
+ end
648
+
649
+ ##
650
+ # Deletes a single Cluster.
651
+ #
652
+ # @overload delete_cluster(request, options = nil)
653
+ # Pass arguments to `delete_cluster` via a request object, either of type
654
+ # {::Google::Cloud::AlloyDB::V1::DeleteClusterRequest} or an equivalent Hash.
655
+ #
656
+ # @param request [::Google::Cloud::AlloyDB::V1::DeleteClusterRequest, ::Hash]
657
+ # A request object representing the call parameters. Required. To specify no
658
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
659
+ # @param options [::Gapic::CallOptions, ::Hash]
660
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
661
+ #
662
+ # @overload delete_cluster(name: nil, request_id: nil, etag: nil, validate_only: nil, force: nil)
663
+ # Pass arguments to `delete_cluster` via keyword arguments. Note that at
664
+ # least one keyword argument is required. To specify no parameters, or to keep all
665
+ # the default parameter values, pass an empty Hash as a request object (see above).
666
+ #
667
+ # @param name [::String]
668
+ # Required. The name of the resource. For the required format, see the
669
+ # comment on the Cluster.name field.
670
+ # @param request_id [::String]
671
+ # Optional. An optional request ID to identify requests. Specify a unique
672
+ # request ID so that if you must retry your request, the server will know to
673
+ # ignore the request if it has already been completed. The server will
674
+ # guarantee that for at least 60 minutes after the first request.
675
+ #
676
+ # For example, consider a situation where you make an initial request and
677
+ # the request times out. If you make the request again with the same request
678
+ # ID, the server can check if original operation with the same request ID
679
+ # was received, and if so, will ignore the second request. This prevents
680
+ # clients from accidentally creating duplicate commitments.
681
+ #
682
+ # The request ID must be a valid UUID with the exception that zero UUID is
683
+ # not supported (00000000-0000-0000-0000-000000000000).
684
+ # @param etag [::String]
685
+ # Optional. The current etag of the Cluster.
686
+ # If an etag is provided and does not match the current etag of the Cluster,
687
+ # deletion will be blocked and an ABORTED error will be returned.
688
+ # @param validate_only [::Boolean]
689
+ # Optional. If set, performs request validation (e.g. permission checks and
690
+ # any other type of validation), but do not actually execute the delete.
691
+ # @param force [::Boolean]
692
+ # Optional. Whether to cascade delete child instances for given cluster.
693
+ #
694
+ # @yield [response, operation] Access the result along with the RPC operation
695
+ # @yieldparam response [::Gapic::Operation]
696
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
697
+ #
698
+ # @return [::Gapic::Operation]
699
+ #
700
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
701
+ #
702
+ # @example Basic example
703
+ # require "google/cloud/alloy_db/v1"
704
+ #
705
+ # # Create a client object. The client can be reused for multiple calls.
706
+ # client = Google::Cloud::AlloyDB::V1::AlloyDBAdmin::Client.new
707
+ #
708
+ # # Create a request. To set request fields, pass in keyword arguments.
709
+ # request = Google::Cloud::AlloyDB::V1::DeleteClusterRequest.new
710
+ #
711
+ # # Call the delete_cluster method.
712
+ # result = client.delete_cluster request
713
+ #
714
+ # # The returned object is of type Gapic::Operation. You can use it to
715
+ # # check the status of an operation, cancel it, or wait for results.
716
+ # # Here is how to wait for a response.
717
+ # result.wait_until_done! timeout: 60
718
+ # if result.response?
719
+ # p result.response
720
+ # else
721
+ # puts "No response received."
722
+ # end
723
+ #
724
+ def delete_cluster request, options = nil
725
+ raise ::ArgumentError, "request must be provided" if request.nil?
726
+
727
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::AlloyDB::V1::DeleteClusterRequest
728
+
729
+ # Converts hash and nil to an options object
730
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
731
+
732
+ # Customize the options with defaults
733
+ metadata = @config.rpcs.delete_cluster.metadata.to_h
734
+
735
+ # Set x-goog-api-client and x-goog-user-project headers
736
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
737
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
738
+ gapic_version: ::Google::Cloud::AlloyDB::V1::VERSION
739
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
740
+
741
+ header_params = {}
742
+ if request.name
743
+ header_params["name"] = request.name
744
+ end
745
+
746
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
747
+ metadata[:"x-goog-request-params"] ||= request_params_header
748
+
749
+ options.apply_defaults timeout: @config.rpcs.delete_cluster.timeout,
750
+ metadata: metadata,
751
+ retry_policy: @config.rpcs.delete_cluster.retry_policy
752
+
753
+ options.apply_defaults timeout: @config.timeout,
754
+ metadata: @config.metadata,
755
+ retry_policy: @config.retry_policy
756
+
757
+ @alloy_db_admin_stub.call_rpc :delete_cluster, request, options: options do |response, operation|
758
+ response = ::Gapic::Operation.new response, @operations_client, options: options
759
+ yield response, operation if block_given?
760
+ return response
761
+ end
762
+ rescue ::GRPC::BadStatus => e
763
+ raise ::Google::Cloud::Error.from_error(e)
764
+ end
765
+
766
+ ##
767
+ # Creates a new Cluster in a given project and location, with a volume
768
+ # restored from the provided source, either a backup ID or a point-in-time
769
+ # and a source cluster.
770
+ #
771
+ # @overload restore_cluster(request, options = nil)
772
+ # Pass arguments to `restore_cluster` via a request object, either of type
773
+ # {::Google::Cloud::AlloyDB::V1::RestoreClusterRequest} or an equivalent Hash.
774
+ #
775
+ # @param request [::Google::Cloud::AlloyDB::V1::RestoreClusterRequest, ::Hash]
776
+ # A request object representing the call parameters. Required. To specify no
777
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
778
+ # @param options [::Gapic::CallOptions, ::Hash]
779
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
780
+ #
781
+ # @overload restore_cluster(backup_source: nil, parent: nil, cluster_id: nil, cluster: nil, request_id: nil, validate_only: nil)
782
+ # Pass arguments to `restore_cluster` via keyword arguments. Note that at
783
+ # least one keyword argument is required. To specify no parameters, or to keep all
784
+ # the default parameter values, pass an empty Hash as a request object (see above).
785
+ #
786
+ # @param backup_source [::Google::Cloud::AlloyDB::V1::BackupSource, ::Hash]
787
+ # Backup source.
788
+ # @param parent [::String]
789
+ # Required. The name of the parent resource. For the required format, see the
790
+ # comment on the Cluster.name field.
791
+ # @param cluster_id [::String]
792
+ # Required. ID of the requesting object.
793
+ # @param cluster [::Google::Cloud::AlloyDB::V1::Cluster, ::Hash]
794
+ # Required. The resource being created
795
+ # @param request_id [::String]
796
+ # Optional. An optional request ID to identify requests. Specify a unique
797
+ # request ID so that if you must retry your request, the server will know to
798
+ # ignore the request if it has already been completed. The server will
799
+ # guarantee that for at least 60 minutes since the first request.
800
+ #
801
+ # For example, consider a situation where you make an initial request and
802
+ # the request times out. If you make the request again with the same request
803
+ # ID, the server can check if original operation with the same request ID
804
+ # was received, and if so, will ignore the second request. This prevents
805
+ # clients from accidentally creating duplicate commitments.
806
+ #
807
+ # The request ID must be a valid UUID with the exception that zero UUID is
808
+ # not supported (00000000-0000-0000-0000-000000000000).
809
+ # @param validate_only [::Boolean]
810
+ # Optional. If set, performs request validation (e.g. permission checks and
811
+ # any other type of validation), but do not actually execute the import
812
+ # request.
813
+ #
814
+ # @yield [response, operation] Access the result along with the RPC operation
815
+ # @yieldparam response [::Gapic::Operation]
816
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
817
+ #
818
+ # @return [::Gapic::Operation]
819
+ #
820
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
821
+ #
822
+ # @example Basic example
823
+ # require "google/cloud/alloy_db/v1"
824
+ #
825
+ # # Create a client object. The client can be reused for multiple calls.
826
+ # client = Google::Cloud::AlloyDB::V1::AlloyDBAdmin::Client.new
827
+ #
828
+ # # Create a request. To set request fields, pass in keyword arguments.
829
+ # request = Google::Cloud::AlloyDB::V1::RestoreClusterRequest.new
830
+ #
831
+ # # Call the restore_cluster method.
832
+ # result = client.restore_cluster request
833
+ #
834
+ # # The returned object is of type Gapic::Operation. You can use it to
835
+ # # check the status of an operation, cancel it, or wait for results.
836
+ # # Here is how to wait for a response.
837
+ # result.wait_until_done! timeout: 60
838
+ # if result.response?
839
+ # p result.response
840
+ # else
841
+ # puts "No response received."
842
+ # end
843
+ #
844
+ def restore_cluster request, options = nil
845
+ raise ::ArgumentError, "request must be provided" if request.nil?
846
+
847
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::AlloyDB::V1::RestoreClusterRequest
848
+
849
+ # Converts hash and nil to an options object
850
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
851
+
852
+ # Customize the options with defaults
853
+ metadata = @config.rpcs.restore_cluster.metadata.to_h
854
+
855
+ # Set x-goog-api-client and x-goog-user-project headers
856
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
857
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
858
+ gapic_version: ::Google::Cloud::AlloyDB::V1::VERSION
859
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
860
+
861
+ header_params = {}
862
+ if request.parent
863
+ header_params["parent"] = request.parent
864
+ end
865
+
866
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
867
+ metadata[:"x-goog-request-params"] ||= request_params_header
868
+
869
+ options.apply_defaults timeout: @config.rpcs.restore_cluster.timeout,
870
+ metadata: metadata,
871
+ retry_policy: @config.rpcs.restore_cluster.retry_policy
872
+
873
+ options.apply_defaults timeout: @config.timeout,
874
+ metadata: @config.metadata,
875
+ retry_policy: @config.retry_policy
876
+
877
+ @alloy_db_admin_stub.call_rpc :restore_cluster, request, options: options do |response, operation|
878
+ response = ::Gapic::Operation.new response, @operations_client, options: options
879
+ yield response, operation if block_given?
880
+ return response
881
+ end
882
+ rescue ::GRPC::BadStatus => e
883
+ raise ::Google::Cloud::Error.from_error(e)
884
+ end
885
+
886
+ ##
887
+ # Lists Instances in a given project and location.
888
+ #
889
+ # @overload list_instances(request, options = nil)
890
+ # Pass arguments to `list_instances` via a request object, either of type
891
+ # {::Google::Cloud::AlloyDB::V1::ListInstancesRequest} or an equivalent Hash.
892
+ #
893
+ # @param request [::Google::Cloud::AlloyDB::V1::ListInstancesRequest, ::Hash]
894
+ # A request object representing the call parameters. Required. To specify no
895
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
896
+ # @param options [::Gapic::CallOptions, ::Hash]
897
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
898
+ #
899
+ # @overload list_instances(parent: nil, page_size: nil, page_token: nil, filter: nil, order_by: nil)
900
+ # Pass arguments to `list_instances` via keyword arguments. Note that at
901
+ # least one keyword argument is required. To specify no parameters, or to keep all
902
+ # the default parameter values, pass an empty Hash as a request object (see above).
903
+ #
904
+ # @param parent [::String]
905
+ # Required. The name of the parent resource. For the required format, see the
906
+ # comment on the Instance.name field. Additionally, you can perform an
907
+ # aggregated list operation by specifying a value with one of the following
908
+ # formats:
909
+ # * projects/\\{project}/locations/-/clusters/-
910
+ # * projects/\\{project}/locations/\\{region}/clusters/-
911
+ # @param page_size [::Integer]
912
+ # Optional. Requested page size. Server may return fewer items than
913
+ # requested. If unspecified, server will pick an appropriate default.
914
+ # @param page_token [::String]
915
+ # A token identifying a page of results the server should return.
916
+ # @param filter [::String]
917
+ # Optional. Filtering results
918
+ # @param order_by [::String]
919
+ # Optional. Hint for how to order the results
920
+ #
921
+ # @yield [response, operation] Access the result along with the RPC operation
922
+ # @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::AlloyDB::V1::Instance>]
923
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
924
+ #
925
+ # @return [::Gapic::PagedEnumerable<::Google::Cloud::AlloyDB::V1::Instance>]
926
+ #
927
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
928
+ #
929
+ # @example Basic example
930
+ # require "google/cloud/alloy_db/v1"
931
+ #
932
+ # # Create a client object. The client can be reused for multiple calls.
933
+ # client = Google::Cloud::AlloyDB::V1::AlloyDBAdmin::Client.new
934
+ #
935
+ # # Create a request. To set request fields, pass in keyword arguments.
936
+ # request = Google::Cloud::AlloyDB::V1::ListInstancesRequest.new
937
+ #
938
+ # # Call the list_instances method.
939
+ # result = client.list_instances request
940
+ #
941
+ # # The returned object is of type Gapic::PagedEnumerable. You can iterate
942
+ # # over elements, and API calls will be issued to fetch pages as needed.
943
+ # result.each do |item|
944
+ # # Each element is of type ::Google::Cloud::AlloyDB::V1::Instance.
945
+ # p item
946
+ # end
947
+ #
948
+ def list_instances request, options = nil
949
+ raise ::ArgumentError, "request must be provided" if request.nil?
950
+
951
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::AlloyDB::V1::ListInstancesRequest
952
+
953
+ # Converts hash and nil to an options object
954
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
955
+
956
+ # Customize the options with defaults
957
+ metadata = @config.rpcs.list_instances.metadata.to_h
958
+
959
+ # Set x-goog-api-client and x-goog-user-project headers
960
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
961
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
962
+ gapic_version: ::Google::Cloud::AlloyDB::V1::VERSION
963
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
964
+
965
+ header_params = {}
966
+ if request.parent
967
+ header_params["parent"] = request.parent
968
+ end
969
+
970
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
971
+ metadata[:"x-goog-request-params"] ||= request_params_header
972
+
973
+ options.apply_defaults timeout: @config.rpcs.list_instances.timeout,
974
+ metadata: metadata,
975
+ retry_policy: @config.rpcs.list_instances.retry_policy
976
+
977
+ options.apply_defaults timeout: @config.timeout,
978
+ metadata: @config.metadata,
979
+ retry_policy: @config.retry_policy
980
+
981
+ @alloy_db_admin_stub.call_rpc :list_instances, request, options: options do |response, operation|
982
+ response = ::Gapic::PagedEnumerable.new @alloy_db_admin_stub, :list_instances, request, response, operation, options
983
+ yield response, operation if block_given?
984
+ return response
985
+ end
986
+ rescue ::GRPC::BadStatus => e
987
+ raise ::Google::Cloud::Error.from_error(e)
988
+ end
989
+
990
+ ##
991
+ # Gets details of a single Instance.
992
+ #
993
+ # @overload get_instance(request, options = nil)
994
+ # Pass arguments to `get_instance` via a request object, either of type
995
+ # {::Google::Cloud::AlloyDB::V1::GetInstanceRequest} or an equivalent Hash.
996
+ #
997
+ # @param request [::Google::Cloud::AlloyDB::V1::GetInstanceRequest, ::Hash]
998
+ # A request object representing the call parameters. Required. To specify no
999
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1000
+ # @param options [::Gapic::CallOptions, ::Hash]
1001
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
1002
+ #
1003
+ # @overload get_instance(name: nil, view: nil)
1004
+ # Pass arguments to `get_instance` via keyword arguments. Note that at
1005
+ # least one keyword argument is required. To specify no parameters, or to keep all
1006
+ # the default parameter values, pass an empty Hash as a request object (see above).
1007
+ #
1008
+ # @param name [::String]
1009
+ # Required. The name of the resource. For the required format, see the
1010
+ # comment on the Instance.name field.
1011
+ # @param view [::Google::Cloud::AlloyDB::V1::InstanceView]
1012
+ # The view of the instance to return.
1013
+ #
1014
+ # @yield [response, operation] Access the result along with the RPC operation
1015
+ # @yieldparam response [::Google::Cloud::AlloyDB::V1::Instance]
1016
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
1017
+ #
1018
+ # @return [::Google::Cloud::AlloyDB::V1::Instance]
1019
+ #
1020
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
1021
+ #
1022
+ # @example Basic example
1023
+ # require "google/cloud/alloy_db/v1"
1024
+ #
1025
+ # # Create a client object. The client can be reused for multiple calls.
1026
+ # client = Google::Cloud::AlloyDB::V1::AlloyDBAdmin::Client.new
1027
+ #
1028
+ # # Create a request. To set request fields, pass in keyword arguments.
1029
+ # request = Google::Cloud::AlloyDB::V1::GetInstanceRequest.new
1030
+ #
1031
+ # # Call the get_instance method.
1032
+ # result = client.get_instance request
1033
+ #
1034
+ # # The returned object is of type Google::Cloud::AlloyDB::V1::Instance.
1035
+ # p result
1036
+ #
1037
+ def get_instance request, options = nil
1038
+ raise ::ArgumentError, "request must be provided" if request.nil?
1039
+
1040
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::AlloyDB::V1::GetInstanceRequest
1041
+
1042
+ # Converts hash and nil to an options object
1043
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1044
+
1045
+ # Customize the options with defaults
1046
+ metadata = @config.rpcs.get_instance.metadata.to_h
1047
+
1048
+ # Set x-goog-api-client and x-goog-user-project headers
1049
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1050
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1051
+ gapic_version: ::Google::Cloud::AlloyDB::V1::VERSION
1052
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1053
+
1054
+ header_params = {}
1055
+ if request.name
1056
+ header_params["name"] = request.name
1057
+ end
1058
+
1059
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1060
+ metadata[:"x-goog-request-params"] ||= request_params_header
1061
+
1062
+ options.apply_defaults timeout: @config.rpcs.get_instance.timeout,
1063
+ metadata: metadata,
1064
+ retry_policy: @config.rpcs.get_instance.retry_policy
1065
+
1066
+ options.apply_defaults timeout: @config.timeout,
1067
+ metadata: @config.metadata,
1068
+ retry_policy: @config.retry_policy
1069
+
1070
+ @alloy_db_admin_stub.call_rpc :get_instance, request, options: options do |response, operation|
1071
+ yield response, operation if block_given?
1072
+ return response
1073
+ end
1074
+ rescue ::GRPC::BadStatus => e
1075
+ raise ::Google::Cloud::Error.from_error(e)
1076
+ end
1077
+
1078
+ ##
1079
+ # Creates a new Instance in a given project and location.
1080
+ #
1081
+ # @overload create_instance(request, options = nil)
1082
+ # Pass arguments to `create_instance` via a request object, either of type
1083
+ # {::Google::Cloud::AlloyDB::V1::CreateInstanceRequest} or an equivalent Hash.
1084
+ #
1085
+ # @param request [::Google::Cloud::AlloyDB::V1::CreateInstanceRequest, ::Hash]
1086
+ # A request object representing the call parameters. Required. To specify no
1087
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1088
+ # @param options [::Gapic::CallOptions, ::Hash]
1089
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
1090
+ #
1091
+ # @overload create_instance(parent: nil, instance_id: nil, instance: nil, request_id: nil, validate_only: nil)
1092
+ # Pass arguments to `create_instance` via keyword arguments. Note that at
1093
+ # least one keyword argument is required. To specify no parameters, or to keep all
1094
+ # the default parameter values, pass an empty Hash as a request object (see above).
1095
+ #
1096
+ # @param parent [::String]
1097
+ # Required. The name of the parent resource. For the required format, see the
1098
+ # comment on the Instance.name field.
1099
+ # @param instance_id [::String]
1100
+ # Required. ID of the requesting object.
1101
+ # @param instance [::Google::Cloud::AlloyDB::V1::Instance, ::Hash]
1102
+ # Required. The resource being created
1103
+ # @param request_id [::String]
1104
+ # Optional. An optional request ID to identify requests. Specify a unique
1105
+ # request ID so that if you must retry your request, the server will know to
1106
+ # ignore the request if it has already been completed. The server will
1107
+ # guarantee that for at least 60 minutes since the first request.
1108
+ #
1109
+ # For example, consider a situation where you make an initial request and
1110
+ # the request times out. If you make the request again with the same request
1111
+ # ID, the server can check if original operation with the same request ID
1112
+ # was received, and if so, will ignore the second request. This prevents
1113
+ # clients from accidentally creating duplicate commitments.
1114
+ #
1115
+ # The request ID must be a valid UUID with the exception that zero UUID is
1116
+ # not supported (00000000-0000-0000-0000-000000000000).
1117
+ # @param validate_only [::Boolean]
1118
+ # Optional. If set, performs request validation (e.g. permission checks and
1119
+ # any other type of validation), but do not actually execute the create
1120
+ # request.
1121
+ #
1122
+ # @yield [response, operation] Access the result along with the RPC operation
1123
+ # @yieldparam response [::Gapic::Operation]
1124
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
1125
+ #
1126
+ # @return [::Gapic::Operation]
1127
+ #
1128
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
1129
+ #
1130
+ # @example Basic example
1131
+ # require "google/cloud/alloy_db/v1"
1132
+ #
1133
+ # # Create a client object. The client can be reused for multiple calls.
1134
+ # client = Google::Cloud::AlloyDB::V1::AlloyDBAdmin::Client.new
1135
+ #
1136
+ # # Create a request. To set request fields, pass in keyword arguments.
1137
+ # request = Google::Cloud::AlloyDB::V1::CreateInstanceRequest.new
1138
+ #
1139
+ # # Call the create_instance method.
1140
+ # result = client.create_instance request
1141
+ #
1142
+ # # The returned object is of type Gapic::Operation. You can use it to
1143
+ # # check the status of an operation, cancel it, or wait for results.
1144
+ # # Here is how to wait for a response.
1145
+ # result.wait_until_done! timeout: 60
1146
+ # if result.response?
1147
+ # p result.response
1148
+ # else
1149
+ # puts "No response received."
1150
+ # end
1151
+ #
1152
+ def create_instance request, options = nil
1153
+ raise ::ArgumentError, "request must be provided" if request.nil?
1154
+
1155
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::AlloyDB::V1::CreateInstanceRequest
1156
+
1157
+ # Converts hash and nil to an options object
1158
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1159
+
1160
+ # Customize the options with defaults
1161
+ metadata = @config.rpcs.create_instance.metadata.to_h
1162
+
1163
+ # Set x-goog-api-client and x-goog-user-project headers
1164
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1165
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1166
+ gapic_version: ::Google::Cloud::AlloyDB::V1::VERSION
1167
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1168
+
1169
+ header_params = {}
1170
+ if request.parent
1171
+ header_params["parent"] = request.parent
1172
+ end
1173
+
1174
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1175
+ metadata[:"x-goog-request-params"] ||= request_params_header
1176
+
1177
+ options.apply_defaults timeout: @config.rpcs.create_instance.timeout,
1178
+ metadata: metadata,
1179
+ retry_policy: @config.rpcs.create_instance.retry_policy
1180
+
1181
+ options.apply_defaults timeout: @config.timeout,
1182
+ metadata: @config.metadata,
1183
+ retry_policy: @config.retry_policy
1184
+
1185
+ @alloy_db_admin_stub.call_rpc :create_instance, request, options: options do |response, operation|
1186
+ response = ::Gapic::Operation.new response, @operations_client, options: options
1187
+ yield response, operation if block_given?
1188
+ return response
1189
+ end
1190
+ rescue ::GRPC::BadStatus => e
1191
+ raise ::Google::Cloud::Error.from_error(e)
1192
+ end
1193
+
1194
+ ##
1195
+ # Creates new instances under the given project, location and cluster.
1196
+ # There can be only one primary instance in a cluster. If the primary
1197
+ # instance exists in the cluster as well as this request, then API will
1198
+ # throw an error.
1199
+ # The primary instance should exist before any read pool instance is
1200
+ # created. If the primary instance is a part of the request payload, then
1201
+ # the API will take care of creating instances in the correct order.
1202
+ # This method is here to support Google-internal use cases, and is not meant
1203
+ # for external customers to consume. Please do not start relying on it; its
1204
+ # behavior is subject to change without notice.
1205
+ #
1206
+ # @overload batch_create_instances(request, options = nil)
1207
+ # Pass arguments to `batch_create_instances` via a request object, either of type
1208
+ # {::Google::Cloud::AlloyDB::V1::BatchCreateInstancesRequest} or an equivalent Hash.
1209
+ #
1210
+ # @param request [::Google::Cloud::AlloyDB::V1::BatchCreateInstancesRequest, ::Hash]
1211
+ # A request object representing the call parameters. Required. To specify no
1212
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1213
+ # @param options [::Gapic::CallOptions, ::Hash]
1214
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
1215
+ #
1216
+ # @overload batch_create_instances(parent: nil, requests: nil, request_id: nil)
1217
+ # Pass arguments to `batch_create_instances` via keyword arguments. Note that at
1218
+ # least one keyword argument is required. To specify no parameters, or to keep all
1219
+ # the default parameter values, pass an empty Hash as a request object (see above).
1220
+ #
1221
+ # @param parent [::String]
1222
+ # Required. The name of the parent resource.
1223
+ # @param requests [::Google::Cloud::AlloyDB::V1::CreateInstanceRequests, ::Hash]
1224
+ # Required. Resources being created.
1225
+ # @param request_id [::String]
1226
+ # Optional. An optional request ID to identify requests. Specify a unique
1227
+ # request ID so that if you must retry your request, the server will know to
1228
+ # ignore the request if it has already been completed. The server will
1229
+ # guarantee that for at least 60 minutes since the first request.
1230
+ #
1231
+ # For example, consider a situation where you make an initial request and
1232
+ # the request times out. If you make the request again with the same request
1233
+ # ID, the server can check if original operation with the same request ID
1234
+ # was received, and if so, will ignore the second request. This prevents
1235
+ # clients from accidentally creating duplicate commitments.
1236
+ #
1237
+ # The request ID must be a valid UUID with the exception that zero UUID is
1238
+ # not supported (00000000-0000-0000-0000-000000000000).
1239
+ #
1240
+ # @yield [response, operation] Access the result along with the RPC operation
1241
+ # @yieldparam response [::Gapic::Operation]
1242
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
1243
+ #
1244
+ # @return [::Gapic::Operation]
1245
+ #
1246
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
1247
+ #
1248
+ # @example Basic example
1249
+ # require "google/cloud/alloy_db/v1"
1250
+ #
1251
+ # # Create a client object. The client can be reused for multiple calls.
1252
+ # client = Google::Cloud::AlloyDB::V1::AlloyDBAdmin::Client.new
1253
+ #
1254
+ # # Create a request. To set request fields, pass in keyword arguments.
1255
+ # request = Google::Cloud::AlloyDB::V1::BatchCreateInstancesRequest.new
1256
+ #
1257
+ # # Call the batch_create_instances method.
1258
+ # result = client.batch_create_instances request
1259
+ #
1260
+ # # The returned object is of type Gapic::Operation. You can use it to
1261
+ # # check the status of an operation, cancel it, or wait for results.
1262
+ # # Here is how to wait for a response.
1263
+ # result.wait_until_done! timeout: 60
1264
+ # if result.response?
1265
+ # p result.response
1266
+ # else
1267
+ # puts "No response received."
1268
+ # end
1269
+ #
1270
+ def batch_create_instances request, options = nil
1271
+ raise ::ArgumentError, "request must be provided" if request.nil?
1272
+
1273
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::AlloyDB::V1::BatchCreateInstancesRequest
1274
+
1275
+ # Converts hash and nil to an options object
1276
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1277
+
1278
+ # Customize the options with defaults
1279
+ metadata = @config.rpcs.batch_create_instances.metadata.to_h
1280
+
1281
+ # Set x-goog-api-client and x-goog-user-project headers
1282
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1283
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1284
+ gapic_version: ::Google::Cloud::AlloyDB::V1::VERSION
1285
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1286
+
1287
+ header_params = {}
1288
+ if request.parent
1289
+ header_params["parent"] = request.parent
1290
+ end
1291
+
1292
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1293
+ metadata[:"x-goog-request-params"] ||= request_params_header
1294
+
1295
+ options.apply_defaults timeout: @config.rpcs.batch_create_instances.timeout,
1296
+ metadata: metadata,
1297
+ retry_policy: @config.rpcs.batch_create_instances.retry_policy
1298
+
1299
+ options.apply_defaults timeout: @config.timeout,
1300
+ metadata: @config.metadata,
1301
+ retry_policy: @config.retry_policy
1302
+
1303
+ @alloy_db_admin_stub.call_rpc :batch_create_instances, request, options: options do |response, operation|
1304
+ response = ::Gapic::Operation.new response, @operations_client, options: options
1305
+ yield response, operation if block_given?
1306
+ return response
1307
+ end
1308
+ rescue ::GRPC::BadStatus => e
1309
+ raise ::Google::Cloud::Error.from_error(e)
1310
+ end
1311
+
1312
+ ##
1313
+ # Updates the parameters of a single Instance.
1314
+ #
1315
+ # @overload update_instance(request, options = nil)
1316
+ # Pass arguments to `update_instance` via a request object, either of type
1317
+ # {::Google::Cloud::AlloyDB::V1::UpdateInstanceRequest} or an equivalent Hash.
1318
+ #
1319
+ # @param request [::Google::Cloud::AlloyDB::V1::UpdateInstanceRequest, ::Hash]
1320
+ # A request object representing the call parameters. Required. To specify no
1321
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1322
+ # @param options [::Gapic::CallOptions, ::Hash]
1323
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
1324
+ #
1325
+ # @overload update_instance(update_mask: nil, instance: nil, request_id: nil, validate_only: nil, allow_missing: nil)
1326
+ # Pass arguments to `update_instance` via keyword arguments. Note that at
1327
+ # least one keyword argument is required. To specify no parameters, or to keep all
1328
+ # the default parameter values, pass an empty Hash as a request object (see above).
1329
+ #
1330
+ # @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
1331
+ # Optional. Field mask is used to specify the fields to be overwritten in the
1332
+ # Instance resource by the update.
1333
+ # The fields specified in the update_mask are relative to the resource, not
1334
+ # the full request. A field will be overwritten if it is in the mask. If the
1335
+ # user does not provide a mask then all fields will be overwritten.
1336
+ # @param instance [::Google::Cloud::AlloyDB::V1::Instance, ::Hash]
1337
+ # Required. The resource being updated
1338
+ # @param request_id [::String]
1339
+ # Optional. An optional request ID to identify requests. Specify a unique
1340
+ # request ID so that if you must retry your request, the server will know to
1341
+ # ignore the request if it has already been completed. The server will
1342
+ # guarantee that for at least 60 minutes since the first request.
1343
+ #
1344
+ # For example, consider a situation where you make an initial request and
1345
+ # the request times out. If you make the request again with the same request
1346
+ # ID, the server can check if original operation with the same request ID
1347
+ # was received, and if so, will ignore the second request. This prevents
1348
+ # clients from accidentally creating duplicate commitments.
1349
+ #
1350
+ # The request ID must be a valid UUID with the exception that zero UUID is
1351
+ # not supported (00000000-0000-0000-0000-000000000000).
1352
+ # @param validate_only [::Boolean]
1353
+ # Optional. If set, performs request validation (e.g. permission checks and
1354
+ # any other type of validation), but do not actually execute the update
1355
+ # request.
1356
+ # @param allow_missing [::Boolean]
1357
+ # Optional. If set to true, update succeeds even if instance is not found. In
1358
+ # that case, a new instance is created and `update_mask` is ignored.
1359
+ #
1360
+ # @yield [response, operation] Access the result along with the RPC operation
1361
+ # @yieldparam response [::Gapic::Operation]
1362
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
1363
+ #
1364
+ # @return [::Gapic::Operation]
1365
+ #
1366
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
1367
+ #
1368
+ # @example Basic example
1369
+ # require "google/cloud/alloy_db/v1"
1370
+ #
1371
+ # # Create a client object. The client can be reused for multiple calls.
1372
+ # client = Google::Cloud::AlloyDB::V1::AlloyDBAdmin::Client.new
1373
+ #
1374
+ # # Create a request. To set request fields, pass in keyword arguments.
1375
+ # request = Google::Cloud::AlloyDB::V1::UpdateInstanceRequest.new
1376
+ #
1377
+ # # Call the update_instance method.
1378
+ # result = client.update_instance request
1379
+ #
1380
+ # # The returned object is of type Gapic::Operation. You can use it to
1381
+ # # check the status of an operation, cancel it, or wait for results.
1382
+ # # Here is how to wait for a response.
1383
+ # result.wait_until_done! timeout: 60
1384
+ # if result.response?
1385
+ # p result.response
1386
+ # else
1387
+ # puts "No response received."
1388
+ # end
1389
+ #
1390
+ def update_instance request, options = nil
1391
+ raise ::ArgumentError, "request must be provided" if request.nil?
1392
+
1393
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::AlloyDB::V1::UpdateInstanceRequest
1394
+
1395
+ # Converts hash and nil to an options object
1396
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1397
+
1398
+ # Customize the options with defaults
1399
+ metadata = @config.rpcs.update_instance.metadata.to_h
1400
+
1401
+ # Set x-goog-api-client and x-goog-user-project headers
1402
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1403
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1404
+ gapic_version: ::Google::Cloud::AlloyDB::V1::VERSION
1405
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1406
+
1407
+ header_params = {}
1408
+ if request.instance&.name
1409
+ header_params["instance.name"] = request.instance.name
1410
+ end
1411
+
1412
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1413
+ metadata[:"x-goog-request-params"] ||= request_params_header
1414
+
1415
+ options.apply_defaults timeout: @config.rpcs.update_instance.timeout,
1416
+ metadata: metadata,
1417
+ retry_policy: @config.rpcs.update_instance.retry_policy
1418
+
1419
+ options.apply_defaults timeout: @config.timeout,
1420
+ metadata: @config.metadata,
1421
+ retry_policy: @config.retry_policy
1422
+
1423
+ @alloy_db_admin_stub.call_rpc :update_instance, request, options: options do |response, operation|
1424
+ response = ::Gapic::Operation.new response, @operations_client, options: options
1425
+ yield response, operation if block_given?
1426
+ return response
1427
+ end
1428
+ rescue ::GRPC::BadStatus => e
1429
+ raise ::Google::Cloud::Error.from_error(e)
1430
+ end
1431
+
1432
+ ##
1433
+ # Deletes a single Instance.
1434
+ #
1435
+ # @overload delete_instance(request, options = nil)
1436
+ # Pass arguments to `delete_instance` via a request object, either of type
1437
+ # {::Google::Cloud::AlloyDB::V1::DeleteInstanceRequest} or an equivalent Hash.
1438
+ #
1439
+ # @param request [::Google::Cloud::AlloyDB::V1::DeleteInstanceRequest, ::Hash]
1440
+ # A request object representing the call parameters. Required. To specify no
1441
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1442
+ # @param options [::Gapic::CallOptions, ::Hash]
1443
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
1444
+ #
1445
+ # @overload delete_instance(name: nil, request_id: nil, etag: nil, validate_only: nil)
1446
+ # Pass arguments to `delete_instance` via keyword arguments. Note that at
1447
+ # least one keyword argument is required. To specify no parameters, or to keep all
1448
+ # the default parameter values, pass an empty Hash as a request object (see above).
1449
+ #
1450
+ # @param name [::String]
1451
+ # Required. The name of the resource. For the required format, see the
1452
+ # comment on the Instance.name field.
1453
+ # @param request_id [::String]
1454
+ # Optional. An optional request ID to identify requests. Specify a unique
1455
+ # request ID so that if you must retry your request, the server will know to
1456
+ # ignore the request if it has already been completed. The server will
1457
+ # guarantee that for at least 60 minutes after the first request.
1458
+ #
1459
+ # For example, consider a situation where you make an initial request and
1460
+ # the request times out. If you make the request again with the same request
1461
+ # ID, the server can check if original operation with the same request ID
1462
+ # was received, and if so, will ignore the second request. This prevents
1463
+ # clients from accidentally creating duplicate commitments.
1464
+ #
1465
+ # The request ID must be a valid UUID with the exception that zero UUID is
1466
+ # not supported (00000000-0000-0000-0000-000000000000).
1467
+ # @param etag [::String]
1468
+ # Optional. The current etag of the Instance.
1469
+ # If an etag is provided and does not match the current etag of the Instance,
1470
+ # deletion will be blocked and an ABORTED error will be returned.
1471
+ # @param validate_only [::Boolean]
1472
+ # Optional. If set, performs request validation (e.g. permission checks and
1473
+ # any other type of validation), but do not actually execute the delete.
1474
+ #
1475
+ # @yield [response, operation] Access the result along with the RPC operation
1476
+ # @yieldparam response [::Gapic::Operation]
1477
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
1478
+ #
1479
+ # @return [::Gapic::Operation]
1480
+ #
1481
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
1482
+ #
1483
+ # @example Basic example
1484
+ # require "google/cloud/alloy_db/v1"
1485
+ #
1486
+ # # Create a client object. The client can be reused for multiple calls.
1487
+ # client = Google::Cloud::AlloyDB::V1::AlloyDBAdmin::Client.new
1488
+ #
1489
+ # # Create a request. To set request fields, pass in keyword arguments.
1490
+ # request = Google::Cloud::AlloyDB::V1::DeleteInstanceRequest.new
1491
+ #
1492
+ # # Call the delete_instance method.
1493
+ # result = client.delete_instance request
1494
+ #
1495
+ # # The returned object is of type Gapic::Operation. You can use it to
1496
+ # # check the status of an operation, cancel it, or wait for results.
1497
+ # # Here is how to wait for a response.
1498
+ # result.wait_until_done! timeout: 60
1499
+ # if result.response?
1500
+ # p result.response
1501
+ # else
1502
+ # puts "No response received."
1503
+ # end
1504
+ #
1505
+ def delete_instance request, options = nil
1506
+ raise ::ArgumentError, "request must be provided" if request.nil?
1507
+
1508
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::AlloyDB::V1::DeleteInstanceRequest
1509
+
1510
+ # Converts hash and nil to an options object
1511
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1512
+
1513
+ # Customize the options with defaults
1514
+ metadata = @config.rpcs.delete_instance.metadata.to_h
1515
+
1516
+ # Set x-goog-api-client and x-goog-user-project headers
1517
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1518
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1519
+ gapic_version: ::Google::Cloud::AlloyDB::V1::VERSION
1520
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1521
+
1522
+ header_params = {}
1523
+ if request.name
1524
+ header_params["name"] = request.name
1525
+ end
1526
+
1527
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1528
+ metadata[:"x-goog-request-params"] ||= request_params_header
1529
+
1530
+ options.apply_defaults timeout: @config.rpcs.delete_instance.timeout,
1531
+ metadata: metadata,
1532
+ retry_policy: @config.rpcs.delete_instance.retry_policy
1533
+
1534
+ options.apply_defaults timeout: @config.timeout,
1535
+ metadata: @config.metadata,
1536
+ retry_policy: @config.retry_policy
1537
+
1538
+ @alloy_db_admin_stub.call_rpc :delete_instance, request, options: options do |response, operation|
1539
+ response = ::Gapic::Operation.new response, @operations_client, options: options
1540
+ yield response, operation if block_given?
1541
+ return response
1542
+ end
1543
+ rescue ::GRPC::BadStatus => e
1544
+ raise ::Google::Cloud::Error.from_error(e)
1545
+ end
1546
+
1547
+ ##
1548
+ # Forces a Failover for a highly available instance.
1549
+ # Failover promotes the HA standby instance as the new primary.
1550
+ # Imperative only.
1551
+ #
1552
+ # @overload failover_instance(request, options = nil)
1553
+ # Pass arguments to `failover_instance` via a request object, either of type
1554
+ # {::Google::Cloud::AlloyDB::V1::FailoverInstanceRequest} or an equivalent Hash.
1555
+ #
1556
+ # @param request [::Google::Cloud::AlloyDB::V1::FailoverInstanceRequest, ::Hash]
1557
+ # A request object representing the call parameters. Required. To specify no
1558
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1559
+ # @param options [::Gapic::CallOptions, ::Hash]
1560
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
1561
+ #
1562
+ # @overload failover_instance(name: nil, request_id: nil, validate_only: nil)
1563
+ # Pass arguments to `failover_instance` via keyword arguments. Note that at
1564
+ # least one keyword argument is required. To specify no parameters, or to keep all
1565
+ # the default parameter values, pass an empty Hash as a request object (see above).
1566
+ #
1567
+ # @param name [::String]
1568
+ # Required. The name of the resource. For the required format, see the
1569
+ # comment on the Instance.name field.
1570
+ # @param request_id [::String]
1571
+ # Optional. An optional request ID to identify requests. Specify a unique
1572
+ # request ID so that if you must retry your request, the server will know to
1573
+ # ignore the request if it has already been completed. The server will
1574
+ # guarantee that for at least 60 minutes after the first request.
1575
+ #
1576
+ # For example, consider a situation where you make an initial request and
1577
+ # the request times out. If you make the request again with the same request
1578
+ # ID, the server can check if original operation with the same request ID
1579
+ # was received, and if so, will ignore the second request. This prevents
1580
+ # clients from accidentally creating duplicate commitments.
1581
+ #
1582
+ # The request ID must be a valid UUID with the exception that zero UUID is
1583
+ # not supported (00000000-0000-0000-0000-000000000000).
1584
+ # @param validate_only [::Boolean]
1585
+ # Optional. If set, performs request validation (e.g. permission checks and
1586
+ # any other type of validation), but do not actually execute the failover.
1587
+ #
1588
+ # @yield [response, operation] Access the result along with the RPC operation
1589
+ # @yieldparam response [::Gapic::Operation]
1590
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
1591
+ #
1592
+ # @return [::Gapic::Operation]
1593
+ #
1594
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
1595
+ #
1596
+ # @example Basic example
1597
+ # require "google/cloud/alloy_db/v1"
1598
+ #
1599
+ # # Create a client object. The client can be reused for multiple calls.
1600
+ # client = Google::Cloud::AlloyDB::V1::AlloyDBAdmin::Client.new
1601
+ #
1602
+ # # Create a request. To set request fields, pass in keyword arguments.
1603
+ # request = Google::Cloud::AlloyDB::V1::FailoverInstanceRequest.new
1604
+ #
1605
+ # # Call the failover_instance method.
1606
+ # result = client.failover_instance request
1607
+ #
1608
+ # # The returned object is of type Gapic::Operation. You can use it to
1609
+ # # check the status of an operation, cancel it, or wait for results.
1610
+ # # Here is how to wait for a response.
1611
+ # result.wait_until_done! timeout: 60
1612
+ # if result.response?
1613
+ # p result.response
1614
+ # else
1615
+ # puts "No response received."
1616
+ # end
1617
+ #
1618
+ def failover_instance request, options = nil
1619
+ raise ::ArgumentError, "request must be provided" if request.nil?
1620
+
1621
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::AlloyDB::V1::FailoverInstanceRequest
1622
+
1623
+ # Converts hash and nil to an options object
1624
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1625
+
1626
+ # Customize the options with defaults
1627
+ metadata = @config.rpcs.failover_instance.metadata.to_h
1628
+
1629
+ # Set x-goog-api-client and x-goog-user-project headers
1630
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1631
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1632
+ gapic_version: ::Google::Cloud::AlloyDB::V1::VERSION
1633
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1634
+
1635
+ header_params = {}
1636
+ if request.name
1637
+ header_params["name"] = request.name
1638
+ end
1639
+
1640
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1641
+ metadata[:"x-goog-request-params"] ||= request_params_header
1642
+
1643
+ options.apply_defaults timeout: @config.rpcs.failover_instance.timeout,
1644
+ metadata: metadata,
1645
+ retry_policy: @config.rpcs.failover_instance.retry_policy
1646
+
1647
+ options.apply_defaults timeout: @config.timeout,
1648
+ metadata: @config.metadata,
1649
+ retry_policy: @config.retry_policy
1650
+
1651
+ @alloy_db_admin_stub.call_rpc :failover_instance, request, options: options do |response, operation|
1652
+ response = ::Gapic::Operation.new response, @operations_client, options: options
1653
+ yield response, operation if block_given?
1654
+ return response
1655
+ end
1656
+ rescue ::GRPC::BadStatus => e
1657
+ raise ::Google::Cloud::Error.from_error(e)
1658
+ end
1659
+
1660
+ ##
1661
+ # Restart an Instance in a cluster.
1662
+ # Imperative only.
1663
+ #
1664
+ # @overload restart_instance(request, options = nil)
1665
+ # Pass arguments to `restart_instance` via a request object, either of type
1666
+ # {::Google::Cloud::AlloyDB::V1::RestartInstanceRequest} or an equivalent Hash.
1667
+ #
1668
+ # @param request [::Google::Cloud::AlloyDB::V1::RestartInstanceRequest, ::Hash]
1669
+ # A request object representing the call parameters. Required. To specify no
1670
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1671
+ # @param options [::Gapic::CallOptions, ::Hash]
1672
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
1673
+ #
1674
+ # @overload restart_instance(name: nil, request_id: nil, validate_only: nil)
1675
+ # Pass arguments to `restart_instance` via keyword arguments. Note that at
1676
+ # least one keyword argument is required. To specify no parameters, or to keep all
1677
+ # the default parameter values, pass an empty Hash as a request object (see above).
1678
+ #
1679
+ # @param name [::String]
1680
+ # Required. The name of the resource. For the required format, see the
1681
+ # comment on the Instance.name field.
1682
+ # @param request_id [::String]
1683
+ # Optional. An optional request ID to identify requests. Specify a unique
1684
+ # request ID so that if you must retry your request, the server will know to
1685
+ # ignore the request if it has already been completed. The server will
1686
+ # guarantee that for at least 60 minutes after the first request.
1687
+ #
1688
+ # For example, consider a situation where you make an initial request and
1689
+ # the request times out. If you make the request again with the same request
1690
+ # ID, the server can check if original operation with the same request ID
1691
+ # was received, and if so, will ignore the second request. This prevents
1692
+ # clients from accidentally creating duplicate commitments.
1693
+ #
1694
+ # The request ID must be a valid UUID with the exception that zero UUID is
1695
+ # not supported (00000000-0000-0000-0000-000000000000).
1696
+ # @param validate_only [::Boolean]
1697
+ # Optional. If set, performs request validation (e.g. permission checks and
1698
+ # any other type of validation), but do not actually execute the restart.
1699
+ #
1700
+ # @yield [response, operation] Access the result along with the RPC operation
1701
+ # @yieldparam response [::Gapic::Operation]
1702
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
1703
+ #
1704
+ # @return [::Gapic::Operation]
1705
+ #
1706
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
1707
+ #
1708
+ # @example Basic example
1709
+ # require "google/cloud/alloy_db/v1"
1710
+ #
1711
+ # # Create a client object. The client can be reused for multiple calls.
1712
+ # client = Google::Cloud::AlloyDB::V1::AlloyDBAdmin::Client.new
1713
+ #
1714
+ # # Create a request. To set request fields, pass in keyword arguments.
1715
+ # request = Google::Cloud::AlloyDB::V1::RestartInstanceRequest.new
1716
+ #
1717
+ # # Call the restart_instance method.
1718
+ # result = client.restart_instance request
1719
+ #
1720
+ # # The returned object is of type Gapic::Operation. You can use it to
1721
+ # # check the status of an operation, cancel it, or wait for results.
1722
+ # # Here is how to wait for a response.
1723
+ # result.wait_until_done! timeout: 60
1724
+ # if result.response?
1725
+ # p result.response
1726
+ # else
1727
+ # puts "No response received."
1728
+ # end
1729
+ #
1730
+ def restart_instance request, options = nil
1731
+ raise ::ArgumentError, "request must be provided" if request.nil?
1732
+
1733
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::AlloyDB::V1::RestartInstanceRequest
1734
+
1735
+ # Converts hash and nil to an options object
1736
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1737
+
1738
+ # Customize the options with defaults
1739
+ metadata = @config.rpcs.restart_instance.metadata.to_h
1740
+
1741
+ # Set x-goog-api-client and x-goog-user-project headers
1742
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1743
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1744
+ gapic_version: ::Google::Cloud::AlloyDB::V1::VERSION
1745
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1746
+
1747
+ header_params = {}
1748
+ if request.name
1749
+ header_params["name"] = request.name
1750
+ end
1751
+
1752
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1753
+ metadata[:"x-goog-request-params"] ||= request_params_header
1754
+
1755
+ options.apply_defaults timeout: @config.rpcs.restart_instance.timeout,
1756
+ metadata: metadata,
1757
+ retry_policy: @config.rpcs.restart_instance.retry_policy
1758
+
1759
+ options.apply_defaults timeout: @config.timeout,
1760
+ metadata: @config.metadata,
1761
+ retry_policy: @config.retry_policy
1762
+
1763
+ @alloy_db_admin_stub.call_rpc :restart_instance, request, options: options do |response, operation|
1764
+ response = ::Gapic::Operation.new response, @operations_client, options: options
1765
+ yield response, operation if block_given?
1766
+ return response
1767
+ end
1768
+ rescue ::GRPC::BadStatus => e
1769
+ raise ::Google::Cloud::Error.from_error(e)
1770
+ end
1771
+
1772
+ ##
1773
+ # Lists Backups in a given project and location.
1774
+ #
1775
+ # @overload list_backups(request, options = nil)
1776
+ # Pass arguments to `list_backups` via a request object, either of type
1777
+ # {::Google::Cloud::AlloyDB::V1::ListBackupsRequest} or an equivalent Hash.
1778
+ #
1779
+ # @param request [::Google::Cloud::AlloyDB::V1::ListBackupsRequest, ::Hash]
1780
+ # A request object representing the call parameters. Required. To specify no
1781
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1782
+ # @param options [::Gapic::CallOptions, ::Hash]
1783
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
1784
+ #
1785
+ # @overload list_backups(parent: nil, page_size: nil, page_token: nil, filter: nil, order_by: nil)
1786
+ # Pass arguments to `list_backups` via keyword arguments. Note that at
1787
+ # least one keyword argument is required. To specify no parameters, or to keep all
1788
+ # the default parameter values, pass an empty Hash as a request object (see above).
1789
+ #
1790
+ # @param parent [::String]
1791
+ # Required. Parent value for ListBackupsRequest
1792
+ # @param page_size [::Integer]
1793
+ # Requested page size. Server may return fewer items than requested.
1794
+ # If unspecified, server will pick an appropriate default.
1795
+ # @param page_token [::String]
1796
+ # A token identifying a page of results the server should return.
1797
+ # @param filter [::String]
1798
+ # Filtering results
1799
+ # @param order_by [::String]
1800
+ # Hint for how to order the results
1801
+ #
1802
+ # @yield [response, operation] Access the result along with the RPC operation
1803
+ # @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::AlloyDB::V1::Backup>]
1804
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
1805
+ #
1806
+ # @return [::Gapic::PagedEnumerable<::Google::Cloud::AlloyDB::V1::Backup>]
1807
+ #
1808
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
1809
+ #
1810
+ # @example Basic example
1811
+ # require "google/cloud/alloy_db/v1"
1812
+ #
1813
+ # # Create a client object. The client can be reused for multiple calls.
1814
+ # client = Google::Cloud::AlloyDB::V1::AlloyDBAdmin::Client.new
1815
+ #
1816
+ # # Create a request. To set request fields, pass in keyword arguments.
1817
+ # request = Google::Cloud::AlloyDB::V1::ListBackupsRequest.new
1818
+ #
1819
+ # # Call the list_backups method.
1820
+ # result = client.list_backups request
1821
+ #
1822
+ # # The returned object is of type Gapic::PagedEnumerable. You can iterate
1823
+ # # over elements, and API calls will be issued to fetch pages as needed.
1824
+ # result.each do |item|
1825
+ # # Each element is of type ::Google::Cloud::AlloyDB::V1::Backup.
1826
+ # p item
1827
+ # end
1828
+ #
1829
+ def list_backups request, options = nil
1830
+ raise ::ArgumentError, "request must be provided" if request.nil?
1831
+
1832
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::AlloyDB::V1::ListBackupsRequest
1833
+
1834
+ # Converts hash and nil to an options object
1835
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1836
+
1837
+ # Customize the options with defaults
1838
+ metadata = @config.rpcs.list_backups.metadata.to_h
1839
+
1840
+ # Set x-goog-api-client and x-goog-user-project headers
1841
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1842
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1843
+ gapic_version: ::Google::Cloud::AlloyDB::V1::VERSION
1844
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1845
+
1846
+ header_params = {}
1847
+ if request.parent
1848
+ header_params["parent"] = request.parent
1849
+ end
1850
+
1851
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1852
+ metadata[:"x-goog-request-params"] ||= request_params_header
1853
+
1854
+ options.apply_defaults timeout: @config.rpcs.list_backups.timeout,
1855
+ metadata: metadata,
1856
+ retry_policy: @config.rpcs.list_backups.retry_policy
1857
+
1858
+ options.apply_defaults timeout: @config.timeout,
1859
+ metadata: @config.metadata,
1860
+ retry_policy: @config.retry_policy
1861
+
1862
+ @alloy_db_admin_stub.call_rpc :list_backups, request, options: options do |response, operation|
1863
+ response = ::Gapic::PagedEnumerable.new @alloy_db_admin_stub, :list_backups, request, response, operation, options
1864
+ yield response, operation if block_given?
1865
+ return response
1866
+ end
1867
+ rescue ::GRPC::BadStatus => e
1868
+ raise ::Google::Cloud::Error.from_error(e)
1869
+ end
1870
+
1871
+ ##
1872
+ # Gets details of a single Backup.
1873
+ #
1874
+ # @overload get_backup(request, options = nil)
1875
+ # Pass arguments to `get_backup` via a request object, either of type
1876
+ # {::Google::Cloud::AlloyDB::V1::GetBackupRequest} or an equivalent Hash.
1877
+ #
1878
+ # @param request [::Google::Cloud::AlloyDB::V1::GetBackupRequest, ::Hash]
1879
+ # A request object representing the call parameters. Required. To specify no
1880
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1881
+ # @param options [::Gapic::CallOptions, ::Hash]
1882
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
1883
+ #
1884
+ # @overload get_backup(name: nil)
1885
+ # Pass arguments to `get_backup` via keyword arguments. Note that at
1886
+ # least one keyword argument is required. To specify no parameters, or to keep all
1887
+ # the default parameter values, pass an empty Hash as a request object (see above).
1888
+ #
1889
+ # @param name [::String]
1890
+ # Required. Name of the resource
1891
+ #
1892
+ # @yield [response, operation] Access the result along with the RPC operation
1893
+ # @yieldparam response [::Google::Cloud::AlloyDB::V1::Backup]
1894
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
1895
+ #
1896
+ # @return [::Google::Cloud::AlloyDB::V1::Backup]
1897
+ #
1898
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
1899
+ #
1900
+ # @example Basic example
1901
+ # require "google/cloud/alloy_db/v1"
1902
+ #
1903
+ # # Create a client object. The client can be reused for multiple calls.
1904
+ # client = Google::Cloud::AlloyDB::V1::AlloyDBAdmin::Client.new
1905
+ #
1906
+ # # Create a request. To set request fields, pass in keyword arguments.
1907
+ # request = Google::Cloud::AlloyDB::V1::GetBackupRequest.new
1908
+ #
1909
+ # # Call the get_backup method.
1910
+ # result = client.get_backup request
1911
+ #
1912
+ # # The returned object is of type Google::Cloud::AlloyDB::V1::Backup.
1913
+ # p result
1914
+ #
1915
+ def get_backup request, options = nil
1916
+ raise ::ArgumentError, "request must be provided" if request.nil?
1917
+
1918
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::AlloyDB::V1::GetBackupRequest
1919
+
1920
+ # Converts hash and nil to an options object
1921
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1922
+
1923
+ # Customize the options with defaults
1924
+ metadata = @config.rpcs.get_backup.metadata.to_h
1925
+
1926
+ # Set x-goog-api-client and x-goog-user-project headers
1927
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1928
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1929
+ gapic_version: ::Google::Cloud::AlloyDB::V1::VERSION
1930
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1931
+
1932
+ header_params = {}
1933
+ if request.name
1934
+ header_params["name"] = request.name
1935
+ end
1936
+
1937
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1938
+ metadata[:"x-goog-request-params"] ||= request_params_header
1939
+
1940
+ options.apply_defaults timeout: @config.rpcs.get_backup.timeout,
1941
+ metadata: metadata,
1942
+ retry_policy: @config.rpcs.get_backup.retry_policy
1943
+
1944
+ options.apply_defaults timeout: @config.timeout,
1945
+ metadata: @config.metadata,
1946
+ retry_policy: @config.retry_policy
1947
+
1948
+ @alloy_db_admin_stub.call_rpc :get_backup, request, options: options do |response, operation|
1949
+ yield response, operation if block_given?
1950
+ return response
1951
+ end
1952
+ rescue ::GRPC::BadStatus => e
1953
+ raise ::Google::Cloud::Error.from_error(e)
1954
+ end
1955
+
1956
+ ##
1957
+ # Creates a new Backup in a given project and location.
1958
+ #
1959
+ # @overload create_backup(request, options = nil)
1960
+ # Pass arguments to `create_backup` via a request object, either of type
1961
+ # {::Google::Cloud::AlloyDB::V1::CreateBackupRequest} or an equivalent Hash.
1962
+ #
1963
+ # @param request [::Google::Cloud::AlloyDB::V1::CreateBackupRequest, ::Hash]
1964
+ # A request object representing the call parameters. Required. To specify no
1965
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1966
+ # @param options [::Gapic::CallOptions, ::Hash]
1967
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
1968
+ #
1969
+ # @overload create_backup(parent: nil, backup_id: nil, backup: nil, request_id: nil, validate_only: nil)
1970
+ # Pass arguments to `create_backup` via keyword arguments. Note that at
1971
+ # least one keyword argument is required. To specify no parameters, or to keep all
1972
+ # the default parameter values, pass an empty Hash as a request object (see above).
1973
+ #
1974
+ # @param parent [::String]
1975
+ # Required. Value for parent.
1976
+ # @param backup_id [::String]
1977
+ # Required. ID of the requesting object.
1978
+ # @param backup [::Google::Cloud::AlloyDB::V1::Backup, ::Hash]
1979
+ # Required. The resource being created
1980
+ # @param request_id [::String]
1981
+ # Optional. An optional request ID to identify requests. Specify a unique
1982
+ # request ID so that if you must retry your request, the server will know to
1983
+ # ignore the request if it has already been completed. The server will
1984
+ # guarantee that for at least 60 minutes since the first request.
1985
+ #
1986
+ # For example, consider a situation where you make an initial request and
1987
+ # the request times out. If you make the request again with the same request
1988
+ # ID, the server can check if original operation with the same request ID
1989
+ # was received, and if so, will ignore the second request. This prevents
1990
+ # clients from accidentally creating duplicate commitments.
1991
+ #
1992
+ # The request ID must be a valid UUID with the exception that zero UUID is
1993
+ # not supported (00000000-0000-0000-0000-000000000000).
1994
+ # @param validate_only [::Boolean]
1995
+ # Optional. If set, the backend validates the request, but doesn't actually
1996
+ # execute it.
1997
+ #
1998
+ # @yield [response, operation] Access the result along with the RPC operation
1999
+ # @yieldparam response [::Gapic::Operation]
2000
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
2001
+ #
2002
+ # @return [::Gapic::Operation]
2003
+ #
2004
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
2005
+ #
2006
+ # @example Basic example
2007
+ # require "google/cloud/alloy_db/v1"
2008
+ #
2009
+ # # Create a client object. The client can be reused for multiple calls.
2010
+ # client = Google::Cloud::AlloyDB::V1::AlloyDBAdmin::Client.new
2011
+ #
2012
+ # # Create a request. To set request fields, pass in keyword arguments.
2013
+ # request = Google::Cloud::AlloyDB::V1::CreateBackupRequest.new
2014
+ #
2015
+ # # Call the create_backup method.
2016
+ # result = client.create_backup request
2017
+ #
2018
+ # # The returned object is of type Gapic::Operation. You can use it to
2019
+ # # check the status of an operation, cancel it, or wait for results.
2020
+ # # Here is how to wait for a response.
2021
+ # result.wait_until_done! timeout: 60
2022
+ # if result.response?
2023
+ # p result.response
2024
+ # else
2025
+ # puts "No response received."
2026
+ # end
2027
+ #
2028
+ def create_backup request, options = nil
2029
+ raise ::ArgumentError, "request must be provided" if request.nil?
2030
+
2031
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::AlloyDB::V1::CreateBackupRequest
2032
+
2033
+ # Converts hash and nil to an options object
2034
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
2035
+
2036
+ # Customize the options with defaults
2037
+ metadata = @config.rpcs.create_backup.metadata.to_h
2038
+
2039
+ # Set x-goog-api-client and x-goog-user-project headers
2040
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
2041
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
2042
+ gapic_version: ::Google::Cloud::AlloyDB::V1::VERSION
2043
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
2044
+
2045
+ header_params = {}
2046
+ if request.parent
2047
+ header_params["parent"] = request.parent
2048
+ end
2049
+
2050
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
2051
+ metadata[:"x-goog-request-params"] ||= request_params_header
2052
+
2053
+ options.apply_defaults timeout: @config.rpcs.create_backup.timeout,
2054
+ metadata: metadata,
2055
+ retry_policy: @config.rpcs.create_backup.retry_policy
2056
+
2057
+ options.apply_defaults timeout: @config.timeout,
2058
+ metadata: @config.metadata,
2059
+ retry_policy: @config.retry_policy
2060
+
2061
+ @alloy_db_admin_stub.call_rpc :create_backup, request, options: options do |response, operation|
2062
+ response = ::Gapic::Operation.new response, @operations_client, options: options
2063
+ yield response, operation if block_given?
2064
+ return response
2065
+ end
2066
+ rescue ::GRPC::BadStatus => e
2067
+ raise ::Google::Cloud::Error.from_error(e)
2068
+ end
2069
+
2070
+ ##
2071
+ # Updates the parameters of a single Backup.
2072
+ #
2073
+ # @overload update_backup(request, options = nil)
2074
+ # Pass arguments to `update_backup` via a request object, either of type
2075
+ # {::Google::Cloud::AlloyDB::V1::UpdateBackupRequest} or an equivalent Hash.
2076
+ #
2077
+ # @param request [::Google::Cloud::AlloyDB::V1::UpdateBackupRequest, ::Hash]
2078
+ # A request object representing the call parameters. Required. To specify no
2079
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
2080
+ # @param options [::Gapic::CallOptions, ::Hash]
2081
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
2082
+ #
2083
+ # @overload update_backup(update_mask: nil, backup: nil, request_id: nil, validate_only: nil, allow_missing: nil)
2084
+ # Pass arguments to `update_backup` via keyword arguments. Note that at
2085
+ # least one keyword argument is required. To specify no parameters, or to keep all
2086
+ # the default parameter values, pass an empty Hash as a request object (see above).
2087
+ #
2088
+ # @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
2089
+ # Optional. Field mask is used to specify the fields to be overwritten in the
2090
+ # Backup resource by the update.
2091
+ # The fields specified in the update_mask are relative to the resource, not
2092
+ # the full request. A field will be overwritten if it is in the mask. If the
2093
+ # user does not provide a mask then all fields will be overwritten.
2094
+ # @param backup [::Google::Cloud::AlloyDB::V1::Backup, ::Hash]
2095
+ # Required. The resource being updated
2096
+ # @param request_id [::String]
2097
+ # Optional. An optional request ID to identify requests. Specify a unique
2098
+ # request ID so that if you must retry your request, the server will know to
2099
+ # ignore the request if it has already been completed. The server will
2100
+ # guarantee that for at least 60 minutes since the first request.
2101
+ #
2102
+ # For example, consider a situation where you make an initial request and
2103
+ # the request times out. If you make the request again with the same request
2104
+ # ID, the server can check if original operation with the same request ID
2105
+ # was received, and if so, will ignore the second request. This prevents
2106
+ # clients from accidentally creating duplicate commitments.
2107
+ #
2108
+ # The request ID must be a valid UUID with the exception that zero UUID is
2109
+ # not supported (00000000-0000-0000-0000-000000000000).
2110
+ # @param validate_only [::Boolean]
2111
+ # Optional. If set, the backend validates the request, but doesn't actually
2112
+ # execute it.
2113
+ # @param allow_missing [::Boolean]
2114
+ # Optional. If set to true, update succeeds even if instance is not found. In
2115
+ # that case, a new backup is created and `update_mask` is ignored.
2116
+ #
2117
+ # @yield [response, operation] Access the result along with the RPC operation
2118
+ # @yieldparam response [::Gapic::Operation]
2119
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
2120
+ #
2121
+ # @return [::Gapic::Operation]
2122
+ #
2123
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
2124
+ #
2125
+ # @example Basic example
2126
+ # require "google/cloud/alloy_db/v1"
2127
+ #
2128
+ # # Create a client object. The client can be reused for multiple calls.
2129
+ # client = Google::Cloud::AlloyDB::V1::AlloyDBAdmin::Client.new
2130
+ #
2131
+ # # Create a request. To set request fields, pass in keyword arguments.
2132
+ # request = Google::Cloud::AlloyDB::V1::UpdateBackupRequest.new
2133
+ #
2134
+ # # Call the update_backup method.
2135
+ # result = client.update_backup request
2136
+ #
2137
+ # # The returned object is of type Gapic::Operation. You can use it to
2138
+ # # check the status of an operation, cancel it, or wait for results.
2139
+ # # Here is how to wait for a response.
2140
+ # result.wait_until_done! timeout: 60
2141
+ # if result.response?
2142
+ # p result.response
2143
+ # else
2144
+ # puts "No response received."
2145
+ # end
2146
+ #
2147
+ def update_backup request, options = nil
2148
+ raise ::ArgumentError, "request must be provided" if request.nil?
2149
+
2150
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::AlloyDB::V1::UpdateBackupRequest
2151
+
2152
+ # Converts hash and nil to an options object
2153
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
2154
+
2155
+ # Customize the options with defaults
2156
+ metadata = @config.rpcs.update_backup.metadata.to_h
2157
+
2158
+ # Set x-goog-api-client and x-goog-user-project headers
2159
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
2160
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
2161
+ gapic_version: ::Google::Cloud::AlloyDB::V1::VERSION
2162
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
2163
+
2164
+ header_params = {}
2165
+ if request.backup&.name
2166
+ header_params["backup.name"] = request.backup.name
2167
+ end
2168
+
2169
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
2170
+ metadata[:"x-goog-request-params"] ||= request_params_header
2171
+
2172
+ options.apply_defaults timeout: @config.rpcs.update_backup.timeout,
2173
+ metadata: metadata,
2174
+ retry_policy: @config.rpcs.update_backup.retry_policy
2175
+
2176
+ options.apply_defaults timeout: @config.timeout,
2177
+ metadata: @config.metadata,
2178
+ retry_policy: @config.retry_policy
2179
+
2180
+ @alloy_db_admin_stub.call_rpc :update_backup, request, options: options do |response, operation|
2181
+ response = ::Gapic::Operation.new response, @operations_client, options: options
2182
+ yield response, operation if block_given?
2183
+ return response
2184
+ end
2185
+ rescue ::GRPC::BadStatus => e
2186
+ raise ::Google::Cloud::Error.from_error(e)
2187
+ end
2188
+
2189
+ ##
2190
+ # Deletes a single Backup.
2191
+ #
2192
+ # @overload delete_backup(request, options = nil)
2193
+ # Pass arguments to `delete_backup` via a request object, either of type
2194
+ # {::Google::Cloud::AlloyDB::V1::DeleteBackupRequest} or an equivalent Hash.
2195
+ #
2196
+ # @param request [::Google::Cloud::AlloyDB::V1::DeleteBackupRequest, ::Hash]
2197
+ # A request object representing the call parameters. Required. To specify no
2198
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
2199
+ # @param options [::Gapic::CallOptions, ::Hash]
2200
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
2201
+ #
2202
+ # @overload delete_backup(name: nil, request_id: nil, validate_only: nil, etag: nil)
2203
+ # Pass arguments to `delete_backup` via keyword arguments. Note that at
2204
+ # least one keyword argument is required. To specify no parameters, or to keep all
2205
+ # the default parameter values, pass an empty Hash as a request object (see above).
2206
+ #
2207
+ # @param name [::String]
2208
+ # Required. Name of the resource. For the required format, see the comment on
2209
+ # the Backup.name field.
2210
+ # @param request_id [::String]
2211
+ # Optional. An optional request ID to identify requests. Specify a unique
2212
+ # request ID so that if you must retry your request, the server will know to
2213
+ # ignore the request if it has already been completed. The server will
2214
+ # guarantee that for at least 60 minutes after the first request.
2215
+ #
2216
+ # For example, consider a situation where you make an initial request and
2217
+ # the request times out. If you make the request again with the same request
2218
+ # ID, the server can check if original operation with the same request ID
2219
+ # was received, and if so, will ignore the second request. This prevents
2220
+ # clients from accidentally creating duplicate commitments.
2221
+ #
2222
+ # The request ID must be a valid UUID with the exception that zero UUID is
2223
+ # not supported (00000000-0000-0000-0000-000000000000).
2224
+ # @param validate_only [::Boolean]
2225
+ # Optional. If set, the backend validates the request, but doesn't actually
2226
+ # execute it.
2227
+ # @param etag [::String]
2228
+ # Optional. The current etag of the Backup.
2229
+ # If an etag is provided and does not match the current etag of the Backup,
2230
+ # deletion will be blocked and an ABORTED error will be returned.
2231
+ #
2232
+ # @yield [response, operation] Access the result along with the RPC operation
2233
+ # @yieldparam response [::Gapic::Operation]
2234
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
2235
+ #
2236
+ # @return [::Gapic::Operation]
2237
+ #
2238
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
2239
+ #
2240
+ # @example Basic example
2241
+ # require "google/cloud/alloy_db/v1"
2242
+ #
2243
+ # # Create a client object. The client can be reused for multiple calls.
2244
+ # client = Google::Cloud::AlloyDB::V1::AlloyDBAdmin::Client.new
2245
+ #
2246
+ # # Create a request. To set request fields, pass in keyword arguments.
2247
+ # request = Google::Cloud::AlloyDB::V1::DeleteBackupRequest.new
2248
+ #
2249
+ # # Call the delete_backup method.
2250
+ # result = client.delete_backup request
2251
+ #
2252
+ # # The returned object is of type Gapic::Operation. You can use it to
2253
+ # # check the status of an operation, cancel it, or wait for results.
2254
+ # # Here is how to wait for a response.
2255
+ # result.wait_until_done! timeout: 60
2256
+ # if result.response?
2257
+ # p result.response
2258
+ # else
2259
+ # puts "No response received."
2260
+ # end
2261
+ #
2262
+ def delete_backup request, options = nil
2263
+ raise ::ArgumentError, "request must be provided" if request.nil?
2264
+
2265
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::AlloyDB::V1::DeleteBackupRequest
2266
+
2267
+ # Converts hash and nil to an options object
2268
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
2269
+
2270
+ # Customize the options with defaults
2271
+ metadata = @config.rpcs.delete_backup.metadata.to_h
2272
+
2273
+ # Set x-goog-api-client and x-goog-user-project headers
2274
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
2275
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
2276
+ gapic_version: ::Google::Cloud::AlloyDB::V1::VERSION
2277
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
2278
+
2279
+ header_params = {}
2280
+ if request.name
2281
+ header_params["name"] = request.name
2282
+ end
2283
+
2284
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
2285
+ metadata[:"x-goog-request-params"] ||= request_params_header
2286
+
2287
+ options.apply_defaults timeout: @config.rpcs.delete_backup.timeout,
2288
+ metadata: metadata,
2289
+ retry_policy: @config.rpcs.delete_backup.retry_policy
2290
+
2291
+ options.apply_defaults timeout: @config.timeout,
2292
+ metadata: @config.metadata,
2293
+ retry_policy: @config.retry_policy
2294
+
2295
+ @alloy_db_admin_stub.call_rpc :delete_backup, request, options: options do |response, operation|
2296
+ response = ::Gapic::Operation.new response, @operations_client, options: options
2297
+ yield response, operation if block_given?
2298
+ return response
2299
+ end
2300
+ rescue ::GRPC::BadStatus => e
2301
+ raise ::Google::Cloud::Error.from_error(e)
2302
+ end
2303
+
2304
+ ##
2305
+ # Lists SupportedDatabaseFlags for a given project and location.
2306
+ #
2307
+ # @overload list_supported_database_flags(request, options = nil)
2308
+ # Pass arguments to `list_supported_database_flags` via a request object, either of type
2309
+ # {::Google::Cloud::AlloyDB::V1::ListSupportedDatabaseFlagsRequest} or an equivalent Hash.
2310
+ #
2311
+ # @param request [::Google::Cloud::AlloyDB::V1::ListSupportedDatabaseFlagsRequest, ::Hash]
2312
+ # A request object representing the call parameters. Required. To specify no
2313
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
2314
+ # @param options [::Gapic::CallOptions, ::Hash]
2315
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
2316
+ #
2317
+ # @overload list_supported_database_flags(parent: nil, page_size: nil, page_token: nil)
2318
+ # Pass arguments to `list_supported_database_flags` via keyword arguments. Note that at
2319
+ # least one keyword argument is required. To specify no parameters, or to keep all
2320
+ # the default parameter values, pass an empty Hash as a request object (see above).
2321
+ #
2322
+ # @param parent [::String]
2323
+ # Required. The name of the parent resource. The required format is:
2324
+ # * projects/\\{project}/locations/\\{location}
2325
+ #
2326
+ # Regardless of the parent specified here, as long it is contains a valid
2327
+ # project and location, the service will return a static list of supported
2328
+ # flags resources. Note that we do not yet support region-specific
2329
+ # flags.
2330
+ # @param page_size [::Integer]
2331
+ # Requested page size. Server may return fewer items than requested.
2332
+ # If unspecified, server will pick an appropriate default.
2333
+ # @param page_token [::String]
2334
+ # A token identifying a page of results the server should return.
2335
+ #
2336
+ # @yield [response, operation] Access the result along with the RPC operation
2337
+ # @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::AlloyDB::V1::SupportedDatabaseFlag>]
2338
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
2339
+ #
2340
+ # @return [::Gapic::PagedEnumerable<::Google::Cloud::AlloyDB::V1::SupportedDatabaseFlag>]
2341
+ #
2342
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
2343
+ #
2344
+ # @example Basic example
2345
+ # require "google/cloud/alloy_db/v1"
2346
+ #
2347
+ # # Create a client object. The client can be reused for multiple calls.
2348
+ # client = Google::Cloud::AlloyDB::V1::AlloyDBAdmin::Client.new
2349
+ #
2350
+ # # Create a request. To set request fields, pass in keyword arguments.
2351
+ # request = Google::Cloud::AlloyDB::V1::ListSupportedDatabaseFlagsRequest.new
2352
+ #
2353
+ # # Call the list_supported_database_flags method.
2354
+ # result = client.list_supported_database_flags request
2355
+ #
2356
+ # # The returned object is of type Gapic::PagedEnumerable. You can iterate
2357
+ # # over elements, and API calls will be issued to fetch pages as needed.
2358
+ # result.each do |item|
2359
+ # # Each element is of type ::Google::Cloud::AlloyDB::V1::SupportedDatabaseFlag.
2360
+ # p item
2361
+ # end
2362
+ #
2363
+ def list_supported_database_flags request, options = nil
2364
+ raise ::ArgumentError, "request must be provided" if request.nil?
2365
+
2366
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::AlloyDB::V1::ListSupportedDatabaseFlagsRequest
2367
+
2368
+ # Converts hash and nil to an options object
2369
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
2370
+
2371
+ # Customize the options with defaults
2372
+ metadata = @config.rpcs.list_supported_database_flags.metadata.to_h
2373
+
2374
+ # Set x-goog-api-client and x-goog-user-project headers
2375
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
2376
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
2377
+ gapic_version: ::Google::Cloud::AlloyDB::V1::VERSION
2378
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
2379
+
2380
+ header_params = {}
2381
+ if request.parent
2382
+ header_params["parent"] = request.parent
2383
+ end
2384
+
2385
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
2386
+ metadata[:"x-goog-request-params"] ||= request_params_header
2387
+
2388
+ options.apply_defaults timeout: @config.rpcs.list_supported_database_flags.timeout,
2389
+ metadata: metadata,
2390
+ retry_policy: @config.rpcs.list_supported_database_flags.retry_policy
2391
+
2392
+ options.apply_defaults timeout: @config.timeout,
2393
+ metadata: @config.metadata,
2394
+ retry_policy: @config.retry_policy
2395
+
2396
+ @alloy_db_admin_stub.call_rpc :list_supported_database_flags, request, options: options do |response, operation|
2397
+ response = ::Gapic::PagedEnumerable.new @alloy_db_admin_stub, :list_supported_database_flags, request, response, operation, options
2398
+ yield response, operation if block_given?
2399
+ return response
2400
+ end
2401
+ rescue ::GRPC::BadStatus => e
2402
+ raise ::Google::Cloud::Error.from_error(e)
2403
+ end
2404
+
2405
+ ##
2406
+ # Configuration class for the AlloyDBAdmin API.
2407
+ #
2408
+ # This class represents the configuration for AlloyDBAdmin,
2409
+ # providing control over timeouts, retry behavior, logging, transport
2410
+ # parameters, and other low-level controls. Certain parameters can also be
2411
+ # applied individually to specific RPCs. See
2412
+ # {::Google::Cloud::AlloyDB::V1::AlloyDBAdmin::Client::Configuration::Rpcs}
2413
+ # for a list of RPCs that can be configured independently.
2414
+ #
2415
+ # Configuration can be applied globally to all clients, or to a single client
2416
+ # on construction.
2417
+ #
2418
+ # @example
2419
+ #
2420
+ # # Modify the global config, setting the timeout for
2421
+ # # list_clusters to 20 seconds,
2422
+ # # and all remaining timeouts to 10 seconds.
2423
+ # ::Google::Cloud::AlloyDB::V1::AlloyDBAdmin::Client.configure do |config|
2424
+ # config.timeout = 10.0
2425
+ # config.rpcs.list_clusters.timeout = 20.0
2426
+ # end
2427
+ #
2428
+ # # Apply the above configuration only to a new client.
2429
+ # client = ::Google::Cloud::AlloyDB::V1::AlloyDBAdmin::Client.new do |config|
2430
+ # config.timeout = 10.0
2431
+ # config.rpcs.list_clusters.timeout = 20.0
2432
+ # end
2433
+ #
2434
+ # @!attribute [rw] endpoint
2435
+ # The hostname or hostname:port of the service endpoint.
2436
+ # Defaults to `"alloydb.googleapis.com"`.
2437
+ # @return [::String]
2438
+ # @!attribute [rw] credentials
2439
+ # Credentials to send with calls. You may provide any of the following types:
2440
+ # * (`String`) The path to a service account key file in JSON format
2441
+ # * (`Hash`) A service account key as a Hash
2442
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
2443
+ # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
2444
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
2445
+ # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
2446
+ # * (`GRPC::Core::Channel`) a gRPC channel with included credentials
2447
+ # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
2448
+ # * (`nil`) indicating no credentials
2449
+ # @return [::Object]
2450
+ # @!attribute [rw] scope
2451
+ # The OAuth scopes
2452
+ # @return [::Array<::String>]
2453
+ # @!attribute [rw] lib_name
2454
+ # The library name as recorded in instrumentation and logging
2455
+ # @return [::String]
2456
+ # @!attribute [rw] lib_version
2457
+ # The library version as recorded in instrumentation and logging
2458
+ # @return [::String]
2459
+ # @!attribute [rw] channel_args
2460
+ # Extra parameters passed to the gRPC channel. Note: this is ignored if a
2461
+ # `GRPC::Core::Channel` object is provided as the credential.
2462
+ # @return [::Hash]
2463
+ # @!attribute [rw] interceptors
2464
+ # An array of interceptors that are run before calls are executed.
2465
+ # @return [::Array<::GRPC::ClientInterceptor>]
2466
+ # @!attribute [rw] timeout
2467
+ # The call timeout in seconds.
2468
+ # @return [::Numeric]
2469
+ # @!attribute [rw] metadata
2470
+ # Additional gRPC headers to be sent with the call.
2471
+ # @return [::Hash{::Symbol=>::String}]
2472
+ # @!attribute [rw] retry_policy
2473
+ # The retry policy. The value is a hash with the following keys:
2474
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
2475
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
2476
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
2477
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
2478
+ # trigger a retry.
2479
+ # @return [::Hash]
2480
+ # @!attribute [rw] quota_project
2481
+ # A separate project against which to charge quota.
2482
+ # @return [::String]
2483
+ #
2484
+ class Configuration
2485
+ extend ::Gapic::Config
2486
+
2487
+ config_attr :endpoint, "alloydb.googleapis.com", ::String
2488
+ config_attr :credentials, nil do |value|
2489
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
2490
+ allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
2491
+ allowed.any? { |klass| klass === value }
2492
+ end
2493
+ config_attr :scope, nil, ::String, ::Array, nil
2494
+ config_attr :lib_name, nil, ::String, nil
2495
+ config_attr :lib_version, nil, ::String, nil
2496
+ config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
2497
+ config_attr :interceptors, nil, ::Array, nil
2498
+ config_attr :timeout, nil, ::Numeric, nil
2499
+ config_attr :metadata, nil, ::Hash, nil
2500
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
2501
+ config_attr :quota_project, nil, ::String, nil
2502
+
2503
+ # @private
2504
+ def initialize parent_config = nil
2505
+ @parent_config = parent_config unless parent_config.nil?
2506
+
2507
+ yield self if block_given?
2508
+ end
2509
+
2510
+ ##
2511
+ # Configurations for individual RPCs
2512
+ # @return [Rpcs]
2513
+ #
2514
+ def rpcs
2515
+ @rpcs ||= begin
2516
+ parent_rpcs = nil
2517
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
2518
+ Rpcs.new parent_rpcs
2519
+ end
2520
+ end
2521
+
2522
+ ##
2523
+ # Configuration RPC class for the AlloyDBAdmin API.
2524
+ #
2525
+ # Includes fields providing the configuration for each RPC in this service.
2526
+ # Each configuration object is of type `Gapic::Config::Method` and includes
2527
+ # the following configuration fields:
2528
+ #
2529
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
2530
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
2531
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
2532
+ # include the following keys:
2533
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
2534
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
2535
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
2536
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
2537
+ # trigger a retry.
2538
+ #
2539
+ class Rpcs
2540
+ ##
2541
+ # RPC-specific configuration for `list_clusters`
2542
+ # @return [::Gapic::Config::Method]
2543
+ #
2544
+ attr_reader :list_clusters
2545
+ ##
2546
+ # RPC-specific configuration for `get_cluster`
2547
+ # @return [::Gapic::Config::Method]
2548
+ #
2549
+ attr_reader :get_cluster
2550
+ ##
2551
+ # RPC-specific configuration for `create_cluster`
2552
+ # @return [::Gapic::Config::Method]
2553
+ #
2554
+ attr_reader :create_cluster
2555
+ ##
2556
+ # RPC-specific configuration for `update_cluster`
2557
+ # @return [::Gapic::Config::Method]
2558
+ #
2559
+ attr_reader :update_cluster
2560
+ ##
2561
+ # RPC-specific configuration for `delete_cluster`
2562
+ # @return [::Gapic::Config::Method]
2563
+ #
2564
+ attr_reader :delete_cluster
2565
+ ##
2566
+ # RPC-specific configuration for `restore_cluster`
2567
+ # @return [::Gapic::Config::Method]
2568
+ #
2569
+ attr_reader :restore_cluster
2570
+ ##
2571
+ # RPC-specific configuration for `list_instances`
2572
+ # @return [::Gapic::Config::Method]
2573
+ #
2574
+ attr_reader :list_instances
2575
+ ##
2576
+ # RPC-specific configuration for `get_instance`
2577
+ # @return [::Gapic::Config::Method]
2578
+ #
2579
+ attr_reader :get_instance
2580
+ ##
2581
+ # RPC-specific configuration for `create_instance`
2582
+ # @return [::Gapic::Config::Method]
2583
+ #
2584
+ attr_reader :create_instance
2585
+ ##
2586
+ # RPC-specific configuration for `batch_create_instances`
2587
+ # @return [::Gapic::Config::Method]
2588
+ #
2589
+ attr_reader :batch_create_instances
2590
+ ##
2591
+ # RPC-specific configuration for `update_instance`
2592
+ # @return [::Gapic::Config::Method]
2593
+ #
2594
+ attr_reader :update_instance
2595
+ ##
2596
+ # RPC-specific configuration for `delete_instance`
2597
+ # @return [::Gapic::Config::Method]
2598
+ #
2599
+ attr_reader :delete_instance
2600
+ ##
2601
+ # RPC-specific configuration for `failover_instance`
2602
+ # @return [::Gapic::Config::Method]
2603
+ #
2604
+ attr_reader :failover_instance
2605
+ ##
2606
+ # RPC-specific configuration for `restart_instance`
2607
+ # @return [::Gapic::Config::Method]
2608
+ #
2609
+ attr_reader :restart_instance
2610
+ ##
2611
+ # RPC-specific configuration for `list_backups`
2612
+ # @return [::Gapic::Config::Method]
2613
+ #
2614
+ attr_reader :list_backups
2615
+ ##
2616
+ # RPC-specific configuration for `get_backup`
2617
+ # @return [::Gapic::Config::Method]
2618
+ #
2619
+ attr_reader :get_backup
2620
+ ##
2621
+ # RPC-specific configuration for `create_backup`
2622
+ # @return [::Gapic::Config::Method]
2623
+ #
2624
+ attr_reader :create_backup
2625
+ ##
2626
+ # RPC-specific configuration for `update_backup`
2627
+ # @return [::Gapic::Config::Method]
2628
+ #
2629
+ attr_reader :update_backup
2630
+ ##
2631
+ # RPC-specific configuration for `delete_backup`
2632
+ # @return [::Gapic::Config::Method]
2633
+ #
2634
+ attr_reader :delete_backup
2635
+ ##
2636
+ # RPC-specific configuration for `list_supported_database_flags`
2637
+ # @return [::Gapic::Config::Method]
2638
+ #
2639
+ attr_reader :list_supported_database_flags
2640
+
2641
+ # @private
2642
+ def initialize parent_rpcs = nil
2643
+ list_clusters_config = parent_rpcs.list_clusters if parent_rpcs.respond_to? :list_clusters
2644
+ @list_clusters = ::Gapic::Config::Method.new list_clusters_config
2645
+ get_cluster_config = parent_rpcs.get_cluster if parent_rpcs.respond_to? :get_cluster
2646
+ @get_cluster = ::Gapic::Config::Method.new get_cluster_config
2647
+ create_cluster_config = parent_rpcs.create_cluster if parent_rpcs.respond_to? :create_cluster
2648
+ @create_cluster = ::Gapic::Config::Method.new create_cluster_config
2649
+ update_cluster_config = parent_rpcs.update_cluster if parent_rpcs.respond_to? :update_cluster
2650
+ @update_cluster = ::Gapic::Config::Method.new update_cluster_config
2651
+ delete_cluster_config = parent_rpcs.delete_cluster if parent_rpcs.respond_to? :delete_cluster
2652
+ @delete_cluster = ::Gapic::Config::Method.new delete_cluster_config
2653
+ restore_cluster_config = parent_rpcs.restore_cluster if parent_rpcs.respond_to? :restore_cluster
2654
+ @restore_cluster = ::Gapic::Config::Method.new restore_cluster_config
2655
+ list_instances_config = parent_rpcs.list_instances if parent_rpcs.respond_to? :list_instances
2656
+ @list_instances = ::Gapic::Config::Method.new list_instances_config
2657
+ get_instance_config = parent_rpcs.get_instance if parent_rpcs.respond_to? :get_instance
2658
+ @get_instance = ::Gapic::Config::Method.new get_instance_config
2659
+ create_instance_config = parent_rpcs.create_instance if parent_rpcs.respond_to? :create_instance
2660
+ @create_instance = ::Gapic::Config::Method.new create_instance_config
2661
+ batch_create_instances_config = parent_rpcs.batch_create_instances if parent_rpcs.respond_to? :batch_create_instances
2662
+ @batch_create_instances = ::Gapic::Config::Method.new batch_create_instances_config
2663
+ update_instance_config = parent_rpcs.update_instance if parent_rpcs.respond_to? :update_instance
2664
+ @update_instance = ::Gapic::Config::Method.new update_instance_config
2665
+ delete_instance_config = parent_rpcs.delete_instance if parent_rpcs.respond_to? :delete_instance
2666
+ @delete_instance = ::Gapic::Config::Method.new delete_instance_config
2667
+ failover_instance_config = parent_rpcs.failover_instance if parent_rpcs.respond_to? :failover_instance
2668
+ @failover_instance = ::Gapic::Config::Method.new failover_instance_config
2669
+ restart_instance_config = parent_rpcs.restart_instance if parent_rpcs.respond_to? :restart_instance
2670
+ @restart_instance = ::Gapic::Config::Method.new restart_instance_config
2671
+ list_backups_config = parent_rpcs.list_backups if parent_rpcs.respond_to? :list_backups
2672
+ @list_backups = ::Gapic::Config::Method.new list_backups_config
2673
+ get_backup_config = parent_rpcs.get_backup if parent_rpcs.respond_to? :get_backup
2674
+ @get_backup = ::Gapic::Config::Method.new get_backup_config
2675
+ create_backup_config = parent_rpcs.create_backup if parent_rpcs.respond_to? :create_backup
2676
+ @create_backup = ::Gapic::Config::Method.new create_backup_config
2677
+ update_backup_config = parent_rpcs.update_backup if parent_rpcs.respond_to? :update_backup
2678
+ @update_backup = ::Gapic::Config::Method.new update_backup_config
2679
+ delete_backup_config = parent_rpcs.delete_backup if parent_rpcs.respond_to? :delete_backup
2680
+ @delete_backup = ::Gapic::Config::Method.new delete_backup_config
2681
+ list_supported_database_flags_config = parent_rpcs.list_supported_database_flags if parent_rpcs.respond_to? :list_supported_database_flags
2682
+ @list_supported_database_flags = ::Gapic::Config::Method.new list_supported_database_flags_config
2683
+
2684
+ yield self if block_given?
2685
+ end
2686
+ end
2687
+ end
2688
+ end
2689
+ end
2690
+ end
2691
+ end
2692
+ end
2693
+ end