google-cloud-alloy_db-v1beta 0.9.0 → 0.11.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -221,15 +221,27 @@ module Google
221
221
  endpoint: @config.endpoint,
222
222
  endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
223
223
  universe_domain: @config.universe_domain,
224
- credentials: credentials
224
+ credentials: credentials,
225
+ logger: @config.logger
225
226
  )
226
227
 
228
+ @alloy_db_admin_stub.logger(stub: true)&.info do |entry|
229
+ entry.set_system_name
230
+ entry.set_service
231
+ entry.message = "Created client for #{entry.service}"
232
+ entry.set_credentials_fields credentials
233
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
234
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
235
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
236
+ end
237
+
227
238
  @location_client = Google::Cloud::Location::Locations::Rest::Client.new do |config|
228
239
  config.credentials = credentials
229
240
  config.quota_project = @quota_project_id
230
241
  config.endpoint = @alloy_db_admin_stub.endpoint
231
242
  config.universe_domain = @alloy_db_admin_stub.universe_domain
232
243
  config.bindings_override = @config.bindings_override
244
+ config.logger = @alloy_db_admin_stub.logger if config.respond_to? :logger=
233
245
  end
234
246
 
235
247
  @iam_policy_client = Google::Iam::V1::IAMPolicy::Rest::Client.new do |config|
@@ -237,6 +249,7 @@ module Google
237
249
  config.quota_project = @quota_project_id
238
250
  config.endpoint = @alloy_db_admin_stub.endpoint
239
251
  config.universe_domain = @alloy_db_admin_stub.universe_domain
252
+ config.logger = @alloy_db_admin_stub.logger if config.respond_to? :logger=
240
253
  end
241
254
  end
242
255
 
@@ -261,6 +274,15 @@ module Google
261
274
  #
262
275
  attr_reader :iam_policy_client
263
276
 
277
+ ##
278
+ # The logger used for request/response debug logging.
279
+ #
280
+ # @return [Logger]
281
+ #
282
+ def logger
283
+ @alloy_db_admin_stub.logger
284
+ end
285
+
264
286
  # Service calls
265
287
 
266
288
  ##
@@ -352,7 +374,6 @@ module Google
352
374
 
353
375
  @alloy_db_admin_stub.list_clusters request, options do |result, operation|
354
376
  yield result, operation if block_given?
355
- return result
356
377
  end
357
378
  rescue ::Gapic::Rest::Error => e
358
379
  raise ::Google::Cloud::Error.from_error(e)
@@ -435,7 +456,6 @@ module Google
435
456
 
436
457
  @alloy_db_admin_stub.get_cluster request, options do |result, operation|
437
458
  yield result, operation if block_given?
438
- return result
439
459
  end
440
460
  rescue ::Gapic::Rest::Error => e
441
461
  raise ::Google::Cloud::Error.from_error(e)
@@ -468,22 +488,22 @@ module Google
468
488
  # Required. The resource being created
469
489
  # @param request_id [::String]
470
490
  # Optional. An optional request ID to identify requests. Specify a unique
471
- # request ID so that if you must retry your request, the server will know to
472
- # ignore the request if it has already been completed. The server will
473
- # guarantee that for at least 60 minutes since the first request.
491
+ # request ID so that if you must retry your request, the server ignores the
492
+ # request if it has already been completed. The server guarantees that for at
493
+ # least 60 minutes since the first request.
474
494
  #
475
495
  # For example, consider a situation where you make an initial request and
476
496
  # the request times out. If you make the request again with the same request
477
- # ID, the server can check if original operation with the same request ID
478
- # was received, and if so, will ignore the second request. This prevents
497
+ # ID, the server can check if the original operation with the same request ID
498
+ # was received, and if so, ignores the second request. This prevents
479
499
  # clients from accidentally creating duplicate commitments.
480
500
  #
481
501
  # The request ID must be a valid UUID with the exception that zero UUID is
482
502
  # not supported (00000000-0000-0000-0000-000000000000).
483
503
  # @param validate_only [::Boolean]
484
- # Optional. If set, performs request validation (e.g. permission checks and
485
- # any other type of validation), but do not actually execute the create
486
- # request.
504
+ # Optional. If set, performs request validation, for example, permission
505
+ # checks and any other type of validation, but does not actually execute the
506
+ # create request.
487
507
  # @yield [result, operation] Access the result along with the TransportOperation object
488
508
  # @yieldparam result [::Gapic::Operation]
489
509
  # @yieldparam operation [::Gapic::Rest::TransportOperation]
@@ -545,7 +565,7 @@ module Google
545
565
  @alloy_db_admin_stub.create_cluster request, options do |result, operation|
546
566
  result = ::Gapic::Operation.new result, @operations_client, options: options
547
567
  yield result, operation if block_given?
548
- return result
568
+ throw :response, result
549
569
  end
550
570
  rescue ::Gapic::Rest::Error => e
551
571
  raise ::Google::Cloud::Error.from_error(e)
@@ -579,22 +599,22 @@ module Google
579
599
  # Required. The resource being updated
580
600
  # @param request_id [::String]
581
601
  # Optional. An optional request ID to identify requests. Specify a unique
582
- # request ID so that if you must retry your request, the server will know to
583
- # ignore the request if it has already been completed. The server will
584
- # guarantee that for at least 60 minutes since the first request.
602
+ # request ID so that if you must retry your request, the server ignores the
603
+ # request if it has already been completed. The server guarantees that for at
604
+ # least 60 minutes since the first request.
585
605
  #
586
606
  # For example, consider a situation where you make an initial request and
587
607
  # the request times out. If you make the request again with the same request
588
- # ID, the server can check if original operation with the same request ID
589
- # was received, and if so, will ignore the second request. This prevents
608
+ # ID, the server can check if the original operation with the same request ID
609
+ # was received, and if so, ignores the second request. This prevents
590
610
  # clients from accidentally creating duplicate commitments.
591
611
  #
592
612
  # The request ID must be a valid UUID with the exception that zero UUID is
593
613
  # not supported (00000000-0000-0000-0000-000000000000).
594
614
  # @param validate_only [::Boolean]
595
- # Optional. If set, performs request validation (e.g. permission checks and
596
- # any other type of validation), but do not actually execute the update
597
- # request.
615
+ # Optional. If set, performs request validation, for example, permission
616
+ # checks and any other type of validation, but does not actually execute the
617
+ # create request.
598
618
  # @param allow_missing [::Boolean]
599
619
  # Optional. If set to true, update succeeds even if cluster is not found. In
600
620
  # that case, a new cluster is created and `update_mask` is ignored.
@@ -659,7 +679,119 @@ module Google
659
679
  @alloy_db_admin_stub.update_cluster request, options do |result, operation|
660
680
  result = ::Gapic::Operation.new result, @operations_client, options: options
661
681
  yield result, operation if block_given?
