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
- #add_tags(new_tags) ⇒ Object
-
#attributes_to_params ⇒ Object
Converts attributes to a parameter hash suitable for requests.
- #create_read_replica(replica_id, options = {}) ⇒ Object
- #destroy(snapshot_identifier = nil) ⇒ Object
- #modify(immediately, options) ⇒ Object
- #ready? ⇒ Boolean
- #reboot ⇒ Object
- #remove_tags(tag_keys) ⇒ Object
- #save ⇒ Object
- #snapshots ⇒ Object
- #tags ⇒ Object
Methods inherited from Model
#initialize, #inspect, #reload, #symbolize_keys, #to_json, #wait_for
Methods included from Fog::Attributes::ClassMethods
#_load, #aliases, #attribute, #attributes, #identity, #ignore_attributes, #ignored_attributes
Methods included from Core::DeprecatedConnectionAccessors
#connection, #connection=, #prepare_service_value
Methods included from Fog::Attributes::InstanceMethods
#_dump, #attributes, #dup, #identity, #identity=, #merge_attributes, #new_record?, #persisted?, #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.
37 38 39 |
# File 'lib/fog/aws/models/rds/server.rb', line 37 def parameter_group_name @parameter_group_name end |
#password ⇒ Object
Returns the value of attribute password.
37 38 39 |
# File 'lib/fog/aws/models/rds/server.rb', line 37 def password @password end |
#port ⇒ Object
Returns the value of attribute port.
37 38 39 |
# File 'lib/fog/aws/models/rds/server.rb', line 37 def port @port end |
#security_group_names ⇒ Object
Returns the value of attribute security_group_names.
37 38 39 |
# File 'lib/fog/aws/models/rds/server.rb', line 37 def security_group_names @security_group_names end |
Instance Method Details
#add_tags(new_tags) ⇒ Object
72 73 74 75 76 |
# File 'lib/fog/aws/models/rds/server.rb', line 72 def () requires :id service.(id, ) end |
#attributes_to_params ⇒ Object
Converts attributes to a parameter hash suitable for requests
106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 |
# File 'lib/fog/aws/models/rds/server.rb', line 106 def attributes_to_params = { '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, 'Iops' => iops, '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, 'PubliclyAccessible' => publicly_accessible, 'VpcSecurityGroups' => vpc_security_groups, } .delete_if {|key, value| value.nil?} end |
#create_read_replica(replica_id, options = {}) ⇒ Object
39 40 41 42 43 44 |
# File 'lib/fog/aws/models/rds/server.rb', line 39 def create_read_replica(replica_id, ={}) [:security_group_names] ||= ['DBSecurityGroups'] params = self.class.new().attributes_to_params service.create_db_instance_read_replica(replica_id, id, params) service.servers.get(replica_id) end |
#destroy(snapshot_identifier = nil) ⇒ Object
50 51 52 53 54 |
# File 'lib/fog/aws/models/rds/server.rb', line 50 def destroy(snapshot_identifier=nil) requires :id service.delete_db_instance(id, snapshot_identifier, snapshot_identifier.nil?) true end |
#modify(immediately, options) ⇒ Object
84 85 86 87 88 89 90 |
# File 'lib/fog/aws/models/rds/server.rb', line 84 def modify(immediately, ) [:security_group_names] ||= ['DBSecurityGroups'] params = self.class.new().attributes_to_params data = service.modify_db_instance(id, immediately, params) merge_attributes(data.body['ModifyDBInstanceResult']['DBInstance']) true end |
#ready? ⇒ Boolean
46 47 48 |
# File 'lib/fog/aws/models/rds/server.rb', line 46 def ready? state == 'available' end |
#reboot ⇒ Object
56 57 58 59 |
# File 'lib/fog/aws/models/rds/server.rb', line 56 def reboot service.reboot_db_instance(id) true end |
#remove_tags(tag_keys) ⇒ Object
78 79 80 81 82 |
# File 'lib/fog/aws/models/rds/server.rb', line 78 def (tag_keys) requires :id service.(id, tag_keys) end |
#save ⇒ Object
92 93 94 95 96 97 98 99 100 101 102 103 |
# File 'lib/fog/aws/models/rds/server.rb', line 92 def save requires :engine requires :allocated_storage requires :master_username requires :password self.flavor_id ||= 'db.m1.small' data = service.create_db_instance(id, attributes_to_params) merge_attributes(data.body['CreateDBInstanceResult']['DBInstance']) true end |
#snapshots ⇒ Object
61 62 63 64 |
# File 'lib/fog/aws/models/rds/server.rb', line 61 def snapshots requires :id service.snapshots(:server => self) end |
#tags ⇒ Object
66 67 68 69 70 |
# File 'lib/fog/aws/models/rds/server.rb', line 66 def requires :id service.(id). body['ListTagsForResourceResult']['TagList'] end |