google-cloud-alloy_db-v1 0.9.2 → 0.11.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -206,15 +206,27 @@ module Google
206
206
  endpoint: @config.endpoint,
207
207
  endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
208
208
  universe_domain: @config.universe_domain,
209
- credentials: credentials
209
+ credentials: credentials,
210
+ logger: @config.logger
210
211
  )
211
212
 
213
+ @alloy_db_admin_stub.logger(stub: true)&.info do |entry|
214
+ entry.set_system_name
215
+ entry.set_service
216
+ entry.message = "Created client for #{entry.service}"
217
+ entry.set_credentials_fields credentials
218
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
219
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
220
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
221
+ end
222
+
212
223
  @location_client = Google::Cloud::Location::Locations::Rest::Client.new do |config|
213
224
  config.credentials = credentials
214
225
  config.quota_project = @quota_project_id
215
226
  config.endpoint = @alloy_db_admin_stub.endpoint
216
227
  config.universe_domain = @alloy_db_admin_stub.universe_domain
217
228
  config.bindings_override = @config.bindings_override
229
+ config.logger = @alloy_db_admin_stub.logger if config.respond_to? :logger=
218
230
  end
219
231
 
220
232
  @iam_policy_client = Google::Iam::V1::IAMPolicy::Rest::Client.new do |config|
@@ -222,6 +234,7 @@ module Google
222
234
  config.quota_project = @quota_project_id
223
235
  config.endpoint = @alloy_db_admin_stub.endpoint
224
236
  config.universe_domain = @alloy_db_admin_stub.universe_domain
237
+ config.logger = @alloy_db_admin_stub.logger if config.respond_to? :logger=
225
238
  end
226
239
  end
227
240
 
@@ -246,6 +259,15 @@ module Google
246
259
  #
247
260
  attr_reader :iam_policy_client
248
261
 
262
+ ##
263
+ # The logger used for request/response debug logging.
264
+ #
265
+ # @return [Logger]
266
+ #
267
+ def logger
268
+ @alloy_db_admin_stub.logger
269
+ end
270
+
249
271
  # Service calls
250
272
 
251
273
  ##
@@ -337,7 +359,6 @@ module Google
337
359
 
338
360
  @alloy_db_admin_stub.list_clusters request, options do |result, operation|
339
361
  yield result, operation if block_given?
340
- return result
341
362
  end
342
363
  rescue ::Gapic::Rest::Error => e
343
364
  raise ::Google::Cloud::Error.from_error(e)
@@ -420,7 +441,6 @@ module Google
420
441
 
421
442
  @alloy_db_admin_stub.get_cluster request, options do |result, operation|
422
443
  yield result, operation if block_given?
423
- return result
424
444
  end
425
445
  rescue ::Gapic::Rest::Error => e
426
446
  raise ::Google::Cloud::Error.from_error(e)
@@ -453,22 +473,22 @@ module Google
453
473
  # Required. The resource being created
454
474
  # @param request_id [::String]
455
475
  # Optional. An optional request ID to identify requests. Specify a unique
456
- # request ID so that if you must retry your request, the server will know to
457
- # ignore the request if it has already been completed. The server will
458
- # guarantee that for at least 60 minutes since the first request.
476
+ # request ID so that if you must retry your request, the server ignores the
477
+ # request if it has already been completed. The server guarantees that for at
478
+ # least 60 minutes since the first request.
459
479
  #
460
480
  # For example, consider a situation where you make an initial request and
461
481
  # the request times out. If you make the request again with the same request
462
- # ID, the server can check if original operation with the same request ID
463
- # was received, and if so, will ignore the second request. This prevents
482
+ # ID, the server can check if the original operation with the same request ID
483
+ # was received, and if so, ignores the second request. This prevents
464
484
  # clients from accidentally creating duplicate commitments.
465
485
  #
466
486
  # The request ID must be a valid UUID with the exception that zero UUID is
467
487
  # not supported (00000000-0000-0000-0000-000000000000).
468
488
  # @param validate_only [::Boolean]
469
- # Optional. If set, performs request validation (e.g. permission checks and
470
- # any other type of validation), but do not actually execute the create
471
- # request.
489
+ # Optional. If set, performs request validation, for example, permission
490
+ # checks and any other type of validation, but does not actually execute the
491
+ # create request.
472
492
  # @yield [result, operation] Access the result along with the TransportOperation object
473
493
  # @yieldparam result [::Gapic::Operation]
474
494
  # @yieldparam operation [::Gapic::Rest::TransportOperation]
@@ -530,7 +550,7 @@ module Google
530
550
  @alloy_db_admin_stub.create_cluster request, options do |result, operation|
531
551
  result = ::Gapic::Operation.new result, @operations_client, options: options
532
552
  yield result, operation if block_given?
533
- return result
553
+ throw :response, result
534
554
  end
535
555
  rescue ::Gapic::Rest::Error => e
536
556
  raise ::Google::Cloud::Error.from_error(e)
@@ -564,22 +584,22 @@ module Google
564
584
  # Required. The resource being updated
565
585
  # @param request_id [::String]
566
586
  # 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.
587
+ # request ID so that if you must retry your request, the server ignores the
588
+ # request if it has already been completed. The server guarantees that for at
589
+ # least 60 minutes since the first request.
570
590
  #
571
591
  # For example, consider a situation where you make an initial request and
572
592
  # 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
593
+ # ID, the server can check if the original operation with the same request ID
594
+ # was received, and if so, ignores the second request. This prevents
575
595
  # clients from accidentally creating duplicate commitments.
576
596
  #
577
597
  # The request ID must be a valid UUID with the exception that zero UUID is
578
598
  # not supported (00000000-0000-0000-0000-000000000000).
579
599
  # @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.
600
+ # Optional. If set, performs request validation, for example, permission
601
+ # checks and any other type of validation, but does not actually execute the
602
+ # create request.
583
603
  # @param allow_missing [::Boolean]
584
604
  # Optional. If set to true, update succeeds even if cluster is not found. In
585
605
  # that case, a new cluster is created and `update_mask` is ignored.
@@ -644,7 +664,7 @@ module Google
644
664
  @alloy_db_admin_stub.update_cluster request, options do |result, operation|
645
665
  result = ::Gapic::Operation.new result, @operations_client, options: options
646
666
  yield result, operation if block_given?
647
- return result
667
+ throw :response, result
648
668
  end
649
669
  rescue ::Gapic::Rest::Error => e
650
670
  raise ::Google::Cloud::Error.from_error(e)
@@ -673,14 +693,14 @@ module Google
673
693
  # comment on the Cluster.name field.
674
694
  # @param request_id [::String]
675
695
  # Optional. An optional request ID to identify requests. Specify a unique
676
- # request ID so that if you must retry your request, the server will know to
677
- # ignore the request if it has already been completed. The server will
678
- # guarantee that for at least 60 minutes after the first request.
696
+ # request ID so that if you must retry your request, the server ignores the
697
+ # request if it has already been completed. The server guarantees that for at
698
+ # least 60 minutes since the first request.
679
699
  #
680
700
  # For example, consider a situation where you make an initial request and
681
701
  # the request times out. If you make the request again with the same request
682
- # ID, the server can check if original operation with the same request ID
683
- # was received, and if so, will ignore the second request. This prevents
702
+ # ID, the server can check if the original operation with the same request ID
703
+ # was received, and if so, ignores the second request. This prevents
684
704
  # clients from accidentally creating duplicate commitments.
685
705
  #
686
706
  # The request ID must be a valid UUID with the exception that zero UUID is
@@ -690,8 +710,9 @@ module Google
690
710
  # If an etag is provided and does not match the current etag of the Cluster,
691
711
  # deletion will be blocked and an ABORTED error will be returned.
692
712
  # @param validate_only [::Boolean]
693
- # Optional. If set, performs request validation (e.g. permission checks and
694
- # any other type of validation), but do not actually execute the delete.
713
+ # Optional. If set, performs request validation, for example, permission
714
+ # checks and any other type of validation, but does not actually execute the
715
+ # create request.
695
716
  # @param force [::Boolean]
696
717
  # Optional. Whether to cascade delete child instances for given cluster.
697
718
  # @yield [result, operation] Access the result along with the TransportOperation object
@@ -755,7 +776,7 @@ module Google
755
776
  @alloy_db_admin_stub.delete_cluster request, options do |result, operation|
756
777
  result = ::Gapic::Operation.new result, @operations_client, options: options