662
- return result
682
+ throw :response, result
683
+ end
684
+ rescue ::Gapic::Rest::Error => e
685
+ raise ::Google::Cloud::Error.from_error(e)
686
+ end
687
+
688
+ ##
689
+ # Upgrades a single Cluster.
690
+ # Imperative only.
691
+ #
692
+ # @overload upgrade_cluster(request, options = nil)
693
+ # Pass arguments to `upgrade_cluster` via a request object, either of type
694
+ # {::Google::Cloud::AlloyDB::V1beta::UpgradeClusterRequest} or an equivalent Hash.
695
+ #
696
+ # @param request [::Google::Cloud::AlloyDB::V1beta::UpgradeClusterRequest, ::Hash]
697
+ # A request object representing the call parameters. Required. To specify no
698
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
699
+ # @param options [::Gapic::CallOptions, ::Hash]
700
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
701
+ #
702
+ # @overload upgrade_cluster(name: nil, version: nil, request_id: nil, validate_only: nil, etag: nil)
703
+ # Pass arguments to `upgrade_cluster` via keyword arguments. Note that at
704
+ # least one keyword argument is required. To specify no parameters, or to keep all
705
+ # the default parameter values, pass an empty Hash as a request object (see above).
706
+ #
707
+ # @param name [::String]
708
+ # Required. The resource name of the cluster.
709
+ # @param version [::Google::Cloud::AlloyDB::V1beta::DatabaseVersion]
710
+ # Required. The version the cluster is going to be upgraded to.
711
+ # @param request_id [::String]
712
+ # Optional. An optional request ID to identify requests. Specify a unique
713
+ # request ID so that if you must retry your request, the server ignores the
714
+ # request if it has already been completed. The server guarantees that for at
715
+ # least 60 minutes since the first request.
716
+ #
717
+ # For example, consider a situation where you make an initial request and
718
+ # the request times out. If you make the request again with the same request
719
+ # ID, the server can check if the original operation with the same request ID
720
+ # was received, and if so, ignores the second request. This prevents
721
+ # clients from accidentally creating duplicate commitments.
722
+ #
723
+ # The request ID must be a valid UUID with the exception that zero UUID is
724
+ # not supported (00000000-0000-0000-0000-000000000000).
725
+ # @param validate_only [::Boolean]
726
+ # Optional. If set, performs request validation, for example, permission
727
+ # checks and any other type of validation, but does not actually execute the
728
+ # create request.
729
+ # @param etag [::String]
730
+ # Optional. The current etag of the Cluster.
731
+ # If an etag is provided and does not match the current etag of the Cluster,
732
+ # upgrade will be blocked and an ABORTED error will be returned.
733
+ # @yield [result, operation] Access the result along with the TransportOperation object
734
+ # @yieldparam result [::Gapic::Operation]
735
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
736
+ #
737
+ # @return [::Gapic::Operation]
738
+ #
739
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
740
+ #
741
+ # @example Basic example
742
+ # require "google/cloud/alloy_db/v1beta"
743
+ #
744
+ # # Create a client object. The client can be reused for multiple calls.
745
+ # client = Google::Cloud::AlloyDB::V1beta::AlloyDBAdmin::Rest::Client.new
746
+ #
747
+ # # Create a request. To set request fields, pass in keyword arguments.
748
+ # request = Google::Cloud::AlloyDB::V1beta::UpgradeClusterRequest.new
749
+ #
750
+ # # Call the upgrade_cluster method.
751
+ # result = client.upgrade_cluster request
752
+ #
753
+ # # The returned object is of type Gapic::Operation. You can use it to
754
+ # # check the status of an operation, cancel it, or wait for results.
755
+ # # Here is how to wait for a response.
756
+ # result.wait_until_done! timeout: 60
757
+ # if result.response?
758
+ # p result.response
759
+ # else
760
+ # puts "No response received."
761
+ # end
762
+ #
763
+ def upgrade_cluster request, options = nil
764
+ raise ::ArgumentError, "request must be provided" if request.nil?
765
+
766
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::AlloyDB::V1beta::UpgradeClusterRequest
767
+
768
+ # Converts hash and nil to an options object
769
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
770
+
771
+ # Customize the options with defaults
772
+ call_metadata = @config.rpcs.upgrade_cluster.metadata.to_h
773
+
774
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
775
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
776
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
777
+ gapic_version: ::Google::Cloud::AlloyDB::V1beta::VERSION,
778
+ transports_version_send: [:rest]
779
+
780
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
781
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
782
+
783
+ options.apply_defaults timeout: @config.rpcs.upgrade_cluster.timeout,
784
+ metadata: call_metadata,
785
+ retry_policy: @config.rpcs.upgrade_cluster.retry_policy
786
+
787
+ options.apply_defaults timeout: @config.timeout,
788
+ metadata: @config.metadata,
789
+ retry_policy: @config.retry_policy
790
+
791
+ @alloy_db_admin_stub.upgrade_cluster request, options do |result, operation|
792
+ result = ::Gapic::Operation.new result, @operations_client, options: options
793
+ yield result, operation if block_given?
794
+ throw :response, result
663
795
  end
664
796
  rescue ::Gapic::Rest::Error => e
665
797
  raise ::Google::Cloud::Error.from_error(e)
@@ -688,14 +820,14 @@ module Google
688
820
  # comment on the Cluster.name field.
689
821
  # @param request_id [::String]
690
822
  # Optional. An optional request ID to identify requests. Specify a unique
691
- # request ID so that if you must retry your request, the server will know to
692
- # ignore the request if it has already been completed. The server will
693
- # guarantee that for at least 60 minutes after the first request.
823
+ # request ID so that if you must retry your request, the server ignores the
824
+ # request if it has already been completed. The server guarantees that for at
825
+ # least 60 minutes since the first request.
694
826
  #
695
827
  # For example, consider a situation where you make an initial request and
696
828
  # the request times out. If you make the request again with the same request
697
- # ID, the server can check if original operation with the same request ID
698
- # was received, and if so, will ignore the second request. This prevents
829
+ # ID, the server can check if the original operation with the same request ID
830
+ # was received, and if so, ignores the second request. This prevents
699
831
  # clients from accidentally creating duplicate commitments.
700
832
  #
701
833
  # The request ID must be a valid UUID with the exception that zero UUID is
@@ -705,8 +837,9 @@ module Google
705
837
  # If an etag is provided and does not match the current etag of the Cluster,
706
838
  # deletion will be blocked and an ABORTED error will be returned.
707
839
  # @param validate_only [::Boolean]
708
- # Optional. If set, performs request validation (e.g. permission checks and
709
- # any other type of validation), but do not actually execute the delete.
840
+ # Optional. If set, performs request validation, for example, permission
841
+ # checks and any other type of validation, but does not actually execute the
842
+ # create request.
710
843
  # @param force [::Boolean]
711
844
  # Optional. Whether to cascade delete child instances for given cluster.
712
845
  # @yield [result, operation] Access the result along with the TransportOperation object
@@ -770,7 +903,7 @@ module Google
770
903
  @alloy_db_admin_stub.delete_cluster request, options do |result, operation|
771
904
  result = ::Gapic::Operation.new result, @operations_client, options: options
772
905
  yield result, operation if block_given?
773
- return result
906
+ throw :response, result
774
907
  end
775
908
  rescue ::Gapic::Rest::Error => e
776
909
  raise ::Google::Cloud::Error.from_error(e)
@@ -802,9 +935,9 @@ module Google
802
935
  # comment on the Cluster.name field
803
936
  # @param request_id [::String]
804
937
  # Optional. An optional request ID to identify requests. Specify a unique
805
- # request ID so that if you must retry your request, the server will know to
806
- # ignore the request if it has already been completed. The server will
807
- # guarantee that for at least 60 minutes after the first request.
938
+ # request ID so that if you must retry your request, the server ignores the
939
+ # request if it has already been completed. The server guarantees that for at
940
+ # least 60 minutes since the first request.
808
941
  #
809
942
  # For example, consider a situation where you make an initial request and
810
943
  # the request times out. If you make the request again with the same request
@@ -819,8 +952,9 @@ module Google
819
952
  # If an etag is provided and does not match the current etag of the Cluster,
820
953
  # deletion will be blocked and an ABORTED error will be returned.
821
954
  # @param validate_only [::Boolean]
822
- # Optional. If set, performs request validation (e.g. permission checks and
823
- # any other type of validation), but do not actually execute the delete.
955
+ # Optional. If set, performs request validation, for example, permission
956
+ # checks and any other type of validation, but does not actually execute the
957
+ # create request.
824
958
  # @yield [result, operation] Access the result along with the TransportOperation object
825
959
  # @yieldparam result [::Gapic::Operation]
826
960
  # @yieldparam operation [::Gapic::Rest::TransportOperation]
@@ -882,7 +1016,115 @@ module Google
882
1016
  @alloy_db_admin_stub.promote_cluster request, options do |result, operation|
883
1017
  result = ::Gapic::Operation.new result, @operations_client, options: options
884
1018
  yield result, operation if block_given?
