# frozen_string_literal: true # Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # Auto-generated by gapic-generator-ruby. DO NOT EDIT! require "google/cloud/errors" require "google/cloud/alloydb/v1/service_pb" require "google/cloud/alloy_db/v1/alloy_db_admin/rest/service_stub" require "google/cloud/location/rest" require "google/iam/v1/rest" module Google module Cloud module AlloyDB module V1 module AlloyDBAdmin module Rest ## # REST client for the AlloyDBAdmin service. # # Service describing handlers for resources # class Client include Paths # @private attr_reader :alloy_db_admin_stub ## # Configure the AlloyDBAdmin Client class. # # See {::Google::Cloud::AlloyDB::V1::AlloyDBAdmin::Rest::Client::Configuration} # for a description of the configuration fields. # # @example # # # Modify the configuration for all AlloyDBAdmin clients # ::Google::Cloud::AlloyDB::V1::AlloyDBAdmin::Rest::Client.configure do |config| # config.timeout = 10.0 # end # # @yield [config] Configure the Client client. # @yieldparam config [Client::Configuration] # # @return [Client::Configuration] # def self.configure @configure ||= begin namespace = ["Google", "Cloud", "AlloyDB", "V1"] parent_config = while namespace.any? parent_name = namespace.join "::" parent_const = const_get parent_name break parent_const.configure if parent_const.respond_to? :configure namespace.pop end default_config = Client::Configuration.new parent_config default_config.timeout = 60.0 default_config.rpcs.list_clusters.timeout = 60.0 default_config.rpcs.list_clusters.retry_policy = { initial_delay: 1.0, max_delay: 60.0, multiplier: 1.3, retry_codes: [14] } default_config.rpcs.get_cluster.timeout = 60.0 default_config.rpcs.get_cluster.retry_policy = { initial_delay: 1.0, max_delay: 60.0, multiplier: 1.3, retry_codes: [14] } default_config.rpcs.list_instances.timeout = 60.0 default_config.rpcs.list_instances.retry_policy = { initial_delay: 1.0, max_delay: 60.0, multiplier: 1.3, retry_codes: [14] } default_config.rpcs.get_instance.timeout = 60.0 default_config.rpcs.get_instance.retry_policy = { initial_delay: 1.0, max_delay: 60.0, multiplier: 1.3, retry_codes: [14] } default_config.rpcs.list_backups.timeout = 60.0 default_config.rpcs.list_backups.retry_policy = { initial_delay: 1.0, max_delay: 60.0, multiplier: 1.3, retry_codes: [14] } default_config.rpcs.get_backup.timeout = 60.0 default_config.rpcs.get_backup.retry_policy = { initial_delay: 1.0, max_delay: 60.0, multiplier: 1.3, retry_codes: [14] } default_config.rpcs.list_supported_database_flags.timeout = 60.0 default_config.rpcs.list_supported_database_flags.retry_policy = { initial_delay: 1.0, max_delay: 60.0, multiplier: 1.3, retry_codes: [14] } default_config.rpcs.generate_client_certificate.timeout = 60.0 default_config.rpcs.generate_client_certificate.retry_policy = { initial_delay: 1.0, max_delay: 60.0, multiplier: 1.3, retry_codes: [14] } default_config.rpcs.get_connection_info.timeout = 60.0 default_config.rpcs.get_connection_info.retry_policy = { initial_delay: 1.0, max_delay: 60.0, multiplier: 1.3, retry_codes: [14] } default_config end yield @configure if block_given? @configure end ## # Configure the AlloyDBAdmin Client instance. # # The configuration is set to the derived mode, meaning that values can be changed, # but structural changes (adding new fields, etc.) are not allowed. Structural changes # should be made on {Client.configure}. # # See {::Google::Cloud::AlloyDB::V1::AlloyDBAdmin::Rest::Client::Configuration} # for a description of the configuration fields. # # @yield [config] Configure the Client client. # @yieldparam config [Client::Configuration] # # @return [Client::Configuration] # def configure yield @config if block_given? @config end ## # Create a new AlloyDBAdmin REST client object. # # @example # # # Create a client using the default configuration # client = ::Google::Cloud::AlloyDB::V1::AlloyDBAdmin::Rest::Client.new # # # Create a client using a custom configuration # client = ::Google::Cloud::AlloyDB::V1::AlloyDBAdmin::Rest::Client.new do |config| # config.timeout = 10.0 # end # # @yield [config] Configure the AlloyDBAdmin client. # @yieldparam config [Client::Configuration] # def initialize # Create the configuration object @config = Configuration.new Client.configure # Yield the configuration if needed yield @config if block_given? # Create credentials credentials = @config.credentials # Use self-signed JWT if the endpoint is unchanged from default, # but only if the default endpoint does not have a region prefix. enable_self_signed_jwt = @config.endpoint == Configuration::DEFAULT_ENDPOINT && !@config.endpoint.split(".").first.include?("-") credentials ||= Credentials.default scope: @config.scope, enable_self_signed_jwt: enable_self_signed_jwt if credentials.is_a?(::String) || credentials.is_a?(::Hash) credentials = Credentials.new credentials, scope: @config.scope end @quota_project_id = @config.quota_project @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id @operations_client = ::Google::Cloud::AlloyDB::V1::AlloyDBAdmin::Rest::Operations.new do |config| config.credentials = credentials config.quota_project = @quota_project_id config.endpoint = @config.endpoint end @location_client = Google::Cloud::Location::Locations::Rest::Client.new do |config| config.credentials = credentials config.quota_project = @quota_project_id config.endpoint = @config.endpoint config.bindings_override = @config.bindings_override end @iam_policy_client = Google::Iam::V1::IAMPolicy::Rest::Client.new do |config| config.credentials = credentials config.quota_project = @quota_project_id config.endpoint = @config.endpoint end @alloy_db_admin_stub = ::Google::Cloud::AlloyDB::V1::AlloyDBAdmin::Rest::ServiceStub.new endpoint: @config.endpoint, credentials: credentials end ## # Get the associated client for long-running operations. # # @return [::Google::Cloud::AlloyDB::V1::AlloyDBAdmin::Rest::Operations] # attr_reader :operations_client ## # Get the associated client for mix-in of the Locations. # # @return [Google::Cloud::Location::Locations::Rest::Client] # attr_reader :location_client ## # Get the associated client for mix-in of the IAMPolicy. # # @return [Google::Iam::V1::IAMPolicy::Rest::Client] # attr_reader :iam_policy_client # Service calls ## # Lists Clusters in a given project and location. # # @overload list_clusters(request, options = nil) # Pass arguments to `list_clusters` via a request object, either of type # {::Google::Cloud::AlloyDB::V1::ListClustersRequest} or an equivalent Hash. # # @param request [::Google::Cloud::AlloyDB::V1::ListClustersRequest, ::Hash] # A request object representing the call parameters. Required. To specify no # parameters, or to keep all the default parameter values, pass an empty Hash. # @param options [::Gapic::CallOptions, ::Hash] # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. # # @overload list_clusters(parent: nil, page_size: nil, page_token: nil, filter: nil, order_by: nil) # Pass arguments to `list_clusters` via keyword arguments. Note that at # least one keyword argument is required. To specify no parameters, or to keep all # the default parameter values, pass an empty Hash as a request object (see above). # # @param parent [::String] # Required. The name of the parent resource. For the required format, see the # comment on the Cluster.name field. Additionally, you can perform an # aggregated list operation by specifying a value with the following format: # * projects/\\{project}/locations/- # @param page_size [::Integer] # Optional. Requested page size. Server may return fewer items than # requested. If unspecified, server will pick an appropriate default. # @param page_token [::String] # A token identifying a page of results the server should return. # @param filter [::String] # Optional. Filtering results # @param order_by [::String] # Optional. Hint for how to order the results # @yield [result, operation] Access the result along with the TransportOperation object # @yieldparam result [::Google::Cloud::AlloyDB::V1::ListClustersResponse] # @yieldparam operation [::Gapic::Rest::TransportOperation] # # @return [::Google::Cloud::AlloyDB::V1::ListClustersResponse] # # @raise [::Google::Cloud::Error] if the REST call is aborted. # # @example Basic example # require "google/cloud/alloy_db/v1" # # # Create a client object. The client can be reused for multiple calls. # client = Google::Cloud::AlloyDB::V1::AlloyDBAdmin::Rest::Client.new # # # Create a request. To set request fields, pass in keyword arguments. # request = Google::Cloud::AlloyDB::V1::ListClustersRequest.new # # # Call the list_clusters method. # result = client.list_clusters request # # # The returned object is of type Gapic::PagedEnumerable. You can iterate # # over elements, and API calls will be issued to fetch pages as needed. # result.each do |item| # # Each element is of type ::Google::Cloud::AlloyDB::V1::Cluster. # p item # end # def list_clusters request, options = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::AlloyDB::V1::ListClustersRequest # Converts hash and nil to an options object options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h # Customize the options with defaults call_metadata = @config.rpcs.list_clusters.metadata.to_h # Set x-goog-api-client and x-goog-user-project headers call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::AlloyDB::V1::VERSION, transports_version_send: [:rest] call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id options.apply_defaults timeout: @config.rpcs.list_clusters.timeout, metadata: call_metadata, retry_policy: @config.rpcs.list_clusters.retry_policy options.apply_defaults timeout: @config.timeout, metadata: @config.metadata, retry_policy: @config.retry_policy @alloy_db_admin_stub.list_clusters request, options do |result, operation| yield result, operation if block_given? return result end rescue ::Gapic::Rest::Error => e raise ::Google::Cloud::Error.from_error(e) end ## # Gets details of a single Cluster. # # @overload get_cluster(request, options = nil) # Pass arguments to `get_cluster` via a request object, either of type # {::Google::Cloud::AlloyDB::V1::GetClusterRequest} or an equivalent Hash. # # @param request [::Google::Cloud::AlloyDB::V1::GetClusterRequest, ::Hash] # A request object representing the call parameters. Required. To specify no # parameters, or to keep all the default parameter values, pass an empty Hash. # @param options [::Gapic::CallOptions, ::Hash] # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. # # @overload get_cluster(name: nil, view: nil) # Pass arguments to `get_cluster` via keyword arguments. Note that at # least one keyword argument is required. To specify no parameters, or to keep all # the default parameter values, pass an empty Hash as a request object (see above). # # @param name [::String] # Required. The name of the resource. For the required format, see the # comment on the Cluster.name field. # @param view [::Google::Cloud::AlloyDB::V1::ClusterView] # Optional. The view of the cluster to return. Returns all default fields if # not set. # @yield [result, operation] Access the result along with the TransportOperation object # @yieldparam result [::Google::Cloud::AlloyDB::V1::Cluster] # @yieldparam operation [::Gapic::Rest::TransportOperation] # # @return [::Google::Cloud::AlloyDB::V1::Cluster] # # @raise [::Google::Cloud::Error] if the REST call is aborted. # # @example Basic example # require "google/cloud/alloy_db/v1" # # # Create a client object. The client can be reused for multiple calls. # client = Google::Cloud::AlloyDB::V1::AlloyDBAdmin::Rest::Client.new # # # Create a request. To set request fields, pass in keyword arguments. # request = Google::Cloud::AlloyDB::V1::GetClusterRequest.new # # # Call the get_cluster method. # result = client.get_cluster request # # # The returned object is of type Google::Cloud::AlloyDB::V1::Cluster. # p result # def get_cluster request, options = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::AlloyDB::V1::GetClusterRequest # Converts hash and nil to an options object options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h # Customize the options with defaults call_metadata = @config.rpcs.get_cluster.metadata.to_h # Set x-goog-api-client and x-goog-user-project headers call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::AlloyDB::V1::VERSION, transports_version_send: [:rest] call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id options.apply_defaults timeout: @config.rpcs.get_cluster.timeout, metadata: call_metadata, retry_policy: @config.rpcs.get_cluster.retry_policy options.apply_defaults timeout: @config.timeout, metadata: @config.metadata, retry_policy: @config.retry_policy @alloy_db_admin_stub.get_cluster request, options do |result, operation| yield result, operation if block_given? return result end rescue ::Gapic::Rest::Error => e raise ::Google::Cloud::Error.from_error(e) end ## # Creates a new Cluster in a given project and location. # # @overload create_cluster(request, options = nil) # Pass arguments to `create_cluster` via a request object, either of type # {::Google::Cloud::AlloyDB::V1::CreateClusterRequest} or an equivalent Hash. # # @param request [::Google::Cloud::AlloyDB::V1::CreateClusterRequest, ::Hash] # A request object representing the call parameters. Required. To specify no # parameters, or to keep all the default parameter values, pass an empty Hash. # @param options [::Gapic::CallOptions, ::Hash] # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. # # @overload create_cluster(parent: nil, cluster_id: nil, cluster: nil, request_id: nil, validate_only: nil) # Pass arguments to `create_cluster` via keyword arguments. Note that at # least one keyword argument is required. To specify no parameters, or to keep all # the default parameter values, pass an empty Hash as a request object (see above). # # @param parent [::String] # Required. The location of the new cluster. For the required format, see the # comment on the Cluster.name field. # @param cluster_id [::String] # Required. ID of the requesting object. # @param cluster [::Google::Cloud::AlloyDB::V1::Cluster, ::Hash] # Required. The resource being created # @param request_id [::String] # Optional. An optional request ID to identify requests. Specify a unique # request ID so that if you must retry your request, the server will know to # ignore the request if it has already been completed. The server will # guarantee that for at least 60 minutes since the first request. # # For example, consider a situation where you make an initial request and # the request times out. If you make the request again with the same request # ID, the server can check if original operation with the same request ID # was received, and if so, will ignore the second request. This prevents # clients from accidentally creating duplicate commitments. # # The request ID must be a valid UUID with the exception that zero UUID is # not supported (00000000-0000-0000-0000-000000000000). # @param validate_only [::Boolean] # Optional. If set, performs request validation (e.g. permission checks and # any other type of validation), but do not actually execute the create # request. # @yield [result, operation] Access the result along with the TransportOperation object # @yieldparam result [::Gapic::Operation] # @yieldparam operation [::Gapic::Rest::TransportOperation] # # @return [::Gapic::Operation] # # @raise [::Google::Cloud::Error] if the REST call is aborted. # # @example Basic example # require "google/cloud/alloy_db/v1" # # # Create a client object. The client can be reused for multiple calls. # client = Google::Cloud::AlloyDB::V1::AlloyDBAdmin::Rest::Client.new # # # Create a request. To set request fields, pass in keyword arguments. # request = Google::Cloud::AlloyDB::V1::CreateClusterRequest.new # # # Call the create_cluster method. # result = client.create_cluster request # # # The returned object is of type Gapic::Operation. You can use it to # # check the status of an operation, cancel it, or wait for results. # # Here is how to wait for a response. # result.wait_until_done! timeout: 60 # if result.response? # p result.response # else # puts "No response received." # end # def create_cluster request, options = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::AlloyDB::V1::CreateClusterRequest # Converts hash and nil to an options object options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h # Customize the options with defaults call_metadata = @config.rpcs.create_cluster.metadata.to_h # Set x-goog-api-client and x-goog-user-project headers call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::AlloyDB::V1::VERSION, transports_version_send: [:rest] call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id options.apply_defaults timeout: @config.rpcs.create_cluster.timeout, metadata: call_metadata, retry_policy: @config.rpcs.create_cluster.retry_policy options.apply_defaults timeout: @config.timeout, metadata: @config.metadata, retry_policy: @config.retry_policy @alloy_db_admin_stub.create_cluster request, options do |result, operation| result = ::Gapic::Operation.new result, @operations_client, options: options yield result, operation if block_given? return result end rescue ::Gapic::Rest::Error => e raise ::Google::Cloud::Error.from_error(e) end ## # Updates the parameters of a single Cluster. # # @overload update_cluster(request, options = nil) # Pass arguments to `update_cluster` via a request object, either of type # {::Google::Cloud::AlloyDB::V1::UpdateClusterRequest} or an equivalent Hash. # # @param request [::Google::Cloud::AlloyDB::V1::UpdateClusterRequest, ::Hash] # A request object representing the call parameters. Required. To specify no # parameters, or to keep all the default parameter values, pass an empty Hash. # @param options [::Gapic::CallOptions, ::Hash] # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. # # @overload update_cluster(update_mask: nil, cluster: nil, request_id: nil, validate_only: nil, allow_missing: nil) # Pass arguments to `update_cluster` via keyword arguments. Note that at # least one keyword argument is required. To specify no parameters, or to keep all # the default parameter values, pass an empty Hash as a request object (see above). # # @param update_mask [::Google::Protobuf::FieldMask, ::Hash] # Optional. Field mask is used to specify the fields to be overwritten in the # Cluster resource by the update. # The fields specified in the update_mask are relative to the resource, not # the full request. A field will be overwritten if it is in the mask. If the # user does not provide a mask then all fields will be overwritten. # @param cluster [::Google::Cloud::AlloyDB::V1::Cluster, ::Hash] # Required. The resource being updated # @param request_id [::String] # Optional. An optional request ID to identify requests. Specify a unique # request ID so that if you must retry your request, the server will know to # ignore the request if it has already been completed. The server will # guarantee that for at least 60 minutes since the first request. # # For example, consider a situation where you make an initial request and # the request times out. If you make the request again with the same request # ID, the server can check if original operation with the same request ID # was received, and if so, will ignore the second request. This prevents # clients from accidentally creating duplicate commitments. # # The request ID must be a valid UUID with the exception that zero UUID is # not supported (00000000-0000-0000-0000-000000000000). # @param validate_only [::Boolean] # Optional. If set, performs request validation (e.g. permission checks and # any other type of validation), but do not actually execute the update # request. # @param allow_missing [::Boolean] # Optional. If set to true, update succeeds even if cluster is not found. In # that case, a new cluster is created and `update_mask` is ignored. # @yield [result, operation] Access the result along with the TransportOperation object # @yieldparam result [::Gapic::Operation] # @yieldparam operation [::Gapic::Rest::TransportOperation] # # @return [::Gapic::Operation] # # @raise [::Google::Cloud::Error] if the REST call is aborted. # # @example Basic example # require "google/cloud/alloy_db/v1" # # # Create a client object. The client can be reused for multiple calls. # client = Google::Cloud::AlloyDB::V1::AlloyDBAdmin::Rest::Client.new # # # Create a request. To set request fields, pass in keyword arguments. # request = Google::Cloud::AlloyDB::V1::UpdateClusterRequest.new # # # Call the update_cluster method. # result = client.update_cluster request # # # The returned object is of type Gapic::Operation. You can use it to # # check the status of an operation, cancel it, or wait for results. # # Here is how to wait for a response. # result.wait_until_done! timeout: 60 # if result.response? # p result.response # else # puts "No response received." # end # def update_cluster request, options = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::AlloyDB::V1::UpdateClusterRequest # Converts hash and nil to an options object options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h # Customize the options with defaults call_metadata = @config.rpcs.update_cluster.metadata.to_h # Set x-goog-api-client and x-goog-user-project headers call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::AlloyDB::V1::VERSION, transports_version_send: [:rest] call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id options.apply_defaults timeout: @config.rpcs.update_cluster.timeout, metadata: call_metadata, retry_policy: @config.rpcs.update_cluster.retry_policy options.apply_defaults timeout: @config.timeout, metadata: @config.metadata, retry_policy: @config.retry_policy @alloy_db_admin_stub.update_cluster request, options do |result, operation| result = ::Gapic::Operation.new result, @operations_client, options: options yield result, operation if block_given? return result end rescue ::Gapic::Rest::Error => e raise ::Google::Cloud::Error.from_error(e) end ## # Deletes a single Cluster. # # @overload delete_cluster(request, options = nil) # Pass arguments to `delete_cluster` via a request object, either of type # {::Google::Cloud::AlloyDB::V1::DeleteClusterRequest} or an equivalent Hash. # # @param request [::Google::Cloud::AlloyDB::V1::DeleteClusterRequest, ::Hash] # A request object representing the call parameters. Required. To specify no # parameters, or to keep all the default parameter values, pass an empty Hash. # @param options [::Gapic::CallOptions, ::Hash] # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. # # @overload delete_cluster(name: nil, request_id: nil, etag: nil, validate_only: nil, force: nil) # Pass arguments to `delete_cluster` via keyword arguments. Note that at # least one keyword argument is required. To specify no parameters, or to keep all # the default parameter values, pass an empty Hash as a request object (see above). # # @param name [::String] # Required. The name of the resource. For the required format, see the # comment on the Cluster.name field. # @param request_id [::String] # Optional. An optional request ID to identify requests. Specify a unique # request ID so that if you must retry your request, the server will know to # ignore the request if it has already been completed. The server will # guarantee that for at least 60 minutes after the first request. # # For example, consider a situation where you make an initial request and # the request times out. If you make the request again with the same request # ID, the server can check if original operation with the same request ID # was received, and if so, will ignore the second request. This prevents # clients from accidentally creating duplicate commitments. # # The request ID must be a valid UUID with the exception that zero UUID is # not supported (00000000-0000-0000-0000-000000000000). # @param etag [::String] # Optional. The current etag of the Cluster. # If an etag is provided and does not match the current etag of the Cluster, # deletion will be blocked and an ABORTED error will be returned. # @param validate_only [::Boolean] # Optional. If set, performs request validation (e.g. permission checks and # any other type of validation), but do not actually execute the delete. # @param force [::Boolean] # Optional. Whether to cascade delete child instances for given cluster. # @yield [result, operation] Access the result along with the TransportOperation object # @yieldparam result [::Gapic::Operation] # @yieldparam operation [::Gapic::Rest::TransportOperation] # # @return [::Gapic::Operation] # # @raise [::Google::Cloud::Error] if the REST call is aborted. # # @example Basic example # require "google/cloud/alloy_db/v1" # # # Create a client object. The client can be reused for multiple calls. # client = Google::Cloud::AlloyDB::V1::AlloyDBAdmin::Rest::Client.new # # # Create a request. To set request fields, pass in keyword arguments. # request = Google::Cloud::AlloyDB::V1::DeleteClusterRequest.new # # # Call the delete_cluster method. # result = client.delete_cluster request # # # The returned object is of type Gapic::Operation. You can use it to # # check the status of an operation, cancel it, or wait for results. # # Here is how to wait for a response. # result.wait_until_done! timeout: 60 # if result.response? # p result.response # else # puts "No response received." # end # def delete_cluster request, options = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::AlloyDB::V1::DeleteClusterRequest # Converts hash and nil to an options object options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h # Customize the options with defaults call_metadata = @config.rpcs.delete_cluster.metadata.to_h # Set x-goog-api-client and x-goog-user-project headers call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::AlloyDB::V1::VERSION, transports_version_send: [:rest] call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id options.apply_defaults timeout: @config.rpcs.delete_cluster.timeout, metadata: call_metadata, retry_policy: @config.rpcs.delete_cluster.retry_policy options.apply_defaults timeout: @config.timeout, metadata: @config.metadata, retry_policy: @config.retry_policy @alloy_db_admin_stub.delete_cluster request, options do |result, operation| result = ::Gapic::Operation.new result, @operations_client, options: options yield result, operation if block_given? return result end rescue ::Gapic::Rest::Error => e raise ::Google::Cloud::Error.from_error(e) end ## # Promotes a SECONDARY cluster. This turns down replication # from the PRIMARY cluster and promotes a secondary cluster # into its own standalone cluster. # Imperative only. # # @overload promote_cluster(request, options = nil) # Pass arguments to `promote_cluster` via a request object, either of type # {::Google::Cloud::AlloyDB::V1::PromoteClusterRequest} or an equivalent Hash. # # @param request [::Google::Cloud::AlloyDB::V1::PromoteClusterRequest, ::Hash] # A request object representing the call parameters. Required. To specify no # parameters, or to keep all the default parameter values, pass an empty Hash. # @param options [::Gapic::CallOptions, ::Hash] # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. # # @overload promote_cluster(name: nil, request_id: nil, etag: nil, validate_only: nil) # Pass arguments to `promote_cluster` via keyword arguments. Note that at # least one keyword argument is required. To specify no parameters, or to keep all # the default parameter values, pass an empty Hash as a request object (see above). # # @param name [::String] # Required. The name of the resource. For the required format, see the # comment on the Cluster.name field # @param request_id [::String] # Optional. An optional request ID to identify requests. Specify a unique # request ID so that if you must retry your request, the server will know to # ignore the request if it has already been completed. The server will # guarantee that for at least 60 minutes after the first request. # # For example, consider a situation where you make an initial request and # the request times out. If you make the request again with the same request # ID, the server can check if original operation with the same request ID # was received, and if so, will ignore the second request. This prevents # clients from accidentally creating duplicate commitments. # # The request ID must be a valid UUID with the exception that zero UUID is # not supported (00000000-0000-0000-0000-000000000000). # @param etag [::String] # Optional. The current etag of the Cluster. # If an etag is provided and does not match the current etag of the Cluster, # deletion will be blocked and an ABORTED error will be returned. # @param validate_only [::Boolean] # Optional. If set, performs request validation (e.g. permission checks and # any other type of validation), but do not actually execute the delete. # @yield [result, operation] Access the result along with the TransportOperation object # @yieldparam result [::Gapic::Operation] # @yieldparam operation [::Gapic::Rest::TransportOperation] # # @return [::Gapic::Operation] # # @raise [::Google::Cloud::Error] if the REST call is aborted. # # @example Basic example # require "google/cloud/alloy_db/v1" # # # Create a client object. The client can be reused for multiple calls. # client = Google::Cloud::AlloyDB::V1::AlloyDBAdmin::Rest::Client.new # # # Create a request. To set request fields, pass in keyword arguments. # request = Google::Cloud::AlloyDB::V1::PromoteClusterRequest.new # # # Call the promote_cluster method. # result = client.promote_cluster request # # # The returned object is of type Gapic::Operation. You can use it to # # check the status of an operation, cancel it, or wait for results. # # Here is how to wait for a response. # result.wait_until_done! timeout: 60 # if result.response? # p result.response # else # puts "No response received." # end # def promote_cluster request, options = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::AlloyDB::V1::PromoteClusterRequest # Converts hash and nil to an options object options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h # Customize the options with defaults call_metadata = @config.rpcs.promote_cluster.metadata.to_h # Set x-goog-api-client and x-goog-user-project headers call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::AlloyDB::V1::VERSION, transports_version_send: [:rest] call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id options.apply_defaults timeout: @config.rpcs.promote_cluster.timeout, metadata: call_metadata, retry_policy: @config.rpcs.promote_cluster.retry_policy options.apply_defaults timeout: @config.timeout, metadata: @config.metadata, retry_policy: @config.retry_policy @alloy_db_admin_stub.promote_cluster request, options do |result, operation| result = ::Gapic::Operation.new result, @operations_client, options: options yield result, operation if block_given? return result end rescue ::Gapic::Rest::Error => e raise ::Google::Cloud::Error.from_error(e) end ## # Creates a new Cluster in a given project and location, with a volume # restored from the provided source, either a backup ID or a point-in-time # and a source cluster. # # @overload restore_cluster(request, options = nil) # Pass arguments to `restore_cluster` via a request object, either of type # {::Google::Cloud::AlloyDB::V1::RestoreClusterRequest} or an equivalent Hash. # # @param request [::Google::Cloud::AlloyDB::V1::RestoreClusterRequest, ::Hash] # A request object representing the call parameters. Required. To specify no # parameters, or to keep all the default parameter values, pass an empty Hash. # @param options [::Gapic::CallOptions, ::Hash] # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. # # @overload restore_cluster(backup_source: nil, continuous_backup_source: nil, parent: nil, cluster_id: nil, cluster: nil, request_id: nil, validate_only: nil) # Pass arguments to `restore_cluster` via keyword arguments. Note that at # least one keyword argument is required. To specify no parameters, or to keep all # the default parameter values, pass an empty Hash as a request object (see above). # # @param backup_source [::Google::Cloud::AlloyDB::V1::BackupSource, ::Hash] # Backup source. # @param continuous_backup_source [::Google::Cloud::AlloyDB::V1::ContinuousBackupSource, ::Hash] # ContinuousBackup source. Continuous backup needs to be enabled in the # source cluster for this operation to succeed. # @param parent [::String] # Required. The name of the parent resource. For the required format, see the # comment on the Cluster.name field. # @param cluster_id [::String] # Required. ID of the requesting object. # @param cluster [::Google::Cloud::AlloyDB::V1::Cluster, ::Hash] # Required. The resource being created # @param request_id [::String] # Optional. An optional request ID to identify requests. Specify a unique # request ID so that if you must retry your request, the server will know to # ignore the request if it has already been completed. The server will # guarantee that for at least 60 minutes since the first request. # # For example, consider a situation where you make an initial request and # the request times out. If you make the request again with the same request # ID, the server can check if original operation with the same request ID # was received, and if so, will ignore the second request. This prevents # clients from accidentally creating duplicate commitments. # # The request ID must be a valid UUID with the exception that zero UUID is # not supported (00000000-0000-0000-0000-000000000000). # @param validate_only [::Boolean] # Optional. If set, performs request validation (e.g. permission checks and # any other type of validation), but do not actually execute the import # request. # @yield [result, operation] Access the result along with the TransportOperation object # @yieldparam result [::Gapic::Operation] # @yieldparam operation [::Gapic::Rest::TransportOperation] # # @return [::Gapic::Operation] # # @raise [::Google::Cloud::Error] if the REST call is aborted. # # @example Basic example # require "google/cloud/alloy_db/v1" # # # Create a client object. The client can be reused for multiple calls. # client = Google::Cloud::AlloyDB::V1::AlloyDBAdmin::Rest::Client.new # # # Create a request. To set request fields, pass in keyword arguments. # request = Google::Cloud::AlloyDB::V1::RestoreClusterRequest.new # # # Call the restore_cluster method. # result = client.restore_cluster request # # # The returned object is of type Gapic::Operation. You can use it to # # check the status of an operation, cancel it, or wait for results. # # Here is how to wait for a response. # result.wait_until_done! timeout: 60 # if result.response? # p result.response # else # puts "No response received." # end # def restore_cluster request, options = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::AlloyDB::V1::RestoreClusterRequest # Converts hash and nil to an options object options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h # Customize the options with defaults call_metadata = @config.rpcs.restore_cluster.metadata.to_h # Set x-goog-api-client and x-goog-user-project headers call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::AlloyDB::V1::VERSION, transports_version_send: [:rest] call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id options.apply_defaults timeout: @config.rpcs.restore_cluster.timeout, metadata: call_metadata, retry_policy: @config.rpcs.restore_cluster.retry_policy options.apply_defaults timeout: @config.timeout, metadata: @config.metadata, retry_policy: @config.retry_policy @alloy_db_admin_stub.restore_cluster request, options do |result, operation| result = ::Gapic::Operation.new result, @operations_client, options: options yield result, operation if block_given? return result end rescue ::Gapic::Rest::Error => e raise ::Google::Cloud::Error.from_error(e) end ## # Creates a cluster of type SECONDARY in the given location using # the primary cluster as the source. # # @overload create_secondary_cluster(request, options = nil) # Pass arguments to `create_secondary_cluster` via a request object, either of type # {::Google::Cloud::AlloyDB::V1::CreateSecondaryClusterRequest} or an equivalent Hash. # # @param request [::Google::Cloud::AlloyDB::V1::CreateSecondaryClusterRequest, ::Hash] # A request object representing the call parameters. Required. To specify no # parameters, or to keep all the default parameter values, pass an empty Hash. # @param options [::Gapic::CallOptions, ::Hash] # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. # # @overload create_secondary_cluster(parent: nil, cluster_id: nil, cluster: nil, request_id: nil, validate_only: nil) # Pass arguments to `create_secondary_cluster` via keyword arguments. Note that at # least one keyword argument is required. To specify no parameters, or to keep all # the default parameter values, pass an empty Hash as a request object (see above). # # @param parent [::String] # Required. The location of the new cluster. For the required # format, see the comment on the Cluster.name field. # @param cluster_id [::String] # Required. ID of the requesting object (the secondary cluster). # @param cluster [::Google::Cloud::AlloyDB::V1::Cluster, ::Hash] # Required. Configuration of the requesting object (the secondary cluster). # @param request_id [::String] # Optional. An optional request ID to identify requests. Specify a unique # request ID so that if you must retry your request, the server will know to # ignore the request if it has already been completed. The server will # guarantee that for at least 60 minutes since the first request. # # For example, consider a situation where you make an initial request and # the request times out. If you make the request again with the same request # ID, the server can check if original operation with the same request ID # was received, and if so, will ignore the second request. This prevents # clients from accidentally creating duplicate commitments. # # The request ID must be a valid UUID with the exception that zero UUID is # not supported (00000000-0000-0000-0000-000000000000). # @param validate_only [::Boolean] # Optional. If set, performs request validation (e.g. permission checks and # any other type of validation), but do not actually execute the create # request. # @yield [result, operation] Access the result along with the TransportOperation object # @yieldparam result [::Gapic::Operation] # @yieldparam operation [::Gapic::Rest::TransportOperation] # # @return [::Gapic::Operation] # # @raise [::Google::Cloud::Error] if the REST call is aborted. # # @example Basic example # require "google/cloud/alloy_db/v1" # # # Create a client object. The client can be reused for multiple calls. # client = Google::Cloud::AlloyDB::V1::AlloyDBAdmin::Rest::Client.new # # # Create a request. To set request fields, pass in keyword arguments. # request = Google::Cloud::AlloyDB::V1::CreateSecondaryClusterRequest.new # # # Call the create_secondary_cluster method. # result = client.create_secondary_cluster request # # # The returned object is of type Gapic::Operation. You can use it to # # check the status of an operation, cancel it, or wait for results. # # Here is how to wait for a response. # result.wait_until_done! timeout: 60 # if result.response? # p result.response # else # puts "No response received." # end # def create_secondary_cluster request, options = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::AlloyDB::V1::CreateSecondaryClusterRequest # Converts hash and nil to an options object options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h # Customize the options with defaults call_metadata = @config.rpcs.create_secondary_cluster.metadata.to_h # Set x-goog-api-client and x-goog-user-project headers call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::AlloyDB::V1::VERSION, transports_version_send: [:rest] call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id options.apply_defaults timeout: @config.rpcs.create_secondary_cluster.timeout, metadata: call_metadata, retry_policy: @config.rpcs.create_secondary_cluster.retry_policy options.apply_defaults timeout: @config.timeout, metadata: @config.metadata, retry_policy: @config.retry_policy @alloy_db_admin_stub.create_secondary_cluster request, options do |result, operation| result = ::Gapic::Operation.new result, @operations_client, options: options yield result, operation if block_given? return result end rescue ::Gapic::Rest::Error => e raise ::Google::Cloud::Error.from_error(e) end ## # Lists Instances in a given project and location. # # @overload list_instances(request, options = nil) # Pass arguments to `list_instances` via a request object, either of type # {::Google::Cloud::AlloyDB::V1::ListInstancesRequest} or an equivalent Hash. # # @param request [::Google::Cloud::AlloyDB::V1::ListInstancesRequest, ::Hash] # A request object representing the call parameters. Required. To specify no # parameters, or to keep all the default parameter values, pass an empty Hash. # @param options [::Gapic::CallOptions, ::Hash] # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. # # @overload list_instances(parent: nil, page_size: nil, page_token: nil, filter: nil, order_by: nil) # Pass arguments to `list_instances` via keyword arguments. Note that at # least one keyword argument is required. To specify no parameters, or to keep all # the default parameter values, pass an empty Hash as a request object (see above). # # @param parent [::String] # Required. The name of the parent resource. For the required format, see the # comment on the Instance.name field. Additionally, you can perform an # aggregated list operation by specifying a value with one of the following # formats: # * projects/\\{project}/locations/-/clusters/- # * projects/\\{project}/locations/\\{region}/clusters/- # @param page_size [::Integer] # Optional. Requested page size. Server may return fewer items than # requested. If unspecified, server will pick an appropriate default. # @param page_token [::String] # A token identifying a page of results the server should return. # @param filter [::String] # Optional. Filtering results # @param order_by [::String] # Optional. Hint for how to order the results # @yield [result, operation] Access the result along with the TransportOperation object # @yieldparam result [::Google::Cloud::AlloyDB::V1::ListInstancesResponse] # @yieldparam operation [::Gapic::Rest::TransportOperation] # # @return [::Google::Cloud::AlloyDB::V1::ListInstancesResponse] # # @raise [::Google::Cloud::Error] if the REST call is aborted. # # @example Basic example # require "google/cloud/alloy_db/v1" # # # Create a client object. The client can be reused for multiple calls. # client = Google::Cloud::AlloyDB::V1::AlloyDBAdmin::Rest::Client.new # # # Create a request. To set request fields, pass in keyword arguments. # request = Google::Cloud::AlloyDB::V1::ListInstancesRequest.new # # # Call the list_instances method. # result = client.list_instances request # # # The returned object is of type Gapic::PagedEnumerable. You can iterate # # over elements, and API calls will be issued to fetch pages as needed. # result.each do |item| # # Each element is of type ::Google::Cloud::AlloyDB::V1::Instance. # p item # end # def list_instances request, options = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::AlloyDB::V1::ListInstancesRequest # Converts hash and nil to an options object options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h # Customize the options with defaults call_metadata = @config.rpcs.list_instances.metadata.to_h # Set x-goog-api-client and x-goog-user-project headers call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::AlloyDB::V1::VERSION, transports_version_send: [:rest] call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id options.apply_defaults timeout: @config.rpcs.list_instances.timeout, metadata: call_metadata, retry_policy: @config.rpcs.list_instances.retry_policy options.apply_defaults timeout: @config.timeout, metadata: @config.metadata, retry_policy: @config.retry_policy @alloy_db_admin_stub.list_instances request, options do |result, operation| yield result, operation if block_given? return result end rescue ::Gapic::Rest::Error => e raise ::Google::Cloud::Error.from_error(e) end ## # Gets details of a single Instance. # # @overload get_instance(request, options = nil) # Pass arguments to `get_instance` via a request object, either of type # {::Google::Cloud::AlloyDB::V1::GetInstanceRequest} or an equivalent Hash. # # @param request [::Google::Cloud::AlloyDB::V1::GetInstanceRequest, ::Hash] # A request object representing the call parameters. Required. To specify no # parameters, or to keep all the default parameter values, pass an empty Hash. # @param options [::Gapic::CallOptions, ::Hash] # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. # # @overload get_instance(name: nil, view: nil) # Pass arguments to `get_instance` via keyword arguments. Note that at # least one keyword argument is required. To specify no parameters, or to keep all # the default parameter values, pass an empty Hash as a request object (see above). # # @param name [::String] # Required. The name of the resource. For the required format, see the # comment on the Instance.name field. # @param view [::Google::Cloud::AlloyDB::V1::InstanceView] # The view of the instance to return. # @yield [result, operation] Access the result along with the TransportOperation object # @yieldparam result [::Google::Cloud::AlloyDB::V1::Instance] # @yieldparam operation [::Gapic::Rest::TransportOperation] # # @return [::Google::Cloud::AlloyDB::V1::Instance] # # @raise [::Google::Cloud::Error] if the REST call is aborted. # # @example Basic example # require "google/cloud/alloy_db/v1" # # # Create a client object. The client can be reused for multiple calls. # client = Google::Cloud::AlloyDB::V1::AlloyDBAdmin::Rest::Client.new # # # Create a request. To set request fields, pass in keyword arguments. # request = Google::Cloud::AlloyDB::V1::GetInstanceRequest.new # # # Call the get_instance method. # result = client.get_instance request # # # The returned object is of type Google::Cloud::AlloyDB::V1::Instance. # p result # def get_instance request, options = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::AlloyDB::V1::GetInstanceRequest # Converts hash and nil to an options object options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h # Customize the options with defaults call_metadata = @config.rpcs.get_instance.metadata.to_h # Set x-goog-api-client and x-goog-user-project headers call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::AlloyDB::V1::VERSION, transports_version_send: [:rest] call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id options.apply_defaults timeout: @config.rpcs.get_instance.timeout, metadata: call_metadata, retry_policy: @config.rpcs.get_instance.retry_policy options.apply_defaults timeout: @config.timeout, metadata: @config.metadata, retry_policy: @config.retry_policy @alloy_db_admin_stub.get_instance request, options do |result, operation| yield result, operation if block_given? return result end rescue ::Gapic::Rest::Error => e raise ::Google::Cloud::Error.from_error(e) end ## # Creates a new Instance in a given project and location. # # @overload create_instance(request, options = nil) # Pass arguments to `create_instance` via a request object, either of type # {::Google::Cloud::AlloyDB::V1::CreateInstanceRequest} or an equivalent Hash. # # @param request [::Google::Cloud::AlloyDB::V1::CreateInstanceRequest, ::Hash] # A request object representing the call parameters. Required. To specify no # parameters, or to keep all the default parameter values, pass an empty Hash. # @param options [::Gapic::CallOptions, ::Hash] # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. # # @overload create_instance(parent: nil, instance_id: nil, instance: nil, request_id: nil, validate_only: nil) # Pass arguments to `create_instance` via keyword arguments. Note that at # least one keyword argument is required. To specify no parameters, or to keep all # the default parameter values, pass an empty Hash as a request object (see above). # # @param parent [::String] # Required. The name of the parent resource. For the required format, see the # comment on the Instance.name field. # @param instance_id [::String] # Required. ID of the requesting object. # @param instance [::Google::Cloud::AlloyDB::V1::Instance, ::Hash] # Required. The resource being created # @param request_id [::String] # Optional. An optional request ID to identify requests. Specify a unique # request ID so that if you must retry your request, the server will know to # ignore the request if it has already been completed. The server will # guarantee that for at least 60 minutes since the first request. # # For example, consider a situation where you make an initial request and # the request times out. If you make the request again with the same request # ID, the server can check if original operation with the same request ID # was received, and if so, will ignore the second request. This prevents # clients from accidentally creating duplicate commitments. # # The request ID must be a valid UUID with the exception that zero UUID is # not supported (00000000-0000-0000-0000-000000000000). # @param validate_only [::Boolean] # Optional. If set, performs request validation (e.g. permission checks and # any other type of validation), but do not actually execute the create # request. # @yield [result, operation] Access the result along with the TransportOperation object # @yieldparam result [::Gapic::Operation] # @yieldparam operation [::Gapic::Rest::TransportOperation] # # @return [::Gapic::Operation] # # @raise [::Google::Cloud::Error] if the REST call is aborted. # # @example Basic example # require "google/cloud/alloy_db/v1" # # # Create a client object. The client can be reused for multiple calls. # client = Google::Cloud::AlloyDB::V1::AlloyDBAdmin::Rest::Client.new # # # Create a request. To set request fields, pass in keyword arguments. # request = Google::Cloud::AlloyDB::V1::CreateInstanceRequest.new # # # Call the create_instance method. # result = client.create_instance request # # # The returned object is of type Gapic::Operation. You can use it to # # check the status of an operation, cancel it, or wait for results. # # Here is how to wait for a response. # result.wait_until_done! timeout: 60 # if result.response? # p result.response # else # puts "No response received." # end # def create_instance request, options = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::AlloyDB::V1::CreateInstanceRequest # Converts hash and nil to an options object options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h # Customize the options with defaults call_metadata = @config.rpcs.create_instance.metadata.to_h # Set x-goog-api-client and x-goog-user-project headers call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::AlloyDB::V1::VERSION, transports_version_send: [:rest] call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id options.apply_defaults timeout: @config.rpcs.create_instance.timeout, metadata: call_metadata, retry_policy: @config.rpcs.create_instance.retry_policy options.apply_defaults timeout: @config.timeout, metadata: @config.metadata, retry_policy: @config.retry_policy @alloy_db_admin_stub.create_instance request, options do |result, operation| result = ::Gapic::Operation.new result, @operations_client, options: options yield result, operation if block_given? return result end rescue ::Gapic::Rest::Error => e raise ::Google::Cloud::Error.from_error(e) end ## # Creates a new SECONDARY Instance in a given project and location. # # @overload create_secondary_instance(request, options = nil) # Pass arguments to `create_secondary_instance` via a request object, either of type # {::Google::Cloud::AlloyDB::V1::CreateSecondaryInstanceRequest} or an equivalent Hash. # # @param request [::Google::Cloud::AlloyDB::V1::CreateSecondaryInstanceRequest, ::Hash] # A request object representing the call parameters. Required. To specify no # parameters, or to keep all the default parameter values, pass an empty Hash. # @param options [::Gapic::CallOptions, ::Hash] # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. # # @overload create_secondary_instance(parent: nil, instance_id: nil, instance: nil, request_id: nil, validate_only: nil) # Pass arguments to `create_secondary_instance` via keyword arguments. Note that at # least one keyword argument is required. To specify no parameters, or to keep all # the default parameter values, pass an empty Hash as a request object (see above). # # @param parent [::String] # Required. The name of the parent resource. For the required format, see the # comment on the Instance.name field. # @param instance_id [::String] # Required. ID of the requesting object. # @param instance [::Google::Cloud::AlloyDB::V1::Instance, ::Hash] # Required. The resource being created # @param request_id [::String] # Optional. An optional request ID to identify requests. Specify a unique # request ID so that if you must retry your request, the server will know to # ignore the request if it has already been completed. The server will # guarantee that for at least 60 minutes since the first request. # # For example, consider a situation where you make an initial request and # the request times out. If you make the request again with the same request # ID, the server can check if original operation with the same request ID # was received, and if so, will ignore the second request. This prevents # clients from accidentally creating duplicate commitments. # # The request ID must be a valid UUID with the exception that zero UUID is # not supported (00000000-0000-0000-0000-000000000000). # @param validate_only [::Boolean] # Optional. If set, performs request validation (e.g. permission checks and # any other type of validation), but do not actually execute the create # request. # @yield [result, operation] Access the result along with the TransportOperation object # @yieldparam result [::Gapic::Operation] # @yieldparam operation [::Gapic::Rest::TransportOperation] # # @return [::Gapic::Operation] # # @raise [::Google::Cloud::Error] if the REST call is aborted. # # @example Basic example # require "google/cloud/alloy_db/v1" # # # Create a client object. The client can be reused for multiple calls. # client = Google::Cloud::AlloyDB::V1::AlloyDBAdmin::Rest::Client.new # # # Create a request. To set request fields, pass in keyword arguments. # request = Google::Cloud::AlloyDB::V1::CreateSecondaryInstanceRequest.new # # # Call the create_secondary_instance method. # result = client.create_secondary_instance request # # # The returned object is of type Gapic::Operation. You can use it to # # check the status of an operation, cancel it, or wait for results. # # Here is how to wait for a response. # result.wait_until_done! timeout: 60 # if result.response? # p result.response # else # puts "No response received." # end # def create_secondary_instance request, options = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::AlloyDB::V1::CreateSecondaryInstanceRequest # Converts hash and nil to an options object options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h # Customize the options with defaults call_metadata = @config.rpcs.create_secondary_instance.metadata.to_h # Set x-goog-api-client and x-goog-user-project headers call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::AlloyDB::V1::VERSION, transports_version_send: [:rest] call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id options.apply_defaults timeout: @config.rpcs.create_secondary_instance.timeout, metadata: call_metadata, retry_policy: @config.rpcs.create_secondary_instance.retry_policy options.apply_defaults timeout: @config.timeout, metadata: @config.metadata, retry_policy: @config.retry_policy @alloy_db_admin_stub.create_secondary_instance request, options do |result, operation| result = ::Gapic::Operation.new result, @operations_client, options: options yield result, operation if block_given? return result end rescue ::Gapic::Rest::Error => e raise ::Google::Cloud::Error.from_error(e) end ## # Creates new instances under the given project, location and cluster. # There can be only one primary instance in a cluster. If the primary # instance exists in the cluster as well as this request, then API will # throw an error. # The primary instance should exist before any read pool instance is # created. If the primary instance is a part of the request payload, then # the API will take care of creating instances in the correct order. # This method is here to support Google-internal use cases, and is not meant # for external customers to consume. Please do not start relying on it; its # behavior is subject to change without notice. # # @overload batch_create_instances(request, options = nil) # Pass arguments to `batch_create_instances` via a request object, either of type # {::Google::Cloud::AlloyDB::V1::BatchCreateInstancesRequest} or an equivalent Hash. # # @param request [::Google::Cloud::AlloyDB::V1::BatchCreateInstancesRequest, ::Hash] # A request object representing the call parameters. Required. To specify no # parameters, or to keep all the default parameter values, pass an empty Hash. # @param options [::Gapic::CallOptions, ::Hash] # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. # # @overload batch_create_instances(parent: nil, requests: nil, request_id: nil) # Pass arguments to `batch_create_instances` via keyword arguments. Note that at # least one keyword argument is required. To specify no parameters, or to keep all # the default parameter values, pass an empty Hash as a request object (see above). # # @param parent [::String] # Required. The name of the parent resource. # @param requests [::Google::Cloud::AlloyDB::V1::CreateInstanceRequests, ::Hash] # Required. Resources being created. # @param request_id [::String] # Optional. An optional request ID to identify requests. Specify a unique # request ID so that if you must retry your request, the server will know to # ignore the request if it has already been completed. The server will # guarantee that for at least 60 minutes since the first request. # # For example, consider a situation where you make an initial request and # the request times out. If you make the request again with the same request # ID, the server can check if original operation with the same request ID # was received, and if so, will ignore the second request. This prevents # clients from accidentally creating duplicate commitments. # # The request ID must be a valid UUID with the exception that zero UUID is # not supported (00000000-0000-0000-0000-000000000000). # @yield [result, operation] Access the result along with the TransportOperation object # @yieldparam result [::Gapic::Operation] # @yieldparam operation [::Gapic::Rest::TransportOperation] # # @return [::Gapic::Operation] # # @raise [::Google::Cloud::Error] if the REST call is aborted. # # @example Basic example # require "google/cloud/alloy_db/v1" # # # Create a client object. The client can be reused for multiple calls. # client = Google::Cloud::AlloyDB::V1::AlloyDBAdmin::Rest::Client.new # # # Create a request. To set request fields, pass in keyword arguments. # request = Google::Cloud::AlloyDB::V1::BatchCreateInstancesRequest.new # # # Call the batch_create_instances method. # result = client.batch_create_instances request # # # The returned object is of type Gapic::Operation. You can use it to # # check the status of an operation, cancel it, or wait for results. # # Here is how to wait for a response. # result.wait_until_done! timeout: 60 # if result.response? # p result.response # else # puts "No response received." # end # def batch_create_instances request, options = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::AlloyDB::V1::BatchCreateInstancesRequest # Converts hash and nil to an options object options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h # Customize the options with defaults call_metadata = @config.rpcs.batch_create_instances.metadata.to_h # Set x-goog-api-client and x-goog-user-project headers call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::AlloyDB::V1::VERSION, transports_version_send: [:rest] call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id options.apply_defaults timeout: @config.rpcs.batch_create_instances.timeout, metadata: call_metadata, retry_policy: @config.rpcs.batch_create_instances.retry_policy options.apply_defaults timeout: @config.timeout, metadata: @config.metadata, retry_policy: @config.retry_policy @alloy_db_admin_stub.batch_create_instances request, options do |result, operation| result = ::Gapic::Operation.new result, @operations_client, options: options yield result, operation if block_given? return result end rescue ::Gapic::Rest::Error => e raise ::Google::Cloud::Error.from_error(e) end ## # Updates the parameters of a single Instance. # # @overload update_instance(request, options = nil) # Pass arguments to `update_instance` via a request object, either of type # {::Google::Cloud::AlloyDB::V1::UpdateInstanceRequest} or an equivalent Hash. # # @param request [::Google::Cloud::AlloyDB::V1::UpdateInstanceRequest, ::Hash] # A request object representing the call parameters. Required. To specify no # parameters, or to keep all the default parameter values, pass an empty Hash. # @param options [::Gapic::CallOptions, ::Hash] # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. # # @overload update_instance(update_mask: nil, instance: nil, request_id: nil, validate_only: nil, allow_missing: nil) # Pass arguments to `update_instance` via keyword arguments. Note that at # least one keyword argument is required. To specify no parameters, or to keep all # the default parameter values, pass an empty Hash as a request object (see above). # # @param update_mask [::Google::Protobuf::FieldMask, ::Hash] # Optional. Field mask is used to specify the fields to be overwritten in the # Instance resource by the update. # The fields specified in the update_mask are relative to the resource, not # the full request. A field will be overwritten if it is in the mask. If the # user does not provide a mask then all fields will be overwritten. # @param instance [::Google::Cloud::AlloyDB::V1::Instance, ::Hash] # Required. The resource being updated # @param request_id [::String] # Optional. An optional request ID to identify requests. Specify a unique # request ID so that if you must retry your request, the server will know to # ignore the request if it has already been completed. The server will # guarantee that for at least 60 minutes since the first request. # # For example, consider a situation where you make an initial request and # the request times out. If you make the request again with the same request # ID, the server can check if original operation with the same request ID # was received, and if so, will ignore the second request. This prevents # clients from accidentally creating duplicate commitments. # # The request ID must be a valid UUID with the exception that zero UUID is # not supported (00000000-0000-0000-0000-000000000000). # @param validate_only [::Boolean] # Optional. If set, performs request validation (e.g. permission checks and # any other type of validation), but do not actually execute the update # request. # @param allow_missing [::Boolean] # Optional. If set to true, update succeeds even if instance is not found. In # that case, a new instance is created and `update_mask` is ignored. # @yield [result, operation] Access the result along with the TransportOperation object # @yieldparam result [::Gapic::Operation] # @yieldparam operation [::Gapic::Rest::TransportOperation] # # @return [::Gapic::Operation] # # @raise [::Google::Cloud::Error] if the REST call is aborted. # # @example Basic example # require "google/cloud/alloy_db/v1" # # # Create a client object. The client can be reused for multiple calls. # client = Google::Cloud::AlloyDB::V1::AlloyDBAdmin::Rest::Client.new # # # Create a request. To set request fields, pass in keyword arguments. # request = Google::Cloud::AlloyDB::V1::UpdateInstanceRequest.new # # # Call the update_instance method. # result = client.update_instance request # # # The returned object is of type Gapic::Operation. You can use it to # # check the status of an operation, cancel it, or wait for results. # # Here is how to wait for a response. # result.wait_until_done! timeout: 60 # if result.response? # p result.response # else # puts "No response received." # end # def update_instance request, options = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::AlloyDB::V1::UpdateInstanceRequest # Converts hash and nil to an options object options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h # Customize the options with defaults call_metadata = @config.rpcs.update_instance.metadata.to_h # Set x-goog-api-client and x-goog-user-project headers call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::AlloyDB::V1::VERSION, transports_version_send: [:rest] call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id options.apply_defaults timeout: @config.rpcs.update_instance.timeout, metadata: call_metadata, retry_policy: @config.rpcs.update_instance.retry_policy options.apply_defaults timeout: @config.timeout, metadata: @config.metadata, retry_policy: @config.retry_policy @alloy_db_admin_stub.update_instance request, options do |result, operation| result = ::Gapic::Operation.new result, @operations_client, options: options yield result, operation if block_given? return result end rescue ::Gapic::Rest::Error => e raise ::Google::Cloud::Error.from_error(e) end ## # Deletes a single Instance. # # @overload delete_instance(request, options = nil) # Pass arguments to `delete_instance` via a request object, either of type # {::Google::Cloud::AlloyDB::V1::DeleteInstanceRequest} or an equivalent Hash. # # @param request [::Google::Cloud::AlloyDB::V1::DeleteInstanceRequest, ::Hash] # A request object representing the call parameters. Required. To specify no # parameters, or to keep all the default parameter values, pass an empty Hash. # @param options [::Gapic::CallOptions, ::Hash] # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. # # @overload delete_instance(name: nil, request_id: nil, etag: nil, validate_only: nil) # Pass arguments to `delete_instance` via keyword arguments. Note that at # least one keyword argument is required. To specify no parameters, or to keep all # the default parameter values, pass an empty Hash as a request object (see above). # # @param name [::String] # Required. The name of the resource. For the required format, see the # comment on the Instance.name field. # @param request_id [::String] # Optional. An optional request ID to identify requests. Specify a unique # request ID so that if you must retry your request, the server will know to # ignore the request if it has already been completed. The server will # guarantee that for at least 60 minutes after the first request. # # For example, consider a situation where you make an initial request and # the request times out. If you make the request again with the same request # ID, the server can check if original operation with the same request ID # was received, and if so, will ignore the second request. This prevents # clients from accidentally creating duplicate commitments. # # The request ID must be a valid UUID with the exception that zero UUID is # not supported (00000000-0000-0000-0000-000000000000). # @param etag [::String] # Optional. The current etag of the Instance. # If an etag is provided and does not match the current etag of the Instance, # deletion will be blocked and an ABORTED error will be returned. # @param validate_only [::Boolean] # Optional. If set, performs request validation (e.g. permission checks and # any other type of validation), but do not actually execute the delete. # @yield [result, operation] Access the result along with the TransportOperation object # @yieldparam result [::Gapic::Operation] # @yieldparam operation [::Gapic::Rest::TransportOperation] # # @return [::Gapic::Operation] # # @raise [::Google::Cloud::Error] if the REST call is aborted. # # @example Basic example # require "google/cloud/alloy_db/v1" # # # Create a client object. The client can be reused for multiple calls. # client = Google::Cloud::AlloyDB::V1::AlloyDBAdmin::Rest::Client.new # # # Create a request. To set request fields, pass in keyword arguments. # request = Google::Cloud::AlloyDB::V1::DeleteInstanceRequest.new # # # Call the delete_instance method. # result = client.delete_instance request # # # The returned object is of type Gapic::Operation. You can use it to # # check the status of an operation, cancel it, or wait for results. # # Here is how to wait for a response. # result.wait_until_done! timeout: 60 # if result.response? # p result.response # else # puts "No response received." # end # def delete_instance request, options = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::AlloyDB::V1::DeleteInstanceRequest # Converts hash and nil to an options object options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h # Customize the options with defaults call_metadata = @config.rpcs.delete_instance.metadata.to_h # Set x-goog-api-client and x-goog-user-project headers call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::AlloyDB::V1::VERSION, transports_version_send: [:rest] call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id options.apply_defaults timeout: @config.rpcs.delete_instance.timeout, metadata: call_metadata, retry_policy: @config.rpcs.delete_instance.retry_policy options.apply_defaults timeout: @config.timeout, metadata: @config.metadata, retry_policy: @config.retry_policy @alloy_db_admin_stub.delete_instance request, options do |result, operation| result = ::Gapic::Operation.new result, @operations_client, options: options yield result, operation if block_given? return result end rescue ::Gapic::Rest::Error => e raise ::Google::Cloud::Error.from_error(e) end ## # Forces a Failover for a highly available instance. # Failover promotes the HA standby instance as the new primary. # Imperative only. # # @overload failover_instance(request, options = nil) # Pass arguments to `failover_instance` via a request object, either of type # {::Google::Cloud::AlloyDB::V1::FailoverInstanceRequest} or an equivalent Hash. # # @param request [::Google::Cloud::AlloyDB::V1::FailoverInstanceRequest, ::Hash] # A request object representing the call parameters. Required. To specify no # parameters, or to keep all the default parameter values, pass an empty Hash. # @param options [::Gapic::CallOptions, ::Hash] # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. # # @overload failover_instance(name: nil, request_id: nil, validate_only: nil) # Pass arguments to `failover_instance` via keyword arguments. Note that at # least one keyword argument is required. To specify no parameters, or to keep all # the default parameter values, pass an empty Hash as a request object (see above). # # @param name [::String] # Required. The name of the resource. For the required format, see the # comment on the Instance.name field. # @param request_id [::String] # Optional. An optional request ID to identify requests. Specify a unique # request ID so that if you must retry your request, the server will know to # ignore the request if it has already been completed. The server will # guarantee that for at least 60 minutes after the first request. # # For example, consider a situation where you make an initial request and # the request times out. If you make the request again with the same request # ID, the server can check if original operation with the same request ID # was received, and if so, will ignore the second request. This prevents # clients from accidentally creating duplicate commitments. # # The request ID must be a valid UUID with the exception that zero UUID is # not supported (00000000-0000-0000-0000-000000000000). # @param validate_only [::Boolean] # Optional. If set, performs request validation (e.g. permission checks and # any other type of validation), but do not actually execute the failover. # @yield [result, operation] Access the result along with the TransportOperation object # @yieldparam result [::Gapic::Operation] # @yieldparam operation [::Gapic::Rest::TransportOperation] # # @return [::Gapic::Operation] # # @raise [::Google::Cloud::Error] if the REST call is aborted. # # @example Basic example # require "google/cloud/alloy_db/v1" # # # Create a client object. The client can be reused for multiple calls. # client = Google::Cloud::AlloyDB::V1::AlloyDBAdmin::Rest::Client.new # # # Create a request. To set request fields, pass in keyword arguments. # request = Google::Cloud::AlloyDB::V1::FailoverInstanceRequest.new # # # Call the failover_instance method. # result = client.failover_instance request # # # The returned object is of type Gapic::Operation. You can use it to # # check the status of an operation, cancel it, or wait for results. # # Here is how to wait for a response. # result.wait_until_done! timeout: 60 # if result.response? # p result.response # else # puts "No response received." # end # def failover_instance request, options = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::AlloyDB::V1::FailoverInstanceRequest # Converts hash and nil to an options object options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h # Customize the options with defaults call_metadata = @config.rpcs.failover_instance.metadata.to_h # Set x-goog-api-client and x-goog-user-project headers call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::AlloyDB::V1::VERSION, transports_version_send: [:rest] call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id options.apply_defaults timeout: @config.rpcs.failover_instance.timeout, metadata: call_metadata, retry_policy: @config.rpcs.failover_instance.retry_policy options.apply_defaults timeout: @config.timeout, metadata: @config.metadata, retry_policy: @config.retry_policy @alloy_db_admin_stub.failover_instance request, options do |result, operation| result = ::Gapic::Operation.new result, @operations_client, options: options yield result, operation if block_given? return result end rescue ::Gapic::Rest::Error => e raise ::Google::Cloud::Error.from_error(e) end ## # Injects fault in an instance. # Imperative only. # # @overload inject_fault(request, options = nil) # Pass arguments to `inject_fault` via a request object, either of type # {::Google::Cloud::AlloyDB::V1::InjectFaultRequest} or an equivalent Hash. # # @param request [::Google::Cloud::AlloyDB::V1::InjectFaultRequest, ::Hash] # A request object representing the call parameters. Required. To specify no # parameters, or to keep all the default parameter values, pass an empty Hash. # @param options [::Gapic::CallOptions, ::Hash] # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. # # @overload inject_fault(fault_type: nil, name: nil, request_id: nil, validate_only: nil) # Pass arguments to `inject_fault` via keyword arguments. Note that at # least one keyword argument is required. To specify no parameters, or to keep all # the default parameter values, pass an empty Hash as a request object (see above). # # @param fault_type [::Google::Cloud::AlloyDB::V1::InjectFaultRequest::FaultType] # Required. The type of fault to be injected in an instance. # @param name [::String] # Required. The name of the resource. For the required format, see the # comment on the Instance.name field. # @param request_id [::String] # Optional. An optional request ID to identify requests. Specify a unique # request ID so that if you must retry your request, the server will know to # ignore the request if it has already been completed. The server will # guarantee that for at least 60 minutes after the first request. # # For example, consider a situation where you make an initial request and # the request times out. If you make the request again with the same request # ID, the server can check if original operation with the same request ID # was received, and if so, will ignore the second request. This prevents # clients from accidentally creating duplicate commitments. # # The request ID must be a valid UUID with the exception that zero UUID is # not supported (00000000-0000-0000-0000-000000000000). # @param validate_only [::Boolean] # Optional. If set, performs request validation (e.g. permission checks and # any other type of validation), but do not actually execute the fault # injection. # @yield [result, operation] Access the result along with the TransportOperation object # @yieldparam result [::Gapic::Operation] # @yieldparam operation [::Gapic::Rest::TransportOperation] # # @return [::Gapic::Operation] # # @raise [::Google::Cloud::Error] if the REST call is aborted. # # @example Basic example # require "google/cloud/alloy_db/v1" # # # Create a client object. The client can be reused for multiple calls. # client = Google::Cloud::AlloyDB::V1::AlloyDBAdmin::Rest::Client.new # # # Create a request. To set request fields, pass in keyword arguments. # request = Google::Cloud::AlloyDB::V1::InjectFaultRequest.new # # # Call the inject_fault method. # result = client.inject_fault request # # # The returned object is of type Gapic::Operation. You can use it to # # check the status of an operation, cancel it, or wait for results. # # Here is how to wait for a response. # result.wait_until_done! timeout: 60 # if result.response? # p result.response # else # puts "No response received." # end # def inject_fault request, options = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::AlloyDB::V1::InjectFaultRequest # Converts hash and nil to an options object options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h # Customize the options with defaults call_metadata = @config.rpcs.inject_fault.metadata.to_h # Set x-goog-api-client and x-goog-user-project headers call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::AlloyDB::V1::VERSION, transports_version_send: [:rest] call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id options.apply_defaults timeout: @config.rpcs.inject_fault.timeout, metadata: call_metadata, retry_policy: @config.rpcs.inject_fault.retry_policy options.apply_defaults timeout: @config.timeout, metadata: @config.metadata, retry_policy: @config.retry_policy @alloy_db_admin_stub.inject_fault request, options do |result, operation| result = ::Gapic::Operation.new result, @operations_client, options: options yield result, operation if block_given? return result end rescue ::Gapic::Rest::Error => e raise ::Google::Cloud::Error.from_error(e) end ## # Restart an Instance in a cluster. # Imperative only. # # @overload restart_instance(request, options = nil) # Pass arguments to `restart_instance` via a request object, either of type # {::Google::Cloud::AlloyDB::V1::RestartInstanceRequest} or an equivalent Hash. # # @param request [::Google::Cloud::AlloyDB::V1::RestartInstanceRequest, ::Hash] # A request object representing the call parameters. Required. To specify no # parameters, or to keep all the default parameter values, pass an empty Hash. # @param options [::Gapic::CallOptions, ::Hash] # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. # # @overload restart_instance(name: nil, request_id: nil, validate_only: nil) # Pass arguments to `restart_instance` via keyword arguments. Note that at # least one keyword argument is required. To specify no parameters, or to keep all # the default parameter values, pass an empty Hash as a request object (see above). # # @param name [::String] # Required. The name of the resource. For the required format, see the # comment on the Instance.name field. # @param request_id [::String] # Optional. An optional request ID to identify requests. Specify a unique # request ID so that if you must retry your request, the server will know to # ignore the request if it has already been completed. The server will # guarantee that for at least 60 minutes after the first request. # # For example, consider a situation where you make an initial request and # the request times out. If you make the request again with the same request # ID, the server can check if original operation with the same request ID # was received, and if so, will ignore the second request. This prevents # clients from accidentally creating duplicate commitments. # # The request ID must be a valid UUID with the exception that zero UUID is # not supported (00000000-0000-0000-0000-000000000000). # @param validate_only [::Boolean] # Optional. If set, performs request validation (e.g. permission checks and # any other type of validation), but do not actually execute the restart. # @yield [result, operation] Access the result along with the TransportOperation object # @yieldparam result [::Gapic::Operation] # @yieldparam operation [::Gapic::Rest::TransportOperation] # # @return [::Gapic::Operation] # # @raise [::Google::Cloud::Error] if the REST call is aborted. # # @example Basic example # require "google/cloud/alloy_db/v1" # # # Create a client object. The client can be reused for multiple calls. # client = Google::Cloud::AlloyDB::V1::AlloyDBAdmin::Rest::Client.new # # # Create a request. To set request fields, pass in keyword arguments. # request = Google::Cloud::AlloyDB::V1::RestartInstanceRequest.new # # # Call the restart_instance method. # result = client.restart_instance request # # # The returned object is of type Gapic::Operation. You can use it to # # check the status of an operation, cancel it, or wait for results. # # Here is how to wait for a response. # result.wait_until_done! timeout: 60 # if result.response? # p result.response # else # puts "No response received." # end # def restart_instance request, options = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::AlloyDB::V1::RestartInstanceRequest # Converts hash and nil to an options object options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h # Customize the options with defaults call_metadata = @config.rpcs.restart_instance.metadata.to_h # Set x-goog-api-client and x-goog-user-project headers call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::AlloyDB::V1::VERSION, transports_version_send: [:rest] call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id options.apply_defaults timeout: @config.rpcs.restart_instance.timeout, metadata: call_metadata, retry_policy: @config.rpcs.restart_instance.retry_policy options.apply_defaults timeout: @config.timeout, metadata: @config.metadata, retry_policy: @config.retry_policy @alloy_db_admin_stub.restart_instance request, options do |result, operation| result = ::Gapic::Operation.new result, @operations_client, options: options yield result, operation if block_given? return result end rescue ::Gapic::Rest::Error => e raise ::Google::Cloud::Error.from_error(e) end ## # Lists Backups in a given project and location. # # @overload list_backups(request, options = nil) # Pass arguments to `list_backups` via a request object, either of type # {::Google::Cloud::AlloyDB::V1::ListBackupsRequest} or an equivalent Hash. # # @param request [::Google::Cloud::AlloyDB::V1::ListBackupsRequest, ::Hash] # A request object representing the call parameters. Required. To specify no # parameters, or to keep all the default parameter values, pass an empty Hash. # @param options [::Gapic::CallOptions, ::Hash] # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. # # @overload list_backups(parent: nil, page_size: nil, page_token: nil, filter: nil, order_by: nil) # Pass arguments to `list_backups` via keyword arguments. Note that at # least one keyword argument is required. To specify no parameters, or to keep all # the default parameter values, pass an empty Hash as a request object (see above). # # @param parent [::String] # Required. Parent value for ListBackupsRequest # @param page_size [::Integer] # Requested page size. Server may return fewer items than requested. # If unspecified, server will pick an appropriate default. # @param page_token [::String] # A token identifying a page of results the server should return. # @param filter [::String] # Filtering results # @param order_by [::String] # Hint for how to order the results # @yield [result, operation] Access the result along with the TransportOperation object # @yieldparam result [::Google::Cloud::AlloyDB::V1::ListBackupsResponse] # @yieldparam operation [::Gapic::Rest::TransportOperation] # # @return [::Google::Cloud::AlloyDB::V1::ListBackupsResponse] # # @raise [::Google::Cloud::Error] if the REST call is aborted. # # @example Basic example # require "google/cloud/alloy_db/v1" # # # Create a client object. The client can be reused for multiple calls. # client = Google::Cloud::AlloyDB::V1::AlloyDBAdmin::Rest::Client.new # # # Create a request. To set request fields, pass in keyword arguments. # request = Google::Cloud::AlloyDB::V1::ListBackupsRequest.new # # # Call the list_backups method. # result = client.list_backups request # # # The returned object is of type Gapic::PagedEnumerable. You can iterate # # over elements, and API calls will be issued to fetch pages as needed. # result.each do |item| # # Each element is of type ::Google::Cloud::AlloyDB::V1::Backup. # p item # end # def list_backups request, options = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::AlloyDB::V1::ListBackupsRequest # Converts hash and nil to an options object options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h # Customize the options with defaults call_metadata = @config.rpcs.list_backups.metadata.to_h # Set x-goog-api-client and x-goog-user-project headers call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::AlloyDB::V1::VERSION, transports_version_send: [:rest] call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id options.apply_defaults timeout: @config.rpcs.list_backups.timeout, metadata: call_metadata, retry_policy: @config.rpcs.list_backups.retry_policy options.apply_defaults timeout: @config.timeout, metadata: @config.metadata, retry_policy: @config.retry_policy @alloy_db_admin_stub.list_backups request, options do |result, operation| yield result, operation if block_given? return result end rescue ::Gapic::Rest::Error => e raise ::Google::Cloud::Error.from_error(e) end ## # Gets details of a single Backup. # # @overload get_backup(request, options = nil) # Pass arguments to `get_backup` via a request object, either of type # {::Google::Cloud::AlloyDB::V1::GetBackupRequest} or an equivalent Hash. # # @param request [::Google::Cloud::AlloyDB::V1::GetBackupRequest, ::Hash] # A request object representing the call parameters. Required. To specify no # parameters, or to keep all the default parameter values, pass an empty Hash. # @param options [::Gapic::CallOptions, ::Hash] # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. # # @overload get_backup(name: nil) # Pass arguments to `get_backup` via keyword arguments. Note that at # least one keyword argument is required. To specify no parameters, or to keep all # the default parameter values, pass an empty Hash as a request object (see above). # # @param name [::String] # Required. Name of the resource # @yield [result, operation] Access the result along with the TransportOperation object # @yieldparam result [::Google::Cloud::AlloyDB::V1::Backup] # @yieldparam operation [::Gapic::Rest::TransportOperation] # # @return [::Google::Cloud::AlloyDB::V1::Backup] # # @raise [::Google::Cloud::Error] if the REST call is aborted. # # @example Basic example # require "google/cloud/alloy_db/v1" # # # Create a client object. The client can be reused for multiple calls. # client = Google::Cloud::AlloyDB::V1::AlloyDBAdmin::Rest::Client.new # # # Create a request. To set request fields, pass in keyword arguments. # request = Google::Cloud::AlloyDB::V1::GetBackupRequest.new # # # Call the get_backup method. # result = client.get_backup request # # # The returned object is of type Google::Cloud::AlloyDB::V1::Backup. # p result # def get_backup request, options = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::AlloyDB::V1::GetBackupRequest # Converts hash and nil to an options object options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h # Customize the options with defaults call_metadata = @config.rpcs.get_backup.metadata.to_h # Set x-goog-api-client and x-goog-user-project headers call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::AlloyDB::V1::VERSION, transports_version_send: [:rest] call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id options.apply_defaults timeout: @config.rpcs.get_backup.timeout, metadata: call_metadata, retry_policy: @config.rpcs.get_backup.retry_policy options.apply_defaults timeout: @config.timeout, metadata: @config.metadata, retry_policy: @config.retry_policy @alloy_db_admin_stub.get_backup request, options do |result, operation| yield result, operation if block_given? return result end rescue ::Gapic::Rest::Error => e raise ::Google::Cloud::Error.from_error(e) end ## # Creates a new Backup in a given project and location. # # @overload create_backup(request, options = nil) # Pass arguments to `create_backup` via a request object, either of type # {::Google::Cloud::AlloyDB::V1::CreateBackupRequest} or an equivalent Hash. # # @param request [::Google::Cloud::AlloyDB::V1::CreateBackupRequest, ::Hash] # A request object representing the call parameters. Required. To specify no # parameters, or to keep all the default parameter values, pass an empty Hash. # @param options [::Gapic::CallOptions, ::Hash] # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. # # @overload create_backup(parent: nil, backup_id: nil, backup: nil, request_id: nil, validate_only: nil) # Pass arguments to `create_backup` via keyword arguments. Note that at # least one keyword argument is required. To specify no parameters, or to keep all # the default parameter values, pass an empty Hash as a request object (see above). # # @param parent [::String] # Required. Value for parent. # @param backup_id [::String] # Required. ID of the requesting object. # @param backup [::Google::Cloud::AlloyDB::V1::Backup, ::Hash] # Required. The resource being created # @param request_id [::String] # Optional. An optional request ID to identify requests. Specify a unique # request ID so that if you must retry your request, the server will know to # ignore the request if it has already been completed. The server will # guarantee that for at least 60 minutes since the first request. # # For example, consider a situation where you make an initial request and # the request times out. If you make the request again with the same request # ID, the server can check if original operation with the same request ID # was received, and if so, will ignore the second request. This prevents # clients from accidentally creating duplicate commitments. # # The request ID must be a valid UUID with the exception that zero UUID is # not supported (00000000-0000-0000-0000-000000000000). # @param validate_only [::Boolean] # Optional. If set, the backend validates the request, but doesn't actually # execute it. # @yield [result, operation] Access the result along with the TransportOperation object # @yieldparam result [::Gapic::Operation] # @yieldparam operation [::Gapic::Rest::TransportOperation] # # @return [::Gapic::Operation] # # @raise [::Google::Cloud::Error] if the REST call is aborted. # # @example Basic example # require "google/cloud/alloy_db/v1" # # # Create a client object. The client can be reused for multiple calls. # client = Google::Cloud::AlloyDB::V1::AlloyDBAdmin::Rest::Client.new # # # Create a request. To set request fields, pass in keyword arguments. # request = Google::Cloud::AlloyDB::V1::CreateBackupRequest.new # # # Call the create_backup method. # result = client.create_backup request # # # The returned object is of type Gapic::Operation. You can use it to # # check the status of an operation, cancel it, or wait for results. # # Here is how to wait for a response. # result.wait_until_done! timeout: 60 # if result.response? # p result.response # else # puts "No response received." # end # def create_backup request, options = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::AlloyDB::V1::CreateBackupRequest # Converts hash and nil to an options object options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h # Customize the options with defaults call_metadata = @config.rpcs.create_backup.metadata.to_h # Set x-goog-api-client and x-goog-user-project headers call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::AlloyDB::V1::VERSION, transports_version_send: [:rest] call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id options.apply_defaults timeout: @config.rpcs.create_backup.timeout, metadata: call_metadata, retry_policy: @config.rpcs.create_backup.retry_policy options.apply_defaults timeout: @config.timeout, metadata: @config.metadata, retry_policy: @config.retry_policy @alloy_db_admin_stub.create_backup request, options do |result, operation| result = ::Gapic::Operation.new result, @operations_client, options: options yield result, operation if block_given? return result end rescue ::Gapic::Rest::Error => e raise ::Google::Cloud::Error.from_error(e) end ## # Updates the parameters of a single Backup. # # @overload update_backup(request, options = nil) # Pass arguments to `update_backup` via a request object, either of type # {::Google::Cloud::AlloyDB::V1::UpdateBackupRequest} or an equivalent Hash. # # @param request [::Google::Cloud::AlloyDB::V1::UpdateBackupRequest, ::Hash] # A request object representing the call parameters. Required. To specify no # parameters, or to keep all the default parameter values, pass an empty Hash. # @param options [::Gapic::CallOptions, ::Hash] # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. # # @overload update_backup(update_mask: nil, backup: nil, request_id: nil, validate_only: nil, allow_missing: nil) # Pass arguments to `update_backup` via keyword arguments. Note that at # least one keyword argument is required. To specify no parameters, or to keep all # the default parameter values, pass an empty Hash as a request object (see above). # # @param update_mask [::Google::Protobuf::FieldMask, ::Hash] # Optional. Field mask is used to specify the fields to be overwritten in the # Backup resource by the update. # The fields specified in the update_mask are relative to the resource, not # the full request. A field will be overwritten if it is in the mask. If the # user does not provide a mask then all fields will be overwritten. # @param backup [::Google::Cloud::AlloyDB::V1::Backup, ::Hash] # Required. The resource being updated # @param request_id [::String] # Optional. An optional request ID to identify requests. Specify a unique # request ID so that if you must retry your request, the server will know to # ignore the request if it has already been completed. The server will # guarantee that for at least 60 minutes since the first request. # # For example, consider a situation where you make an initial request and # the request times out. If you make the request again with the same request # ID, the server can check if original operation with the same request ID # was received, and if so, will ignore the second request. This prevents # clients from accidentally creating duplicate commitments. # # The request ID must be a valid UUID with the exception that zero UUID is # not supported (00000000-0000-0000-0000-000000000000). # @param validate_only [::Boolean] # Optional. If set, the backend validates the request, but doesn't actually # execute it. # @param allow_missing [::Boolean] # Optional. If set to true, update succeeds even if instance is not found. In # that case, a new backup is created and `update_mask` is ignored. # @yield [result, operation] Access the result along with the TransportOperation object # @yieldparam result [::Gapic::Operation] # @yieldparam operation [::Gapic::Rest::TransportOperation] # # @return [::Gapic::Operation] # # @raise [::Google::Cloud::Error] if the REST call is aborted. # # @example Basic example # require "google/cloud/alloy_db/v1" # # # Create a client object. The client can be reused for multiple calls. # client = Google::Cloud::AlloyDB::V1::AlloyDBAdmin::Rest::Client.new # # # Create a request. To set request fields, pass in keyword arguments. # request = Google::Cloud::AlloyDB::V1::UpdateBackupRequest.new # # # Call the update_backup method. # result = client.update_backup request # # # The returned object is of type Gapic::Operation. You can use it to # # check the status of an operation, cancel it, or wait for results. # # Here is how to wait for a response. # result.wait_until_done! timeout: 60 # if result.response? # p result.response # else # puts "No response received." # end # def update_backup request, options = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::AlloyDB::V1::UpdateBackupRequest # Converts hash and nil to an options object options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h # Customize the options with defaults call_metadata = @config.rpcs.update_backup.metadata.to_h # Set x-goog-api-client and x-goog-user-project headers call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::AlloyDB::V1::VERSION, transports_version_send: [:rest] call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id options.apply_defaults timeout: @config.rpcs.update_backup.timeout, metadata: call_metadata, retry_policy: @config.rpcs.update_backup.retry_policy options.apply_defaults timeout: @config.timeout, metadata: @config.metadata, retry_policy: @config.retry_policy @alloy_db_admin_stub.update_backup request, options do |result, operation| result = ::Gapic::Operation.new result, @operations_client, options: options yield result, operation if block_given? return result end rescue ::Gapic::Rest::Error => e raise ::Google::Cloud::Error.from_error(e) end ## # Deletes a single Backup. # # @overload delete_backup(request, options = nil) # Pass arguments to `delete_backup` via a request object, either of type # {::Google::Cloud::AlloyDB::V1::DeleteBackupRequest} or an equivalent Hash. # # @param request [::Google::Cloud::AlloyDB::V1::DeleteBackupRequest, ::Hash] # A request object representing the call parameters. Required. To specify no # parameters, or to keep all the default parameter values, pass an empty Hash. # @param options [::Gapic::CallOptions, ::Hash] # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. # # @overload delete_backup(name: nil, request_id: nil, validate_only: nil, etag: nil) # Pass arguments to `delete_backup` via keyword arguments. Note that at # least one keyword argument is required. To specify no parameters, or to keep all # the default parameter values, pass an empty Hash as a request object (see above). # # @param name [::String] # Required. Name of the resource. For the required format, see the comment on # the Backup.name field. # @param request_id [::String] # Optional. An optional request ID to identify requests. Specify a unique # request ID so that if you must retry your request, the server will know to # ignore the request if it has already been completed. The server will # guarantee that for at least 60 minutes after the first request. # # For example, consider a situation where you make an initial request and # the request times out. If you make the request again with the same request # ID, the server can check if original operation with the same request ID # was received, and if so, will ignore the second request. This prevents # clients from accidentally creating duplicate commitments. # # The request ID must be a valid UUID with the exception that zero UUID is # not supported (00000000-0000-0000-0000-000000000000). # @param validate_only [::Boolean] # Optional. If set, the backend validates the request, but doesn't actually # execute it. # @param etag [::String] # Optional. The current etag of the Backup. # If an etag is provided and does not match the current etag of the Backup, # deletion will be blocked and an ABORTED error will be returned. # @yield [result, operation] Access the result along with the TransportOperation object # @yieldparam result [::Gapic::Operation] # @yieldparam operation [::Gapic::Rest::TransportOperation] # # @return [::Gapic::Operation] # # @raise [::Google::Cloud::Error] if the REST call is aborted. # # @example Basic example # require "google/cloud/alloy_db/v1" # # # Create a client object. The client can be reused for multiple calls. # client = Google::Cloud::AlloyDB::V1::AlloyDBAdmin::Rest::Client.new # # # Create a request. To set request fields, pass in keyword arguments. # request = Google::Cloud::AlloyDB::V1::DeleteBackupRequest.new # # # Call the delete_backup method. # result = client.delete_backup request # # # The returned object is of type Gapic::Operation. You can use it to # # check the status of an operation, cancel it, or wait for results. # # Here is how to wait for a response. # result.wait_until_done! timeout: 60 # if result.response? # p result.response # else # puts "No response received." # end # def delete_backup request, options = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::AlloyDB::V1::DeleteBackupRequest # Converts hash and nil to an options object options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h # Customize the options with defaults call_metadata = @config.rpcs.delete_backup.metadata.to_h # Set x-goog-api-client and x-goog-user-project headers call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::AlloyDB::V1::VERSION, transports_version_send: [:rest] call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id options.apply_defaults timeout: @config.rpcs.delete_backup.timeout, metadata: call_metadata, retry_policy: @config.rpcs.delete_backup.retry_policy options.apply_defaults timeout: @config.timeout, metadata: @config.metadata, retry_policy: @config.retry_policy @alloy_db_admin_stub.delete_backup request, options do |result, operation| result = ::Gapic::Operation.new result, @operations_client, options: options yield result, operation if block_given? return result end rescue ::Gapic::Rest::Error => e raise ::Google::Cloud::Error.from_error(e) end ## # Lists SupportedDatabaseFlags for a given project and location. # # @overload list_supported_database_flags(request, options = nil) # Pass arguments to `list_supported_database_flags` via a request object, either of type # {::Google::Cloud::AlloyDB::V1::ListSupportedDatabaseFlagsRequest} or an equivalent Hash. # # @param request [::Google::Cloud::AlloyDB::V1::ListSupportedDatabaseFlagsRequest, ::Hash] # A request object representing the call parameters. Required. To specify no # parameters, or to keep all the default parameter values, pass an empty Hash. # @param options [::Gapic::CallOptions, ::Hash] # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. # # @overload list_supported_database_flags(parent: nil, page_size: nil, page_token: nil) # Pass arguments to `list_supported_database_flags` via keyword arguments. Note that at # least one keyword argument is required. To specify no parameters, or to keep all # the default parameter values, pass an empty Hash as a request object (see above). # # @param parent [::String] # Required. The name of the parent resource. The required format is: # * projects/\\{project}/locations/\\{location} # # Regardless of the parent specified here, as long it is contains a valid # project and location, the service will return a static list of supported # flags resources. Note that we do not yet support region-specific # flags. # @param page_size [::Integer] # Requested page size. Server may return fewer items than requested. # If unspecified, server will pick an appropriate default. # @param page_token [::String] # A token identifying a page of results the server should return. # @yield [result, operation] Access the result along with the TransportOperation object # @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Cloud::AlloyDB::V1::SupportedDatabaseFlag>] # @yieldparam operation [::Gapic::Rest::TransportOperation] # # @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::AlloyDB::V1::SupportedDatabaseFlag>] # # @raise [::Google::Cloud::Error] if the REST call is aborted. # # @example Basic example # require "google/cloud/alloy_db/v1" # # # Create a client object. The client can be reused for multiple calls. # client = Google::Cloud::AlloyDB::V1::AlloyDBAdmin::Rest::Client.new # # # Create a request. To set request fields, pass in keyword arguments. # request = Google::Cloud::AlloyDB::V1::ListSupportedDatabaseFlagsRequest.new # # # Call the list_supported_database_flags method. # result = client.list_supported_database_flags request # # # The returned object is of type Gapic::PagedEnumerable. You can iterate # # over elements, and API calls will be issued to fetch pages as needed. # result.each do |item| # # Each element is of type ::Google::Cloud::AlloyDB::V1::SupportedDatabaseFlag. # p item # end # def list_supported_database_flags request, options = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::AlloyDB::V1::ListSupportedDatabaseFlagsRequest # Converts hash and nil to an options object options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h # Customize the options with defaults call_metadata = @config.rpcs.list_supported_database_flags.metadata.to_h # Set x-goog-api-client and x-goog-user-project headers call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::AlloyDB::V1::VERSION, transports_version_send: [:rest] call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id options.apply_defaults timeout: @config.rpcs.list_supported_database_flags.timeout, metadata: call_metadata, retry_policy: @config.rpcs.list_supported_database_flags.retry_policy options.apply_defaults timeout: @config.timeout, metadata: @config.metadata, retry_policy: @config.retry_policy @alloy_db_admin_stub.list_supported_database_flags request, options do |result, operation| result = ::Gapic::Rest::PagedEnumerable.new @alloy_db_admin_stub, :list_supported_database_flags, "supported_database_flags", request, result, options yield result, operation if block_given? return result end rescue ::Gapic::Rest::Error => e raise ::Google::Cloud::Error.from_error(e) end ## # Generate a client certificate signed by a Cluster CA. # The sole purpose of this endpoint is to support AlloyDB connectors and the # Auth Proxy client. The endpoint's behavior is subject to change without # notice, so do not rely on its behavior remaining constant. Future changes # will not break AlloyDB connectors or the Auth Proxy client. # # @overload generate_client_certificate(request, options = nil) # Pass arguments to `generate_client_certificate` via a request object, either of type # {::Google::Cloud::AlloyDB::V1::GenerateClientCertificateRequest} or an equivalent Hash. # # @param request [::Google::Cloud::AlloyDB::V1::GenerateClientCertificateRequest, ::Hash] # A request object representing the call parameters. Required. To specify no # parameters, or to keep all the default parameter values, pass an empty Hash. # @param options [::Gapic::CallOptions, ::Hash] # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. # # @overload generate_client_certificate(parent: nil, request_id: nil, cert_duration: nil, public_key: nil, use_metadata_exchange: nil) # Pass arguments to `generate_client_certificate` via keyword arguments. Note that at # least one keyword argument is required. To specify no parameters, or to keep all # the default parameter values, pass an empty Hash as a request object (see above). # # @param parent [::String] # Required. The name of the parent resource. The required format is: # * projects/\\{project}/locations/\\{location}/clusters/\\{cluster} # @param request_id [::String] # Optional. An optional request ID to identify requests. Specify a unique # request ID so that if you must retry your request, the server will know to # ignore the request if it has already been completed. The server will # guarantee that for at least 60 minutes after the first request. # # For example, consider a situation where you make an initial request and # the request times out. If you make the request again with the same request # ID, the server can check if original operation with the same request ID # was received, and if so, will ignore the second request. This prevents # clients from accidentally creating duplicate commitments. # # The request ID must be a valid UUID with the exception that zero UUID is # not supported (00000000-0000-0000-0000-000000000000). # @param cert_duration [::Google::Protobuf::Duration, ::Hash] # Optional. An optional hint to the endpoint to generate the client # certificate with the requested duration. The duration can be from 1 hour to # 24 hours. The endpoint may or may not honor the hint. If the hint is left # unspecified or is not honored, then the endpoint will pick an appropriate # default duration. # @param public_key [::String] # Optional. The public key from the client. # @param use_metadata_exchange [::Boolean] # Optional. An optional hint to the endpoint to generate a client # ceritificate that can be used by AlloyDB connectors to exchange additional # metadata with the server after TLS handshake. # @yield [result, operation] Access the result along with the TransportOperation object # @yieldparam result [::Google::Cloud::AlloyDB::V1::GenerateClientCertificateResponse] # @yieldparam operation [::Gapic::Rest::TransportOperation] # # @return [::Google::Cloud::AlloyDB::V1::GenerateClientCertificateResponse] # # @raise [::Google::Cloud::Error] if the REST call is aborted. # # @example Basic example # require "google/cloud/alloy_db/v1" # # # Create a client object. The client can be reused for multiple calls. # client = Google::Cloud::AlloyDB::V1::AlloyDBAdmin::Rest::Client.new # # # Create a request. To set request fields, pass in keyword arguments. # request = Google::Cloud::AlloyDB::V1::GenerateClientCertificateRequest.new # # # Call the generate_client_certificate method. # result = client.generate_client_certificate request # # # The returned object is of type Google::Cloud::AlloyDB::V1::GenerateClientCertificateResponse. # p result # def generate_client_certificate request, options = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::AlloyDB::V1::GenerateClientCertificateRequest # Converts hash and nil to an options object options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h # Customize the options with defaults call_metadata = @config.rpcs.generate_client_certificate.metadata.to_h # Set x-goog-api-client and x-goog-user-project headers call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::AlloyDB::V1::VERSION, transports_version_send: [:rest] call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id options.apply_defaults timeout: @config.rpcs.generate_client_certificate.timeout, metadata: call_metadata, retry_policy: @config.rpcs.generate_client_certificate.retry_policy options.apply_defaults timeout: @config.timeout, metadata: @config.metadata, retry_policy: @config.retry_policy @alloy_db_admin_stub.generate_client_certificate request, options do |result, operation| yield result, operation if block_given? return result end rescue ::Gapic::Rest::Error => e raise ::Google::Cloud::Error.from_error(e) end ## # Get instance metadata used for a connection. # # @overload get_connection_info(request, options = nil) # Pass arguments to `get_connection_info` via a request object, either of type # {::Google::Cloud::AlloyDB::V1::GetConnectionInfoRequest} or an equivalent Hash. # # @param request [::Google::Cloud::AlloyDB::V1::GetConnectionInfoRequest, ::Hash] # A request object representing the call parameters. Required. To specify no # parameters, or to keep all the default parameter values, pass an empty Hash. # @param options [::Gapic::CallOptions, ::Hash] # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. # # @overload get_connection_info(parent: nil, request_id: nil) # Pass arguments to `get_connection_info` via keyword arguments. Note that at # least one keyword argument is required. To specify no parameters, or to keep all # the default parameter values, pass an empty Hash as a request object (see above). # # @param parent [::String] # Required. The name of the parent resource. The required format is: # projects/\\{project}/locations/\\{location}/clusters/\\{cluster}/instances/\\{instance} # @param request_id [::String] # Optional. An optional request ID to identify requests. Specify a unique # request ID so that if you must retry your request, the server will know to # ignore the request if it has already been completed. The server will # guarantee that for at least 60 minutes after the first request. # # For example, consider a situation where you make an initial request and # the request times out. If you make the request again with the same request # ID, the server can check if original operation with the same request ID # was received, and if so, will ignore the second request. This prevents # clients from accidentally creating duplicate commitments. # # The request ID must be a valid UUID with the exception that zero UUID is # not supported (00000000-0000-0000-0000-000000000000). # @yield [result, operation] Access the result along with the TransportOperation object # @yieldparam result [::Google::Cloud::AlloyDB::V1::ConnectionInfo] # @yieldparam operation [::Gapic::Rest::TransportOperation] # # @return [::Google::Cloud::AlloyDB::V1::ConnectionInfo] # # @raise [::Google::Cloud::Error] if the REST call is aborted. # # @example Basic example # require "google/cloud/alloy_db/v1" # # # Create a client object. The client can be reused for multiple calls. # client = Google::Cloud::AlloyDB::V1::AlloyDBAdmin::Rest::Client.new # # # Create a request. To set request fields, pass in keyword arguments. # request = Google::Cloud::AlloyDB::V1::GetConnectionInfoRequest.new # # # Call the get_connection_info method. # result = client.get_connection_info request # # # The returned object is of type Google::Cloud::AlloyDB::V1::ConnectionInfo. # p result # def get_connection_info request, options = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::AlloyDB::V1::GetConnectionInfoRequest # Converts hash and nil to an options object options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h # Customize the options with defaults call_metadata = @config.rpcs.get_connection_info.metadata.to_h # Set x-goog-api-client and x-goog-user-project headers call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::AlloyDB::V1::VERSION, transports_version_send: [:rest] call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id options.apply_defaults timeout: @config.rpcs.get_connection_info.timeout, metadata: call_metadata, retry_policy: @config.rpcs.get_connection_info.retry_policy options.apply_defaults timeout: @config.timeout, metadata: @config.metadata, retry_policy: @config.retry_policy @alloy_db_admin_stub.get_connection_info request, options do |result, operation| yield result, operation if block_given? return result end rescue ::Gapic::Rest::Error => e raise ::Google::Cloud::Error.from_error(e) end ## # Lists Users in a given project and location. # # @overload list_users(request, options = nil) # Pass arguments to `list_users` via a request object, either of type # {::Google::Cloud::AlloyDB::V1::ListUsersRequest} or an equivalent Hash. # # @param request [::Google::Cloud::AlloyDB::V1::ListUsersRequest, ::Hash] # A request object representing the call parameters. Required. To specify no # parameters, or to keep all the default parameter values, pass an empty Hash. # @param options [::Gapic::CallOptions, ::Hash] # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. # # @overload list_users(parent: nil, page_size: nil, page_token: nil, filter: nil, order_by: nil) # Pass arguments to `list_users` via keyword arguments. Note that at # least one keyword argument is required. To specify no parameters, or to keep all # the default parameter values, pass an empty Hash as a request object (see above). # # @param parent [::String] # Required. Parent value for ListUsersRequest # @param page_size [::Integer] # Optional. Requested page size. Server may return fewer items than # requested. If unspecified, server will pick an appropriate default. # @param page_token [::String] # Optional. A token identifying a page of results the server should return. # @param filter [::String] # Optional. Filtering results # @param order_by [::String] # Optional. Hint for how to order the results # @yield [result, operation] Access the result along with the TransportOperation object # @yieldparam result [::Google::Cloud::AlloyDB::V1::ListUsersResponse] # @yieldparam operation [::Gapic::Rest::TransportOperation] # # @return [::Google::Cloud::AlloyDB::V1::ListUsersResponse] # # @raise [::Google::Cloud::Error] if the REST call is aborted. # # @example Basic example # require "google/cloud/alloy_db/v1" # # # Create a client object. The client can be reused for multiple calls. # client = Google::Cloud::AlloyDB::V1::AlloyDBAdmin::Rest::Client.new # # # Create a request. To set request fields, pass in keyword arguments. # request = Google::Cloud::AlloyDB::V1::ListUsersRequest.new # # # Call the list_users method. # result = client.list_users request # # # The returned object is of type Gapic::PagedEnumerable. You can iterate # # over elements, and API calls will be issued to fetch pages as needed. # result.each do |item| # # Each element is of type ::Google::Cloud::AlloyDB::V1::User. # p item # end # def list_users request, options = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::AlloyDB::V1::ListUsersRequest # Converts hash and nil to an options object options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h # Customize the options with defaults call_metadata = @config.rpcs.list_users.metadata.to_h # Set x-goog-api-client and x-goog-user-project headers call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::AlloyDB::V1::VERSION, transports_version_send: [:rest] call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id options.apply_defaults timeout: @config.rpcs.list_users.timeout, metadata: call_metadata, retry_policy: @config.rpcs.list_users.retry_policy options.apply_defaults timeout: @config.timeout, metadata: @config.metadata, retry_policy: @config.retry_policy @alloy_db_admin_stub.list_users request, options do |result, operation| yield result, operation if block_given? return result end rescue ::Gapic::Rest::Error => e raise ::Google::Cloud::Error.from_error(e) end ## # Gets details of a single User. # # @overload get_user(request, options = nil) # Pass arguments to `get_user` via a request object, either of type # {::Google::Cloud::AlloyDB::V1::GetUserRequest} or an equivalent Hash. # # @param request [::Google::Cloud::AlloyDB::V1::GetUserRequest, ::Hash] # A request object representing the call parameters. Required. To specify no # parameters, or to keep all the default parameter values, pass an empty Hash. # @param options [::Gapic::CallOptions, ::Hash] # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. # # @overload get_user(name: nil) # Pass arguments to `get_user` via keyword arguments. Note that at # least one keyword argument is required. To specify no parameters, or to keep all # the default parameter values, pass an empty Hash as a request object (see above). # # @param name [::String] # Required. The name of the resource. For the required format, see the # comment on the User.name field. # @yield [result, operation] Access the result along with the TransportOperation object # @yieldparam result [::Google::Cloud::AlloyDB::V1::User] # @yieldparam operation [::Gapic::Rest::TransportOperation] # # @return [::Google::Cloud::AlloyDB::V1::User] # # @raise [::Google::Cloud::Error] if the REST call is aborted. # # @example Basic example # require "google/cloud/alloy_db/v1" # # # Create a client object. The client can be reused for multiple calls. # client = Google::Cloud::AlloyDB::V1::AlloyDBAdmin::Rest::Client.new # # # Create a request. To set request fields, pass in keyword arguments. # request = Google::Cloud::AlloyDB::V1::GetUserRequest.new # # # Call the get_user method. # result = client.get_user request # # # The returned object is of type Google::Cloud::AlloyDB::V1::User. # p result # def get_user request, options = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::AlloyDB::V1::GetUserRequest # Converts hash and nil to an options object options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h # Customize the options with defaults call_metadata = @config.rpcs.get_user.metadata.to_h # Set x-goog-api-client and x-goog-user-project headers call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::AlloyDB::V1::VERSION, transports_version_send: [:rest] call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id options.apply_defaults timeout: @config.rpcs.get_user.timeout, metadata: call_metadata, retry_policy: @config.rpcs.get_user.retry_policy options.apply_defaults timeout: @config.timeout, metadata: @config.metadata, retry_policy: @config.retry_policy @alloy_db_admin_stub.get_user request, options do |result, operation| yield result, operation if block_given? return result end rescue ::Gapic::Rest::Error => e raise ::Google::Cloud::Error.from_error(e) end ## # Creates a new User in a given project, location, and cluster. # # @overload create_user(request, options = nil) # Pass arguments to `create_user` via a request object, either of type # {::Google::Cloud::AlloyDB::V1::CreateUserRequest} or an equivalent Hash. # # @param request [::Google::Cloud::AlloyDB::V1::CreateUserRequest, ::Hash] # A request object representing the call parameters. Required. To specify no # parameters, or to keep all the default parameter values, pass an empty Hash. # @param options [::Gapic::CallOptions, ::Hash] # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. # # @overload create_user(parent: nil, user_id: nil, user: nil, request_id: nil, validate_only: nil) # Pass arguments to `create_user` via keyword arguments. Note that at # least one keyword argument is required. To specify no parameters, or to keep all # the default parameter values, pass an empty Hash as a request object (see above). # # @param parent [::String] # Required. Value for parent. # @param user_id [::String] # Required. ID of the requesting object. # @param user [::Google::Cloud::AlloyDB::V1::User, ::Hash] # Required. The resource being created # @param request_id [::String] # Optional. An optional request ID to identify requests. Specify a unique # request ID so that if you must retry your request, the server will know to # ignore the request if it has already been completed. The server will # guarantee that for at least 60 minutes since the first request. # # For example, consider a situation where you make an initial request and # the request times out. If you make the request again with the same request # ID, the server can check if original operation with the same request ID # was received, and if so, will ignore the second request. This prevents # clients from accidentally creating duplicate commitments. # # The request ID must be a valid UUID with the exception that zero UUID is # not supported (00000000-0000-0000-0000-000000000000). # @param validate_only [::Boolean] # Optional. If set, the backend validates the request, but doesn't actually # execute it. # @yield [result, operation] Access the result along with the TransportOperation object # @yieldparam result [::Google::Cloud::AlloyDB::V1::User] # @yieldparam operation [::Gapic::Rest::TransportOperation] # # @return [::Google::Cloud::AlloyDB::V1::User] # # @raise [::Google::Cloud::Error] if the REST call is aborted. # # @example Basic example # require "google/cloud/alloy_db/v1" # # # Create a client object. The client can be reused for multiple calls. # client = Google::Cloud::AlloyDB::V1::AlloyDBAdmin::Rest::Client.new # # # Create a request. To set request fields, pass in keyword arguments. # request = Google::Cloud::AlloyDB::V1::CreateUserRequest.new # # # Call the create_user method. # result = client.create_user request # # # The returned object is of type Google::Cloud::AlloyDB::V1::User. # p result # def create_user request, options = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::AlloyDB::V1::CreateUserRequest # Converts hash and nil to an options object options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h # Customize the options with defaults call_metadata = @config.rpcs.create_user.metadata.to_h # Set x-goog-api-client and x-goog-user-project headers call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::AlloyDB::V1::VERSION, transports_version_send: [:rest] call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id options.apply_defaults timeout: @config.rpcs.create_user.timeout, metadata: call_metadata, retry_policy: @config.rpcs.create_user.retry_policy options.apply_defaults timeout: @config.timeout, metadata: @config.metadata, retry_policy: @config.retry_policy @alloy_db_admin_stub.create_user request, options do |result, operation| yield result, operation if block_given? return result end rescue ::Gapic::Rest::Error => e raise ::Google::Cloud::Error.from_error(e) end ## # Updates the parameters of a single User. # # @overload update_user(request, options = nil) # Pass arguments to `update_user` via a request object, either of type # {::Google::Cloud::AlloyDB::V1::UpdateUserRequest} or an equivalent Hash. # # @param request [::Google::Cloud::AlloyDB::V1::UpdateUserRequest, ::Hash] # A request object representing the call parameters. Required. To specify no # parameters, or to keep all the default parameter values, pass an empty Hash. # @param options [::Gapic::CallOptions, ::Hash] # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. # # @overload update_user(update_mask: nil, user: nil, request_id: nil, validate_only: nil, allow_missing: nil) # Pass arguments to `update_user` via keyword arguments. Note that at # least one keyword argument is required. To specify no parameters, or to keep all # the default parameter values, pass an empty Hash as a request object (see above). # # @param update_mask [::Google::Protobuf::FieldMask, ::Hash] # Optional. Field mask is used to specify the fields to be overwritten in the # User resource by the update. # The fields specified in the update_mask are relative to the resource, not # the full request. A field will be overwritten if it is in the mask. If the # user does not provide a mask then all fields will be overwritten. # @param user [::Google::Cloud::AlloyDB::V1::User, ::Hash] # Required. The resource being updated # @param request_id [::String] # Optional. An optional request ID to identify requests. Specify a unique # request ID so that if you must retry your request, the server will know to # ignore the request if it has already been completed. The server will # guarantee that for at least 60 minutes since the first request. # # For example, consider a situation where you make an initial request and # the request times out. If you make the request again with the same request # ID, the server can check if original operation with the same request ID # was received, and if so, will ignore the second request. This prevents # clients from accidentally creating duplicate commitments. # # The request ID must be a valid UUID with the exception that zero UUID is # not supported (00000000-0000-0000-0000-000000000000). # @param validate_only [::Boolean] # Optional. If set, the backend validates the request, but doesn't actually # execute it. # @param allow_missing [::Boolean] # Optional. Allow missing fields in the update mask. # @yield [result, operation] Access the result along with the TransportOperation object # @yieldparam result [::Google::Cloud::AlloyDB::V1::User] # @yieldparam operation [::Gapic::Rest::TransportOperation] # # @return [::Google::Cloud::AlloyDB::V1::User] # # @raise [::Google::Cloud::Error] if the REST call is aborted. # # @example Basic example # require "google/cloud/alloy_db/v1" # # # Create a client object. The client can be reused for multiple calls. # client = Google::Cloud::AlloyDB::V1::AlloyDBAdmin::Rest::Client.new # # # Create a request. To set request fields, pass in keyword arguments. # request = Google::Cloud::AlloyDB::V1::UpdateUserRequest.new # # # Call the update_user method. # result = client.update_user request # # # The returned object is of type Google::Cloud::AlloyDB::V1::User. # p result # def update_user request, options = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::AlloyDB::V1::UpdateUserRequest # Converts hash and nil to an options object options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h # Customize the options with defaults call_metadata = @config.rpcs.update_user.metadata.to_h # Set x-goog-api-client and x-goog-user-project headers call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::AlloyDB::V1::VERSION, transports_version_send: [:rest] call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id options.apply_defaults timeout: @config.rpcs.update_user.timeout, metadata: call_metadata, retry_policy: @config.rpcs.update_user.retry_policy options.apply_defaults timeout: @config.timeout, metadata: @config.metadata, retry_policy: @config.retry_policy @alloy_db_admin_stub.update_user request, options do |result, operation| yield result, operation if block_given? return result end rescue ::Gapic::Rest::Error => e raise ::Google::Cloud::Error.from_error(e) end ## # Deletes a single User. # # @overload delete_user(request, options = nil) # Pass arguments to `delete_user` via a request object, either of type # {::Google::Cloud::AlloyDB::V1::DeleteUserRequest} or an equivalent Hash. # # @param request [::Google::Cloud::AlloyDB::V1::DeleteUserRequest, ::Hash] # A request object representing the call parameters. Required. To specify no # parameters, or to keep all the default parameter values, pass an empty Hash. # @param options [::Gapic::CallOptions, ::Hash] # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. # # @overload delete_user(name: nil, request_id: nil, validate_only: nil) # Pass arguments to `delete_user` via keyword arguments. Note that at # least one keyword argument is required. To specify no parameters, or to keep all # the default parameter values, pass an empty Hash as a request object (see above). # # @param name [::String] # Required. The name of the resource. For the required format, see the # comment on the User.name field. # @param request_id [::String] # Optional. An optional request ID to identify requests. Specify a unique # request ID so that if you must retry your request, the server will know to # ignore the request if it has already been completed. The server will # guarantee that for at least 60 minutes after the first request. # # For example, consider a situation where you make an initial request and # the request times out. If you make the request again with the same request # ID, the server can check if original operation with the same request ID # was received, and if so, will ignore the second request. This prevents # clients from accidentally creating duplicate commitments. # # The request ID must be a valid UUID with the exception that zero UUID is # not supported (00000000-0000-0000-0000-000000000000). # @param validate_only [::Boolean] # Optional. If set, the backend validates the request, but doesn't actually # execute it. # @yield [result, operation] Access the result along with the TransportOperation object # @yieldparam result [::Google::Protobuf::Empty] # @yieldparam operation [::Gapic::Rest::TransportOperation] # # @return [::Google::Protobuf::Empty] # # @raise [::Google::Cloud::Error] if the REST call is aborted. # # @example Basic example # require "google/cloud/alloy_db/v1" # # # Create a client object. The client can be reused for multiple calls. # client = Google::Cloud::AlloyDB::V1::AlloyDBAdmin::Rest::Client.new # # # Create a request. To set request fields, pass in keyword arguments. # request = Google::Cloud::AlloyDB::V1::DeleteUserRequest.new # # # Call the delete_user method. # result = client.delete_user request # # # The returned object is of type Google::Protobuf::Empty. # p result # def delete_user request, options = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::AlloyDB::V1::DeleteUserRequest # Converts hash and nil to an options object options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h # Customize the options with defaults call_metadata = @config.rpcs.delete_user.metadata.to_h # Set x-goog-api-client and x-goog-user-project headers call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::AlloyDB::V1::VERSION, transports_version_send: [:rest] call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id options.apply_defaults timeout: @config.rpcs.delete_user.timeout, metadata: call_metadata, retry_policy: @config.rpcs.delete_user.retry_policy options.apply_defaults timeout: @config.timeout, metadata: @config.metadata, retry_policy: @config.retry_policy @alloy_db_admin_stub.delete_user request, options do |result, operation| yield result, operation if block_given? return result end rescue ::Gapic::Rest::Error => e raise ::Google::Cloud::Error.from_error(e) end ## # Configuration class for the AlloyDBAdmin REST API. # # This class represents the configuration for AlloyDBAdmin REST, # providing control over timeouts, retry behavior, logging, transport # parameters, and other low-level controls. Certain parameters can also be # applied individually to specific RPCs. See # {::Google::Cloud::AlloyDB::V1::AlloyDBAdmin::Rest::Client::Configuration::Rpcs} # for a list of RPCs that can be configured independently. # # Configuration can be applied globally to all clients, or to a single client # on construction. # # @example # # # Modify the global config, setting the timeout for # # list_clusters to 20 seconds, # # and all remaining timeouts to 10 seconds. # ::Google::Cloud::AlloyDB::V1::AlloyDBAdmin::Rest::Client.configure do |config| # config.timeout = 10.0 # config.rpcs.list_clusters.timeout = 20.0 # end # # # Apply the above configuration only to a new client. # client = ::Google::Cloud::AlloyDB::V1::AlloyDBAdmin::Rest::Client.new do |config| # config.timeout = 10.0 # config.rpcs.list_clusters.timeout = 20.0 # end # # @!attribute [rw] endpoint # The hostname or hostname:port of the service endpoint. # Defaults to `"alloydb.googleapis.com"`. # @return [::String] # @!attribute [rw] credentials # Credentials to send with calls. You may provide any of the following types: # * (`String`) The path to a service account key file in JSON format # * (`Hash`) A service account key as a Hash # * (`Google::Auth::Credentials`) A googleauth credentials object # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials)) # * (`Signet::OAuth2::Client`) A signet oauth2 client object # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client)) # * (`nil`) indicating no credentials # @return [::Object] # @!attribute [rw] scope # The OAuth scopes # @return [::Array<::String>] # @!attribute [rw] lib_name # The library name as recorded in instrumentation and logging # @return [::String] # @!attribute [rw] lib_version # The library version as recorded in instrumentation and logging # @return [::String] # @!attribute [rw] timeout # The call timeout in seconds. # @return [::Numeric] # @!attribute [rw] metadata # Additional headers to be sent with the call. # @return [::Hash{::Symbol=>::String}] # @!attribute [rw] retry_policy # The retry policy. The value is a hash with the following keys: # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. # * `:retry_codes` (*type:* `Array`) - The error codes that should # trigger a retry. # @return [::Hash] # @!attribute [rw] quota_project # A separate project against which to charge quota. # @return [::String] # class Configuration extend ::Gapic::Config DEFAULT_ENDPOINT = "alloydb.googleapis.com" config_attr :endpoint, DEFAULT_ENDPOINT, ::String config_attr :credentials, nil do |value| allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil] allowed.any? { |klass| klass === value } end config_attr :scope, nil, ::String, ::Array, nil config_attr :lib_name, nil, ::String, nil config_attr :lib_version, nil, ::String, nil config_attr :timeout, nil, ::Numeric, nil config_attr :metadata, nil, ::Hash, nil config_attr :retry_policy, nil, ::Hash, ::Proc, nil config_attr :quota_project, nil, ::String, nil # @private # Overrides for http bindings for the RPCs of this service # are only used when this service is used as mixin, and only # by the host service. # @return [::Hash{::Symbol=>::Array<::Gapic::Rest::GrpcTranscoder::HttpBinding>}] config_attr :bindings_override, {}, ::Hash, nil # @private def initialize parent_config = nil @parent_config = parent_config unless parent_config.nil? yield self if block_given? end ## # Configurations for individual RPCs # @return [Rpcs] # def rpcs @rpcs ||= begin parent_rpcs = nil parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs) Rpcs.new parent_rpcs end end ## # Configuration RPC class for the AlloyDBAdmin API. # # Includes fields providing the configuration for each RPC in this service. # Each configuration object is of type `Gapic::Config::Method` and includes # the following configuration fields: # # * `timeout` (*type:* `Numeric`) - The call timeout in seconds # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields # include the following keys: # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. # * `:retry_codes` (*type:* `Array`) - The error codes that should # trigger a retry. # class Rpcs ## # RPC-specific configuration for `list_clusters` # @return [::Gapic::Config::Method] # attr_reader :list_clusters ## # RPC-specific configuration for `get_cluster` # @return [::Gapic::Config::Method] # attr_reader :get_cluster ## # RPC-specific configuration for `create_cluster` # @return [::Gapic::Config::Method] # attr_reader :create_cluster ## # RPC-specific configuration for `update_cluster` # @return [::Gapic::Config::Method] # attr_reader :update_cluster ## # RPC-specific configuration for `delete_cluster` # @return [::Gapic::Config::Method] # attr_reader :delete_cluster ## # RPC-specific configuration for `promote_cluster` # @return [::Gapic::Config::Method] # attr_reader :promote_cluster ## # RPC-specific configuration for `restore_cluster` # @return [::Gapic::Config::Method] # attr_reader :restore_cluster ## # RPC-specific configuration for `create_secondary_cluster` # @return [::Gapic::Config::Method] # attr_reader :create_secondary_cluster ## # RPC-specific configuration for `list_instances` # @return [::Gapic::Config::Method] # attr_reader :list_instances ## # RPC-specific configuration for `get_instance` # @return [::Gapic::Config::Method] # attr_reader :get_instance ## # RPC-specific configuration for `create_instance` # @return [::Gapic::Config::Method] # attr_reader :create_instance ## # RPC-specific configuration for `create_secondary_instance` # @return [::Gapic::Config::Method] # attr_reader :create_secondary_instance ## # RPC-specific configuration for `batch_create_instances` # @return [::Gapic::Config::Method] # attr_reader :batch_create_instances ## # RPC-specific configuration for `update_instance` # @return [::Gapic::Config::Method] # attr_reader :update_instance ## # RPC-specific configuration for `delete_instance` # @return [::Gapic::Config::Method] # attr_reader :delete_instance ## # RPC-specific configuration for `failover_instance` # @return [::Gapic::Config::Method] # attr_reader :failover_instance ## # RPC-specific configuration for `inject_fault` # @return [::Gapic::Config::Method] # attr_reader :inject_fault ## # RPC-specific configuration for `restart_instance` # @return [::Gapic::Config::Method] # attr_reader :restart_instance ## # RPC-specific configuration for `list_backups` # @return [::Gapic::Config::Method] # attr_reader :list_backups ## # RPC-specific configuration for `get_backup` # @return [::Gapic::Config::Method] # attr_reader :get_backup ## # RPC-specific configuration for `create_backup` # @return [::Gapic::Config::Method] # attr_reader :create_backup ## # RPC-specific configuration for `update_backup` # @return [::Gapic::Config::Method] # attr_reader :update_backup ## # RPC-specific configuration for `delete_backup` # @return [::Gapic::Config::Method] # attr_reader :delete_backup ## # RPC-specific configuration for `list_supported_database_flags` # @return [::Gapic::Config::Method] # attr_reader :list_supported_database_flags ## # RPC-specific configuration for `generate_client_certificate` # @return [::Gapic::Config::Method] # attr_reader :generate_client_certificate ## # RPC-specific configuration for `get_connection_info` # @return [::Gapic::Config::Method] # attr_reader :get_connection_info ## # RPC-specific configuration for `list_users` # @return [::Gapic::Config::Method] # attr_reader :list_users ## # RPC-specific configuration for `get_user` # @return [::Gapic::Config::Method] # attr_reader :get_user ## # RPC-specific configuration for `create_user` # @return [::Gapic::Config::Method] # attr_reader :create_user ## # RPC-specific configuration for `update_user` # @return [::Gapic::Config::Method] # attr_reader :update_user ## # RPC-specific configuration for `delete_user` # @return [::Gapic::Config::Method] # attr_reader :delete_user # @private def initialize parent_rpcs = nil list_clusters_config = parent_rpcs.list_clusters if parent_rpcs.respond_to? :list_clusters @list_clusters = ::Gapic::Config::Method.new list_clusters_config get_cluster_config = parent_rpcs.get_cluster if parent_rpcs.respond_to? :get_cluster @get_cluster = ::Gapic::Config::Method.new get_cluster_config create_cluster_config = parent_rpcs.create_cluster if parent_rpcs.respond_to? :create_cluster @create_cluster = ::Gapic::Config::Method.new create_cluster_config update_cluster_config = parent_rpcs.update_cluster if parent_rpcs.respond_to? :update_cluster @update_cluster = ::Gapic::Config::Method.new update_cluster_config delete_cluster_config = parent_rpcs.delete_cluster if parent_rpcs.respond_to? :delete_cluster @delete_cluster = ::Gapic::Config::Method.new delete_cluster_config promote_cluster_config = parent_rpcs.promote_cluster if parent_rpcs.respond_to? :promote_cluster @promote_cluster = ::Gapic::Config::Method.new promote_cluster_config restore_cluster_config = parent_rpcs.restore_cluster if parent_rpcs.respond_to? :restore_cluster @restore_cluster = ::Gapic::Config::Method.new restore_cluster_config create_secondary_cluster_config = parent_rpcs.create_secondary_cluster if parent_rpcs.respond_to? :create_secondary_cluster @create_secondary_cluster = ::Gapic::Config::Method.new create_secondary_cluster_config list_instances_config = parent_rpcs.list_instances if parent_rpcs.respond_to? :list_instances @list_instances = ::Gapic::Config::Method.new list_instances_config get_instance_config = parent_rpcs.get_instance if parent_rpcs.respond_to? :get_instance @get_instance = ::Gapic::Config::Method.new get_instance_config create_instance_config = parent_rpcs.create_instance if parent_rpcs.respond_to? :create_instance @create_instance = ::Gapic::Config::Method.new create_instance_config create_secondary_instance_config = parent_rpcs.create_secondary_instance if parent_rpcs.respond_to? :create_secondary_instance @create_secondary_instance = ::Gapic::Config::Method.new create_secondary_instance_config batch_create_instances_config = parent_rpcs.batch_create_instances if parent_rpcs.respond_to? :batch_create_instances @batch_create_instances = ::Gapic::Config::Method.new batch_create_instances_config update_instance_config = parent_rpcs.update_instance if parent_rpcs.respond_to? :update_instance @update_instance = ::Gapic::Config::Method.new update_instance_config delete_instance_config = parent_rpcs.delete_instance if parent_rpcs.respond_to? :delete_instance @delete_instance = ::Gapic::Config::Method.new delete_instance_config failover_instance_config = parent_rpcs.failover_instance if parent_rpcs.respond_to? :failover_instance @failover_instance = ::Gapic::Config::Method.new failover_instance_config inject_fault_config = parent_rpcs.inject_fault if parent_rpcs.respond_to? :inject_fault @inject_fault = ::Gapic::Config::Method.new inject_fault_config restart_instance_config = parent_rpcs.restart_instance if parent_rpcs.respond_to? :restart_instance @restart_instance = ::Gapic::Config::Method.new restart_instance_config list_backups_config = parent_rpcs.list_backups if parent_rpcs.respond_to? :list_backups @list_backups = ::Gapic::Config::Method.new list_backups_config get_backup_config = parent_rpcs.get_backup if parent_rpcs.respond_to? :get_backup @get_backup = ::Gapic::Config::Method.new get_backup_config create_backup_config = parent_rpcs.create_backup if parent_rpcs.respond_to? :create_backup @create_backup = ::Gapic::Config::Method.new create_backup_config update_backup_config = parent_rpcs.update_backup if parent_rpcs.respond_to? :update_backup @update_backup = ::Gapic::Config::Method.new update_backup_config delete_backup_config = parent_rpcs.delete_backup if parent_rpcs.respond_to? :delete_backup @delete_backup = ::Gapic::Config::Method.new delete_backup_config list_supported_database_flags_config = parent_rpcs.list_supported_database_flags if parent_rpcs.respond_to? :list_supported_database_flags @list_supported_database_flags = ::Gapic::Config::Method.new list_supported_database_flags_config generate_client_certificate_config = parent_rpcs.generate_client_certificate if parent_rpcs.respond_to? :generate_client_certificate @generate_client_certificate = ::Gapic::Config::Method.new generate_client_certificate_config get_connection_info_config = parent_rpcs.get_connection_info if parent_rpcs.respond_to? :get_connection_info @get_connection_info = ::Gapic::Config::Method.new get_connection_info_config list_users_config = parent_rpcs.list_users if parent_rpcs.respond_to? :list_users @list_users = ::Gapic::Config::Method.new list_users_config get_user_config = parent_rpcs.get_user if parent_rpcs.respond_to? :get_user @get_user = ::Gapic::Config::Method.new get_user_config create_user_config = parent_rpcs.create_user if parent_rpcs.respond_to? :create_user @create_user = ::Gapic::Config::Method.new create_user_config update_user_config = parent_rpcs.update_user if parent_rpcs.respond_to? :update_user @update_user = ::Gapic::Config::Method.new update_user_config delete_user_config = parent_rpcs.delete_user if parent_rpcs.respond_to? :delete_user @delete_user = ::Gapic::Config::Method.new delete_user_config yield self if block_given? end end end end end end end end end end