Class: Fog::AWS::RDS::Server
- Inherits:
-
Model
- Object
- Model
- 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.
-
#source_snapshot_id ⇒ Object
Returns the value of attribute source_snapshot_id.
Instance Method Summary collapse
- #add_tags(new_tags) ⇒ Object
-
#attributes_to_params ⇒ Object
Converts attributes to a parameter hash suitable for requests.
- #cluster ⇒ Object
- #create_read_replica(replica_id, options = {}) ⇒ Object
- #destroy(snapshot_identifier = nil) ⇒ Object
- #modify(immediately, options) ⇒ Object
- #promote_read_replica ⇒ Object (also: #promote)
- #ready? ⇒ Boolean
- #reboot ⇒ Object
- #remove_tags(tag_keys) ⇒ Object
- #save ⇒ Object
- #snapshots ⇒ Object
- #tags ⇒ Object
Instance Attribute Details
#parameter_group_name ⇒ Object
Returns the value of attribute parameter_group_name.
42 43 44 |
# File 'lib/fog/aws/models/rds/server.rb', line 42 def parameter_group_name @parameter_group_name end |
#password ⇒ Object
Returns the value of attribute password.
42 43 44 |
# File 'lib/fog/aws/models/rds/server.rb', line 42 def password @password end |
#port ⇒ Object
Returns the value of attribute port.
42 43 44 |
# File 'lib/fog/aws/models/rds/server.rb', line 42 def port @port end |
#security_group_names ⇒ Object
Returns the value of attribute security_group_names.
42 43 44 |
# File 'lib/fog/aws/models/rds/server.rb', line 42 def security_group_names @security_group_names end |
#source_snapshot_id ⇒ Object
Returns the value of attribute source_snapshot_id.
42 43 44 |
# File 'lib/fog/aws/models/rds/server.rb', line 42 def source_snapshot_id @source_snapshot_id end |
Instance Method Details
#add_tags(new_tags) ⇒ Object
82 83 84 85 86 |
# File 'lib/fog/aws/models/rds/server.rb', line 82 def () requires :id service.(id, ) end |
#attributes_to_params ⇒ Object
Converts attributes to a parameter hash suitable for requests
137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 |
# File 'lib/fog/aws/models/rds/server.rb', line 137 def attributes_to_params = { 'AllocatedStorage' => allocated_storage, 'AutoMinorVersionUpgrade' => auto_minor_version_upgrade, 'AvailabilityZone' => availability_zone, 'BackupRetentionPeriod' => backup_retention_period, 'DBClusterIdentifier' => cluster_id, 'DBInstanceClass' => flavor_id, 'DBInstanceIdentifier' => id, 'DBName' => db_name, 'DBParameterGroupName' => parameter_group_name || attributes['DBParameterGroupName'], 'DBSecurityGroups' => security_group_names, 'DBSubnetGroupName' => db_subnet_group_name, 'Engine' => engine, 'EngineVersion' => engine_version, 'Iops' => iops, 'KmsKeyId' => kms_key_id, 'LicenseModel' => license_model, 'MasterUserPassword' => password || attributes['MasterUserPassword'], 'MasterUsername' => master_username, 'MultiAZ' => multi_az, 'Port' => port || attributes['Port'], 'PreferredBackupWindow' => preferred_backup_window, 'PreferredMaintenanceWindow' => preferred_maintenance_window, 'PubliclyAccessible' => publicly_accessible, 'StorageEncrypted' => storage_encrypted, 'StorageType' => storage_type, 'VpcSecurityGroups' => vpc_security_groups, } .delete_if {|key, value| value.nil?} end |
#cluster ⇒ Object
44 45 46 47 |
# File 'lib/fog/aws/models/rds/server.rb', line 44 def cluster return nil unless cluster_id service.clusters.get(cluster_id) end |
#create_read_replica(replica_id, options = {}) ⇒ Object
49 50 51 52 53 54 |
# File 'lib/fog/aws/models/rds/server.rb', line 49 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
60 61 62 63 64 |
# File 'lib/fog/aws/models/rds/server.rb', line 60 def destroy(snapshot_identifier=nil) requires :id service.delete_db_instance(id, snapshot_identifier, snapshot_identifier.nil?) true end |
#modify(immediately, options) ⇒ Object
104 105 106 107 108 109 110 |
# File 'lib/fog/aws/models/rds/server.rb', line 104 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 |
#promote_read_replica ⇒ Object Also known as: promote
94 95 96 97 98 99 100 |
# File 'lib/fog/aws/models/rds/server.rb', line 94 def promote_read_replica requires :id data = service.promote_read_replica(id).body["PromoteReadReplicaResult"]["DBInstance"] merge_attributes(data) end |
#ready? ⇒ Boolean
56 57 58 |
# File 'lib/fog/aws/models/rds/server.rb', line 56 def ready? state == 'available' end |
#reboot ⇒ Object
66 67 68 69 |
# File 'lib/fog/aws/models/rds/server.rb', line 66 def reboot service.reboot_db_instance(id) true end |
#remove_tags(tag_keys) ⇒ Object
88 89 90 91 92 |
# File 'lib/fog/aws/models/rds/server.rb', line 88 def (tag_keys) requires :id service.(id, tag_keys) end |
#save ⇒ Object
112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 |
# File 'lib/fog/aws/models/rds/server.rb', line 112 def save if source_snapshot_id requires :id data = service.restore_db_instance_from_db_snapshot(source_snapshot_id, id, attributes_to_params) merge_attributes(data.body['RestoreDBInstanceFromDBSnapshotResult']['DBInstance']) else requires :engine if engine == 'aurora' requires :cluster_id self.flavor_id ||= 'db.r3.large' else requires :master_username requires :password requires :allocated_storage self.flavor_id ||= 'db.m1.small' end data = service.create_db_instance(id, attributes_to_params) merge_attributes(data.body['CreateDBInstanceResult']['DBInstance']) true end end |
#snapshots ⇒ Object
71 72 73 74 |
# File 'lib/fog/aws/models/rds/server.rb', line 71 def snapshots requires :id service.snapshots(:server => self) end |
#tags ⇒ Object
76 77 78 79 80 |
# File 'lib/fog/aws/models/rds/server.rb', line 76 def requires :id service.(id). body['ListTagsForResourceResult']['TagList'] end |