885
- return result
1019
+ throw :response, result
1020
+ end
1021
+ rescue ::Gapic::Rest::Error => e
1022
+ raise ::Google::Cloud::Error.from_error(e)
1023
+ end
1024
+
1025
+ ##
1026
+ # Switches the roles of PRIMARY and SECONDARY clusters without any data loss.
1027
+ # This promotes the SECONDARY cluster to PRIMARY and sets up the original
1028
+ # PRIMARY cluster to replicate from this newly promoted cluster.
1029
+ #
1030
+ # @overload switchover_cluster(request, options = nil)
1031
+ # Pass arguments to `switchover_cluster` via a request object, either of type
1032
+ # {::Google::Cloud::AlloyDB::V1beta::SwitchoverClusterRequest} or an equivalent Hash.
1033
+ #
1034
+ # @param request [::Google::Cloud::AlloyDB::V1beta::SwitchoverClusterRequest, ::Hash]
1035
+ # A request object representing the call parameters. Required. To specify no
1036
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1037
+ # @param options [::Gapic::CallOptions, ::Hash]
1038
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
1039
+ #
1040
+ # @overload switchover_cluster(name: nil, request_id: nil, validate_only: nil)
1041
+ # Pass arguments to `switchover_cluster` via keyword arguments. Note that at
1042
+ # least one keyword argument is required. To specify no parameters, or to keep all
1043
+ # the default parameter values, pass an empty Hash as a request object (see above).
1044
+ #
1045
+ # @param name [::String]
1046
+ # Required. The name of the resource. For the required format, see the
1047
+ # comment on the Cluster.name field
1048
+ # @param request_id [::String]
1049
+ # Optional. An optional request ID to identify requests. Specify a unique
1050
+ # request ID so that if you must retry your request, the server ignores the
1051
+ # request if it has already been completed. The server guarantees that for at
1052
+ # least 60 minutes since the first request.
1053
+ #
1054
+ # For example, consider a situation where you make an initial request and
1055
+ # the request times out. If you make the request again with the same request
1056
+ # ID, the server can check if the original operation with the same request ID
1057
+ # was received, and if so, ignores the second request. This prevents
1058
+ # clients from accidentally creating duplicate commitments.
1059
+ #
1060
+ # The request ID must be a valid UUID with the exception that zero UUID is
1061
+ # not supported (00000000-0000-0000-0000-000000000000).
1062
+ # @param validate_only [::Boolean]
1063
+ # Optional. If set, performs request validation, for example, permission
1064
+ # checks and any other type of validation, but does not actually execute the
1065
+ # create request.
1066
+ # @yield [result, operation] Access the result along with the TransportOperation object
1067
+ # @yieldparam result [::Gapic::Operation]
1068
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
1069
+ #
1070
+ # @return [::Gapic::Operation]
1071
+ #
1072
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
1073
+ #
1074
+ # @example Basic example
1075
+ # require "google/cloud/alloy_db/v1beta"
1076
+ #
1077
+ # # Create a client object. The client can be reused for multiple calls.
1078
+ # client = Google::Cloud::AlloyDB::V1beta::AlloyDBAdmin::Rest::Client.new
1079
+ #
1080
+ # # Create a request. To set request fields, pass in keyword arguments.
1081
+ # request = Google::Cloud::AlloyDB::V1beta::SwitchoverClusterRequest.new
1082
+ #
1083
+ # # Call the switchover_cluster method.
1084
+ # result = client.switchover_cluster request
1085
+ #
1086
+ # # The returned object is of type Gapic::Operation. You can use it to
1087
+ # # check the status of an operation, cancel it, or wait for results.
1088
+ # # Here is how to wait for a response.
1089
+ # result.wait_until_done! timeout: 60
1090
+ # if result.response?
1091
+ # p result.response
1092
+ # else
1093
+ # puts "No response received."
1094
+ # end
1095
+ #
1096
+ def switchover_cluster request, options = nil
1097
+ raise ::ArgumentError, "request must be provided" if request.nil?
1098
+
1099
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::AlloyDB::V1beta::SwitchoverClusterRequest
1100
+
1101
+ # Converts hash and nil to an options object
1102
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1103
+
1104
+ # Customize the options with defaults
1105
+ call_metadata = @config.rpcs.switchover_cluster.metadata.to_h
1106
+
1107
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
1108
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1109
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1110
+ gapic_version: ::Google::Cloud::AlloyDB::V1beta::VERSION,
1111
+ transports_version_send: [:rest]
1112
+
1113
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
1114
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1115
+
1116
+ options.apply_defaults timeout: @config.rpcs.switchover_cluster.timeout,
1117
+ metadata: call_metadata,
1118
+ retry_policy: @config.rpcs.switchover_cluster.retry_policy
1119
+
1120
+ options.apply_defaults timeout: @config.timeout,
1121
+ metadata: @config.metadata,
1122
+ retry_policy: @config.retry_policy
1123
+
1124
+ @alloy_db_admin_stub.switchover_cluster request, options do |result, operation|
1125
+ result = ::Gapic::Operation.new result, @operations_client, options: options
1126
+ yield result, operation if block_given?
1127
+ throw :response, result
886
1128
  end
887
1129
  rescue ::Gapic::Rest::Error => e
888
1130
  raise ::Google::Cloud::Error.from_error(e)
@@ -922,22 +1164,22 @@ module Google
922
1164
  # Required. The resource being created
923
1165
  # @param request_id [::String]
924
1166
  # Optional. An optional request ID to identify requests. Specify a unique
925
- # request ID so that if you must retry your request, the server will know to
926
- # ignore the request if it has already been completed. The server will
927
- # guarantee that for at least 60 minutes since the first request.
1167
+ # request ID so that if you must retry your request, the server ignores the
1168
+ # request if it has already been completed. The server guarantees that for at
1169
+ # least 60 minutes since the first request.
928
1170
  #
929
1171
  # For example, consider a situation where you make an initial request and
930
1172
  # the request times out. If you make the request again with the same request
931
- # ID, the server can check if original operation with the same request ID
932
- # was received, and if so, will ignore the second request. This prevents
1173
+ # ID, the server can check if the original operation with the same request ID
1174
+ # was received, and if so, ignores the second request. This prevents
933
1175
  # clients from accidentally creating duplicate commitments.
934
1176
  #
935
1177
  # The request ID must be a valid UUID with the exception that zero UUID is
936
1178
  # not supported (00000000-0000-0000-0000-000000000000).
937
1179
  # @param validate_only [::Boolean]
938
- # Optional. If set, performs request validation (e.g. permission checks and
939
- # any other type of validation), but do not actually execute the import
940
- # request.
1180
+ # Optional. If set, performs request validation, for example, permission
1181
+ # checks and any other type of validation, but does not actually execute the
1182
+ # create request.
941
1183
  # @yield [result, operation] Access the result along with the TransportOperation object
942
1184
  # @yieldparam result [::Gapic::Operation]
943
1185
  # @yieldparam operation [::Gapic::Rest::TransportOperation]
@@ -999,7 +1241,7 @@ module Google
999
1241
  @alloy_db_admin_stub.restore_cluster request, options do |result, operation|
1000
1242
  result = ::Gapic::Operation.new result, @operations_client, options: options
1001
1243
  yield result, operation if block_given?
1002
- return result
1244
+ throw :response, result
1003
1245
  end
1004
1246
  rescue ::Gapic::Rest::Error => e
1005
1247
  raise ::Google::Cloud::Error.from_error(e)
@@ -1033,22 +1275,22 @@ module Google
1033
1275
  # Required. Configuration of the requesting object (the secondary cluster).
1034
1276
  # @param request_id [::String]
1035
1277
  # Optional. An optional request ID to identify requests. Specify a unique
1036
- # request ID so that if you must retry your request, the server will know to
1037
- # ignore the request if it has already been completed. The server will
1038
- # guarantee that for at least 60 minutes since the first request.
1278
+ # request ID so that if you must retry your request, the server ignores the
1279
+ # request if it has already been completed. The server guarantees that for at
1280
+ # least 60 minutes since the first request.
1039
1281
  #
1040
1282
  # For example, consider a situation where you make an initial request and
1041
1283
  # the request times out. If you make the request again with the same request
1042
- # ID, the server can check if original operation with the same request ID
1043
- # was received, and if so, will ignore the second request. This prevents
1284
+ # ID, the server can check if the original operation with the same request ID
1285
+ # was received, and if so, ignores the second request. This prevents
1044
1286
  # clients from accidentally creating duplicate commitments.
1045
1287
  #
1046
1288
  # The request ID must be a valid UUID with the exception that zero UUID is
1047
1289
  # not supported (00000000-0000-0000-0000-000000000000).
1048
1290
  # @param validate_only [::Boolean]
1049
- # Optional. If set, performs request validation (e.g. permission checks and
1050
- # any other type of validation), but do not actually execute the create
1051
- # request.
1291
+ # Optional. If set, performs request validation, for example, permission
1292
+ # checks and any other type of validation, but does not actually execute the
1293
+ # create request.
1052
1294
  # @yield [result, operation] Access the result along with the TransportOperation object
1053
1295
  # @yieldparam result [::Gapic::Operation]
1054
1296
  # @yieldparam operation [::Gapic::Rest::TransportOperation]
@@ -1110,7 +1352,7 @@ module Google
1110
1352
  @alloy_db_admin_stub.create_secondary_cluster request, options do |result, operation|
1111
1353
  result = ::Gapic::Operation.new result, @operations_client, options: options
1112
1354
  yield result, operation if block_given?
1113
- return result
1355
+ throw :response, result
1114
1356
  end
1115
1357
  rescue ::Gapic::Rest::Error => e
1116
1358
  raise ::Google::Cloud::Error.from_error(e)
@@ -1207,7 +1449,6 @@ module Google
1207
1449
 
1208
1450
  @alloy_db_admin_stub.list_instances request, options do |result, operation|
1209
1451
  yield result, operation if block_given?
1210
- return result
1211
1452
  end
1212
1453
  rescue ::Gapic::Rest::Error => e
1213
1454
  raise ::Google::Cloud::Error.from_error(e)
@@ -1289,7 +1530,6 @@ module Google
1289
1530
 
1290
1531
  @alloy_db_admin_stub.get_instance request, options do |result, operation|
1291
1532
  yield result, operation if block_given?
1292
- return result
1293
1533
  end
1294
1534
  rescue ::Gapic::Rest::Error => e
