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.
@@ -228,14 +228,26 @@ module Google
228
228
  universe_domain: @config.universe_domain,
229
229
  channel_args: @config.channel_args,
230
230
  interceptors: @config.interceptors,
231
- channel_pool_config: @config.channel_pool
231
+ channel_pool_config: @config.channel_pool,
232
+ logger: @config.logger
232
233
  )
233
234
 
235
+ @alloy_db_admin_stub.stub_logger&.info do |entry|
236
+ entry.set_system_name
237
+ entry.set_service
238
+ entry.message = "Created client for #{entry.service}"
239
+ entry.set_credentials_fields credentials
240
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
241
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
242
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
243
+ end
244
+
234
245
  @location_client = Google::Cloud::Location::Locations::Client.new do |config|
235
246
  config.credentials = credentials
236
247
  config.quota_project = @quota_project_id
237
248
  config.endpoint = @alloy_db_admin_stub.endpoint
238
249
  config.universe_domain = @alloy_db_admin_stub.universe_domain
250
+ config.logger = @alloy_db_admin_stub.logger if config.respond_to? :logger=
239
251
  end
240
252
 
241
253
  @iam_policy_client = Google::Iam::V1::IAMPolicy::Client.new do |config|
@@ -243,6 +255,7 @@ module Google
243
255
  config.quota_project = @quota_project_id
244
256
  config.endpoint = @alloy_db_admin_stub.endpoint
245
257
  config.universe_domain = @alloy_db_admin_stub.universe_domain
258
+ config.logger = @alloy_db_admin_stub.logger if config.respond_to? :logger=
246
259
  end
247
260
  end
248
261
 
@@ -267,6 +280,15 @@ module Google
267
280
  #
268
281
  attr_reader :iam_policy_client
269
282
 
283
+ ##
284
+ # The logger used for request/response debug logging.
285
+ #
286
+ # @return [Logger]
287
+ #
288
+ def logger
289
+ @alloy_db_admin_stub.logger
290
+ end
291
+
270
292
  # Service calls
271
293
 
272
294
  ##
@@ -366,7 +388,7 @@ module Google
366
388
  @alloy_db_admin_stub.call_rpc :list_clusters, request, options: options do |response, operation|
367
389
  response = ::Gapic::PagedEnumerable.new @alloy_db_admin_stub, :list_clusters, request, response, operation, options
368
390
  yield response, operation if block_given?
369
- return response
391
+ throw :response, response
370
392
  end
371
393
  rescue ::GRPC::BadStatus => e
372
394
  raise ::Google::Cloud::Error.from_error(e)
@@ -456,7 +478,6 @@ module Google
456
478
 
457
479
  @alloy_db_admin_stub.call_rpc :get_cluster, request, options: options do |response, operation|
458
480
  yield response, operation if block_given?
459
- return response
460
481
  end
461
482
  rescue ::GRPC::BadStatus => e
462
483
  raise ::Google::Cloud::Error.from_error(e)
@@ -489,22 +510,22 @@ module Google
489
510
  # Required. The resource being created
490
511
  # @param request_id [::String]
491
512
  # Optional. An optional request ID to identify requests. Specify a unique
492
- # request ID so that if you must retry your request, the server will know to
493
- # ignore the request if it has already been completed. The server will
494
- # guarantee that for at least 60 minutes since the first request.
513
+ # request ID so that if you must retry your request, the server ignores the
514
+ # request if it has already been completed. The server guarantees that for at
515
+ # least 60 minutes since the first request.
495
516
  #
496
517
  # For example, consider a situation where you make an initial request and
497
518
  # the request times out. If you make the request again with the same request
498
- # ID, the server can check if original operation with the same request ID
499
- # was received, and if so, will ignore the second request. This prevents
519
+ # ID, the server can check if the original operation with the same request ID
520
+ # was received, and if so, ignores the second request. This prevents
500
521
  # clients from accidentally creating duplicate commitments.
501
522
  #
502
523
  # The request ID must be a valid UUID with the exception that zero UUID is
503
524
  # not supported (00000000-0000-0000-0000-000000000000).
504
525
  # @param validate_only [::Boolean]
505
- # Optional. If set, performs request validation (e.g. permission checks and
506
- # any other type of validation), but do not actually execute the create
507
- # request.
526
+ # Optional. If set, performs request validation, for example, permission
527
+ # checks and any other type of validation, but does not actually execute the
528
+ # create request.
508
529
  #
509
530
  # @yield [response, operation] Access the result along with the RPC operation
510
531
  # @yieldparam response [::Gapic::Operation]
@@ -573,7 +594,7 @@ module Google
573
594
  @alloy_db_admin_stub.call_rpc :create_cluster, request, options: options do |response, operation|
574
595
  response = ::Gapic::Operation.new response, @operations_client, options: options
575
596
  yield response, operation if block_given?
576
- return response
597
+ throw :response, response
577
598
  end
578
599
  rescue ::GRPC::BadStatus => e
579
600
  raise ::Google::Cloud::Error.from_error(e)
@@ -607,22 +628,22 @@ module Google
607
628
  # Required. The resource being updated
608
629
  # @param request_id [::String]
609
630
  # Optional. An optional request ID to identify requests. Specify a unique
610
- # request ID so that if you must retry your request, the server will know to
611
- # ignore the request if it has already been completed. The server will
612
- # guarantee that for at least 60 minutes since the first request.
631
+ # request ID so that if you must retry your request, the server ignores the
632
+ # request if it has already been completed. The server guarantees that for at
633
+ # least 60 minutes since the first request.
613
634
  #
614
635
  # For example, consider a situation where you make an initial request and
615
636
  # the request times out. If you make the request again with the same request
616
- # ID, the server can check if original operation with the same request ID
617
- # was received, and if so, will ignore the second request. This prevents
637
+ # ID, the server can check if the original operation with the same request ID
638
+ # was received, and if so, ignores the second request. This prevents
618
639
  # clients from accidentally creating duplicate commitments.
619
640
  #
620
641
  # The request ID must be a valid UUID with the exception that zero UUID is
621
642
  # not supported (00000000-0000-0000-0000-000000000000).
622
643
  # @param validate_only [::Boolean]
623
- # Optional. If set, performs request validation (e.g. permission checks and
624
- # any other type of validation), but do not actually execute the update
625
- # request.
644
+ # Optional. If set, performs request validation, for example, permission
645
+ # checks and any other type of validation, but does not actually execute the
646
+ # create request.
626
647
  # @param allow_missing [::Boolean]
627
648
  # Optional. If set to true, update succeeds even if cluster is not found. In
628
649
  # that case, a new cluster is created and `update_mask` is ignored.
@@ -694,7 +715,126 @@ module Google
694
715
  @alloy_db_admin_stub.call_rpc :update_cluster, request, options: options do |response, operation|
695
716
  response = ::Gapic::Operation.new response, @operations_client, options: options
696
717
  yield response, operation if block_given?