757
778
  yield result, operation if block_given?
758
- return result
779
+ throw :response, result
759
780
  end
760
781
  rescue ::Gapic::Rest::Error => e
761
782
  raise ::Google::Cloud::Error.from_error(e)
@@ -787,9 +808,9 @@ module Google
787
808
  # comment on the Cluster.name field
788
809
  # @param request_id [::String]
789
810
  # Optional. An optional request ID to identify requests. Specify a unique
790
- # request ID so that if you must retry your request, the server will know to
791
- # ignore the request if it has already been completed. The server will
792
- # guarantee that for at least 60 minutes after the first request.
811
+ # request ID so that if you must retry your request, the server ignores the
812
+ # request if it has already been completed. The server guarantees that for at
813
+ # least 60 minutes since the first request.
793
814
  #
794
815
  # For example, consider a situation where you make an initial request and
795
816
  # the request times out. If you make the request again with the same request
@@ -804,8 +825,9 @@ module Google
804
825
  # If an etag is provided and does not match the current etag of the Cluster,
805
826
  # deletion will be blocked and an ABORTED error will be returned.
806
827
  # @param validate_only [::Boolean]
807
- # Optional. If set, performs request validation (e.g. permission checks and
808
- # any other type of validation), but do not actually execute the delete.
828
+ # Optional. If set, performs request validation, for example, permission
829
+ # checks and any other type of validation, but does not actually execute the
830
+ # create request.
809
831
  # @yield [result, operation] Access the result along with the TransportOperation object
810
832
  # @yieldparam result [::Gapic::Operation]
811
833
  # @yieldparam operation [::Gapic::Rest::TransportOperation]
@@ -867,7 +889,115 @@ module Google
867
889
  @alloy_db_admin_stub.promote_cluster request, options do |result, operation|
868
890
  result = ::Gapic::Operation.new result, @operations_client, options: options
869
891
  yield result, operation if block_given?
870
- return result
892
+ throw :response, result
893
+ end
894
+ rescue ::Gapic::Rest::Error => e
895
+ raise ::Google::Cloud::Error.from_error(e)
896
+ end
897
+
898
+ ##
899
+ # Switches the roles of PRIMARY and SECONDARY clusters without any data loss.
900
+ # This promotes the SECONDARY cluster to PRIMARY and sets up the original
901
+ # PRIMARY cluster to replicate from this newly promoted cluster.
902
+ #
903
+ # @overload switchover_cluster(request, options = nil)
904
+ # Pass arguments to `switchover_cluster` via a request object, either of type
905
+ # {::Google::Cloud::AlloyDB::V1::SwitchoverClusterRequest} or an equivalent Hash.
906
+ #
907
+ # @param request [::Google::Cloud::AlloyDB::V1::SwitchoverClusterRequest, ::Hash]
908
+ # A request object representing the call parameters. Required. To specify no
909
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
910
+ # @param options [::Gapic::CallOptions, ::Hash]
911
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
912
+ #
913
+ # @overload switchover_cluster(name: nil, request_id: nil, validate_only: nil)
914
+ # Pass arguments to `switchover_cluster` via keyword arguments. Note that at
915
+ # least one keyword argument is required. To specify no parameters, or to keep all
916
+ # the default parameter values, pass an empty Hash as a request object (see above).
917
+ #
918
+ # @param name [::String]
919
+ # Required. The name of the resource. For the required format, see the
920
+ # comment on the Cluster.name field
921
+ # @param request_id [::String]
922
+ # Optional. An optional request ID to identify requests. Specify a unique
923
+ # request ID so that if you must retry your request, the server ignores the
924
+ # request if it has already been completed. The server guarantees that for at
925
+ # least 60 minutes since the first request.
926
+ #
927
+ # For example, consider a situation where you make an initial request and
928
+ # the request times out. If you make the request again with the same request
929
+ # ID, the server can check if the original operation with the same request ID
930
+ # was received, and if so, ignores the second request. This prevents
931
+ # clients from accidentally creating duplicate commitments.
932
+ #
933
+ # The request ID must be a valid UUID with the exception that zero UUID is
934
+ # not supported (00000000-0000-0000-0000-000000000000).
935
+ # @param validate_only [::Boolean]
936
+ # Optional. If set, performs request validation, for example, permission
937
+ # checks and any other type of validation, but does not actually execute the
938
+ # create request.
939
+ # @yield [result, operation] Access the result along with the TransportOperation object
940
+ # @yieldparam result [::Gapic::Operation]
941
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
942
+ #
943
+ # @return [::Gapic::Operation]
944
+ #
945
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
946
+ #
947
+ # @example Basic example
948
+ # require "google/cloud/alloy_db/v1"
949
+ #
950
+ # # Create a client object. The client can be reused for multiple calls.
951
+ # client = Google::Cloud::AlloyDB::V1::AlloyDBAdmin::Rest::Client.new
952
+ #
953
+ # # Create a request. To set request fields, pass in keyword arguments.
954
+ # request = Google::Cloud::AlloyDB::V1::SwitchoverClusterRequest.new
955
+ #
956
+ # # Call the switchover_cluster method.
957
+ # result = client.switchover_cluster request
958
+ #
959
+ # # The returned object is of type Gapic::Operation. You can use it to
960
+ # # check the status of an operation, cancel it, or wait for results.
961
+ # # Here is how to wait for a response.
962
+ # result.wait_until_done! timeout: 60
963
+ # if result.response?
964
+ # p result.response
965
+ # else
966
+ # puts "No response received."
967
+ # end
968
+ #
969
+ def switchover_cluster request, options = nil
970
+ raise ::ArgumentError, "request must be provided" if request.nil?
971
+
972
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::AlloyDB::V1::SwitchoverClusterRequest
973
+
974
+ # Converts hash and nil to an options object
975
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
976
+
977
+ # Customize the options with defaults
978
+ call_metadata = @config.rpcs.switchover_cluster.metadata.to_h
979
+
980
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
981
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
982
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
983
+ gapic_version: ::Google::Cloud::AlloyDB::V1::VERSION,
984
+ transports_version_send: [:rest]
985
+
986
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
987
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
988
+
989
+ options.apply_defaults timeout: @config.rpcs.switchover_cluster.timeout,
990
+ metadata: call_metadata,
991
+ retry_policy: @config.rpcs.switchover_cluster.retry_policy
992
+
993
+ options.apply_defaults timeout: @config.timeout,
994
+ metadata: @config.metadata,
995
+ retry_policy: @config.retry_policy
996
+
997
+ @alloy_db_admin_stub.switchover_cluster request, options do |result, operation|
998
+ result = ::Gapic::Operation.new result, @operations_client, options: options
999
+ yield result, operation if block_given?
1000
+ throw :response, result
871
1001
  end
872
1002
  rescue ::Gapic::Rest::Error => e
873
1003
  raise ::Google::Cloud::Error.from_error(e)
@@ -907,22 +1037,22 @@ module Google
907
1037
  # Required. The resource being created
908
1038
  # @param request_id [::String]
909
1039
  # Optional. An optional request ID to identify requests. Specify a unique
910
- # request ID so that if you must retry your request, the server will know to
911
- # ignore the request if it has already been completed. The server will
912
- # guarantee that for at least 60 minutes since the first request.
1040
+ # request ID so that if you must retry your request, the server ignores the
1041
+ # request if it has already been completed. The server guarantees that for at
1042
+ # least 60 minutes since the first request.
913
1043
  #
914
1044
  # For example, consider a situation where you make an initial request and
915
1045
  # the request times out. If you make the request again with the same request
916
- # ID, the server can check if original operation with the same request ID
917
- # was received, and if so, will ignore the second request. This prevents
1046
+ # ID, the server can check if the original operation with the same request ID
1047
+ # was received, and if so, ignores the second request. This prevents
918
1048
  # clients from accidentally creating duplicate commitments.
919
1049
  #
920
1050
  # The request ID must be a valid UUID with the exception that zero UUID is
921
1051
  # not supported (00000000-0000-0000-0000-000000000000).
922
1052
  # @param validate_only [::Boolean]
923
- # Optional. If set, performs request validation (e.g. permission checks and
924
- # any other type of validation), but do not actually execute the import
925
- # request.
1053
+ # Optional. If set, performs request validation, for example, permission
1054
+ # checks and any other type of validation, but does not actually execute the
1055
+ # create request.
926
1056
  # @yield [result, operation] Access the result along with the TransportOperation object
