Class: Fog::Google::SQL::Real
- Inherits:
-
Object
- Object
- Fog::Google::SQL::Real
show all
- Includes:
- Fog::Google::Shared
- Defined in:
- lib/fog/google/requests/sql/list_flags.rb,
lib/fog/google/sql.rb,
lib/fog/google/requests/sql/list_tiers.rb,
lib/fog/google/requests/sql/get_instance.rb,
lib/fog/google/requests/sql/get_ssl_cert.rb,
lib/fog/google/requests/sql/get_operation.rb,
lib/fog/google/requests/sql/clone_instance.rb,
lib/fog/google/requests/sql/get_backup_run.rb,
lib/fog/google/requests/sql/list_instances.rb,
lib/fog/google/requests/sql/list_ssl_certs.rb,
lib/fog/google/requests/sql/delete_instance.rb,
lib/fog/google/requests/sql/delete_ssl_cert.rb,
lib/fog/google/requests/sql/export_instance.rb,
lib/fog/google/requests/sql/import_instance.rb,
lib/fog/google/requests/sql/insert_instance.rb,
lib/fog/google/requests/sql/insert_ssl_cert.rb,
lib/fog/google/requests/sql/list_operations.rb,
lib/fog/google/requests/sql/update_instance.rb,
lib/fog/google/requests/sql/list_backup_runs.rb,
lib/fog/google/requests/sql/restart_instance.rb,
lib/fog/google/requests/sql/restore_instance_backup.rb,
lib/fog/google/requests/sql/reset_instance_ssl_config.rb,
lib/fog/google/requests/sql/set_instance_root_password.rb
Overview
Sets the password for the root user
Instance Attribute Summary collapse
#api_url, #api_version, #project
Instance Method Summary
collapse
-
#clone_instance(instance_id, destination_name, options = {}) ⇒ Object
-
#delete_instance(instance_id) ⇒ Object
-
#delete_ssl_cert(instance_id, sha1_fingerprint) ⇒ Object
-
#export_instance(instance_id, uri, options = {}) ⇒ Object
-
#get_backup_run(instance_id, backup_configuration_id, due_time) ⇒ Object
-
#get_instance(instance_id) ⇒ Object
-
#get_operation(instance_id, operation_id) ⇒ Object
-
#get_ssl_cert(instance_id, sha1_fingerprint) ⇒ Object
-
#import_instance(instance_id, uri, options = {}) ⇒ Object
-
#initialize(options) ⇒ Real
constructor
-
#insert_instance(name, tier, options = {}) ⇒ Object
-
#insert_ssl_cert(instance_id, common_name) ⇒ Object
-
#list_backup_runs(instance_id, backup_configuration_id) ⇒ Object
-
#list_flags ⇒ Object
-
#list_instances ⇒ Object
-
#list_operations(instance_id) ⇒ Object
-
#list_ssl_certs(instance_id) ⇒ Object
-
#list_tiers ⇒ Object
-
#reset_instance_ssl_config(instance_id) ⇒ Object
-
#restart_instance(instance_id) ⇒ Object
-
#restore_instance_backup(identity, backup_configuration, due_time) ⇒ Object
-
#set_instance_root_password(instance_id, password) ⇒ Object
-
#update_instance(instance_id, settings_version, tier, options = {}) ⇒ Object
#build_excon_response, #initialize_google_client, #new_pk12_google_client, #request, #shared_initialize
Constructor Details
#initialize(options) ⇒ Real
Returns a new instance of Real.
122
123
124
125
126
127
128
|
# File 'lib/fog/google/sql.rb', line 122
def initialize(options)
shared_initialize(options[:google_project], GOOGLE_SQL_API_VERSION, GOOGLE_SQL_BASE_URL)
options.merge!(:google_api_scope_url => GOOGLE_SQL_API_SCOPE_URLS.join(' '))
@client = initialize_google_client(options)
@sql = @client.discovered_api('sqladmin', api_version)
end
|
Instance Attribute Details
#client ⇒ Object
Returns the value of attribute client.
119
120
121
|
# File 'lib/fog/google/sql.rb', line 119
def client
@client
end
|
#sql ⇒ Object
Returns the value of attribute sql.
120
121
122
|
# File 'lib/fog/google/sql.rb', line 120
def sql
@sql
end
|
Instance Method Details
#clone_instance(instance_id, destination_name, options = {}) ⇒ Object
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
# File 'lib/fog/google/requests/sql/clone_instance.rb', line 10
def clone_instance(instance_id, destination_name, options = {})
api_method = @sql.instances.discovered_methods.find { |x| x.id == 'sql.instances.clone' }
parameters = {
'project' => @project,
}
body = {
'cloneContext' => {
'kind' => 'sql#cloneContext',
'sourceInstanceName' => instance_id,
'destinationInstanceName' => destination_name,
}
}
if options[:log_position]
body['cloneContext']['binLogCoordinates'] = {
'kind' => 'sql#binLogCoordinates',
'binLogFileName' => options[:log_filename],
'binLogPosition' => options[:log_position],
}
end
request(api_method, parameters, body)
end
|
#delete_instance(instance_id) ⇒ Object
10
11
12
13
14
15
16
17
18
|
# File 'lib/fog/google/requests/sql/delete_instance.rb', line 10
def delete_instance(instance_id)
api_method = @sql.instances.delete
parameters = {
'project' => @project,
'instance' => instance_id,
}
request(api_method, parameters)
end
|
#delete_ssl_cert(instance_id, sha1_fingerprint) ⇒ Object
10
11
12
13
14
15
16
17
18
19
|
# File 'lib/fog/google/requests/sql/delete_ssl_cert.rb', line 10
def delete_ssl_cert(instance_id, sha1_fingerprint)
api_method = @sql.ssl_certs.delete
parameters = {
'project' => @project,
'instance' => instance_id,
'sha1Fingerprint' => sha1_fingerprint,
}
request(api_method, parameters)
end
|
#export_instance(instance_id, uri, options = {}) ⇒ Object
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
# File 'lib/fog/google/requests/sql/export_instance.rb', line 10
def export_instance(instance_id, uri, options = {})
api_method = @sql.instances.export
parameters = {
'project' => @project,
'instance' => instance_id,
}
body = {
'exportContext' => {
'kind' => 'sql#exportContext',
'uri' => uri,
'database' => Array(options[:databases]),
'table' => Array(options[:tables]),
}
}
request(api_method, parameters, body)
end
|
#get_backup_run(instance_id, backup_configuration_id, due_time) ⇒ Object
10
11
12
13
14
15
16
17
18
19
20
|
# File 'lib/fog/google/requests/sql/get_backup_run.rb', line 10
def get_backup_run(instance_id, backup_configuration_id, due_time)
api_method = @sql.backup_runs.get
parameters = {
'project' => @project,
'instance' => instance_id,
'backupConfiguration' => backup_configuration_id,
'dueTime' => due_time,
}
request(api_method, parameters)
end
|
#get_instance(instance_id) ⇒ Object
10
11
12
13
14
15
16
17
18
|
# File 'lib/fog/google/requests/sql/get_instance.rb', line 10
def get_instance(instance_id)
api_method = @sql.instances.get
parameters = {
'project' => @project,
'instance' => instance_id,
}
request(api_method, parameters)
end
|
#get_operation(instance_id, operation_id) ⇒ Object
10
11
12
13
14
15
16
17
18
19
|
# File 'lib/fog/google/requests/sql/get_operation.rb', line 10
def get_operation(instance_id, operation_id)
api_method = @sql.operations.get
parameters = {
'project' => @project,
'instance' => instance_id,
'operation' => operation_id,
}
request(api_method, parameters)
end
|
#get_ssl_cert(instance_id, sha1_fingerprint) ⇒ Object
10
11
12
13
14
15
16
17
18
19
|
# File 'lib/fog/google/requests/sql/get_ssl_cert.rb', line 10
def get_ssl_cert(instance_id, sha1_fingerprint)
api_method = @sql.ssl_certs.get
parameters = {
'project' => @project,
'instance' => instance_id,
'sha1Fingerprint' => sha1_fingerprint,
}
request(api_method, parameters)
end
|
#import_instance(instance_id, uri, options = {}) ⇒ Object
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
# File 'lib/fog/google/requests/sql/import_instance.rb', line 10
def import_instance(instance_id, uri, options = {})
api_method = @sql.instances.import
parameters = {
'project' => @project,
'instance' => instance_id,
}
body = {
'importContext' => {
'kind' => 'sql#importContext',
'uri' => Array(uri),
'database' => options[:database],
}
}
request(api_method, parameters, body)
end
|
#insert_instance(name, tier, options = {}) ⇒ Object
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
# File 'lib/fog/google/requests/sql/insert_instance.rb', line 10
def insert_instance(name, tier, options = {})
api_method = @sql.instances.insert
parameters = {
'project' => @project,
}
body = {
'project' => @project,
'instance' => name,
'settings' => {
'tier' => tier,
}
}
if options[:region]
body['region'] = options[:region]
end
if options[:activation_policy]
body['settings']['activationPolicy'] = options[:activation_policy]
end
if options[:autorized_gae_applications]
body['settings']['authorizedGaeApplications'] = Array(options[:autorized_gae_applications])
end
if options[:backup_configuration]
body['settings']['backupConfiguration'] = options[:backup_configuration]
end
if options[:ip_configuration_authorized_networks]
body['settings']['ipConfiguration'] ||= {}
body['settings']['ipConfiguration']['authorizedNetworks'] = Array(options[:ip_configuration_authorized_networks])
end
if options[:ip_configuration_enabled]
body['settings']['ipConfiguration'] ||= {}
body['settings']['ipConfiguration']['enabled'] = options[:ip_configuration_enabled]
end
if options[:ip_configuration_require_ssl]
body['settings']['ipConfiguration'] ||= {}
body['settings']['ipConfiguration']['requireSsl'] = options[:ip_configuration_require_ssl]
end
if options[:location_preference_zone_follow_gae_application]
body['settings']['locationPreference'] ||= {}
body['settings']['locationPreference']['followGaeApplication'] = options[:location_preference_zone_follow_gae_application]
end
if options[:location_preference_zone]
body['settings']['locationPreference'] ||= {}
body['settings']['locationPreference']['zone'] = options[:location_preference_zone]
end
if options[:pricing_plan]
body['settings']['pricingPlan'] = options[:pricing_plan]
end
if options[:replication_type]
body['settings']['replicationType'] = options[:replication_type]
end
request(api_method, parameters, body)
end
|
#insert_ssl_cert(instance_id, common_name) ⇒ Object
10
11
12
13
14
15
16
17
18
19
20
21
22
|
# File 'lib/fog/google/requests/sql/insert_ssl_cert.rb', line 10
def insert_ssl_cert(instance_id, common_name)
api_method = @sql.ssl_certs.insert
parameters = {
'project' => @project,
'instance' => instance_id,
}
body = {
'commonName' => common_name
}
request(api_method, parameters, body)
end
|
#list_backup_runs(instance_id, backup_configuration_id) ⇒ Object
11
12
13
14
15
16
17
18
19
20
|
# File 'lib/fog/google/requests/sql/list_backup_runs.rb', line 11
def list_backup_runs(instance_id, backup_configuration_id)
api_method = @sql.backup_runs.list
parameters = {
'project' => @project,
'instance' => instance_id,
'backupConfiguration' => backup_configuration_id,
}
request(api_method, parameters)
end
|
#list_flags ⇒ Object
10
11
12
13
14
15
|
# File 'lib/fog/google/requests/sql/list_flags.rb', line 10
def list_flags
api_method = @sql.flags.list
parameters = {}
request(api_method, parameters)
end
|
#list_instances ⇒ Object
10
11
12
13
14
15
16
17
|
# File 'lib/fog/google/requests/sql/list_instances.rb', line 10
def list_instances
api_method = @sql.instances.list
parameters = {
'project' => @project,
}
request(api_method, parameters)
end
|
#list_operations(instance_id) ⇒ Object
11
12
13
14
15
16
17
18
19
|
# File 'lib/fog/google/requests/sql/list_operations.rb', line 11
def list_operations(instance_id)
api_method = @sql.operations.list
parameters = {
'project' => @project,
'instance' => instance_id,
}
request(api_method, parameters)
end
|
#list_ssl_certs(instance_id) ⇒ Object
10
11
12
13
14
15
16
17
18
|
# File 'lib/fog/google/requests/sql/list_ssl_certs.rb', line 10
def list_ssl_certs(instance_id)
api_method = @sql.ssl_certs.list
parameters = {
'project' => @project,
'instance' => instance_id,
}
request(api_method, parameters)
end
|
#list_tiers ⇒ Object
10
11
12
13
14
15
16
17
|
# File 'lib/fog/google/requests/sql/list_tiers.rb', line 10
def list_tiers
api_method = @sql.tiers.list
parameters = {
'project' => @project,
}
request(api_method, parameters)
end
|
#reset_instance_ssl_config(instance_id) ⇒ Object
12
13
14
15
16
17
18
19
20
|
# File 'lib/fog/google/requests/sql/reset_instance_ssl_config.rb', line 12
def reset_instance_ssl_config(instance_id)
api_method = @sql.instances.reset_ssl_config
parameters = {
'project' => @project,
'instance' => instance_id,
}
request(api_method, parameters)
end
|
#restart_instance(instance_id) ⇒ Object
10
11
12
13
14
15
16
17
18
|
# File 'lib/fog/google/requests/sql/restart_instance.rb', line 10
def restart_instance(instance_id)
api_method = @sql.instances.restart
parameters = {
'project' => @project,
'instance' => instance_id,
}
request(api_method, parameters)
end
|
#restore_instance_backup(identity, backup_configuration, due_time) ⇒ Object
10
11
12
13
14
15
16
17
18
19
20
|
# File 'lib/fog/google/requests/sql/restore_instance_backup.rb', line 10
def restore_instance_backup(identity, backup_configuration, due_time)
api_method = @sql.instances.reset_ssl_config
parameters = {
'project' => @project,
'instance' => identity,
'backupConfiguration' => backup_configuration,
'dueTime' => due_time,
}
request(api_method, parameters)
end
|
#set_instance_root_password(instance_id, password) ⇒ Object
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
# File 'lib/fog/google/requests/sql/set_instance_root_password.rb', line 10
def set_instance_root_password(instance_id, password)
api_method = @sql.instances.set_root_password
parameters = {
'project' => @project,
'instance' => instance_id,
}
body = {
'setRootPasswordContext' => {
'kind' => 'sql#setRootUserContext',
'password' => password,
}
}
request(api_method, parameters, body)
end
|
#update_instance(instance_id, settings_version, tier, options = {}) ⇒ Object
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
|
# File 'lib/fog/google/requests/sql/update_instance.rb', line 10
def update_instance(instance_id, settings_version, tier, options = {})
api_method = @sql.instances.update
parameters = {
'project' => @project,
'instance' => instance_id,
}
body = {
'project' => @project,
'instance' => instance_id,
'settings' => {
'settingsVersion' => settings_version,
'tier' => tier,
}
}
if options[:activation_policy]
body['settings']['activationPolicy'] = options[:activation_policy]
end
if options[:autorized_gae_applications]
body['settings']['authorizedGaeApplications'] = Array(options[:autorized_gae_applications])
end
if options[:backup_configuration]
body['settings']['backupConfiguration'] = options[:backup_configuration]
end
if options[:ip_configuration_authorized_networks]
body['settings']['ipConfiguration'] ||= {}
body['settings']['ipConfiguration']['authorizedNetworks'] = Array(options[:ip_configuration_authorized_networks])
end
if options[:ip_configuration_enabled]
body['settings']['ipConfiguration'] ||= {}
body['settings']['ipConfiguration']['enabled'] = options[:ip_configuration_enabled]
end
if options[:ip_configuration_require_ssl]
body['settings']['ipConfiguration'] ||= {}
body['settings']['ipConfiguration']['requireSsl'] = options[:ip_configuration_require_ssl]
end
if options[:location_preference_zone_follow_gae_application]
body['settings']['locationPreference'] ||= {}
body['settings']['locationPreference']['followGaeApplication'] = options[:location_preference_zone_follow_gae_application]
end
if options[:location_preference_zone]
body['settings']['locationPreference'] ||= {}
body['settings']['locationPreference']['zone'] = options[:location_preference_zone]
end
if options[:pricing_plan]
body['settings']['pricingPlan'] = options[:pricing_plan]
end
if options[:replication_type]
body['settings']['replicationType'] = options[:replication_type]
end
request(api_method, parameters, body)
end
|