697
- return response
718
+ throw :response, response
719
+ end
720
+ rescue ::GRPC::BadStatus => e
721
+ raise ::Google::Cloud::Error.from_error(e)
722
+ end
723
+
724
+ ##
725
+ # Upgrades a single Cluster.
726
+ # Imperative only.
727
+ #
728
+ # @overload upgrade_cluster(request, options = nil)
729
+ # Pass arguments to `upgrade_cluster` via a request object, either of type
730
+ # {::Google::Cloud::AlloyDB::V1beta::UpgradeClusterRequest} or an equivalent Hash.
731
+ #
732
+ # @param request [::Google::Cloud::AlloyDB::V1beta::UpgradeClusterRequest, ::Hash]
733
+ # A request object representing the call parameters. Required. To specify no
734
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
735
+ # @param options [::Gapic::CallOptions, ::Hash]
736
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
737
+ #
738
+ # @overload upgrade_cluster(name: nil, version: nil, request_id: nil, validate_only: nil, etag: nil)
739
+ # Pass arguments to `upgrade_cluster` via keyword arguments. Note that at
740
+ # least one keyword argument is required. To specify no parameters, or to keep all
741
+ # the default parameter values, pass an empty Hash as a request object (see above).
742
+ #
743
+ # @param name [::String]
744
+ # Required. The resource name of the cluster.
745
+ # @param version [::Google::Cloud::AlloyDB::V1beta::DatabaseVersion]
746
+ # Required. The version the cluster is going to be upgraded to.
747
+ # @param request_id [::String]
748
+ # Optional. An optional request ID to identify requests. Specify a unique
749
+ # request ID so that if you must retry your request, the server ignores the
750
+ # request if it has already been completed. The server guarantees that for at
751
+ # least 60 minutes since the first request.
752
+ #
753
+ # For example, consider a situation where you make an initial request and
754
+ # the request times out. If you make the request again with the same request
755
+ # ID, the server can check if the original operation with the same request ID
756
+ # was received, and if so, ignores the second request. This prevents
757
+ # clients from accidentally creating duplicate commitments.
758
+ #
759
+ # The request ID must be a valid UUID with the exception that zero UUID is
760
+ # not supported (00000000-0000-0000-0000-000000000000).
761
+ # @param validate_only [::Boolean]
762
+ # Optional. If set, performs request validation, for example, permission
763
+ # checks and any other type of validation, but does not actually execute the
764
+ # create request.
765
+ # @param etag [::String]
766
+ # Optional. The current etag of the Cluster.
767
+ # If an etag is provided and does not match the current etag of the Cluster,
768
+ # upgrade will be blocked and an ABORTED error will be returned.
769
+ #
770
+ # @yield [response, operation] Access the result along with the RPC operation
771
+ # @yieldparam response [::Gapic::Operation]
772
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
773
+ #
774
+ # @return [::Gapic::Operation]
775
+ #
776
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
777
+ #
778
+ # @example Basic example
779
+ # require "google/cloud/alloy_db/v1beta"
780
+ #
781
+ # # Create a client object. The client can be reused for multiple calls.
782
+ # client = Google::Cloud::AlloyDB::V1beta::AlloyDBAdmin::Client.new
783
+ #
784
+ # # Create a request. To set request fields, pass in keyword arguments.
785
+ # request = Google::Cloud::AlloyDB::V1beta::UpgradeClusterRequest.new
786
+ #
787
+ # # Call the upgrade_cluster method.
788
+ # result = client.upgrade_cluster request
789
+ #
790
+ # # The returned object is of type Gapic::Operation. You can use it to
791
+ # # check the status of an operation, cancel it, or wait for results.
792
+ # # Here is how to wait for a response.
793
+ # result.wait_until_done! timeout: 60
794
+ # if result.response?
795
+ # p result.response
796
+ # else
797
+ # puts "No response received."
798
+ # end
799
+ #
800
+ def upgrade_cluster request, options = nil
801
+ raise ::ArgumentError, "request must be provided" if request.nil?
802
+
803
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::AlloyDB::V1beta::UpgradeClusterRequest
804
+
805
+ # Converts hash and nil to an options object
806
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
807
+
808
+ # Customize the options with defaults
809
+ metadata = @config.rpcs.upgrade_cluster.metadata.to_h
810
+
811
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
812
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
813
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
814
+ gapic_version: ::Google::Cloud::AlloyDB::V1beta::VERSION
815
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
816
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
817
+
818
+ header_params = {}
819
+ if request.name
820
+ header_params["name"] = request.name
821
+ end
822
+
823
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
824
+ metadata[:"x-goog-request-params"] ||= request_params_header
825
+
826
+ options.apply_defaults timeout: @config.rpcs.upgrade_cluster.timeout,
827
+ metadata: metadata,
828
+ retry_policy: @config.rpcs.upgrade_cluster.retry_policy
829
+
830
+ options.apply_defaults timeout: @config.timeout,
831
+ metadata: @config.metadata,
832
+ retry_policy: @config.retry_policy
833
+
834
+ @alloy_db_admin_stub.call_rpc :upgrade_cluster, request, options: options do |response, operation|
835
+ response = ::Gapic::Operation.new response, @operations_client, options: options
836
+ yield response, operation if block_given?
837
+ throw :response, response
698
838
  end
699
839
  rescue ::GRPC::BadStatus => e
700
840
  raise ::Google::Cloud::Error.from_error(e)
@@ -723,14 +863,14 @@ module Google
723
863
  # comment on the Cluster.name field.
724
864
  # @param request_id [::String]
725
865
  # Optional. An optional request ID to identify requests. Specify a unique
726
- # request ID so that if you must retry your request, the server will know to
727
- # ignore the request if it has already been completed. The server will
728
- # guarantee that for at least 60 minutes after the first request.
866
+ # request ID so that if you must retry your request, the server ignores the
867
+ # request if it has already been completed. The server guarantees that for at
868
+ # least 60 minutes since the first request.
729
869
  #
730
870
  # For example, consider a situation where you make an initial request and
731
871
  # the request times out. If you make the request again with the same request
732
- # ID, the server can check if original operation with the same request ID
733
- # was received, and if so, will ignore the second request. This prevents
872
+ # ID, the server can check if the original operation with the same request ID
873
+ # was received, and if so, ignores the second request. This prevents
734
874
  # clients from accidentally creating duplicate commitments.
735
875
  #
736
876
  # The request ID must be a valid UUID with the exception that zero UUID is
@@ -740,8 +880,9 @@ module Google
740
880
  # If an etag is provided and does not match the current etag of the Cluster,
741
881
  # deletion will be blocked and an ABORTED error will be returned.
742
882
  # @param validate_only [::Boolean]
743
- # Optional. If set, performs request validation (e.g. permission checks and
744
- # any other type of validation), but do not actually execute the delete.
883
+ # Optional. If set, performs request validation, for example, permission
884
+ # checks and any other type of validation, but does not actually execute the
885
+ # create request.
745
886
  # @param force [::Boolean]
746
887
  # Optional. Whether to cascade delete child instances for given cluster.
747
888
  #
@@ -812,7 +953,7 @@ module Google
812
953
  @alloy_db_admin_stub.call_rpc :delete_cluster, request, options: options do |response, operation|
813
954
  response = ::Gapic::Operation.new response, @operations_client, options: options
814
955
  yield response, operation if block_given?
815
- return response
956
+ throw :response, response
816
957
  end
817
958
  rescue ::GRPC::BadStatus => e
818
959
  raise ::Google::Cloud::Error.from_error(e)
@@ -844,9 +985,9 @@ module Google
844
985
  # comment on the Cluster.name field
845
986
  # @param request_id [::String]
846
987
  # Optional. An optional request ID to identify requests. Specify a unique
847
- # request ID so that if you must retry your request, the server will know to
848
- # ignore the request if it has already been completed. The server will
849
- # guarantee that for at least 60 minutes after the first request.
988
+ # request ID so that if you must retry your request, the server ignores the
989
+ # request if it has already been completed. The server guarantees that for at
990
+ # least 60 minutes since the first request.
850
991
  #
851
992
  # For example, consider a situation where you make an initial request and
852
993
  # the request times out. If you make the request again with the same request
@@ -861,8 +1002,9 @@ module Google
861
1002
  # If an etag is provided and does not match the current etag of the Cluster,
862
1003
  # deletion will be blocked and an ABORTED error will be returned.
863
1004
  # @param validate_only [::Boolean]
864
- # Optional. If set, performs request validation (e.g. permission checks and
865
- # any other type of validation), but do not actually execute the delete.
1005
+ # Optional. If set, performs request validation, for example, permission
1006
+ # checks and any other type of validation, but does not actually execute the
1007
+ # create request.
866
1008
  #
867
1009
  # @yield [response, operation] Access the result along with the RPC operation
868
1010
  # @yieldparam response [::Gapic::Operation]
@@ -931,7 +1073,122 @@ module Google
931
1073
  @alloy_db_admin_stub.call_rpc :promote_cluster, request, options: options do |response, operation|
932
1074
  response = ::Gapic::Operation.new response, @operations_client, options: options
933
1075
  yield response, operation if block_given?