927
1057
  # @yieldparam result [::Gapic::Operation]
928
1058
  # @yieldparam operation [::Gapic::Rest::TransportOperation]
@@ -984,7 +1114,7 @@ module Google
984
1114
  @alloy_db_admin_stub.restore_cluster request, options do |result, operation|
985
1115
  result = ::Gapic::Operation.new result, @operations_client, options: options
986
1116
  yield result, operation if block_given?
987
- return result
1117
+ throw :response, result
988
1118
  end
989
1119
  rescue ::Gapic::Rest::Error => e
990
1120
  raise ::Google::Cloud::Error.from_error(e)
@@ -1018,22 +1148,22 @@ module Google
1018
1148
  # Required. Configuration of the requesting object (the secondary cluster).
1019
1149
  # @param request_id [::String]
1020
1150
  # Optional. An optional request ID to identify requests. Specify a unique
1021
- # request ID so that if you must retry your request, the server will know to
1022
- # ignore the request if it has already been completed. The server will
1023
- # guarantee that for at least 60 minutes since the first request.
1151
+ # request ID so that if you must retry your request, the server ignores the
1152
+ # request if it has already been completed. The server guarantees that for at
1153
+ # least 60 minutes since the first request.
1024
1154
  #
1025
1155
  # For example, consider a situation where you make an initial request and
1026
1156
  # the request times out. If you make the request again with the same request
1027
- # ID, the server can check if original operation with the same request ID
1028
- # was received, and if so, will ignore the second request. This prevents
1157
+ # ID, the server can check if the original operation with the same request ID
1158
+ # was received, and if so, ignores the second request. This prevents
1029
1159
  # clients from accidentally creating duplicate commitments.
1030
1160
  #
1031
1161
  # The request ID must be a valid UUID with the exception that zero UUID is
1032
1162
  # not supported (00000000-0000-0000-0000-000000000000).
1033
1163
  # @param validate_only [::Boolean]
1034
- # Optional. If set, performs request validation (e.g. permission checks and
1035
- # any other type of validation), but do not actually execute the create
1036
- # request.
1164
+ # Optional. If set, performs request validation, for example, permission
1165
+ # checks and any other type of validation, but does not actually execute the
1166
+ # create request.
1037
1167
  # @yield [result, operation] Access the result along with the TransportOperation object
1038
1168
  # @yieldparam result [::Gapic::Operation]
1039
1169
  # @yieldparam operation [::Gapic::Rest::TransportOperation]
@@ -1095,7 +1225,7 @@ module Google
1095
1225
  @alloy_db_admin_stub.create_secondary_cluster request, options do |result, operation|
1096
1226
  result = ::Gapic::Operation.new result, @operations_client, options: options
1097
1227
  yield result, operation if block_given?
1098
- return result
1228
+ throw :response, result
1099
1229
  end
1100
1230
  rescue ::Gapic::Rest::Error => e
1101
1231
  raise ::Google::Cloud::Error.from_error(e)
@@ -1192,7 +1322,6 @@ module Google
1192
1322
 
1193
1323
  @alloy_db_admin_stub.list_instances request, options do |result, operation|
1194
1324
  yield result, operation if block_given?
1195
- return result
1196
1325
  end
1197
1326
  rescue ::Gapic::Rest::Error => e
1198
1327
  raise ::Google::Cloud::Error.from_error(e)
@@ -1274,7 +1403,6 @@ module Google
1274
1403
 
1275
1404
  @alloy_db_admin_stub.get_instance request, options do |result, operation|
1276
1405
  yield result, operation if block_given?
1277
- return result
1278
1406
  end
1279
1407
  rescue ::Gapic::Rest::Error => e
1280
1408
  raise ::Google::Cloud::Error.from_error(e)
@@ -1307,22 +1435,22 @@ module Google
1307
1435
  # Required. The resource being created
1308
1436
  # @param request_id [::String]
1309
1437
  # Optional. An optional request ID to identify requests. Specify a unique
1310
- # request ID so that if you must retry your request, the server will know to
1311
- # ignore the request if it has already been completed. The server will
1312
- # guarantee that for at least 60 minutes since the first request.
1438
+ # request ID so that if you must retry your request, the server ignores the
1439
+ # request if it has already been completed. The server guarantees that for at
1440
+ # least 60 minutes since the first request.
1313
1441
  #
1314
1442
  # For example, consider a situation where you make an initial request and
1315
1443
  # the request times out. If you make the request again with the same request
1316
- # ID, the server can check if original operation with the same request ID
1317
- # was received, and if so, will ignore the second request. This prevents
1444
+ # ID, the server can check if the original operation with the same request ID
1445
+ # was received, and if so, ignores the second request. This prevents
1318
1446
  # clients from accidentally creating duplicate commitments.
1319
1447
  #
1320
1448
  # The request ID must be a valid UUID with the exception that zero UUID is
1321
1449
  # not supported (00000000-0000-0000-0000-000000000000).
1322
1450
  # @param validate_only [::Boolean]
1323
- # Optional. If set, performs request validation (e.g. permission checks and
1324
- # any other type of validation), but do not actually execute the create
1325
- # request.
1451
+ # Optional. If set, performs request validation, for example, permission
1452
+ # checks and any other type of validation, but does not actually execute the
1453
+ # create request.
1326
1454
  # @yield [result, operation] Access the result along with the TransportOperation object
1327
1455
  # @yieldparam result [::Gapic::Operation]
1328
1456
  # @yieldparam operation [::Gapic::Rest::TransportOperation]
@@ -1384,7 +1512,7 @@ module Google
1384
1512
  @alloy_db_admin_stub.create_instance request, options do |result, operation|
1385
1513
  result = ::Gapic::Operation.new result, @operations_client, options: options
1386
1514
  yield result, operation if block_given?
1387
- return result
1515
+ throw :response, result
1388
1516
  end
1389
1517
  rescue ::Gapic::Rest::Error => e
1390
1518
  raise ::Google::Cloud::Error.from_error(e)
@@ -1417,22 +1545,22 @@ module Google
1417
1545
  # Required. The resource being created
1418
1546
  # @param request_id [::String]
1419
1547
  # Optional. An optional request ID to identify requests. Specify a unique
1420
- # request ID so that if you must retry your request, the server will know to
1421
- # ignore the request if it has already been completed. The server will
1422
- # guarantee that for at least 60 minutes since the first request.
1548
+ # request ID so that if you must retry your request, the server ignores the
1549
+ # request if it has already been completed. The server guarantees that for at
1550
+ # least 60 minutes since the first request.
1423
1551
  #
1424
1552
  # For example, consider a situation where you make an initial request and
1425
1553
  # the request times out. If you make the request again with the same request
1426
- # ID, the server can check if original operation with the same request ID
1427
- # was received, and if so, will ignore the second request. This prevents
1554
+ # ID, the server can check if the original operation with the same request ID
1555
+ # was received, and if so, ignores the second request. This prevents
1428
1556
  # clients from accidentally creating duplicate commitments.
1429
1557
  #
1430
1558
  # The request ID must be a valid UUID with the exception that zero UUID is
1431
1559
  # not supported (00000000-0000-0000-0000-000000000000).
1432
1560
  # @param validate_only [::Boolean]
1433
- # Optional. If set, performs request validation (e.g. permission checks and
1434
- # any other type of validation), but do not actually execute the create
1435
- # request.
1561
+ # Optional. If set, performs request validation, for example, permission
1562
+ # checks and any other type of validation, but does not actually execute the
1563
+ # create request.
1436
1564
  # @yield [result, operation] Access the result along with the TransportOperation object
1437
1565
  # @yieldparam result [::Gapic::Operation]
1438
1566
  # @yieldparam operation [::Gapic::Rest::TransportOperation]
@@ -1494,7 +1622,7 @@ module Google
1494
1622
  @alloy_db_admin_stub.create_secondary_instance request, options do |result, operation|
1495
1623
  result = ::Gapic::Operation.new result, @operations_client, options: options
1496
1624
  yield result, operation if block_given?
1497
- return result
1625
+ throw :response, result
1498
1626
  end
1499
1627
  rescue ::Gapic::Rest::Error => e
1500
1628
  raise ::Google::Cloud::Error.from_error(e)
@@ -1533,14 +1661,14 @@ module Google
1533
1661
  # Required. Resources being created.
1534
1662
  # @param request_id [::String]
