Class: DrawCloud::RDSInstance
- Defined in:
- lib/draw_cloud/rds_instance.rb
Defined Under Namespace
Classes: RDSSubnetGroup
Instance Attribute Summary collapse
-
#allocated_storage ⇒ Object
Returns the value of attribute allocated_storage.
-
#auto_minor_version_upgrade ⇒ Object
Returns the value of attribute auto_minor_version_upgrade.
-
#backup_retention_period ⇒ Object
Returns the value of attribute backup_retention_period.
-
#db_instance_class ⇒ Object
(also: #instance_class)
Returns the value of attribute db_instance_class.
-
#db_security_groups ⇒ Object
Returns the value of attribute db_security_groups.
-
#db_snapshot_identifier ⇒ Object
Returns the value of attribute db_snapshot_identifier.
-
#engine ⇒ Object
Returns the value of attribute engine.
-
#engine_version ⇒ Object
Returns the value of attribute engine_version.
-
#iops ⇒ Object
Returns the value of attribute iops.
-
#master_user_password ⇒ Object
(also: #master_password)
Returns the value of attribute master_user_password.
-
#master_username ⇒ Object
Returns the value of attribute master_username.
-
#multi_az ⇒ Object
Returns the value of attribute multi_az.
-
#name ⇒ Object
Returns the value of attribute name.
-
#rds_subnets ⇒ Object
Returns the value of attribute rds_subnets.
Attributes inherited from Base
#as_groups, #as_launch_configurations, #deletion_policy, #depends_on, #ec2_instances, #elastic_ips, #gateways, #iam_access_keys, #iam_policies, #iam_users, #mappings, #metadata, #network_acls, #network_interfaces, #outputs, #parameters, #parent, #rdses, #resources, #route_tables, #security_groups, #sns_topics, #subnets, #vpcs, #wait_handles
Instance Method Summary collapse
- #db_security_group(name, description, options = {}, &block) ⇒ Object
-
#initialize(name, options = {}, &block) ⇒ RDSInstance
constructor
A new instance of RDSInstance.
- #load_into_config(config) ⇒ Object
- #rds ⇒ Object
- #resource_name ⇒ Object
- #subnet_group ⇒ Object
- #to_h ⇒ Object
Methods inherited from Base
#[], #accessor, #add_standard_properties, #create_as_group, #create_as_launch_configuration, #create_ec2_instance, #create_ec2_instance_template, #create_elastic_ip, #create_iam_access_key, #create_iam_policy, #create_iam_user, #create_mapping, #create_network_acl, #create_network_interface, #create_output, #create_parameter, #create_rds, #create_route_table, #create_security_group, #create_service, #create_sns_topic, #create_subnet, #create_vpc, #create_wait_handle, #ref
Methods included from Locations
Methods included from Utilities
#desplice, #fnbase64, #fngetatt, #fnjoin, #hash_to_tag_array, #region, #resource_style, #splice, #stack_name
Constructor Details
#initialize(name, options = {}, &block) ⇒ RDSInstance
60 61 62 63 64 65 |
# File 'lib/draw_cloud/rds_instance.rb', line 60 def initialize(name, ={}, &block) @name = name @db_security_groups = [] @rds_subnets = [] super(, &block) end |
Instance Attribute Details
#allocated_storage ⇒ Object
Returns the value of attribute allocated_storage.
42 43 44 |
# File 'lib/draw_cloud/rds_instance.rb', line 42 def allocated_storage @allocated_storage end |
#auto_minor_version_upgrade ⇒ Object
Returns the value of attribute auto_minor_version_upgrade.
42 43 44 |
# File 'lib/draw_cloud/rds_instance.rb', line 42 def auto_minor_version_upgrade @auto_minor_version_upgrade end |
#backup_retention_period ⇒ Object
Returns the value of attribute backup_retention_period.
42 43 44 |
# File 'lib/draw_cloud/rds_instance.rb', line 42 def backup_retention_period @backup_retention_period end |
#db_instance_class ⇒ Object Also known as: instance_class
Returns the value of attribute db_instance_class.
42 43 44 |
# File 'lib/draw_cloud/rds_instance.rb', line 42 def db_instance_class @db_instance_class end |
#db_security_groups ⇒ Object
Returns the value of attribute db_security_groups.
42 43 44 |
# File 'lib/draw_cloud/rds_instance.rb', line 42 def db_security_groups @db_security_groups end |
#db_snapshot_identifier ⇒ Object
Returns the value of attribute db_snapshot_identifier.
42 43 44 |
# File 'lib/draw_cloud/rds_instance.rb', line 42 def db_snapshot_identifier @db_snapshot_identifier end |
#engine ⇒ Object
Returns the value of attribute engine.
42 43 44 |
# File 'lib/draw_cloud/rds_instance.rb', line 42 def engine @engine end |
#engine_version ⇒ Object
Returns the value of attribute engine_version.
42 43 44 |
# File 'lib/draw_cloud/rds_instance.rb', line 42 def engine_version @engine_version end |
#iops ⇒ Object
Returns the value of attribute iops.
42 43 44 |
# File 'lib/draw_cloud/rds_instance.rb', line 42 def iops @iops end |
#master_user_password ⇒ Object Also known as: master_password
Returns the value of attribute master_user_password.
42 43 44 |
# File 'lib/draw_cloud/rds_instance.rb', line 42 def master_user_password @master_user_password end |
#master_username ⇒ Object
Returns the value of attribute master_username.
42 43 44 |
# File 'lib/draw_cloud/rds_instance.rb', line 42 def master_username @master_username end |
#multi_az ⇒ Object
Returns the value of attribute multi_az.
42 43 44 |
# File 'lib/draw_cloud/rds_instance.rb', line 42 def multi_az @multi_az end |
#name ⇒ Object
Returns the value of attribute name.
42 43 44 |
# File 'lib/draw_cloud/rds_instance.rb', line 42 def name @name end |
#rds_subnets ⇒ Object
Returns the value of attribute rds_subnets.
42 43 44 |
# File 'lib/draw_cloud/rds_instance.rb', line 42 def rds_subnets @rds_subnets end |
Instance Method Details
#db_security_group(name, description, options = {}, &block) ⇒ Object
88 89 90 91 92 |
# File 'lib/draw_cloud/rds_instance.rb', line 88 def db_security_group(name, description, ={}, &block) d = RDSSecurityGroup.new(name, description, .merge(:parent => self), &block) db_security_groups << d d end |
#load_into_config(config) ⇒ Object
71 72 73 74 75 76 77 78 |
# File 'lib/draw_cloud/rds_instance.rb', line 71 def load_into_config(config) config.cf_add_resource resource_name, self db_security_groups.each {|g| g.load_into_config(config) } unless rds_subnets.empty? config.cf_add_resource subnet_group.resource_name, subnet_group end super(config) end |
#rds ⇒ Object
67 68 69 |
# File 'lib/draw_cloud/rds_instance.rb', line 67 def rds self end |
#resource_name ⇒ Object
80 81 82 |
# File 'lib/draw_cloud/rds_instance.rb', line 80 def resource_name resource_style(name) + "RDS" end |
#subnet_group ⇒ Object
84 85 86 |
# File 'lib/draw_cloud/rds_instance.rb', line 84 def subnet_group RDSSubnetGroup.new(self, rds_subnets) end |
#to_h ⇒ Object
94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 |
# File 'lib/draw_cloud/rds_instance.rb', line 94 def to_h h = { "Type" => "AWS::RDS::DBInstance", "Properties" => { "DBSecurityGroups" => db_security_groups.collect { |g| DrawCloud.ref(g)}, "AllocatedStorage" => DrawCloud.ref(allocated_storage), "Engine" => DrawCloud.ref(engine), "DBInstanceClass" => DrawCloud.ref(db_instance_class), "MasterUsername" => DrawCloud.ref(master_username), "MasterUserPassword" => DrawCloud.ref(master_user_password), } } p = h["Properties"] p["DBSnapshotIdentifier"] = DrawCloud.ref(db_snapshot_identifier) if db_snapshot_identifier p["MultiAZ"] = multi_az unless multi_az.nil? p["EngineVersion"] = DrawCloud.ref(engine_version) unless engine_version.nil? p["Iops"] = DrawCloud.ref(iops) if iops p["DBSubnetGroupName"] = DrawCloud.ref(subnet_group) unless rds_subnets.empty? p["AutoMinorVersionUpgrade"] = DrawCloud.ref(auto_minor_version_upgrade) unless auto_minor_version_upgrade.nil? p["BackupRetentionPeriod"] = DrawCloud.ref(backup_retention_period) unless backup_retention_period.nil? add_standard_properties(h) end |