1295
1535
  raise ::Google::Cloud::Error.from_error(e)
@@ -1322,22 +1562,22 @@ module Google
1322
1562
  # Required. The resource being created
1323
1563
  # @param request_id [::String]
1324
1564
  # Optional. An optional request ID to identify requests. Specify a unique
1325
- # request ID so that if you must retry your request, the server will know to
1326
- # ignore the request if it has already been completed. The server will
1327
- # guarantee that for at least 60 minutes since the first request.
1565
+ # request ID so that if you must retry your request, the server ignores the
1566
+ # request if it has already been completed. The server guarantees that for at
1567
+ # least 60 minutes since the first request.
1328
1568
  #
1329
1569
  # For example, consider a situation where you make an initial request and
1330
1570
  # the request times out. If you make the request again with the same request
1331
- # ID, the server can check if original operation with the same request ID
1332
- # was received, and if so, will ignore the second request. This prevents
1571
+ # ID, the server can check if the original operation with the same request ID
1572
+ # was received, and if so, ignores the second request. This prevents
1333
1573
  # clients from accidentally creating duplicate commitments.
1334
1574
  #
1335
1575
  # The request ID must be a valid UUID with the exception that zero UUID is
1336
1576
  # not supported (00000000-0000-0000-0000-000000000000).
1337
1577
  # @param validate_only [::Boolean]
1338
- # Optional. If set, performs request validation (e.g. permission checks and
1339
- # any other type of validation), but do not actually execute the create
1340
- # request.
1578
+ # Optional. If set, performs request validation, for example, permission
1579
+ # checks and any other type of validation, but does not actually execute the
1580
+ # create request.
1341
1581
  # @yield [result, operation] Access the result along with the TransportOperation object
1342
1582
  # @yieldparam result [::Gapic::Operation]
1343
1583
  # @yieldparam operation [::Gapic::Rest::TransportOperation]
@@ -1399,7 +1639,7 @@ module Google
1399
1639
  @alloy_db_admin_stub.create_instance request, options do |result, operation|
1400
1640
  result = ::Gapic::Operation.new result, @operations_client, options: options
1401
1641
  yield result, operation if block_given?
1402
- return result
1642
+ throw :response, result
1403
1643
  end
1404
1644
  rescue ::Gapic::Rest::Error => e
1405
1645
  raise ::Google::Cloud::Error.from_error(e)
@@ -1432,22 +1672,22 @@ module Google
1432
1672
  # Required. The resource being created
1433
1673
  # @param request_id [::String]
1434
1674
  # Optional. An optional request ID to identify requests. Specify a unique
1435
- # request ID so that if you must retry your request, the server will know to
1436
- # ignore the request if it has already been completed. The server will
1437
- # guarantee that for at least 60 minutes since the first request.
1675
+ # request ID so that if you must retry your request, the server ignores the
1676
+ # request if it has already been completed. The server guarantees that for at
1677
+ # least 60 minutes since the first request.
1438
1678
  #
1439
1679
  # For example, consider a situation where you make an initial request and
1440
1680
  # the request times out. If you make the request again with the same request
1441
- # ID, the server can check if original operation with the same request ID
1442
- # was received, and if so, will ignore the second request. This prevents
1681
+ # ID, the server can check if the original operation with the same request ID
1682
+ # was received, and if so, ignores the second request. This prevents
1443
1683
  # clients from accidentally creating duplicate commitments.
1444
1684
  #
1445
1685
  # The request ID must be a valid UUID with the exception that zero UUID is
1446
1686
  # not supported (00000000-0000-0000-0000-000000000000).
1447
1687
  # @param validate_only [::Boolean]
1448
- # Optional. If set, performs request validation (e.g. permission checks and
1449
- # any other type of validation), but do not actually execute the create
1450
- # request.
1688
+ # Optional. If set, performs request validation, for example, permission
1689
+ # checks and any other type of validation, but does not actually execute the
1690
+ # create request.
1451
1691
  # @yield [result, operation] Access the result along with the TransportOperation object
1452
1692
  # @yieldparam result [::Gapic::Operation]
1453
1693
  # @yieldparam operation [::Gapic::Rest::TransportOperation]
@@ -1509,7 +1749,7 @@ module Google
1509
1749
  @alloy_db_admin_stub.create_secondary_instance request, options do |result, operation|
1510
1750
  result = ::Gapic::Operation.new result, @operations_client, options: options
1511
1751
  yield result, operation if block_given?
1512
- return result
1752
+ throw :response, result
1513
1753
  end
1514
1754
  rescue ::Gapic::Rest::Error => e
1515
1755
  raise ::Google::Cloud::Error.from_error(e)
@@ -1548,14 +1788,14 @@ module Google
1548
1788
  # Required. Resources being created.
1549
1789
  # @param request_id [::String]
1550
1790
  # Optional. An optional request ID to identify requests. Specify a unique
1551
- # request ID so that if you must retry your request, the server will know to
1552
- # ignore the request if it has already been completed. The server will
1553
- # guarantee that for at least 60 minutes since the first request.
1791
+ # request ID so that if you must retry your request, the server ignores the
1792
+ # request if it has already been completed. The server guarantees that for at
1793
+ # least 60 minutes since the first request.
1554
1794
  #
1555
1795
  # For example, consider a situation where you make an initial request and
1556
1796
  # the request times out. If you make the request again with the same request
1557
- # ID, the server can check if original operation with the same request ID
1558
- # was received, and if so, will ignore the second request. This prevents
1797
+ # ID, the server can check if the original operation with the same request ID
1798
+ # was received, and if so, ignores the second request. This prevents
1559
1799
  # clients from accidentally creating duplicate commitments.
1560
1800
  #
1561
1801
  # The request ID must be a valid UUID with the exception that zero UUID is
@@ -1621,7 +1861,7 @@ module Google
1621
1861
  @alloy_db_admin_stub.batch_create_instances request, options do |result, operation|
1622
1862
  result = ::Gapic::Operation.new result, @operations_client, options: options
1623
1863
  yield result, operation if block_given?
1624
- return result
1864
+ throw :response, result
1625
1865
  end
1626
1866
  rescue ::Gapic::Rest::Error => e
1627
1867
  raise ::Google::Cloud::Error.from_error(e)
@@ -1655,22 +1895,22 @@ module Google
1655
1895
  # Required. The resource being updated
1656
1896
  # @param request_id [::String]
1657
1897
  # Optional. An optional request ID to identify requests. Specify a unique
1658
- # request ID so that if you must retry your request, the server will know to
1659
- # ignore the request if it has already been completed. The server will
1660
- # guarantee that for at least 60 minutes since the first request.
1898
+ # request ID so that if you must retry your request, the server ignores the
1899
+ # request if it has already been completed. The server guarantees that for at
1900
+ # least 60 minutes since the first request.
1661
1901
  #
1662
1902
  # For example, consider a situation where you make an initial request and
1663
1903
  # the request times out. If you make the request again with the same request
1664
- # ID, the server can check if original operation with the same request ID
1665
- # was received, and if so, will ignore the second request. This prevents
1904
+ # ID, the server can check if the original operation with the same request ID
1905
+ # was received, and if so, ignores the second request. This prevents
1666
1906
  # clients from accidentally creating duplicate commitments.
1667
1907
  #
1668
1908
  # The request ID must be a valid UUID with the exception that zero UUID is
1669
1909
  # not supported (00000000-0000-0000-0000-000000000000).
1670
1910
  # @param validate_only [::Boolean]
1671
- # Optional. If set, performs request validation (e.g. permission checks and
1672
- # any other type of validation), but do not actually execute the update
1673
- # request.
1911
+ # Optional. If set, performs request validation, for example, permission
1912
+ # checks and any other type of validation, but does not actually execute the
1913
+ # create request.
1674
1914
  # @param allow_missing [::Boolean]
1675
1915
  # Optional. If set to true, update succeeds even if instance is not found. In
1676
1916
  # that case, a new instance is created and `update_mask` is ignored.
@@ -1735,7 +1975,7 @@ module Google
1735
1975
  @alloy_db_admin_stub.update_instance request, options do |result, operation|
1736
1976
  result = ::Gapic::Operation.new result, @operations_client, options: options
1737
1977
  yield result, operation if block_given?
1738
- return result
1978
+ throw :response, result
1739
1979
  end
1740
1980
  rescue ::Gapic::Rest::Error => e
1741
1981
  raise ::Google::Cloud::Error.from_error(e)
@@ -1764,14 +2004,14 @@ module Google
1764
2004
  # comment on the Instance.name field.
1765
2005
  # @param request_id [::String]
1766
2006
  # Optional. An optional request ID to identify requests. Specify a unique
