class DrawCloud::Subnet
Attributes
availability_zone[RW]
cidr[RW]
name[RW]
network_acl[RW]
route_table[RW]
Public Class Methods
new(name, cidr, options={}, &block)
click to toggle source
Calls superclass method
DrawCloud::Base::new
# File lib/draw_cloud/subnet.rb, line 64 def initialize(name, cidr, options={}, &block) @name = name @cidr = cidr @availability_zone = options.fetch(:availability_zone, nil) @route_table = options.fetch(:route_table, nil) @network_acl = options.fetch(:network_acl, nil) super(options, &block) end
Public Instance Methods
load_into_config(config)
click to toggle source
Calls superclass method
DrawCloud::Base#load_into_config
# 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()
click to toggle source
# File lib/draw_cloud/subnet.rb, line 73 def subnet self end
to_h()
click to toggle source
# 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