934
- return response
1076
+ throw :response, response
1077
+ end
1078
+ rescue ::GRPC::BadStatus => e
1079
+ raise ::Google::Cloud::Error.from_error(e)
1080
+ end
1081
+
1082
+ ##
1083
+ # Switches the roles of PRIMARY and SECONDARY clusters without any data loss.
1084
+ # This promotes the SECONDARY cluster to PRIMARY and sets up the original
1085
+ # PRIMARY cluster to replicate from this newly promoted cluster.
1086
+ #
1087
+ # @overload switchover_cluster(request, options = nil)
1088
+ # Pass arguments to `switchover_cluster` via a request object, either of type
1089
+ # {::Google::Cloud::AlloyDB::V1beta::SwitchoverClusterRequest} or an equivalent Hash.
1090
+ #
1091
+ # @param request [::Google::Cloud::AlloyDB::V1beta::SwitchoverClusterRequest, ::Hash]
1092
+ # A request object representing the call parameters. Required. To specify no
1093
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1094
+ # @param options [::Gapic::CallOptions, ::Hash]
1095
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
1096
+ #
1097
+ # @overload switchover_cluster(name: nil, request_id: nil, validate_only: nil)
1098
+ # Pass arguments to `switchover_cluster` via keyword arguments. Note that at
1099
+ # least one keyword argument is required. To specify no parameters, or to keep all
1100
+ # the default parameter values, pass an empty Hash as a request object (see above).
1101
+ #
1102
+ # @param name [::String]
1103
+ # Required. The name of the resource. For the required format, see the
1104
+ # comment on the Cluster.name field
1105
+ # @param request_id [::String]
1106
+ # Optional. An optional request ID to identify requests. Specify a unique
1107
+ # request ID so that if you must retry your request, the server ignores the
1108
+ # request if it has already been completed. The server guarantees that for at
1109
+ # least 60 minutes since the first request.
1110
+ #
1111
+ # For example, consider a situation where you make an initial request and
1112
+ # the request times out. If you make the request again with the same request
1113
+ # ID, the server can check if the original operation with the same request ID
1114
+ # was received, and if so, ignores the second request. This prevents
1115
+ # clients from accidentally creating duplicate commitments.
1116
+ #
1117
+ # The request ID must be a valid UUID with the exception that zero UUID is
1118
+ # not supported (00000000-0000-0000-0000-000000000000).
1119
+ # @param validate_only [::Boolean]
1120
+ # Optional. If set, performs request validation, for example, permission
1121
+ # checks and any other type of validation, but does not actually execute the
1122
+ # create request.
1123
+ #
1124
+ # @yield [response, operation] Access the result along with the RPC operation
1125
+ # @yieldparam response [::Gapic::Operation]
1126
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
1127
+ #
1128
+ # @return [::Gapic::Operation]
1129
+ #
1130
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
1131
+ #
1132
+ # @example Basic example
1133
+ # require "google/cloud/alloy_db/v1beta"
1134
+ #
1135
+ # # Create a client object. The client can be reused for multiple calls.
1136
+ # client = Google::Cloud::AlloyDB::V1beta::AlloyDBAdmin::Client.new
1137
+ #
1138
+ # # Create a request. To set request fields, pass in keyword arguments.
1139
+ # request = Google::Cloud::AlloyDB::V1beta::SwitchoverClusterRequest.new
1140
+ #
1141
+ # # Call the switchover_cluster method.
1142
+ # result = client.switchover_cluster request
1143
+ #
1144
+ # # The returned object is of type Gapic::Operation. You can use it to
1145
+ # # check the status of an operation, cancel it, or wait for results.
1146
+ # # Here is how to wait for a response.
1147
+ # result.wait_until_done! timeout: 60
1148
+ # if result.response?
1149
+ # p result.response
1150
+ # else
1151
+ # puts "No response received."
1152
+ # end
1153
+ #
1154
+ def switchover_cluster request, options = nil
1155
+ raise ::ArgumentError, "request must be provided" if request.nil?
1156
+
1157
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::AlloyDB::V1beta::SwitchoverClusterRequest
1158
+
1159
+ # Converts hash and nil to an options object
1160
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1161
+
1162
+ # Customize the options with defaults
1163
+ metadata = @config.rpcs.switchover_cluster.metadata.to_h
1164
+
1165
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
1166
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1167
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1168
+ gapic_version: ::Google::Cloud::AlloyDB::V1beta::VERSION
1169
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
1170
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1171
+
1172
+ header_params = {}
1173
+ if request.name
1174
+ header_params["name"] = request.name
1175
+ end
1176
+
1177
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1178
+ metadata[:"x-goog-request-params"] ||= request_params_header
1179
+
1180
+ options.apply_defaults timeout: @config.rpcs.switchover_cluster.timeout,
1181
+ metadata: metadata,
1182
+ retry_policy: @config.rpcs.switchover_cluster.retry_policy
1183
+
1184
+ options.apply_defaults timeout: @config.timeout,
1185
+ metadata: @config.metadata,
1186
+ retry_policy: @config.retry_policy
1187
+
1188
+ @alloy_db_admin_stub.call_rpc :switchover_cluster, request, options: options do |response, operation|
1189
+ response = ::Gapic::Operation.new response, @operations_client, options: options
1190
+ yield response, operation if block_given?
1191
+ throw :response, response
935
1192
  end
936
1193
  rescue ::GRPC::BadStatus => e
937
1194
  raise ::Google::Cloud::Error.from_error(e)
@@ -971,22 +1228,22 @@ module Google
971
1228
  # Required. The resource being created
972
1229
  # @param request_id [::String]
973
1230
  # Optional. An optional request ID to identify requests. Specify a unique
974
- # request ID so that if you must retry your request, the server will know to
975
- # ignore the request if it has already been completed. The server will
976
- # guarantee that for at least 60 minutes since the first request.
1231
+ # request ID so that if you must retry your request, the server ignores the
1232
+ # request if it has already been completed. The server guarantees that for at
1233
+ # least 60 minutes since the first request.
977
1234
  #
978
1235
  # For example, consider a situation where you make an initial request and
979
1236
  # the request times out. If you make the request again with the same request
980
- # ID, the server can check if original operation with the same request ID
981
- # was received, and if so, will ignore the second request. This prevents
1237
+ # ID, the server can check if the original operation with the same request ID
1238
+ # was received, and if so, ignores the second request. This prevents
982
1239
  # clients from accidentally creating duplicate commitments.
983
1240
  #
984
1241
  # The request ID must be a valid UUID with the exception that zero UUID is
985
1242
  # not supported (00000000-0000-0000-0000-000000000000).
986
1243
  # @param validate_only [::Boolean]
987
- # Optional. If set, performs request validation (e.g. permission checks and
988
- # any other type of validation), but do not actually execute the import
989
- # request.
1244
+ # Optional. If set, performs request validation, for example, permission
1245
+ # checks and any other type of validation, but does not actually execute the
1246
+ # create request.
990
1247
  #
991
1248
  # @yield [response, operation] Access the result along with the RPC operation
992
1249
  # @yieldparam response [::Gapic::Operation]
@@ -1055,7 +1312,7 @@ module Google
1055
1312
  @alloy_db_admin_stub.call_rpc :restore_cluster, request, options: options do |response, operation|
1056
1313
  response = ::Gapic::Operation.new response, @operations_client, options: options
1057
1314
  yield response, operation if block_given?
1058
- return response
1315
+ throw :response, response
1059
1316
  end
1060
1317
  rescue ::GRPC::BadStatus => e
1061
1318
  raise ::Google::Cloud::Error.from_error(e)
@@ -1089,22 +1346,22 @@ module Google
1089
1346
  # Required. Configuration of the requesting object (the secondary cluster).
1090
1347
  # @param request_id [::String]
1091
1348
  # Optional. An optional request ID to identify requests. Specify a unique
1092
- # request ID so that if you must retry your request, the server will know to
1093
- # ignore the request if it has already been completed. The server will
1094
- # guarantee that for at least 60 minutes since the first request.
1349
+ # request ID so that if you must retry your request, the server ignores the
1350
+ # request if it has already been completed. The server guarantees that for at
1351
+ # least 60 minutes since the first request.
1095
1352
  #
1096
1353
  # For example, consider a situation where you make an initial request and
1097
1354
  # the request times out. If you make the request again with the same request
1098
- # ID, the server can check if original operation with the same request ID
1099
- # was received, and if so, will ignore the second request. This prevents
1355
+ # ID, the server can check if the original operation with the same request ID
1356
+ # was received, and if so, ignores the second request. This prevents
1100
1357
  # clients from accidentally creating duplicate commitments.
1101
1358
  #
1102
1359
  # The request ID must be a valid UUID with the exception that zero UUID is
1103
1360
  # not supported (00000000-0000-0000-0000-000000000000).
1104
1361
  # @param validate_only [::Boolean]
1105
- # Optional. If set, performs request validation (e.g. permission checks and
1106
- # any other type of validation), but do not actually execute the create
1107
- # request.
1362
+ # Optional. If set, performs request validation, for example, permission
1363
+ # checks and any other type of validation, but does not actually execute the
1364
+ # create request.
1108
1365
  #
1109
1366
  # @yield [response, operation] Access the result along with the RPC operation
1110
1367
  # @yieldparam response [::Gapic::Operation]
@@ -1173,7 +1430,7 @@ module Google
1173
1430
  @alloy_db_admin_stub.call_rpc :create_secondary_cluster, request, options: options do |response, operation|
1174
1431
  response = ::Gapic::Operation.new response, @operations_client, options: options
1175
1432
  yield response, operation if block_given?
1176
- return response
1433
+ throw :response, response
1177
1434
  end
1178
1435
  rescue ::GRPC::BadStatus => e
1179
1436
  raise ::Google::Cloud::Error.from_error(e)
@@ -1278,7 +1535,7 @@ module Google
1278
1535
  @alloy_db_admin_stub.call_rpc :list_instances, request, options: options do |response, operation|
1279
1536
  response = ::Gapic::PagedEnumerable.new @alloy_db_admin_stub, :list_instances, request, response, operation, options
1280
1537
  yield response, operation if block_given?
1281
- return response
1538
+ throw :response, response
1282
1539
  end
1283
1540
  rescue ::GRPC::BadStatus => e
1284
1541
  raise ::Google::Cloud::Error.from_error(e)
