Class: Google::Cloud::AlloyDB::V1::AlloyDBAdmin::Client

Inherits:
Object
  • Object
show all
Includes:
Paths
Defined in:
lib/google/cloud/alloy_db/v1/alloy_db_admin/client.rb

Overview

Client for the AlloyDBAdmin service.

Service describing handlers for resources

Defined Under Namespace

Classes: Configuration

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Paths

#backup_path, #cluster_path, #crypto_key_version_path, #instance_path, #location_path, #network_path, #user_path

Constructor Details

#initialize {|config| ... } ⇒ Client

Create a new AlloyDBAdmin client object.

Examples:


# Create a client using the default configuration
client = ::Google::Cloud::AlloyDB::V1::AlloyDBAdmin::Client.new

# Create a client using a custom configuration
client = ::Google::Cloud::AlloyDB::V1::AlloyDBAdmin::Client.new do |config|
  config.timeout = 10.0
end

Yields:

  • (config)

    Configure the AlloyDBAdmin client.

Yield Parameters:



173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
# File 'lib/google/cloud/alloy_db/v1/alloy_db_admin/client.rb', line 173

def initialize
  # These require statements are intentionally placed here to initialize
  # the gRPC module only when it's required.
  # See https://github.com/googleapis/toolkit/issues/446
  require "gapic/grpc"
  require "google/cloud/alloydb/v1/service_services_pb"

  # 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.nil? ||
                           (@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 = Operations.new do |config|
    config.credentials = credentials
    config.quota_project = @quota_project_id
    config.endpoint = @config.endpoint
    config.universe_domain = @config.universe_domain
  end

  @alloy_db_admin_stub = ::Gapic::ServiceStub.new(
    ::Google::Cloud::AlloyDB::V1::AlloyDBAdmin::Stub,
    credentials: credentials,
    endpoint: @config.endpoint,
    endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
    universe_domain: @config.universe_domain,
    channel_args: @config.channel_args,
    interceptors: @config.interceptors,
    channel_pool_config: @config.channel_pool
  )

  @location_client = Google::Cloud::Location::Locations::Client.new do |config|
    config.credentials = credentials
    config.quota_project = @quota_project_id
    config.endpoint = @alloy_db_admin_stub.endpoint
    config.universe_domain = @alloy_db_admin_stub.universe_domain
  end

  @iam_policy_client = Google::Iam::V1::IAMPolicy::Client.new do |config|
    config.credentials = credentials
    config.quota_project = @quota_project_id
    config.endpoint = @alloy_db_admin_stub.endpoint
    config.universe_domain = @alloy_db_admin_stub.universe_domain
  end
end

Instance Attribute Details

#iam_policy_clientGoogle::Iam::V1::IAMPolicy::Client (readonly)

Get the associated client for mix-in of the IAMPolicy.

Returns:

  • (Google::Iam::V1::IAMPolicy::Client)


253
254
255
# File 'lib/google/cloud/alloy_db/v1/alloy_db_admin/client.rb', line 253

def iam_policy_client
  @iam_policy_client
end

#location_clientGoogle::Cloud::Location::Locations::Client (readonly)

Get the associated client for mix-in of the Locations.

Returns:

  • (Google::Cloud::Location::Locations::Client)


246
247
248
# File 'lib/google/cloud/alloy_db/v1/alloy_db_admin/client.rb', line 246

def location_client
  @location_client
end

#operations_client::Google::Cloud::AlloyDB::V1::AlloyDBAdmin::Operations (readonly)

Get the associated client for long-running operations.



239
240
241
# File 'lib/google/cloud/alloy_db/v1/alloy_db_admin/client.rb', line 239

def operations_client
  @operations_client
end

Class Method Details

.configure {|config| ... } ⇒ Client::Configuration

Configure the AlloyDBAdmin Client class.

See Configuration for a description of the configuration fields.

Examples:


# Modify the configuration for all AlloyDBAdmin clients
::Google::Cloud::AlloyDB::V1::AlloyDBAdmin::Client.configure do |config|
  config.timeout = 10.0
end

Yields:

  • (config)

    Configure the Client client.

Yield Parameters:

Returns:



64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
# File 'lib/google/cloud/alloy_db/v1/alloy_db_admin/client.rb', line 64

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

Instance Method Details

#batch_create_instances(request, options = nil) ⇒ ::Gapic::Operation #batch_create_instances(parent: nil, requests: nil, request_id: nil) ⇒ ::Gapic::Operation

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.

Examples:

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::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

Overloads:

  • #batch_create_instances(request, options = nil) ⇒ ::Gapic::Operation

    Pass arguments to batch_create_instances via a request object, either of type BatchCreateInstancesRequest or an equivalent Hash.

    Parameters:

    • 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.

    • options (::Gapic::CallOptions, ::Hash) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #batch_create_instances(parent: nil, requests: nil, request_id: nil) ⇒ ::Gapic::Operation

    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).

    Parameters:

    • parent (::String) (defaults to: nil)

      Required. The name of the parent resource.

    • requests (::Google::Cloud::AlloyDB::V1::CreateInstanceRequests, ::Hash) (defaults to: nil)

      Required. Resources being created.

    • request_id (::String) (defaults to: nil)

      Optional. An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server ignores the request if it has already been completed. The server guarantees 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 the original operation with the same request ID was received, and if so, ignores 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).

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

  • response (::Gapic::Operation)
  • operation (::GRPC::ActiveCall::Operation)

Returns:

  • (::Gapic::Operation)

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
# File 'lib/google/cloud/alloy_db/v1/alloy_db_admin/client.rb', line 1788

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
   = @config.rpcs.batch_create_instances..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"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
  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.parent
    header_params["parent"] = request.parent
  end

  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
  [:"x-goog-request-params"] ||= request_params_header

  options.apply_defaults timeout:      @config.rpcs.batch_create_instances.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.batch_create_instances.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @alloy_db_admin_stub.call_rpc :batch_create_instances, request, options: options do |response, operation|
    response = ::Gapic::Operation.new response, @operations_client, options: options
    yield response, operation if block_given?
    return response
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end

#configure {|config| ... } ⇒ Client::Configuration

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 configure.

See Configuration for a description of the configuration fields.

Yields:

  • (config)

    Configure the Client client.

Yield Parameters:

Returns:



143
144
145
146
# File 'lib/google/cloud/alloy_db/v1/alloy_db_admin/client.rb', line 143

def configure
  yield @config if block_given?
  @config
end

#create_backup(request, options = nil) ⇒ ::Gapic::Operation #create_backup(parent: nil, backup_id: nil, backup: nil, request_id: nil, validate_only: nil) ⇒ ::Gapic::Operation

Creates a new Backup in a given project and location.

Examples:

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::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

Overloads:

  • #create_backup(request, options = nil) ⇒ ::Gapic::Operation

    Pass arguments to create_backup via a request object, either of type CreateBackupRequest or an equivalent Hash.

    Parameters:

    • 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.

    • options (::Gapic::CallOptions, ::Hash) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #create_backup(parent: nil, backup_id: nil, backup: nil, request_id: nil, validate_only: nil) ⇒ ::Gapic::Operation

    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).

    Parameters:

    • parent (::String) (defaults to: nil)

      Required. Value for parent.

    • backup_id (::String) (defaults to: nil)

      Required. ID of the requesting object.

    • backup (::Google::Cloud::AlloyDB::V1::Backup, ::Hash) (defaults to: nil)

      Required. The resource being created

    • request_id (::String) (defaults to: nil)

      Optional. An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server ignores the request if it has already been completed. The server guarantees 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 the original operation with the same request ID was received, and if so, ignores 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).

    • validate_only (::Boolean) (defaults to: nil)

      Optional. If set, the backend validates the request, but doesn't actually execute it.

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

  • response (::Gapic::Operation)
  • operation (::GRPC::ActiveCall::Operation)

Returns:

  • (::Gapic::Operation)

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
# File 'lib/google/cloud/alloy_db/v1/alloy_db_admin/client.rb', line 2775

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
   = @config.rpcs.create_backup..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"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
  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.parent
    header_params["parent"] = request.parent
  end

  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
  [:"x-goog-request-params"] ||= request_params_header

  options.apply_defaults timeout:      @config.rpcs.create_backup.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.create_backup.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @alloy_db_admin_stub.call_rpc :create_backup, request, options: options do |response, operation|
    response = ::Gapic::Operation.new response, @operations_client, options: options
    yield response, operation if block_given?
    return response
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end

#create_cluster(request, options = nil) ⇒ ::Gapic::Operation #create_cluster(parent: nil, cluster_id: nil, cluster: nil, request_id: nil, validate_only: nil) ⇒ ::Gapic::Operation

Creates a new Cluster in a given project and location.

Examples:

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::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

