Class: Fog::AWS::RDS::Cluster
- Inherits:
-
Model
- Object
- Model
- Fog::AWS::RDS::Cluster
- Defined in:
- lib/fog/aws/models/rds/cluster.rb
Instance Attribute Summary collapse
-
#storage_encrypted ⇒ Object
not in the response.
Instance Method Summary collapse
- #attributes_to_params ⇒ Object
- #destroy(snapshot_identifier = nil) ⇒ Object
- #has_replica?(replica_name) ⇒ Boolean
- #master ⇒ Object
- #ready? ⇒ Boolean
- #replicas ⇒ Object
- #save ⇒ Object
- #servers(set = db_cluster_members) ⇒ Object
- #snapshots ⇒ Object
Instance Attribute Details
#storage_encrypted ⇒ Object
not in the response
23 24 25 |
# File 'lib/fog/aws/models/rds/cluster.rb', line 23 def storage_encrypted @storage_encrypted end |
Instance Method Details
#attributes_to_params ⇒ Object
77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 |
# File 'lib/fog/aws/models/rds/cluster.rb', line 77 def attributes_to_params = { 'AllocatedStorage' => allocated_storage, 'BackupRetentionPeriod' => backup_retention_period, 'DBClusterIdentifier' => identity, 'DBClusterParameterGroup' => db_cluster_parameter_group, 'DBSubnetGroupName' => db_subnet_group, 'Endpoint' => endpoint, 'Engine' => engine, 'EngineVersion' => engine_version, 'MasterUserPassword' => password, 'MasterUsername' => master_username, 'PreferredBackupWindow' => preferred_backup_window, 'PreferredMaintenanceWindow' => preferred_maintenance_window, 'Status' => state, 'StorageEncrypted' => storage_encrypted, 'VpcSecurityGroups' => vpc_security_groups, } .delete_if { |key,value| value.nil? } end |
#destroy(snapshot_identifier = nil) ⇒ Object
60 61 62 63 64 |
# File 'lib/fog/aws/models/rds/cluster.rb', line 60 def destroy(snapshot_identifier=nil) requires :id service.delete_db_cluster(id, snapshot_identifier, snapshot_identifier.nil?) true end |
#has_replica?(replica_name) ⇒ Boolean
56 57 58 |
# File 'lib/fog/aws/models/rds/cluster.rb', line 56 def has_replica?(replica_name) replicas.detect { |replica| replica.id == replica_name } end |
#master ⇒ Object
48 49 50 |
# File 'lib/fog/aws/models/rds/cluster.rb', line 48 def master db_cluster_members.detect { |member| member["master"] } end |
#ready? ⇒ Boolean
25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/fog/aws/models/rds/cluster.rb', line 25 def ready? # [2019.01] I don't think this is going to work, at least not with Aurora # clusters. In my testing, the state reported by Fog for an Aurora cluster # is "active" as soon as the cluster is retrievable from AWS, and the # value doesn't change after that. Contrast that with the AWS Console UI, # which reports the cluster as "Creating" while it's being created. I don't # know where Fog is getting the state value from, but I don't think it's # correct, at least not for the purpose of knowing if the Cluster is ready # to have individual instances added to it. state == 'available' || state == 'active' end |
#replicas ⇒ Object
52 53 54 |
# File 'lib/fog/aws/models/rds/cluster.rb', line 52 def replicas servers(db_cluster_members.select { |member| !member["master"] }) end |
#save ⇒ Object
66 67 68 69 70 71 72 73 74 75 |
# File 'lib/fog/aws/models/rds/cluster.rb', line 66 def save requires :id requires :engine requires :master_username requires :password data = service.create_db_cluster(id, attributes_to_params) merge_attributes(data.body['CreateDBClusterResult']['DBCluster']) true end |
#servers(set = db_cluster_members) ⇒ Object
42 43 44 45 46 |
# File 'lib/fog/aws/models/rds/cluster.rb', line 42 def servers(set=db_cluster_members) set.map do |member| service.servers.get(member['DBInstanceIdentifier']) end end |
#snapshots ⇒ Object
37 38 39 40 |
# File 'lib/fog/aws/models/rds/cluster.rb', line 37 def snapshots requires :id service.cluster_snapshots(:cluster => self) end |