Module: AwsExtensions::EC2::Subnet

Defined in:
lib/aws_extensions/ec2/Subnet.rb

Instance Method Summary collapse

Instance Method Details

#<=>(other) ⇒ Object

Implement comparison by using subnet id



22
23
24
# File 'lib/aws_extensions/ec2/Subnet.rb', line 22

def <=>(other)
  self.subnet_id <=> other.subnet_id
end

#nameObject

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



8
9
10
11
12
# 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_nameObject

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



15
16
17
18
19
# 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