Overloads:

  • #create_cluster(request, options = nil) ⇒ ::Gapic::Operation

    Pass arguments to create_cluster via a request object, either of type CreateClusterRequest or an equivalent Hash.

    Parameters:

    • 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.

    • options (::Gapic::CallOptions, ::Hash) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #create_cluster(parent: nil, cluster_id: nil, cluster: nil, request_id: nil, validate_only: nil) ⇒ ::Gapic::Operation

    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).

    Parameters:

    • parent (::String) (defaults to: nil)

      Required. The location of the new cluster. For the required format, see the comment on the Cluster.name field.

    • cluster_id (::String) (defaults to: nil)

      Required. ID of the requesting object.

    • cluster (::Google::Cloud::AlloyDB::V1::Cluster, ::Hash) (defaults to: nil)

      Required. The resource being created

    • request_id (::String) (defaults to: nil)

      Optional. An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server ignores the request if it has already been completed. The server guarantees 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 the original operation with the same request ID was received, and if so, ignores 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).

    • validate_only (::Boolean) (defaults to: nil)

      Optional. If set, performs request validation, for example, permission checks and any other type of validation, but does not actually execute the create request.

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

  • response (::Gapic::Operation)
  • operation (::GRPC::ActiveCall::Operation)

Returns:

  • (::Gapic::Operation)

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
# File 'lib/google/cloud/alloy_db/v1/alloy_db_admin/client.rb', line 524

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
   = @config.rpcs.create_cluster..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"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
  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.parent
    header_params["parent"] = request.parent
  end

  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
  [:"x-goog-request-params"] ||= request_params_header

  options.apply_defaults timeout:      @config.rpcs.create_cluster.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.create_cluster.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @alloy_db_admin_stub.call_rpc :create_cluster, request, options: options do |response, operation|
    response = ::Gapic::Operation.new response, @operations_client, options: options
    yield response, operation if block_given?
    return response
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end

#create_instance(request, options = nil) ⇒ ::Gapic::Operation #create_instance(parent: nil, instance_id: nil, instance: nil, request_id: nil, validate_only: nil) ⇒ ::Gapic::Operation

Creates a new Instance in a given project and location.

Examples:

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::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

Overloads:

  • #create_instance(request, options = nil) ⇒ ::Gapic::Operation

    Pass arguments to create_instance via a request object, either of type CreateInstanceRequest or an equivalent Hash.

    Parameters:

    • 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.

    • options (::Gapic::CallOptions, ::Hash) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #create_instance(parent: nil, instance_id: nil, instance: nil, request_id: nil, validate_only: nil) ⇒ ::Gapic::Operation

    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).

    Parameters:

    • parent (::String) (defaults to: nil)

      Required. The name of the parent resource. For the required format, see the comment on the Instance.name field.

    • instance_id (::String) (defaults to: nil)

      Required. ID of the requesting object.

    • instance (::Google::Cloud::AlloyDB::V1::Instance, ::Hash) (defaults to: nil)

      Required. The resource being created

    • request_id (::String) (defaults to: nil)

      Optional. An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server ignores the request if it has already been completed. The server guarantees 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 the original operation with the same request ID was received, and if so, ignores 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).

    • validate_only (::Boolean) (defaults to: nil)

      Optional. If set, performs request validation, for example, permission checks and any other type of validation, but does not actually execute the create request.

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

  • response (::Gapic::Operation)
  • operation (::GRPC::ActiveCall::Operation)

Returns:

  • (::Gapic::Operation)

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
# File 'lib/google/cloud/alloy_db/v1/alloy_db_admin/client.rb', line 1552

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
   = @config.rpcs.create_instance..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"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
  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.parent
    header_params["parent"] = request.parent
  end

  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
  [:"x-goog-request-params"] ||= request_params_header

  options.apply_defaults timeout:      @config.rpcs.create_instance.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.create_instance.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @alloy_db_admin_stub.call_rpc :create_instance, request, options: options do |response, operation|
    response = ::Gapic::Operation.new response, @operations_client, options: options
    yield response, operation if block_given?
    return response
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end

#create_secondary_cluster(request, options = nil) ⇒ ::Gapic::Operation #create_secondary_cluster(parent: nil, cluster_id: nil, cluster: nil, request_id: nil, validate_only: nil) ⇒ ::Gapic::Operation

Creates a cluster of type SECONDARY in the given location using the primary cluster as the source.

Examples:

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::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

Overloads:

  • #create_secondary_cluster(request, options = nil) ⇒ ::Gapic::Operation

    Pass arguments to create_secondary_cluster via a request object, either of type CreateSecondaryClusterRequest or an equivalent Hash.

    Parameters:

    • 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.

    • options (::Gapic::CallOptions, ::Hash) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #create_secondary_cluster(parent: nil, cluster_id: nil, cluster: nil, request_id: nil, validate_only: nil) ⇒ ::Gapic::Operation

    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).

    Parameters:

    • parent (::String) (defaults to: nil)

      Required. The location of the new cluster. For the required format, see the comment on the Cluster.name field.

    • cluster_id (::String) (defaults to: nil)

      Required. ID of the requesting object (the secondary cluster).

    • cluster (::Google::Cloud::AlloyDB::V1::Cluster, ::Hash) (defaults to: nil)

      Required. Configuration of the requesting object (the secondary cluster).

    • request_id (::String) (defaults to: nil)

      Optional. An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server ignores the request if it has already been completed. The server guarantees 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 the original operation with the same request ID was received, and if so, ignores 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).

    • validate_only (::Boolean) (defaults to: nil)

      Optional. If set, performs request validation, for example, permission checks and any other type of validation, but does not actually execute the create request.

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

  • response (::Gapic::Operation)
  • operation (::GRPC::ActiveCall::Operation)

Returns:

  • (::Gapic::Operation)

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
# File 'lib/google/cloud/alloy_db/v1/alloy_db_admin/client.rb', line 1241

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
   = @config.rpcs.create_secondary_cluster..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"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
  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.parent
    header_params["parent"] = request.parent
  end

  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
  [:"x-goog-request-params"] ||= request_params_header

  options.apply_defaults timeout:      @config.rpcs.create_secondary_cluster.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.create_secondary_cluster.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @alloy_db_admin_stub.call_rpc :create_secondary_cluster, request, options: options do |response, operation|
    response = ::Gapic::Operation.new response, @operations_client, options: options
    yield response, operation if block_given?
    return response
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end

#create_secondary_instance(request, options = nil) ⇒ ::Gapic::Operation #create_secondary_instance(parent: nil, instance_id: nil, instance: nil, request_id: nil, validate_only: nil) ⇒ ::Gapic::Operation

Creates a new SECONDARY Instance in a given project and location.

Examples:

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::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

Overloads:

  • #create_secondary_instance(request, options = nil) ⇒ ::Gapic::Operation

    Pass arguments to create_secondary_instance via a request object, either of type CreateSecondaryInstanceRequest or an equivalent Hash.

    Parameters:

    • 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.

    • options (::Gapic::CallOptions, ::Hash) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #create_secondary_instance(parent: nil, instance_id: nil, instance: nil, request_id: nil, validate_only: nil) ⇒ ::Gapic::Operation

    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).

    Parameters:

    • parent (::String) (defaults to: nil)

      Required. The name of the parent resource. For the required format, see the comment on the Instance.name field.

    • instance_id (::String) (defaults to: nil)

      Required. ID of the requesting object.

    • instance (::Google::Cloud::AlloyDB::V1::Instance, ::Hash) (defaults to: nil)

      Required. The resource being created

    • request_id (::String) (defaults to: nil)

      Optional. An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server ignores the request if it has already been completed. The server guarantees 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 the original operation with the same request ID was received, and if so, ignores 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).

    • validate_only (::Boolean) (defaults to: nil)

      Optional. If set, performs request validation, for example, permission checks and any other type of validation, but does not actually execute the create request.

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

  • response (::Gapic::Operation)
  • operation (::GRPC::ActiveCall::Operation)

Returns:

  • (::Gapic::Operation)

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
# File 'lib/google/cloud/alloy_db/v1/alloy_db_admin/client.rb', line 1669

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
   = @config.rpcs.create_secondary_instance..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"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
  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.parent
    header_params["parent"] = request.parent
  end

  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
  [:"x-goog-request-params"] ||= request_params_header

  options.apply_defaults timeout:      @config.rpcs.create_secondary_instance.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.create_secondary_instance.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @alloy_db_admin_stub.call_rpc :create_secondary_instance, request, options: options do |response, operation|
    response = ::Gapic::Operation.new response, @operations_client, options: options
    yield response, operation if block_given?
    return response
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end

#create_user(request, options = nil) ⇒ ::Google::Cloud::AlloyDB::V1::User #create_user(parent: nil, user_id: nil, user: nil, request_id: nil, validate_only: nil) ⇒ ::Google::Cloud::AlloyDB::V1::User

Creates a new User in a given project, location, and cluster.

Examples:

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::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

