google-cloud-alloy_db-v1 0.9.2 → 0.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -213,14 +213,26 @@ module Google
213
213
  universe_domain: @config.universe_domain,
214
214
  channel_args: @config.channel_args,
215
215
  interceptors: @config.interceptors,
216
- channel_pool_config: @config.channel_pool
216
+ channel_pool_config: @config.channel_pool,
217
+ logger: @config.logger
217
218
  )
218
219
 
220
+ @alloy_db_admin_stub.stub_logger&.info do |entry|
221
+ entry.set_system_name
222
+ entry.set_service
223
+ entry.message = "Created client for #{entry.service}"
224
+ entry.set_credentials_fields credentials
225
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
226
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
227
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
228
+ end
229
+
219
230
  @location_client = Google::Cloud::Location::Locations::Client.new do |config|
220
231
  config.credentials = credentials
221
232
  config.quota_project = @quota_project_id
222
233
  config.endpoint = @alloy_db_admin_stub.endpoint
223
234
  config.universe_domain = @alloy_db_admin_stub.universe_domain
235
+ config.logger = @alloy_db_admin_stub.logger if config.respond_to? :logger=
224
236
  end
225
237
 
226
238
  @iam_policy_client = Google::Iam::V1::IAMPolicy::Client.new do |config|
@@ -228,6 +240,7 @@ module Google
228
240
  config.quota_project = @quota_project_id
229
241
  config.endpoint = @alloy_db_admin_stub.endpoint
230
242
  config.universe_domain = @alloy_db_admin_stub.universe_domain
243
+ config.logger = @alloy_db_admin_stub.logger if config.respond_to? :logger=
231
244
  end
232
245
  end
233
246
 
@@ -252,6 +265,15 @@ module Google
252
265
  #
253
266
  attr_reader :iam_policy_client
254
267
 
268
+ ##
269
+ # The logger used for request/response debug logging.
270
+ #
271
+ # @return [Logger]
272
+ #
273
+ def logger
274
+ @alloy_db_admin_stub.logger
275
+ end
276
+
255
277
  # Service calls
256
278
 
257
279
  ##
@@ -351,7 +373,7 @@ module Google
351
373
  @alloy_db_admin_stub.call_rpc :list_clusters, request, options: options do |response, operation|
352
374
  response = ::Gapic::PagedEnumerable.new @alloy_db_admin_stub, :list_clusters, request, response, operation, options
353
375
  yield response, operation if block_given?
354
- return response
376
+ throw :response, response
355
377
  end
356
378
  rescue ::GRPC::BadStatus => e
357
379
  raise ::Google::Cloud::Error.from_error(e)
@@ -441,7 +463,6 @@ module Google
441
463
 
442
464
  @alloy_db_admin_stub.call_rpc :get_cluster, request, options: options do |response, operation|
443
465
  yield response, operation if block_given?
444
- return response
445
466
  end
446
467
  rescue ::GRPC::BadStatus => e
447
468
  raise ::Google::Cloud::Error.from_error(e)
@@ -474,22 +495,22 @@ module Google
474
495
  # Required. The resource being created
475
496
  # @param request_id [::String]
476
497
  # Optional. An optional request ID to identify requests. Specify a unique
477
- # request ID so that if you must retry your request, the server will know to
478
- # ignore the request if it has already been completed. The server will
479
- # guarantee that for at least 60 minutes since the first request.
498
+ # request ID so that if you must retry your request, the server ignores the
499
+ # request if it has already been completed. The server guarantees that for at
500
+ # least 60 minutes since the first request.
480
501
  #
481
502
  # For example, consider a situation where you make an initial request and
482
503
  # the request times out. If you make the request again with the same request
483
- # ID, the server can check if original operation with the same request ID
484
- # was received, and if so, will ignore the second request. This prevents
504
+ # ID, the server can check if the original operation with the same request ID
505
+ # was received, and if so, ignores the second request. This prevents
485
506
  # clients from accidentally creating duplicate commitments.
486
507
  #
487
508
  # The request ID must be a valid UUID with the exception that zero UUID is
488
509
  # not supported (00000000-0000-0000-0000-000000000000).
489
510
  # @param validate_only [::Boolean]
490
- # Optional. If set, performs request validation (e.g. permission checks and
491
- # any other type of validation), but do not actually execute the create
492
- # request.
511
+ # Optional. If set, performs request validation, for example, permission
512
+ # checks and any other type of validation, but does not actually execute the
513
+ # create request.
493
514
  #
494
515
  # @yield [response, operation] Access the result along with the RPC operation
495
516
  # @yieldparam response [::Gapic::Operation]
@@ -558,7 +579,7 @@ module Google
558
579
  @alloy_db_admin_stub.call_rpc :create_cluster, request, options: options do |response, operation|
559
580
  response = ::Gapic::Operation.new response, @operations_client, options: options
560
581
  yield response, operation if block_given?
561
- return response
582
+ throw :response, response
562
583
  end
563
584
  rescue ::GRPC::BadStatus => e
564
585
  raise ::Google::Cloud::Error.from_error(e)
@@ -592,22 +613,22 @@ module Google
592
613
  # Required. The resource being updated
593
614
  # @param request_id [::String]
594
615
  # Optional. An optional request ID to identify requests. Specify a unique
595
- # request ID so that if you must retry your request, the server will know to
596
- # ignore the request if it has already been completed. The server will
597
- # guarantee that for at least 60 minutes since the first request.
616
+ # request ID so that if you must retry your request, the server ignores the
617
+ # request if it has already been completed. The server guarantees that for at
618
+ # least 60 minutes since the first request.
598
619
  #
599
620
  # For example, consider a situation where you make an initial request and
600
621
  # the request times out. If you make the request again with the same request
601
- # ID, the server can check if original operation with the same request ID
602
- # was received, and if so, will ignore the second request. This prevents
622
+ # ID, the server can check if the original operation with the same request ID
623
+ # was received, and if so, ignores the second request. This prevents
603
624
  # clients from accidentally creating duplicate commitments.
604
625
  #
605
626
  # The request ID must be a valid UUID with the exception that zero UUID is
606
627
  # not supported (00000000-0000-0000-0000-000000000000).
607
628
  # @param validate_only [::Boolean]
608
- # Optional. If set, performs request validation (e.g. permission checks and
609
- # any other type of validation), but do not actually execute the update
610
- # request.
629
+ # Optional. If set, performs request validation, for example, permission
630
+ # checks and any other type of validation, but does not actually execute the
631
+ # create request.
611
632
  # @param allow_missing [::Boolean]
612
633
  # Optional. If set to true, update succeeds even if cluster is not found. In
613
634
  # that case, a new cluster is created and `update_mask` is ignored.
@@ -679,7 +700,7 @@ module Google
679
700
  @alloy_db_admin_stub.call_rpc :update_cluster, request, options: options do |response, operation|
680
701
  response = ::Gapic::Operation.new response, @operations_client, options: options
681
702
  yield response, operation if block_given?
682
- return response
703
+ throw :response, response
683
704
  end
684
705
  rescue ::GRPC::BadStatus => e
685
706
  raise ::Google::Cloud::Error.from_error(e)
@@ -708,14 +729,14 @@ module Google
708
729
  # comment on the Cluster.name field.
709
730
  # @param request_id [::String]
710
731
  # Optional. An optional request ID to identify requests. Specify a unique
711
- # request ID so that if you must retry your request, the server will know to
712
- # ignore the request if it has already been completed. The server will
713
- # guarantee that for at least 60 minutes after the first request.
732
+ # request ID so that if you must retry your request, the server ignores the
733
+ # request if it has already been completed. The server guarantees that for at
734
+ # least 60 minutes since the first request.
714
735
  #
715
736
  # For example, consider a situation where you make an initial request and
716
737
  # the request times out. If you make the request again with the same request
717
- # ID, the server can check if original operation with the same request ID
718
- # was received, and if so, will ignore the second request. This prevents
738
+ # ID, the server can check if the original operation with the same request ID
739
+ # was received, and if so, ignores the second request. This prevents
719
740
  # clients from accidentally creating duplicate commitments.
720
741
  #
721
742
  # The request ID must be a valid UUID with the exception that zero UUID is
@@ -725,8 +746,9 @@ module Google
725
746
  # If an etag is provided and does not match the current etag of the Cluster,
726
747
  # deletion will be blocked and an ABORTED error will be returned.
727
748
  # @param validate_only [::Boolean]
728
- # Optional. If set, performs request validation (e.g. permission checks and
729
- # any other type of validation), but do not actually execute the delete.
749
+ # Optional. If set, performs request validation, for example, permission
750
+ # checks and any other type of validation, but does not actually execute the
751
+ # create request.
730
752
  # @param force [::Boolean]