@@ -1367,7 +1624,6 @@ module Google
1367
1624
 
1368
1625
  @alloy_db_admin_stub.call_rpc :get_instance, request, options: options do |response, operation|
1369
1626
  yield response, operation if block_given?
1370
- return response
1371
1627
  end
1372
1628
  rescue ::GRPC::BadStatus => e
1373
1629
  raise ::Google::Cloud::Error.from_error(e)
@@ -1400,22 +1656,22 @@ module Google
1400
1656
  # Required. The resource being created
1401
1657
  # @param request_id [::String]
1402
1658
  # Optional. An optional request ID to identify requests. Specify a unique
1403
- # request ID so that if you must retry your request, the server will know to
1404
- # ignore the request if it has already been completed. The server will
1405
- # guarantee that for at least 60 minutes since the first request.
1659
+ # request ID so that if you must retry your request, the server ignores the
1660
+ # request if it has already been completed. The server guarantees that for at
1661
+ # least 60 minutes since the first request.
1406
1662
  #
1407
1663
  # For example, consider a situation where you make an initial request and
1408
1664
  # the request times out. If you make the request again with the same request
1409
- # ID, the server can check if original operation with the same request ID
1410
- # was received, and if so, will ignore the second request. This prevents
1665
+ # ID, the server can check if the original operation with the same request ID
1666
+ # was received, and if so, ignores the second request. This prevents
1411
1667
  # clients from accidentally creating duplicate commitments.
1412
1668
  #
1413
1669
  # The request ID must be a valid UUID with the exception that zero UUID is
1414
1670
  # not supported (00000000-0000-0000-0000-000000000000).
1415
1671
  # @param validate_only [::Boolean]
1416
- # Optional. If set, performs request validation (e.g. permission checks and
1417
- # any other type of validation), but do not actually execute the create
1418
- # request.
1672
+ # Optional. If set, performs request validation, for example, permission
1673
+ # checks and any other type of validation, but does not actually execute the
1674
+ # create request.
1419
1675
  #
1420
1676
  # @yield [response, operation] Access the result along with the RPC operation
1421
1677
  # @yieldparam response [::Gapic::Operation]
@@ -1484,7 +1740,7 @@ module Google
1484
1740
  @alloy_db_admin_stub.call_rpc :create_instance, request, options: options do |response, operation|
1485
1741
  response = ::Gapic::Operation.new response, @operations_client, options: options
1486
1742
  yield response, operation if block_given?
1487
- return response
1743
+ throw :response, response
1488
1744
  end
1489
1745
  rescue ::GRPC::BadStatus => e
1490
1746
  raise ::Google::Cloud::Error.from_error(e)
@@ -1517,22 +1773,22 @@ module Google
1517
1773
  # Required. The resource being created
1518
1774
  # @param request_id [::String]
1519
1775
  # Optional. An optional request ID to identify requests. Specify a unique
1520
- # request ID so that if you must retry your request, the server will know to
1521
- # ignore the request if it has already been completed. The server will
1522
- # guarantee that for at least 60 minutes since the first request.
1776
+ # request ID so that if you must retry your request, the server ignores the
1777
+ # request if it has already been completed. The server guarantees that for at
1778
+ # least 60 minutes since the first request.
1523
1779
  #
1524
1780
  # For example, consider a situation where you make an initial request and
1525
1781
  # the request times out. If you make the request again with the same request
1526
- # ID, the server can check if original operation with the same request ID
1527
- # was received, and if so, will ignore the second request. This prevents
1782
+ # ID, the server can check if the original operation with the same request ID
1783
+ # was received, and if so, ignores the second request. This prevents
1528
1784
  # clients from accidentally creating duplicate commitments.
1529
1785
  #
1530
1786
  # The request ID must be a valid UUID with the exception that zero UUID is
1531
1787
  # not supported (00000000-0000-0000-0000-000000000000).
1532
1788
  # @param validate_only [::Boolean]
1533
- # Optional. If set, performs request validation (e.g. permission checks and
1534
- # any other type of validation), but do not actually execute the create
1535
- # request.
1789
+ # Optional. If set, performs request validation, for example, permission
1790
+ # checks and any other type of validation, but does not actually execute the
1791
+ # create request.
1536
1792
  #
1537
1793
  # @yield [response, operation] Access the result along with the RPC operation
1538
1794
  # @yieldparam response [::Gapic::Operation]
@@ -1601,7 +1857,7 @@ module Google
1601
1857
  @alloy_db_admin_stub.call_rpc :create_secondary_instance, request, options: options do |response, operation|
1602
1858
  response = ::Gapic::Operation.new response, @operations_client, options: options
1603
1859
  yield response, operation if block_given?
1604
- return response
1860
+ throw :response, response
1605
1861
  end
1606
1862
  rescue ::GRPC::BadStatus => e
1607
1863
  raise ::Google::Cloud::Error.from_error(e)
@@ -1640,14 +1896,14 @@ module Google
1640
1896
  # Required. Resources being created.
1641
1897
  # @param request_id [::String]
1642
1898
  # 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.
1899
+ # request ID so that if you must retry your request, the server ignores the
1900
+ # request if it has already been completed. The server guarantees that for at
1901
+ # least 60 minutes since the first request.
1646
1902
  #
1647
1903
  # For example, consider a situation where you make an initial request and
1648
1904
  # 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
1905
+ # ID, the server can check if the original operation with the same request ID
1906
+ # was received, and if so, ignores the second request. This prevents
1651
1907
  # clients from accidentally creating duplicate commitments.
1652
1908
  #
1653
1909
  # The request ID must be a valid UUID with the exception that zero UUID is
@@ -1720,7 +1976,7 @@ module Google
1720
1976
  @alloy_db_admin_stub.call_rpc :batch_create_instances, request, options: options do |response, operation|
1721
1977
  response = ::Gapic::Operation.new response, @operations_client, options: options
1722
1978
  yield response, operation if block_given?
1723
- return response
1979
+ throw :response, response
1724
1980
  end
1725
1981
  rescue ::GRPC::BadStatus => e
1726
1982
  raise ::Google::Cloud::Error.from_error(e)
@@ -1754,22 +2010,22 @@ module Google
1754
2010
  # Required. The resource being updated
1755
2011
  # @param request_id [::String]
1756
2012
  # Optional. An optional request ID to identify requests. Specify a unique
1757
- # request ID so that if you must retry your request, the server will know to
1758
- # ignore the request if it has already been completed. The server will
1759
- # guarantee that for at least 60 minutes since the first request.
2013
+ # request ID so that if you must retry your request, the server ignores the
2014
+ # request if it has already been completed. The server guarantees that for at
2015
+ # least 60 minutes since the first request.
1760
2016
  #
1761
2017
  # For example, consider a situation where you make an initial request and
1762
2018
  # the request times out. If you make the request again with the same request
1763
- # ID, the server can check if original operation with the same request ID
1764
- # was received, and if so, will ignore the second request. This prevents
2019
+ # ID, the server can check if the original operation with the same request ID
2020
+ # was received, and if so, ignores the second request. This prevents
1765
2021
  # clients from accidentally creating duplicate commitments.
1766
2022
  #
1767
2023
  # The request ID must be a valid UUID with the exception that zero UUID is
1768
2024
  # not supported (00000000-0000-0000-0000-000000000000).
1769
2025
  # @param validate_only [::Boolean]
1770
- # Optional. If set, performs request validation (e.g. permission checks and
1771
- # any other type of validation), but do not actually execute the update
1772
- # request.
2026
+ # Optional. If set, performs request validation, for example, permission
2027
+ # checks and any other type of validation, but does not actually execute the
2028
+ # create request.
1773
2029
  # @param allow_missing [::Boolean]
1774
2030
  # Optional. If set to true, update succeeds even if instance is not found. In
1775
2031
  # that case, a new instance is created and `update_mask` is ignored.
@@ -1841,7 +2097,7 @@ module Google
1841
2097
  @alloy_db_admin_stub.call_rpc :update_instance, request, options: options do |response, operation|
1842
2098
  response = ::Gapic::Operation.new response, @operations_client, options: options
1843
2099
  yield response, operation if block_given?
1844
- return response
2100
+ throw :response, response
1845
2101
  end
1846
2102
  rescue ::GRPC::BadStatus => e
1847
2103
  raise ::Google::Cloud::Error.from_error(e)
@@ -1870,14 +2126,14 @@ module Google
1870
2126
  # comment on the Instance.name field.
1871
2127
  # @param request_id [::String]
1872
2128
  # Optional. An optional request ID to identify requests. Specify a unique
1873
- # request ID so that if you must retry your request, the server will know to
1874
- # ignore the request if it has already been completed. The server will
1875
- # guarantee that for at least 60 minutes after the first request.
2129
+ # request ID so that if you must retry your request, the server ignores the
2130
+ # request if it has already been completed. The server guarantees that for at
2131
+ # least 60 minutes since the first request.
1876
2132
  #
