Class: Google::Cloud::Sql::V1::SqlInstancesService::Rest::Client

Inherits:
Object
  • Object
show all
Includes:
Paths
Defined in:
lib/google/cloud/sql/v1/sql_instances_service/rest/client.rb

Overview

REST client for the SqlInstancesService service.

Defined Under Namespace

Classes: Configuration

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Paths

#backup_path, #network_path

Constructor Details

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

Create a new SqlInstancesService REST client object.

Examples:


# Create a client using the default configuration
client = ::Google::Cloud::Sql::V1::SqlInstancesService::Rest::Client.new

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

Yields:

  • (config)

    Configure the SqlInstancesService client.

Yield Parameters:



127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
# File 'lib/google/cloud/sql/v1/sql_instances_service/rest/client.rb', line 127

def initialize
  # Create the configuration object
  @config = Configuration.new Client.configure

  # Yield the configuration if needed
  yield @config if block_given?

  # Create credentials
  credentials = @config.credentials
  # Use self-signed JWT if the endpoint is unchanged from default,
  # but only if the default endpoint does not have a region prefix.
  enable_self_signed_jwt = @config.endpoint.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

  @sql_instances_service_stub = ::Google::Cloud::Sql::V1::SqlInstancesService::Rest::ServiceStub.new(
    endpoint: @config.endpoint,
    endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
    universe_domain: @config.universe_domain,
    credentials: credentials,
    logger: @config.logger
  )

  @sql_instances_service_stub.logger(stub: true)&.info do |entry|
    entry.set_system_name
    entry.set_service
    entry.message = "Created client for #{entry.service}"
    entry.set_credentials_fields credentials
    entry.set "customEndpoint", @config.endpoint if @config.endpoint
    entry.set "defaultTimeout", @config.timeout if @config.timeout
    entry.set "quotaProject", @quota_project_id if @quota_project_id
  end

  @location_client = Google::Cloud::Location::Locations::Rest::Client.new do |config|
    config.credentials = credentials
    config.quota_project = @quota_project_id
    config.endpoint = @sql_instances_service_stub.endpoint
    config.universe_domain = @sql_instances_service_stub.universe_domain
    config.logger = @sql_instances_service_stub.logger if config.respond_to? :logger=
  end
end

Instance Attribute Details

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

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

Returns:

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


182
183
184
# File 'lib/google/cloud/sql/v1/sql_instances_service/rest/client.rb', line 182

def location_client
  @location_client
end

Class Method Details

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

Configure the SqlInstancesService Client class.

See Configuration for a description of the configuration fields.

Examples:


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

Yields:

  • (config)

    Configure the Client client.

Yield Parameters:

Returns:



63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
# File 'lib/google/cloud/sql/v1/sql_instances_service/rest/client.rb', line 63

def self.configure
  @configure ||= begin
    namespace = ["Google", "Cloud", "Sql", "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
  end
  yield @configure if block_given?
  @configure
end

Instance Method Details

#acquire_ssrs_lease(request, options = nil) ⇒ ::Google::Cloud::Sql::V1::SqlInstancesAcquireSsrsLeaseResponse #acquire_ssrs_lease(instance: nil, project: nil, body: nil) ⇒ ::Google::Cloud::Sql::V1::SqlInstancesAcquireSsrsLeaseResponse

Acquire a lease for the setup of SQL Server Reporting Services (SSRS).

Examples:

Basic example

require "google/cloud/sql/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Sql::V1::SqlInstancesService::Rest::Client.new

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

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

# The returned object is of type Google::Cloud::Sql::V1::SqlInstancesAcquireSsrsLeaseResponse.
p result

Overloads:

  • #acquire_ssrs_lease(request, options = nil) ⇒ ::Google::Cloud::Sql::V1::SqlInstancesAcquireSsrsLeaseResponse

    Pass arguments to acquire_ssrs_lease via a request object, either of type Google::Cloud::Sql::V1::SqlInstancesAcquireSsrsLeaseRequest or an equivalent Hash.

    Parameters:

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

  • #acquire_ssrs_lease(instance: nil, project: nil, body: nil) ⇒ ::Google::Cloud::Sql::V1::SqlInstancesAcquireSsrsLeaseResponse

    Pass arguments to acquire_ssrs_lease 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:

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

      Required. Cloud SQL instance ID. This doesn't include the project ID. It's composed of lowercase letters, numbers, and hyphens, and it must start with a letter. The total length must be 98 characters or less (Example: instance-id).

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

      Required. Project ID of the project that contains the instance (Example: project-id).

    • body (::Google::Cloud::Sql::V1::InstancesAcquireSsrsLeaseRequest, ::Hash) (defaults to: nil)

      Required. The request body.

Yields:

  • (result, operation)

    Access the result along with the TransportOperation object

Yield Parameters:

Returns:

Raises:

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

    if the REST call is aborted.



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
3560
# File 'lib/google/cloud/sql/v1/sql_instances_service/rest/client.rb', line 3527

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

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1::SqlInstancesAcquireSsrsLeaseRequest

  # 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.acquire_ssrs_lease..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::Sql::V1::VERSION,
    transports_version_send: [:rest]

  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

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

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

  @sql_instances_service_stub.acquire_ssrs_lease request, options do |result, operation|
    yield result, operation if block_given?
  end
rescue ::Gapic::Rest::Error => e
  raise ::Google::Cloud::Error.from_error(e)
end

#add_entra_id_certificate(request, options = nil) ⇒ ::Google::Cloud::Sql::V1::Operation #add_entra_id_certificate(instance: nil, project: nil) ⇒ ::Google::Cloud::Sql::V1::Operation

Adds a new Entra ID certificate for the specified instance. If an Entra ID certificate was previously added but never used in a certificate rotation, this operation replaces that version.

Examples:

Basic example

require "google/cloud/sql/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Sql::V1::SqlInstancesService::Rest::Client.new

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

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

# The returned object is of type Google::Cloud::Sql::V1::Operation.
p result

Overloads:

  • #add_entra_id_certificate(request, options = nil) ⇒ ::Google::Cloud::Sql::V1::Operation

    Pass arguments to add_entra_id_certificate via a request object, either of type Google::Cloud::Sql::V1::SqlInstancesAddEntraIdCertificateRequest or an equivalent Hash.

    Parameters:

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

  • #add_entra_id_certificate(instance: nil, project: nil) ⇒ ::Google::Cloud::Sql::V1::Operation

    Pass arguments to add_entra_id_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:

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

      Required. Cloud SQL instance ID. This does not include the project ID.

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

      Required. Project ID of the project that contains the instance.

Yields:

  • (result, operation)

    Access the result along with the TransportOperation object

Yield Parameters:

Returns:

Raises:

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

    if the REST call is aborted.



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
# File 'lib/google/cloud/sql/v1/sql_instances_service/rest/client.rb', line 414

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

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1::SqlInstancesAddEntraIdCertificateRequest

  # 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.add_entra_id_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::Sql::V1::VERSION,
    transports_version_send: [:rest]

  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

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

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

  @sql_instances_service_stub.add_entra_id_certificate request, options do |result, operation|
    yield result, operation if block_given?
  end
rescue ::Gapic::Rest::Error => e
  raise ::Google::Cloud::Error.from_error(e)
end

#add_server_ca(request, options = nil) ⇒ ::Google::Cloud::Sql::V1::Operation #add_server_ca(instance: nil, project: nil) ⇒ ::Google::Cloud::Sql::V1::Operation

Adds a new trusted Certificate Authority (CA) version for the specified instance. Required to prepare for a certificate rotation. If a CA version was previously added but never used in a certificate rotation, this operation replaces that version. There cannot be more than one CA version waiting to be rotated in. For instances that have enabled Certificate Authority Service (CAS) based server CA, use AddServerCertificate to add a new server certificate.

Examples:

Basic example

require "google/cloud/sql/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Sql::V1::SqlInstancesService::Rest::Client.new

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

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

# The returned object is of type Google::Cloud::Sql::V1::Operation.
p result

Overloads:

  • #add_server_ca(request, options = nil) ⇒ ::Google::Cloud::Sql::V1::Operation

    Pass arguments to add_server_ca via a request object, either of type Google::Cloud::Sql::V1::SqlInstancesAddServerCaRequest or an equivalent Hash.

    Parameters:

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

  • #add_server_ca(instance: nil, project: nil) ⇒ ::Google::Cloud::Sql::V1::Operation

    Pass arguments to add_server_ca 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:

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

      Cloud SQL instance ID. This does not include the project ID.

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

      Project ID of the project that contains the instance.

Yields:

  • (result, operation)

    Access the result along with the TransportOperation object

Yield Parameters:

Returns:

Raises:

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

    if the REST call is aborted.



246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
# File 'lib/google/cloud/sql/v1/sql_instances_service/rest/client.rb', line 246

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

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1::SqlInstancesAddServerCaRequest

  # 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.add_server_ca..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::Sql::V1::VERSION,
    transports_version_send: [:rest]

  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

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

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

  @sql_instances_service_stub.add_server_ca request, options do |result, operation|
    yield result, operation if block_given?
  end
rescue ::Gapic::Rest::Error => e
  raise ::Google::Cloud::Error.from_error(e)
end

#add_server_certificate(request, options = nil) ⇒ ::Google::Cloud::Sql::V1::Operation #add_server_certificate(instance: nil, project: nil) ⇒ ::Google::Cloud::Sql::V1::Operation

Add a new trusted server certificate version for the specified instance using Certificate Authority Service (CAS) server CA. Required to prepare for a certificate rotation. If a server certificate version was previously added but never used in a certificate rotation, this operation replaces that version. There cannot be more than one certificate version waiting to be rotated in. For instances not using CAS server CA, use AddServerCa instead.

Examples:

Basic example

require "google/cloud/sql/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Sql::V1::SqlInstancesService::Rest::Client.new

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

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

# The returned object is of type Google::Cloud::Sql::V1::Operation.
p result

Overloads:

  • #add_server_certificate(request, options = nil) ⇒ ::Google::Cloud::Sql::V1::Operation

    Pass arguments to add_server_certificate via a request object, either of type Google::Cloud::Sql::V1::SqlInstancesAddServerCertificateRequest or an equivalent Hash.

    Parameters:

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

  • #add_server_certificate(instance: nil, project: nil) ⇒ ::Google::Cloud::Sql::V1::Operation

    Pass arguments to add_server_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:

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

      Cloud SQL instance ID. This does not include the project ID.

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

      Project ID of the project that contains the instance.

Yields:

  • (result, operation)

    Access the result along with the TransportOperation object

Yield Parameters:

Returns:

Raises:

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

    if the REST call is aborted.



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
359
360
361
362
363
364
365
# File 'lib/google/cloud/sql/v1/sql_instances_service/rest/client.rb', line 332

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

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1::SqlInstancesAddServerCertificateRequest

  # 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.add_server_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::Sql::V1::VERSION,
    transports_version_send: [:rest]

  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

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

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

  @sql_instances_service_stub.add_server_certificate request, options do |result, operation|
    yield result, operation if block_given?
  end
rescue ::Gapic::Rest::Error => e
  raise ::Google::Cloud::Error.from_error(e)
end

#call_clone(request, options = nil) ⇒ ::Google::Cloud::Sql::V1::Operation #call_clone(instance: nil, project: nil, body: nil) ⇒ ::Google::Cloud::Sql::V1::Operation

Creates a Cloud SQL instance as a clone of the source instance. Using this operation might cause your instance to restart.

Examples:

Basic example

require "google/cloud/sql/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Sql::V1::SqlInstancesService::Rest::Client.new

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

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

# The returned object is of type Google::Cloud::Sql::V1::Operation.
p result

Overloads:

  • #call_clone(request, options = nil) ⇒ ::Google::Cloud::Sql::V1::Operation

    Pass arguments to call_clone via a request object, either of type Google::Cloud::Sql::V1::SqlInstancesCloneRequest or an equivalent Hash.

    Parameters:

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

  • #call_clone(instance: nil, project: nil, body: nil) ⇒ ::Google::Cloud::Sql::V1::Operation

    Pass arguments to call_clone 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:

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

      Required. The ID of the Cloud SQL instance to be cloned (source). This does not include the project ID.

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

      Required. Project ID of the source Cloud SQL instance.

    • body (::Google::Cloud::Sql::V1::InstancesCloneRequest, ::Hash) (defaults to: nil)

Yields:

  • (result, operation)

    Access the result along with the TransportOperation object

Yield Parameters:

Returns:

Raises:

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

    if the REST call is aborted.



497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
# File 'lib/google/cloud/sql/v1/sql_instances_service/rest/client.rb', line 497

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

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1::SqlInstancesCloneRequest

  # 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.call_clone..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::Sql::V1::VERSION,
    transports_version_send: [:rest]

  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

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

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

  @sql_instances_service_stub.call_clone request, options do |result, operation|
    yield result, operation if block_given?
  end
rescue ::Gapic::Rest::Error => e
  raise ::Google::Cloud::Error.from_error(e)
end

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

Configure the SqlInstancesService 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:



97
98
99
100
# File 'lib/google/cloud/sql/v1/sql_instances_service/rest/client.rb', line 97

def configure
  yield @config if block_given?
  @config
end

#create_ephemeral(request, options = nil) ⇒ ::Google::Cloud::Sql::V1::SslCert #create_ephemeral(instance: nil, project: nil, body: nil) ⇒ ::Google::Cloud::Sql::V1::SslCert

Generates a short-lived X509 certificate containing the provided public key and signed by a private key specific to the target instance. Users may use the certificate to authenticate as themselves when connecting to the database.

Examples:

Basic example

require "google/cloud/sql/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Sql::V1::SqlInstancesService::Rest::Client.new

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

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

# The returned object is of type Google::Cloud::Sql::V1::SslCert.
p result

Overloads:

  • #create_ephemeral(request, options = nil) ⇒ ::Google::Cloud::Sql::V1::SslCert

    Pass arguments to create_ephemeral via a request object, either of type Google::Cloud::Sql::V1::SqlInstancesCreateEphemeralCertRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::Sql::V1::SqlInstancesCreateEphemeralCertRequest, ::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_ephemeral(instance: nil, project: nil, body: nil) ⇒ ::Google::Cloud::Sql::V1::SslCert

    Pass arguments to create_ephemeral 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:

Yields:

  • (result, operation)

    Access the result along with the TransportOperation object

Yield Parameters:

Returns:

Raises:

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

    if the REST call is aborted.



2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
# File 'lib/google/cloud/sql/v1/sql_instances_service/rest/client.rb', line 2757

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

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1::SqlInstancesCreateEphemeralCertRequest

  # 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_ephemeral..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::Sql::V1::VERSION,
    transports_version_send: [:rest]

  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

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

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

  @sql_instances_service_stub.create_ephemeral request, options do |result, operation|
    yield result, operation if block_given?
  end
rescue ::Gapic::Rest::Error => e
  raise ::Google::Cloud::Error.from_error(e)
end

#delete(request, options = nil) ⇒ ::Google::Cloud::Sql::V1::Operation #delete(instance: nil, project: nil, enable_final_backup: nil, final_backup_ttl_days: nil, final_backup_expiry_time: nil, final_backup_description: nil) ⇒ ::Google::Cloud::Sql::V1::Operation

Deletes a Cloud SQL instance.

Examples:

Basic example

require "google/cloud/sql/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Sql::V1::SqlInstancesService::Rest::Client.new

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

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

# The returned object is of type Google::Cloud::Sql::V1::Operation.
p result

Overloads:

  • #delete(request, options = nil) ⇒ ::Google::Cloud::Sql::V1::Operation

    Pass arguments to delete via a request object, either of type Google::Cloud::Sql::V1::SqlInstancesDeleteRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::Sql::V1::SqlInstancesDeleteRequest, ::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: nil, project: nil, enable_final_backup: nil, final_backup_ttl_days: nil, final_backup_expiry_time: nil, final_backup_description: nil) ⇒ ::Google::Cloud::Sql::V1::Operation

    Pass arguments to delete 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:

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

      Cloud SQL instance ID. This does not include the project ID.

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

      Project ID of the project that contains the instance to be deleted.

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

      Flag to opt-in for final backup. By default, it is turned off.

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

      Optional. Retention period of the final backup.

      Note: The following parameters are mutually exclusive: final_backup_ttl_days, final_backup_expiry_time. At most one of these parameters can be set. If more than one is set, only one will be used, and it is not defined which one.

    • final_backup_expiry_time (::Google::Protobuf::Timestamp, ::Hash) (defaults to: nil)

      Optional. Final Backup expiration time. Timestamp in UTC of when this resource is considered expired.

      Note: The following parameters are mutually exclusive: final_backup_expiry_time, final_backup_ttl_days. At most one of these parameters can be set. If more than one is set, only one will be used, and it is not defined which one.

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

      Optional. The description of the final backup.