731
753
  # Optional. Whether to cascade delete child instances for given cluster.
732
754
  #
@@ -797,7 +819,7 @@ module Google
797
819
  @alloy_db_admin_stub.call_rpc :delete_cluster, request, options: options do |response, operation|
798
820
  response = ::Gapic::Operation.new response, @operations_client, options: options
799
821
  yield response, operation if block_given?
800
- return response
822
+ throw :response, response
801
823
  end
802
824
  rescue ::GRPC::BadStatus => e
803
825
  raise ::Google::Cloud::Error.from_error(e)
@@ -829,9 +851,9 @@ module Google
829
851
  # comment on the Cluster.name field
830
852
  # @param request_id [::String]
831
853
  # Optional. An optional request ID to identify requests. Specify a unique
832
- # request ID so that if you must retry your request, the server will know to
833
- # ignore the request if it has already been completed. The server will
834
- # guarantee that for at least 60 minutes after the first request.
854
+ # request ID so that if you must retry your request, the server ignores the
855
+ # request if it has already been completed. The server guarantees that for at
856
+ # least 60 minutes since the first request.
835
857
  #
836
858
  # For example, consider a situation where you make an initial request and
837
859
  # the request times out. If you make the request again with the same request
@@ -846,8 +868,9 @@ module Google
846
868
  # If an etag is provided and does not match the current etag of the Cluster,
847
869
  # deletion will be blocked and an ABORTED error will be returned.
848
870
  # @param validate_only [::Boolean]
849
- # Optional. If set, performs request validation (e.g. permission checks and
850
- # any other type of validation), but do not actually execute the delete.
871
+ # Optional. If set, performs request validation, for example, permission
872
+ # checks and any other type of validation, but does not actually execute the
873
+ # create request.
851
874
  #
852
875
  # @yield [response, operation] Access the result along with the RPC operation
853
876
  # @yieldparam response [::Gapic::Operation]
@@ -916,7 +939,122 @@ module Google
916
939
  @alloy_db_admin_stub.call_rpc :promote_cluster, request, options: options do |response, operation|
917
940
  response = ::Gapic::Operation.new response, @operations_client, options: options
918
941
  yield response, operation if block_given?
919
- return response
942
+ throw :response, response
943
+ end
944
+ rescue ::GRPC::BadStatus => e
945
+ raise ::Google::Cloud::Error.from_error(e)
946
+ end
947
+
948
+ ##
949
+ # Switches the roles of PRIMARY and SECONDARY clusters without any data loss.
950
+ # This promotes the SECONDARY cluster to PRIMARY and sets up the original
951
+ # PRIMARY cluster to replicate from this newly promoted cluster.
952
+ #
953
+ # @overload switchover_cluster(request, options = nil)
954
+ # Pass arguments to `switchover_cluster` via a request object, either of type
955
+ # {::Google::Cloud::AlloyDB::V1::SwitchoverClusterRequest} or an equivalent Hash.
956
+ #
957
+ # @param request [::Google::Cloud::AlloyDB::V1::SwitchoverClusterRequest, ::Hash]
958
+ # A request object representing the call parameters. Required. To specify no
959
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
960
+ # @param options [::Gapic::CallOptions, ::Hash]
961
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
962
+ #
963
+ # @overload switchover_cluster(name: nil, request_id: nil, validate_only: nil)
964
+ # Pass arguments to `switchover_cluster` via keyword arguments. Note that at
965
+ # least one keyword argument is required. To specify no parameters, or to keep all
966
+ # the default parameter values, pass an empty Hash as a request object (see above).
967
+ #
968
+ # @param name [::String]
969
+ # Required. The name of the resource. For the required format, see the
970
+ # comment on the Cluster.name field
971
+ # @param request_id [::String]
972
+ # Optional. An optional request ID to identify requests. Specify a unique
973
+ # request ID so that if you must retry your request, the server ignores the
974
+ # request if it has already been completed. The server guarantees that for at
975
+ # least 60 minutes since the first request.
976
+ #
977
+ # For example, consider a situation where you make an initial request and
978
+ # the request times out. If you make the request again with the same request
979
+ # ID, the server can check if the original operation with the same request ID
980
+ # was received, and if so, ignores the second request. This prevents
981
+ # clients from accidentally creating duplicate commitments.
982
+ #
983
+ # The request ID must be a valid UUID with the exception that zero UUID is
984
+ # not supported (00000000-0000-0000-0000-000000000000).
985
+ # @param validate_only [::Boolean]
986
+ # Optional. If set, performs request validation, for example, permission
987
+ # checks and any other type of validation, but does not actually execute the
988
+ # create request.
989
+ #
990
+ # @yield [response, operation] Access the result along with the RPC operation
991
+ # @yieldparam response [::Gapic::Operation]
992
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
993
+ #
994
+ # @return [::Gapic::Operation]
995
+ #
996
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
997
+ #
998
+ # @example Basic example
999
+ # require "google/cloud/alloy_db/v1"
1000
+ #
1001
+ # # Create a client object. The client can be reused for multiple calls.
1002
+ # client = Google::Cloud::AlloyDB::V1::AlloyDBAdmin::Client.new
1003
+ #
1004
+ # # Create a request. To set request fields, pass in keyword arguments.
1005
+ # request = Google::Cloud::AlloyDB::V1::SwitchoverClusterRequest.new
1006
+ #
1007
+ # # Call the switchover_cluster method.
1008
+ # result = client.switchover_cluster request
1009
+ #
1010
+ # # The returned object is of type Gapic::Operation. You can use it to
1011
+ # # check the status of an operation, cancel it, or wait for results.
1012
+ # # Here is how to wait for a response.
1013
+ # result.wait_until_done! timeout: 60
1014
+ # if result.response?
1015
+ # p result.response
1016
+ # else
1017
+ # puts "No response received."
1018
+ # end
1019
+ #
1020
+ def switchover_cluster request, options = nil
1021
+ raise ::ArgumentError, "request must be provided" if request.nil?
1022
+
1023
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::AlloyDB::V1::SwitchoverClusterRequest
1024
+
1025
+ # Converts hash and nil to an options object
1026
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1027
+
1028
+ # Customize the options with defaults
1029
+ metadata = @config.rpcs.switchover_cluster.metadata.to_h
1030
+
1031
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
1032
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1033
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1034
+ gapic_version: ::Google::Cloud::AlloyDB::V1::VERSION
1035
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
1036
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1037
+
1038
+ header_params = {}
1039
+ if request.name
1040
+ header_params["name"] = request.name
1041
+ end
1042
+
1043
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1044
+ metadata[:"x-goog-request-params"] ||= request_params_header
1045
+
1046
+ options.apply_defaults timeout: @config.rpcs.switchover_cluster.timeout,
1047
+ metadata: metadata,
1048
+ retry_policy: @config.rpcs.switchover_cluster.retry_policy
1049
+
1050
+ options.apply_defaults timeout: @config.timeout,
1051
+ metadata: @config.metadata,
1052
+ retry_policy: @config.retry_policy
1053
+
1054
+ @alloy_db_admin_stub.call_rpc :switchover_cluster, request, options: options do |response, operation|
1055
+ response = ::Gapic::Operation.new response, @operations_client, options: options
1056
+ yield response, operation if block_given?
1057
+ throw :response, response
920
1058
  end
921
1059
  rescue ::GRPC::BadStatus => e
922
1060
  raise ::Google::Cloud::Error.from_error(e)
@@ -956,22 +1094,22 @@ module Google
956
1094
  # Required. The resource being created
957
1095
  # @param request_id [::String]
958
1096
  # Optional. An optional request ID to identify requests. Specify a unique
959
- # request ID so that if you must retry your request, the server will know to
960
- # ignore the request if it has already been completed. The server will
961
- # guarantee that for at least 60 minutes since the first request.
1097
+ # request ID so that if you must retry your request, the server ignores the
1098
+ # request if it has already been completed. The server guarantees that for at
1099
+ # least 60 minutes since the first request.
962
1100
  #
963
1101
  # For example, consider a situation where you make an initial request and
964
1102
  # the request times out. If you make the request again with the same request
965
- # ID, the server can check if original operation with the same request ID
966
- # was received, and if so, will ignore the second request. This prevents
1103
+ # ID, the server can check if the original operation with the same request ID
1104
+ # was received, and if so, ignores the second request. This prevents
967
1105
  # clients from accidentally creating duplicate commitments.
968
1106
  #
969
1107
  # The request ID must be a valid UUID with the exception that zero UUID is