1767
- # request ID so that if you must retry your request, the server will know to
1768
- # ignore the request if it has already been completed. The server will
1769
- # guarantee that for at least 60 minutes after the first request.
2007
+ # request ID so that if you must retry your request, the server ignores the
2008
+ # request if it has already been completed. The server guarantees that for at
2009
+ # least 60 minutes since the first request.
1770
2010
  #
1771
2011
  # For example, consider a situation where you make an initial request and
1772
2012
  # the request times out. If you make the request again with the same request
1773
- # ID, the server can check if original operation with the same request ID
1774
- # was received, and if so, will ignore the second request. This prevents
2013
+ # ID, the server can check if the original operation with the same request ID
2014
+ # was received, and if so, ignores the second request. This prevents
1775
2015
  # clients from accidentally creating duplicate commitments.
1776
2016
  #
1777
2017
  # The request ID must be a valid UUID with the exception that zero UUID is
@@ -1781,8 +2021,9 @@ module Google
1781
2021
  # If an etag is provided and does not match the current etag of the Instance,
1782
2022
  # deletion will be blocked and an ABORTED error will be returned.
1783
2023
  # @param validate_only [::Boolean]
1784
- # Optional. If set, performs request validation (e.g. permission checks and
1785
- # any other type of validation), but do not actually execute the delete.
2024
+ # Optional. If set, performs request validation, for example, permission
2025
+ # checks and any other type of validation, but does not actually execute the
2026
+ # create request.
1786
2027
  # @yield [result, operation] Access the result along with the TransportOperation object
1787
2028
  # @yieldparam result [::Gapic::Operation]
1788
2029
  # @yieldparam operation [::Gapic::Rest::TransportOperation]
@@ -1844,7 +2085,7 @@ module Google
1844
2085
  @alloy_db_admin_stub.delete_instance request, options do |result, operation|
1845
2086
  result = ::Gapic::Operation.new result, @operations_client, options: options
1846
2087
  yield result, operation if block_given?
1847
- return result
2088
+ throw :response, result
1848
2089
  end
1849
2090
  rescue ::Gapic::Rest::Error => e
1850
2091
  raise ::Google::Cloud::Error.from_error(e)
@@ -1875,21 +2116,22 @@ module Google
1875
2116
  # comment on the Instance.name field.
1876
2117
  # @param request_id [::String]
1877
2118
  # Optional. An optional request ID to identify requests. Specify a unique
1878
- # request ID so that if you must retry your request, the server will know to
1879
- # ignore the request if it has already been completed. The server will
1880
- # guarantee that for at least 60 minutes after the first request.
2119
+ # request ID so that if you must retry your request, the server ignores the
2120
+ # request if it has already been completed. The server guarantees that for at
2121
+ # least 60 minutes since the first request.
1881
2122
  #
1882
2123
  # For example, consider a situation where you make an initial request and
1883
2124
  # the request times out. If you make the request again with the same request
1884
- # ID, the server can check if original operation with the same request ID
1885
- # was received, and if so, will ignore the second request. This prevents
2125
+ # ID, the server can check if the original operation with the same request ID
2126
+ # was received, and if so, ignores the second request. This prevents
1886
2127
  # clients from accidentally creating duplicate commitments.
1887
2128
  #
1888
2129
  # The request ID must be a valid UUID with the exception that zero UUID is
1889
2130
  # not supported (00000000-0000-0000-0000-000000000000).
1890
2131
  # @param validate_only [::Boolean]
1891
- # Optional. If set, performs request validation (e.g. permission checks and
1892
- # any other type of validation), but do not actually execute the failover.
2132
+ # Optional. If set, performs request validation, for example, permission
2133
+ # checks and any other type of validation, but does not actually execute the
2134
+ # create request.
1893
2135
  # @yield [result, operation] Access the result along with the TransportOperation object
1894
2136
  # @yieldparam result [::Gapic::Operation]
1895
2137
  # @yieldparam operation [::Gapic::Rest::TransportOperation]
@@ -1951,7 +2193,7 @@ module Google
1951
2193
  @alloy_db_admin_stub.failover_instance request, options do |result, operation|
1952
2194
  result = ::Gapic::Operation.new result, @operations_client, options: options
1953
2195
  yield result, operation if block_given?
1954
- return result
2196
+ throw :response, result
1955
2197
  end
1956
2198
  rescue ::Gapic::Rest::Error => e
1957
2199
  raise ::Google::Cloud::Error.from_error(e)
@@ -1983,22 +2225,22 @@ module Google
1983
2225
  # comment on the Instance.name field.
1984
2226
  # @param request_id [::String]
1985
2227
  # Optional. An optional request ID to identify requests. Specify a unique
1986
- # request ID so that if you must retry your request, the server will know to
1987
- # ignore the request if it has already been completed. The server will
1988
- # guarantee that for at least 60 minutes after the first request.
2228
+ # request ID so that if you must retry your request, the server ignores the
2229
+ # request if it has already been completed. The server guarantees that for at
2230
+ # least 60 minutes since the first request.
1989
2231
  #
1990
2232
  # For example, consider a situation where you make an initial request and
1991
2233
  # the request times out. If you make the request again with the same request
1992
- # ID, the server can check if original operation with the same request ID
1993
- # was received, and if so, will ignore the second request. This prevents
2234
+ # ID, the server can check if the original operation with the same request ID
2235
+ # was received, and if so, ignores the second request. This prevents
1994
2236
  # clients from accidentally creating duplicate commitments.
1995
2237
  #
1996
2238
  # The request ID must be a valid UUID with the exception that zero UUID is
1997
2239
  # not supported (00000000-0000-0000-0000-000000000000).
1998
2240
  # @param validate_only [::Boolean]
1999
- # Optional. If set, performs request validation (e.g. permission checks and
2000
- # any other type of validation), but do not actually execute the fault
2001
- # injection.
2241
+ # Optional. If set, performs request validation, for example, permission
2242
+ # checks and any other type of validation, but does not actually execute the
2243
+ # create request.
2002
2244
  # @yield [result, operation] Access the result along with the TransportOperation object
2003
2245
  # @yieldparam result [::Gapic::Operation]
2004
2246
  # @yieldparam operation [::Gapic::Rest::TransportOperation]
@@ -2060,7 +2302,7 @@ module Google
2060
2302
  @alloy_db_admin_stub.inject_fault request, options do |result, operation|
2061
2303
  result = ::Gapic::Operation.new result, @operations_client, options: options
2062
2304
  yield result, operation if block_given?
2063
- return result
2305
+ throw :response, result
2064
2306
  end
2065
2307
  rescue ::Gapic::Rest::Error => e
2066
2308
  raise ::Google::Cloud::Error.from_error(e)
@@ -2080,7 +2322,7 @@ module Google
2080
2322
  # @param options [::Gapic::CallOptions, ::Hash]
2081
2323
  # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
2082
2324
  #
2083
- # @overload restart_instance(name: nil, request_id: nil, validate_only: nil)
2325
+ # @overload restart_instance(name: nil, request_id: nil, validate_only: nil, node_ids: nil)
2084
2326
  # Pass arguments to `restart_instance` via keyword arguments. Note that at
2085
2327
  # least one keyword argument is required. To specify no parameters, or to keep all
2086
2328
  # the default parameter values, pass an empty Hash as a request object (see above).
@@ -2090,21 +2332,25 @@ module Google
2090
2332
  # comment on the Instance.name field.
2091
2333
  # @param request_id [::String]
2092
2334
  # Optional. An optional request ID to identify requests. Specify a unique
2093
- # request ID so that if you must retry your request, the server will know to
2094
- # ignore the request if it has already been completed. The server will
2095
- # guarantee that for at least 60 minutes after the first request.
2335
+ # request ID so that if you must retry your request, the server ignores the
2336
+ # request if it has already been completed. The server guarantees that for at
2337
+ # least 60 minutes since the first request.
2096
2338
  #
2097
2339
  # For example, consider a situation where you make an initial request and
2098
2340
  # the request times out. If you make the request again with the same request
2099
- # ID, the server can check if original operation with the same request ID
2100
- # was received, and if so, will ignore the second request. This prevents
2341
+ # ID, the server can check if the original operation with the same request ID
2342
+ # was received, and if so, ignores the second request. This prevents
2101
2343
  # clients from accidentally creating duplicate commitments.
2102
2344
  #
2103
2345
  # The request ID must be a valid UUID with the exception that zero UUID is
2104
2346
  # not supported (00000000-0000-0000-0000-000000000000).
2105
2347
  # @param validate_only [::Boolean]
