Class: Ctrl::Ec2Instance
- Inherits:
-
Object
- Object
- Ctrl::Ec2Instance
- Includes:
- Virtus::Model
- Defined in:
- lib/ctrl/ec2_instance.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.from_instance(_instance) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/ctrl/ec2_instance.rb', line 12 def self.from_instance(_instance) new.tap do |i| name_tag = _instance..select {|e| e.key == 'Name'}.first env_tag = _instance..select {|e| e.key == 'Environment'}.first i.private_ip_address = _instance.private_ip_address i.name = name_tag.value if name_tag i.environment = env_tag.value if env_tag i.state = _instance.state.name i.instance_id = _instance.instance_id i.public_ip_address = _instance.public_ip_address end end |
Instance Method Details
#to_s ⇒ Object
26 27 28 |
# File 'lib/ctrl/ec2_instance.rb', line 26 def to_s "%10s %20s %15s %10s %16s %16s" % [environment, name, state, instance_id, private_ip_address, public_ip_address] end |