970
1108
  # not supported (00000000-0000-0000-0000-000000000000).
971
1109
  # @param validate_only [::Boolean]
972
- # Optional. If set, performs request validation (e.g. permission checks and
973
- # any other type of validation), but do not actually execute the import
974
- # request.
1110
+ # Optional. If set, performs request validation, for example, permission
1111
+ # checks and any other type of validation, but does not actually execute the
1112
+ # create request.
975
1113
  #
976
1114
  # @yield [response, operation] Access the result along with the RPC operation
977
1115
  # @yieldparam response [::Gapic::Operation]
@@ -1040,7 +1178,7 @@ module Google
1040
1178
  @alloy_db_admin_stub.call_rpc :restore_cluster, request, options: options do |response, operation|
1041
1179
  response = ::Gapic::Operation.new response, @operations_client, options: options
1042
1180
  yield response, operation if block_given?
1043
- return response
1181
+ throw :response, response
1044
1182
  end
1045
1183
  rescue ::GRPC::BadStatus => e
1046
1184
  raise ::Google::Cloud::Error.from_error(e)
@@ -1074,22 +1212,22 @@ module Google
1074
1212
  # Required. Configuration of the requesting object (the secondary cluster).
1075
1213
  # @param request_id [::String]
1076
1214
  # Optional. An optional request ID to identify requests. Specify a unique
1077
- # request ID so that if you must retry your request, the server will know to
1078
- # ignore the request if it has already been completed. The server will
1079
- # guarantee that for at least 60 minutes since the first request.
1215
+ # request ID so that if you must retry your request, the server ignores the
1216
+ # request if it has already been completed. The server guarantees that for at
1217
+ # least 60 minutes since the first request.
1080
1218
  #
1081
1219
  # For example, consider a situation where you make an initial request and
1082
1220
  # the request times out. If you make the request again with the same request
1083
- # ID, the server can check if original operation with the same request ID
1084
- # was received, and if so, will ignore the second request. This prevents
1221
+ # ID, the server can check if the original operation with the same request ID
1222
+ # was received, and if so, ignores the second request. This prevents
1085
1223
  # clients from accidentally creating duplicate commitments.
1086
1224
  #
1087
1225
  # The request ID must be a valid UUID with the exception that zero UUID is
1088
1226
  # not supported (00000000-0000-0000-0000-000000000000).
1089
1227
  # @param validate_only [::Boolean]
1090
- # Optional. If set, performs request validation (e.g. permission checks and
1091
- # any other type of validation), but do not actually execute the create
1092
- # request.
1228
+ # Optional. If set, performs request validation, for example, permission
1229
+ # checks and any other type of validation, but does not actually execute the
1230
+ # create request.
1093
1231
  #
1094
1232
  # @yield [response, operation] Access the result along with the RPC operation
1095
1233
  # @yieldparam response [::Gapic::Operation]
@@ -1158,7 +1296,7 @@ module Google
1158
1296
  @alloy_db_admin_stub.call_rpc :create_secondary_cluster, request, options: options do |response, operation|
1159
1297
  response = ::Gapic::Operation.new response, @operations_client, options: options
1160
1298
  yield response, operation if block_given?
1161
- return response
1299
+ throw :response, response
1162
1300
  end
1163
1301
  rescue ::GRPC::BadStatus => e
1164
1302
  raise ::Google::Cloud::Error.from_error(e)
@@ -1263,7 +1401,7 @@ module Google
1263
1401
  @alloy_db_admin_stub.call_rpc :list_instances, request, options: options do |response, operation|
1264
1402
  response = ::Gapic::PagedEnumerable.new @alloy_db_admin_stub, :list_instances, request, response, operation, options
1265
1403
  yield response, operation if block_given?
1266
- return response
1404
+ throw :response, response
1267
1405
  end
1268
1406
  rescue ::GRPC::BadStatus => e
1269
1407
  raise ::Google::Cloud::Error.from_error(e)
@@ -1352,7 +1490,6 @@ module Google
1352
1490
 
1353
1491
  @alloy_db_admin_stub.call_rpc :get_instance, request, options: options do |response, operation|
1354
1492
  yield response, operation if block_given?
1355
- return response
1356
1493
  end
1357
1494
  rescue ::GRPC::BadStatus => e
1358
1495
  raise ::Google::Cloud::Error.from_error(e)
@@ -1385,22 +1522,22 @@ module Google
1385
1522
  # Required. The resource being created
1386
1523
  # @param request_id [::String]
1387
1524
  # Optional. An optional request ID to identify requests. Specify a unique
1388
- # request ID so that if you must retry your request, the server will know to
1389
- # ignore the request if it has already been completed. The server will
1390
- # guarantee that for at least 60 minutes since the first request.
1525
+ # request ID so that if you must retry your request, the server ignores the
1526
+ # request if it has already been completed. The server guarantees that for at
1527
+ # least 60 minutes since the first request.
1391
1528
  #
1392
1529
  # For example, consider a situation where you make an initial request and
1393
1530
  # the request times out. If you make the request again with the same request
1394
- # ID, the server can check if original operation with the same request ID
1395
- # was received, and if so, will ignore the second request. This prevents
1531
+ # ID, the server can check if the original operation with the same request ID
1532
+ # was received, and if so, ignores the second request. This prevents
1396
1533
  # clients from accidentally creating duplicate commitments.
1397
1534
  #
1398
1535
  # The request ID must be a valid UUID with the exception that zero UUID is
1399
1536
  # not supported (00000000-0000-0000-0000-000000000000).
1400
1537
  # @param validate_only [::Boolean]
1401
- # Optional. If set, performs request validation (e.g. permission checks and
1402
- # any other type of validation), but do not actually execute the create
1403
- # request.
1538
+ # Optional. If set, performs request validation, for example, permission
1539
+ # checks and any other type of validation, but does not actually execute the
1540
+ # create request.
1404
1541
  #
1405
1542
  # @yield [response, operation] Access the result along with the RPC operation
1406
1543
  # @yieldparam response [::Gapic::Operation]
@@ -1469,7 +1606,7 @@ module Google
1469
1606
  @alloy_db_admin_stub.call_rpc :create_instance, request, options: options do |response, operation|
1470
1607
  response = ::Gapic::Operation.new response, @operations_client, options: options
1471
1608
  yield response, operation if block_given?
1472
- return response
1609
+ throw :response, response
1473
1610
  end
1474
1611
  rescue ::GRPC::BadStatus => e
1475
1612
  raise ::Google::Cloud::Error.from_error(e)
@@ -1502,22 +1639,22 @@ module Google
1502
1639
  # Required. The resource being created
1503
1640
  # @param request_id [::String]
1504
1641
  # Optional. An optional request ID to identify requests. Specify a unique
1505
- # request ID so that if you must retry your request, the server will know to
1506
- # ignore the request if it has already been completed. The server will
1507
- # guarantee that for at least 60 minutes since the first request.
1642
+ # request ID so that if you must retry your request, the server ignores the
1643
+ # request if it has already been completed. The server guarantees that for at
1644
+ # least 60 minutes since the first request.
1508
1645
  #
1509
1646
  # For example, consider a situation where you make an initial request and
1510
1647
  # the request times out. If you make the request again with the same request
1511
- # ID, the server can check if original operation with the same request ID
1512
- # was received, and if so, will ignore the second request. This prevents
1648
+ # ID, the server can check if the original operation with the same request ID
1649
+ # was received, and if so, ignores the second request. This prevents
1513
1650
  # clients from accidentally creating duplicate commitments.
1514
1651
  #
1515
1652
  # The request ID must be a valid UUID with the exception that zero UUID is
1516
1653
  # not supported (00000000-0000-0000-0000-000000000000).
1517
1654
  # @param validate_only [::Boolean]
1518
- # Optional. If set, performs request validation (e.g. permission checks and
1519
- # any other type of validation), but do not actually execute the create
1520
- # request.
1655
+ # Optional. If set, performs request validation, for example, permission
1656
+ # checks and any other type of validation, but does not actually execute the
1657
+ # create request.
1521
1658
  #
1522
1659
  # @yield [response, operation] Access the result along with the RPC operation
1523
1660
  # @yieldparam response [::Gapic::Operation]
@@ -1586,7 +1723,7 @@ module Google
1586
1723
  @alloy_db_admin_stub.call_rpc :create_secondary_instance, request, options: options do |response, operation|
1587
1724
  response = ::Gapic::Operation.new response, @operations_client, options: options
1588
1725
  yield response, operation if block_given?
1589
- return response
1726
+ throw :response, response
1590
1727
  end