Yields:

  • (result, operation)

    Access the result along with the TransportOperation object

Yield Parameters:

Returns:

Raises:

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

    if the REST call is aborted.



590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
# File 'lib/google/cloud/sql/v1/sql_instances_service/rest/client.rb', line 590

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

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1::SqlInstancesDeleteRequest

  # 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..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::Sql::V1::VERSION,
    transports_version_send: [:rest]

  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

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

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

  @sql_instances_service_stub.delete request, options do |result, operation|
    yield result, operation if block_given?
  end
rescue ::Gapic::Rest::Error => e
  raise ::Google::Cloud::Error.from_error(e)
end

#demote(request, options = nil) ⇒ ::Google::Cloud::Sql::V1::Operation #demote(instance: nil, project: nil, body: nil) ⇒ ::Google::Cloud::Sql::V1::Operation

Demotes an existing standalone instance to be a Cloud SQL read replica for an external database server.

Examples:

Basic example

require "google/cloud/sql/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Sql::V1::SqlInstancesService::Rest::Client.new

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

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

# The returned object is of type Google::Cloud::Sql::V1::Operation.
p result

Overloads:

  • #demote(request, options = nil) ⇒ ::Google::Cloud::Sql::V1::Operation

    Pass arguments to demote via a request object, either of type Google::Cloud::Sql::V1::SqlInstancesDemoteRequest or an equivalent Hash.

    Parameters:

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

  • #demote(instance: nil, project: nil, body: nil) ⇒ ::Google::Cloud::Sql::V1::Operation

    Pass arguments to demote 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:

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

      Required. Cloud SQL instance name.

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

      Required. ID of the project that contains the instance.

    • body (::Google::Cloud::Sql::V1::InstancesDemoteRequest, ::Hash) (defaults to: nil)

      Required. The request body.

Yields:

  • (result, operation)

    Access the result along with the TransportOperation object

Yield Parameters:

Returns:

Raises:

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

    if the REST call is aborted.



755
756
757
758
759
760
761
762
763
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
# File 'lib/google/cloud/sql/v1/sql_instances_service/rest/client.rb', line 755

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

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1::SqlInstancesDemoteRequest

  # 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.demote..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::Sql::V1::VERSION,
    transports_version_send: [:rest]

  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

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

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

  @sql_instances_service_stub.demote request, options do |result, operation|
    yield result, operation if block_given?
  end
rescue ::Gapic::Rest::Error => e
  raise ::Google::Cloud::Error.from_error(e)
end

#demote_master(request, options = nil) ⇒ ::Google::Cloud::Sql::V1::Operation #demote_master(instance: nil, project: nil, body: nil) ⇒ ::Google::Cloud::Sql::V1::Operation

Demotes the stand-alone instance to be a Cloud SQL read replica for an external database server.

Examples:

Basic example

require "google/cloud/sql/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Sql::V1::SqlInstancesService::Rest::Client.new

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

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

# The returned object is of type Google::Cloud::Sql::V1::Operation.
p result

Overloads:

  • #demote_master(request, options = nil) ⇒ ::Google::Cloud::Sql::V1::Operation

    Pass arguments to demote_master via a request object, either of type Google::Cloud::Sql::V1::SqlInstancesDemoteMasterRequest or an equivalent Hash.

    Parameters:

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

  • #demote_master(instance: nil, project: nil, body: nil) ⇒ ::Google::Cloud::Sql::V1::Operation

    Pass arguments to demote_master 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:

Yields:

  • (result, operation)

    Access the result along with the TransportOperation object

Yield Parameters:

Returns:

Raises:

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

    if the REST call is aborted.



672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
# File 'lib/google/cloud/sql/v1/sql_instances_service/rest/client.rb', line 672

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

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1::SqlInstancesDemoteMasterRequest

  # 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.demote_master..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::Sql::V1::VERSION,
    transports_version_send: [:rest]

  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

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

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

  @sql_instances_service_stub.demote_master request, options do |result, operation|
    yield result, operation if block_given?
  end