1877
2133
  # For example, consider a situation where you make an initial request and
1878
2134
  # the request times out. If you make the request again with the same request
1879
- # ID, the server can check if original operation with the same request ID
1880
- # was received, and if so, will ignore the second request. This prevents
2135
+ # ID, the server can check if the original operation with the same request ID
2136
+ # was received, and if so, ignores the second request. This prevents
1881
2137
  # clients from accidentally creating duplicate commitments.
1882
2138
  #
1883
2139
  # The request ID must be a valid UUID with the exception that zero UUID is
@@ -1887,8 +2143,9 @@ module Google
1887
2143
  # If an etag is provided and does not match the current etag of the Instance,
1888
2144
  # deletion will be blocked and an ABORTED error will be returned.
1889
2145
  # @param validate_only [::Boolean]
1890
- # Optional. If set, performs request validation (e.g. permission checks and
1891
- # any other type of validation), but do not actually execute the delete.
2146
+ # Optional. If set, performs request validation, for example, permission
2147
+ # checks and any other type of validation, but does not actually execute the
2148
+ # create request.
1892
2149
  #
1893
2150
  # @yield [response, operation] Access the result along with the RPC operation
1894
2151
  # @yieldparam response [::Gapic::Operation]
@@ -1957,7 +2214,7 @@ module Google
1957
2214
  @alloy_db_admin_stub.call_rpc :delete_instance, request, options: options do |response, operation|
1958
2215
  response = ::Gapic::Operation.new response, @operations_client, options: options
1959
2216
  yield response, operation if block_given?
1960
- return response
2217
+ throw :response, response
1961
2218
  end
1962
2219
  rescue ::GRPC::BadStatus => e
1963
2220
  raise ::Google::Cloud::Error.from_error(e)
@@ -1988,21 +2245,22 @@ module Google
1988
2245
  # comment on the Instance.name field.
1989
2246
  # @param request_id [::String]
1990
2247
  # Optional. An optional request ID to identify requests. Specify a unique
1991
- # request ID so that if you must retry your request, the server will know to
1992
- # ignore the request if it has already been completed. The server will
1993
- # guarantee that for at least 60 minutes after the first request.
2248
+ # request ID so that if you must retry your request, the server ignores the
2249
+ # request if it has already been completed. The server guarantees that for at
2250
+ # least 60 minutes since the first request.
1994
2251
  #
1995
2252
  # For example, consider a situation where you make an initial request and
1996
2253
  # the request times out. If you make the request again with the same request
1997
- # ID, the server can check if original operation with the same request ID
1998
- # was received, and if so, will ignore the second request. This prevents
2254
+ # ID, the server can check if the original operation with the same request ID
2255
+ # was received, and if so, ignores the second request. This prevents
1999
2256
  # clients from accidentally creating duplicate commitments.
2000
2257
  #
2001
2258
  # The request ID must be a valid UUID with the exception that zero UUID is
2002
2259
  # not supported (00000000-0000-0000-0000-000000000000).
2003
2260
  # @param validate_only [::Boolean]
2004
- # Optional. If set, performs request validation (e.g. permission checks and
2005
- # any other type of validation), but do not actually execute the failover.
2261
+ # Optional. If set, performs request validation, for example, permission
2262
+ # checks and any other type of validation, but does not actually execute the
2263
+ # create request.
2006
2264
  #
2007
2265
  # @yield [response, operation] Access the result along with the RPC operation
2008
2266
  # @yieldparam response [::Gapic::Operation]
@@ -2071,7 +2329,7 @@ module Google
2071
2329
  @alloy_db_admin_stub.call_rpc :failover_instance, request, options: options do |response, operation|
2072
2330
  response = ::Gapic::Operation.new response, @operations_client, options: options
2073
2331
  yield response, operation if block_given?
2074
- return response
2332
+ throw :response, response
2075
2333
  end
2076
2334
  rescue ::GRPC::BadStatus => e
2077
2335
  raise ::Google::Cloud::Error.from_error(e)
@@ -2103,22 +2361,22 @@ module Google
2103
2361
  # comment on the Instance.name field.
2104
2362
  # @param request_id [::String]
2105
2363
  # Optional. An optional request ID to identify requests. Specify a unique
2106
- # request ID so that if you must retry your request, the server will know to
2107
- # ignore the request if it has already been completed. The server will
2108
- # guarantee that for at least 60 minutes after the first request.
2364
+ # request ID so that if you must retry your request, the server ignores the
2365
+ # request if it has already been completed. The server guarantees that for at
2366
+ # least 60 minutes since the first request.
2109
2367
  #
2110
2368
  # For example, consider a situation where you make an initial request and
2111
2369
  # the request times out. If you make the request again with the same request
2112
- # ID, the server can check if original operation with the same request ID
2113
- # was received, and if so, will ignore the second request. This prevents
2370
+ # ID, the server can check if the original operation with the same request ID
2371
+ # was received, and if so, ignores the second request. This prevents
2114
2372
  # clients from accidentally creating duplicate commitments.
2115
2373
  #
2116
2374
  # The request ID must be a valid UUID with the exception that zero UUID is
2117
2375
  # not supported (00000000-0000-0000-0000-000000000000).
2118
2376
  # @param validate_only [::Boolean]
2119
- # Optional. If set, performs request validation (e.g. permission checks and
2120
- # any other type of validation), but do not actually execute the fault
2121
- # injection.
2377
+ # Optional. If set, performs request validation, for example, permission
2378
+ # checks and any other type of validation, but does not actually execute the
2379
+ # create request.
2122
2380
  #
2123
2381
  # @yield [response, operation] Access the result along with the RPC operation
2124
2382
  # @yieldparam response [::Gapic::Operation]
@@ -2187,7 +2445,7 @@ module Google
2187
2445
  @alloy_db_admin_stub.call_rpc :inject_fault, request, options: options do |response, operation|
2188
2446
  response = ::Gapic::Operation.new response, @operations_client, options: options
2189
2447
  yield response, operation if block_given?
2190
- return response
2448
+ throw :response, response
2191
2449
  end
2192
2450
  rescue ::GRPC::BadStatus => e
2193
2451
  raise ::Google::Cloud::Error.from_error(e)
@@ -2207,7 +2465,7 @@ module Google
2207
2465
  # @param options [::Gapic::CallOptions, ::Hash]
2208
2466
  # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
2209
2467
  #
2210
- # @overload restart_instance(name: nil, request_id: nil, validate_only: nil)
2468
+ # @overload restart_instance(name: nil, request_id: nil, validate_only: nil, node_ids: nil)
2211
2469
  # Pass arguments to `restart_instance` via keyword arguments. Note that at
2212
2470
  # least one keyword argument is required. To specify no parameters, or to keep all
2213
2471
  # the default parameter values, pass an empty Hash as a request object (see above).
@@ -2217,21 +2475,25 @@ module Google
2217
2475
  # comment on the Instance.name field.
2218
2476
  # @param request_id [::String]
2219
2477
  # Optional. An optional request ID to identify requests. Specify a unique
2220
- # request ID so that if you must retry your request, the server will know to
2221
- # ignore the request if it has already been completed. The server will
2222
- # guarantee that for at least 60 minutes after the first request.
2478
+ # request ID so that if you must retry your request, the server ignores the
2479
+ # request if it has already been completed. The server guarantees that for at
2480
+ # least 60 minutes since the first request.
2223
2481
  #
2224
2482
  # For example, consider a situation where you make an initial request and
2225
2483
  # the request times out. If you make the request again with the same request
2226
- # ID, the server can check if original operation with the same request ID
2227
- # was received, and if so, will ignore the second request. This prevents
2484
+ # ID, the server can check if the original operation with the same request ID
2485
+ # was received, and if so, ignores the second request. This prevents
2228
2486
  # clients from accidentally creating duplicate commitments.
2229
2487
  #
2230
2488
  # The request ID must be a valid UUID with the exception that zero UUID is
2231
2489
  # not supported (00000000-0000-0000-0000-000000000000).
2232
2490
  # @param validate_only [::Boolean]
2233
- # Optional. If set, performs request validation (e.g. permission checks and
2234
- # any other type of validation), but do not actually execute the restart.
2491
+ # Optional. If set, performs request validation, for example, permission
2492
+ # checks and any other type of validation, but does not actually execute the
2493
+ # create request.
2494
+ # @param node_ids [::Array<::String>]
2495
+ # Optional. Full name of the nodes as obtained from INSTANCE_VIEW_FULL to
2496
+ # restart upon. Applicable only to read instances.
2235
2497
  #
2236
2498
  # @yield [response, operation] Access the result along with the RPC operation
2237
2499
  # @yieldparam response [::Gapic::Operation]