1591
1728
  rescue ::GRPC::BadStatus => e
1592
1729
  raise ::Google::Cloud::Error.from_error(e)
@@ -1625,14 +1762,14 @@ module Google
1625
1762
  # Required. Resources being created.
1626
1763
  # @param request_id [::String]
1627
1764
  # Optional. An optional request ID to identify requests. Specify a unique
1628
- # request ID so that if you must retry your request, the server will know to
1629
- # ignore the request if it has already been completed. The server will
1630
- # guarantee that for at least 60 minutes since the first request.
1765
+ # request ID so that if you must retry your request, the server ignores the
1766
+ # request if it has already been completed. The server guarantees that for at
1767
+ # least 60 minutes since the first request.
1631
1768
  #
1632
1769
  # For example, consider a situation where you make an initial request and
1633
1770
  # the request times out. If you make the request again with the same request
1634
- # ID, the server can check if original operation with the same request ID
1635
- # was received, and if so, will ignore the second request. This prevents
1771
+ # ID, the server can check if the original operation with the same request ID
1772
+ # was received, and if so, ignores the second request. This prevents
1636
1773
  # clients from accidentally creating duplicate commitments.
1637
1774
  #
1638
1775
  # The request ID must be a valid UUID with the exception that zero UUID is
@@ -1705,7 +1842,7 @@ module Google
1705
1842
  @alloy_db_admin_stub.call_rpc :batch_create_instances, request, options: options do |response, operation|
1706
1843
  response = ::Gapic::Operation.new response, @operations_client, options: options
1707
1844
  yield response, operation if block_given?
1708
- return response
1845
+ throw :response, response
1709
1846
  end
1710
1847
  rescue ::GRPC::BadStatus => e
1711
1848
  raise ::Google::Cloud::Error.from_error(e)
@@ -1739,22 +1876,22 @@ module Google
1739
1876
  # Required. The resource being updated
1740
1877
  # @param request_id [::String]
1741
1878
  # Optional. An optional request ID to identify requests. Specify a unique
1742
- # request ID so that if you must retry your request, the server will know to
1743
- # ignore the request if it has already been completed. The server will
1744
- # guarantee that for at least 60 minutes since the first request.
1879
+ # request ID so that if you must retry your request, the server ignores the
1880
+ # request if it has already been completed. The server guarantees that for at
1881
+ # least 60 minutes since the first request.
1745
1882
  #
1746
1883
  # For example, consider a situation where you make an initial request and
1747
1884
  # the request times out. If you make the request again with the same request
1748
- # ID, the server can check if original operation with the same request ID
1749
- # was received, and if so, will ignore the second request. This prevents
1885
+ # ID, the server can check if the original operation with the same request ID
1886
+ # was received, and if so, ignores the second request. This prevents
1750
1887
  # clients from accidentally creating duplicate commitments.
1751
1888
  #
1752
1889
  # The request ID must be a valid UUID with the exception that zero UUID is
1753
1890
  # not supported (00000000-0000-0000-0000-000000000000).
1754
1891
  # @param validate_only [::Boolean]
1755
- # Optional. If set, performs request validation (e.g. permission checks and
1756
- # any other type of validation), but do not actually execute the update
1757
- # request.
1892
+ # Optional. If set, performs request validation, for example, permission
1893
+ # checks and any other type of validation, but does not actually execute the
1894
+ # create request.
1758
1895
  # @param allow_missing [::Boolean]
1759
1896
  # Optional. If set to true, update succeeds even if instance is not found. In
1760
1897
  # that case, a new instance is created and `update_mask` is ignored.
@@ -1826,7 +1963,7 @@ module Google
1826
1963
  @alloy_db_admin_stub.call_rpc :update_instance, request, options: options do |response, operation|
1827
1964
  response = ::Gapic::Operation.new response, @operations_client, options: options
1828
1965
  yield response, operation if block_given?
1829
- return response
1966
+ throw :response, response
1830
1967
  end
1831
1968
  rescue ::GRPC::BadStatus => e
1832
1969
  raise ::Google::Cloud::Error.from_error(e)
@@ -1855,14 +1992,14 @@ module Google
1855
1992
  # comment on the Instance.name field.
1856
1993
  # @param request_id [::String]
1857
1994
  # Optional. An optional request ID to identify requests. Specify a unique
1858
- # request ID so that if you must retry your request, the server will know to
1859
- # ignore the request if it has already been completed. The server will
1860
- # guarantee that for at least 60 minutes after the first request.
1995
+ # request ID so that if you must retry your request, the server ignores the
1996
+ # request if it has already been completed. The server guarantees that for at
1997
+ # least 60 minutes since the first request.
1861
1998
  #
1862
1999
  # For example, consider a situation where you make an initial request and
1863
2000
  # the request times out. If you make the request again with the same request
1864
- # ID, the server can check if original operation with the same request ID
1865
- # was received, and if so, will ignore the second request. This prevents
2001
+ # ID, the server can check if the original operation with the same request ID
2002
+ # was received, and if so, ignores the second request. This prevents
1866
2003
  # clients from accidentally creating duplicate commitments.
1867
2004
  #
1868
2005
  # The request ID must be a valid UUID with the exception that zero UUID is
@@ -1872,8 +2009,9 @@ module Google
1872
2009
  # If an etag is provided and does not match the current etag of the Instance,
1873
2010
  # deletion will be blocked and an ABORTED error will be returned.
1874
2011
  # @param validate_only [::Boolean]
1875
- # Optional. If set, performs request validation (e.g. permission checks and
1876
- # any other type of validation), but do not actually execute the delete.
2012
+ # Optional. If set, performs request validation, for example, permission
2013
+ # checks and any other type of validation, but does not actually execute the
2014
+ # create request.
1877
2015
  #
1878
2016
  # @yield [response, operation] Access the result along with the RPC operation
1879
2017
  # @yieldparam response [::Gapic::Operation]
@@ -1942,7 +2080,7 @@ module Google
1942
2080
  @alloy_db_admin_stub.call_rpc :delete_instance, request, options: options do |response, operation|
1943
2081
  response = ::Gapic::Operation.new response, @operations_client, options: options
1944
2082
  yield response, operation if block_given?
1945
- return response
2083
+ throw :response, response
1946
2084
  end
1947
2085
  rescue ::GRPC::BadStatus => e
1948
2086
  raise ::Google::Cloud::Error.from_error(e)
@@ -1973,21 +2111,22 @@ module Google
1973
2111
  # comment on the Instance.name field.
1974
2112
  # @param request_id [::String]
1975
2113
  # Optional. An optional request ID to identify requests. Specify a unique
1976
- # request ID so that if you must retry your request, the server will know to
1977
- # ignore the request if it has already been completed. The server will
1978
- # guarantee that for at least 60 minutes after the first request.
2114
+ # request ID so that if you must retry your request, the server ignores the
2115
+ # request if it has already been completed. The server guarantees that for at
2116
+ # least 60 minutes since the first request.
1979
2117
  #
1980
2118
  # For example, consider a situation where you make an initial request and
1981
2119
  # the request times out. If you make the request again with the same request
1982
- # ID, the server can check if original operation with the same request ID
1983
- # was received, and if so, will ignore the second request. This prevents
2120
+ # ID, the server can check if the original operation with the same request ID
2121
+ # was received, and if so, ignores the second request. This prevents
1984
2122
  # clients from accidentally creating duplicate commitments.
1985
2123
  #
1986
2124
  # The request ID must be a valid UUID with the exception that zero UUID is
1987
2125
  # not supported (00000000-0000-0000-0000-000000000000).
1988
2126
  # @param validate_only [::Boolean]
1989
- # Optional. If set, performs request validation (e.g. permission checks and
1990
- # any other type of validation), but do not actually execute the failover.
2127
+ # Optional. If set, performs request validation, for example, permission
2128
+ # checks and any other type of validation, but does not actually execute the
2129
+ # create request.
1991
2130
  #
1992
2131
  # @yield [response, operation] Access the result along with the RPC operation
1993
2132
  # @yieldparam response [::Gapic::Operation]
@@ -2056,7 +2195,7 @@ module Google
2056
2195
  @alloy_db_admin_stub.call_rpc :failover_instance, request, options: options do |response, operation|
2057
2196
  response = ::Gapic::Operation.new response, @operations_client, options: options
2058
2197
  yield response, operation if block_given?
2059
- return response
2198
+ throw :response, response
2060
2199
  end
2061
2200
  rescue ::GRPC::BadStatus => e
2062
2201
  raise ::Google::Cloud::Error.from_error(e)
@@ -2088,22 +2227,22 @@ module Google
2088
2227
  # comment on the Instance.name field.