Overloads:

  • #create_user(request, options = nil) ⇒ ::Google::Cloud::AlloyDB::V1::User

    Pass arguments to create_user via a request object, either of type CreateUserRequest or an equivalent Hash.

    Parameters:

    • 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.

    • options (::Gapic::CallOptions, ::Hash) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #create_user(parent: nil, user_id: nil, user: nil, request_id: nil, validate_only: nil) ⇒ ::Google::Cloud::AlloyDB::V1::User

    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).

    Parameters:

    • parent (::String) (defaults to: nil)

      Required. Value for parent.

    • user_id (::String) (defaults to: nil)

      Required. ID of the requesting object.

    • user (::Google::Cloud::AlloyDB::V1::User, ::Hash) (defaults to: nil)

      Required. The resource being created

    • request_id (::String) (defaults to: nil)

      Optional. An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server ignores the request if it has already been completed. The server guarantees 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 the original operation with the same request ID was received, and if so, ignores 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).

    • validate_only (::Boolean) (defaults to: nil)

      Optional. If set, the backend validates the request, but doesn't actually execute it.

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
# File 'lib/google/cloud/alloy_db/v1/alloy_db_admin/client.rb', line 3626

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
   = @config.rpcs.create_user..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"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
  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.parent
    header_params["parent"] = request.parent
  end

  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
  [:"x-goog-request-params"] ||= request_params_header

  options.apply_defaults timeout:      @config.rpcs.create_user.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.create_user.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @alloy_db_admin_stub.call_rpc :create_user, request, options: options do |response, operation|
    yield response, operation if block_given?
    return response
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end

#delete_backup(request, options = nil) ⇒ ::Gapic::Operation #delete_backup(name: nil, request_id: nil, validate_only: nil, etag: nil) ⇒ ::Gapic::Operation

Deletes a single Backup.

Examples:

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::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

Overloads:

  • #delete_backup(request, options = nil) ⇒ ::Gapic::Operation

    Pass arguments to delete_backup via a request object, either of type DeleteBackupRequest or an equivalent Hash.

    Parameters:

    • 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.

    • options (::Gapic::CallOptions, ::Hash) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #delete_backup(name: nil, request_id: nil, validate_only: nil, etag: nil) ⇒ ::Gapic::Operation

    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).

    Parameters:

    • name (::String) (defaults to: nil)

      Required. Name of the resource. For the required format, see the comment on the Backup.name field.

    • request_id (::String) (defaults to: nil)

      Optional. An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server ignores the request if it has already been completed. The server guarantees 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 the original operation with the same request ID was received, and if so, ignores 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).

    • validate_only (::Boolean) (defaults to: nil)

      Optional. If set, the backend validates the request, but doesn't actually execute it.

    • etag (::String) (defaults to: nil)

      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.

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

  • response (::Gapic::Operation)
  • operation (::GRPC::ActiveCall::Operation)

Returns:

  • (::Gapic::Operation)

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
# File 'lib/google/cloud/alloy_db/v1/alloy_db_admin/client.rb', line 3011

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
   = @config.rpcs.delete_backup..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"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
  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.name
    header_params["name"] = request.name
  end

  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
  [:"x-goog-request-params"] ||= request_params_header

  options.apply_defaults timeout:      @config.rpcs.delete_backup.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.delete_backup.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @alloy_db_admin_stub.call_rpc :delete_backup, request, options: options do |response, operation|
    response = ::Gapic::Operation.new response, @operations_client, options: options
    yield response, operation if block_given?
    return response
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end

#delete_cluster(request, options = nil) ⇒ ::Gapic::Operation #delete_cluster(name: nil, request_id: nil, etag: nil, validate_only: nil, force: nil) ⇒ ::Gapic::Operation

Deletes a single Cluster.

Examples:

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::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

Overloads:

  • #delete_cluster(request, options = nil) ⇒ ::Gapic::Operation

    Pass arguments to delete_cluster via a request object, either of type DeleteClusterRequest or an equivalent Hash.

    Parameters:

    • 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.

    • options (::Gapic::CallOptions, ::Hash) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #delete_cluster(name: nil, request_id: nil, etag: nil, validate_only: nil, force: nil) ⇒ ::Gapic::Operation

    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).

    Parameters:

    • name (::String) (defaults to: nil)

      Required. The name of the resource. For the required format, see the comment on the Cluster.name field.

    • request_id (::String) (defaults to: nil)

      Optional. An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server ignores the request if it has already been completed. The server guarantees 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 the original operation with the same request ID was received, and if so, ignores 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).

    • etag (::String) (defaults to: nil)

      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.

    • validate_only (::Boolean) (defaults to: nil)

      Optional. If set, performs request validation, for example, permission checks and any other type of validation, but does not actually execute the create request.

    • force (::Boolean) (defaults to: nil)

      Optional. Whether to cascade delete child instances for given cluster.

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

  • response (::Gapic::Operation)
  • operation (::GRPC::ActiveCall::Operation)

Returns:

  • (::Gapic::Operation)

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
# File 'lib/google/cloud/alloy_db/v1/alloy_db_admin/client.rb', line 764

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
   = @config.rpcs.delete_cluster..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"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
  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.name
    header_params["name"] = request.name
  end

  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
  [:"x-goog-request-params"] ||= request_params_header

  options.apply_defaults timeout:      @config.rpcs.delete_cluster.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.delete_cluster.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @alloy_db_admin_stub.call_rpc :delete_cluster, request, options: options do |response, operation|
    response = ::Gapic::Operation.new response, @operations_client, options: options
    yield response, operation if block_given?
    return response
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end

#delete_instance(request, options = nil) ⇒ ::Gapic::Operation #delete_instance(name: nil, request_id: nil, etag: nil, validate_only: nil) ⇒ ::Gapic::Operation

Deletes a single Instance.

Examples:

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::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

Overloads:

  • #delete_instance(request, options = nil) ⇒ ::Gapic::Operation

    Pass arguments to delete_instance via a request object, either of type DeleteInstanceRequest or an equivalent Hash.

    Parameters:

    • 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.

    • options (::Gapic::CallOptions, ::Hash) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #delete_instance(name: nil, request_id: nil, etag: nil, validate_only: nil) ⇒ ::Gapic::Operation

    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).

    Parameters:

    • name (::String) (defaults to: nil)

      Required. The name of the resource. For the required format, see the comment on the Instance.name field.

    • request_id (::String) (defaults to: nil)

      Optional. An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server ignores the request if it has already been completed. The server guarantees 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 the original operation with the same request ID was received, and if so, ignores 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).

    • etag (::String) (defaults to: nil)

      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.

    • validate_only (::Boolean) (defaults to: nil)

      Optional. If set, performs request validation, for example, permission checks and any other type of validation, but does not actually execute the create request.

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

  • response (::Gapic::Operation)
  • operation (::GRPC::ActiveCall::Operation)

Returns:

  • (::Gapic::Operation)

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
# File 'lib/google/cloud/alloy_db/v1/alloy_db_admin/client.rb', line 2026

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
   = @config.rpcs.delete_instance..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"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
  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.name
    header_params["name"] = request.name
  end

  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
  [:"x-goog-request-params"] ||= request_params_header

  options.apply_defaults timeout:      @config.rpcs.delete_instance.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.delete_instance.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @alloy_db_admin_stub.call_rpc :delete_instance, request, options: options do |response, operation|
    response = ::Gapic::Operation.new response, @operations_client, options: options
    yield response, operation if block_given?
    return response
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end

#delete_user(request, options = nil) ⇒ ::Google::Protobuf::Empty #delete_user(name: nil, request_id: nil, validate_only: nil) ⇒ ::Google::Protobuf::Empty

Deletes a single User.

Examples:

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::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

Overloads:

  • #delete_user(request, options = nil) ⇒ ::Google::Protobuf::Empty

    Pass arguments to delete_user via a request object, either of type DeleteUserRequest or an equivalent Hash.

    Parameters:

    • 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.

    • options (::Gapic::CallOptions, ::Hash) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #delete_user(name: nil, request_id: nil, validate_only: nil) ⇒ ::Google::Protobuf::Empty

    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).

    Parameters:

    • name (::String) (defaults to: nil)

      Required. The name of the resource. For the required format, see the comment on the User.name field.

    • request_id (::String) (defaults to: nil)

      Optional. An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server ignores the request if it has already been completed. The server guarantees 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 the original operation with the same request ID was received, and if so, ignores 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).

    • validate_only (::Boolean) (defaults to: nil)

      Optional. If set, the backend validates the request, but doesn't actually execute it.

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
# File 'lib/google/cloud/alloy_db/v1/alloy_db_admin/client.rb', line 3841

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
   = @config.rpcs.delete_user..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"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
  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.name
    header_params["name"] = request.name
  end

  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
  [:"x-goog-request-params"] ||= request_params_header

  options.apply_defaults timeout:      @config.rpcs.delete_user.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.delete_user.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @alloy_db_admin_stub.call_rpc :delete_user, request, options: options do |response, operation|
    yield response, operation if block_given?
    return response
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end

