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

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

Overview

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 client object.

Examples:


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

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

Yields:

  • (config)

    Configure the SqlInstancesService client.

Yield Parameters:



125
126
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
176
177
178
179
180
181
182
# File 'lib/google/cloud/sql/v1/sql_instances_service/client.rb', line 125

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

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

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

  # Create credentials
  credentials = @config.credentials
  # Use self-signed JWT if the endpoint is unchanged from default,
  # but only if the default endpoint does not have a region prefix.
  enable_self_signed_jwt = @config.endpoint.nil? ||
                           (@config.endpoint == Configuration::DEFAULT_ENDPOINT &&
                           !@config.endpoint.split(".").first.include?("-"))
  credentials ||= Credentials.default scope: @config.scope,
                                      enable_self_signed_jwt: enable_self_signed_jwt
  if credentials.is_a?(::String) || credentials.is_a?(::Hash)
    credentials = Credentials.new credentials, scope: @config.scope
  end
  @quota_project_id = @config.quota_project
  @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id

  @sql_instances_service_stub = ::Gapic::ServiceStub.new(
    ::Google::Cloud::Sql::V1::SqlInstancesService::Stub,
    credentials: credentials,
    endpoint: @config.endpoint,
    endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
    universe_domain: @config.universe_domain,
    channel_args: @config.channel_args,
    interceptors: @config.interceptors,
    channel_pool_config: @config.channel_pool,
    logger: @config.logger
  )

  @sql_instances_service_stub.stub_logger&.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::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::Client (readonly)

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

Returns:

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


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

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::Client.configure do |config|
  config.timeout = 10.0
end

Yields:

  • (config)

    Configure the Client client.

Yield Parameters:

Returns:



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

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

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

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

    if the RPC is aborted.



3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
# File 'lib/google/cloud/sql/v1/sql_instances_service/client.rb', line 3919

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

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

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

  options.apply_defaults timeout:      @config.rpcs.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.call_rpc :acquire_ssrs_lease, request, options: options do |response, operation|
    yield response, operation if block_given?
  end
rescue ::GRPC::BadStatus => 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::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:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

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

    if the RPC is aborted.



442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
# File 'lib/google/cloud/sql/v1/sql_instances_service/client.rb', line 442

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

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

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

  options.apply_defaults timeout:      @config.rpcs.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.call_rpc :add_entra_id_certificate, request, options: options do |response, operation|
    yield response, operation if block_given?
  end
rescue ::GRPC::BadStatus => 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::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:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

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

    if the RPC is aborted.



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
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
# File 'lib/google/cloud/sql/v1/sql_instances_service/client.rb', line 254

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

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

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

  options.apply_defaults timeout:      @config.rpcs.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.call_rpc :add_server_ca, request, options: options do |response, operation|
    yield response, operation if block_given?
  end
rescue ::GRPC::BadStatus => 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::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:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

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

    if the RPC is aborted.



350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
# File 'lib/google/cloud/sql/v1/sql_instances_service/client.rb', line 350

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

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

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

  options.apply_defaults timeout:      @config.rpcs.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.call_rpc :add_server_certificate, request, options: options do |response, operation|
    yield response, operation if block_given?
  end
rescue ::GRPC::BadStatus => 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::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:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

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

    if the RPC is aborted.



535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
# File 'lib/google/cloud/sql/v1/sql_instances_service/client.rb', line 535

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

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

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

  options.apply_defaults timeout:      @config.rpcs.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_rpc :call_clone, request, options: options do |response, operation|
    yield response, operation if block_given?
  end
rescue ::GRPC::BadStatus => 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:



95
96
97
98
# File 'lib/google/cloud/sql/v1/sql_instances_service/client.rb', line 95

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

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

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

    if the RPC is aborted.



3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
# File 'lib/google/cloud/sql/v1/sql_instances_service/client.rb', line 3059

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

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

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

  options.apply_defaults timeout:      @config.rpcs.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.call_rpc :create_ephemeral, request, options: options do |response, operation|
    yield response, operation if block_given?
  end
rescue ::GRPC::BadStatus => 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::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:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

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

    if the RPC is aborted.



638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
# File 'lib/google/cloud/sql/v1/sql_instances_service/client.rb', line 638

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

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

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

  options.apply_defaults timeout:      @config.rpcs.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.call_rpc :delete, request, options: options do |response, operation|
    yield response, operation if block_given?
  end
rescue ::GRPC::BadStatus => 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::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:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

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

    if the RPC is aborted.



