gcloudex v0.4.3 GCloudex.CloudSQL.Client
Summary
Functions
Clones the given ‘instance’ and gives the new instance the chosen ‘dest_name’ and the given ‘bin_log_file’ and ‘bin_log_pos’
Generates a short-lived X509 certificate containing the provided ‘public_key’ and signed by a private key specific to the target ‘instance’. Users may use the certificate to authenticate as themselves when connecting to the database
Deletes the backup taken by a backup run with ID ‘run_id’ and belonging to the given ‘instance’
Deletes the ‘database’ from the Cloud SQL ‘instance’
Deletes the given ‘instance’ from the project
Deletes the SSL certificate with the given ‘sha1_fingerprint’ from the specified ‘instance’
Deletes a user with the given ‘host’ and ‘name’ from the Cloud SQL ‘instance’
Failover the ‘instance’ to its failover replica instance with the specified ‘settings_version’
Retrieves a resource containing information about a backup run with the ID of ‘run_id’ and belonging to the given ‘instance’
Retrieves a resource containing information about the ‘database’ inside a Cloud SQL ‘instance’
Retrieves a resource containing information about the given Cloud SQL ‘instance’
Retrieves the instance operation with ‘operation_id’ that has been performed on an instance
Retrieves a particular SSL certificate belonging to the given ‘instance’ and with the provided ‘sh1_fingerprint’. Does not include the private key (required for usage). The private key must be saved from the response to initial creation
Creates a new database inside the specified Cloud SQL ‘instance’ with the given ‘name’
Creates a new Cloud SQL instance with the specified ‘name’, ‘settings’, ‘optional_properties’ and with the given ‘tier’ unless already passed through ‘settings’
Creates an SSL certificate for the given ‘instance’ and gives it the name specified in ‘common_name’ and returns it along with the private key and server certificate authority
Creates a new user in a Cloud SQL ‘instance’ with the given ‘name and ‘password’. The authorized host to connect can be set through ‘host’ (defaults to ‘% (any host)’)
Lists all backup runs associated with a given ‘instance’ and configuration in the reverse chronological order of the backup initiation time
Lists databases in the specified Cloud SQL ‘instance’
List all available database flags for Google the Cloud SQL ‘instance’
List instances from the project
Lists all instance operations that have been performed on the given Cloud SQL ‘instance’ in the reverse chronological order of the start time
Lists all of the current SSL certificates for the ‘instance’
Lists all available service tiers for Google Cloud SQL, for example D1, D2
Lists users in the specified Cloud SQL ‘instance’
Updates a resource containing information about a ‘database’ inside a Cloud SQL ‘instance’ using patch semantics. The ‘db_resource’ must follow the description of Database Resources in: https://cloud.google.com/sql/docs/admin-api/v1beta4/databases#resource
Promotes the read replica ‘instance’ to be a stand-alone Cloud SQL instance
Sends a HTTP request with the given ‘verb’, ‘headers’ and ‘body’ to the specified ‘endpoint’. The authorization and google project headers are added automatically
Sends a HTTP request with the given ‘verb’, ‘headers’, ‘body’ and query ‘parameters’ to the specified ‘endpoint’. The authorization and google project headers are added automatically
Deletes all client certificates and generates a new server SSL certificate for the ‘instance’
Restarts the given ‘instance’
Starts the replication in the read replica ‘instance’
Stops the replication in the read replica ‘instance’
Updates a resource containing information about a ‘database’ inside a Cloud SQL ‘instance’. The ‘update_map’ must be a Map
Updates an existing user in a Cloud SQL ‘instance’ with the given ‘host’, ‘name’ and ‘password’
Functions
Specs
clone_instance(instance :: binary, dest_name :: binary, bin_log_file :: binary, bin_log_pos :: binary) :: HTTPResponse.t
Clones the given ‘instance’ and gives the new instance the chosen ‘dest_name’ and the given ‘bin_log_file’ and ‘bin_log_pos’.
Specs
create_ephemeral_ssl_cert(instance :: binary, public_key :: binary) :: HTTPResponse.t
Generates a short-lived X509 certificate containing the provided ‘public_key’ and signed by a private key specific to the target ‘instance’. Users may use the certificate to authenticate as themselves when connecting to the database.
Specs
delete_backup_run(instance :: binary, run_id :: binary | number) :: HTTPResponse.t
Deletes the backup taken by a backup run with ID ‘run_id’ and belonging to the given ‘instance’.
Specs
delete_database(instance :: binary, database :: binary) :: HTTPResponse.t
Deletes the ‘database’ from the Cloud SQL ‘instance’.
Specs
delete_instance(instance :: binary) :: HTTPResponse.t
Deletes the given ‘instance’ from the project.
Specs
delete_ssl_cert(instance :: binary, sha1_fingerprint :: binary) :: HTTPResponse.t
Deletes the SSL certificate with the given ‘sha1_fingerprint’ from the specified ‘instance’.
Specs
delete_user(instance :: binary, host :: binary, name :: binary) :: HTTPResponse.t
Deletes a user with the given ‘host’ and ‘name’ from the Cloud SQL ‘instance’.
Specs
failover_instance(instance :: binary, settings_version :: number) :: HTTPResponse.t
Failover the ‘instance’ to its failover replica instance with the specified ‘settings_version’.
Specs
get_backup_run(instance :: binary, run_id :: binary | number) :: HTTPResponse.t
Retrieves a resource containing information about a backup run with the ID of ‘run_id’ and belonging to the given ‘instance’.
Specs
get_database(instance :: binary, database :: binary) :: HTTPResponse.t
Retrieves a resource containing information about the ‘database’ inside a Cloud SQL ‘instance’.
Specs
get_instance(instance :: binary) :: HTTPResponse.t
Retrieves a resource containing information about the given Cloud SQL ‘instance’.
Specs
get_operation(operation_id :: binary) :: HTTPResponse.t
Retrieves the instance operation with ‘operation_id’ that has been performed on an instance.
Specs
get_ssl_cert(instance :: binary, sh1_fingerprint :: binary) :: HTTPResponse.t
Retrieves a particular SSL certificate belonging to the given ‘instance’ and with the provided ‘sh1_fingerprint’. Does not include the private key (required for usage). The private key must be saved from the response to initial creation.
Specs
insert_database(instance :: binary, name :: binary) :: HTTPResponse.t
Creates a new database inside the specified Cloud SQL ‘instance’ with the given ‘name’.
Specs
insert_instance(name :: binary, optional_properties :: map, settings :: map, tier :: binary) :: HTTPResponse.t
Creates a new Cloud SQL instance with the specified ‘name’, ‘settings’, ‘optional_properties’ and with the given ‘tier’ unless already passed through ‘settings’.
The ‘settings’ parameter is meant to have the settings JSON nested object while ‘optional_properties’ is meant to have other non-required request fields like the ‘replicaConfiguration’ JSON nested object field. The ‘settings’ map will be nested into ‘optional_properties’ to match the API’s request structure like in the following example:
optional_properties = %{
name: 'name',
region: someRegion,
settings: %{
tier: 'tier',
other_key_1: someValue,
other_key_2: someValue
},
optional_prop_1: someValue,
optional_prop_2: someValue
}
TODO: Re-evaluate how the optional fields should be passed.
Specs
insert_ssl_cert(instance :: binary, common_name :: binary) :: HTTPResponse.t
Creates an SSL certificate for the given ‘instance’ and gives it the name specified in ‘common_name’ and returns it along with the private key and server certificate authority.
For First Generation instances, the new certificate does not take effect until the instance is restarted.
Specs
insert_user(instance :: binary, name :: binary, password :: binary, host :: binary) :: HTTPResponse.t
Creates a new user in a Cloud SQL ‘instance’ with the given ‘name and ‘password’. The authorized host to connect can be set through ‘host’ (defaults to ‘% (any host)’).
Specs
list_backup_runs(instance :: binary) :: HTTPResponse.t
Lists all backup runs associated with a given ‘instance’ and configuration in the reverse chronological order of the backup initiation time.
Specs
list_databases(instance :: binary) :: HTTPResponse.t
Lists databases in the specified Cloud SQL ‘instance’.
Specs
list_flags :: HTTPResponse.t
List all available database flags for Google the Cloud SQL ‘instance’.
Specs
list_operations(instance :: binary) :: HTTPResponse.t
Lists all instance operations that have been performed on the given Cloud SQL ‘instance’ in the reverse chronological order of the start time.
Specs
list_ssl_certs(instance :: binary) :: HTTPResponse.t
Lists all of the current SSL certificates for the ‘instance’.
Specs
list_tiers :: HTTPResponse.t
Lists all available service tiers for Google Cloud SQL, for example D1, D2.
Specs
list_users(instance :: binary) :: HTTPResponse.t
Lists users in the specified Cloud SQL ‘instance’.
Specs
patch_database(instance :: binary, database :: binary, db_resource :: Map.t) :: HTTPResponse.t
Updates a resource containing information about a ‘database’ inside a Cloud SQL ‘instance’ using patch semantics. The ‘db_resource’ must follow the description of Database Resources in: https://cloud.google.com/sql/docs/admin-api/v1beta4/databases#resource
Specs
promote_replica(instance :: binary) :: HTTPResponse.t
Promotes the read replica ‘instance’ to be a stand-alone Cloud SQL instance.
Specs
request(verb :: atom, endpoint :: binary, headers :: [{key :: binary, value :: binary}], body :: binary) :: HTTPoison.HTTPResponse.t
Sends a HTTP request with the given ‘verb’, ‘headers’ and ‘body’ to the specified ‘endpoint’. The authorization and google project headers are added automatically.
Specs
request_query(verb :: atom, endpoint :: binary, headers :: [{key :: binary, value :: binary}], body :: binary, parameters :: binary) :: HTTPoison.HTTPResponse.t
Sends a HTTP request with the given ‘verb’, ‘headers’, ‘body’ and query ‘parameters’ to the specified ‘endpoint’. The authorization and google project headers are added automatically.
Specs
reset_ssl_config(instance :: binary) :: HTTPResponse.t
Deletes all client certificates and generates a new server SSL certificate for the ‘instance’.
For First Generation instances, the changes do not take effect until the instance is restarted. For Second Generation instances, the changes are immediate; all existing connections to the instance are broken.
Specs
restart_instance(instance :: binary) :: HTTPResponse.t
Restarts the given ‘instance’.
Specs
start_replica(instance :: binary) :: HTTPResponse.t
Starts the replication in the read replica ‘instance’.
Specs
stop_replica(instance :: binary) :: HTTPResponse.t
Stops the replication in the read replica ‘instance’.
Specs
update_database(instance :: binary, database :: binary, db_resource :: Map.t) :: HTTPResponse.t
Updates a resource containing information about a ‘database’ inside a Cloud SQL ‘instance’. The ‘update_map’ must be a Map.