#execute_sql(request, options = nil) ⇒ ::Google::Cloud::AlloyDB::V1::ExecuteSqlResponse #execute_sql(password: nil, instance: nil, database: nil, user: nil, sql_statement: nil) ⇒ ::Google::Cloud::AlloyDB::V1::ExecuteSqlResponse

Executes a SQL statement in a database inside an AlloyDB instance.

Examples:

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::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::AlloyDB::V1::ExecuteSqlRequest.new

# Call the execute_sql method.
result = client.execute_sql request

# The returned object is of type Google::Cloud::AlloyDB::V1::ExecuteSqlResponse.
p result

Overloads:

  • #execute_sql(request, options = nil) ⇒ ::Google::Cloud::AlloyDB::V1::ExecuteSqlResponse

    Pass arguments to execute_sql via a request object, either of type ExecuteSqlRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::AlloyDB::V1::ExecuteSqlRequest, ::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.

    • options (::Gapic::CallOptions, ::Hash) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #execute_sql(password: nil, instance: nil, database: nil, user: nil, sql_statement: nil) ⇒ ::Google::Cloud::AlloyDB::V1::ExecuteSqlResponse

    Pass arguments to execute_sql 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).

    Parameters:

    • password (::String) (defaults to: nil)

      Optional. The database native user’s password.

    • instance (::String) (defaults to: nil)

      Required. The instance where the SQL will be executed. For the required format, see the comment on the Instance.name field.

    • database (::String) (defaults to: nil)

      Required. Name of the database where the query will be executed. Note - Value provided should be the same as expected from SELECT current_database(); and NOT as a resource reference.

    • user (::String) (defaults to: nil)

      Required. Database user to be used for executing the SQL. Note - Value provided should be the same as expected from SELECT current_user; and NOT as a resource reference.

    • sql_statement (::String) (defaults to: nil)

      Required. SQL statement to execute on database. Any valid statement is permitted, including DDL, DML, DQL statements.

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
# File 'lib/google/cloud/alloy_db/v1/alloy_db_admin/client.rb', line 2475

def execute_sql request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::AlloyDB::V1::ExecuteSqlRequest

  # 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
   = @config.rpcs.execute_sql..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"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
  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.instance
    header_params["instance"] = request.instance
  end

  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
  [:"x-goog-request-params"] ||= request_params_header

  options.apply_defaults timeout:      @config.rpcs.execute_sql.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.execute_sql.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @alloy_db_admin_stub.call_rpc :execute_sql, request, options: options do |response, operation|
    yield response, operation if block_given?
    return response
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end

#failover_instance(request, options = nil) ⇒ ::Gapic::Operation #failover_instance(name: nil, request_id: nil, validate_only: nil) ⇒ ::Gapic::Operation

Forces a Failover for a highly available instance. Failover promotes the HA standby instance as the new primary. Imperative only.

Examples:

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::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

Overloads:

  • #failover_instance(request, options = nil) ⇒ ::Gapic::Operation

    Pass arguments to failover_instance via a request object, either of type FailoverInstanceRequest or an equivalent Hash.

    Parameters:

    • 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.

    • options (::Gapic::CallOptions, ::Hash) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #failover_instance(name: nil, request_id: nil, validate_only: nil) ⇒ ::Gapic::Operation

    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).

    Parameters:

    • name (::String) (defaults to: nil)

      Required. The name of the resource. For the required format, see the comment on the Instance.name field.

    • request_id (::String) (defaults to: nil)

      Optional. An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server ignores the request if it has already been completed. The server guarantees 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 the original operation with the same request ID was received, and if so, ignores 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).

    • validate_only (::Boolean) (defaults to: nil)

      Optional. If set, performs request validation, for example, permission checks and any other type of validation, but does not actually execute the create request.

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

  • response (::Gapic::Operation)
  • operation (::GRPC::ActiveCall::Operation)

Returns:

  • (::Gapic::Operation)

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
# File 'lib/google/cloud/alloy_db/v1/alloy_db_admin/client.rb', line 2141

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
   = @config.rpcs.failover_instance..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"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
  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.name
    header_params["name"] = request.name
  end

  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
  [:"x-goog-request-params"] ||= request_params_header

  options.apply_defaults timeout:      @config.rpcs.failover_instance.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.failover_instance.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @alloy_db_admin_stub.call_rpc :failover_instance, request, options: options do |response, operation|
    response = ::Gapic::Operation.new response, @operations_client, options: options
    yield response, operation if block_given?
    return response
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end

#generate_client_certificate(request, options = nil) ⇒ ::Google::Cloud::AlloyDB::V1::GenerateClientCertificateResponse #generate_client_certificate(parent: nil, request_id: nil, cert_duration: nil, public_key: nil, use_metadata_exchange: nil) ⇒ ::Google::Cloud::AlloyDB::V1::GenerateClientCertificateResponse

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.

Examples:

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::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

Overloads:

  • #generate_client_certificate(request, options = nil) ⇒ ::Google::Cloud::AlloyDB::V1::GenerateClientCertificateResponse

    Pass arguments to generate_client_certificate via a request object, either of type GenerateClientCertificateRequest or an equivalent Hash.

    Parameters:

    • 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.

    • options (::Gapic::CallOptions, ::Hash) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #generate_client_certificate(parent: nil, request_id: nil, cert_duration: nil, public_key: nil, use_metadata_exchange: nil) ⇒ ::Google::Cloud::AlloyDB::V1::GenerateClientCertificateResponse

    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).

    Parameters:

    • parent (::String) (defaults to: nil)

      Required. The name of the parent resource. The required format is:

      • projects/{project}/locations/{location}/clusters/{cluster}
    • request_id (::String) (defaults to: nil)

      Optional. An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server ignores the request if it has already been completed. The server guarantees 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 the original operation with the same request ID was received, and if so, ignores 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).

    • cert_duration (::Google::Protobuf::Duration, ::Hash) (defaults to: nil)

      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.

    • public_key (::String) (defaults to: nil)

      Optional. The public key from the client.

    • use_metadata_exchange (::Boolean) (defaults to: nil)

      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.

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
# File 'lib/google/cloud/alloy_db/v1/alloy_db_admin/client.rb', line 3231

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
   = @config.rpcs.generate_client_certificate..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"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
  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.parent
    header_params["parent"] = request.parent
  end

  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
  [:"x-goog-request-params"] ||= request_params_header

  options.apply_defaults timeout:      @config.rpcs.generate_client_certificate.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.generate_client_certificate.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @alloy_db_admin_stub.call_rpc :generate_client_certificate, request, options: options do |response, operation|
    yield response, operation if block_given?
    return response
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end

#get_backup(request, options = nil) ⇒ ::Google::Cloud::AlloyDB::V1::Backup #get_backup(name: nil) ⇒ ::Google::Cloud::AlloyDB::V1::Backup

Gets details of a single Backup.

Examples:

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::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

Overloads:

  • #get_backup(request, options = nil) ⇒ ::Google::Cloud::AlloyDB::V1::Backup

    Pass arguments to get_backup via a request object, either of type GetBackupRequest or an equivalent Hash.

    Parameters:

    • 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.

    • options (::Gapic::CallOptions, ::Hash) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #get_backup(name: nil) ⇒ ::Google::Cloud::AlloyDB::V1::Backup

    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).

    Parameters:

    • name (::String) (defaults to: nil)

      Required. Name of the resource

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
# File 'lib/google/cloud/alloy_db/v1/alloy_db_admin/client.rb', line 2661

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
   = @config.rpcs.get_backup..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"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
  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.name
    header_params["name"] = request.name
  end

  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
  [:"x-goog-request-params"] ||= request_params_header

  options.apply_defaults timeout:      @config.rpcs.get_backup.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.get_backup.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @alloy_db_admin_stub.call_rpc :get_backup, request, options: options do |response, operation|
    yield response, operation if block_given?
    return response
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end

#get_cluster(request, options = nil) ⇒ ::Google::Cloud::AlloyDB::V1::Cluster #get_cluster(name: nil, view: nil) ⇒ ::Google::Cloud::AlloyDB::V1::Cluster

Gets details of a single Cluster.

Examples:

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::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

Overloads:

  • #get_cluster(request, options = nil) ⇒ ::Google::Cloud::AlloyDB::V1::Cluster

    Pass arguments to get_cluster via a request object, either of type GetClusterRequest or an equivalent Hash.

    Parameters:

    • 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.

    • options (::Gapic::CallOptions, ::Hash) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #get_cluster(name: nil, view: nil) ⇒ ::Google::Cloud::AlloyDB::V1::Cluster

    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).

    Parameters:

    • name (::String) (defaults to: nil)

      Required. The name of the resource. For the required format, see the comment on the Cluster.name field.

    • view (::Google::Cloud::AlloyDB::V1::ClusterView) (defaults to: nil)

      Optional. The view of the cluster to return. Returns all default fields if not set.

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
# File 'lib/google/cloud/alloy_db/v1/alloy_db_admin/client.rb', line 408

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
   = @config.rpcs.get_cluster..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"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
  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.name
    header_params["name"] = request.name
  end

  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
  [:"x-goog-request-params"] ||= request_params_header

  options.apply_defaults timeout:      @config.rpcs.get_cluster.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.get_cluster.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @alloy_db_admin_stub.call_rpc :get_cluster, request, options: options do |response, operation|
    yield response, operation if block_given?
    return response
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end

