Class: Fog::AWS::RDS::Server
- Inherits:
-
Model
- Object
- Model
- Fog::AWS::RDS::Server
show all
- Defined in:
- lib/fog/aws/models/rds/server.rb
Instance Attribute Summary collapse
Attributes inherited from Model
#collection, #connection
Instance Method Summary
collapse
Methods inherited from Model
#initialize, #inspect, #reload, #symbolize_keys, #to_json, #wait_for
#_load, #aliases, #attribute, #attributes, #identity, #ignore_attributes, #ignored_attributes
#_dump, #attributes, #dup, #identity, #identity=, #merge_attributes, #new_record?, #requires, #requires_one
Constructor Details
This class inherits a constructor from Fog::Model
Instance Attribute Details
#parameter_group_name ⇒ Object
Returns the value of attribute parameter_group_name.
34
35
36
|
# File 'lib/fog/aws/models/rds/server.rb', line 34
def parameter_group_name
@parameter_group_name
end
|
#password ⇒ Object
Returns the value of attribute password.
34
35
36
|
# File 'lib/fog/aws/models/rds/server.rb', line 34
def password
@password
end
|
#port ⇒ Object
Returns the value of attribute port.
34
35
36
|
# File 'lib/fog/aws/models/rds/server.rb', line 34
def port
@port
end
|
#security_group_names ⇒ Object
Returns the value of attribute security_group_names.
34
35
36
|
# File 'lib/fog/aws/models/rds/server.rb', line 34
def security_group_names
@security_group_names
end
|
Instance Method Details
69
70
71
72
73
|
# File 'lib/fog/aws/models/rds/server.rb', line 69
def add_tags(new_tags)
requires :id
connection.add_tags_to_resource(id, new_tags)
tags
end
|
#attributes_to_params ⇒ Object
Converts attributes to a parameter hash suitable for requests
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
|
# File 'lib/fog/aws/models/rds/server.rb', line 103
def attributes_to_params
options = {
'AllocatedStorage' => allocated_storage,
'AutoMinorVersionUpgrade' => auto_minor_version_upgrade,
'BackupRetentionPeriod' => backup_retention_period,
'DBName' => db_name,
'DBParameterGroupName' => parameter_group_name || attributes['DBParameterGroupName'],
'DBSecurityGroups' => security_group_names,
'DBInstanceIdentifier' => id,
'AvailabilityZone' => availability_zone,
'DBInstanceClass' => flavor_id,
'Port' => port || attributes['Port'],
'Engine' => engine,
'EngineVersion' => engine_version,
'MasterUsername' => master_username,
'MasterUserPassword' => password || attributes['MasterUserPassword'],
'PreferredMaintenanceWindow' => preferred_maintenance_window,
'PreferredBackupWindow' => preferred_backup_window,
'MultiAZ' => multi_az,
'LicenseModel' => license_model,
'DBSubnetGroupName' => db_subnet_group_name
}
options.delete_if {|key, value| value.nil?}
end
|
#create_read_replica(replica_id, options = {}) ⇒ Object
36
37
38
39
40
41
|
# File 'lib/fog/aws/models/rds/server.rb', line 36
def create_read_replica(replica_id, options={})
options[:security_group_names] ||= options['DBSecurityGroups']
params = self.class.new(options).attributes_to_params
connection.create_db_instance_read_replica(replica_id, id, params)
connection.servers.get(replica_id)
end
|
#destroy(snapshot_identifier = nil) ⇒ Object
47
48
49
50
51
|
# File 'lib/fog/aws/models/rds/server.rb', line 47
def destroy(snapshot_identifier=nil)
requires :id
connection.delete_db_instance(id, snapshot_identifier, snapshot_identifier.nil?)
true
end
|
#modify(immediately, options) ⇒ Object
81
82
83
84
85
86
87
|
# File 'lib/fog/aws/models/rds/server.rb', line 81
def modify(immediately, options)
options[:security_group_names] ||= options['DBSecurityGroups']
params = self.class.new(options).attributes_to_params
data = connection.modify_db_instance(id, immediately, params)
merge_attributes(data.body['ModifyDBInstanceResult']['DBInstance'])
true
end
|
#ready? ⇒ Boolean
43
44
45
|
# File 'lib/fog/aws/models/rds/server.rb', line 43
def ready?
state == 'available'
end
|
#reboot ⇒ Object
53
54
55
56
|
# File 'lib/fog/aws/models/rds/server.rb', line 53
def reboot
connection.reboot_db_instance(id)
true
end
|
75
76
77
78
79
|
# File 'lib/fog/aws/models/rds/server.rb', line 75
def remove_tags(tag_keys)
requires :id
connection.remove_tags_from_resource(id, tag_keys)
tags
end
|
#save ⇒ Object
89
90
91
92
93
94
95
96
97
98
99
100
|
# File 'lib/fog/aws/models/rds/server.rb', line 89
def save
requires :engine
requires :allocated_storage
requires :master_username
requires :password
self.flavor_id ||= 'db.m1.small'
data = connection.create_db_instance(id, attributes_to_params)
merge_attributes(data.body['CreateDBInstanceResult']['DBInstance'])
true
end
|
#snapshots ⇒ Object
58
59
60
61
|
# File 'lib/fog/aws/models/rds/server.rb', line 58
def snapshots
requires :id
connection.snapshots(:server => self)
end
|
63
64
65
66
67
|
# File 'lib/fog/aws/models/rds/server.rb', line 63
def tags
requires :id
connection.list_tags_for_resource(id).
body['ListTagsForResourceResult']['TagList']
end
|