rescue ::Gapic::Rest::Error => e
  raise ::Google::Cloud::Error.from_error(e)
end

#execute_sql(request, options = nil) ⇒ ::Google::Cloud::Sql::V1::SqlInstancesExecuteSqlResponse #execute_sql(instance: nil, project: nil, body: nil) ⇒ ::Google::Cloud::Sql::V1::SqlInstancesExecuteSqlResponse

Execute SQL statements.

Examples:

Basic example

require "google/cloud/sql/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Sql::V1::SqlInstancesService::Rest::Client.new

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

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

# The returned object is of type Google::Cloud::Sql::V1::SqlInstancesExecuteSqlResponse.
p result

Overloads:

Yields:

  • (result, operation)

    Access the result along with the TransportOperation object

Yield Parameters:

Returns:

Raises:

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

    if the REST call is aborted.



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
3473
3474
# File 'lib/google/cloud/sql/v1/sql_instances_service/rest/client.rb', line 3441

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

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1::SqlInstancesExecuteSqlRequest

  # 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::Sql::V1::VERSION,
    transports_version_send: [:rest]

  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  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

  @sql_instances_service_stub.execute_sql request, options do |result, operation|
    yield result, operation if block_given?
  end
rescue ::Gapic::Rest::Error => e
  raise ::Google::Cloud::Error.from_error(e)
end

#export(request, options = nil) ⇒ ::Google::Cloud::Sql::V1::Operation #export(instance: nil, project: nil, body: nil) ⇒ ::Google::Cloud::Sql::V1::Operation

Exports data from a Cloud SQL instance to a Cloud Storage bucket as a SQL dump or CSV file.

Examples:

Basic example

require "google/cloud/sql/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Sql::V1::SqlInstancesService::Rest::Client.new

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

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

# The returned object is of type Google::Cloud::Sql::V1::Operation.
p result

Overloads:

  • #export(request, options = nil) ⇒ ::Google::Cloud::Sql::V1::Operation

    Pass arguments to export via a request object, either of type Google::Cloud::Sql::V1::SqlInstancesExportRequest or an equivalent Hash.

    Parameters:

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

  • #export(instance: nil, project: nil, body: nil) ⇒ ::Google::Cloud::Sql::V1::Operation

    Pass arguments to export 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:

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

      Cloud SQL instance ID. This does not include the project ID.

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

      Project ID of the project that contains the instance to be exported.

    • body (::Google::Cloud::Sql::V1::InstancesExportRequest, ::Hash) (defaults to: nil)

Yields:

  • (result, operation)

    Access the result along with the TransportOperation object

Yield Parameters:

Returns:

Raises:

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

    if the REST call is aborted.



837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
# File 'lib/google/cloud/sql/v1/sql_instances_service/rest/client.rb', line 837

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

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1::SqlInstancesExportRequest

  # 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.export..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::Sql::V1::VERSION,
    transports_version_send: [:rest]

  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

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

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

  @sql_instances_service_stub.export request, options do |result, operation|
    yield result, operation if block_given?
  end
rescue ::Gapic::Rest::Error => e
  raise ::Google::Cloud::Error.from_error(e)
end

#failover(request, options = nil) ⇒ ::Google::Cloud::Sql::V1::Operation #failover(instance: nil, project: nil, body: nil) ⇒ ::Google::Cloud::Sql::V1::Operation

Initiates a manual failover of a high availability (HA) primary instance to a standby instance, which becomes the primary instance. Users are then rerouted to the new primary. For more information, see the Overview of high availability page in the Cloud SQL documentation. If using Legacy HA (MySQL only), this causes the instance to failover to its failover replica instance.

Examples:

Basic example

require "google/cloud/sql/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Sql::V1::SqlInstancesService::Rest::Client.new

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

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

# The returned object is of type Google::Cloud::Sql::V1::Operation.
p result

Overloads:

  • #failover(request, options = nil) ⇒ ::Google::Cloud::Sql::V1::Operation

    Pass arguments to failover via a request object, either of type Google::Cloud::Sql::V1::SqlInstancesFailoverRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::Sql::V1::SqlInstancesFailoverRequest, ::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: nil, project: nil, body: nil) ⇒ ::Google::Cloud::Sql::V1::Operation

    Pass arguments to failover 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:

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

      Cloud SQL instance ID. This does not include the project ID.

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

      ID of the project that contains the read replica.

    • body (::Google::Cloud::Sql::V1::InstancesFailoverRequest, ::Hash) (defaults to: nil)

Yields:

  • (result, operation)

    Access the result along with the TransportOperation object

Yield Parameters:

Returns:

Raises:

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

    if the REST call is aborted.



925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
# File 'lib/google/cloud/sql/v1/sql_instances_service/rest/client.rb', line 925

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

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1::SqlInstancesFailoverRequest

  # 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..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::Sql::V1::VERSION,
    transports_version_send: [:rest]

  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

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

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

  @sql_instances_service_stub.failover request, options do |result, operation|
    yield result, operation if block_given?
  end
rescue ::Gapic::Rest::Error => e
  raise ::Google::Cloud::Error.from_error(e)
end

#get(request, options = nil) ⇒ ::Google::Cloud::Sql::V1::DatabaseInstance #get(instance: nil, project: nil) ⇒ ::Google::Cloud::Sql::V1::DatabaseInstance

Retrieves a resource containing information about a Cloud SQL instance.

Examples:

Basic example

require "google/cloud/sql/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Sql::V1::SqlInstancesService::Rest::Client.new

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

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

# The returned object is of type Google::Cloud::Sql::V1::DatabaseInstance.
p result

Overloads:

  • #get(request, options = nil) ⇒ ::Google::Cloud::Sql::V1::DatabaseInstance

    Pass arguments to get via a request object, either of type Google::Cloud::Sql::V1::SqlInstancesGetRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::Sql::V1::SqlInstancesGetRequest, ::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: nil, project: nil) ⇒ ::Google::Cloud::Sql::V1::DatabaseInstance

    Pass arguments to get 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:

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

      Required. Database instance ID. This does not include the project ID.

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

      Required. Project ID of the project that contains the instance.

Yields:

  • (result, operation)

    Access the result along with the TransportOperation object

Yield Parameters:

Returns:

Raises:

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

    if the REST call is aborted.



1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
# File 'lib/google/cloud/sql/v1/sql_instances_service/rest/client.rb', line 1087

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

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1::SqlInstancesGetRequest

  # 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..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::Sql::V1::VERSION,
    transports_version_send: [:rest]

  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

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

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

  @sql_instances_service_stub.get request, options do |result, operation|
    yield result, operation if block_given?
  end
rescue ::Gapic::Rest::Error => e
  raise ::Google::Cloud::Error.from_error(e)
end

#get_disk_shrink_config(request, options = nil) ⇒ ::Google::Cloud::Sql::V1::SqlInstancesGetDiskShrinkConfigResponse #get_disk_shrink_config(instance: nil, project: nil) ⇒ ::Google::Cloud::Sql::V1::SqlInstancesGetDiskShrinkConfigResponse

Get Disk Shrink Config for a given instance.

Examples:

Basic example

require "google/cloud/sql/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Sql::V1::SqlInstancesService::Rest::Client.new

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

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

# The returned object is of type Google::Cloud::Sql::V1::SqlInstancesGetDiskShrinkConfigResponse.
p result

Overloads:

Yields:

  • (result, operation)

    Access the result along with the TransportOperation object

Yield Parameters:

Returns:

Raises:

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

    if the REST call is aborted.



3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
# File 'lib/google/cloud/sql/v1/sql_instances_service/rest/client.rb', line 3196

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

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1::SqlInstancesGetDiskShrinkConfigRequest

  # 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_disk_shrink_config..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::Sql::V1::VERSION,
    transports_version_send: [:rest]

  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

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

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

  @sql_instances_service_stub.get_disk_shrink_config request, options do |result, operation|
    yield result, operation if block_given?
  end
rescue ::Gapic::Rest::Error => e
  raise ::Google::Cloud::Error.from_error(e)
end

#get_latest_recovery_time(request, options = nil) ⇒ ::Google::Cloud::Sql::V1::SqlInstancesGetLatestRecoveryTimeResponse #get_latest_recovery_time(instance: nil, project: nil, source_instance_deletion_time: nil) ⇒ ::Google::Cloud::Sql::V1::SqlInstancesGetLatestRecoveryTimeResponse

Get Latest Recovery Time for a given instance.

Examples:

Basic example

require "google/cloud/sql/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Sql::V1::SqlInstancesService::Rest::Client.new

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

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

# The returned object is of type Google::Cloud::Sql::V1::SqlInstancesGetLatestRecoveryTimeResponse.
p result

Overloads:

  • #get_latest_recovery_time(request, options = nil) ⇒ ::Google::Cloud::Sql::V1::SqlInstancesGetLatestRecoveryTimeResponse

    Pass arguments to get_latest_recovery_time via a request object, either of type Google::Cloud::Sql::V1::SqlInstancesGetLatestRecoveryTimeRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::Sql::V1::SqlInstancesGetLatestRecoveryTimeRequest, ::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_latest_recovery_time(instance: nil, project: nil, source_instance_deletion_time: nil) ⇒ ::Google::Cloud::Sql::V1::SqlInstancesGetLatestRecoveryTimeResponse

    Pass arguments to get_latest_recovery_time 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:

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

      Cloud SQL instance ID. This does not include the project ID.

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

      Project ID of the project that contains the instance.

    • source_instance_deletion_time (::Google::Protobuf::Timestamp, ::Hash) (defaults to: nil)

      The timestamp used to identify the time when the source instance is deleted. If this instance is deleted, then you must set the timestamp.

Yields:

  • (result, operation)

    Access the result along with the TransportOperation object

Yield Parameters:

Returns:

Raises:

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

    if the REST call is aborted.



3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
# File 'lib/google/cloud/sql/v1/sql_instances_service/rest/client.rb', line 3359

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

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1::SqlInstancesGetLatestRecoveryTimeRequest

  # 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_latest_recovery_time..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::Sql::V1::VERSION,
    transports_version_send: [:rest]

  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

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

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

  @sql_instances_service_stub.get_latest_recovery_time request, options do |result, operation|
    yield result, operation if block_given?
  end
rescue ::Gapic::Rest::Error => e
  raise ::Google::Cloud::Error.from_error(e)
end

#import(request, options = nil) ⇒ ::Google::Cloud::Sql::V1::Operation #import(instance: nil, project: nil, body: nil) ⇒ ::Google::Cloud::Sql::V1::Operation