#get_connection_info(request, options = nil) ⇒ ::Google::Cloud::AlloyDB::V1::ConnectionInfo #get_connection_info(parent: nil, request_id: nil) ⇒ ::Google::Cloud::AlloyDB::V1::ConnectionInfo

Get instance metadata used for a connection.

Examples:

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::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

Overloads:

  • #get_connection_info(request, options = nil) ⇒ ::Google::Cloud::AlloyDB::V1::ConnectionInfo

    Pass arguments to get_connection_info via a request object, either of type GetConnectionInfoRequest or an equivalent Hash.

    Parameters:

    • 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.

    • options (::Gapic::CallOptions, ::Hash) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #get_connection_info(parent: nil, request_id: nil) ⇒ ::Google::Cloud::AlloyDB::V1::ConnectionInfo

    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).

    Parameters:

    • parent (::String) (defaults to: nil)

      Required. The name of the parent resource. The required format is: projects/{project}/locations/{location}/clusters/{cluster}/instances/{instance}

    • request_id (::String) (defaults to: nil)

      Optional. An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server ignores the request if it has already been completed. The server guarantees 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 the original operation with the same request ID was received, and if so, ignores 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).

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
# File 'lib/google/cloud/alloy_db/v1/alloy_db_admin/client.rb', line 3332

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
   = @config.rpcs.get_connection_info..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"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
  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.parent
    header_params["parent"] = request.parent
  end

  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
  [:"x-goog-request-params"] ||= request_params_header

  options.apply_defaults timeout:      @config.rpcs.get_connection_info.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.get_connection_info.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @alloy_db_admin_stub.call_rpc :get_connection_info, request, options: options do |response, operation|
    yield response, operation if block_given?
    return response
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end

#get_instance(request, options = nil) ⇒ ::Google::Cloud::AlloyDB::V1::Instance #get_instance(name: nil, view: nil) ⇒ ::Google::Cloud::AlloyDB::V1::Instance

Gets details of a single Instance.

Examples:

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::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

Overloads:

  • #get_instance(request, options = nil) ⇒ ::Google::Cloud::AlloyDB::V1::Instance

    Pass arguments to get_instance via a request object, either of type GetInstanceRequest or an equivalent Hash.

    Parameters:

    • 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.

    • options (::Gapic::CallOptions, ::Hash) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #get_instance(name: nil, view: nil) ⇒ ::Google::Cloud::AlloyDB::V1::Instance

    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).

    Parameters:

    • name (::String) (defaults to: nil)

      Required. The name of the resource. For the required format, see the comment on the Instance.name field.

    • view (::Google::Cloud::AlloyDB::V1::InstanceView) (defaults to: nil)

      The view of the instance to return.

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
# File 'lib/google/cloud/alloy_db/v1/alloy_db_admin/client.rb', line 1436

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
   = @config.rpcs.get_instance..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"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
  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.name
    header_params["name"] = request.name
  end

  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
  [:"x-goog-request-params"] ||= request_params_header

  options.apply_defaults timeout:      @config.rpcs.get_instance.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.get_instance.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @alloy_db_admin_stub.call_rpc :get_instance, request, options: options do |response, operation|
    yield response, operation if block_given?
    return response
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end

#get_user(request, options = nil) ⇒ ::Google::Cloud::AlloyDB::V1::User #get_user(name: nil) ⇒ ::Google::Cloud::AlloyDB::V1::User

Gets details of a single User.

Examples:

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::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

Overloads:

  • #get_user(request, options = nil) ⇒ ::Google::Cloud::AlloyDB::V1::User

    Pass arguments to get_user via a request object, either of type GetUserRequest or an equivalent Hash.

    Parameters:

    • 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.

    • options (::Gapic::CallOptions, ::Hash) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #get_user(name: nil) ⇒ ::Google::Cloud::AlloyDB::V1::User

    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).

    Parameters:

    • name (::String) (defaults to: nil)

      Required. The name of the resource. For the required format, see the comment on the User.name field.

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
# File 'lib/google/cloud/alloy_db/v1/alloy_db_admin/client.rb', line 3519

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
   = @config.rpcs.get_user..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"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
  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.name
    header_params["name"] = request.name
  end

  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
  [:"x-goog-request-params"] ||= request_params_header

  options.apply_defaults timeout:      @config.rpcs.get_user.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.get_user.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @alloy_db_admin_stub.call_rpc :get_user, request, options: options do |response, operation|
    yield response, operation if block_given?
    return response
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end

#inject_fault(request, options = nil) ⇒ ::Gapic::Operation #inject_fault(fault_type: nil, name: nil, request_id: nil, validate_only: nil) ⇒ ::Gapic::Operation

Injects fault in an instance. Imperative only.

Examples:

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::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

Overloads:

  • #inject_fault(request, options = nil) ⇒ ::Gapic::Operation

    Pass arguments to inject_fault via a request object, either of type InjectFaultRequest or an equivalent Hash.

    Parameters:

    • 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.

    • options (::Gapic::CallOptions, ::Hash) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #inject_fault(fault_type: nil, name: nil, request_id: nil, validate_only: nil) ⇒ ::Gapic::Operation

    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).

    Parameters:

    • fault_type (::Google::Cloud::AlloyDB::V1::InjectFaultRequest::FaultType) (defaults to: nil)

      Required. The type of fault to be injected in an instance.

    • name (::String) (defaults to: nil)

      Required. The name of the resource. For the required format, see the comment on the Instance.name field.

    • request_id (::String) (defaults to: nil)

      Optional. An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server ignores the request if it has already been completed. The server guarantees 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 the original operation with the same request ID was received, and if so, ignores 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).

    • validate_only (::Boolean) (defaults to: nil)

      Optional. If set, performs request validation, for example, permission checks and any other type of validation, but does not actually execute the create request.

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

  • response (::Gapic::Operation)
  • operation (::GRPC::ActiveCall::Operation)

Returns:

  • (::Gapic::Operation)

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
# File 'lib/google/cloud/alloy_db/v1/alloy_db_admin/client.rb', line 2257

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
   = @config.rpcs.inject_fault..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"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
  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.name
    header_params["name"] = request.name
  end

  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
  [:"x-goog-request-params"] ||= request_params_header

  options.apply_defaults timeout:      @config.rpcs.inject_fault.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.inject_fault.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @alloy_db_admin_stub.call_rpc :inject_fault, request, options: options do |response, operation|
    response = ::Gapic::Operation.new response, @operations_client, options: options
    yield response, operation if block_given?
    return response
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end

#list_backups(request, options = nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::AlloyDB::V1::Backup> #list_backups(parent: nil, page_size: nil, page_token: nil, filter: nil, order_by: nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::AlloyDB::V1::Backup>

Lists Backups in a given project and location.

Examples:

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::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

Overloads:

  • #list_backups(request, options = nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::AlloyDB::V1::Backup>

    Pass arguments to list_backups via a request object, either of type ListBackupsRequest or an equivalent Hash.

    Parameters:

    • 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.

    • options (::Gapic::CallOptions, ::Hash) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #list_backups(parent: nil, page_size: nil, page_token: nil, filter: nil, order_by: nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::AlloyDB::V1::Backup>

    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).

    Parameters:

    • parent (::String) (defaults to: nil)

      Required. Parent value for ListBackupsRequest

    • page_size (::Integer) (defaults to: nil)

      Requested page size. Server may return fewer items than requested. If unspecified, server will pick an appropriate default.

    • page_token (::String) (defaults to: nil)

      A token identifying a page of results the server should return.

    • filter (::String) (defaults to: nil)

      Filtering results

    • order_by (::String) (defaults to: nil)

      Hint for how to order the results

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
# File 'lib/google/cloud/alloy_db/v1/alloy_db_admin/client.rb', line 2574

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
   = @config.rpcs.list_backups..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"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
  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.parent
    header_params["parent"] = request.parent
  end

  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
  [:"x-goog-request-params"] ||= request_params_header

  options.apply_defaults timeout:      @config.rpcs.list_backups.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.list_backups.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @alloy_db_admin_stub.call_rpc :list_backups, request, options: options do |response, operation|
    response = ::Gapic::PagedEnumerable.new @alloy_db_admin_stub, :list_backups, request, response, operation, options
    yield response, operation if block_given?
    return response
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end

#list_clusters(request, options = nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::AlloyDB::V1::Cluster> #list_clusters(parent: nil, page_size: nil, page_token: nil, filter: nil, order_by: nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::AlloyDB::V1::Cluster>

Lists Clusters in a given project and location.

