class Fog::Google::SQL::Real
Creates a Cloud SQL
instance as a clone of the source instance
@see cloud.google.com/sql/docs/mysql/admin-api/v1beta4/instances/clone
Deletes the backup taken by a backup run.
@see cloud.google.com/sql/docs/mysql/admin-api/v1beta4/backupRuns/delete
Deletes a Cloud SQL
instance
@see cloud.google.com/sql/docs/mysql/admin-api/v1beta4/instances/delete
Deletes a SSL certificate. The change will not take effect until the instance is restarted.
@see cloud.google.com/sql/docs/mysql/admin-api/v1beta4/sslCerts/delete
Deletes a user from a Cloud SQL
instance.
@see cloud.google.com/sql/docs/mysql/admin-api/v1beta4/users/delete
Exports data from a Cloud SQL
instance to a Google
Cloud Storage
bucket as a MySQL dump or CSV file.
@see cloud.google.com/sql/docs/mysql/admin-api/v1beta4/instances/export
Retrieves a resource containing information about a backup run.
@see cloud.google.com/sql/docs/mysql/admin-api/v1beta4/backupRuns/get
Retrieves a resource containing information about a Cloud SQL
instance
@see cloud.google.com/sql/docs/mysql/admin-api/v1beta4/instances/get
Retrieves an instance operation that has been performed on an instance
@see cloud.google.com/sql/docs/mysql/admin-api/v1beta4/operations/get
Retrieves a particular SSL certificate (does not include the private key)
@see cloud.google.com/sql/docs/mysql/admin-api/v1beta4/sslCerts/get
Imports data into a Cloud SQL
instance from a MySQL dump file in Google
Cloud Storage
@see cloud.google.com/sql/docs/mysql/admin-api/v1beta4/instances/import
Creates a new backup run on demand. This method is applicable only to Second Generation instances.
@see cloud.google.com/sql/docs/mysql/admin-api/v1beta4/backupRuns/insert
Creates a new Cloud SQL
instance
@see cloud.google.com/sql/docs/mysql/admin-api/v1beta4/instances/insert
Creates an SSL certificate. The new certificate will not be usable until the instance is restarted.
@see cloud.google.com/sql/docs/mysql/admin-api/v1beta4/sslCerts/insert
Create a new user in a Cloud SQL
instance.
@see cloud.google.com/sql/docs/mysql/admin-api/v1beta4/users/insert
Lists all backup runs associated with a given instance and configuration in the reverse chronological order of the enqueued time
@see cloud.google.com/sql/docs/mysql/admin-api/v1beta4/backupRuns/list
List all available database flags for Google
Cloud SQL
instances
@see developers.google.com/cloud-sql/docs/admin-api/v1beta3/flags/list
Lists instances under a given project in the alphabetical order of the instance name
@see cloud.google.com/sql/docs/mysql/admin-api/v1beta4/instances/list
Lists all instance operations that have been performed on the given Cloud SQL
instance in the reverse chronological order of the start time
@see cloud.google.com/sql/docs/mysql/admin-api/v1beta4/operations/list
Lists all of the current SSL certificates for the instance
@see cloud.google.com/sql/docs/mysql/admin-api/v1beta4/sslCerts/list
Lists all available service tiers for Google
Cloud SQL
@see developers.google.com/cloud-sql/docs/admin-api/v1beta3/tiers/list
Lists users in the specified Cloud SQL
instance.
@see cloud.google.com/sql/docs/mysql/admin-api/v1beta4/users/list
Deletes all client certificates and generates a new server SSL certificate for the instance. The changes will not take effect until the instance is restarted. Existing instances without a server certificate will need to call this once to set a server certificate
@see cloud.google.com/sql/docs/mysql/admin-api/v1beta4/instances/resetSslConfig
Restarts a Cloud SQL
instance
@see cloud.google.com/sql/docs/mysql/admin-api/v1beta4/instances/restart
Restores a backup of a Cloud SQL
instance
@see cloud.google.com/sql/docs/mysql/admin-api/v1beta4/instances/restoreBackup
Updates settings of a Cloud SQL
instance
@see cloud.google.com/sql/docs/mysql/admin-api/v1beta4/instances/update
Updates an existing user in a Cloud SQL
instance.
@see cloud.google.com/sql/docs/mysql/admin-api/v1beta4/users/update
Attributes
Public Class Methods
# File lib/fog/google/sql/real.rb, line 10 def initialize(options) shared_initialize(options[:google_project], GOOGLE_SQL_API_VERSION, GOOGLE_SQL_BASE_URL) options[:google_api_scope_url] = GOOGLE_SQL_API_SCOPE_URLS.join(" ") initialize_google_client(options) @sql = ::Google::Apis::SqladminV1beta4::SQLAdminService.new apply_client_options(@sql, options) end
Public Instance Methods
# File lib/fog/google/requests/sql/clone_instance.rb, line 9 def clone_instance(instance_id, destination_name, log_filename: nil, log_position: nil) context = { :kind => "sql#cloneContext", :destination_instance_name => destination_name } unless log_filename.nil? || log_position.nil? context[:bin_log_coordinates] = ::Google::Apis::SqladminV1beta4::BinLogCoordinates.new( kind: "sql#binLogCoordinates", log_filename: log_filename, log_position: log_position ) end clone_request = ::Google::Apis::SqladminV1beta4::CloneInstancesRequest.new( clone_context: ::Google::Apis::SqladminV1beta4::CloneContext.new(**context) ) @sql.clone_instance(@project, instance_id, clone_request) end
# File lib/fog/google/requests/sql/delete_backup_run.rb, line 9 def delete_backup_run(instance_id, backup_run_id) @sql.delete_backup_run(@project, instance_id, backup_run_id) end
# File lib/fog/google/requests/sql/delete_instance.rb, line 10 def delete_instance(instance_id) @sql.delete_instance(@project, instance_id) end
# File lib/fog/google/requests/sql/delete_ssl_cert.rb, line 10 def delete_ssl_cert(instance_id, sha1_fingerprint) @sql.delete_ssl_cert(@project, instance_id, sha1_fingerprint) end
# File lib/fog/google/requests/sql/delete_user.rb, line 10 def delete_user(instance_id, host, name) @sql.delete_user(@project, instance_id, host: host, name: name) end
# File lib/fog/google/requests/sql/export_instance.rb, line 10 def export_instance(instance_id, uri, databases: [], sql_export_options: {}, csv_export_options: {}, file_type: nil) data = { :kind => "sql#exportContext", :uri => uri, :databases => databases } unless file_type.nil? data[:file_type] = file_type end unless csv_export_options.empty? data[:csv_export_options] = ::Google::Apis::SqladminV1beta4::ExportContext::CsvExportOptions.new(**csv_export_options) end unless sql_export_options.nil? data[:sql_export_options] = ::Google::Apis::SqladminV1beta4::ExportContext::SqlExportOptions.new(**sql_export_options) end export_context = ::Google::Apis::SqladminV1beta4::ExportContext.new(export_context) @sql.export_instance( @project, instance_id, ::Google::Apis::SqladminV1beta4::ExportInstancesRequest.new( export_context: export_context ) ) end
# File lib/fog/google/requests/sql/get_backup_run.rb, line 9 def get_backup_run(instance_id, backup_run_id) @sql.get_backup_run(@project, instance_id, backup_run_id) end
# File lib/fog/google/requests/sql/get_instance.rb, line 10 def get_instance(instance_id) @sql.get_instance(@project, instance_id) end
# File lib/fog/google/requests/sql/get_operation.rb, line 10 def get_operation(operation_id) @sql.get_operation(@project, operation_id) end
# File lib/fog/google/requests/sql/get_ssl_cert.rb, line 10 def get_ssl_cert(instance_id, sha1_fingerprint) @sql.get_ssl_cert(@project, instance_id, sha1_fingerprint) end
# File lib/fog/google/requests/sql/import_instance.rb, line 10 def import_instance(instance_id, uri, database: nil, csv_import_options: nil, file_type: nil, import_user: nil) data = { :kind => "sql#importContext", :uri => uri } data[:database] = database unless database.nil? data[:file_type] = file_type unless file_type.nil? data[:import_user] = import_user unless import_user.nil? unless csv_import_options.nil? data[:csv_import_options] = ::Google::Apis::SqladminV1beta4::ImportContext::CsvImportOptions.new(**csv_import_options) end @sql.import_instance( @project, instance_id, ::Google::Apis::SqladminV1beta4::ImportInstancesRequest.new( import_context: ::Google::Apis::SqladminV1beta4::ImportContext.new(**data) ) ) end
# File lib/fog/google/requests/sql/insert_backup_run.rb, line 10 def insert_backup_run(instance_id, backup_run = {}) @sql.insert_backup_run( @project, instance_id, ::Google::Apis::SqladminV1beta4::BackupRun.new(**backup_run) ) end
# File lib/fog/google/requests/sql/insert_instance.rb, line 10 def insert_instance(name, tier, options = {}) instance = ::Google::Apis::SqladminV1beta4::DatabaseInstance.new(**options) instance.name = name instance.settings = ::Google::Apis::SqladminV1beta4::Settings.new(**instance.settings || {}) instance.settings.tier = tier @sql.insert_instance(@project, instance) end
# File lib/fog/google/requests/sql/insert_ssl_cert.rb, line 10 def insert_ssl_cert(instance_id, common_name) @sql.insert_ssl_cert( @project, instance_id, ::Google::Apis::SqladminV1beta4::InsertSslCertsRequest.new( common_name: common_name ) ) end
# File lib/fog/google/requests/sql/insert_user.rb, line 10 def insert_user(instance_id, user) @sql.insert_user(@project, instance_id, ::Google::Apis::SqladminV1beta4::User.new(**user)) end
# File lib/fog/google/requests/sql/list_backup_runs.rb, line 11 def list_backup_runs(instance_id, max_results: nil, page_token: nil) @sql.list_backup_runs(@project, instance_id, :max_results => max_results, :page_token => page_token) end
# File lib/fog/google/requests/sql/list_flags.rb, line 10 def list_flags(database_version: nil) @sql.list_flags(:database_version => database_version) end
# File lib/fog/google/requests/sql/list_instances.rb, line 10 def list_instances(filter: nil, max_results: nil, page_token: nil) @sql.list_instances(@project, :filter => filter, :max_results => max_results, :page_token => page_token) end
# File lib/fog/google/requests/sql/list_operations.rb, line 11 def list_operations(instance_id, max_results: nil, page_token: nil) @sql.list_operations(@project, instance_id, :max_results => max_results, :page_token => page_token) end
# File lib/fog/google/requests/sql/list_ssl_certs.rb, line 10 def list_ssl_certs(instance_id) @sql.list_ssl_certs(@project, instance_id) end
# File lib/fog/google/requests/sql/list_tiers.rb, line 10 def list_tiers @sql.list_tiers(@project) end
# File lib/fog/google/requests/sql/list_users.rb, line 10 def list_users(instance_id) @sql.list_users(@project, instance_id) end
# File lib/fog/google/requests/sql/reset_instance_ssl_config.rb, line 12 def reset_instance_ssl_config(instance_id) @sql.reset_instance_ssl_config(@project, instance_id) end
# File lib/fog/google/requests/sql/restart_instance.rb, line 10 def restart_instance(instance_id) @sql.restart_instance(@project, instance_id) end
# File lib/fog/google/requests/sql/restore_instance_backup.rb, line 10 def restore_instance_backup(instance_id, backup_run_id) request = ::Google::Apis::SqladminV1beta4::RestoreInstancesBackupRequest.new( restore_backup_context: ::Google::Apis::SqladminV1beta4::RestoreBackupContext.new( backup_run_id: backup_run_id, instance_id: instance_id, kind: "sql#restoreBackupContext" ) ) @sql.restore_instance_backup(@project, instance_id, request) end
# File lib/fog/google/requests/sql/update_instance.rb, line 9 def update_instance(instance_id, settings_version, tier, settings = {}) settings = ::Google::Apis::SqladminV1beta4::Settings.new(**settings) settings.tier = tier settings.settings_version = settings_version @sql.update_instance( @project, instance_id, ::Google::Apis::SqladminV1beta4::DatabaseInstance.new(settings: settings) ) end
# File lib/fog/google/requests/sql/update_user.rb, line 10 def update_user(instance_id, host, name, user) @sql.update_user( @project, instance_id, host, name, ::Google::Apis::SqladminV1beta4::User.new(user) ) end