Imports data into a Cloud SQL instance from a SQL dump or CSV file in Cloud Storage.

Examples:

Basic example

require "google/cloud/sql/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Sql::V1::SqlInstancesService::Rest::Client.new

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

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

# The returned object is of type Google::Cloud::Sql::V1::Operation.
p result

Overloads:

  • #import(request, options = nil) ⇒ ::Google::Cloud::Sql::V1::Operation

    Pass arguments to import via a request object, either of type Google::Cloud::Sql::V1::SqlInstancesImportRequest or an equivalent Hash.

    Parameters:

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

  • #import(instance: nil, project: nil, body: nil) ⇒ ::Google::Cloud::Sql::V1::Operation

    Pass arguments to import 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:

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

      Cloud SQL instance ID. This does not include the project ID.

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

      Project ID of the project that contains the instance.

    • body (::Google::Cloud::Sql::V1::InstancesImportRequest, ::Hash) (defaults to: nil)

Yields:

  • (result, operation)

    Access the result along with the TransportOperation object

Yield Parameters:

Returns:

Raises:

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

    if the REST call is aborted.



1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
# File 'lib/google/cloud/sql/v1/sql_instances_service/rest/client.rb', line 1169

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

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1::SqlInstancesImportRequest

  # 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.import..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::Sql::V1::VERSION,
    transports_version_send: [:rest]

  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

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

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

  @sql_instances_service_stub.import request, options do |result, operation|
    yield result, operation if block_given?
  end
rescue ::Gapic::Rest::Error => e
  raise ::Google::Cloud::Error.from_error(e)
end

#insert(request, options = nil) ⇒ ::Google::Cloud::Sql::V1::Operation #insert(project: nil, body: nil) ⇒ ::Google::Cloud::Sql::V1::Operation

Creates a new Cloud SQL instance.

Examples:

Basic example

require "google/cloud/sql/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Sql::V1::SqlInstancesService::Rest::Client.new

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

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

# The returned object is of type Google::Cloud::Sql::V1::Operation.
p result

Overloads:

  • #insert(request, options = nil) ⇒ ::Google::Cloud::Sql::V1::Operation

    Pass arguments to insert via a request object, either of type Google::Cloud::Sql::V1::SqlInstancesInsertRequest or an equivalent Hash.

    Parameters:

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

  • #insert(project: nil, body: nil) ⇒ ::Google::Cloud::Sql::V1::Operation

    Pass arguments to insert 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:

Yields:

  • (result, operation)

    Access the result along with the TransportOperation object

Yield Parameters:

Returns:

Raises:

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

    if the REST call is aborted.



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/sql/v1/sql_instances_service/rest/client.rb', line 1249

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

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1::SqlInstancesInsertRequest

  # 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.insert..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::Sql::V1::VERSION,
    transports_version_send: [:rest]

  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

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

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

  @sql_instances_service_stub.insert request, options do |result, operation|
    yield result, operation if block_given?
  end
rescue ::Gapic::Rest::Error => e
  raise ::Google::Cloud::Error.from_error(e)
end

#list(request, options = nil) ⇒ ::Google::Cloud::Sql::V1::InstancesListResponse #list(filter: nil, max_results: nil, page_token: nil, project: nil) ⇒ ::Google::Cloud::Sql::V1::InstancesListResponse

Lists instances under a given project.

Examples:

Basic example

require "google/cloud/sql/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Sql::V1::SqlInstancesService::Rest::Client.new

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

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

# The returned object is of type Google::Cloud::Sql::V1::InstancesListResponse.
p result

Overloads:

  • #list(request, options = nil) ⇒ ::Google::Cloud::Sql::V1::InstancesListResponse

    Pass arguments to list via a request object, either of type Google::Cloud::Sql::V1::SqlInstancesListRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::Sql::V1::SqlInstancesListRequest, ::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(filter: nil, max_results: nil, page_token: nil, project: nil) ⇒ ::Google::Cloud::Sql::V1::InstancesListResponse

    Pass arguments to list 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:

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

      A filter expression that filters resources listed in the response. The expression is in the form of field:value. For example, 'instanceType:CLOUD_SQL_INSTANCE'. Fields can be nested as needed as per their JSON representation, such as 'settings.userLabels.auto_start:true'.

      Multiple filter queries are space-separated. For example. 'state:RUNNABLE instanceType:CLOUD_SQL_INSTANCE'. By default, each expression is an AND expression. However, you can include AND and OR expressions explicitly.

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

      The maximum number of instances to return. The service may return fewer than this value. If unspecified, at most 500 instances are returned. The maximum value is 1000; values above 1000 are coerced to 1000.

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

      A previously-returned page token representing part of the larger set of results to view.

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

      Project ID of the project for which to list Cloud SQL instances.

Yields:

  • (result, operation)

    Access the result along with the TransportOperation object

Yield Parameters:

Returns:

Raises:

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

    if the REST call is aborted.



1345
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
# File 'lib/google/cloud/sql/v1/sql_instances_service/rest/client.rb', line 1345

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

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1::SqlInstancesListRequest

  # 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..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::Sql::V1::VERSION,
    transports_version_send: [:rest]

  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

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

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

  @sql_instances_service_stub.list request, options do |result, operation|
    yield result, operation if block_given?
  end
rescue ::Gapic::Rest::Error => e
  raise ::Google::Cloud::Error.from_error(e)
end

#list_entra_id_certificates(request, options = nil) ⇒ ::Google::Cloud::Sql::V1::InstancesListEntraIdCertificatesResponse #list_entra_id_certificates(instance: nil, project: nil) ⇒ ::Google::Cloud::Sql::V1::InstancesListEntraIdCertificatesResponse

Lists all versions of EntraID certificates for the specified instance. There can be up to three sets of certificates listed: the certificate that is currently in use, a future that has been added but not yet used to sign a certificate, and a certificate that has been rotated out.

Examples:

Basic example

require "google/cloud/sql/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Sql::V1::SqlInstancesService::Rest::Client.new

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

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

# The returned object is of type Google::Cloud::Sql::V1::InstancesListEntraIdCertificatesResponse.
p result

Overloads:

Yields:

  • (result, operation)

    Access the result along with the TransportOperation object

Yield Parameters:

Returns:

Raises:

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

    if the REST call is aborted.



1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
# File 'lib/google/cloud/sql/v1/sql_instances_service/rest/client.rb', line 1597

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

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1::SqlInstancesListEntraIdCertificatesRequest

  # 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_entra_id_certificates..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::Sql::V1::VERSION,
    transports_version_send: [:rest]

  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

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

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

  @sql_instances_service_stub.list_entra_id_certificates request, options do |result, operation|
    yield result, operation if block_given?
  end
rescue ::Gapic::Rest::Error => e
  raise ::Google::Cloud::Error.from_error(e)
end

#list_server_cas(request, options = nil) ⇒ ::Google::Cloud::Sql::V1::InstancesListServerCasResponse #list_server_cas(instance: nil, project: nil) ⇒ ::Google::Cloud::Sql::V1::InstancesListServerCasResponse

Lists all of the trusted Certificate Authorities (CAs) for the specified instance. There can be up to three CAs listed: the CA that was used to sign the certificate that is currently in use, a CA that has been added but not yet used to sign a certificate, and a CA used to sign a certificate that has previously rotated out.

Examples:

Basic example

require "google/cloud/sql/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Sql::V1::SqlInstancesService::Rest::Client.new

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

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

# The returned object is of type Google::Cloud::Sql::V1::InstancesListServerCasResponse.
p result

Overloads:

  • #list_server_cas(request, options = nil) ⇒ ::Google::Cloud::Sql::V1::InstancesListServerCasResponse

    Pass arguments to list_server_cas via a request object, either of type Google::Cloud::Sql::V1::SqlInstancesListServerCasRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::Sql::V1::SqlInstancesListServerCasRequest, ::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_server_cas(instance: nil, project: nil) ⇒ ::Google::Cloud::Sql::V1::InstancesListServerCasResponse

    Pass arguments to list_server_cas 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:

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

      Cloud SQL instance ID. This does not include the project ID.

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

      Project ID of the project that contains the instance.

Yields:

  • (result, operation)

    Access the result along with the TransportOperation object

Yield Parameters:

Returns:

Raises:

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

    if the REST call is aborted.



1429
1430
1431
1432
1433
1434
1435
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
# File 'lib/google/cloud/sql/v1/sql_instances_service/rest/client.rb', line 1429

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

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1::SqlInstancesListServerCasRequest

  # 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_server_cas..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::Sql::V1::VERSION,
    transports_version_send: [:rest]

  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

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

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

  @sql_instances_service_stub.list_server_cas request, options do |result, operation|
    yield result, operation if block_given?
  end
rescue ::Gapic::Rest::Error => e
  raise ::Google::Cloud::Error.from_error(e)
end

#list_server_certificates(request, options = nil) ⇒ ::Google::Cloud::Sql::V1::InstancesListServerCertificatesResponse #list_server_certificates(instance: nil, project: nil) ⇒ ::Google::Cloud::Sql::V1::InstancesListServerCertificatesResponse

Lists all versions of server certificates and certificate authorities (CAs) for the specified instance. There can be up to three sets of certs listed: the certificate that is currently in use, a future that has been added but not yet used to sign a certificate, and a certificate that has been rotated out. For instances not using Certificate Authority Service (CAS) server CA, use ListServerCas instead.

Examples:

Basic example

require "google/cloud/sql/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Sql::V1::SqlInstancesService::Rest::Client.new

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

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

# The returned object is of type Google::Cloud::Sql::V1::InstancesListServerCertificatesResponse.
p result

Overloads:

Yields:

  • (result, operation)

    Access the result along with the TransportOperation object

Yield Parameters:

Returns:

Raises:

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

    if the REST call is aborted.



1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
# File 'lib/google/cloud/sql/v1/sql_instances_service/rest/client.rb', line 1514

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

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1::SqlInstancesListServerCertificatesRequest

  # 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_server_certificates..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::Sql::V1::VERSION,
    transports_version_send: [:rest]

  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

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

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

  @sql_instances_service_stub.list_server_certificates request, options do |result, operation|
    yield result, operation if block_given?
  end
rescue ::Gapic::Rest::Error => e
  raise ::Google::Cloud::Error.from_error(e)
end

#loggerLogger

The logger used for request/response debug logging.

Returns:

  • (Logger)