Examples:

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::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

Overloads:

  • #list_clusters(request, options = nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::AlloyDB::V1::Cluster>

    Pass arguments to list_clusters via a request object, either of type ListClustersRequest or an equivalent Hash.

    Parameters:

    • 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.

    • options (::Gapic::CallOptions, ::Hash) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #list_clusters(parent: nil, page_size: nil, page_token: nil, filter: nil, order_by: nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::AlloyDB::V1::Cluster>

    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).

    Parameters:

    • parent (::String) (defaults to: nil)

      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/-
    • page_size (::Integer) (defaults to: nil)

      Optional. Requested page size. Server may return fewer items than requested. If unspecified, server will pick an appropriate default.

    • page_token (::String) (defaults to: nil)

      A token identifying a page of results the server should return.

    • filter (::String) (defaults to: nil)

      Optional. Filtering results

    • order_by (::String) (defaults to: nil)

      Optional. Hint for how to order the results

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
# File 'lib/google/cloud/alloy_db/v1/alloy_db_admin/client.rb', line 317

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
   = @config.rpcs.list_clusters..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"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
  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.parent
    header_params["parent"] = request.parent
  end

  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
  [:"x-goog-request-params"] ||= request_params_header

  options.apply_defaults timeout:      @config.rpcs.list_clusters.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.list_clusters.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @alloy_db_admin_stub.call_rpc :list_clusters, request, options: options do |response, operation|
    response = ::Gapic::PagedEnumerable.new @alloy_db_admin_stub, :list_clusters, request, response, operation, options
    yield response, operation if block_given?
    return response
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end

#list_databases(request, options = nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::AlloyDB::V1::Database> #list_databases(parent: nil, page_size: nil, page_token: nil, filter: nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::AlloyDB::V1::Database>

Lists Databases in a given project and location.

Examples:

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::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::AlloyDB::V1::ListDatabasesRequest.new

# Call the list_databases method.
result = client.list_databases 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::Database.
  p item
end

Overloads:

  • #list_databases(request, options = nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::AlloyDB::V1::Database>

    Pass arguments to list_databases via a request object, either of type ListDatabasesRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::AlloyDB::V1::ListDatabasesRequest, ::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.

    • options (::Gapic::CallOptions, ::Hash) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #list_databases(parent: nil, page_size: nil, page_token: nil, filter: nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::AlloyDB::V1::Database>

    Pass arguments to list_databases 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).

    Parameters:

    • parent (::String) (defaults to: nil)

      Required. Parent value for ListDatabasesRequest.

    • page_size (::Integer) (defaults to: nil)

      Optional. The maximum number of databases to return. The service may return fewer than this value. If unspecified, 2000 is the default page_size. The max value of page_size will be 4000, values above max will be coerced to max.

    • page_token (::String) (defaults to: nil)

      Optional. A page token, received from a previous ListDatabases call. This should be provided to retrieve the subsequent page. This field is currently not supported, its value will be ignored if passed.

    • filter (::String) (defaults to: nil)

      Optional. Filtering results. This field is currently not supported, its value will be ignored if passed.

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
# File 'lib/google/cloud/alloy_db/v1/alloy_db_admin/client.rb', line 3943

def list_databases request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::AlloyDB::V1::ListDatabasesRequest

  # 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
   = @config.rpcs.list_databases..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"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
  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.parent
    header_params["parent"] = request.parent
  end

  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
  [:"x-goog-request-params"] ||= request_params_header

  options.apply_defaults timeout:      @config.rpcs.list_databases.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.list_databases.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @alloy_db_admin_stub.call_rpc :list_databases, request, options: options do |response, operation|
    response = ::Gapic::PagedEnumerable.new @alloy_db_admin_stub, :list_databases, request, response, operation, options
    yield response, operation if block_given?
    return response
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end

#list_instances(request, options = nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::AlloyDB::V1::Instance> #list_instances(parent: nil, page_size: nil, page_token: nil, filter: nil, order_by: nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::AlloyDB::V1::Instance>

Lists Instances in a given project and location.

Examples:

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::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

Overloads:

  • #list_instances(request, options = nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::AlloyDB::V1::Instance>

    Pass arguments to list_instances via a request object, either of type ListInstancesRequest or an equivalent Hash.

    Parameters:

    • 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.

    • options (::Gapic::CallOptions, ::Hash) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #list_instances(parent: nil, page_size: nil, page_token: nil, filter: nil, order_by: nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::AlloyDB::V1::Instance>

    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).

    Parameters:

    • parent (::String) (defaults to: nil)

      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/-
    • page_size (::Integer) (defaults to: nil)

      Optional. Requested page size. Server may return fewer items than requested. If unspecified, server will pick an appropriate default.

    • page_token (::String) (defaults to: nil)

      A token identifying a page of results the server should return.

    • filter (::String) (defaults to: nil)

      Optional. Filtering results

    • order_by (::String) (defaults to: nil)

      Optional. Hint for how to order the results

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
# File 'lib/google/cloud/alloy_db/v1/alloy_db_admin/client.rb', line 1346

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
   = @config.rpcs.list_instances..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"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
  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.parent
    header_params["parent"] = request.parent
  end

  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
  [:"x-goog-request-params"] ||= request_params_header

  options.apply_defaults timeout:      @config.rpcs.list_instances.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.list_instances.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @alloy_db_admin_stub.call_rpc :list_instances, request, options: options do |response, operation|
    response = ::Gapic::PagedEnumerable.new @alloy_db_admin_stub, :list_instances, request, response, operation, options
    yield response, operation if block_given?
    return response
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end

#list_supported_database_flags(request, options = nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::AlloyDB::V1::SupportedDatabaseFlag> #list_supported_database_flags(parent: nil, page_size: nil, page_token: nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::AlloyDB::V1::SupportedDatabaseFlag>

Lists SupportedDatabaseFlags for a given project and location.

Examples:

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::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

Overloads:

  • #list_supported_database_flags(request, options = nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::AlloyDB::V1::SupportedDatabaseFlag>

    Pass arguments to list_supported_database_flags via a request object, either of type ListSupportedDatabaseFlagsRequest or an equivalent Hash.

    Parameters:

    • 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.

    • options (::Gapic::CallOptions, ::Hash) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #list_supported_database_flags(parent: nil, page_size: nil, page_token: nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::AlloyDB::V1::SupportedDatabaseFlag>

    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).

    Parameters:

    • parent (::String) (defaults to: nil)

      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.

    • page_size (::Integer) (defaults to: nil)

      Requested page size. Server may return fewer items than requested. If unspecified, server will pick an appropriate default.

    • page_token (::String) (defaults to: nil)

      A token identifying a page of results the server should return.

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
# File 'lib/google/cloud/alloy_db/v1/alloy_db_admin/client.rb', line 3113

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
   = @config.rpcs.list_supported_database_flags..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"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
  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.parent
    header_params["parent"] = request.parent
  end

  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
  [:"x-goog-request-params"] ||= request_params_header

  options.apply_defaults timeout:      @config.rpcs.list_supported_database_flags.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.list_supported_database_flags.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @alloy_db_admin_stub.call_rpc :list_supported_database_flags, request, options: options do |response, operation|
    response = ::Gapic::PagedEnumerable.new @alloy_db_admin_stub, :list_supported_database_flags, request, response, operation, options
    yield response, operation if block_given?
    return response
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end

#list_users(request, options = nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::AlloyDB::V1::User> #list_users(parent: nil, page_size: nil, page_token: nil, filter: nil, order_by: nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::AlloyDB::V1::User>

Lists Users in a given project and location.

Examples:

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::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

Overloads:

  • #list_users(request, options = nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::AlloyDB::V1::User>

    Pass arguments to list_users via a request object, either of type ListUsersRequest or an equivalent Hash.

    Parameters:

    • 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.

    • options (::Gapic::CallOptions, ::Hash) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #list_users(parent: nil, page_size: nil, page_token: nil, filter: nil, order_by: nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::AlloyDB::V1::User>

    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).

    Parameters:

    • parent (::String) (defaults to: nil)

      Required. Parent value for ListUsersRequest

    • page_size (::Integer) (defaults to: nil)

      Optional. Requested page size. Server may return fewer items than requested. If unspecified, server will pick an appropriate default.

    • page_token (::String) (defaults to: nil)

      Optional. A token identifying a page of results the server should return.

    • filter (::String) (defaults to: nil)

      Optional. Filtering results

    • order_by (::String) (defaults to: nil)

      Optional. Hint for how to order the results

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
# File 'lib/google/cloud/alloy_db/v1/alloy_db_admin/client.rb', line 3431

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
   = @config.rpcs.list_users..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"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
  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.parent
    header_params["parent"] = request.parent
  end

  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
  [:"x-goog-request-params"] ||= request_params_header

  options.apply_defaults timeout:      @config.rpcs.list_users.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.list_users.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @alloy_db_admin_stub.call_rpc :list_users, request, options: options do |response, operation|
    response = ::Gapic::PagedEnumerable.new @alloy_db_admin_stub, :list_users, request, response, operation, options
    yield response, operation if block_given?
    return response
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end

