module AwsExtensions::EC2::Subnet

Public Instance Methods

<=>(other) click to toggle source

Implement comparison by using subnet id

# File lib/aws_extensions/ec2/Subnet.rb, line 22
def <=>(other)
  self.subnet_id <=> other.subnet_id
end
name() click to toggle source

Public: Returns the value of the “Name” tag for the subnet or nil if there is not one

# File lib/aws_extensions/ec2/Subnet.rb, line 8
def name
  self.tags.select { |tag| tag.key == "Name" }.first.value
rescue
  nil
end
vpc_subnet_name() click to toggle source

Public: Returns the name of the security group prefixed by the vpc name or id

# File lib/aws_extensions/ec2/Subnet.rb, line 15
def vpc_subnet_name
  vpc = Cumulus::EC2::id_vpcs[self.vpc_id]
  vpc_name = vpc.name || vpc.vpd_id
  "#{vpc_name}/#{self.name}"
end