189
190
191
# File 'lib/google/cloud/sql/v1/sql_instances_service/rest/client.rb', line 189

def logger
  @sql_instances_service_stub.logger
end

#patch(request, options = nil) ⇒ ::Google::Cloud::Sql::V1::Operation #patch(instance: nil, project: nil, body: nil) ⇒ ::Google::Cloud::Sql::V1::Operation

Partially updates settings of a Cloud SQL instance by merging the request with the current configuration. This method supports patch semantics.

Examples:

Basic example

require "google/cloud/sql/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Sql::V1::SqlInstancesService::Rest::Client.new

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

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

# The returned object is of type Google::Cloud::Sql::V1::Operation.
p result

Overloads:

  • #patch(request, options = nil) ⇒ ::Google::Cloud::Sql::V1::Operation

    Pass arguments to patch via a request object, either of type Google::Cloud::Sql::V1::SqlInstancesPatchRequest or an equivalent Hash.

    Parameters:

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

  • #patch(instance: nil, project: nil, body: nil) ⇒ ::Google::Cloud::Sql::V1::Operation

    Pass arguments to patch 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:

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

      Cloud SQL instance ID. This does not include the project ID.

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

      Project ID of the project that contains the instance.

    • body (::Google::Cloud::Sql::V1::DatabaseInstance, ::Hash) (defaults to: nil)

Yields:

  • (result, operation)

    Access the result along with the TransportOperation object

Yield Parameters:

Returns:

Raises:

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

    if the REST call is aborted.



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
1711
1712
# File 'lib/google/cloud/sql/v1/sql_instances_service/rest/client.rb', line 1679

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

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1::SqlInstancesPatchRequest

  # 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.patch..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::Sql::V1::VERSION,
    transports_version_send: [:rest]

  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

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

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

  @sql_instances_service_stub.patch request, options do |result, operation|
    yield result, operation if block_given?
  end
rescue ::Gapic::Rest::Error => e
  raise ::Google::Cloud::Error.from_error(e)
end

#perform_disk_shrink(request, options = nil) ⇒ ::Google::Cloud::Sql::V1::Operation #perform_disk_shrink(instance: nil, project: nil, body: nil) ⇒ ::Google::Cloud::Sql::V1::Operation

Perform Disk Shrink on primary instance.

Examples:

Basic example

require "google/cloud/sql/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Sql::V1::SqlInstancesService::Rest::Client.new

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

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

# The returned object is of type Google::Cloud::Sql::V1::Operation.
p result

Overloads:

  • #perform_disk_shrink(request, options = nil) ⇒ ::Google::Cloud::Sql::V1::Operation

    Pass arguments to perform_disk_shrink via a request object, either of type Google::Cloud::Sql::V1::SqlInstancesPerformDiskShrinkRequest or an equivalent Hash.

    Parameters:

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

  • #perform_disk_shrink(instance: nil, project: nil, body: nil) ⇒ ::Google::Cloud::Sql::V1::Operation

    Pass arguments to perform_disk_shrink 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:

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

      Cloud SQL instance ID. This does not include the project ID.

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

      Project ID of the project that contains the instance.

    • body (::Google::Cloud::Sql::V1::PerformDiskShrinkContext, ::Hash) (defaults to: nil)

      Perform disk shrink context.

Yields:

  • (result, operation)

    Access the result along with the TransportOperation object

Yield Parameters:

Returns:

Raises:

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

    if the REST call is aborted.



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
# File 'lib/google/cloud/sql/v1/sql_instances_service/rest/client.rb', line 3116

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

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1::SqlInstancesPerformDiskShrinkRequest

  # 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.perform_disk_shrink..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::Sql::V1::VERSION,
    transports_version_send: [:rest]

  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

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

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

  @sql_instances_service_stub.perform_disk_shrink request, options do |result, operation|
    yield result, operation if block_given?
  end
rescue ::Gapic::Rest::Error => e
  raise ::Google::Cloud::Error.from_error(e)
end

#point_in_time_restore(request, options = nil) ⇒ ::Google::Cloud::Sql::V1::Operation #point_in_time_restore(parent: nil, context: nil) ⇒ ::Google::Cloud::Sql::V1::Operation

Point in time restore for an instance managed by Google Cloud Backup and Disaster Recovery.

Examples:

Basic example

require "google/cloud/sql/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Sql::V1::SqlInstancesService::Rest::Client.new

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

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

# The returned object is of type Google::Cloud::Sql::V1::Operation.
p result

Overloads:

  • #point_in_time_restore(request, options = nil) ⇒ ::Google::Cloud::Sql::V1::Operation

    Pass arguments to point_in_time_restore via a request object, either of type Google::Cloud::Sql::V1::SqlInstancesPointInTimeRestoreRequest or an equivalent Hash.

    Parameters:

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

  • #point_in_time_restore(parent: nil, context: nil) ⇒ ::Google::Cloud::Sql::V1::Operation

    Pass arguments to point_in_time_restore 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 parent resource where you created this instance. Format: projects/{project}

    • context (::Google::Cloud::Sql::V1::PointInTimeRestoreContext, ::Hash) (defaults to: nil)

      Required. The context for request to perform a PITR on a Google Cloud Backup and Disaster Recovery managed instance.

Yields:

  • (result, operation)

    Access the result along with the TransportOperation object

Yield Parameters:

Returns:

Raises:

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

    if the REST call is aborted.



3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
# File 'lib/google/cloud/sql/v1/sql_instances_service/rest/client.rb', line 3776

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

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1::SqlInstancesPointInTimeRestoreRequest

  # 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.point_in_time_restore..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::Sql::V1::VERSION,
    transports_version_send: [:rest]

  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

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

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

  @sql_instances_service_stub.point_in_time_restore request, options do |result, operation|
    yield result, operation if block_given?
  end
rescue ::Gapic::Rest::Error => e
  raise ::Google::Cloud::Error.from_error(e)
end

#pre_check_major_version_upgrade(request, options = nil) ⇒ ::Google::Cloud::Sql::V1::Operation #pre_check_major_version_upgrade(instance: nil, project: nil, body: nil) ⇒ ::Google::Cloud::Sql::V1::Operation

Execute MVU Pre-checks

Examples:

Basic example

require "google/cloud/sql/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Sql::V1::SqlInstancesService::Rest::Client.new

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

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

# The returned object is of type Google::Cloud::Sql::V1::Operation.
p result

Overloads:

  • #pre_check_major_version_upgrade(request, options = nil) ⇒ ::Google::Cloud::Sql::V1::Operation

    Pass arguments to pre_check_major_version_upgrade via a request object, either of type Google::Cloud::Sql::V1::SqlInstancesPreCheckMajorVersionUpgradeRequest or an equivalent Hash.

    Parameters:

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

  • #pre_check_major_version_upgrade(instance: nil, project: nil, body: nil) ⇒ ::Google::Cloud::Sql::V1::Operation

    Pass arguments to pre_check_major_version_upgrade 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:

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

      Required. Cloud SQL instance ID. This does not include the project ID.

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

      Required. Project ID of the project that contains the instance.

    • body (::Google::Cloud::Sql::V1::InstancesPreCheckMajorVersionUpgradeRequest, ::Hash) (defaults to: nil)

      Required. The context for request to perform the pre-check major version upgrade operation.

Yields:

  • (result, operation)

    Access the result along with the TransportOperation object

Yield Parameters:

Returns:

Raises:

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

    if the REST call is aborted.



3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
# File 'lib/google/cloud/sql/v1/sql_instances_service/rest/client.rb', line 3693

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

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1::SqlInstancesPreCheckMajorVersionUpgradeRequest

  # 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.pre_check_major_version_upgrade..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::Sql::V1::VERSION,
    transports_version_send: [:rest]

  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

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

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

  @sql_instances_service_stub.pre_check_major_version_upgrade request, options do |result, operation|
    yield result, operation if block_given?
  end
rescue ::Gapic::Rest::Error => e
  raise ::Google::Cloud::Error.from_error(e)
end

#promote_replica(request, options = nil) ⇒ ::Google::Cloud::Sql::V1::Operation #promote_replica(instance: nil, project: nil, failover: nil) ⇒ ::Google::Cloud::Sql::V1::Operation

Promotes the read replica instance to be an independent Cloud SQL primary instance. Using this operation might cause your instance to restart.

Examples:

Basic example

require "google/cloud/sql/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Sql::V1::SqlInstancesService::Rest::Client.new

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

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

# The returned object is of type Google::Cloud::Sql::V1::Operation.
p result

Overloads:

  • #promote_replica(request, options = nil) ⇒ ::Google::Cloud::Sql::V1::Operation

    Pass arguments to promote_replica via a request object, either of type Google::Cloud::Sql::V1::SqlInstancesPromoteReplicaRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::Sql::V1::SqlInstancesPromoteReplicaRequest, ::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_replica(instance: nil, project: nil, failover: nil) ⇒ ::Google::Cloud::Sql::V1::Operation

    Pass arguments to promote_replica 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:

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

      Cloud SQL read replica instance name.

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

      ID of the project that contains the read replica.

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

      Set to true to invoke a replica failover to the DR replica. As part of replica failover, the promote operation attempts to add the original primary instance as a replica of the promoted DR replica when the original primary instance comes back online. If set to false or not specified, then the original primary instance becomes an independent Cloud SQL primary instance.

Yields:

  • (result, operation)

    Access the result along with the TransportOperation object

Yield Parameters:

Returns:

Raises:

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

    if the REST call is aborted.



1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
# File 'lib/google/cloud/sql/v1/sql_instances_service/rest/client.rb', line 1768

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

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1::SqlInstancesPromoteReplicaRequest

  # 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_replica..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::Sql::V1::VERSION,
    transports_version_send: [:rest]

  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

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

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

  @sql_instances_service_stub.promote_replica request, options do |result, operation|
    yield result, operation if block_given?
  end
rescue ::Gapic::Rest::Error => e
  raise ::Google::Cloud::Error.from_error(e)
end

#reencrypt(request, options = nil) ⇒ ::Google::Cloud::Sql::V1::Operation #reencrypt(instance: nil, project: nil, body: nil) ⇒ ::Google::Cloud::Sql::V1::Operation

Reencrypt CMEK instance with latest key version.

Examples:

Basic example

require "google/cloud/sql/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Sql::V1::SqlInstancesService::Rest::Client.new

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

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

# The returned object is of type Google::Cloud::Sql::V1::Operation.
p result