2089
2228
  # @param request_id [::String]
2090
2229
  # Optional. An optional request ID to identify requests. Specify a unique
2091
- # request ID so that if you must retry your request, the server will know to
2092
- # ignore the request if it has already been completed. The server will
2093
- # guarantee that for at least 60 minutes after the first request.
2230
+ # request ID so that if you must retry your request, the server ignores the
2231
+ # request if it has already been completed. The server guarantees that for at
2232
+ # least 60 minutes since the first request.
2094
2233
  #
2095
2234
  # For example, consider a situation where you make an initial request and
2096
2235
  # the request times out. If you make the request again with the same request
2097
- # ID, the server can check if original operation with the same request ID
2098
- # was received, and if so, will ignore the second request. This prevents
2236
+ # ID, the server can check if the original operation with the same request ID
2237
+ # was received, and if so, ignores the second request. This prevents
2099
2238
  # clients from accidentally creating duplicate commitments.
2100
2239
  #
2101
2240
  # The request ID must be a valid UUID with the exception that zero UUID is
2102
2241
  # not supported (00000000-0000-0000-0000-000000000000).
2103
2242
  # @param validate_only [::Boolean]
2104
- # Optional. If set, performs request validation (e.g. permission checks and
2105
- # any other type of validation), but do not actually execute the fault
2106
- # injection.
2243
+ # Optional. If set, performs request validation, for example, permission
2244
+ # checks and any other type of validation, but does not actually execute the
2245
+ # create request.
2107
2246
  #
2108
2247
  # @yield [response, operation] Access the result along with the RPC operation
2109
2248
  # @yieldparam response [::Gapic::Operation]
@@ -2172,7 +2311,7 @@ module Google
2172
2311
  @alloy_db_admin_stub.call_rpc :inject_fault, request, options: options do |response, operation|
2173
2312
  response = ::Gapic::Operation.new response, @operations_client, options: options
2174
2313
  yield response, operation if block_given?
2175
- return response
2314
+ throw :response, response
2176
2315
  end
2177
2316
  rescue ::GRPC::BadStatus => e
2178
2317
  raise ::Google::Cloud::Error.from_error(e)
@@ -2192,7 +2331,7 @@ module Google
2192
2331
  # @param options [::Gapic::CallOptions, ::Hash]
2193
2332
  # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
2194
2333
  #
2195
- # @overload restart_instance(name: nil, request_id: nil, validate_only: nil)
2334
+ # @overload restart_instance(name: nil, request_id: nil, validate_only: nil, node_ids: nil)
2196
2335
  # Pass arguments to `restart_instance` via keyword arguments. Note that at
2197
2336
  # least one keyword argument is required. To specify no parameters, or to keep all
2198
2337
  # the default parameter values, pass an empty Hash as a request object (see above).
@@ -2202,21 +2341,25 @@ module Google
2202
2341
  # comment on the Instance.name field.
2203
2342
  # @param request_id [::String]
2204
2343
  # Optional. An optional request ID to identify requests. Specify a unique
2205
- # request ID so that if you must retry your request, the server will know to
2206
- # ignore the request if it has already been completed. The server will
2207
- # guarantee that for at least 60 minutes after the first request.
2344
+ # request ID so that if you must retry your request, the server ignores the
2345
+ # request if it has already been completed. The server guarantees that for at
2346
+ # least 60 minutes since the first request.
2208
2347
  #
2209
2348
  # For example, consider a situation where you make an initial request and
2210
2349
  # the request times out. If you make the request again with the same request
2211
- # ID, the server can check if original operation with the same request ID
2212
- # was received, and if so, will ignore the second request. This prevents
2350
+ # ID, the server can check if the original operation with the same request ID
2351
+ # was received, and if so, ignores the second request. This prevents
2213
2352
  # clients from accidentally creating duplicate commitments.
2214
2353
  #
2215
2354
  # The request ID must be a valid UUID with the exception that zero UUID is
2216
2355
  # not supported (00000000-0000-0000-0000-000000000000).
2217
2356
  # @param validate_only [::Boolean]
2218
- # Optional. If set, performs request validation (e.g. permission checks and
2219
- # any other type of validation), but do not actually execute the restart.
2357
+ # Optional. If set, performs request validation, for example, permission
2358
+ # checks and any other type of validation, but does not actually execute the
2359
+ # create request.
2360
+ # @param node_ids [::Array<::String>]
2361
+ # Optional. Full name of the nodes as obtained from INSTANCE_VIEW_FULL to
2362
+ # restart upon. Applicable only to read instances.
2220
2363
  #
2221
2364
  # @yield [response, operation] Access the result along with the RPC operation
2222
2365
  # @yieldparam response [::Gapic::Operation]
@@ -2285,7 +2428,106 @@ module Google
2285
2428
  @alloy_db_admin_stub.call_rpc :restart_instance, request, options: options do |response, operation|
2286
2429
  response = ::Gapic::Operation.new response, @operations_client, options: options
2287
2430
  yield response, operation if block_given?
2288
- return response
2431
+ throw :response, response
2432
+ end
2433
+ rescue ::GRPC::BadStatus => e
2434
+ raise ::Google::Cloud::Error.from_error(e)
2435
+ end
2436
+
2437
+ ##
2438
+ # Executes a SQL statement in a database inside an AlloyDB instance.
2439
+ #
2440
+ # @overload execute_sql(request, options = nil)
2441
+ # Pass arguments to `execute_sql` via a request object, either of type
2442
+ # {::Google::Cloud::AlloyDB::V1::ExecuteSqlRequest} or an equivalent Hash.
2443
+ #
2444
+ # @param request [::Google::Cloud::AlloyDB::V1::ExecuteSqlRequest, ::Hash]
2445
+ # A request object representing the call parameters. Required. To specify no
2446
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
2447
+ # @param options [::Gapic::CallOptions, ::Hash]
2448
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
2449
+ #
2450
+ # @overload execute_sql(password: nil, instance: nil, database: nil, user: nil, sql_statement: nil)
2451
+ # Pass arguments to `execute_sql` via keyword arguments. Note that at
2452
+ # least one keyword argument is required. To specify no parameters, or to keep all
2453
+ # the default parameter values, pass an empty Hash as a request object (see above).
2454
+ #
2455
+ # @param password [::String]
2456
+ # Optional. The database native user’s password.
2457
+ # @param instance [::String]
2458
+ # Required. The instance where the SQL will be executed. For the required
2459
+ # format, see the comment on the Instance.name field.
2460
+ # @param database [::String]
2461
+ # Required. Name of the database where the query will be executed.
2462
+ # Note - Value provided should be the same as expected from `SELECT
2463
+ # current_database();` and NOT as a resource reference.
2464
+ # @param user [::String]
2465
+ # Required. Database user to be used for executing the SQL.
2466
+ # Note - Value provided should be the same as expected from
2467
+ # `SELECT current_user;` and NOT as a resource reference.
2468
+ # @param sql_statement [::String]
2469
+ # Required. SQL statement to execute on database. Any valid statement is
2470
+ # permitted, including DDL, DML, DQL statements.
2471
+ #
2472
+ # @yield [response, operation] Access the result along with the RPC operation
2473
+ # @yieldparam response [::Google::Cloud::AlloyDB::V1::ExecuteSqlResponse]
2474
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
2475
+ #
2476
+ # @return [::Google::Cloud::AlloyDB::V1::ExecuteSqlResponse]
2477
+ #
2478
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
2479
+ #
2480
+ # @example Basic example
2481
+ # require "google/cloud/alloy_db/v1"
2482
+ #
2483
+ # # Create a client object. The client can be reused for multiple calls.
2484
+ # client = Google::Cloud::AlloyDB::V1::AlloyDBAdmin::Client.new
2485
+ #
2486
+ # # Create a request. To set request fields, pass in keyword arguments.
2487
+ # request = Google::Cloud::AlloyDB::V1::ExecuteSqlRequest.new
2488
+ #
2489
+ # # Call the execute_sql method.
2490
+ # result = client.execute_sql request
2491
+ #
2492
+ # # The returned object is of type Google::Cloud::AlloyDB::V1::ExecuteSqlResponse.
2493
+ # p result
2494
+ #
2495
+ def execute_sql request, options = nil
2496
+ raise ::ArgumentError, "request must be provided" if request.nil?
2497
+
2498
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::AlloyDB::V1::ExecuteSqlRequest
2499
+
2500
+ # Converts hash and nil to an options object
2501
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
2502
+
2503
+ # Customize the options with defaults
2504
+ metadata = @config.rpcs.execute_sql.metadata.to_h
2505
+
2506
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
2507
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
2508
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
2509
+ gapic_version: ::Google::Cloud::AlloyDB::V1::VERSION
2510
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
2511
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
2512
+
2513
+ header_params = {}
2514
+ if request.instance
2515
+ header_params["instance"] = request.instance
2516
+ end
2517
+
2518
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
2519
+ metadata[:"x-goog-request-params"] ||= request_params_header
2520
+
2521
+ options.apply_defaults timeout: @config.rpcs.execute_sql.timeout,
2522
+ metadata: metadata,
2523
+ retry_policy: @config.rpcs.execute_sql.retry_policy
2524
+
2525
+ options.apply_defaults timeout: @config.timeout,
2526
+ metadata: @config.metadata,
2527
+ retry_policy: @config.retry_policy
2528
+
2529
+ @alloy_db_admin_stub.call_rpc :execute_sql, request, options: options do |response, operation|
2530
+ yield response, operation if block_given?
2289
2531
  end
