Class: Awsom::Subnet

Inherits:
Object
  • Object
show all
Includes:
Logger
Defined in:
lib/awsom/subnet.rb

Instance Method Summary collapse

Methods included from Logger

#debug?, #logger, logger, #stderr, stderr

Constructor Details

#initialize(name, cidr:, az:, vpc_id:) ⇒ Subnet

Returns a new instance of Subnet.



8
9
10
11
12
13
# File 'lib/awsom/subnet.rb', line 8

def initialize(name, cidr:, az:, vpc_id:)
  @vpc_id = vpc_id
  @name = name
  @cidr = cidr
  @az = az
end

Instance Method Details

#createdObject



21
22
23
24
25
26
27
28
29
# File 'lib/awsom/subnet.rb', line 21

def created
  id = find_id
  if id
    subnet = subnet(id)
    tag(subnet) if not tagged?(subnet)
    return id
  end
  create
end

#idObject



15
16
17
18
19
# File 'lib/awsom/subnet.rb', line 15

def id
  id = find_id
  error "specified subnet #{@name} doesn't exist in vpc #{@vpc_id}" if not id
  id
end