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

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

REST client for the SqlDatabasesService service.

Service to manage databases.

Inherits

  • Object

Methods

.configure

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

Configure the SqlDatabasesService 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 SqlDatabasesService clients
::Google::Cloud::Sql::V1::SqlDatabasesService::Rest::Client.configure do |config|
  config.timeout = 10.0
end

#configure

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

Configure the SqlDatabasesService 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

#delete

def delete(request, options = nil) -> ::Google::Cloud::Sql::V1::Operation
def delete(database: nil, instance: nil, project: nil) -> ::Google::Cloud::Sql::V1::Operation

Deletes a database from a Cloud SQL instance.

Overloads
def delete(request, options = nil) -> ::Google::Cloud::Sql::V1::Operation
Pass arguments to delete via a request object, either of type Google::Cloud::Sql::V1::SqlDatabasesDeleteRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Sql::V1::SqlDatabasesDeleteRequest, ::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(database: nil, instance: nil, project: 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
  • database (::String) — Name of the database to be deleted in the instance.
  • instance (::String) — Database instance ID. This does not include the project ID.
  • project (::String) — Project ID of the project that contains the instance.
Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the REST call 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::SqlDatabasesService::Rest::Client.new

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

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

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

#get

def get(request, options = nil) -> ::Google::Cloud::Sql::V1::Database
def get(database: nil, instance: nil, project: nil) -> ::Google::Cloud::Sql::V1::Database

Retrieves a resource containing information about a database inside a Cloud SQL instance.

Overloads
def get(request, options = nil) -> ::Google::Cloud::Sql::V1::Database
Pass arguments to get via a request object, either of type Google::Cloud::Sql::V1::SqlDatabasesGetRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Sql::V1::SqlDatabasesGetRequest, ::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(database: nil, instance: nil, project: nil) -> ::Google::Cloud::Sql::V1::Database
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
  • database (::String) — Name of the database in the instance.
  • instance (::String) — Database instance ID. This does not include the project ID.
  • project (::String) — Project ID of the project that contains the instance.
Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the REST call 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::SqlDatabasesService::Rest::Client.new

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

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

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

#initialize

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

Create a new SqlDatabasesService REST client object.

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

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

#insert

def insert(request, options = nil) -> ::Google::Cloud::Sql::V1::Operation
def insert(instance: nil, project: nil, body: nil) -> ::Google::Cloud::Sql::V1::Operation

Inserts a resource containing information about a database inside a Cloud SQL instance.

Note: You can't modify the default character set and collation.

Overloads
def insert(request, options = nil) -> ::Google::Cloud::Sql::V1::Operation
Pass arguments to insert via a request object, either of type Google::Cloud::Sql::V1::SqlDatabasesInsertRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Sql::V1::SqlDatabasesInsertRequest, ::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 insert(instance: nil, 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
  • instance (::String) — Database instance ID. This does not include the project ID.
  • project (::String) — Project ID of the project that contains the instance.
  • body (::Google::Cloud::Sql::V1::Database, ::Hash)
Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the REST call 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::SqlDatabasesService::Rest::Client.new

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

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

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

#list

def list(request, options = nil) -> ::Google::Cloud::Sql::V1::DatabasesListResponse
def list(instance: nil, project: nil) -> ::Google::Cloud::Sql::V1::DatabasesListResponse

Lists databases in the specified Cloud SQL instance.

Overloads
def list(request, options = nil) -> ::Google::Cloud::Sql::V1::DatabasesListResponse
Pass arguments to list via a request object, either of type Google::Cloud::Sql::V1::SqlDatabasesListRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Sql::V1::SqlDatabasesListRequest, ::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(instance: nil, project: nil) -> ::Google::Cloud::Sql::V1::DatabasesListResponse
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
  • instance (::String) — Cloud SQL instance ID. This does not include the project ID.
  • project (::String) — Project ID of the project that contains the instance.
Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the REST call 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::SqlDatabasesService::Rest::Client.new

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

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

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

#location_client

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

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

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

#logger

def logger() -> Logger

The logger used for request/response debug logging.

Returns
  • (Logger)

#patch

def patch(request, options = nil) -> ::Google::Cloud::Sql::V1::Operation
def patch(database: nil, instance: nil, project: nil, body: nil) -> ::Google::Cloud::Sql::V1::Operation

Partially updates a resource containing information about a database inside a Cloud SQL instance. This method supports patch semantics.

Overloads
def patch(request, options = nil) -> ::Google::Cloud::Sql::V1::Operation
Pass arguments to patch via a request object, either of type Google::Cloud::Sql::V1::SqlDatabasesUpdateRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Sql::V1::SqlDatabasesUpdateRequest, ::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 patch(database: nil, 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
  • database (::String) — Name of the database to be updated in the instance.
  • instance (::String) — Database instance ID. This does not include the project ID.
  • project (::String) — Project ID of the project that contains the instance.
  • body (::Google::Cloud::Sql::V1::Database, ::Hash)
Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the REST call 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::SqlDatabasesService::Rest::Client.new

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

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

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

#universe_domain

def universe_domain() -> String

The effective universe domain

Returns
  • (String)

#update

def update(request, options = nil) -> ::Google::Cloud::Sql::V1::Operation
def update(database: nil, instance: nil, project: nil, body: nil) -> ::Google::Cloud::Sql::V1::Operation

Updates a resource containing information about a database inside a Cloud SQL instance.

Overloads
def update(request, options = nil) -> ::Google::Cloud::Sql::V1::Operation
Pass arguments to update via a request object, either of type Google::Cloud::Sql::V1::SqlDatabasesUpdateRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Sql::V1::SqlDatabasesUpdateRequest, ::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(database: nil, 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
  • database (::String) — Name of the database to be updated in the instance.
  • instance (::String) — Database instance ID. This does not include the project ID.
  • project (::String) — Project ID of the project that contains the instance.
  • body (::Google::Cloud::Sql::V1::Database, ::Hash)
Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the REST call 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::SqlDatabasesService::Rest::Client.new

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

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

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