1535
1663
  # Optional. An optional request ID to identify requests. Specify a unique
1536
- # request ID so that if you must retry your request, the server will know to
1537
- # ignore the request if it has already been completed. The server will
1538
- # guarantee that for at least 60 minutes since the first request.
1664
+ # request ID so that if you must retry your request, the server ignores the
1665
+ # request if it has already been completed. The server guarantees that for at
1666
+ # least 60 minutes since the first request.
1539
1667
  #
1540
1668
  # For example, consider a situation where you make an initial request and
1541
1669
  # the request times out. If you make the request again with the same request
1542
- # ID, the server can check if original operation with the same request ID
1543
- # was received, and if so, will ignore the second request. This prevents
1670
+ # ID, the server can check if the original operation with the same request ID
1671
+ # was received, and if so, ignores the second request. This prevents
1544
1672
  # clients from accidentally creating duplicate commitments.
1545
1673
  #
1546
1674
  # The request ID must be a valid UUID with the exception that zero UUID is
@@ -1606,7 +1734,7 @@ module Google
1606
1734
  @alloy_db_admin_stub.batch_create_instances request, options do |result, operation|
1607
1735
  result = ::Gapic::Operation.new result, @operations_client, options: options
1608
1736
  yield result, operation if block_given?
1609
- return result
1737
+ throw :response, result
1610
1738
  end
1611
1739
  rescue ::Gapic::Rest::Error => e
1612
1740
  raise ::Google::Cloud::Error.from_error(e)
@@ -1640,22 +1768,22 @@ module Google
1640
1768
  # Required. The resource being updated
1641
1769
  # @param request_id [::String]
1642
1770
  # Optional. An optional request ID to identify requests. Specify a unique
1643
- # request ID so that if you must retry your request, the server will know to
1644
- # ignore the request if it has already been completed. The server will
1645
- # guarantee that for at least 60 minutes since the first request.
1771
+ # request ID so that if you must retry your request, the server ignores the
1772
+ # request if it has already been completed. The server guarantees that for at
1773
+ # least 60 minutes since the first request.
1646
1774
  #
1647
1775
  # For example, consider a situation where you make an initial request and
1648
1776
  # the request times out. If you make the request again with the same request
1649
- # ID, the server can check if original operation with the same request ID
1650
- # was received, and if so, will ignore the second request. This prevents
1777
+ # ID, the server can check if the original operation with the same request ID
1778
+ # was received, and if so, ignores the second request. This prevents
1651
1779
  # clients from accidentally creating duplicate commitments.
1652
1780
  #
1653
1781
  # The request ID must be a valid UUID with the exception that zero UUID is
1654
1782
  # not supported (00000000-0000-0000-0000-000000000000).
1655
1783
  # @param validate_only [::Boolean]
1656
- # Optional. If set, performs request validation (e.g. permission checks and
1657
- # any other type of validation), but do not actually execute the update
1658
- # request.
1784
+ # Optional. If set, performs request validation, for example, permission
1785
+ # checks and any other type of validation, but does not actually execute the
1786
+ # create request.
1659
1787
  # @param allow_missing [::Boolean]
1660
1788
  # Optional. If set to true, update succeeds even if instance is not found. In
1661
1789
  # that case, a new instance is created and `update_mask` is ignored.
@@ -1720,7 +1848,7 @@ module Google
1720
1848
  @alloy_db_admin_stub.update_instance request, options do |result, operation|
1721
1849
  result = ::Gapic::Operation.new result, @operations_client, options: options
1722
1850
  yield result, operation if block_given?
1723
- return result
1851
+ throw :response, result
1724
1852
  end
1725
1853
  rescue ::Gapic::Rest::Error => e
1726
1854
  raise ::Google::Cloud::Error.from_error(e)
@@ -1749,14 +1877,14 @@ module Google
1749
1877
  # comment on the Instance.name field.
1750
1878
  # @param request_id [::String]
1751
1879
  # Optional. An optional request ID to identify requests. Specify a unique
1752
- # request ID so that if you must retry your request, the server will know to
1753
- # ignore the request if it has already been completed. The server will
1754
- # guarantee that for at least 60 minutes after the first request.
1880
+ # request ID so that if you must retry your request, the server ignores the
1881
+ # request if it has already been completed. The server guarantees that for at
1882
+ # least 60 minutes since the first request.
1755
1883
  #
1756
1884
  # For example, consider a situation where you make an initial request and
1757
1885
  # the request times out. If you make the request again with the same request
1758
- # ID, the server can check if original operation with the same request ID
1759
- # was received, and if so, will ignore the second request. This prevents
1886
+ # ID, the server can check if the original operation with the same request ID
1887
+ # was received, and if so, ignores the second request. This prevents
1760
1888
  # clients from accidentally creating duplicate commitments.
1761
1889
  #
1762
1890
  # The request ID must be a valid UUID with the exception that zero UUID is
@@ -1766,8 +1894,9 @@ module Google
1766
1894
  # If an etag is provided and does not match the current etag of the Instance,
1767
1895
  # deletion will be blocked and an ABORTED error will be returned.
1768
1896
  # @param validate_only [::Boolean]
1769
- # Optional. If set, performs request validation (e.g. permission checks and
1770
- # any other type of validation), but do not actually execute the delete.
1897
+ # Optional. If set, performs request validation, for example, permission
1898
+ # checks and any other type of validation, but does not actually execute the
1899
+ # create request.
1771
1900
  # @yield [result, operation] Access the result along with the TransportOperation object
1772
1901
  # @yieldparam result [::Gapic::Operation]
1773
1902
  # @yieldparam operation [::Gapic::Rest::TransportOperation]
@@ -1829,7 +1958,7 @@ module Google
1829
1958
  @alloy_db_admin_stub.delete_instance request, options do |result, operation|
1830
1959
  result = ::Gapic::Operation.new result, @operations_client, options: options
1831
1960
  yield result, operation if block_given?
1832
- return result
1961
+ throw :response, result
1833
1962
  end
1834
1963
  rescue ::Gapic::Rest::Error => e
1835
1964
  raise ::Google::Cloud::Error.from_error(e)
@@ -1860,21 +1989,22 @@ module Google
1860
1989
  # comment on the Instance.name field.
1861
1990
  # @param request_id [::String]
1862
1991
  # Optional. An optional request ID to identify requests. Specify a unique
1863
- # request ID so that if you must retry your request, the server will know to
1864
- # ignore the request if it has already been completed. The server will
1865
- # guarantee that for at least 60 minutes after the first request.
1992
+ # request ID so that if you must retry your request, the server ignores the
1993
+ # request if it has already been completed. The server guarantees that for at
1994
+ # least 60 minutes since the first request.
1866
1995
  #
1867
1996
  # For example, consider a situation where you make an initial request and
1868
1997
  # the request times out. If you make the request again with the same request
1869
- # ID, the server can check if original operation with the same request ID
1870
- # was received, and if so, will ignore the second request. This prevents
1998
+ # ID, the server can check if the original operation with the same request ID
1999
+ # was received, and if so, ignores the second request. This prevents
1871
2000
  # clients from accidentally creating duplicate commitments.
1872
2001
  #
1873
2002
  # The request ID must be a valid UUID with the exception that zero UUID is
1874
2003
  # not supported (00000000-0000-0000-0000-000000000000).
1875
2004
  # @param validate_only [::Boolean]
1876
- # Optional. If set, performs request validation (e.g. permission checks and
1877
- # any other type of validation), but do not actually execute the failover.
2005
+ # Optional. If set, performs request validation, for example, permission
2006
+ # checks and any other type of validation, but does not actually execute the
2007
+ # create request.
1878
2008
  # @yield [result, operation] Access the result along with the TransportOperation object
1879
2009
  # @yieldparam result [::Gapic::Operation]
1880
2010
  # @yieldparam operation [::Gapic::Rest::TransportOperation]
@@ -1936,7 +2066,7 @@ module Google
1936
2066
  @alloy_db_admin_stub.failover_instance request, options do |result, operation|
1937
2067
  result = ::Gapic::Operation.new result, @operations_client, options: options
1938
2068
  yield result, operation if block_given?
1939
- return result
2069
+ throw :response, result
1940
2070
  end
1941
2071
  rescue ::Gapic::Rest::Error => e
1942
2072
  raise ::Google::Cloud::Error.from_error(e)
@@ -1968,22 +2098,22 @@ module Google
1968
2098
  # comment on the Instance.name field.