2290
2532
  rescue ::GRPC::BadStatus => e
2291
2533
  raise ::Google::Cloud::Error.from_error(e)
@@ -2385,7 +2627,7 @@ module Google
2385
2627
  @alloy_db_admin_stub.call_rpc :list_backups, request, options: options do |response, operation|
2386
2628
  response = ::Gapic::PagedEnumerable.new @alloy_db_admin_stub, :list_backups, request, response, operation, options
2387
2629
  yield response, operation if block_given?
2388
- return response
2630
+ throw :response, response
2389
2631
  end
2390
2632
  rescue ::GRPC::BadStatus => e
2391
2633
  raise ::Google::Cloud::Error.from_error(e)
@@ -2471,7 +2713,6 @@ module Google
2471
2713
 
2472
2714
  @alloy_db_admin_stub.call_rpc :get_backup, request, options: options do |response, operation|
2473
2715
  yield response, operation if block_given?
2474
- return response
2475
2716
  end
2476
2717
  rescue ::GRPC::BadStatus => e
2477
2718
  raise ::Google::Cloud::Error.from_error(e)
@@ -2503,14 +2744,14 @@ module Google
2503
2744
  # Required. The resource being created
2504
2745
  # @param request_id [::String]
2505
2746
  # Optional. An optional request ID to identify requests. Specify a unique
2506
- # request ID so that if you must retry your request, the server will know to
2507
- # ignore the request if it has already been completed. The server will
2508
- # guarantee that for at least 60 minutes since the first request.
2747
+ # request ID so that if you must retry your request, the server ignores the
2748
+ # request if it has already been completed. The server guarantees that for at
2749
+ # least 60 minutes since the first request.
2509
2750
  #
2510
2751
  # For example, consider a situation where you make an initial request and
2511
2752
  # the request times out. If you make the request again with the same request
2512
- # ID, the server can check if original operation with the same request ID
2513
- # was received, and if so, will ignore the second request. This prevents
2753
+ # ID, the server can check if the original operation with the same request ID
2754
+ # was received, and if so, ignores the second request. This prevents
2514
2755
  # clients from accidentally creating duplicate commitments.
2515
2756
  #
2516
2757
  # The request ID must be a valid UUID with the exception that zero UUID is
@@ -2586,7 +2827,7 @@ module Google
2586
2827
  @alloy_db_admin_stub.call_rpc :create_backup, request, options: options do |response, operation|
2587
2828
  response = ::Gapic::Operation.new response, @operations_client, options: options
2588
2829
  yield response, operation if block_given?
2589
- return response
2830
+ throw :response, response
2590
2831
  end
2591
2832
  rescue ::GRPC::BadStatus => e
2592
2833
  raise ::Google::Cloud::Error.from_error(e)
@@ -2620,14 +2861,14 @@ module Google
2620
2861
  # Required. The resource being updated
2621
2862
  # @param request_id [::String]
2622
2863
  # Optional. An optional request ID to identify requests. Specify a unique
2623
- # request ID so that if you must retry your request, the server will know to
2624
- # ignore the request if it has already been completed. The server will
2625
- # guarantee that for at least 60 minutes since the first request.
2864
+ # request ID so that if you must retry your request, the server ignores the
2865
+ # request if it has already been completed. The server guarantees that for at
2866
+ # least 60 minutes since the first request.
2626
2867
  #
2627
2868
  # For example, consider a situation where you make an initial request and
2628
2869
  # the request times out. If you make the request again with the same request
2629
- # ID, the server can check if original operation with the same request ID
2630
- # was received, and if so, will ignore the second request. This prevents
2870
+ # ID, the server can check if the original operation with the same request ID
2871
+ # was received, and if so, ignores the second request. This prevents
2631
2872
  # clients from accidentally creating duplicate commitments.
2632
2873
  #
2633
2874
  # The request ID must be a valid UUID with the exception that zero UUID is
@@ -2706,7 +2947,7 @@ module Google
2706
2947
  @alloy_db_admin_stub.call_rpc :update_backup, request, options: options do |response, operation|
2707
2948
  response = ::Gapic::Operation.new response, @operations_client, options: options
2708
2949
  yield response, operation if block_given?
2709
- return response
2950
+ throw :response, response
2710
2951
  end
2711
2952
  rescue ::GRPC::BadStatus => e
2712
2953
  raise ::Google::Cloud::Error.from_error(e)
@@ -2735,14 +2976,14 @@ module Google
2735
2976
  # the Backup.name field.
2736
2977
  # @param request_id [::String]
2737
2978
  # Optional. An optional request ID to identify requests. Specify a unique
2738
- # request ID so that if you must retry your request, the server will know to
2739
- # ignore the request if it has already been completed. The server will
2740
- # guarantee that for at least 60 minutes after the first request.
2979
+ # request ID so that if you must retry your request, the server ignores the
2980
+ # request if it has already been completed. The server guarantees that for at
2981
+ # least 60 minutes since the first request.
2741
2982
  #
2742
2983
  # For example, consider a situation where you make an initial request and
2743
2984
  # the request times out. If you make the request again with the same request
2744
- # ID, the server can check if original operation with the same request ID
2745
- # was received, and if so, will ignore the second request. This prevents
2985
+ # ID, the server can check if the original operation with the same request ID
2986
+ # was received, and if so, ignores the second request. This prevents
2746
2987
  # clients from accidentally creating duplicate commitments.
2747
2988
  #
2748
2989
  # The request ID must be a valid UUID with the exception that zero UUID is
@@ -2822,7 +3063,7 @@ module Google
2822
3063
  @alloy_db_admin_stub.call_rpc :delete_backup, request, options: options do |response, operation|
2823
3064
  response = ::Gapic::Operation.new response, @operations_client, options: options
2824
3065
  yield response, operation if block_given?
2825
- return response
3066
+ throw :response, response
2826
3067
  end
2827
3068
  rescue ::GRPC::BadStatus => e
2828
3069
  raise ::Google::Cloud::Error.from_error(e)
@@ -2924,7 +3165,7 @@ module Google
2924
3165
  @alloy_db_admin_stub.call_rpc :list_supported_database_flags, request, options: options do |response, operation|
2925
3166
  response = ::Gapic::PagedEnumerable.new @alloy_db_admin_stub, :list_supported_database_flags, request, response, operation, options
2926
3167
  yield response, operation if block_given?
2927
- return response
3168
+ throw :response, response
2928
3169
  end
2929
3170
  rescue ::GRPC::BadStatus => e
2930
3171
  raise ::Google::Cloud::Error.from_error(e)
@@ -2957,14 +3198,14 @@ module Google
2957
3198
  # * projects/\\{project}/locations/\\{location}/clusters/\\{cluster}
2958
3199
  # @param request_id [::String]
2959
3200
  # Optional. An optional request ID to identify requests. Specify a unique
2960
- # request ID so that if you must retry your request, the server will know to
2961
- # ignore the request if it has already been completed. The server will
2962
- # guarantee that for at least 60 minutes after the first request.
3201
+ # request ID so that if you must retry your request, the server ignores the
3202
+ # request if it has already been completed. The server guarantees that for at
3203
+ # least 60 minutes since the first request.
2963
3204
  #
2964
3205
  # For example, consider a situation where you make an initial request and
2965
3206
  # the request times out. If you make the request again with the same request
2966
- # ID, the server can check if original operation with the same request ID
2967
- # was received, and if so, will ignore the second request. This prevents
3207
+ # ID, the server can check if the original operation with the same request ID
3208
+ # was received, and if so, ignores the second request. This prevents
2968
3209
  # clients from accidentally creating duplicate commitments.
2969
3210
  #
