Class: Fog::AWS::RDS::Server
- Defined in:
- lib/fog/aws/models/rds/server.rb
Instance Attribute Summary collapse
-
#parameter_group_name ⇒ Object
Returns the value of attribute parameter_group_name.
-
#password ⇒ Object
Returns the value of attribute password.
-
#port ⇒ Object
Returns the value of attribute port.
-
#security_group_names ⇒ Object
Returns the value of attribute security_group_names.
Attributes inherited from Model
Instance Method Summary collapse
- #create_read_replica(replica_id, options = {}) ⇒ Object
- #destroy(snapshot_identifier = nil) ⇒ Object
-
#initialize(attributes = {}) ⇒ Server
constructor
A new instance of Server.
- #modify(immediately, options) ⇒ Object
- #ready? ⇒ Boolean
- #reboot ⇒ Object
- #save ⇒ Object
- #snapshots ⇒ Object
Methods inherited from Model
#inspect, #reload, #to_json, #wait_for
Methods included from Fog::Attributes::ClassMethods
#_load, #aliases, #attribute, #attributes, #identity, #ignore_attributes, #ignored_attributes
Methods included from Fog::Attributes::InstanceMethods
#_dump, #attributes, #dup, #identity, #identity=, #merge_attributes, #new_record?, #requires, #requires_one
Constructor Details
#initialize(attributes = {}) ⇒ Server
Returns a new instance of Server.
35 36 37 38 |
# File 'lib/fog/aws/models/rds/server.rb', line 35 def initialize(attributes={}) self.flavor_id ||= 'db.m1.small' super end |
Instance Attribute Details
#parameter_group_name ⇒ Object
Returns the value of attribute parameter_group_name.
33 34 35 |
# File 'lib/fog/aws/models/rds/server.rb', line 33 def parameter_group_name @parameter_group_name end |
#password ⇒ Object
Returns the value of attribute password.
33 34 35 |
# File 'lib/fog/aws/models/rds/server.rb', line 33 def password @password end |
#port ⇒ Object
Returns the value of attribute port.
33 34 35 |
# File 'lib/fog/aws/models/rds/server.rb', line 33 def port @port end |
#security_group_names ⇒ Object
Returns the value of attribute security_group_names.
33 34 35 |
# File 'lib/fog/aws/models/rds/server.rb', line 33 def security_group_names @security_group_names end |
Instance Method Details
#create_read_replica(replica_id, options = {}) ⇒ Object
40 41 42 43 |
# File 'lib/fog/aws/models/rds/server.rb', line 40 def create_read_replica(replica_id, ={}) connection.create_db_instance_read_replica(replica_id, id, ) connection.servers.get(replica_id) end |
#destroy(snapshot_identifier = nil) ⇒ Object
49 50 51 52 53 |
# File 'lib/fog/aws/models/rds/server.rb', line 49 def destroy(snapshot_identifier=nil) requires :id connection.delete_db_instance(id, snapshot_identifier, snapshot_identifier.nil?) true end |
#modify(immediately, options) ⇒ Object
65 66 67 68 69 |
# File 'lib/fog/aws/models/rds/server.rb', line 65 def modify(immediately, ) data = connection.modify_db_instance(id, immediately, ) merge_attributes(data.body['ModifyDBInstanceResult']['DBInstance']) true end |
#ready? ⇒ Boolean
45 46 47 |
# File 'lib/fog/aws/models/rds/server.rb', line 45 def ready? state == 'available' end |
#reboot ⇒ Object
55 56 57 58 |
# File 'lib/fog/aws/models/rds/server.rb', line 55 def reboot connection.reboot_db_instance(id) true end |
#save ⇒ Object
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 |
# File 'lib/fog/aws/models/rds/server.rb', line 71 def save requires :engine requires :allocated_storage requires :master_username requires :password = { 'AllocatedStorage' => allocated_storage, 'AutoMinorVersionUpgrade' => auto_minor_version_upgrade, 'BackupRetentionPeriod' => backup_retention_period, 'DBName' => db_name, 'DBParameterGroupName' => parameter_group_name, 'DBSecurityGroups' => security_group_names, 'DBInstanceIdentifier' => id, 'AvailabilityZone' => availability_zone, 'DBInstanceClass' => flavor_id, 'Port' => port, 'Engine' => engine, 'EngineVersion' => engine_version, 'MasterUsername' => master_username, 'MasterUserPassword' => password, 'PreferredMaintenanceWindow' => preferred_maintenance_window, 'PreferredBackupWindow' => preferred_backup_window, 'MultiAZ' => multi_az, 'LicenseModel' => license_model } .delete_if {|key, value| value.nil?} data = connection.create_db_instance(id, ) merge_attributes(data.body['CreateDBInstanceResult']['DBInstance']) true end |
#snapshots ⇒ Object
60 61 62 63 |
# File 'lib/fog/aws/models/rds/server.rb', line 60 def snapshots requires :id connection.snapshots(:server => self) end |