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

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

Client for the SqlUsersService service.

Cloud SQL users service.

Inherits

  • Object

Methods

.configure

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

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

#configure

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

Configure the SqlUsersService 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(host: nil, instance: nil, name: nil, project: nil) -> ::Google::Cloud::Sql::V1::Operation

Deletes a user 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::SqlUsersDeleteRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Sql::V1::SqlUsersDeleteRequest, ::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(host: nil, instance: nil, name: 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
  • host (::String) — Host of the user in the instance.
  • instance (::String) — Database instance ID. This does not include the project ID.
  • name (::String) — Name of the user in the instance.
  • project (::String) — Project ID of the project that contains the instance.
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::SqlUsersService::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Sql::V1::SqlUsersDeleteRequest.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::User
def get(instance: nil, name: nil, project: nil, host: nil) -> ::Google::Cloud::Sql::V1::User

Retrieves a resource containing information about a user.

Overloads
def get(request, options = nil) -> ::Google::Cloud::Sql::V1::User
Pass arguments to get via a request object, either of type Google::Cloud::Sql::V1::SqlUsersGetRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Sql::V1::SqlUsersGetRequest, ::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(instance: nil, name: nil, project: nil, host: nil) -> ::Google::Cloud::Sql::V1::User
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) — Database instance ID. This does not include the project ID.
  • name (::String) — User of the instance.
  • project (::String) — Project ID of the project that contains the instance.
  • host (::String) — Host of a user of the instance.
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::SqlUsersService::Client.new

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

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

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

#initialize

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

Create a new SqlUsersService client object.

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

# Create a client using a custom configuration
client = ::Google::Cloud::Sql::V1::SqlUsersService::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

Creates a new user in a Cloud SQL instance.

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::SqlUsersInsertRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Sql::V1::SqlUsersInsertRequest, ::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::User, ::Hash)
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::SqlUsersService::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Sql::V1::SqlUsersInsertRequest.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::UsersListResponse
def list(instance: nil, project: nil) -> ::Google::Cloud::Sql::V1::UsersListResponse

Lists users in the specified Cloud SQL instance.

Overloads
def list(request, options = nil) -> ::Google::Cloud::Sql::V1::UsersListResponse
Pass arguments to list via a request object, either of type Google::Cloud::Sql::V1::SqlUsersListRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Sql::V1::SqlUsersListRequest, ::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::UsersListResponse
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) — Database instance ID. This does not include the project ID.
  • project (::String) — Project ID of the project that contains the instance.
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::SqlUsersService::Client.new

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

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

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

#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

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

Updates an existing user in 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::SqlUsersUpdateRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Sql::V1::SqlUsersUpdateRequest, ::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(host: nil, instance: nil, name: nil, project: nil, database_roles: nil, revoke_existing_roles: 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
  • host (::String) — Optional. Host of the user in the instance.
  • instance (::String) — Database instance ID. This does not include the project ID.
  • name (::String) — Name of the user in the instance.
  • project (::String) — Project ID of the project that contains the instance.
  • database_roles (::Array<::String>) — Optional. List of database roles to grant to the user. body.database_roles will be ignored for update request.
  • revoke_existing_roles (::Boolean) — Optional. Specifies whether to revoke existing roles that are not present in the database_roles field. If false or unset, the database roles specified in database_roles are added to the user's existing roles.
  • body (::Google::Cloud::Sql::V1::User, ::Hash)
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::SqlUsersService::Client.new

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

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

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