Reference documentation and code samples for the Cloud SQL Admin V1 API class Google::Cloud::Sql::V1::SqlDatabasesService::Client.
Client for the SqlDatabasesService service.
Service to manage databases.
Inherits
- Object
Methods
.configure
def self.configure() { |config| ... } -> Client::ConfigurationConfigure the SqlDatabasesService Client class.
See Configuration for a description of the configuration fields.
- (config) — Configure the Client client.
- config (Client::Configuration)
# Modify the configuration for all SqlDatabasesService clients ::Google::Cloud::Sql::V1::SqlDatabasesService::Client.configure do |config| config.timeout = 10.0 end
#configure
def configure() { |config| ... } -> Client::ConfigurationConfigure 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.
- (config) — Configure the Client client.
- config (Client::Configuration)
#delete
def delete(request, options = nil) -> ::Google::Cloud::Sql::V1::Operation
def delete(database: nil, instance: nil, project: nil) -> ::Google::Cloud::Sql::V1::OperationDeletes a database from a Cloud SQL instance.
def delete(request, options = nil) -> ::Google::Cloud::Sql::V1::Operationdelete via a request object, either of type
Google::Cloud::Sql::V1::SqlDatabasesDeleteRequest or an equivalent Hash.
- 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::Operationdelete 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).
- 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.
- (response, operation) — Access the result along with the RPC operation
- response (::Google::Cloud::Sql::V1::Operation)
- operation (::GRPC::ActiveCall::Operation)
- (::Google::Cloud::Error) — if the RPC is aborted.
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::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::DatabaseRetrieves a resource containing information about a database inside a Cloud SQL instance.
def get(request, options = nil) -> ::Google::Cloud::Sql::V1::Databaseget via a request object, either of type
Google::Cloud::Sql::V1::SqlDatabasesGetRequest or an equivalent Hash.
- 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::Databaseget 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).
- 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.
- (response, operation) — Access the result along with the RPC operation
- response (::Google::Cloud::Sql::V1::Database)
- operation (::GRPC::ActiveCall::Operation)
- (::Google::Cloud::Error) — if the RPC is aborted.
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::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| ... } -> ClientCreate a new SqlDatabasesService client object.
- (config) — Configure the SqlDatabasesService client.
- config (Client::Configuration)
- (Client) — a new instance of Client
# Create a client using the default configuration client = ::Google::Cloud::Sql::V1::SqlDatabasesService::Client.new # Create a client using a custom configuration client = ::Google::Cloud::Sql::V1::SqlDatabasesService::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::OperationInserts a resource containing information about a database inside a Cloud SQL instance.
Note: You can't modify the default character set and collation.
def insert(request, options = nil) -> ::Google::Cloud::Sql::V1::Operationinsert via a request object, either of type
Google::Cloud::Sql::V1::SqlDatabasesInsertRequest or an equivalent Hash.
- 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::Operationinsert 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).
- 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)
- (response, operation) — Access the result along with the RPC operation
- response (::Google::Cloud::Sql::V1::Operation)
- operation (::GRPC::ActiveCall::Operation)
- (::Google::Cloud::Error) — if the RPC is aborted.
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::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::DatabasesListResponseLists databases in the specified Cloud SQL instance.
def list(request, options = nil) -> ::Google::Cloud::Sql::V1::DatabasesListResponselist via a request object, either of type
Google::Cloud::Sql::V1::SqlDatabasesListRequest or an equivalent Hash.
- 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::DatabasesListResponselist 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).
- instance (::String) — Cloud SQL instance ID. This does not include the project ID.
- project (::String) — Project ID of the project that contains the instance.
- (response, operation) — Access the result along with the RPC operation
- response (::Google::Cloud::Sql::V1::DatabasesListResponse)
- operation (::GRPC::ActiveCall::Operation)
- (::Google::Cloud::Error) — if the RPC is aborted.
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::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::ClientGet the associated client for mix-in of the Locations.
- (Google::Cloud::Location::Locations::Client)
#logger
def logger() -> LoggerThe logger used for request/response debug logging.
- (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::OperationPartially updates a resource containing information about a database inside a Cloud SQL instance. This method supports patch semantics.
def patch(request, options = nil) -> ::Google::Cloud::Sql::V1::Operationpatch via a request object, either of type
Google::Cloud::Sql::V1::SqlDatabasesUpdateRequest or an equivalent Hash.
- 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::Operationpatch 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).
- 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)
- (response, operation) — Access the result along with the RPC operation
- response (::Google::Cloud::Sql::V1::Operation)
- operation (::GRPC::ActiveCall::Operation)
- (::Google::Cloud::Error) — if the RPC is aborted.
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::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() -> StringThe effective universe domain
- (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::OperationUpdates a resource containing information about a database inside a Cloud SQL instance.
def update(request, options = nil) -> ::Google::Cloud::Sql::V1::Operationupdate via a request object, either of type
Google::Cloud::Sql::V1::SqlDatabasesUpdateRequest or an equivalent Hash.
- 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::Operationupdate 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).
- 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)
- (response, operation) — Access the result along with the RPC operation
- response (::Google::Cloud::Sql::V1::Operation)
- operation (::GRPC::ActiveCall::Operation)
- (::Google::Cloud::Error) — if the RPC is aborted.
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::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