2970
3211
  # The request ID must be a valid UUID with the exception that zero UUID is
@@ -3041,7 +3282,6 @@ module Google
3041
3282
 
3042
3283
  @alloy_db_admin_stub.call_rpc :generate_client_certificate, request, options: options do |response, operation|
3043
3284
  yield response, operation if block_given?
3044
- return response
3045
3285
  end
3046
3286
  rescue ::GRPC::BadStatus => e
3047
3287
  raise ::Google::Cloud::Error.from_error(e)
@@ -3070,14 +3310,14 @@ module Google
3070
3310
  # projects/\\{project}/locations/\\{location}/clusters/\\{cluster}/instances/\\{instance}
3071
3311
  # @param request_id [::String]
3072
3312
  # Optional. An optional request ID to identify requests. Specify a unique
3073
- # request ID so that if you must retry your request, the server will know to
3074
- # ignore the request if it has already been completed. The server will
3075
- # guarantee that for at least 60 minutes after the first request.
3313
+ # request ID so that if you must retry your request, the server ignores the
3314
+ # request if it has already been completed. The server guarantees that for at
3315
+ # least 60 minutes since the first request.
3076
3316
  #
3077
3317
  # For example, consider a situation where you make an initial request and
3078
3318
  # the request times out. If you make the request again with the same request
3079
- # ID, the server can check if original operation with the same request ID
3080
- # was received, and if so, will ignore the second request. This prevents
3319
+ # ID, the server can check if the original operation with the same request ID
3320
+ # was received, and if so, ignores the second request. This prevents
3081
3321
  # clients from accidentally creating duplicate commitments.
3082
3322
  #
3083
3323
  # The request ID must be a valid UUID with the exception that zero UUID is
@@ -3142,7 +3382,6 @@ module Google
3142
3382
 
3143
3383
  @alloy_db_admin_stub.call_rpc :get_connection_info, request, options: options do |response, operation|
3144
3384
  yield response, operation if block_given?
3145
- return response
3146
3385
  end
3147
3386
  rescue ::GRPC::BadStatus => e
3148
3387
  raise ::Google::Cloud::Error.from_error(e)
@@ -3242,7 +3481,7 @@ module Google
3242
3481
  @alloy_db_admin_stub.call_rpc :list_users, request, options: options do |response, operation|
3243
3482
  response = ::Gapic::PagedEnumerable.new @alloy_db_admin_stub, :list_users, request, response, operation, options
3244
3483
  yield response, operation if block_given?
3245
- return response
3484
+ throw :response, response
3246
3485
  end
3247
3486
  rescue ::GRPC::BadStatus => e
3248
3487
  raise ::Google::Cloud::Error.from_error(e)
@@ -3329,7 +3568,6 @@ module Google
3329
3568
 
3330
3569
  @alloy_db_admin_stub.call_rpc :get_user, request, options: options do |response, operation|
3331
3570
  yield response, operation if block_given?
3332
- return response
3333
3571
  end
3334
3572
  rescue ::GRPC::BadStatus => e
3335
3573
  raise ::Google::Cloud::Error.from_error(e)
@@ -3361,14 +3599,14 @@ module Google
3361
3599
  # Required. The resource being created
3362
3600
  # @param request_id [::String]
3363
3601
  # Optional. An optional request ID to identify requests. Specify a unique
3364
- # request ID so that if you must retry your request, the server will know to
3365
- # ignore the request if it has already been completed. The server will
3366
- # guarantee that for at least 60 minutes since the first request.
3602
+ # request ID so that if you must retry your request, the server ignores the
3603
+ # request if it has already been completed. The server guarantees that for at
3604
+ # least 60 minutes since the first request.
3367
3605
  #
3368
3606
  # For example, consider a situation where you make an initial request and
3369
3607
  # the request times out. If you make the request again with the same request
3370
- # ID, the server can check if original operation with the same request ID
3371
- # was received, and if so, will ignore the second request. This prevents
3608
+ # ID, the server can check if the original operation with the same request ID
3609
+ # was received, and if so, ignores the second request. This prevents
3372
3610
  # clients from accidentally creating duplicate commitments.
3373
3611
  #
3374
3612
  # The request ID must be a valid UUID with the exception that zero UUID is
@@ -3436,7 +3674,6 @@ module Google
3436
3674
 
3437
3675
  @alloy_db_admin_stub.call_rpc :create_user, request, options: options do |response, operation|
3438
3676
  yield response, operation if block_given?
3439
- return response
3440
3677
  end
3441
3678
  rescue ::GRPC::BadStatus => e
3442
3679
  raise ::Google::Cloud::Error.from_error(e)
@@ -3470,14 +3707,14 @@ module Google
3470
3707
  # Required. The resource being updated
3471
3708
  # @param request_id [::String]
3472
3709
  # Optional. An optional request ID to identify requests. Specify a unique
3473
- # request ID so that if you must retry your request, the server will know to
3474
- # ignore the request if it has already been completed. The server will
3475
- # guarantee that for at least 60 minutes since the first request.
3710
+ # request ID so that if you must retry your request, the server ignores the
3711
+ # request if it has already been completed. The server guarantees that for at
3712
+ # least 60 minutes since the first request.
3476
3713
  #
3477
3714
  # For example, consider a situation where you make an initial request and
3478
3715
  # the request times out. If you make the request again with the same request
3479
- # ID, the server can check if original operation with the same request ID
3480
- # was received, and if so, will ignore the second request. This prevents
3716
+ # ID, the server can check if the original operation with the same request ID
3717
+ # was received, and if so, ignores the second request. This prevents
3481
3718
  # clients from accidentally creating duplicate commitments.
3482
3719
  #
3483
3720
  # The request ID must be a valid UUID with the exception that zero UUID is
@@ -3547,7 +3784,6 @@ module Google
3547
3784
 
3548
3785
  @alloy_db_admin_stub.call_rpc :update_user, request, options: options do |response, operation|
3549
3786
  yield response, operation if block_given?
3550
- return response
3551
3787
  end
3552
3788
  rescue ::GRPC::BadStatus => e
3553
3789
  raise ::Google::Cloud::Error.from_error(e)
@@ -3576,14 +3812,14 @@ module Google
3576
3812
  # comment on the User.name field.
3577
3813
  # @param request_id [::String]
3578
3814
  # Optional. An optional request ID to identify requests. Specify a unique
3579
- # request ID so that if you must retry your request, the server will know to
3580
- # ignore the request if it has already been completed. The server will
3581
- # guarantee that for at least 60 minutes after the first request.
3815
+ # request ID so that if you must retry your request, the server ignores the
3816
+ # request if it has already been completed. The server guarantees that for at
3817
+ # least 60 minutes since the first request.
3582
3818
  #
3583
3819
  # For example, consider a situation where you make an initial request and
3584
3820
  # the request times out. If you make the request again with the same request
3585
- # ID, the server can check if original operation with the same request ID
3586
- # was received, and if so, will ignore the second request. This prevents
3821
+ # ID, the server can check if the original operation with the same request ID
3822
+ # was received, and if so, ignores the second request. This prevents
3587
3823
  # clients from accidentally creating duplicate commitments.
3588
3824
  #
3589
3825
  # The request ID must be a valid UUID with the exception that zero UUID is
@@ -3651,7 +3887,109 @@ module Google
3651
3887
 
3652
3888
  @alloy_db_admin_stub.call_rpc :delete_user, request, options: options do |response, operation|
3653
3889
  yield response, operation if block_given?
