Reference documentation and code samples for the Cloud SQL Admin V1BETA4 API class Google::Cloud::Sql::V1beta4::SqlDataService::Client.
Client for the SqlDataService service.
Service for streaming data to and from Cloud SQL instances.
Inherits
- Object
Methods
.configure
def self.configure() { |config| ... } -> Client::ConfigurationConfigure the SqlDataService Client class.
See Configuration for a description of the configuration fields.
- (config) — Configure the Client client.
- config (Client::Configuration)
# Modify the configuration for all SqlDataService clients ::Google::Cloud::Sql::V1beta4::SqlDataService::Client.configure do |config| config.timeout = 10.0 end
#configure
def configure() { |config| ... } -> Client::ConfigurationConfigure the SqlDataService 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)
#initialize
def initialize() { |config| ... } -> ClientCreate a new SqlDataService client object.
- (config) — Configure the SqlDataService client.
- config (Client::Configuration)
- (Client) — a new instance of Client
# Create a client using the default configuration client = ::Google::Cloud::Sql::V1beta4::SqlDataService::Client.new # Create a client using a custom configuration client = ::Google::Cloud::Sql::V1beta4::SqlDataService::Client.new do |config| config.timeout = 10.0 end
#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)
#stream_sql_data
def stream_sql_data(request, options = nil) { |response, operation| ... } -> ::Enumerable<::Google::Cloud::Sql::V1beta4::StreamSqlDataResponse>StreamSqlData establishes a bidirectional stream to a Cloud SQL instance,
and then streams data to and from the instance.
The first message from the client MUST be a StreamSqlDataRequest request
with configuration settings, including required values for the
connection_settings field. Subsequent messages from the client may
contain the payload field.
Messages from the server may contain the payload field.
The payload fields of the request and response streams contain the raw
data of the database's native wire protocol (e.g., PostgreSQL wire
protocol). The database client is responsible for generating and parsing
this data.
Any errors on initial connection (e.g., connection failure, authorization issues, network problems) will result in the stream being terminated with an appropriate RPC status exception.
After a successful connection is made, if an error occurs, then the server terminates connection and returns the appropriate RPC status exception.
Add the request params headers to the request to ensure that the streaming request is routed to the correct service for your database.
Use this format for the request params header:
x-goog-request-params:
location_id={location_path}&instance_id={instance_path}`
location_path is locations/{location_name}
instance_path is projects/{project_name}/instances/{instance_name}
for example:
x-goog-request-params:
location_id=locations/us-central1&instance_id=projects/myproject/instances/instancename
- request (::Gapic::StreamInput, ::Enumerable<::Google::Cloud::Sql::V1beta4::StreamSqlDataRequest, ::Hash>) — An enumerable of Google::Cloud::Sql::V1beta4::StreamSqlDataRequest instances.
- options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
- (response, operation) — Access the result along with the RPC operation
- response (::Enumerable<::Google::Cloud::Sql::V1beta4::StreamSqlDataResponse>)
- operation (::GRPC::ActiveCall::Operation)
- (::Enumerable<::Google::Cloud::Sql::V1beta4::StreamSqlDataResponse>)
- (::Google::Cloud::Error) — if the RPC is aborted.
Basic example
require "google/cloud/sql/v1beta4" # Create a client object. The client can be reused for multiple calls. client = Google::Cloud::Sql::V1beta4::SqlDataService::Client.new # Create an input stream. input = Gapic::StreamInput.new # Call the stream_sql_data method to start streaming. output = client.stream_sql_data input # Send requests on the stream. For each request object, set fields by # passing keyword arguments. Be sure to close the stream when done. input << Google::Cloud::Sql::V1beta4::StreamSqlDataRequest.new input << Google::Cloud::Sql::V1beta4::StreamSqlDataRequest.new input.close # The returned object is a streamed enumerable yielding elements of type # ::Google::Cloud::Sql::V1beta4::StreamSqlDataResponse output.each do |current_response| p current_response end
#universe_domain
def universe_domain() -> StringThe effective universe domain
- (String)