1969
2099
  # @param request_id [::String]
1970
2100
  # Optional. An optional request ID to identify requests. Specify a unique
1971
- # request ID so that if you must retry your request, the server will know to
1972
- # ignore the request if it has already been completed. The server will
1973
- # guarantee that for at least 60 minutes after the first request.
2101
+ # request ID so that if you must retry your request, the server ignores the
2102
+ # request if it has already been completed. The server guarantees that for at
2103
+ # least 60 minutes since the first request.
1974
2104
  #
1975
2105
  # For example, consider a situation where you make an initial request and
1976
2106
  # the request times out. If you make the request again with the same request
1977
- # ID, the server can check if original operation with the same request ID
1978
- # was received, and if so, will ignore the second request. This prevents
2107
+ # ID, the server can check if the original operation with the same request ID
2108
+ # was received, and if so, ignores the second request. This prevents
1979
2109
  # clients from accidentally creating duplicate commitments.
1980
2110
  #
1981
2111
  # The request ID must be a valid UUID with the exception that zero UUID is
1982
2112
  # not supported (00000000-0000-0000-0000-000000000000).
1983
2113
  # @param validate_only [::Boolean]
1984
- # Optional. If set, performs request validation (e.g. permission checks and
1985
- # any other type of validation), but do not actually execute the fault
1986
- # injection.
2114
+ # Optional. If set, performs request validation, for example, permission
2115
+ # checks and any other type of validation, but does not actually execute the
2116
+ # create request.
1987
2117
  # @yield [result, operation] Access the result along with the TransportOperation object
1988
2118
  # @yieldparam result [::Gapic::Operation]
1989
2119
  # @yieldparam operation [::Gapic::Rest::TransportOperation]
@@ -2045,7 +2175,7 @@ module Google
2045
2175
  @alloy_db_admin_stub.inject_fault request, options do |result, operation|
2046
2176
  result = ::Gapic::Operation.new result, @operations_client, options: options
2047
2177
  yield result, operation if block_given?
2048
- return result
2178
+ throw :response, result
2049
2179
  end
2050
2180
  rescue ::Gapic::Rest::Error => e
2051
2181
  raise ::Google::Cloud::Error.from_error(e)
@@ -2065,7 +2195,7 @@ module Google
2065
2195
  # @param options [::Gapic::CallOptions, ::Hash]
2066
2196
  # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
2067
2197
  #
2068
- # @overload restart_instance(name: nil, request_id: nil, validate_only: nil)
2198
+ # @overload restart_instance(name: nil, request_id: nil, validate_only: nil, node_ids: nil)
2069
2199
  # Pass arguments to `restart_instance` via keyword arguments. Note that at
2070
2200
  # least one keyword argument is required. To specify no parameters, or to keep all
2071
2201
  # the default parameter values, pass an empty Hash as a request object (see above).
@@ -2075,21 +2205,25 @@ module Google
2075
2205
  # comment on the Instance.name field.
2076
2206
  # @param request_id [::String]
2077
2207
  # Optional. An optional request ID to identify requests. Specify a unique
2078
- # request ID so that if you must retry your request, the server will know to
2079
- # ignore the request if it has already been completed. The server will
2080
- # guarantee that for at least 60 minutes after the first request.
2208
+ # request ID so that if you must retry your request, the server ignores the
2209
+ # request if it has already been completed. The server guarantees that for at
2210
+ # least 60 minutes since the first request.
2081
2211
  #
2082
2212
  # For example, consider a situation where you make an initial request and
2083
2213
  # the request times out. If you make the request again with the same request
2084
- # ID, the server can check if original operation with the same request ID
2085
- # was received, and if so, will ignore the second request. This prevents
2214
+ # ID, the server can check if the original operation with the same request ID
2215
+ # was received, and if so, ignores the second request. This prevents
2086
2216
  # clients from accidentally creating duplicate commitments.
2087
2217
  #
2088
2218
  # The request ID must be a valid UUID with the exception that zero UUID is
2089
2219
  # not supported (00000000-0000-0000-0000-000000000000).
2090
2220
  # @param validate_only [::Boolean]
2091
- # Optional. If set, performs request validation (e.g. permission checks and
2092
- # any other type of validation), but do not actually execute the restart.
2221
+ # Optional. If set, performs request validation, for example, permission
2222
+ # checks and any other type of validation, but does not actually execute the
2223
+ # create request.
2224
+ # @param node_ids [::Array<::String>]
2225
+ # Optional. Full name of the nodes as obtained from INSTANCE_VIEW_FULL to
2226
+ # restart upon. Applicable only to read instances.
2093
2227
  # @yield [result, operation] Access the result along with the TransportOperation object
2094
2228
  # @yieldparam result [::Gapic::Operation]
2095
2229
  # @yieldparam operation [::Gapic::Rest::TransportOperation]
@@ -2151,7 +2285,99 @@ module Google
2151
2285
  @alloy_db_admin_stub.restart_instance request, options do |result, operation|
2152
2286
  result = ::Gapic::Operation.new result, @operations_client, options: options
2153
2287
  yield result, operation if block_given?
2154
- return result
2288
+ throw :response, result
2289
+ end
2290
+ rescue ::Gapic::Rest::Error => e
2291
+ raise ::Google::Cloud::Error.from_error(e)
2292
+ end
2293
+
2294
+ ##
2295
+ # Executes a SQL statement in a database inside an AlloyDB instance.
2296
+ #
2297
+ # @overload execute_sql(request, options = nil)
2298
+ # Pass arguments to `execute_sql` via a request object, either of type
2299
+ # {::Google::Cloud::AlloyDB::V1::ExecuteSqlRequest} or an equivalent Hash.
2300
+ #
2301
+ # @param request [::Google::Cloud::AlloyDB::V1::ExecuteSqlRequest, ::Hash]
2302
+ # A request object representing the call parameters. Required. To specify no
2303
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
2304
+ # @param options [::Gapic::CallOptions, ::Hash]
2305
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
2306
+ #
2307
+ # @overload execute_sql(password: nil, instance: nil, database: nil, user: nil, sql_statement: nil)
2308
+ # Pass arguments to `execute_sql` via keyword arguments. Note that at
2309
+ # least one keyword argument is required. To specify no parameters, or to keep all
2310
+ # the default parameter values, pass an empty Hash as a request object (see above).
2311
+ #
2312
+ # @param password [::String]
2313
+ # Optional. The database native user’s password.
2314
+ # @param instance [::String]
2315
+ # Required. The instance where the SQL will be executed. For the required
2316
+ # format, see the comment on the Instance.name field.
2317
+ # @param database [::String]
2318
+ # Required. Name of the database where the query will be executed.
2319
+ # Note - Value provided should be the same as expected from `SELECT
2320
+ # current_database();` and NOT as a resource reference.
2321
+ # @param user [::String]
2322
+ # Required. Database user to be used for executing the SQL.
2323
+ # Note - Value provided should be the same as expected from
2324
+ # `SELECT current_user;` and NOT as a resource reference.
2325
+ # @param sql_statement [::String]
2326
+ # Required. SQL statement to execute on database. Any valid statement is
2327
+ # permitted, including DDL, DML, DQL statements.
2328
+ # @yield [result, operation] Access the result along with the TransportOperation object
2329
+ # @yieldparam result [::Google::Cloud::AlloyDB::V1::ExecuteSqlResponse]
2330
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
2331
+ #
2332
+ # @return [::Google::Cloud::AlloyDB::V1::ExecuteSqlResponse]
2333
+ #
2334
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
2335
+ #
2336
+ # @example Basic example
2337
+ # require "google/cloud/alloy_db/v1"
2338
+ #
2339
+ # # Create a client object. The client can be reused for multiple calls.
2340
+ # client = Google::Cloud::AlloyDB::V1::AlloyDBAdmin::Rest::Client.new
2341
+ #
2342
+ # # Create a request. To set request fields, pass in keyword arguments.
2343
+ # request = Google::Cloud::AlloyDB::V1::ExecuteSqlRequest.new
2344
+ #
2345
+ # # Call the execute_sql method.
2346
+ # result = client.execute_sql request
2347
+ #
2348
+ # # The returned object is of type Google::Cloud::AlloyDB::V1::ExecuteSqlResponse.
2349
+ # p result
2350
+ #
2351
+ def execute_sql request, options = nil
2352
+ raise ::ArgumentError, "request must be provided" if request.nil?
2353
+
2354
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::AlloyDB::V1::ExecuteSqlRequest
2355
+
2356
+ # Converts hash and nil to an options object
2357
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
2358
+
2359
+ # Customize the options with defaults
2360
+ call_metadata = @config.rpcs.execute_sql.metadata.to_h
2361
+
2362
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
2363
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
2364
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
2365
+ gapic_version: ::Google::Cloud::AlloyDB::V1::VERSION,
2366
+ transports_version_send: [:rest]
2367
+
2368
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
2369
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
2370
+
2371
+ options.apply_defaults timeout: @config.rpcs.execute_sql.timeout,
2372
+ metadata: call_metadata,
2373
+ retry_policy: @config.rpcs.execute_sql.retry_policy
2374
+
2375
+ options.apply_defaults timeout: @config.timeout,
2376
+ metadata: @config.metadata,
2377
+ retry_policy: @config.retry_policy
2378
+
2379
+ @alloy_db_admin_stub.execute_sql request, options do |result, operation|
2380
+ yield result, operation if block_given?
2155
2381
  end