2106
- # Optional. If set, performs request validation (e.g. permission checks and
2107
- # any other type of validation), but do not actually execute the restart.
2348
+ # Optional. If set, performs request validation, for example, permission
2349
+ # checks and any other type of validation, but does not actually execute the
2350
+ # create request.
2351
+ # @param node_ids [::Array<::String>]
2352
+ # Optional. Full name of the nodes as obtained from INSTANCE_VIEW_FULL to
2353
+ # restart upon. Applicable only to read instances.
2108
2354
  # @yield [result, operation] Access the result along with the TransportOperation object
2109
2355
  # @yieldparam result [::Gapic::Operation]
2110
2356
  # @yieldparam operation [::Gapic::Rest::TransportOperation]
@@ -2166,7 +2412,99 @@ module Google
2166
2412
  @alloy_db_admin_stub.restart_instance request, options do |result, operation|
2167
2413
  result = ::Gapic::Operation.new result, @operations_client, options: options
2168
2414
  yield result, operation if block_given?
2169
- return result
2415
+ throw :response, result
2416
+ end
2417
+ rescue ::Gapic::Rest::Error => e
2418
+ raise ::Google::Cloud::Error.from_error(e)
2419
+ end
2420
+
2421
+ ##
2422
+ # Executes a SQL statement in a database inside an AlloyDB instance.
2423
+ #
2424
+ # @overload execute_sql(request, options = nil)
2425
+ # Pass arguments to `execute_sql` via a request object, either of type
2426
+ # {::Google::Cloud::AlloyDB::V1beta::ExecuteSqlRequest} or an equivalent Hash.
2427
+ #
2428
+ # @param request [::Google::Cloud::AlloyDB::V1beta::ExecuteSqlRequest, ::Hash]
2429
+ # A request object representing the call parameters. Required. To specify no
2430
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
2431
+ # @param options [::Gapic::CallOptions, ::Hash]
2432
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
2433
+ #
2434
+ # @overload execute_sql(password: nil, instance: nil, database: nil, user: nil, sql_statement: nil)
2435
+ # Pass arguments to `execute_sql` via keyword arguments. Note that at
2436
+ # least one keyword argument is required. To specify no parameters, or to keep all
2437
+ # the default parameter values, pass an empty Hash as a request object (see above).
2438
+ #
2439
+ # @param password [::String]
2440
+ # Optional. The database native user’s password.
2441
+ # @param instance [::String]
2442
+ # Required. The instance where the SQL will be executed. For the required
2443
+ # format, see the comment on the Instance.name field.
2444
+ # @param database [::String]
2445
+ # Required. Name of the database where the query will be executed.
2446
+ # Note - Value provided should be the same as expected from `SELECT
2447
+ # current_database();` and NOT as a resource reference.
2448
+ # @param user [::String]
2449
+ # Required. Database user to be used for executing the SQL.
2450
+ # Note - Value provided should be the same as expected from
2451
+ # `SELECT current_user;` and NOT as a resource reference.
2452
+ # @param sql_statement [::String]
2453
+ # Required. SQL statement to execute on database. Any valid statement is
2454
+ # permitted, including DDL, DML, DQL statements.
2455
+ # @yield [result, operation] Access the result along with the TransportOperation object
2456
+ # @yieldparam result [::Google::Cloud::AlloyDB::V1beta::ExecuteSqlResponse]
2457
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
2458
+ #
2459
+ # @return [::Google::Cloud::AlloyDB::V1beta::ExecuteSqlResponse]
2460
+ #
2461
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
2462
+ #
2463
+ # @example Basic example
2464
+ # require "google/cloud/alloy_db/v1beta"
2465
+ #
2466
+ # # Create a client object. The client can be reused for multiple calls.
2467
+ # client = Google::Cloud::AlloyDB::V1beta::AlloyDBAdmin::Rest::Client.new
2468
+ #
2469
+ # # Create a request. To set request fields, pass in keyword arguments.
2470
+ # request = Google::Cloud::AlloyDB::V1beta::ExecuteSqlRequest.new
2471
+ #
2472
+ # # Call the execute_sql method.
2473
+ # result = client.execute_sql request
2474
+ #
2475
+ # # The returned object is of type Google::Cloud::AlloyDB::V1beta::ExecuteSqlResponse.
2476
+ # p result
2477
+ #
2478
+ def execute_sql request, options = nil
2479
+ raise ::ArgumentError, "request must be provided" if request.nil?
2480
+
2481
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::AlloyDB::V1beta::ExecuteSqlRequest
2482
+
2483
+ # Converts hash and nil to an options object
2484
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
2485
+
2486
+ # Customize the options with defaults
2487
+ call_metadata = @config.rpcs.execute_sql.metadata.to_h
2488
+
2489
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
2490
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
2491
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
2492
+ gapic_version: ::Google::Cloud::AlloyDB::V1beta::VERSION,
2493
+ transports_version_send: [:rest]
2494
+
2495
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
2496
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
2497
+
2498
+ options.apply_defaults timeout: @config.rpcs.execute_sql.timeout,
2499
+ metadata: call_metadata,
2500
+ retry_policy: @config.rpcs.execute_sql.retry_policy
2501
+
2502
+ options.apply_defaults timeout: @config.timeout,
2503
+ metadata: @config.metadata,
2504
+ retry_policy: @config.retry_policy
2505
+
2506
+ @alloy_db_admin_stub.execute_sql request, options do |result, operation|
2507
+ yield result, operation if block_given?
2170
2508
  end
2171
2509
  rescue ::Gapic::Rest::Error => e
2172
2510
  raise ::Google::Cloud::Error.from_error(e)
@@ -2258,7 +2596,6 @@ module Google
2258
2596
 
2259
2597
  @alloy_db_admin_stub.list_backups request, options do |result, operation|
2260
2598
  yield result, operation if block_given?
2261
- return result
2262
2599
  end
2263
2600
  rescue ::Gapic::Rest::Error => e
2264
2601
  raise ::Google::Cloud::Error.from_error(e)
@@ -2337,7 +2674,6 @@ module Google
2337
2674
 
2338
2675
  @alloy_db_admin_stub.get_backup request, options do |result, operation|
2339
2676
  yield result, operation if block_given?
2340
- return result
2341
2677
  end
2342
2678
  rescue ::Gapic::Rest::Error => e
2343
2679
  raise ::Google::Cloud::Error.from_error(e)
@@ -2369,14 +2705,14 @@ module Google
2369
2705
  # Required. The resource being created
2370
2706
  # @param request_id [::String]
2371
2707
  # Optional. An optional request ID to identify requests. Specify a unique
2372
- # request ID so that if you must retry your request, the server will know to
2373
- # ignore the request if it has already been completed. The server will
2374
- # guarantee that for at least 60 minutes since the first request.
2708
+ # request ID so that if you must retry your request, the server ignores the
2709
+ # request if it has already been completed. The server guarantees that for at
2710
+ # least 60 minutes since the first request.
2375
2711
  #
2376
2712
  # For example, consider a situation where you make an initial request and
2377
2713
  # the request times out. If you make the request again with the same request
2378
- # ID, the server can check if original operation with the same request ID
2379
- # was received, and if so, will ignore the second request. This prevents
2714
+ # ID, the server can check if the original operation with the same request ID
2715
+ # was received, and if so, ignores the second request. This prevents
2380
2716
  # clients from accidentally creating duplicate commitments.
2381
2717
  #
2382
2718
  # The request ID must be a valid UUID with the exception that zero UUID is
@@ -2445,7 +2781,7 @@ module Google
2445
2781
  @alloy_db_admin_stub.create_backup request, options do |result, operation|
2446
2782
  result = ::Gapic::Operation.new result, @operations_client, options: options
2447
2783
  yield result, operation if block_given?
2448
- return result
2784
+ throw :response, result
2449
2785
  end
2450
2786
  rescue ::Gapic::Rest::Error => e
2451
2787
  raise ::Google::Cloud::Error.from_error(e)
@@ -2479,14 +2815,14 @@ module Google
2479
2815
  # Required. The resource being updated
2480
2816
  # @param request_id [::String]
2481
2817
  # Optional. An optional request ID to identify requests. Specify a unique
2482
- # request ID so that if you must retry your request, the server will know to
2483
- # ignore the request if it has already been completed. The server will
2484
- # guarantee that for at least 60 minutes since the first request.
2818
+ # request ID so that if you must retry your request, the server ignores the
2819
+ # request if it has already been completed. The server guarantees that for at
2820
+ # least 60 minutes since the first request.
2485
2821
  #
2486
2822
  # For example, consider a situation where you make an initial request and
2487
2823
  # the request times out. If you make the request again with the same request
2488
- # ID, the server can check if original operation with the same request ID
2489
- # was received, and if so, will ignore the second request. This prevents
2824
+ # ID, the server can check if the original operation with the same request ID
2825
+ # was received, and if so, ignores the second request. This prevents
2490
2826
  # clients from accidentally creating duplicate commitments.
2491
2827
  #
2492
2828
  # The request ID must be a valid UUID with the exception that zero UUID is