823
824
825
826
827
828
829
830
831
832
833
834
835
836
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
# File 'lib/google/cloud/sql/v1/sql_instances_service/client.rb', line 823

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

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

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

  options.apply_defaults timeout:      @config.rpcs.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.call_rpc :demote, request, options: options do |response, operation|
    yield response, operation if block_given?
  end
rescue ::GRPC::BadStatus => 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::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:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

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

    if the RPC is aborted.



730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
# File 'lib/google/cloud/sql/v1/sql_instances_service/client.rb', line 730

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

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

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

  options.apply_defaults timeout:      @config.rpcs.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.call_rpc :demote_master, request, options: options do |response, operation|
    yield response, operation if block_given?
  end
rescue ::GRPC::BadStatus => 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::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:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

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

    if the RPC is aborted.



3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
# File 'lib/google/cloud/sql/v1/sql_instances_service/client.rb', line 3823

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

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

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

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

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

  @sql_instances_service_stub.call_rpc :execute_sql, request, options: options do |response, operation|
    yield response, operation if block_given?
  end
rescue ::GRPC::BadStatus => 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::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:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

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

    if the RPC is aborted.



915
916
917
918
919
920
921
922
923
924
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
# File 'lib/google/cloud/sql/v1/sql_instances_service/client.rb', line 915

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

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

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

  options.apply_defaults timeout:      @config.rpcs.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.call_rpc :export, request, options: options do |response, operation|
    yield response, operation if block_given?
  end
rescue ::GRPC::BadStatus => 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::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:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

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

    if the RPC is aborted.



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
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
# File 'lib/google/cloud/sql/v1/sql_instances_service/client.rb', line 1013

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

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

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

  options.apply_defaults timeout:      @config.rpcs.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.call_rpc :failover, request, options: options do |response, operation|
    yield response, operation if block_given?
  end
rescue ::GRPC::BadStatus => 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::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:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

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

    if the RPC is aborted.



1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
# File 'lib/google/cloud/sql/v1/sql_instances_service/client.rb', line 1195

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

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

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

  options.apply_defaults timeout:      @config.rpcs.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.call_rpc :get, request, options: options do |response, operation|
    yield response, operation if block_given?
  end
rescue ::GRPC::BadStatus => 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::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:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

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

    if the RPC is aborted.



3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
# File 'lib/google/cloud/sql/v1/sql_instances_service/client.rb', line 3548

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

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

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

  options.apply_defaults timeout:      @config.rpcs.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.call_rpc :get_disk_shrink_config, request, options: options do |response, operation|
    yield response, operation if block_given?
  end
rescue ::GRPC::BadStatus => 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::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:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

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

    if the RPC is aborted.



3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
# File 'lib/google/cloud/sql/v1/sql_instances_service/client.rb', line 3731

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

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

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

  options.apply_defaults timeout:      @config.rpcs.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.call_rpc :get_latest_recovery_time, request, options: options do |response, operation|
    yield response, operation if block_given?
  end
rescue ::GRPC::BadStatus => 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::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:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

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

    if the RPC is aborted.



1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
# File 'lib/google/cloud/sql/v1/sql_instances_service/client.rb', line 1287

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

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

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

  options.apply_defaults timeout:      @config.rpcs.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.call_rpc :import, request, options: options do |response, operation|
    yield response, operation if block_given?
  end
rescue ::GRPC::BadStatus => 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::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:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

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

    if the RPC is aborted.



1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
# File 'lib/google/cloud/sql/v1/sql_instances_service/client.rb', line 1377

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

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

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

  options.apply_defaults timeout:      @config.rpcs.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.call_rpc :insert, request, options: options do |response, operation|
    yield response, operation if block_given?
  end
rescue ::GRPC::BadStatus => 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::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:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

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

    if the RPC is aborted.



1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
# File 'lib/google/cloud/sql/v1/sql_instances_service/client.rb', line 1480

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

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

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

  options.apply_defaults timeout:      @config.rpcs.list.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.call_rpc :list, request, options: options do |response, operation|
    yield response, operation if block_given?
  end
rescue ::GRPC::BadStatus => 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::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:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

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

    if the RPC is aborted.



1759
1760
1761
1762
1763
1764
1765
1766
1767
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/client.rb', line 1759

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

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

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

  options.apply_defaults timeout:      @config.rpcs.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.call_rpc :list_entra_id_certificates, request, options: options do |response, operation|
    yield response, operation if block_given?
  end
rescue ::GRPC::BadStatus => 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::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:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

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

    if the RPC is aborted.