@@ -2300,7 +2562,106 @@ module Google
2300
2562
  @alloy_db_admin_stub.call_rpc :restart_instance, request, options: options do |response, operation|
2301
2563
  response = ::Gapic::Operation.new response, @operations_client, options: options
2302
2564
  yield response, operation if block_given?
2303
- return response
2565
+ throw :response, response
2566
+ end
2567
+ rescue ::GRPC::BadStatus => e
2568
+ raise ::Google::Cloud::Error.from_error(e)
2569
+ end
2570
+
2571
+ ##
2572
+ # Executes a SQL statement in a database inside an AlloyDB instance.
2573
+ #
2574
+ # @overload execute_sql(request, options = nil)
2575
+ # Pass arguments to `execute_sql` via a request object, either of type
2576
+ # {::Google::Cloud::AlloyDB::V1beta::ExecuteSqlRequest} or an equivalent Hash.
2577
+ #
2578
+ # @param request [::Google::Cloud::AlloyDB::V1beta::ExecuteSqlRequest, ::Hash]
2579
+ # A request object representing the call parameters. Required. To specify no
2580
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
2581
+ # @param options [::Gapic::CallOptions, ::Hash]
2582
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
2583
+ #
2584
+ # @overload execute_sql(password: nil, instance: nil, database: nil, user: nil, sql_statement: nil)
2585
+ # Pass arguments to `execute_sql` via keyword arguments. Note that at
2586
+ # least one keyword argument is required. To specify no parameters, or to keep all
2587
+ # the default parameter values, pass an empty Hash as a request object (see above).
2588
+ #
2589
+ # @param password [::String]
2590
+ # Optional. The database native user’s password.
2591
+ # @param instance [::String]
2592
+ # Required. The instance where the SQL will be executed. For the required
2593
+ # format, see the comment on the Instance.name field.
2594
+ # @param database [::String]
2595
+ # Required. Name of the database where the query will be executed.
2596
+ # Note - Value provided should be the same as expected from `SELECT
2597
+ # current_database();` and NOT as a resource reference.
2598
+ # @param user [::String]
2599
+ # Required. Database user to be used for executing the SQL.
2600
+ # Note - Value provided should be the same as expected from
2601
+ # `SELECT current_user;` and NOT as a resource reference.
2602
+ # @param sql_statement [::String]
2603
+ # Required. SQL statement to execute on database. Any valid statement is
2604
+ # permitted, including DDL, DML, DQL statements.
2605
+ #
2606
+ # @yield [response, operation] Access the result along with the RPC operation
2607
+ # @yieldparam response [::Google::Cloud::AlloyDB::V1beta::ExecuteSqlResponse]
2608
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
2609
+ #
2610
+ # @return [::Google::Cloud::AlloyDB::V1beta::ExecuteSqlResponse]
2611
+ #
2612
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
2613
+ #
2614
+ # @example Basic example
2615
+ # require "google/cloud/alloy_db/v1beta"
2616
+ #
2617
+ # # Create a client object. The client can be reused for multiple calls.
2618
+ # client = Google::Cloud::AlloyDB::V1beta::AlloyDBAdmin::Client.new
2619
+ #
2620
+ # # Create a request. To set request fields, pass in keyword arguments.
2621
+ # request = Google::Cloud::AlloyDB::V1beta::ExecuteSqlRequest.new
2622
+ #
2623
+ # # Call the execute_sql method.
2624
+ # result = client.execute_sql request
2625
+ #
2626
+ # # The returned object is of type Google::Cloud::AlloyDB::V1beta::ExecuteSqlResponse.
2627
+ # p result
2628
+ #
2629
+ def execute_sql request, options = nil
2630
+ raise ::ArgumentError, "request must be provided" if request.nil?
2631
+
2632
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::AlloyDB::V1beta::ExecuteSqlRequest
2633
+
2634
+ # Converts hash and nil to an options object
2635
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
2636
+
2637
+ # Customize the options with defaults
2638
+ metadata = @config.rpcs.execute_sql.metadata.to_h
2639
+
2640
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
2641
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
2642
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
2643
+ gapic_version: ::Google::Cloud::AlloyDB::V1beta::VERSION
2644
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
2645
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
2646
+
2647
+ header_params = {}
2648
+ if request.instance
2649
+ header_params["instance"] = request.instance
2650
+ end
2651
+
2652
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
2653
+ metadata[:"x-goog-request-params"] ||= request_params_header
2654
+
2655
+ options.apply_defaults timeout: @config.rpcs.execute_sql.timeout,
2656
+ metadata: metadata,
2657
+ retry_policy: @config.rpcs.execute_sql.retry_policy
2658
+
2659
+ options.apply_defaults timeout: @config.timeout,
2660
+ metadata: @config.metadata,
2661
+ retry_policy: @config.retry_policy
2662
+
2663
+ @alloy_db_admin_stub.call_rpc :execute_sql, request, options: options do |response, operation|
2664
+ yield response, operation if block_given?
2304
2665
  end
2305
2666
  rescue ::GRPC::BadStatus => e
2306
2667
  raise ::Google::Cloud::Error.from_error(e)
@@ -2400,7 +2761,7 @@ module Google
2400
2761
  @alloy_db_admin_stub.call_rpc :list_backups, request, options: options do |response, operation|
2401
2762
  response = ::Gapic::PagedEnumerable.new @alloy_db_admin_stub, :list_backups, request, response, operation, options
2402
2763
  yield response, operation if block_given?
2403
- return response
2764
+ throw :response, response
2404
2765
  end
2405
2766
  rescue ::GRPC::BadStatus => e
2406
2767
  raise ::Google::Cloud::Error.from_error(e)
@@ -2486,7 +2847,6 @@ module Google
2486
2847
 
2487
2848
  @alloy_db_admin_stub.call_rpc :get_backup, request, options: options do |response, operation|
2488
2849
  yield response, operation if block_given?
2489
- return response
2490
2850
  end
2491
2851
  rescue ::GRPC::BadStatus => e
2492
2852
  raise ::Google::Cloud::Error.from_error(e)
@@ -2518,14 +2878,14 @@ module Google
2518
2878
  # Required. The resource being created
2519
2879
  # @param request_id [::String]
2520
2880
  # Optional. An optional request ID to identify requests. Specify a unique
2521
- # request ID so that if you must retry your request, the server will know to
2522
- # ignore the request if it has already been completed. The server will
2523
- # guarantee that for at least 60 minutes since the first request.
2881
+ # request ID so that if you must retry your request, the server ignores the
2882
+ # request if it has already been completed. The server guarantees that for at
2883
+ # least 60 minutes since the first request.
2524
2884
  #
2525
2885
  # For example, consider a situation where you make an initial request and
2526
2886
  # the request times out. If you make the request again with the same request
2527
- # ID, the server can check if original operation with the same request ID
2528
- # was received, and if so, will ignore the second request. This prevents
2887
+ # ID, the server can check if the original operation with the same request ID
2888
+ # was received, and if so, ignores the second request. This prevents
2529
2889
  # clients from accidentally creating duplicate commitments.
2530
2890
  #
2531
2891
  # The request ID must be a valid UUID with the exception that zero UUID is
@@ -2601,7 +2961,7 @@ module Google
2601
2961
  @alloy_db_admin_stub.call_rpc :create_backup, request, options: options do |response, operation|
2602
2962
  response = ::Gapic::Operation.new response, @operations_client, options: options
2603
2963
  yield response, operation if block_given?
2604
- return response
2964
+ throw :response, response
2605
2965
  end
2606
2966
  rescue ::GRPC::BadStatus => e
2607
2967
  raise ::Google::Cloud::Error.from_error(e)
@@ -2635,14 +2995,14 @@ module Google
2635
2995
  # Required. The resource being updated
2636
2996
  # @param request_id [::String]
2637
2997
  # Optional. An optional request ID to identify requests. Specify a unique
2638
- # request ID so that if you must retry your request, the server will know to
2639
- # ignore the request if it has already been completed. The server will
2640
- # guarantee that for at least 60 minutes since the first request.
2998
+ # request ID so that if you must retry your request, the server ignores the
2999
+ # request if it has already been completed. The server guarantees that for at
3000
+ # least 60 minutes since the first request.
2641
3001
  #
2642
3002
  # For example, consider a situation where you make an initial request and
2643
3003
  # the request times out. If you make the request again with the same request
2644
- # ID, the server can check if original operation with the same request ID
2645
- # was received, and if so, will ignore the second request. This prevents
3004
+ # ID, the server can check if the original operation with the same request ID
3005
+ # was received, and if so, ignores the second request. This prevents
2646
3006
  # clients from accidentally creating duplicate commitments.
2647
3007
  #
2648
3008
  # The request ID must be a valid UUID with the exception that zero UUID is
@@ -2721,7 +3081,7 @@ module Google
2721
3081
  @alloy_db_admin_stub.call_rpc :update_backup, request, options: options do |response, operation|
