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