@@ -2558,7 +2894,7 @@ module Google
2558
2894
  @alloy_db_admin_stub.update_backup request, options do |result, operation|
2559
2895
  result = ::Gapic::Operation.new result, @operations_client, options: options
2560
2896
  yield result, operation if block_given?
2561
- return result
2897
+ throw :response, result
2562
2898
  end
2563
2899
  rescue ::Gapic::Rest::Error => e
2564
2900
  raise ::Google::Cloud::Error.from_error(e)
@@ -2587,14 +2923,14 @@ module Google
2587
2923
  # the Backup.name field.
2588
2924
  # @param request_id [::String]
2589
2925
  # Optional. An optional request ID to identify requests. Specify a unique
2590
- # request ID so that if you must retry your request, the server will know to
2591
- # ignore the request if it has already been completed. The server will
2592
- # guarantee that for at least 60 minutes after the first request.
2926
+ # request ID so that if you must retry your request, the server ignores the
2927
+ # request if it has already been completed. The server guarantees that for at
2928
+ # least 60 minutes since the first request.
2593
2929
  #
2594
2930
  # For example, consider a situation where you make an initial request and
2595
2931
  # the request times out. If you make the request again with the same request
2596
- # ID, the server can check if original operation with the same request ID
2597
- # was received, and if so, will ignore the second request. This prevents
2932
+ # ID, the server can check if the original operation with the same request ID
2933
+ # was received, and if so, ignores the second request. This prevents
2598
2934
  # clients from accidentally creating duplicate commitments.
2599
2935
  #
2600
2936
  # The request ID must be a valid UUID with the exception that zero UUID is
@@ -2667,7 +3003,7 @@ module Google
2667
3003
  @alloy_db_admin_stub.delete_backup request, options do |result, operation|
2668
3004
  result = ::Gapic::Operation.new result, @operations_client, options: options
2669
3005
  yield result, operation if block_given?
2670
- return result
3006
+ throw :response, result
2671
3007
  end
2672
3008
  rescue ::Gapic::Rest::Error => e
2673
3009
  raise ::Google::Cloud::Error.from_error(e)
@@ -2762,7 +3098,7 @@ module Google
2762
3098
  @alloy_db_admin_stub.list_supported_database_flags request, options do |result, operation|
2763
3099
  result = ::Gapic::Rest::PagedEnumerable.new @alloy_db_admin_stub, :list_supported_database_flags, "supported_database_flags", request, result, options
2764
3100
  yield result, operation if block_given?
2765
- return result
3101
+ throw :response, result
2766
3102
  end
2767
3103
  rescue ::Gapic::Rest::Error => e
2768
3104
  raise ::Google::Cloud::Error.from_error(e)
@@ -2795,14 +3131,14 @@ module Google
2795
3131
  # * projects/\\{project}/locations/\\{location}/clusters/\\{cluster}
2796
3132
  # @param request_id [::String]
2797
3133
  # Optional. An optional request ID to identify requests. Specify a unique
2798
- # request ID so that if you must retry your request, the server will know to
2799
- # ignore the request if it has already been completed. The server will
2800
- # guarantee that for at least 60 minutes after the first request.
3134
+ # request ID so that if you must retry your request, the server ignores the
3135
+ # request if it has already been completed. The server guarantees that for at
3136
+ # least 60 minutes since the first request.
2801
3137
  #
2802
3138
  # For example, consider a situation where you make an initial request and
2803
3139
  # the request times out. If you make the request again with the same request
2804
- # ID, the server can check if original operation with the same request ID
2805
- # was received, and if so, will ignore the second request. This prevents
3140
+ # ID, the server can check if the original operation with the same request ID
3141
+ # was received, and if so, ignores the second request. This prevents
2806
3142
  # clients from accidentally creating duplicate commitments.
2807
3143
  #
2808
3144
  # The request ID must be a valid UUID with the exception that zero UUID is
@@ -2875,7 +3211,6 @@ module Google
2875
3211
 
2876
3212
  @alloy_db_admin_stub.generate_client_certificate request, options do |result, operation|
2877
3213
  yield result, operation if block_given?
2878
- return result
2879
3214
  end
2880
3215
  rescue ::Gapic::Rest::Error => e
2881
3216
  raise ::Google::Cloud::Error.from_error(e)
@@ -2904,14 +3239,14 @@ module Google
2904
3239
  # projects/\\{project}/locations/\\{location}/clusters/\\{cluster}/instances/\\{instance}
2905
3240
  # @param request_id [::String]
2906
3241
  # Optional. An optional request ID to identify requests. Specify a unique
2907
- # request ID so that if you must retry your request, the server will know to
2908
- # ignore the request if it has already been completed. The server will
2909
- # guarantee that for at least 60 minutes after the first request.
3242
+ # request ID so that if you must retry your request, the server ignores the
3243
+ # request if it has already been completed. The server guarantees that for at
3244
+ # least 60 minutes since the first request.
2910
3245
  #
2911
3246
  # For example, consider a situation where you make an initial request and
2912
3247
  # the request times out. If you make the request again with the same request
2913
- # ID, the server can check if original operation with the same request ID
2914
- # was received, and if so, will ignore the second request. This prevents
3248
+ # ID, the server can check if the original operation with the same request ID
3249
+ # was received, and if so, ignores the second request. This prevents
2915
3250
  # clients from accidentally creating duplicate commitments.
2916
3251
  #
2917
3252
  # The request ID must be a valid UUID with the exception that zero UUID is
@@ -2969,7 +3304,6 @@ module Google
2969
3304
 
2970
3305
  @alloy_db_admin_stub.get_connection_info request, options do |result, operation|
2971
3306
  yield result, operation if block_given?
2972
- return result
2973
3307
  end
2974
3308
  rescue ::Gapic::Rest::Error => e
2975
3309
  raise ::Google::Cloud::Error.from_error(e)
@@ -3061,7 +3395,6 @@ module Google
3061
3395
 
3062
3396
  @alloy_db_admin_stub.list_users request, options do |result, operation|
3063
3397
  yield result, operation if block_given?
3064
- return result
3065
3398
  end
3066
3399
  rescue ::Gapic::Rest::Error => e
3067
3400
  raise ::Google::Cloud::Error.from_error(e)
@@ -3141,7 +3474,6 @@ module Google
3141
3474
 
3142
3475
  @alloy_db_admin_stub.get_user request, options do |result, operation|
3143
3476
  yield result, operation if block_given?
3144
- return result
3145
3477
  end
3146
3478
  rescue ::Gapic::Rest::Error => e
3147
3479
  raise ::Google::Cloud::Error.from_error(e)
@@ -3173,14 +3505,14 @@ module Google
3173
3505
  # Required. The resource being created
3174
3506
  # @param request_id [::String]
3175
3507
  # Optional. An optional request ID to identify requests. Specify a unique
3176
- # request ID so that if you must retry your request, the server will know to
3177
- # ignore the request if it has already been completed. The server will
3178
- # guarantee that for at least 60 minutes since the first request.
3508
+ # request ID so that if you must retry your request, the server ignores the
3509
+ # request if it has already been completed. The server guarantees that for at
3510
+ # least 60 minutes since the first request.
3179
3511
  #
3180
3512
  # For example, consider a situation where you make an initial request and
3181
3513
  # the request times out. If you make the request again with the same request
3182
- # ID, the server can check if original operation with the same request ID
3183
- # was received, and if so, will ignore the second request. This prevents
3514
+ # ID, the server can check if the original operation with the same request ID
3515
+ # was received, and if so, ignores the second request. This prevents
3184
3516
  # clients from accidentally creating duplicate commitments.
3185
3517
  #
3186
3518
  # The request ID must be a valid UUID with the exception that zero UUID is
@@ -3241,7 +3573,6 @@ module Google
3241
3573
 
3242
3574
  @alloy_db_admin_stub.create_user request, options do |result, operation|
3243
3575
  yield result, operation if block_given?
3244
- return result
3245
3576
  end
3246
3577
  rescue ::Gapic::Rest::Error => e
3247
3578
  raise ::Google::Cloud::Error.from_error(e)
@@ -3275,14 +3606,14 @@ module Google
3275
3606
  # Required. The resource being updated
3276
3607
  # @param request_id [::String]
3277
3608
  # Optional. An optional request ID to identify requests. Specify a unique
3278
- # request ID so that if you must retry your request, the server will know to
3279
- # ignore the request if it has already been completed. The server will
3280
- # guarantee that for at least 60 minutes since the first request.
3609
+ # request ID so that if you must retry your request, the server ignores the
3610
+ # request if it has already been completed. The server guarantees that for at
3611
+ # least 60 minutes since the first request.
3281
3612
  #
3282
3613
  # For example, consider a situation where you make an initial request and