2722
3082
  response = ::Gapic::Operation.new response, @operations_client, options: options
2723
3083
  yield response, operation if block_given?
2724
- return response
3084
+ throw :response, response
2725
3085
  end
2726
3086
  rescue ::GRPC::BadStatus => e
2727
3087
  raise ::Google::Cloud::Error.from_error(e)
@@ -2750,14 +3110,14 @@ module Google
2750
3110
  # the Backup.name field.
2751
3111
  # @param request_id [::String]
2752
3112
  # Optional. An optional request ID to identify requests. Specify a unique
2753
- # request ID so that if you must retry your request, the server will know to
2754
- # ignore the request if it has already been completed. The server will
2755
- # guarantee that for at least 60 minutes after the first request.
3113
+ # request ID so that if you must retry your request, the server ignores the
3114
+ # request if it has already been completed. The server guarantees that for at
3115
+ # least 60 minutes since the first request.
2756
3116
  #
2757
3117
  # For example, consider a situation where you make an initial request and
2758
3118
  # the request times out. If you make the request again with the same request
2759
- # ID, the server can check if original operation with the same request ID
2760
- # was received, and if so, will ignore the second request. This prevents
3119
+ # ID, the server can check if the original operation with the same request ID
3120
+ # was received, and if so, ignores the second request. This prevents
2761
3121
  # clients from accidentally creating duplicate commitments.
2762
3122
  #
2763
3123
  # The request ID must be a valid UUID with the exception that zero UUID is
@@ -2837,7 +3197,7 @@ module Google
2837
3197
  @alloy_db_admin_stub.call_rpc :delete_backup, request, options: options do |response, operation|
2838
3198
  response = ::Gapic::Operation.new response, @operations_client, options: options
2839
3199
  yield response, operation if block_given?
2840
- return response
3200
+ throw :response, response
2841
3201
  end
2842
3202
  rescue ::GRPC::BadStatus => e
2843
3203
  raise ::Google::Cloud::Error.from_error(e)
@@ -2939,7 +3299,7 @@ module Google
2939
3299
  @alloy_db_admin_stub.call_rpc :list_supported_database_flags, request, options: options do |response, operation|
2940
3300
  response = ::Gapic::PagedEnumerable.new @alloy_db_admin_stub, :list_supported_database_flags, request, response, operation, options
2941
3301
  yield response, operation if block_given?
2942
- return response
3302
+ throw :response, response
2943
3303
  end
2944
3304
  rescue ::GRPC::BadStatus => e
2945
3305
  raise ::Google::Cloud::Error.from_error(e)
@@ -2972,14 +3332,14 @@ module Google
2972
3332
  # * projects/\\{project}/locations/\\{location}/clusters/\\{cluster}
2973
3333
  # @param request_id [::String]
2974
3334
  # Optional. An optional request ID to identify requests. Specify a unique
2975
- # request ID so that if you must retry your request, the server will know to
2976
- # ignore the request if it has already been completed. The server will
2977
- # guarantee that for at least 60 minutes after the first request.
3335
+ # request ID so that if you must retry your request, the server ignores the
3336
+ # request if it has already been completed. The server guarantees that for at
3337
+ # least 60 minutes since the first request.
2978
3338
  #
2979
3339
  # For example, consider a situation where you make an initial request and
2980
3340
  # the request times out. If you make the request again with the same request
2981
- # ID, the server can check if original operation with the same request ID
2982
- # was received, and if so, will ignore the second request. This prevents
3341
+ # ID, the server can check if the original operation with the same request ID
3342
+ # was received, and if so, ignores the second request. This prevents
2983
3343
  # clients from accidentally creating duplicate commitments.
2984
3344
  #
2985
3345
  # The request ID must be a valid UUID with the exception that zero UUID is
@@ -3059,7 +3419,6 @@ module Google
3059
3419
 
3060
3420
  @alloy_db_admin_stub.call_rpc :generate_client_certificate, request, options: options do |response, operation|
3061
3421
  yield response, operation if block_given?
3062
- return response
3063
3422
  end
3064
3423
  rescue ::GRPC::BadStatus => e
3065
3424
  raise ::Google::Cloud::Error.from_error(e)
@@ -3088,14 +3447,14 @@ module Google
3088
3447
  # projects/\\{project}/locations/\\{location}/clusters/\\{cluster}/instances/\\{instance}
3089
3448
  # @param request_id [::String]
3090
3449
  # Optional. An optional request ID to identify requests. Specify a unique
3091
- # request ID so that if you must retry your request, the server will know to
3092
- # ignore the request if it has already been completed. The server will
3093
- # guarantee that for at least 60 minutes after the first request.
3450
+ # request ID so that if you must retry your request, the server ignores the
3451
+ # request if it has already been completed. The server guarantees that for at
3452
+ # least 60 minutes since the first request.
3094
3453
  #
3095
3454
  # For example, consider a situation where you make an initial request and
3096
3455
  # the request times out. If you make the request again with the same request
3097
- # ID, the server can check if original operation with the same request ID
3098
- # was received, and if so, will ignore the second request. This prevents
3456
+ # ID, the server can check if the original operation with the same request ID
3457
+ # was received, and if so, ignores the second request. This prevents
3099
3458
  # clients from accidentally creating duplicate commitments.
3100
3459
  #
3101
3460
  # The request ID must be a valid UUID with the exception that zero UUID is
@@ -3160,7 +3519,6 @@ module Google
3160
3519
 
3161
3520
  @alloy_db_admin_stub.call_rpc :get_connection_info, request, options: options do |response, operation|
3162
3521
  yield response, operation if block_given?
3163
- return response
3164
3522
  end
3165
3523
  rescue ::GRPC::BadStatus => e
3166
3524
  raise ::Google::Cloud::Error.from_error(e)
@@ -3260,7 +3618,7 @@ module Google
3260
3618
  @alloy_db_admin_stub.call_rpc :list_users, request, options: options do |response, operation|
3261
3619
  response = ::Gapic::PagedEnumerable.new @alloy_db_admin_stub, :list_users, request, response, operation, options
3262
3620
  yield response, operation if block_given?
3263
- return response
3621
+ throw :response, response
3264
3622
  end
3265
3623
  rescue ::GRPC::BadStatus => e
3266
3624
  raise ::Google::Cloud::Error.from_error(e)
@@ -3347,7 +3705,6 @@ module Google
3347
3705
 
3348
3706
  @alloy_db_admin_stub.call_rpc :get_user, request, options: options do |response, operation|
3349
3707
  yield response, operation if block_given?
3350
- return response
3351
3708
  end
3352
3709
  rescue ::GRPC::BadStatus => e
3353
3710
  raise ::Google::Cloud::Error.from_error(e)
@@ -3379,14 +3736,14 @@ module Google
3379
3736
  # Required. The resource being created
3380
3737
  # @param request_id [::String]
3381
3738
  # Optional. An optional request ID to identify requests. Specify a unique
3382
- # request ID so that if you must retry your request, the server will know to
3383
- # ignore the request if it has already been completed. The server will
3384
- # guarantee that for at least 60 minutes since the first request.
3739
+ # request ID so that if you must retry your request, the server ignores the
3740
+ # request if it has already been completed. The server guarantees that for at
3741
+ # least 60 minutes since the first request.
3385
3742
  #
3386
3743
  # For example, consider a situation where you make an initial request and
3387
3744
  # the request times out. If you make the request again with the same request
3388
- # ID, the server can check if original operation with the same request ID
3389
- # was received, and if so, will ignore the second request. This prevents
3745
+ # ID, the server can check if the original operation with the same request ID
3746
+ # was received, and if so, ignores the second request. This prevents
3390
3747
  # clients from accidentally creating duplicate commitments.
3391
3748
  #
3392
3749
  # The request ID must be a valid UUID with the exception that zero UUID is
@@ -3454,7 +3811,6 @@ module Google
3454
3811
 
3455
3812
  @alloy_db_admin_stub.call_rpc :create_user, request, options: options do |response, operation|
3456
3813
  yield response, operation if block_given?
3457
- return response
3458
3814
  end
3459
3815
  rescue ::GRPC::BadStatus => e
3460
3816
  raise ::Google::Cloud::Error.from_error(e)
@@ -3488,14 +3844,14 @@ module Google
3488
3844
  # Required. The resource being updated
3489
3845
  # @param request_id [::String]
3490
3846
  # Optional. An optional request ID to identify requests. Specify a unique
3491
- # request ID so that if you must retry your request, the server will know to
3492
- # ignore the request if it has already been completed. The server will
3493
- # guarantee that for at least 60 minutes since the first request.
3847
+ # request ID so that if you must retry your request, the server ignores the
3848
+ # request if it has already been completed. The server guarantees that for at
3849
+ # least 60 minutes since the first request.
3494
3850
  #
