class AWS::EC2::Subnet
@attr_reader [String] availability_zone_name
@attr_reader [Integer] available_ip_address_count
@attr_reader [String] cidr_block
@attr_reader [Symbol] state
@attr_reader [String] vpc_id
def availability_zone
-
(AvailabilityZone)
-
def availability_zone AvailabilityZone.new(availability_zone_name, :config => config) end
def delete
-
(nil)
-
def delete client.delete_subnet(:subnet_id => subnet_id) nil end
def initialize subnet_id, options = {}
def initialize subnet_id, options = {} @subnet_id = subnet_id super end
def instances
-
(InstanceCollection)
- Returns a filtered collection of
def instances InstanceCollection.new(:config => config).filter('subnet-id', id) end
def network_acl
-
(NetworkACL)
- Returns the network ACL currently assigned
def network_acl network_acl_association.network_acl end
def network_acl= network_acl
-
network_acl
(NetworkACL, String
) -- A {NetworkACL} or network
def network_acl= network_acl network_acl_association.replace_network_acl(network_acl) end
def network_acl_association
-
(NetworkACL::Association)
- Returns the association between
def network_acl_association associations = AWS.memoize { vpc.network_acls.map(&:associations) }.flatten associations.first{|a| a.subnet == self } end
def network_interfaces
-
(NetworkInterfaceCollection)
- Returns a collection that
def network_interfaces NetworkInterfaceCollection.new(:config => config).filter('subnet-id', id) end
def route_table
-
(RouteTable)
- Returns the route table currently associated
def route_table route_table_association.route_table end
def route_table_association
-
(RouteTable::Association)
- Returns the association between
def route_table_association assocs = AWS.memoize { vpc.route_tables.map(&:associations) }.flatten assocs.find{|a| a.subnet == self } || assocs.find{|a| a.main? } end
def set_route_table route_table
-
(RouteTable::Association)
-
Parameters:
-
route_table
(RouteTable, String
) -- A {RouteTable} object or
def set_route_table route_table unless route_table.is_a?(RouteTable) route_table = RouteTable.new(route_table, :config => config) end client_opts = {} client_opts[:route_table_id] = route_table.id assoc = route_table_association if assoc.main? client_opts[:subnet_id] = subnet_id response = client.associate_route_table(client_opts) association_id = response.association_id else client_opts[:association_id] = assoc.association_id resp = client.replace_route_table_association(client_opts) association_id = resp.new_association_id end RouteTable::Association.new(route_table, association_id, subnet_id) end
def vpc
-
(VPC)
- Returns the VPC this subnet belongs to.
def vpc VPC.new(vpc_id, :config => config) end