2156
2382
  rescue ::Gapic::Rest::Error => e
2157
2383
  raise ::Google::Cloud::Error.from_error(e)
@@ -2243,7 +2469,6 @@ module Google
2243
2469
 
2244
2470
  @alloy_db_admin_stub.list_backups request, options do |result, operation|
2245
2471
  yield result, operation if block_given?
2246
- return result
2247
2472
  end
2248
2473
  rescue ::Gapic::Rest::Error => e
2249
2474
  raise ::Google::Cloud::Error.from_error(e)
@@ -2322,7 +2547,6 @@ module Google
2322
2547
 
2323
2548
  @alloy_db_admin_stub.get_backup request, options do |result, operation|
2324
2549
  yield result, operation if block_given?
2325
- return result
2326
2550
  end
2327
2551
  rescue ::Gapic::Rest::Error => e
2328
2552
  raise ::Google::Cloud::Error.from_error(e)
@@ -2354,14 +2578,14 @@ module Google
2354
2578
  # Required. The resource being created
2355
2579
  # @param request_id [::String]
2356
2580
  # Optional. An optional request ID to identify requests. Specify a unique
2357
- # request ID so that if you must retry your request, the server will know to
2358
- # ignore the request if it has already been completed. The server will
2359
- # guarantee that for at least 60 minutes since the first request.
2581
+ # request ID so that if you must retry your request, the server ignores the
2582
+ # request if it has already been completed. The server guarantees that for at
2583
+ # least 60 minutes since the first request.
2360
2584
  #
2361
2585
  # For example, consider a situation where you make an initial request and
2362
2586
  # the request times out. If you make the request again with the same request
2363
- # ID, the server can check if original operation with the same request ID
2364
- # was received, and if so, will ignore the second request. This prevents
2587
+ # ID, the server can check if the original operation with the same request ID
2588
+ # was received, and if so, ignores the second request. This prevents
2365
2589
  # clients from accidentally creating duplicate commitments.
2366
2590
  #
2367
2591
  # The request ID must be a valid UUID with the exception that zero UUID is
@@ -2430,7 +2654,7 @@ module Google
2430
2654
  @alloy_db_admin_stub.create_backup request, options do |result, operation|
2431
2655
  result = ::Gapic::Operation.new result, @operations_client, options: options
2432
2656
  yield result, operation if block_given?
2433
- return result
2657
+ throw :response, result
2434
2658
  end
2435
2659
  rescue ::Gapic::Rest::Error => e
2436
2660
  raise ::Google::Cloud::Error.from_error(e)
@@ -2464,14 +2688,14 @@ module Google
2464
2688
  # Required. The resource being updated
2465
2689
  # @param request_id [::String]
2466
2690
  # Optional. An optional request ID to identify requests. Specify a unique
2467
- # request ID so that if you must retry your request, the server will know to
2468
- # ignore the request if it has already been completed. The server will
2469
- # guarantee that for at least 60 minutes since the first request.
2691
+ # request ID so that if you must retry your request, the server ignores the
2692
+ # request if it has already been completed. The server guarantees that for at
2693
+ # least 60 minutes since the first request.
2470
2694
  #
2471
2695
  # For example, consider a situation where you make an initial request and
2472
2696
  # the request times out. If you make the request again with the same request
2473
- # ID, the server can check if original operation with the same request ID
2474
- # was received, and if so, will ignore the second request. This prevents
2697
+ # ID, the server can check if the original operation with the same request ID
2698
+ # was received, and if so, ignores the second request. This prevents
2475
2699
  # clients from accidentally creating duplicate commitments.
2476
2700
  #
2477
2701
  # The request ID must be a valid UUID with the exception that zero UUID is
@@ -2543,7 +2767,7 @@ module Google
2543
2767
  @alloy_db_admin_stub.update_backup request, options do |result, operation|
2544
2768
  result = ::Gapic::Operation.new result, @operations_client, options: options
2545
2769
  yield result, operation if block_given?
2546
- return result
2770
+ throw :response, result
2547
2771
  end
2548
2772
  rescue ::Gapic::Rest::Error => e
2549
2773
  raise ::Google::Cloud::Error.from_error(e)
@@ -2572,14 +2796,14 @@ module Google
2572
2796
  # the Backup.name field.
2573
2797
  # @param request_id [::String]
2574
2798
  # Optional. An optional request ID to identify requests. Specify a unique
2575
- # request ID so that if you must retry your request, the server will know to
2576
- # ignore the request if it has already been completed. The server will
2577
- # guarantee that for at least 60 minutes after the first request.
2799
+ # request ID so that if you must retry your request, the server ignores the
2800
+ # request if it has already been completed. The server guarantees that for at
2801
+ # least 60 minutes since the first request.
2578
2802
  #
2579
2803
  # For example, consider a situation where you make an initial request and
2580
2804
  # the request times out. If you make the request again with the same request
2581
- # ID, the server can check if original operation with the same request ID
2582
- # was received, and if so, will ignore the second request. This prevents
2805
+ # ID, the server can check if the original operation with the same request ID
2806
+ # was received, and if so, ignores the second request. This prevents
2583
2807
  # clients from accidentally creating duplicate commitments.
2584
2808
  #
2585
2809
  # The request ID must be a valid UUID with the exception that zero UUID is
@@ -2652,7 +2876,7 @@ module Google
2652
2876
  @alloy_db_admin_stub.delete_backup request, options do |result, operation|
2653
2877
  result = ::Gapic::Operation.new result, @operations_client, options: options
2654
2878
  yield result, operation if block_given?
2655
- return result
2879
+ throw :response, result
2656
2880
  end
2657
2881
  rescue ::Gapic::Rest::Error => e
2658
2882
  raise ::Google::Cloud::Error.from_error(e)
@@ -2747,7 +2971,7 @@ module Google
2747
2971
  @alloy_db_admin_stub.list_supported_database_flags request, options do |result, operation|
2748
2972
  result = ::Gapic::Rest::PagedEnumerable.new @alloy_db_admin_stub, :list_supported_database_flags, "supported_database_flags", request, result, options
2749
2973
  yield result, operation if block_given?
2750
- return result
2974
+ throw :response, result
2751
2975
  end
2752
2976
  rescue ::Gapic::Rest::Error => e
2753
2977
  raise ::Google::Cloud::Error.from_error(e)
@@ -2780,14 +3004,14 @@ module Google
2780
3004
  # * projects/\\{project}/locations/\\{location}/clusters/\\{cluster}
2781
3005
  # @param request_id [::String]
2782
3006
  # Optional. An optional request ID to identify requests. Specify a unique
2783
- # request ID so that if you must retry your request, the server will know to
2784
- # ignore the request if it has already been completed. The server will
2785
- # guarantee that for at least 60 minutes after the first request.
3007
+ # request ID so that if you must retry your request, the server ignores the
3008
+ # request if it has already been completed. The server guarantees that for at
3009
+ # least 60 minutes since the first request.
2786
3010
  #
2787
3011
  # For example, consider a situation where you make an initial request and
2788
3012
  # the request times out. If you make the request again with the same request
2789
- # ID, the server can check if original operation with the same request ID
2790
- # was received, and if so, will ignore the second request. This prevents
3013
+ # ID, the server can check if the original operation with the same request ID
3014
+ # was received, and if so, ignores the second request. This prevents
2791
3015
  # clients from accidentally creating duplicate commitments.