3495
3851
  # For example, consider a situation where you make an initial request and
3496
3852
  # the request times out. If you make the request again with the same request
3497
- # ID, the server can check if original operation with the same request ID
3498
- # was received, and if so, will ignore the second request. This prevents
3853
+ # ID, the server can check if the original operation with the same request ID
3854
+ # was received, and if so, ignores the second request. This prevents
3499
3855
  # clients from accidentally creating duplicate commitments.
3500
3856
  #
3501
3857
  # The request ID must be a valid UUID with the exception that zero UUID is
@@ -3565,7 +3921,6 @@ module Google
3565
3921
 
3566
3922
  @alloy_db_admin_stub.call_rpc :update_user, request, options: options do |response, operation|
3567
3923
  yield response, operation if block_given?
3568
- return response
3569
3924
  end
3570
3925
  rescue ::GRPC::BadStatus => e
3571
3926
  raise ::Google::Cloud::Error.from_error(e)
@@ -3594,14 +3949,14 @@ module Google
3594
3949
  # comment on the User.name field.
3595
3950
  # @param request_id [::String]
3596
3951
  # Optional. An optional request ID to identify requests. Specify a unique
3597
- # request ID so that if you must retry your request, the server will know to
3598
- # ignore the request if it has already been completed. The server will
3599
- # guarantee that for at least 60 minutes after the first request.
3952
+ # request ID so that if you must retry your request, the server ignores the
3953
+ # request if it has already been completed. The server guarantees that for at
3954
+ # least 60 minutes since the first request.
3600
3955
  #
3601
3956
  # For example, consider a situation where you make an initial request and
3602
3957
  # the request times out. If you make the request again with the same request
3603
- # ID, the server can check if original operation with the same request ID
3604
- # was received, and if so, will ignore the second request. This prevents
3958
+ # ID, the server can check if the original operation with the same request ID
3959
+ # was received, and if so, ignores the second request. This prevents
3605
3960
  # clients from accidentally creating duplicate commitments.
3606
3961
  #
3607
3962
  # The request ID must be a valid UUID with the exception that zero UUID is
@@ -3669,7 +4024,6 @@ module Google
3669
4024
 
3670
4025
  @alloy_db_admin_stub.call_rpc :delete_user, request, options: options do |response, operation|
3671
4026
  yield response, operation if block_given?
3672
- return response
3673
4027
  end
3674
4028
  rescue ::GRPC::BadStatus => e
3675
4029
  raise ::Google::Cloud::Error.from_error(e)
@@ -3697,9 +4051,9 @@ module Google
3697
4051
  # Required. Parent value for ListDatabasesRequest.
3698
4052
  # @param page_size [::Integer]
3699
4053
  # Optional. The maximum number of databases to return. The service may return
3700
- # fewer than this value. If unspecified, an appropriate number of databases
3701
- # will be returned. The max value will be 2000, values above max will be
3702
- # coerced to max.
4054
+ # fewer than this value. If unspecified, 2000 is the default page_size. The
4055
+ # max value of page_size will be 4000, values above max will be coerced to
4056
+ # max.
3703
4057
  # @param page_token [::String]
3704
4058
  # Optional. A page token, received from a previous `ListDatabases` call.
3705
4059
  # This should be provided to retrieve the subsequent page.
@@ -3772,7 +4126,7 @@ module Google
3772
4126
  @alloy_db_admin_stub.call_rpc :list_databases, request, options: options do |response, operation|
3773
4127
  response = ::Gapic::PagedEnumerable.new @alloy_db_admin_stub, :list_databases, request, response, operation, options
3774
4128
  yield response, operation if block_given?
3775
- return response
4129
+ throw :response, response
3776
4130
  end
3777
4131
  rescue ::GRPC::BadStatus => e
3778
4132
  raise ::Google::Cloud::Error.from_error(e)
@@ -3861,6 +4215,11 @@ module Google
3861
4215
  # default endpoint URL. The default value of nil uses the environment
3862
4216
  # universe (usually the default "googleapis.com" universe).
3863
4217
  # @return [::String,nil]
4218
+ # @!attribute [rw] logger
4219
+ # A custom logger to use for request/response debug logging, or the value
4220
+ # `:default` (the default) to construct a default logger, or `nil` to
4221
+ # explicitly disable logging.
4222
+ # @return [::Logger,:default,nil]
3864
4223
  #
3865
4224
  class Configuration
3866
4225
  extend ::Gapic::Config
@@ -3885,6 +4244,7 @@ module Google
3885
4244
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
3886
4245
  config_attr :quota_project, nil, ::String, nil
3887
4246
  config_attr :universe_domain, nil, ::String, nil
4247
+ config_attr :logger, :default, ::Logger, nil, :default
3888
4248
 
3889
4249
  # @private
3890
4250
  def initialize parent_config = nil
@@ -3952,6 +4312,11 @@ module Google
3952
4312
  #
3953
4313
  attr_reader :update_cluster
3954
4314
  ##
4315
+ # RPC-specific configuration for `upgrade_cluster`
4316
+ # @return [::Gapic::Config::Method]
4317
+ #
4318
+ attr_reader :upgrade_cluster
4319
+ ##
3955
4320
  # RPC-specific configuration for `delete_cluster`
3956
4321
  # @return [::Gapic::Config::Method]
3957
4322
  #
@@ -3962,6 +4327,11 @@ module Google
3962
4327
  #
3963
4328
  attr_reader :promote_cluster
3964
4329
  ##
4330
+ # RPC-specific configuration for `switchover_cluster`
4331
+ # @return [::Gapic::Config::Method]
4332
+ #
4333
+ attr_reader :switchover_cluster
4334
+ ##
3965
4335
  # RPC-specific configuration for `restore_cluster`
3966
4336
  # @return [::Gapic::Config::Method]
3967
4337
  #
@@ -4022,6 +4392,11 @@ module Google
4022
4392
  #
4023
4393
  attr_reader :restart_instance
4024
4394
  ##
4395
+ # RPC-specific configuration for `execute_sql`
4396
+ # @return [::Gapic::Config::Method]
4397
+ #
4398
+ attr_reader :execute_sql
4399
+ ##
4025
4400
  # RPC-specific configuration for `list_backups`
4026
4401
  # @return [::Gapic::Config::Method]
4027
4402
  #
@@ -4102,10 +4477,14 @@ module Google
4102
4477
  @create_cluster = ::Gapic::Config::Method.new create_cluster_config
4103
4478
  update_cluster_config = parent_rpcs.update_cluster if parent_rpcs.respond_to? :update_cluster
4104
4479
  @update_cluster = ::Gapic::Config::Method.new update_cluster_config
4480
+ upgrade_cluster_config = parent_rpcs.upgrade_cluster if parent_rpcs.respond_to? :upgrade_cluster
4481
+ @upgrade_cluster = ::Gapic::Config::Method.new upgrade_cluster_config
4105
4482
  delete_cluster_config = parent_rpcs.delete_cluster if parent_rpcs.respond_to? :delete_cluster
4106
4483
  @delete_cluster = ::Gapic::Config::Method.new delete_cluster_config
4107
4484
  promote_cluster_config = parent_rpcs.promote_cluster if parent_rpcs.respond_to? :promote_cluster
4108
4485
  @promote_cluster = ::Gapic::Config::Method.new promote_cluster_config
4486
+ switchover_cluster_config = parent_rpcs.switchover_cluster if parent_rpcs.respond_to? :switchover_cluster
4487
+ @switchover_cluster = ::Gapic::Config::Method.new switchover_cluster_config
4109
4488
  restore_cluster_config = parent_rpcs.restore_cluster if parent_rpcs.respond_to? :restore_cluster
4110
4489
  @restore_cluster = ::Gapic::Config::Method.new restore_cluster_config
4111
4490
  create_secondary_cluster_config = parent_rpcs.create_secondary_cluster if parent_rpcs.respond_to? :create_secondary_cluster
@@ -4130,6 +4509,8 @@ module Google
4130
4509
  @inject_fault = ::Gapic::Config::Method.new inject_fault_config
4131
4510
  restart_instance_config = parent_rpcs.restart_instance if parent_rpcs.respond_to? :restart_instance
4132
4511
  @restart_instance = ::Gapic::Config::Method.new restart_instance_config
4512
+ execute_sql_config = parent_rpcs.execute_sql if parent_rpcs.respond_to? :execute_sql
4513
+ @execute_sql = ::Gapic::Config::Method.new execute_sql_config
4133
4514
  list_backups_config = parent_rpcs.list_backups if parent_rpcs.respond_to? :list_backups
4134
4515
  @list_backups = ::Gapic::Config::Method.new list_backups_config
4135
4516
  get_backup_config = parent_rpcs.get_backup if parent_rpcs.respond_to? :get_backup