#promote_cluster(request, options = nil) ⇒ ::Gapic::Operation #promote_cluster(name: nil, request_id: nil, etag: nil, validate_only: nil) ⇒ ::Gapic::Operation

Promotes a SECONDARY cluster. This turns down replication from the PRIMARY cluster and promotes a secondary cluster into its own standalone cluster. Imperative only.

Examples:

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::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

Overloads:

  • #promote_cluster(request, options = nil) ⇒ ::Gapic::Operation

    Pass arguments to promote_cluster via a request object, either of type PromoteClusterRequest or an equivalent Hash.

    Parameters:

    • 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.

    • options (::Gapic::CallOptions, ::Hash) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #promote_cluster(name: nil, request_id: nil, etag: nil, validate_only: nil) ⇒ ::Gapic::Operation

    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).

    Parameters:

    • name (::String) (defaults to: nil)

      Required. The name of the resource. For the required format, see the comment on the Cluster.name field

    • request_id (::String) (defaults to: nil)

      Optional. An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server ignores the request if it has already been completed. The server guarantees 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).

    • etag (::String) (defaults to: nil)

      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.

    • validate_only (::Boolean) (defaults to: nil)

      Optional. If set, performs request validation, for example, permission checks and any other type of validation, but does not actually execute the create request.

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

  • response (::Gapic::Operation)
  • operation (::GRPC::ActiveCall::Operation)

Returns:

  • (::Gapic::Operation)

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
# File 'lib/google/cloud/alloy_db/v1/alloy_db_admin/client.rb', line 884

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
   = @config.rpcs.promote_cluster..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"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
  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.name
    header_params["name"] = request.name
  end

  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
  [:"x-goog-request-params"] ||= request_params_header

  options.apply_defaults timeout:      @config.rpcs.promote_cluster.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.promote_cluster.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @alloy_db_admin_stub.call_rpc :promote_cluster, request, options: options do |response, operation|
    response = ::Gapic::Operation.new response, @operations_client, options: options
    yield response, operation if block_given?
    return response
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end

#restart_instance(request, options = nil) ⇒ ::Gapic::Operation #restart_instance(name: nil, request_id: nil, validate_only: nil, node_ids: nil) ⇒ ::Gapic::Operation

Restart an Instance in a cluster. Imperative only.

Examples:

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::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

Overloads:

  • #restart_instance(request, options = nil) ⇒ ::Gapic::Operation

    Pass arguments to restart_instance via a request object, either of type RestartInstanceRequest or an equivalent Hash.

    Parameters:

    • 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.

    • options (::Gapic::CallOptions, ::Hash) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #restart_instance(name: nil, request_id: nil, validate_only: nil, node_ids: nil) ⇒ ::Gapic::Operation

    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).

    Parameters:

    • name (::String) (defaults to: nil)

      Required. The name of the resource. For the required format, see the comment on the Instance.name field.

    • request_id (::String) (defaults to: nil)

      Optional. An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server ignores the request if it has already been completed. The server guarantees 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 the original operation with the same request ID was received, and if so, ignores 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).

    • validate_only (::Boolean) (defaults to: nil)

      Optional. If set, performs request validation, for example, permission checks and any other type of validation, but does not actually execute the create request.

    • node_ids (::Array<::String>) (defaults to: nil)

      Optional. Full name of the nodes as obtained from INSTANCE_VIEW_FULL to restart upon. Applicable only to read instances.

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

  • response (::Gapic::Operation)
  • operation (::GRPC::ActiveCall::Operation)

Returns:

  • (::Gapic::Operation)

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
# File 'lib/google/cloud/alloy_db/v1/alloy_db_admin/client.rb', line 2374

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
   = @config.rpcs.restart_instance..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"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
  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.name
    header_params["name"] = request.name
  end

  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
  [:"x-goog-request-params"] ||= request_params_header

  options.apply_defaults timeout:      @config.rpcs.restart_instance.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.restart_instance.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @alloy_db_admin_stub.call_rpc :restart_instance, request, options: options do |response, operation|
    response = ::Gapic::Operation.new response, @operations_client, options: options
    yield response, operation if block_given?
    return response
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end

#restore_cluster(request, options = nil) ⇒ ::Gapic::Operation #restore_cluster(backup_source: nil, continuous_backup_source: nil, parent: nil, cluster_id: nil, cluster: nil, request_id: nil, validate_only: nil) ⇒ ::Gapic::Operation

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.

Examples:

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::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

Overloads:

  • #restore_cluster(request, options = nil) ⇒ ::Gapic::Operation

    Pass arguments to restore_cluster via a request object, either of type RestoreClusterRequest or an equivalent Hash.

    Parameters:

    • 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.

    • options (::Gapic::CallOptions, ::Hash) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #restore_cluster(backup_source: nil, continuous_backup_source: nil, parent: nil, cluster_id: nil, cluster: nil, request_id: nil, validate_only: nil) ⇒ ::Gapic::Operation

    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).

    Parameters:

    • backup_source (::Google::Cloud::AlloyDB::V1::BackupSource, ::Hash) (defaults to: nil)

      Backup source.

    • continuous_backup_source (::Google::Cloud::AlloyDB::V1::ContinuousBackupSource, ::Hash) (defaults to: nil)

      ContinuousBackup source. Continuous backup needs to be enabled in the source cluster for this operation to succeed.

    • parent (::String) (defaults to: nil)

      Required. The name of the parent resource. For the required format, see the comment on the Cluster.name field.

    • cluster_id (::String) (defaults to: nil)

      Required. ID of the requesting object.

    • cluster (::Google::Cloud::AlloyDB::V1::Cluster, ::Hash) (defaults to: nil)

      Required. The resource being created

    • request_id (::String) (defaults to: nil)

      Optional. An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server ignores the request if it has already been completed. The server guarantees 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 the original operation with the same request ID was received, and if so, ignores 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).

    • validate_only (::Boolean) (defaults to: nil)

      Optional. If set, performs request validation, for example, permission checks and any other type of validation, but does not actually execute the create request.

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

  • response (::Gapic::Operation)
  • operation (::GRPC::ActiveCall::Operation)

Returns:

  • (::Gapic::Operation)

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
# File 'lib/google/cloud/alloy_db/v1/alloy_db_admin/client.rb', line 1123

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
   = @config.rpcs.restore_cluster..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"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
  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.parent
    header_params["parent"] = request.parent
  end

  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
  [:"x-goog-request-params"] ||= request_params_header

  options.apply_defaults timeout:      @config.rpcs.restore_cluster.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.restore_cluster.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @alloy_db_admin_stub.call_rpc :restore_cluster, request, options: options do |response, operation|
    response = ::Gapic::Operation.new response, @operations_client, options: options
    yield response, operation if block_given?
    return response
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end

#switchover_cluster(request, options = nil) ⇒ ::Gapic::Operation #switchover_cluster(name: nil, request_id: nil, validate_only: nil) ⇒ ::Gapic::Operation

Switches the roles of PRIMARY and SECONDARY clusters without any data loss. This promotes the SECONDARY cluster to PRIMARY and sets up the original PRIMARY cluster to replicate from this newly promoted cluster.

Examples:

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::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::AlloyDB::V1::SwitchoverClusterRequest.new

# Call the switchover_cluster method.
result = client.switchover_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

Overloads:

  • #switchover_cluster(request, options = nil) ⇒ ::Gapic::Operation

    Pass arguments to switchover_cluster via a request object, either of type SwitchoverClusterRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::AlloyDB::V1::SwitchoverClusterRequest, ::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.

    • options (::Gapic::CallOptions, ::Hash) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #switchover_cluster(name: nil, request_id: nil, validate_only: nil) ⇒ ::Gapic::Operation

    Pass arguments to switchover_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).

    Parameters:

    • name (::String) (defaults to: nil)

      Required. The name of the resource. For the required format, see the comment on the Cluster.name field

    • request_id (::String) (defaults to: nil)

      Optional. An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server ignores the request if it has already been completed. The server guarantees 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 the original operation with the same request ID was received, and if so, ignores 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).

    • validate_only (::Boolean) (defaults to: nil)

      Optional. If set, performs request validation, for example, permission checks and any other type of validation, but does not actually execute the create request.

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

  • response (::Gapic::Operation)
  • operation (::GRPC::ActiveCall::Operation)

Returns:

  • (::Gapic::Operation)

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
# File 'lib/google/cloud/alloy_db/v1/alloy_db_admin/client.rb', line 999

def switchover_cluster request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::AlloyDB::V1::SwitchoverClusterRequest

  # 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
   = @config.rpcs.switchover_cluster..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"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
  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.name
    header_params["name"] = request.name
  end

  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
  [:"x-goog-request-params"] ||= request_params_header

  options.apply_defaults timeout:      @config.rpcs.switchover_cluster.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.switchover_cluster.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @alloy_db_admin_stub.call_rpc :switchover_cluster, request, options: options do |response, operation|
    response = ::Gapic::Operation.new response, @operations_client, options: options
    yield response, operation if block_given?
    return response
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end

