Class: Ec2list::Instance
- Inherits:
-
Object
- Object
- Ec2list::Instance
- Defined in:
- lib/ec2list.rb
Instance Attribute Summary collapse
-
#fqdn ⇒ Object
Returns the value of attribute fqdn.
-
#id ⇒ Object
Returns the value of attribute id.
-
#ip_addr ⇒ Object
Returns the value of attribute ip_addr.
-
#private_addr ⇒ Object
Returns the value of attribute private_addr.
-
#since ⇒ Object
Returns the value of attribute since.
-
#status ⇒ Object
Returns the value of attribute status.
-
#tags ⇒ Object
Returns the value of attribute tags.
-
#type ⇒ Object
Returns the value of attribute type.
Instance Method Summary collapse
- #cont?(tag) ⇒ Boolean
-
#initialize(ec2) ⇒ Instance
constructor
A new instance of Instance.
- #name ⇒ Object
- #tag ⇒ Object
Constructor Details
#initialize(ec2) ⇒ Instance
Returns a new instance of Instance.
69 70 71 72 73 74 75 76 77 78 |
# File 'lib/ec2list.rb', line 69 def initialize(ec2) @id = ec2.instance_id @type = ec2.instance_type @status = ec2.state.name @since = since_about(Time.now - ec2.launch_time) @tags = ec2. || [] @fqdn = ec2.public_dns_name @ip_addr = ec2.public_ip_address @private_addr = ec2.private_ip_address end |
Instance Attribute Details
#fqdn ⇒ Object
Returns the value of attribute fqdn.
67 68 69 |
# File 'lib/ec2list.rb', line 67 def fqdn @fqdn end |
#id ⇒ Object
Returns the value of attribute id.
67 68 69 |
# File 'lib/ec2list.rb', line 67 def id @id end |
#ip_addr ⇒ Object
Returns the value of attribute ip_addr.
67 68 69 |
# File 'lib/ec2list.rb', line 67 def ip_addr @ip_addr end |
#private_addr ⇒ Object
Returns the value of attribute private_addr.
67 68 69 |
# File 'lib/ec2list.rb', line 67 def private_addr @private_addr end |
#since ⇒ Object
Returns the value of attribute since.
67 68 69 |
# File 'lib/ec2list.rb', line 67 def since @since end |
#status ⇒ Object
Returns the value of attribute status.
67 68 69 |
# File 'lib/ec2list.rb', line 67 def status @status end |
#tags ⇒ Object
Returns the value of attribute tags.
67 68 69 |
# File 'lib/ec2list.rb', line 67 def @tags end |
#type ⇒ Object
Returns the value of attribute type.
67 68 69 |
# File 'lib/ec2list.rb', line 67 def type @type end |
Instance Method Details
#cont?(tag) ⇒ Boolean
93 94 95 |
# File 'lib/ec2list.rb', line 93 def cont?(tag) name && name.include?(tag) end |
#name ⇒ Object
80 81 82 83 84 85 86 87 |
# File 'lib/ec2list.rb', line 80 def name name_tag = .find { |tag| tag.key == 'Name' } if name_tag name_tag.value.gsub(' ', '_') else nil end end |
#tag ⇒ Object
89 90 91 |
# File 'lib/ec2list.rb', line 89 def tag name end |