1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
# File 'lib/google/cloud/sql/v1/sql_instances_service/client.rb', line 1571

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

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

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

  options.apply_defaults timeout:      @config.rpcs.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.call_rpc :list_server_cas, request, options: options do |response, operation|
    yield response, operation if block_given?
  end
rescue ::GRPC::BadStatus => 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::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:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

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

    if the RPC is aborted.



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

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

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

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

  options.apply_defaults timeout:      @config.rpcs.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.call_rpc :list_server_certificates, request, options: options do |response, operation|
    yield response, operation if block_given?
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end

#loggerLogger

The logger used for request/response debug logging.

Returns:

  • (Logger)


196
197
198
# File 'lib/google/cloud/sql/v1/sql_instances_service/client.rb', line 196

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

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

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

    if the RPC is aborted.



1851
1852
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
1887
1888
1889
1890
1891
1892
1893
# File 'lib/google/cloud/sql/v1/sql_instances_service/client.rb', line 1851

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

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

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

  options.apply_defaults timeout:      @config.rpcs.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.call_rpc :patch, request, options: options do |response, operation|
    yield response, operation if block_given?
  end
rescue ::GRPC::BadStatus => 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::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:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

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

    if the RPC is aborted.



3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
# File 'lib/google/cloud/sql/v1/sql_instances_service/client.rb', line 3458

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

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

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

  options.apply_defaults timeout:      @config.rpcs.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.call_rpc :perform_disk_shrink, request, options: options do |response, operation|
    yield response, operation if block_given?
  end
rescue ::GRPC::BadStatus => 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::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:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

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

    if the RPC is aborted.



4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
4217
4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
4231
4232
4233
4234
4235
4236
4237
# File 'lib/google/cloud/sql/v1/sql_instances_service/client.rb', line 4198

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

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

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

  options.apply_defaults timeout:      @config.rpcs.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.call_rpc :point_in_time_restore, request, options: options do |response, operation|
    yield response, operation if block_given?
  end
rescue ::GRPC::BadStatus => 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::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:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

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

    if the RPC is aborted.



4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
# File 'lib/google/cloud/sql/v1/sql_instances_service/client.rb', line 4105

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

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

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

  options.apply_defaults timeout:      @config.rpcs.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.call_rpc :pre_check_major_version_upgrade, request, options: options do |response, operation|
    yield response, operation if block_given?
  end
rescue ::GRPC::BadStatus => 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::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:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

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

    if the RPC is aborted.



1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
# File 'lib/google/cloud/sql/v1/sql_instances_service/client.rb', line 1950

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

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

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

  options.apply_defaults timeout:      @config.rpcs.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.call_rpc :promote_replica, request, options: options do |response, operation|
    yield response, operation if block_given?
  end
rescue ::GRPC::BadStatus => 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::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:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

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

    if the RPC is aborted.



1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
# File 'lib/google/cloud/sql/v1/sql_instances_service/client.rb', line 1105

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

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

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

  options.apply_defaults timeout:      @config.rpcs.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.call_rpc :reencrypt, request, options: options do |response, operation|
    yield response, operation if block_given?
  end
rescue ::GRPC::BadStatus => 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::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:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

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

    if the RPC is aborted.



4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
# File 'lib/google/cloud/sql/v1/sql_instances_service/client.rb', line 4012

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

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

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

  options.apply_defaults timeout:      @config.rpcs.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.call_rpc :release_ssrs_lease, request, options: options do |response, operation|
    yield response, operation if block_given?
  end
rescue ::GRPC::BadStatus => 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::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:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

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

    if the RPC is aborted.



3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
# File 'lib/google/cloud/sql/v1/sql_instances_service/client.rb', line 3150

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

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

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

  options.apply_defaults timeout:      @config.rpcs.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.call_rpc :reschedule_maintenance, request, options: options do |response, operation|
    yield response, operation if block_given?
  end
rescue ::GRPC::BadStatus => 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::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:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

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

    if the RPC is aborted.



3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
# File 'lib/google/cloud/sql/v1/sql_instances_service/client.rb', line 3638

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

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

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

  options.apply_defaults timeout:      @config.rpcs.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.call_rpc :reset_replica_size, request, options: options do |response, operation|
    yield response, operation if block_given?
  end
rescue ::GRPC::BadStatus => 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::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:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

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

    if the RPC is aborted.



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

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

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

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

  options.apply_defaults timeout:      @config.rpcs.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.call_rpc :reset_ssl_config, request, options: options do |response, operation|
    yield response, operation if block_given?
  end
rescue ::GRPC::BadStatus => 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::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:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

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

    if the RPC is aborted.