#universe_domainString

The effective universe domain

Returns:

  • (String)


153
154
155
# File 'lib/google/cloud/alloy_db/v1/alloy_db_admin/client.rb', line 153

def universe_domain
  @alloy_db_admin_stub.universe_domain
end

#update_backup(request, options = nil) ⇒ ::Gapic::Operation #update_backup(update_mask: nil, backup: nil, request_id: nil, validate_only: nil, allow_missing: nil) ⇒ ::Gapic::Operation

Updates the parameters of a single Backup.

Examples:

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::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

Overloads:

  • #update_backup(request, options = nil) ⇒ ::Gapic::Operation

    Pass arguments to update_backup via a request object, either of type UpdateBackupRequest or an equivalent Hash.

    Parameters:

    • 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.

    • options (::Gapic::CallOptions, ::Hash) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #update_backup(update_mask: nil, backup: nil, request_id: nil, validate_only: nil, allow_missing: nil) ⇒ ::Gapic::Operation

    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).

    Parameters:

    • update_mask (::Google::Protobuf::FieldMask, ::Hash) (defaults to: nil)

      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.

    • backup (::Google::Cloud::AlloyDB::V1::Backup, ::Hash) (defaults to: nil)

      Required. The resource being updated

    • request_id (::String) (defaults to: nil)

      Optional. An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server ignores the request if it has already been completed. The server guarantees 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 the original operation with the same request ID was received, and if so, ignores 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).

    • validate_only (::Boolean) (defaults to: nil)

      Optional. If set, the backend validates the request, but doesn't actually execute it.

    • allow_missing (::Boolean) (defaults to: nil)

      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.

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

  • response (::Gapic::Operation)
  • operation (::GRPC::ActiveCall::Operation)

Returns:

  • (::Gapic::Operation)

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
# File 'lib/google/cloud/alloy_db/v1/alloy_db_admin/client.rb', line 2895

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
   = @config.rpcs.update_backup..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"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
  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.backup&.name
    header_params["backup.name"] = request.backup.name
  end

  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
  [:"x-goog-request-params"] ||= request_params_header

  options.apply_defaults timeout:      @config.rpcs.update_backup.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.update_backup.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @alloy_db_admin_stub.call_rpc :update_backup, request, options: options do |response, operation|
    response = ::Gapic::Operation.new response, @operations_client, options: options
    yield response, operation if block_given?
    return response
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end

#update_cluster(request, options = nil) ⇒ ::Gapic::Operation #update_cluster(update_mask: nil, cluster: nil, request_id: nil, validate_only: nil, allow_missing: nil) ⇒ ::Gapic::Operation

Updates the parameters of a single Cluster.

Examples:

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::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

Overloads:

  • #update_cluster(request, options = nil) ⇒ ::Gapic::Operation

    Pass arguments to update_cluster via a request object, either of type UpdateClusterRequest or an equivalent Hash.

    Parameters:

    • 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.

    • options (::Gapic::CallOptions, ::Hash) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #update_cluster(update_mask: nil, cluster: nil, request_id: nil, validate_only: nil, allow_missing: nil) ⇒ ::Gapic::Operation

    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).

    Parameters:

    • update_mask (::Google::Protobuf::FieldMask, ::Hash) (defaults to: nil)

      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.

    • cluster (::Google::Cloud::AlloyDB::V1::Cluster, ::Hash) (defaults to: nil)

      Required. The resource being updated

    • request_id (::String) (defaults to: nil)

      Optional. An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server ignores the request if it has already been completed. The server guarantees 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 the original operation with the same request ID was received, and if so, ignores 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).

    • validate_only (::Boolean) (defaults to: nil)

      Optional. If set, performs request validation, for example, permission checks and any other type of validation, but does not actually execute the create request.

    • allow_missing (::Boolean) (defaults to: nil)

      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.

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

  • response (::Gapic::Operation)
  • operation (::GRPC::ActiveCall::Operation)

Returns:

  • (::Gapic::Operation)

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
# File 'lib/google/cloud/alloy_db/v1/alloy_db_admin/client.rb', line 645

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
   = @config.rpcs.update_cluster..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"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
  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.cluster&.name
    header_params["cluster.name"] = request.cluster.name
  end

  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
  [:"x-goog-request-params"] ||= request_params_header

  options.apply_defaults timeout:      @config.rpcs.update_cluster.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.update_cluster.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @alloy_db_admin_stub.call_rpc :update_cluster, request, options: options do |response, operation|
    response = ::Gapic::Operation.new response, @operations_client, options: options
    yield response, operation if block_given?
    return response
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end

#update_instance(request, options = nil) ⇒ ::Gapic::Operation #update_instance(update_mask: nil, instance: nil, request_id: nil, validate_only: nil, allow_missing: nil) ⇒ ::Gapic::Operation

Updates the parameters of a single Instance.

Examples:

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::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

Overloads:

  • #update_instance(request, options = nil) ⇒ ::Gapic::Operation

    Pass arguments to update_instance via a request object, either of type UpdateInstanceRequest or an equivalent Hash.

    Parameters:

    • 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.

    • options (::Gapic::CallOptions, ::Hash) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #update_instance(update_mask: nil, instance: nil, request_id: nil, validate_only: nil, allow_missing: nil) ⇒ ::Gapic::Operation

    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).

    Parameters:

    • update_mask (::Google::Protobuf::FieldMask, ::Hash) (defaults to: nil)

      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.

    • instance (::Google::Cloud::AlloyDB::V1::Instance, ::Hash) (defaults to: nil)

      Required. The resource being updated

    • request_id (::String) (defaults to: nil)

      Optional. An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server ignores the request if it has already been completed. The server guarantees 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 the original operation with the same request ID was received, and if so, ignores 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).

    • validate_only (::Boolean) (defaults to: nil)

      Optional. If set, performs request validation, for example, permission checks and any other type of validation, but does not actually execute the create request.

    • allow_missing (::Boolean) (defaults to: nil)

      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.

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

  • response (::Gapic::Operation)
  • operation (::GRPC::ActiveCall::Operation)

Returns:

  • (::Gapic::Operation)

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
# File 'lib/google/cloud/alloy_db/v1/alloy_db_admin/client.rb', line 1909

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
   = @config.rpcs.update_instance..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"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
  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.instance&.name
    header_params["instance.name"] = request.instance.name
  end

  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
  [:"x-goog-request-params"] ||= request_params_header

  options.apply_defaults timeout:      @config.rpcs.update_instance.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.update_instance.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @alloy_db_admin_stub.call_rpc :update_instance, request, options: options do |response, operation|
    response = ::Gapic::Operation.new response, @operations_client, options: options
    yield response, operation if block_given?
    return response
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end

#update_user(request, options = nil) ⇒ ::Google::Cloud::AlloyDB::V1::User #update_user(update_mask: nil, user: nil, request_id: nil, validate_only: nil, allow_missing: nil) ⇒ ::Google::Cloud::AlloyDB::V1::User

Updates the parameters of a single User.

Examples:

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::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

Overloads:

  • #update_user(request, options = nil) ⇒ ::Google::Cloud::AlloyDB::V1::User

    Pass arguments to update_user via a request object, either of type UpdateUserRequest or an equivalent Hash.

    Parameters:

    • 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.

    • options (::Gapic::CallOptions, ::Hash) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #update_user(update_mask: nil, user: nil, request_id: nil, validate_only: nil, allow_missing: nil) ⇒ ::Google::Cloud::AlloyDB::V1::User

    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).

    Parameters:

    • update_mask (::Google::Protobuf::FieldMask, ::Hash) (defaults to: nil)

      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.

    • user (::Google::Cloud::AlloyDB::V1::User, ::Hash) (defaults to: nil)

      Required. The resource being updated

    • request_id (::String) (defaults to: nil)

      Optional. An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server ignores the request if it has already been completed. The server guarantees 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 the original operation with the same request ID was received, and if so, ignores 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).

    • validate_only (::Boolean) (defaults to: nil)

      Optional. If set, the backend validates the request, but doesn't actually execute it.

    • allow_missing (::Boolean) (defaults to: nil)

      Optional. Allow missing fields in the update mask.

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
# File 'lib/google/cloud/alloy_db/v1/alloy_db_admin/client.rb', line 3737

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
   = @config.rpcs.update_user..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"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
  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.user&.name
    header_params["user.name"] = request.user.name
  end

  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
  [:"x-goog-request-params"] ||= request_params_header

  options.apply_defaults timeout:      @config.rpcs.update_user.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.update_user.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @alloy_db_admin_stub.call_rpc :update_user, request, options: options do |response, operation|
    yield response, operation if block_given?
    return response
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end