Cloud SQL Admin V1 API - Class Google::Cloud::Sql::V1::SqlBackupsService::Client (v0.1.0)

Reference documentation and code samples for the Cloud SQL Admin V1 API class Google::Cloud::Sql::V1::SqlBackupsService::Client.

Client for the SqlBackupsService service.

Inherits

  • Object

Methods

.configure

def self.configure() { |config| ... } -> Client::Configuration

Configure the SqlBackupsService Client class.

See Configuration for a description of the configuration fields.

Yields
  • (config) — Configure the Client client.
Yield Parameter
Example
# Modify the configuration for all SqlBackupsService clients
::Google::Cloud::Sql::V1::SqlBackupsService::Client.configure do |config|
  config.timeout = 10.0
end

#configure

def configure() { |config| ... } -> Client::Configuration

Configure the SqlBackupsService Client instance.

The configuration is set to the derived mode, meaning that values can be changed, but structural changes (adding new fields, etc.) are not allowed. Structural changes should be made on Client.configure.

See Configuration for a description of the configuration fields.

Yields
  • (config) — Configure the Client client.
Yield Parameter

#create_backup

def create_backup(request, options = nil) -> ::Google::Cloud::Sql::V1::Operation
def create_backup(parent: nil, backup: nil) -> ::Google::Cloud::Sql::V1::Operation

Creates a backup for a Cloud SQL instance. This API can be used only to create on-demand backups.

Overloads
def create_backup(request, options = nil) -> ::Google::Cloud::Sql::V1::Operation
Pass arguments to create_backup via a request object, either of type CreateBackupRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Sql::V1::CreateBackupRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def create_backup(parent: nil, backup: nil) -> ::Google::Cloud::Sql::V1::Operation
Pass arguments to create_backup via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameters
  • parent (::String) — Required. The parent resource where this backup is created. Format: projects/{project}
  • backup (::Google::Cloud::Sql::V1::Backup, ::Hash) — Required. The Backup to create.
Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

Basic example

require "google/cloud/sql/v1"

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

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

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

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

#delete_backup

def delete_backup(request, options = nil) -> ::Google::Cloud::Sql::V1::Operation
def delete_backup(name: nil) -> ::Google::Cloud::Sql::V1::Operation

Deletes the backup.

Overloads
def delete_backup(request, options = nil) -> ::Google::Cloud::Sql::V1::Operation
Pass arguments to delete_backup via a request object, either of type DeleteBackupRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Sql::V1::DeleteBackupRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def delete_backup(name: nil) -> ::Google::Cloud::Sql::V1::Operation
Pass arguments to delete_backup via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameter
  • name (::String) — Required. The name of the backup to delete. Format: projects/{project}/backups/{backup}
Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

Basic example

require "google/cloud/sql/v1"

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

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

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

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

#get_backup

def get_backup(request, options = nil) -> ::Google::Cloud::Sql::V1::Backup
def get_backup(name: nil) -> ::Google::Cloud::Sql::V1::Backup

Retrieves a resource containing information about a backup.

Overloads
def get_backup(request, options = nil) -> ::Google::Cloud::Sql::V1::Backup
Pass arguments to get_backup via a request object, either of type GetBackupRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Sql::V1::GetBackupRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def get_backup(name: nil) -> ::Google::Cloud::Sql::V1::Backup
Pass arguments to get_backup via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameter
  • name (::String) — Required. The name of the backup to retrieve. Format: projects/{project}/backups/{backup}
Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

Basic example

require "google/cloud/sql/v1"

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

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

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

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

#initialize

def initialize() { |config| ... } -> Client

Create a new SqlBackupsService client object.

Yields
  • (config) — Configure the SqlBackupsService client.
Yield Parameter
Returns
  • (Client) — a new instance of Client
Example
# Create a client using the default configuration
client = ::Google::Cloud::Sql::V1::SqlBackupsService::Client.new

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

#list_backups

def list_backups(request, options = nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::Sql::V1::Backup>
def list_backups(parent: nil, page_size: nil, page_token: nil, filter: nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::Sql::V1::Backup>

Lists all backups associated with the project.

Overloads
def list_backups(request, options = nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::Sql::V1::Backup>
Pass arguments to list_backups via a request object, either of type ListBackupsRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Sql::V1::ListBackupsRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def list_backups(parent: nil, page_size: nil, page_token: nil, filter: nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::Sql::V1::Backup>
Pass arguments to list_backups via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameters
  • parent (::String) — Required. The parent that owns this collection of backups. Format: projects/{project}
  • page_size (::Integer) — The maximum number of backups to return per response. The service might return fewer backups than this value. If a value for this parameter isn't specified, then, at most, 500 backups are returned. The maximum value is 2,000. Any values that you set, which are greater than 2,000, are changed to 2,000.
  • page_token (::String) — A page token, received from a previous ListBackups call. Provide this to retrieve the subsequent page.

    When paginating, all other parameters provided to ListBackups must match the call that provided the page token.

  • filter (::String) — Multiple filter queries are separated by spaces. For example, 'instance:abc AND type:FINAL, 'location:us', 'backupInterval.startTime>=1950-01-01T01:01:25.771Z'. You can filter by type, instance, backupInterval.startTime (creation time), or location.
Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
Returns
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

Basic example

require "google/cloud/sql/v1"

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

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

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

# The returned object is of type Gapic::PagedEnumerable. You can iterate
# over elements, and API calls will be issued to fetch pages as needed.
result.each do |item|
  # Each element is of type ::Google::Cloud::Sql::V1::Backup.
  p item
end

#location_client

def location_client() -> Google::Cloud::Location::Locations::Client

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

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

#logger

def logger() -> Logger

The logger used for request/response debug logging.

Returns
  • (Logger)

#universe_domain

def universe_domain() -> String

The effective universe domain

Returns
  • (String)

#update_backup

def update_backup(request, options = nil) -> ::Google::Cloud::Sql::V1::Operation
def update_backup(backup: nil, update_mask: nil) -> ::Google::Cloud::Sql::V1::Operation

Updates the retention period and description of the backup. You can use this API to update final backups only.

Overloads
def update_backup(request, options = nil) -> ::Google::Cloud::Sql::V1::Operation
Pass arguments to update_backup via a request object, either of type UpdateBackupRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Sql::V1::UpdateBackupRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def update_backup(backup: nil, update_mask: nil) -> ::Google::Cloud::Sql::V1::Operation
Pass arguments to update_backup via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameters
  • backup (::Google::Cloud::Sql::V1::Backup, ::Hash) — Required. The backup to update. The backup’s name field is used to identify the backup to update. Format: projects/{project}/backups/{backup}
  • update_mask (::Google::Protobuf::FieldMask, ::Hash) — The list of fields that you can update. You can update only the description and retention period of the final backup.
Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

Basic example

require "google/cloud/sql/v1"

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

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

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

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