3283
3614
  # the request times out. If you make the request again with the same request
3284
- # ID, the server can check if original operation with the same request ID
3285
- # was received, and if so, will ignore the second request. This prevents
3615
+ # ID, the server can check if the original operation with the same request ID
3616
+ # was received, and if so, ignores the second request. This prevents
3286
3617
  # clients from accidentally creating duplicate commitments.
3287
3618
  #
3288
3619
  # The request ID must be a valid UUID with the exception that zero UUID is
@@ -3345,7 +3676,6 @@ module Google
3345
3676
 
3346
3677
  @alloy_db_admin_stub.update_user request, options do |result, operation|
3347
3678
  yield result, operation if block_given?
3348
- return result
3349
3679
  end
3350
3680
  rescue ::Gapic::Rest::Error => e
3351
3681
  raise ::Google::Cloud::Error.from_error(e)
@@ -3374,14 +3704,14 @@ module Google
3374
3704
  # comment on the User.name field.
3375
3705
  # @param request_id [::String]
3376
3706
  # Optional. An optional request ID to identify requests. Specify a unique
3377
- # request ID so that if you must retry your request, the server will know to
3378
- # ignore the request if it has already been completed. The server will
3379
- # guarantee that for at least 60 minutes after the first request.
3707
+ # request ID so that if you must retry your request, the server ignores the
3708
+ # request if it has already been completed. The server guarantees that for at
3709
+ # least 60 minutes since the first request.
3380
3710
  #
3381
3711
  # For example, consider a situation where you make an initial request and
3382
3712
  # the request times out. If you make the request again with the same request
3383
- # ID, the server can check if original operation with the same request ID
3384
- # was received, and if so, will ignore the second request. This prevents
3713
+ # ID, the server can check if the original operation with the same request ID
3714
+ # was received, and if so, ignores the second request. This prevents
3385
3715
  # clients from accidentally creating duplicate commitments.
3386
3716
  #
3387
3717
  # The request ID must be a valid UUID with the exception that zero UUID is
@@ -3442,7 +3772,6 @@ module Google
3442
3772
 
3443
3773
  @alloy_db_admin_stub.delete_user request, options do |result, operation|
3444
3774
  yield result, operation if block_given?
3445
- return result
3446
3775
  end
3447
3776
  rescue ::Gapic::Rest::Error => e
3448
3777
  raise ::Google::Cloud::Error.from_error(e)
@@ -3470,9 +3799,9 @@ module Google
3470
3799
  # Required. Parent value for ListDatabasesRequest.
3471
3800
  # @param page_size [::Integer]
3472
3801
  # Optional. The maximum number of databases to return. The service may return
3473
- # fewer than this value. If unspecified, an appropriate number of databases
3474
- # will be returned. The max value will be 2000, values above max will be
3475
- # coerced to max.
3802
+ # fewer than this value. If unspecified, 2000 is the default page_size. The
3803
+ # max value of page_size will be 4000, values above max will be coerced to
3804
+ # max.
3476
3805
  # @param page_token [::String]
3477
3806
  # Optional. A page token, received from a previous `ListDatabases` call.
3478
3807
  # This should be provided to retrieve the subsequent page.
@@ -3538,7 +3867,7 @@ module Google
3538
3867
  @alloy_db_admin_stub.list_databases request, options do |result, operation|
3539
3868
  result = ::Gapic::Rest::PagedEnumerable.new @alloy_db_admin_stub, :list_databases, "databases", request, result, options
3540
3869
  yield result, operation if block_given?
3541
- return result
3870
+ throw :response, result
3542
3871
  end
3543
3872
  rescue ::Gapic::Rest::Error => e
3544
3873
  raise ::Google::Cloud::Error.from_error(e)
@@ -3618,6 +3947,11 @@ module Google
3618
3947
  # default endpoint URL. The default value of nil uses the environment
3619
3948
  # universe (usually the default "googleapis.com" universe).
3620
3949
  # @return [::String,nil]
3950
+ # @!attribute [rw] logger
3951
+ # A custom logger to use for request/response debug logging, or the value
3952
+ # `:default` (the default) to construct a default logger, or `nil` to
3953
+ # explicitly disable logging.
3954
+ # @return [::Logger,:default,nil]
3621
3955
  #
3622
3956
  class Configuration
3623
3957
  extend ::Gapic::Config
@@ -3646,6 +3980,7 @@ module Google
3646
3980
  # by the host service.
3647
3981
  # @return [::Hash{::Symbol=>::Array<::Gapic::Rest::GrpcTranscoder::HttpBinding>}]
3648
3982
  config_attr :bindings_override, {}, ::Hash, nil
3983
+ config_attr :logger, :default, ::Logger, nil, :default
3649
3984
 
3650
3985
  # @private
3651
3986
  def initialize parent_config = nil
@@ -3705,6 +4040,11 @@ module Google
3705
4040
  #
3706
4041
  attr_reader :update_cluster
3707
4042
  ##
4043
+ # RPC-specific configuration for `upgrade_cluster`
4044
+ # @return [::Gapic::Config::Method]
4045
+ #
4046
+ attr_reader :upgrade_cluster
4047
+ ##
3708
4048
  # RPC-specific configuration for `delete_cluster`
3709
4049
  # @return [::Gapic::Config::Method]
3710
4050
  #
@@ -3715,6 +4055,11 @@ module Google
3715
4055
  #
3716
4056
  attr_reader :promote_cluster
3717
4057
  ##
4058
+ # RPC-specific configuration for `switchover_cluster`
4059
+ # @return [::Gapic::Config::Method]
4060
+ #
4061
+ attr_reader :switchover_cluster
4062
+ ##
3718
4063
  # RPC-specific configuration for `restore_cluster`
3719
4064
  # @return [::Gapic::Config::Method]
3720
4065
  #
@@ -3775,6 +4120,11 @@ module Google
3775
4120
  #
3776
4121
  attr_reader :restart_instance
3777
4122
  ##
4123
+ # RPC-specific configuration for `execute_sql`
4124
+ # @return [::Gapic::Config::Method]
4125
+ #
4126
+ attr_reader :execute_sql
4127
+ ##
3778
4128
  # RPC-specific configuration for `list_backups`
3779
4129
  # @return [::Gapic::Config::Method]
3780
4130
  #
@@ -3855,10 +4205,14 @@ module Google
3855
4205
  @create_cluster = ::Gapic::Config::Method.new create_cluster_config
3856
4206
  update_cluster_config = parent_rpcs.update_cluster if parent_rpcs.respond_to? :update_cluster
3857
4207
  @update_cluster = ::Gapic::Config::Method.new update_cluster_config
4208
+ upgrade_cluster_config = parent_rpcs.upgrade_cluster if parent_rpcs.respond_to? :upgrade_cluster
4209
+ @upgrade_cluster = ::Gapic::Config::Method.new upgrade_cluster_config
3858
4210
  delete_cluster_config = parent_rpcs.delete_cluster if parent_rpcs.respond_to? :delete_cluster
3859
4211
  @delete_cluster = ::Gapic::Config::Method.new delete_cluster_config
3860
4212
  promote_cluster_config = parent_rpcs.promote_cluster if parent_rpcs.respond_to? :promote_cluster
3861
4213
  @promote_cluster = ::Gapic::Config::Method.new promote_cluster_config
4214
+ switchover_cluster_config = parent_rpcs.switchover_cluster if parent_rpcs.respond_to? :switchover_cluster
4215
+ @switchover_cluster = ::Gapic::Config::Method.new switchover_cluster_config
3862
4216
  restore_cluster_config = parent_rpcs.restore_cluster if parent_rpcs.respond_to? :restore_cluster
3863
4217
  @restore_cluster = ::Gapic::Config::Method.new restore_cluster_config
3864
4218
  create_secondary_cluster_config = parent_rpcs.create_secondary_cluster if parent_rpcs.respond_to? :create_secondary_cluster
@@ -3883,6 +4237,8 @@ module Google
3883
4237
  @inject_fault = ::Gapic::Config::Method.new inject_fault_config
3884
4238
  restart_instance_config = parent_rpcs.restart_instance if parent_rpcs.respond_to? :restart_instance
3885
4239
  @restart_instance = ::Gapic::Config::Method.new restart_instance_config
4240
+ execute_sql_config = parent_rpcs.execute_sql if parent_rpcs.respond_to? :execute_sql
4241
+ @execute_sql = ::Gapic::Config::Method.new execute_sql_config
3886
4242
  list_backups_config = parent_rpcs.list_backups if parent_rpcs.respond_to? :list_backups
3887
4243
  @list_backups = ::Gapic::Config::Method.new list_backups_config
3888
4244
  get_backup_config = parent_rpcs.get_backup if parent_rpcs.respond_to? :get_backup