3654
- return response
3890
+ end
3891
+ rescue ::GRPC::BadStatus => e
3892
+ raise ::Google::Cloud::Error.from_error(e)
3893
+ end
3894
+
3895
+ ##
3896
+ # Lists Databases in a given project and location.
3897
+ #
3898
+ # @overload list_databases(request, options = nil)
3899
+ # Pass arguments to `list_databases` via a request object, either of type
3900
+ # {::Google::Cloud::AlloyDB::V1::ListDatabasesRequest} or an equivalent Hash.
3901
+ #
3902
+ # @param request [::Google::Cloud::AlloyDB::V1::ListDatabasesRequest, ::Hash]
3903
+ # A request object representing the call parameters. Required. To specify no
3904
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
3905
+ # @param options [::Gapic::CallOptions, ::Hash]
3906
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
3907
+ #
3908
+ # @overload list_databases(parent: nil, page_size: nil, page_token: nil, filter: nil)
3909
+ # Pass arguments to `list_databases` via keyword arguments. Note that at
3910
+ # least one keyword argument is required. To specify no parameters, or to keep all
3911
+ # the default parameter values, pass an empty Hash as a request object (see above).
3912
+ #
3913
+ # @param parent [::String]
3914
+ # Required. Parent value for ListDatabasesRequest.
3915
+ # @param page_size [::Integer]
3916
+ # Optional. The maximum number of databases to return. The service may return
3917
+ # fewer than this value. If unspecified, 2000 is the default page_size. The
3918
+ # max value of page_size will be 4000, values above max will be coerced to
3919
+ # max.
3920
+ # @param page_token [::String]
3921
+ # Optional. A page token, received from a previous `ListDatabases` call.
3922
+ # This should be provided to retrieve the subsequent page.
3923
+ # This field is currently not supported, its value will be ignored if passed.
3924
+ # @param filter [::String]
3925
+ # Optional. Filtering results.
3926
+ # This field is currently not supported, its value will be ignored if passed.
3927
+ #
3928
+ # @yield [response, operation] Access the result along with the RPC operation
3929
+ # @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::AlloyDB::V1::Database>]
3930
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
3931
+ #
3932
+ # @return [::Gapic::PagedEnumerable<::Google::Cloud::AlloyDB::V1::Database>]
3933
+ #
3934
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
3935
+ #
3936
+ # @example Basic example
3937
+ # require "google/cloud/alloy_db/v1"
3938
+ #
3939
+ # # Create a client object. The client can be reused for multiple calls.
3940
+ # client = Google::Cloud::AlloyDB::V1::AlloyDBAdmin::Client.new
3941
+ #
3942
+ # # Create a request. To set request fields, pass in keyword arguments.
3943
+ # request = Google::Cloud::AlloyDB::V1::ListDatabasesRequest.new
3944
+ #
3945
+ # # Call the list_databases method.
3946
+ # result = client.list_databases request
3947
+ #
3948
+ # # The returned object is of type Gapic::PagedEnumerable. You can iterate
3949
+ # # over elements, and API calls will be issued to fetch pages as needed.
3950
+ # result.each do |item|
3951
+ # # Each element is of type ::Google::Cloud::AlloyDB::V1::Database.
3952
+ # p item
3953
+ # end
3954
+ #
3955
+ def list_databases request, options = nil
3956
+ raise ::ArgumentError, "request must be provided" if request.nil?
3957
+
3958
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::AlloyDB::V1::ListDatabasesRequest
3959
+
3960
+ # Converts hash and nil to an options object
3961
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
3962
+
3963
+ # Customize the options with defaults
3964
+ metadata = @config.rpcs.list_databases.metadata.to_h
3965
+
3966
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
3967
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
3968
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
3969
+ gapic_version: ::Google::Cloud::AlloyDB::V1::VERSION
3970
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
3971
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
3972
+
3973
+ header_params = {}
3974
+ if request.parent
3975
+ header_params["parent"] = request.parent
3976
+ end
3977
+
3978
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
3979
+ metadata[:"x-goog-request-params"] ||= request_params_header
3980
+
3981
+ options.apply_defaults timeout: @config.rpcs.list_databases.timeout,
3982
+ metadata: metadata,
3983
+ retry_policy: @config.rpcs.list_databases.retry_policy
3984
+
3985
+ options.apply_defaults timeout: @config.timeout,
3986
+ metadata: @config.metadata,
3987
+ retry_policy: @config.retry_policy
3988
+
3989
+ @alloy_db_admin_stub.call_rpc :list_databases, request, options: options do |response, operation|
3990
+ response = ::Gapic::PagedEnumerable.new @alloy_db_admin_stub, :list_databases, request, response, operation, options
3991
+ yield response, operation if block_given?
3992
+ throw :response, response
3655
3993
  end
3656
3994
  rescue ::GRPC::BadStatus => e
3657
3995
  raise ::Google::Cloud::Error.from_error(e)
@@ -3740,6 +4078,11 @@ module Google
3740
4078
  # default endpoint URL. The default value of nil uses the environment
3741
4079
  # universe (usually the default "googleapis.com" universe).
3742
4080
  # @return [::String,nil]
4081
+ # @!attribute [rw] logger
4082
+ # A custom logger to use for request/response debug logging, or the value
4083
+ # `:default` (the default) to construct a default logger, or `nil` to
4084
+ # explicitly disable logging.
4085
+ # @return [::Logger,:default,nil]
3743
4086
  #
3744
4087
  class Configuration
3745
4088
  extend ::Gapic::Config
@@ -3764,6 +4107,7 @@ module Google
3764
4107
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
3765
4108
  config_attr :quota_project, nil, ::String, nil
3766
4109
  config_attr :universe_domain, nil, ::String, nil
4110
+ config_attr :logger, :default, ::Logger, nil, :default
3767
4111
 
3768
4112
  # @private
3769
4113
  def initialize parent_config = nil
@@ -3841,6 +4185,11 @@ module Google
3841
4185
  #
3842
4186
  attr_reader :promote_cluster
3843
4187
  ##
4188
+ # RPC-specific configuration for `switchover_cluster`
4189
+ # @return [::Gapic::Config::Method]
4190
+ #
4191
+ attr_reader :switchover_cluster
4192
+ ##
3844
4193
  # RPC-specific configuration for `restore_cluster`
3845
4194
  # @return [::Gapic::Config::Method]
3846
4195
  #
@@ -3901,6 +4250,11 @@ module Google
3901
4250
  #
3902
4251
  attr_reader :restart_instance
3903
4252
  ##
4253
+ # RPC-specific configuration for `execute_sql`
4254
+ # @return [::Gapic::Config::Method]
4255
+ #
4256
+ attr_reader :execute_sql
4257
+ ##
3904
4258
  # RPC-specific configuration for `list_backups`
3905
4259
  # @return [::Gapic::Config::Method]
3906
4260
  #
@@ -3965,6 +4319,11 @@ module Google
3965
4319
  # @return [::Gapic::Config::Method]
3966
4320
  #
3967
4321
  attr_reader :delete_user
4322
+ ##
4323
+ # RPC-specific configuration for `list_databases`
4324
+ # @return [::Gapic::Config::Method]
4325
+ #
4326
+ attr_reader :list_databases
3968
4327
 
3969
4328
  # @private
3970
4329
  def initialize parent_rpcs = nil
@@ -3980,6 +4339,8 @@ module Google
3980
4339
  @delete_cluster = ::Gapic::Config::Method.new delete_cluster_config
3981
4340
  promote_cluster_config = parent_rpcs.promote_cluster if parent_rpcs.respond_to? :promote_cluster
3982
4341
  @promote_cluster = ::Gapic::Config::Method.new promote_cluster_config
4342
+ switchover_cluster_config = parent_rpcs.switchover_cluster if parent_rpcs.respond_to? :switchover_cluster
4343
+ @switchover_cluster = ::Gapic::Config::Method.new switchover_cluster_config
3983
4344
  restore_cluster_config = parent_rpcs.restore_cluster if parent_rpcs.respond_to? :restore_cluster
3984
4345
  @restore_cluster = ::Gapic::Config::Method.new restore_cluster_config
3985
4346
  create_secondary_cluster_config = parent_rpcs.create_secondary_cluster if parent_rpcs.respond_to? :create_secondary_cluster
@@ -4004,6 +4365,8 @@ module Google
4004
4365
  @inject_fault = ::Gapic::Config::Method.new inject_fault_config
4005
4366
  restart_instance_config = parent_rpcs.restart_instance if parent_rpcs.respond_to? :restart_instance
4006
4367
  @restart_instance = ::Gapic::Config::Method.new restart_instance_config
4368
+ execute_sql_config = parent_rpcs.execute_sql if parent_rpcs.respond_to? :execute_sql
4369
+ @execute_sql = ::Gapic::Config::Method.new execute_sql_config
4007
4370
  list_backups_config = parent_rpcs.list_backups if parent_rpcs.respond_to? :list_backups
4008
4371
  @list_backups = ::Gapic::Config::Method.new list_backups_config
4009
4372
  get_backup_config = parent_rpcs.get_backup if parent_rpcs.respond_to? :get_backup
@@ -4030,6 +4393,8 @@ module Google
4030
4393
  @update_user = ::Gapic::Config::Method.new update_user_config
4031
4394
  delete_user_config = parent_rpcs.delete_user if parent_rpcs.respond_to? :delete_user
4032
4395
  @delete_user = ::Gapic::Config::Method.new delete_user_config
4396
+ list_databases_config = parent_rpcs.list_databases if parent_rpcs.respond_to? :list_databases
4397
+ @list_databases = ::Gapic::Config::Method.new list_databases_config
4033
4398
 
4034
4399
  yield self if block_given?
4035
4400
  end