2792
3016
  #
2793
3017
  # The request ID must be a valid UUID with the exception that zero UUID is
@@ -2857,7 +3081,6 @@ module Google
2857
3081
 
2858
3082
  @alloy_db_admin_stub.generate_client_certificate request, options do |result, operation|
2859
3083
  yield result, operation if block_given?
2860
- return result
2861
3084
  end
2862
3085
  rescue ::Gapic::Rest::Error => e
2863
3086
  raise ::Google::Cloud::Error.from_error(e)
@@ -2886,14 +3109,14 @@ module Google
2886
3109
  # projects/\\{project}/locations/\\{location}/clusters/\\{cluster}/instances/\\{instance}
2887
3110
  # @param request_id [::String]
2888
3111
  # Optional. An optional request ID to identify requests. Specify a unique
2889
- # request ID so that if you must retry your request, the server will know to
2890
- # ignore the request if it has already been completed. The server will
2891
- # guarantee that for at least 60 minutes after the first request.
3112
+ # request ID so that if you must retry your request, the server ignores the
3113
+ # request if it has already been completed. The server guarantees that for at
3114
+ # least 60 minutes since the first request.
2892
3115
  #
2893
3116
  # For example, consider a situation where you make an initial request and
2894
3117
  # the request times out. If you make the request again with the same request
2895
- # ID, the server can check if original operation with the same request ID
2896
- # was received, and if so, will ignore the second request. This prevents
3118
+ # ID, the server can check if the original operation with the same request ID
3119
+ # was received, and if so, ignores the second request. This prevents
2897
3120
  # clients from accidentally creating duplicate commitments.
2898
3121
  #
2899
3122
  # The request ID must be a valid UUID with the exception that zero UUID is
@@ -2951,7 +3174,6 @@ module Google
2951
3174
 
2952
3175
  @alloy_db_admin_stub.get_connection_info request, options do |result, operation|
2953
3176
  yield result, operation if block_given?
2954
- return result
2955
3177
  end
2956
3178
  rescue ::Gapic::Rest::Error => e
2957
3179
  raise ::Google::Cloud::Error.from_error(e)
@@ -3043,7 +3265,6 @@ module Google
3043
3265
 
3044
3266
  @alloy_db_admin_stub.list_users request, options do |result, operation|
3045
3267
  yield result, operation if block_given?
3046
- return result
3047
3268
  end
3048
3269
  rescue ::Gapic::Rest::Error => e
3049
3270
  raise ::Google::Cloud::Error.from_error(e)
@@ -3123,7 +3344,6 @@ module Google
3123
3344
 
3124
3345
  @alloy_db_admin_stub.get_user request, options do |result, operation|
3125
3346
  yield result, operation if block_given?
3126
- return result
3127
3347
  end
3128
3348
  rescue ::Gapic::Rest::Error => e
3129
3349
  raise ::Google::Cloud::Error.from_error(e)
@@ -3155,14 +3375,14 @@ module Google
3155
3375
  # Required. The resource being created
3156
3376
  # @param request_id [::String]
3157
3377
  # Optional. An optional request ID to identify requests. Specify a unique
3158
- # request ID so that if you must retry your request, the server will know to
3159
- # ignore the request if it has already been completed. The server will
3160
- # guarantee that for at least 60 minutes since the first request.
3378
+ # request ID so that if you must retry your request, the server ignores the
3379
+ # request if it has already been completed. The server guarantees that for at
3380
+ # least 60 minutes since the first request.
3161
3381
  #
3162
3382
  # For example, consider a situation where you make an initial request and
3163
3383
  # the request times out. If you make the request again with the same request
3164
- # ID, the server can check if original operation with the same request ID
3165
- # was received, and if so, will ignore the second request. This prevents
3384
+ # ID, the server can check if the original operation with the same request ID
3385
+ # was received, and if so, ignores the second request. This prevents
3166
3386
  # clients from accidentally creating duplicate commitments.
3167
3387
  #
3168
3388
  # The request ID must be a valid UUID with the exception that zero UUID is
@@ -3223,7 +3443,6 @@ module Google
3223
3443
 
3224
3444
  @alloy_db_admin_stub.create_user request, options do |result, operation|
3225
3445
  yield result, operation if block_given?
3226
- return result
3227
3446
  end
3228
3447
  rescue ::Gapic::Rest::Error => e
3229
3448
  raise ::Google::Cloud::Error.from_error(e)
@@ -3257,14 +3476,14 @@ module Google
3257
3476
  # Required. The resource being updated
3258
3477
  # @param request_id [::String]
3259
3478
  # Optional. An optional request ID to identify requests. Specify a unique
3260
- # request ID so that if you must retry your request, the server will know to
3261
- # ignore the request if it has already been completed. The server will
3262
- # guarantee that for at least 60 minutes since the first request.
3479
+ # request ID so that if you must retry your request, the server ignores the
3480
+ # request if it has already been completed. The server guarantees that for at
3481
+ # least 60 minutes since the first request.
3263
3482
  #
3264
3483
  # For example, consider a situation where you make an initial request and
3265
3484
  # the request times out. If you make the request again with the same request
3266
- # ID, the server can check if original operation with the same request ID
3267
- # was received, and if so, will ignore the second request. This prevents
3485
+ # ID, the server can check if the original operation with the same request ID
3486
+ # was received, and if so, ignores the second request. This prevents
3268
3487
  # clients from accidentally creating duplicate commitments.
3269
3488
  #
3270
3489
  # The request ID must be a valid UUID with the exception that zero UUID is
@@ -3327,7 +3546,6 @@ module Google
3327
3546
 
3328
3547
  @alloy_db_admin_stub.update_user request, options do |result, operation|
3329
3548
  yield result, operation if block_given?
3330
- return result
3331
3549
  end
3332
3550
  rescue ::Gapic::Rest::Error => e
3333
3551
  raise ::Google::Cloud::Error.from_error(e)
@@ -3356,14 +3574,14 @@ module Google
3356
3574
  # comment on the User.name field.
3357
3575
  # @param request_id [::String]
3358
3576
  # Optional. An optional request ID to identify requests. Specify a unique
3359
- # request ID so that if you must retry your request, the server will know to
3360
- # ignore the request if it has already been completed. The server will
3361
- # guarantee that for at least 60 minutes after the first request.
3577
+ # request ID so that if you must retry your request, the server ignores the
3578
+ # request if it has already been completed. The server guarantees that for at
3579
+ # least 60 minutes since the first request.
3362
3580
  #
3363
3581
  # For example, consider a situation where you make an initial request and
3364
3582
  # the request times out. If you make the request again with the same request
3365
- # ID, the server can check if original operation with the same request ID
3366
- # was received, and if so, will ignore the second request. This prevents
3583
+ # ID, the server can check if the original operation with the same request ID
3584
+ # was received, and if so, ignores the second request. This prevents
3367
3585
  # clients from accidentally creating duplicate commitments.
3368
3586
  #
3369
3587
  # The request ID must be a valid UUID with the exception that zero UUID is
@@ -3424,7 +3642,102 @@ module Google
3424
3642
 
3425
3643
  @alloy_db_admin_stub.delete_user request, options do |result, operation|
3426
3644
  yield result, operation if block_given?