Overloads:

  • #reencrypt(request, options = nil) ⇒ ::Google::Cloud::Sql::V1::Operation

    Pass arguments to reencrypt via a request object, either of type Google::Cloud::Sql::V1::SqlInstancesReencryptRequest or an equivalent Hash.

    Parameters:

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

  • #reencrypt(instance: nil, project: nil, body: nil) ⇒ ::Google::Cloud::Sql::V1::Operation

    Pass arguments to reencrypt 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:

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

      Cloud SQL instance ID. This does not include the project ID.

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

      ID of the project that contains the instance.

    • body (::Google::Cloud::Sql::V1::InstancesReencryptRequest, ::Hash) (defaults to: nil)

      Reencrypt body that users request

Yields:

  • (result, operation)

    Access the result along with the TransportOperation object

Yield Parameters:

Returns:

Raises:

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

    if the REST call is aborted.



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/sql/v1/sql_instances_service/rest/client.rb', line 1007

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

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1::SqlInstancesReencryptRequest

  # 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.reencrypt..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::Sql::V1::VERSION,
    transports_version_send: [:rest]

  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

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

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

  @sql_instances_service_stub.reencrypt request, options do |result, operation|
    yield result, operation if block_given?
  end
rescue ::Gapic::Rest::Error => e
  raise ::Google::Cloud::Error.from_error(e)
end

#release_ssrs_lease(request, options = nil) ⇒ ::Google::Cloud::Sql::V1::SqlInstancesReleaseSsrsLeaseResponse #release_ssrs_lease(instance: nil, project: nil) ⇒ ::Google::Cloud::Sql::V1::SqlInstancesReleaseSsrsLeaseResponse

Release a lease for the setup of SQL Server Reporting Services (SSRS).

Examples:

Basic example

require "google/cloud/sql/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Sql::V1::SqlInstancesService::Rest::Client.new

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

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

# The returned object is of type Google::Cloud::Sql::V1::SqlInstancesReleaseSsrsLeaseResponse.
p result

Overloads:

  • #release_ssrs_lease(request, options = nil) ⇒ ::Google::Cloud::Sql::V1::SqlInstancesReleaseSsrsLeaseResponse

    Pass arguments to release_ssrs_lease via a request object, either of type Google::Cloud::Sql::V1::SqlInstancesReleaseSsrsLeaseRequest or an equivalent Hash.

    Parameters:

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

  • #release_ssrs_lease(instance: nil, project: nil) ⇒ ::Google::Cloud::Sql::V1::SqlInstancesReleaseSsrsLeaseResponse

    Pass arguments to release_ssrs_lease 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:

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

      Required. The Cloud SQL instance ID. This doesn't include the project ID. The instance ID contains lowercase letters, numbers, and hyphens, and it must start with a letter. This ID can have a maximum length of 98 characters.

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

      Required. The project ID that contains the instance.

Yields:

  • (result, operation)

    Access the result along with the TransportOperation object

Yield Parameters:

Returns:

Raises:

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

    if the REST call is aborted.



3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
# File 'lib/google/cloud/sql/v1/sql_instances_service/rest/client.rb', line 3610

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

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1::SqlInstancesReleaseSsrsLeaseRequest

  # 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.release_ssrs_lease..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::Sql::V1::VERSION,
    transports_version_send: [:rest]

  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

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

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

  @sql_instances_service_stub.release_ssrs_lease request, options do |result, operation|
    yield result, operation if block_given?
  end
rescue ::Gapic::Rest::Error => e
  raise ::Google::Cloud::Error.from_error(e)
end

#reschedule_maintenance(request, options = nil) ⇒ ::Google::Cloud::Sql::V1::Operation #reschedule_maintenance(instance: nil, project: nil, body: nil) ⇒ ::Google::Cloud::Sql::V1::Operation

Reschedules the maintenance on the given instance.

Examples:

Basic example

require "google/cloud/sql/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Sql::V1::SqlInstancesService::Rest::Client.new

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

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

# The returned object is of type Google::Cloud::Sql::V1::Operation.
p result

Overloads:

Yields:

  • (result, operation)

    Access the result along with the TransportOperation object

Yield Parameters:

Returns:

Raises:

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

    if the REST call is aborted.



2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
# File 'lib/google/cloud/sql/v1/sql_instances_service/rest/client.rb', line 2838

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

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1::SqlInstancesRescheduleMaintenanceRequest

  # 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.reschedule_maintenance..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::Sql::V1::VERSION,
    transports_version_send: [:rest]

  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

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

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

  @sql_instances_service_stub.reschedule_maintenance request, options do |result, operation|
    yield result, operation if block_given?
  end
rescue ::Gapic::Rest::Error => e
  raise ::Google::Cloud::Error.from_error(e)
end

#reset_replica_size(request, options = nil) ⇒ ::Google::Cloud::Sql::V1::Operation #reset_replica_size(instance: nil, project: nil) ⇒ ::Google::Cloud::Sql::V1::Operation

Reset Replica Size to primary instance disk size.

Examples:

Basic example

require "google/cloud/sql/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Sql::V1::SqlInstancesService::Rest::Client.new

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

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

# The returned object is of type Google::Cloud::Sql::V1::Operation.
p result

Overloads:

  • #reset_replica_size(request, options = nil) ⇒ ::Google::Cloud::Sql::V1::Operation

    Pass arguments to reset_replica_size via a request object, either of type Google::Cloud::Sql::V1::SqlInstancesResetReplicaSizeRequest or an equivalent Hash.

    Parameters:

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

  • #reset_replica_size(instance: nil, project: nil) ⇒ ::Google::Cloud::Sql::V1::Operation

    Pass arguments to reset_replica_size 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:

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

      Cloud SQL read replica instance name.

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

      ID of the project that contains the read replica.

Yields:

  • (result, operation)

    Access the result along with the TransportOperation object

Yield Parameters:

Returns:

Raises:

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

    if the REST call is aborted.



3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
# File 'lib/google/cloud/sql/v1/sql_instances_service/rest/client.rb', line 3276

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

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1::SqlInstancesResetReplicaSizeRequest

  # 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.reset_replica_size..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::Sql::V1::VERSION,
    transports_version_send: [:rest]

  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

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

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

  @sql_instances_service_stub.reset_replica_size request, options do |result, operation|
    yield result, operation if block_given?
  end
rescue ::Gapic::Rest::Error => e
  raise ::Google::Cloud::Error.from_error(e)
end

#reset_ssl_config(request, options = nil) ⇒ ::Google::Cloud::Sql::V1::Operation #reset_ssl_config(instance: nil, project: nil, mode: nil) ⇒ ::Google::Cloud::Sql::V1::Operation

Deletes all client certificates and generates a new server SSL certificate for the instance.

Examples:

Basic example

require "google/cloud/sql/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Sql::V1::SqlInstancesService::Rest::Client.new

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

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

# The returned object is of type Google::Cloud::Sql::V1::Operation.
p result

Overloads:

  • #reset_ssl_config(request, options = nil) ⇒ ::Google::Cloud::Sql::V1::Operation

    Pass arguments to reset_ssl_config via a request object, either of type Google::Cloud::Sql::V1::SqlInstancesResetSslConfigRequest or an equivalent Hash.

    Parameters:

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

  • #reset_ssl_config(instance: nil, project: nil, mode: nil) ⇒ ::Google::Cloud::Sql::V1::Operation

    Pass arguments to reset_ssl_config 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:

Yields:

  • (result, operation)

    Access the result along with the TransportOperation object

Yield Parameters:

Returns:

Raises:

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

    if the REST call is aborted.



1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
# File 'lib/google/cloud/sql/v1/sql_instances_service/rest/client.rb', line 1936

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

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1::SqlInstancesResetSslConfigRequest

  # 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.reset_ssl_config..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::Sql::V1::VERSION,
    transports_version_send: [:rest]

  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

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

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

  @sql_instances_service_stub.reset_ssl_config request, options do |result, operation|
    yield result, operation if block_given?
  end
rescue ::Gapic::Rest::Error => e
  raise ::Google::Cloud::Error.from_error(e)
end

#restart(request, options = nil) ⇒ ::Google::Cloud::Sql::V1::Operation #restart(instance: nil, project: nil) ⇒ ::Google::Cloud::Sql::V1::Operation

Restarts a Cloud SQL instance.

Examples:

Basic example

require "google/cloud/sql/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Sql::V1::SqlInstancesService::Rest::Client.new

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

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

# The returned object is of type Google::Cloud::Sql::V1::Operation.
p result

Overloads:

  • #restart(request, options = nil) ⇒ ::Google::Cloud::Sql::V1::Operation

    Pass arguments to restart via a request object, either of type Google::Cloud::Sql::V1::SqlInstancesRestartRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::Sql::V1::SqlInstancesRestartRequest, ::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: nil, project: nil) ⇒ ::Google::Cloud::Sql::V1::Operation

    Pass arguments to restart 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:

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

      Cloud SQL instance ID. This does not include the project ID.

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

      Project ID of the project that contains the instance to be restarted.

Yields:

  • (result, operation)

    Access the result along with the TransportOperation object

Yield Parameters:

Returns:

Raises:

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

    if the REST call is aborted.



2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
# File 'lib/google/cloud/sql/v1/sql_instances_service/rest/client.rb', line 2016

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

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1::SqlInstancesRestartRequest

  # 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..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::Sql::V1::VERSION,
    transports_version_send: [:rest]

  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

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

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

  @sql_instances_service_stub.restart request, options do |result, operation|
    yield result, operation if block_given?
  end
rescue ::Gapic::Rest::Error => e
  raise ::Google::Cloud::Error.from_error(e)
end

#restore_backup(request, options = nil) ⇒ ::Google::Cloud::Sql::V1::Operation #restore_backup(instance: nil, project: nil, body: nil) ⇒ ::Google::Cloud::Sql::V1::Operation

Restores a backup of a Cloud SQL instance. Using this operation might cause your instance to restart.

Examples:

Basic example

require "google/cloud/sql/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Sql::V1::SqlInstancesService::Rest::Client.new

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

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

# The returned object is of type Google::Cloud::Sql::V1::Operation.
p result