2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
# File 'lib/google/cloud/sql/v1/sql_instances_service/client.rb', line 2228

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

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

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

  options.apply_defaults timeout:      @config.rpcs.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.call_rpc :restart, request, options: options do |response, operation|
    yield response, operation if block_given?
  end
rescue ::GRPC::BadStatus => 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::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:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

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

    if the RPC is aborted.



2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
# File 'lib/google/cloud/sql/v1/sql_instances_service/client.rb', line 2320

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

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

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

  options.apply_defaults timeout:      @config.rpcs.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.call_rpc :restore_backup, request, options: options do |response, operation|
    yield response, operation if block_given?
  end
rescue ::GRPC::BadStatus => 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::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:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

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

    if the RPC is aborted.



2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
# File 'lib/google/cloud/sql/v1/sql_instances_service/client.rb', line 2601

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

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

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

  options.apply_defaults timeout:      @config.rpcs.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.call_rpc :rotate_entra_id_certificate, request, options: options do |response, operation|
    yield response, operation if block_given?
  end
rescue ::GRPC::BadStatus => 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::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:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

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

    if the RPC is aborted.



2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
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
# File 'lib/google/cloud/sql/v1/sql_instances_service/client.rb', line 2414

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

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

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

  options.apply_defaults timeout:      @config.rpcs.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.call_rpc :rotate_server_ca, request, options: options do |response, operation|
    yield response, operation if block_given?
  end
rescue ::GRPC::BadStatus => 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::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:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

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

    if the RPC is aborted.



2508
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
2543
2544
2545
2546
2547
2548
2549
2550
# File 'lib/google/cloud/sql/v1/sql_instances_service/client.rb', line 2508

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

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

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

  options.apply_defaults timeout:      @config.rpcs.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.call_rpc :rotate_server_certificate, request, options: options do |response, operation|
    yield response, operation if block_given?
  end
rescue ::GRPC::BadStatus => 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::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:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

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

    if the RPC is aborted.



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
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
# File 'lib/google/cloud/sql/v1/sql_instances_service/client.rb', line 3366

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

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

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

  options.apply_defaults timeout:      @config.rpcs.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.call_rpc :start_external_sync, request, options: options do |response, operation|
    yield response, operation if block_given?
  end
rescue ::GRPC::BadStatus => 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::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:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

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

    if the RPC is aborted.



2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
# File 'lib/google/cloud/sql/v1/sql_instances_service/client.rb', line 2691

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

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

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

  options.apply_defaults timeout:      @config.rpcs.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.call_rpc :start_replica, request, options: options do |response, operation|
    yield response, operation if block_given?
  end
rescue ::GRPC::BadStatus => 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::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:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

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

    if the RPC is aborted.



2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
# File 'lib/google/cloud/sql/v1/sql_instances_service/client.rb', line 2781

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

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

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

  options.apply_defaults timeout:      @config.rpcs.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.call_rpc :stop_replica, request, options: options do |response, operation|
    yield response, operation if block_given?
  end
rescue ::GRPC::BadStatus => 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::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:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

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

    if the RPC is aborted.



2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
# File 'lib/google/cloud/sql/v1/sql_instances_service/client.rb', line 2045

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

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

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

  options.apply_defaults timeout:      @config.rpcs.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.call_rpc :switchover, request, options: options do |response, operation|
    yield response, operation if block_given?
  end
rescue ::GRPC::BadStatus => 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::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:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

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

    if the RPC is aborted.



2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
# File 'lib/google/cloud/sql/v1/sql_instances_service/client.rb', line 2873

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

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

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

  options.apply_defaults timeout:      @config.rpcs.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.call_rpc :truncate_log, request, options: options do |response, operation|
    yield response, operation if block_given?
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end

#universe_domainString

The effective universe domain

Returns:

  • (String)


105
106
107
# File 'lib/google/cloud/sql/v1/sql_instances_service/client.rb', line 105

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

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

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

    if the RPC is aborted.



2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
# File 'lib/google/cloud/sql/v1/sql_instances_service/client.rb', line 2965

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

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

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

  options.apply_defaults timeout:      @config.rpcs.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.call_rpc :update, request, options: options do |response, operation|
    yield response, operation if block_given?
  end
rescue ::GRPC::BadStatus => 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::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:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

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

    if the RPC is aborted.



3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
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
# File 'lib/google/cloud/sql/v1/sql_instances_service/client.rb', line 3258

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

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

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

  options.apply_defaults timeout:      @config.rpcs.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.call_rpc :verify_external_sync_settings, request, options: options do |response, operation|
    yield response, operation if block_given?
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end