Class: DrawCloud::Subnet
Defined Under Namespace
Classes: SubnetNetworkAclAssociation, SubnetRouteTableAssociation
Instance Attribute Summary collapse
-
#availability_zone ⇒ Object
Returns the value of attribute availability_zone.
-
#cidr ⇒ Object
Returns the value of attribute cidr.
-
#name ⇒ Object
Returns the value of attribute name.
-
#network_acl ⇒ Object
Returns the value of attribute network_acl.
-
#route_table ⇒ Object
Returns the value of attribute route_table.
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
-
#initialize(name, cidr, options = {}, &block) ⇒ Subnet
constructor
A new instance of Subnet.
- #load_into_config(config) ⇒ Object
- #subnet ⇒ 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, #resource_name
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, cidr, options = {}, &block) ⇒ Subnet
Returns a new instance of Subnet.
64 65 66 67 68 69 70 71 |
# File 'lib/draw_cloud/subnet.rb', line 64 def initialize(name, cidr, ={}, &block) @name = name @cidr = cidr @availability_zone = .fetch(:availability_zone, nil) @route_table = .fetch(:route_table, nil) @network_acl = .fetch(:network_acl, nil) super(, &block) end |
Instance Attribute Details
#availability_zone ⇒ Object
Returns the value of attribute availability_zone.
63 64 65 |
# File 'lib/draw_cloud/subnet.rb', line 63 def availability_zone @availability_zone end |
#cidr ⇒ Object
Returns the value of attribute cidr.
63 64 65 |
# File 'lib/draw_cloud/subnet.rb', line 63 def cidr @cidr end |
#name ⇒ Object
Returns the value of attribute name.
63 64 65 |
# File 'lib/draw_cloud/subnet.rb', line 63 def name @name end |
#network_acl ⇒ Object
Returns the value of attribute network_acl.
63 64 65 |
# File 'lib/draw_cloud/subnet.rb', line 63 def network_acl @network_acl end |
#route_table ⇒ Object
Returns the value of attribute route_table.
63 64 65 |
# File 'lib/draw_cloud/subnet.rb', line 63 def route_table @route_table end |
Instance Method Details
#load_into_config(config) ⇒ Object
77 78 79 80 81 82 83 84 85 86 87 88 89 90 |
# File 'lib/draw_cloud/subnet.rb', line 77 def load_into_config(config) config.cf_add_resource resource_name, self if route_table route_table.load_into_config(config) assoc = SubnetRouteTableAssociation.new(self, route_table) config.cf_add_resource assoc.resource_name, assoc end if network_acl network_acl.load_into_config(config) assoc = SubnetNetworkAclAssociation.new(self, network_acl) config.cf_add_resource assoc.resource_name, assoc end super(config) end |
#subnet ⇒ Object
73 74 75 |
# File 'lib/draw_cloud/subnet.rb', line 73 def subnet self end |
#to_h ⇒ Object
92 93 94 95 96 97 98 99 100 101 102 |
# File 'lib/draw_cloud/subnet.rb', line 92 def to_h h = { "Type" => "AWS::EC2::Subnet", "Properties" => { "CidrBlock" => cidr, } } h["Properties"]["VpcId"] = DrawCloud.ref(vpc) if vpc h["Properties"]["AvailabilityZone"] = DrawCloud.ref(@availability_zone) if @availability_zone add_standard_properties(h) end |