Overloads:

  • #restore_backup(request, options = nil) ⇒ ::Google::Cloud::Sql::V1::Operation

    Pass arguments to restore_backup via a request object, either of type Google::Cloud::Sql::V1::SqlInstancesRestoreBackupRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::Sql::V1::SqlInstancesRestoreBackupRequest, ::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_backup(instance: nil, project: nil, body: nil) ⇒ ::Google::Cloud::Sql::V1::Operation

    Pass arguments to restore_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:

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

      Cloud SQL instance ID. This does not include the project ID.

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

      Project ID of the project that contains the instance.

    • body (::Google::Cloud::Sql::V1::InstancesRestoreBackupRequest, ::Hash) (defaults to: nil)

Yields:

  • (result, operation)

    Access the result along with the TransportOperation object

Yield Parameters:

Returns:

Raises:

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

    if the REST call is aborted.



2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
# File 'lib/google/cloud/sql/v1/sql_instances_service/rest/client.rb', line 2098

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

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1::SqlInstancesRestoreBackupRequest

  # 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_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::Sql::V1::VERSION,
    transports_version_send: [:rest]

  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

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

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

  @sql_instances_service_stub.restore_backup request, options do |result, operation|
    yield result, operation if block_given?
  end
rescue ::Gapic::Rest::Error => e
  raise ::Google::Cloud::Error.from_error(e)
end

#rotate_entra_id_certificate(request, options = nil) ⇒ ::Google::Cloud::Sql::V1::Operation #rotate_entra_id_certificate(instance: nil, project: nil, body: nil) ⇒ ::Google::Cloud::Sql::V1::Operation

Rotates the server certificate version to one previously added with the addEntraIdCertificate method.

Examples:

Basic example

require "google/cloud/sql/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Sql::V1::SqlInstancesService::Rest::Client.new

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

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

# The returned object is of type Google::Cloud::Sql::V1::Operation.
p result

Overloads:

  • #rotate_entra_id_certificate(request, options = nil) ⇒ ::Google::Cloud::Sql::V1::Operation

    Pass arguments to rotate_entra_id_certificate via a request object, either of type Google::Cloud::Sql::V1::SqlInstancesRotateEntraIdCertificateRequest or an equivalent Hash.

    Parameters:

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

  • #rotate_entra_id_certificate(instance: nil, project: nil, body: nil) ⇒ ::Google::Cloud::Sql::V1::Operation

    Pass arguments to rotate_entra_id_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:

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

      Required. Cloud SQL instance ID. This does not include the project ID.

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

      Required. Project ID of the project that contains the instance.

    • body (::Google::Cloud::Sql::V1::InstancesRotateEntraIdCertificateRequest, ::Hash) (defaults to: nil)

      Optional. Rotate Entra ID certificate request body.

Yields:

  • (result, operation)

    Access the result along with the TransportOperation object

Yield Parameters:

Returns:

Raises:

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

    if the REST call is aborted.



2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
# File 'lib/google/cloud/sql/v1/sql_instances_service/rest/client.rb', line 2349

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

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1::SqlInstancesRotateEntraIdCertificateRequest

  # 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.rotate_entra_id_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::Sql::V1::VERSION,
    transports_version_send: [:rest]

  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

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

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

  @sql_instances_service_stub.rotate_entra_id_certificate request, options do |result, operation|
    yield result, operation if block_given?
  end
rescue ::Gapic::Rest::Error => e
  raise ::Google::Cloud::Error.from_error(e)
end

#rotate_server_ca(request, options = nil) ⇒ ::Google::Cloud::Sql::V1::Operation #rotate_server_ca(instance: nil, project: nil, body: nil) ⇒ ::Google::Cloud::Sql::V1::Operation

Rotates the server certificate to one signed by the Certificate Authority (CA) version previously added with the addServerCA method. For instances that have enabled Certificate Authority Service (CAS) based server CA, use RotateServerCertificate to rotate the server certificate.

Examples:

Basic example

require "google/cloud/sql/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Sql::V1::SqlInstancesService::Rest::Client.new

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

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

# The returned object is of type Google::Cloud::Sql::V1::Operation.
p result

Overloads:

  • #rotate_server_ca(request, options = nil) ⇒ ::Google::Cloud::Sql::V1::Operation

    Pass arguments to rotate_server_ca via a request object, either of type Google::Cloud::Sql::V1::SqlInstancesRotateServerCaRequest or an equivalent Hash.

    Parameters:

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

  • #rotate_server_ca(instance: nil, project: nil, body: nil) ⇒ ::Google::Cloud::Sql::V1::Operation

    Pass arguments to rotate_server_ca 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:

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

      Cloud SQL instance ID. This does not include the project ID.

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

      Project ID of the project that contains the instance.

    • body (::Google::Cloud::Sql::V1::InstancesRotateServerCaRequest, ::Hash) (defaults to: nil)

Yields:

  • (result, operation)

    Access the result along with the TransportOperation object

Yield Parameters:

Returns:

Raises:

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

    if the REST call is aborted.



2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
# File 'lib/google/cloud/sql/v1/sql_instances_service/rest/client.rb', line 2182

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

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1::SqlInstancesRotateServerCaRequest

  # 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.rotate_server_ca..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::Sql::V1::VERSION,
    transports_version_send: [:rest]

  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

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

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

  @sql_instances_service_stub.rotate_server_ca request, options do |result, operation|
    yield result, operation if block_given?
  end
rescue ::Gapic::Rest::Error => e
  raise ::Google::Cloud::Error.from_error(e)
end

#rotate_server_certificate(request, options = nil) ⇒ ::Google::Cloud::Sql::V1::Operation #rotate_server_certificate(instance: nil, project: nil, body: nil) ⇒ ::Google::Cloud::Sql::V1::Operation

Rotates the server certificate version to one previously added with the addServerCertificate method. For instances not using Certificate Authority Service (CAS) server CA, use RotateServerCa instead.

Examples:

Basic example

require "google/cloud/sql/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Sql::V1::SqlInstancesService::Rest::Client.new

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

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

# The returned object is of type Google::Cloud::Sql::V1::Operation.
p result

Overloads:

  • #rotate_server_certificate(request, options = nil) ⇒ ::Google::Cloud::Sql::V1::Operation

    Pass arguments to rotate_server_certificate via a request object, either of type Google::Cloud::Sql::V1::SqlInstancesRotateServerCertificateRequest or an equivalent Hash.

    Parameters:

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

  • #rotate_server_certificate(instance: nil, project: nil, body: nil) ⇒ ::Google::Cloud::Sql::V1::Operation

    Pass arguments to rotate_server_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:

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

      Required. Cloud SQL instance ID. This does not include the project ID.

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

      Required. Project ID of the project that contains the instance.

    • body (::Google::Cloud::Sql::V1::InstancesRotateServerCertificateRequest, ::Hash) (defaults to: nil)

      Optional. Rotate server certificate request body.

Yields:

  • (result, operation)

    Access the result along with the TransportOperation object

Yield Parameters:

Returns:

Raises:

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

    if the REST call is aborted.



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
2299
# File 'lib/google/cloud/sql/v1/sql_instances_service/rest/client.rb', line 2266

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

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1::SqlInstancesRotateServerCertificateRequest

  # 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.rotate_server_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::Sql::V1::VERSION,
    transports_version_send: [:rest]

  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

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

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

  @sql_instances_service_stub.rotate_server_certificate request, options do |result, operation|
    yield result, operation if block_given?
  end
rescue ::Gapic::Rest::Error => e
  raise ::Google::Cloud::Error.from_error(e)
end

#start_external_sync(request, options = nil) ⇒ ::Google::Cloud::Sql::V1::Operation #start_external_sync(instance: nil, project: nil, sync_mode: nil, skip_verification: nil, mysql_sync_config: nil, sync_parallel_level: nil, migration_type: nil, replica_overwrite_enabled: nil) ⇒ ::Google::Cloud::Sql::V1::Operation

Start External primary instance migration.

Examples:

Basic example

require "google/cloud/sql/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Sql::V1::SqlInstancesService::Rest::Client.new

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

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

# The returned object is of type Google::Cloud::Sql::V1::Operation.
p result

Overloads:

  • #start_external_sync(request, options = nil) ⇒ ::Google::Cloud::Sql::V1::Operation

    Pass arguments to start_external_sync via a request object, either of type Google::Cloud::Sql::V1::SqlInstancesStartExternalSyncRequest or an equivalent Hash.

    Parameters:

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

  • #start_external_sync(instance: nil, project: nil, sync_mode: nil, skip_verification: nil, mysql_sync_config: nil, sync_parallel_level: nil, migration_type: nil, replica_overwrite_enabled: nil) ⇒ ::Google::Cloud::Sql::V1::Operation

    Pass arguments to start_external_sync 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:

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

      Cloud SQL instance ID. This does not include the project ID.

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

      ID of the project that contains the instance.

    • sync_mode (::Google::Cloud::Sql::V1::SqlInstancesVerifyExternalSyncSettingsRequest::ExternalSyncMode) (defaults to: nil)

      External sync mode.

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

      Whether to skip the verification step (VESS).

    • mysql_sync_config (::Google::Cloud::Sql::V1::MySqlSyncConfig, ::Hash) (defaults to: nil)

      MySQL-specific settings for start external sync.

    • sync_parallel_level (::Google::Cloud::Sql::V1::ExternalSyncParallelLevel) (defaults to: nil)

      Optional. Parallel level for initial data sync. Currently only applicable for MySQL.

    • migration_type (::Google::Cloud::Sql::V1::SqlInstancesVerifyExternalSyncSettingsRequest::MigrationType) (defaults to: nil)

      Optional. MigrationType configures the migration to use physical files or logical dump files. If not set, then the logical dump file configuration is used. Valid values are LOGICAL or PHYSICAL. Only applicable to MySQL.

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

      Optional. MySQL only. True if end-user has confirmed that this SES call will wipe replica databases overlapping with the proposed selected_objects. If this field is not set and there are both overlapping and additional databases proposed, an error will be returned.

Yields:

  • (result, operation)

    Access the result along with the TransportOperation object

Yield Parameters:

Returns:

Raises:

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

    if the REST call is aborted.



3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
# File 'lib/google/cloud/sql/v1/sql_instances_service/rest/client.rb', line 3034

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

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1::SqlInstancesStartExternalSyncRequest

  # 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.start_external_sync..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::Sql::V1::VERSION,
    transports_version_send: [:rest]

  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

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

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

  @sql_instances_service_stub.start_external_sync request, options do |result, operation|
    yield result, operation if block_given?
  end
rescue ::Gapic::Rest::Error => e
  raise ::Google::Cloud::Error.from_error(e)
end

