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::ConfigurationConfigure the SqlUsersService Client class.
See Configuration for a description of the configuration fields.
- (config) — Configure the Client client.
- config (Client::Configuration)
# 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::ConfigurationConfigure 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.
- (config) — Configure the Client client.
- config (Client::Configuration)
#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::OperationDeletes a user 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::SqlUsersDeleteRequest or an equivalent Hash.
- 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::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).
- 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.
- (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::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::UserRetrieves a resource containing information about a user.
def get(request, options = nil) -> ::Google::Cloud::Sql::V1::Userget via a request object, either of type
Google::Cloud::Sql::V1::SqlUsersGetRequest or an equivalent Hash.
- 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::Userget 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.
- 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.
- (response, operation) — Access the result along with the RPC operation
- response (::Google::Cloud::Sql::V1::User)
- 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::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| ... } -> ClientCreate a new SqlUsersService client object.
- (config) — Configure the SqlUsersService client.
- config (Client::Configuration)
- (Client) — a new instance of Client
# 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::OperationCreates a new user in a Cloud SQL instance.
def insert(request, options = nil) -> ::Google::Cloud::Sql::V1::Operationinsert via a request object, either of type
Google::Cloud::Sql::V1::SqlUsersInsertRequest or an equivalent Hash.
- 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::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::User, ::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::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::UsersListResponseLists users in the specified Cloud SQL instance.
def list(request, options = nil) -> ::Google::Cloud::Sql::V1::UsersListResponselist via a request object, either of type
Google::Cloud::Sql::V1::SqlUsersListRequest or an equivalent Hash.
- 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::UsersListResponselist 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.
- (response, operation) — Access the result along with the RPC operation
- response (::Google::Cloud::Sql::V1::UsersListResponse)
- 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::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::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)
#universe_domain
def universe_domain() -> StringThe effective universe domain
- (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::OperationUpdates an existing user in 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::SqlUsersUpdateRequest or an equivalent Hash.
- 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::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).
- 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_rolesfield. Iffalseor unset, the database roles specified indatabase_rolesare added to the user's existing roles. - body (::Google::Cloud::Sql::V1::User, ::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::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