Class: Ec2::Subnet
Instance Method Summary collapse
- #created(&block) ⇒ Object
- #id! ⇒ Object
-
#initialize(name, vpc_id: nil) ⇒ Subnet
constructor
A new instance of Subnet.
Methods included from Logger
#debug?, #logger, logger, #stderr, stderr
Methods included from Helper
Constructor Details
#initialize(name, vpc_id: nil) ⇒ Subnet
Returns a new instance of Subnet.
9 10 11 12 13 |
# File 'lib/ec2/subnet.rb', line 9 def initialize(name, vpc_id: nil) error "vpc_id not specified for subnet" if not vpc_id @vpc_id = vpc_id.to_s @name = name.to_s end |
Instance Method Details
#created(&block) ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/ec2/subnet.rb', line 21 def created(&block) instance_eval &block load_id using_cidr: true if exists? tag if not tagged? verify else create tag end end |
#id! ⇒ Object
15 16 17 18 19 |
# File 'lib/ec2/subnet.rb', line 15 def id! load_id if not @id error "specified subnet #{@name} doesn't exist in vpc #{@vpc_id}" if not exists? @id end |