#start_replica(request, options = nil) ⇒ ::Google::Cloud::Sql::V1::Operation #start_replica(instance: nil, project: nil) ⇒ ::Google::Cloud::Sql::V1::Operation

Starts the replication in the read replica instance.

Examples:

Basic example

require "google/cloud/sql/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Sql::V1::SqlInstancesService::Rest::Client.new

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

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

# The returned object is of type Google::Cloud::Sql::V1::Operation.
p result

Overloads:

  • #start_replica(request, options = nil) ⇒ ::Google::Cloud::Sql::V1::Operation

    Pass arguments to start_replica via a request object, either of type Google::Cloud::Sql::V1::SqlInstancesStartReplicaRequest or an equivalent Hash.

    Parameters:

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

  • #start_replica(instance: nil, project: nil) ⇒ ::Google::Cloud::Sql::V1::Operation

    Pass arguments to start_replica 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:

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

      Cloud SQL read replica instance name.

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

      ID of the project that contains the read replica.

Yields:

  • (result, operation)

    Access the result along with the TransportOperation object

Yield Parameters:

Returns:

Raises:

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

    if the REST call is aborted.



2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
# File 'lib/google/cloud/sql/v1/sql_instances_service/rest/client.rb', line 2429

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

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1::SqlInstancesStartReplicaRequest

  # 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.start_replica..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::Sql::V1::VERSION,
    transports_version_send: [:rest]

  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

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

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

  @sql_instances_service_stub.start_replica request, options do |result, operation|
    yield result, operation if block_given?
  end
rescue ::Gapic::Rest::Error => e
  raise ::Google::Cloud::Error.from_error(e)
end

#stop_replica(request, options = nil) ⇒ ::Google::Cloud::Sql::V1::Operation #stop_replica(instance: nil, project: nil) ⇒ ::Google::Cloud::Sql::V1::Operation

Stops the replication in the read replica instance.

Examples:

Basic example

require "google/cloud/sql/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Sql::V1::SqlInstancesService::Rest::Client.new

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

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

# The returned object is of type Google::Cloud::Sql::V1::Operation.
p result

Overloads:

  • #stop_replica(request, options = nil) ⇒ ::Google::Cloud::Sql::V1::Operation

    Pass arguments to stop_replica via a request object, either of type Google::Cloud::Sql::V1::SqlInstancesStopReplicaRequest or an equivalent Hash.

    Parameters:

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

  • #stop_replica(instance: nil, project: nil) ⇒ ::Google::Cloud::Sql::V1::Operation

    Pass arguments to stop_replica 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:

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

      Cloud SQL read replica instance name.

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

      ID of the project that contains the read replica.

Yields:

  • (result, operation)

    Access the result along with the TransportOperation object

Yield Parameters:

Returns:

Raises:

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

    if the REST call is aborted.



2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
# File 'lib/google/cloud/sql/v1/sql_instances_service/rest/client.rb', line 2509

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

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1::SqlInstancesStopReplicaRequest

  # 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.stop_replica..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::Sql::V1::VERSION,
    transports_version_send: [:rest]

  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

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

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

  @sql_instances_service_stub.stop_replica request, options do |result, operation|
    yield result, operation if block_given?
  end
rescue ::Gapic::Rest::Error => e
  raise ::Google::Cloud::Error.from_error(e)
end

#switchover(request, options = nil) ⇒ ::Google::Cloud::Sql::V1::Operation #switchover(instance: nil, project: nil, db_timeout: nil) ⇒ ::Google::Cloud::Sql::V1::Operation

Switches over from the primary instance to the DR replica instance.

Examples:

Basic example

require "google/cloud/sql/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Sql::V1::SqlInstancesService::Rest::Client.new

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

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

# The returned object is of type Google::Cloud::Sql::V1::Operation.
p result

Overloads:

  • #switchover(request, options = nil) ⇒ ::Google::Cloud::Sql::V1::Operation

    Pass arguments to switchover via a request object, either of type Google::Cloud::Sql::V1::SqlInstancesSwitchoverRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::Sql::V1::SqlInstancesSwitchoverRequest, ::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(instance: nil, project: nil, db_timeout: nil) ⇒ ::Google::Cloud::Sql::V1::Operation

    Pass arguments to switchover 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:

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

      Cloud SQL read replica instance name.

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

      ID of the project that contains the replica.

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

      Optional. (MySQL and PostgreSQL only) Cloud SQL instance operations timeout, which is a sum of all database operations. Default value is 10 minutes and can be modified to a maximum value of 24 hours.

Yields:

  • (result, operation)

    Access the result along with the TransportOperation object

Yield Parameters:

Returns:

Raises:

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

    if the REST call is aborted.



1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
# File 'lib/google/cloud/sql/v1/sql_instances_service/rest/client.rb', line 1853

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

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1::SqlInstancesSwitchoverRequest

  # 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..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::Sql::V1::VERSION,
    transports_version_send: [:rest]

  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

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

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

  @sql_instances_service_stub.switchover request, options do |result, operation|
    yield result, operation if block_given?
  end
rescue ::Gapic::Rest::Error => e
  raise ::Google::Cloud::Error.from_error(e)
end

#truncate_log(request, options = nil) ⇒ ::Google::Cloud::Sql::V1::Operation #truncate_log(instance: nil, project: nil, body: nil) ⇒ ::Google::Cloud::Sql::V1::Operation

Truncate MySQL general and slow query log tables MySQL only.

Examples:

Basic example

require "google/cloud/sql/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Sql::V1::SqlInstancesService::Rest::Client.new

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

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

# The returned object is of type Google::Cloud::Sql::V1::Operation.
p result

Overloads:

  • #truncate_log(request, options = nil) ⇒ ::Google::Cloud::Sql::V1::Operation

    Pass arguments to truncate_log via a request object, either of type Google::Cloud::Sql::V1::SqlInstancesTruncateLogRequest or an equivalent Hash.

    Parameters:

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

  • #truncate_log(instance: nil, project: nil, body: nil) ⇒ ::Google::Cloud::Sql::V1::Operation

    Pass arguments to truncate_log 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:

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

      Cloud SQL instance ID. This does not include the project ID.

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

      Project ID of the Cloud SQL project.

    • body (::Google::Cloud::Sql::V1::InstancesTruncateLogRequest, ::Hash) (defaults to: nil)

Yields:

  • (result, operation)

    Access the result along with the TransportOperation object

Yield Parameters:

Returns:

Raises:

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

    if the REST call is aborted.



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
2616
2617
2618
2619
2620
2621
2622
2623
2624
# File 'lib/google/cloud/sql/v1/sql_instances_service/rest/client.rb', line 2591

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

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1::SqlInstancesTruncateLogRequest

  # 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.truncate_log..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::Sql::V1::VERSION,
    transports_version_send: [:rest]

  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

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

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

  @sql_instances_service_stub.truncate_log request, options do |result, operation|
    yield result, operation if block_given?
  end
rescue ::Gapic::Rest::Error => e
  raise ::Google::Cloud::Error.from_error(e)
end

#universe_domainString

The effective universe domain

Returns:

  • (String)


107
108
109
# File 'lib/google/cloud/sql/v1/sql_instances_service/rest/client.rb', line 107

def universe_domain
  @sql_instances_service_stub.universe_domain
end

#update(request, options = nil) ⇒ ::Google::Cloud::Sql::V1::Operation #update(instance: nil, project: nil, body: nil) ⇒ ::Google::Cloud::Sql::V1::Operation

Updates settings of a Cloud SQL instance. Using this operation might cause your instance to restart.

Examples:

Basic example

require "google/cloud/sql/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Sql::V1::SqlInstancesService::Rest::Client.new

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

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

# The returned object is of type Google::Cloud::Sql::V1::Operation.
p result

Overloads:

  • #update(request, options = nil) ⇒ ::Google::Cloud::Sql::V1::Operation

    Pass arguments to update via a request object, either of type Google::Cloud::Sql::V1::SqlInstancesUpdateRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::Sql::V1::SqlInstancesUpdateRequest, ::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: nil, project: nil, body: nil) ⇒ ::Google::Cloud::Sql::V1::Operation

    Pass arguments to update 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:

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

      Cloud SQL instance ID. This does not include the project ID.

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

      Project ID of the project that contains the instance.

    • body (::Google::Cloud::Sql::V1::DatabaseInstance, ::Hash) (defaults to: nil)

Yields:

  • (result, operation)

    Access the result along with the TransportOperation object

Yield Parameters:

Returns:

Raises:

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

    if the REST call is aborted.



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
2702
2703
2704
2705
2706
# File 'lib/google/cloud/sql/v1/sql_instances_service/rest/client.rb', line 2673

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

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1::SqlInstancesUpdateRequest

  # 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..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::Sql::V1::VERSION,
    transports_version_send: [:rest]

  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

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

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

  @sql_instances_service_stub.update request, options do |result, operation|
    yield result, operation if block_given?
  end
rescue ::Gapic::Rest::Error => e
  raise ::Google::Cloud::Error.from_error(e)
end

#verify_external_sync_settings(request, options = nil) ⇒ ::Google::Cloud::Sql::V1::SqlInstancesVerifyExternalSyncSettingsResponse #verify_external_sync_settings(instance: nil, project: nil, verify_connection_only: nil, sync_mode: nil, verify_replication_only: nil, mysql_sync_config: nil, migration_type: nil, sync_parallel_level: nil, selected_objects: nil) ⇒ ::Google::Cloud::Sql::V1::SqlInstancesVerifyExternalSyncSettingsResponse

Verify External primary instance external sync settings.

Examples:

Basic example

require "google/cloud/sql/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Sql::V1::SqlInstancesService::Rest::Client.new

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

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

# The returned object is of type Google::Cloud::Sql::V1::SqlInstancesVerifyExternalSyncSettingsResponse.
p result

Overloads:

Yields:

  • (result, operation)

    Access the result along with the TransportOperation object

Yield Parameters:

Returns:

Raises:

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

    if the REST call is aborted.



2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
# File 'lib/google/cloud/sql/v1/sql_instances_service/rest/client.rb', line 2936

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

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1::SqlInstancesVerifyExternalSyncSettingsRequest

  # 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.verify_external_sync_settings..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::Sql::V1::VERSION,
    transports_version_send: [:rest]

  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

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

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

  @sql_instances_service_stub.verify_external_sync_settings request, options do |result, operation|
    yield result, operation if block_given?
  end
rescue ::Gapic::Rest::Error => e
  raise ::Google::Cloud::Error.from_error(e)
end