3427
- return result
3645
+ end
3646
+ rescue ::Gapic::Rest::Error => e
3647
+ raise ::Google::Cloud::Error.from_error(e)
3648
+ end
3649
+
3650
+ ##
3651
+ # Lists Databases in a given project and location.
3652
+ #
3653
+ # @overload list_databases(request, options = nil)
3654
+ # Pass arguments to `list_databases` via a request object, either of type
3655
+ # {::Google::Cloud::AlloyDB::V1::ListDatabasesRequest} or an equivalent Hash.
3656
+ #
3657
+ # @param request [::Google::Cloud::AlloyDB::V1::ListDatabasesRequest, ::Hash]
3658
+ # A request object representing the call parameters. Required. To specify no
3659
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
3660
+ # @param options [::Gapic::CallOptions, ::Hash]
3661
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
3662
+ #
3663
+ # @overload list_databases(parent: nil, page_size: nil, page_token: nil, filter: nil)
3664
+ # Pass arguments to `list_databases` via keyword arguments. Note that at
3665
+ # least one keyword argument is required. To specify no parameters, or to keep all
3666
+ # the default parameter values, pass an empty Hash as a request object (see above).
3667
+ #
3668
+ # @param parent [::String]
3669
+ # Required. Parent value for ListDatabasesRequest.
3670
+ # @param page_size [::Integer]
3671
+ # Optional. The maximum number of databases to return. The service may return
3672
+ # fewer than this value. If unspecified, 2000 is the default page_size. The
3673
+ # max value of page_size will be 4000, values above max will be coerced to
3674
+ # max.
3675
+ # @param page_token [::String]
3676
+ # Optional. A page token, received from a previous `ListDatabases` call.
3677
+ # This should be provided to retrieve the subsequent page.
3678
+ # This field is currently not supported, its value will be ignored if passed.
3679
+ # @param filter [::String]
3680
+ # Optional. Filtering results.
3681
+ # This field is currently not supported, its value will be ignored if passed.
3682
+ # @yield [result, operation] Access the result along with the TransportOperation object
3683
+ # @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Cloud::AlloyDB::V1::Database>]
3684
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
3685
+ #
3686
+ # @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::AlloyDB::V1::Database>]
3687
+ #
3688
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
3689
+ #
3690
+ # @example Basic example
3691
+ # require "google/cloud/alloy_db/v1"
3692
+ #
3693
+ # # Create a client object. The client can be reused for multiple calls.
3694
+ # client = Google::Cloud::AlloyDB::V1::AlloyDBAdmin::Rest::Client.new
3695
+ #
3696
+ # # Create a request. To set request fields, pass in keyword arguments.
3697
+ # request = Google::Cloud::AlloyDB::V1::ListDatabasesRequest.new
3698
+ #
3699
+ # # Call the list_databases method.
3700
+ # result = client.list_databases request
3701
+ #
3702
+ # # The returned object is of type Gapic::PagedEnumerable. You can iterate
3703
+ # # over elements, and API calls will be issued to fetch pages as needed.
3704
+ # result.each do |item|
3705
+ # # Each element is of type ::Google::Cloud::AlloyDB::V1::Database.
3706
+ # p item
3707
+ # end
3708
+ #
3709
+ def list_databases request, options = nil
3710
+ raise ::ArgumentError, "request must be provided" if request.nil?
3711
+
3712
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::AlloyDB::V1::ListDatabasesRequest
3713
+
3714
+ # Converts hash and nil to an options object
3715
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
3716
+
3717
+ # Customize the options with defaults
3718
+ call_metadata = @config.rpcs.list_databases.metadata.to_h
3719
+
3720
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
3721
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
3722
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
3723
+ gapic_version: ::Google::Cloud::AlloyDB::V1::VERSION,
3724
+ transports_version_send: [:rest]
3725
+
3726
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
3727
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
3728
+
3729
+ options.apply_defaults timeout: @config.rpcs.list_databases.timeout,
3730
+ metadata: call_metadata,
3731
+ retry_policy: @config.rpcs.list_databases.retry_policy
3732
+
3733
+ options.apply_defaults timeout: @config.timeout,
3734
+ metadata: @config.metadata,
3735
+ retry_policy: @config.retry_policy
3736
+
3737
+ @alloy_db_admin_stub.list_databases request, options do |result, operation|
3738
+ result = ::Gapic::Rest::PagedEnumerable.new @alloy_db_admin_stub, :list_databases, "databases", request, result, options
3739
+ yield result, operation if block_given?
3740
+ throw :response, result
3428
3741
  end
3429
3742
  rescue ::Gapic::Rest::Error => e
3430
3743
  raise ::Google::Cloud::Error.from_error(e)
@@ -3504,6 +3817,11 @@ module Google
3504
3817
  # default endpoint URL. The default value of nil uses the environment
3505
3818
  # universe (usually the default "googleapis.com" universe).
3506
3819
  # @return [::String,nil]
3820
+ # @!attribute [rw] logger
3821
+ # A custom logger to use for request/response debug logging, or the value
3822
+ # `:default` (the default) to construct a default logger, or `nil` to
3823
+ # explicitly disable logging.
3824
+ # @return [::Logger,:default,nil]
3507
3825
  #
3508
3826
  class Configuration
3509
3827
  extend ::Gapic::Config
@@ -3532,6 +3850,7 @@ module Google
3532
3850
  # by the host service.
3533
3851
  # @return [::Hash{::Symbol=>::Array<::Gapic::Rest::GrpcTranscoder::HttpBinding>}]
3534
3852
  config_attr :bindings_override, {}, ::Hash, nil
3853
+ config_attr :logger, :default, ::Logger, nil, :default
3535
3854
 
3536
3855
  # @private
3537
3856
  def initialize parent_config = nil
@@ -3601,6 +3920,11 @@ module Google
3601
3920
  #
3602
3921
  attr_reader :promote_cluster
3603
3922
  ##
3923
+ # RPC-specific configuration for `switchover_cluster`
3924
+ # @return [::Gapic::Config::Method]
3925
+ #
3926
+ attr_reader :switchover_cluster
3927
+ ##
3604
3928
  # RPC-specific configuration for `restore_cluster`
3605
3929
  # @return [::Gapic::Config::Method]
3606
3930
  #
@@ -3661,6 +3985,11 @@ module Google
3661
3985
  #
3662
3986
  attr_reader :restart_instance
3663
3987
  ##
3988
+ # RPC-specific configuration for `execute_sql`
3989
+ # @return [::Gapic::Config::Method]
3990
+ #
3991
+ attr_reader :execute_sql
3992
+ ##
3664
3993
  # RPC-specific configuration for `list_backups`
3665
3994
  # @return [::Gapic::Config::Method]
3666
3995
  #
@@ -3725,6 +4054,11 @@ module Google
3725
4054
  # @return [::Gapic::Config::Method]
3726
4055
  #
3727
4056
  attr_reader :delete_user
4057
+ ##
4058
+ # RPC-specific configuration for `list_databases`
4059
+ # @return [::Gapic::Config::Method]
4060
+ #
4061
+ attr_reader :list_databases
3728
4062
 
3729
4063
  # @private
3730
4064
  def initialize parent_rpcs = nil
@@ -3740,6 +4074,8 @@ module Google
3740
4074
  @delete_cluster = ::Gapic::Config::Method.new delete_cluster_config
3741
4075
  promote_cluster_config = parent_rpcs.promote_cluster if parent_rpcs.respond_to? :promote_cluster
3742
4076
  @promote_cluster = ::Gapic::Config::Method.new promote_cluster_config
4077
+ switchover_cluster_config = parent_rpcs.switchover_cluster if parent_rpcs.respond_to? :switchover_cluster
4078
+ @switchover_cluster = ::Gapic::Config::Method.new switchover_cluster_config
3743
4079
  restore_cluster_config = parent_rpcs.restore_cluster if parent_rpcs.respond_to? :restore_cluster
3744
4080
  @restore_cluster = ::Gapic::Config::Method.new restore_cluster_config
3745
4081
  create_secondary_cluster_config = parent_rpcs.create_secondary_cluster if parent_rpcs.respond_to? :create_secondary_cluster
@@ -3764,6 +4100,8 @@ module Google
3764
4100
  @inject_fault = ::Gapic::Config::Method.new inject_fault_config
3765
4101
  restart_instance_config = parent_rpcs.restart_instance if parent_rpcs.respond_to? :restart_instance
3766
4102
  @restart_instance = ::Gapic::Config::Method.new restart_instance_config
4103
+ execute_sql_config = parent_rpcs.execute_sql if parent_rpcs.respond_to? :execute_sql
4104
+ @execute_sql = ::Gapic::Config::Method.new execute_sql_config
3767
4105
  list_backups_config = parent_rpcs.list_backups if parent_rpcs.respond_to? :list_backups
3768
4106
  @list_backups = ::Gapic::Config::Method.new list_backups_config
3769
4107
  get_backup_config = parent_rpcs.get_backup if parent_rpcs.respond_to? :get_backup
@@ -3790,6 +4128,8 @@ module Google
3790
4128
  @update_user = ::Gapic::Config::Method.new update_user_config
3791
4129
  delete_user_config = parent_rpcs.delete_user if parent_rpcs.respond_to? :delete_user
3792
4130
  @delete_user = ::Gapic::Config::Method.new delete_user_config
4131
+ list_databases_config = parent_rpcs.list_databases if parent_rpcs.respond_to? :list_databases
4132
+ @list_databases = ::Gapic::Config::Method.new list_databases_config
3793
4133
 
3794
4134
  yield self if block_given?
3795
4135
  end