Class: AWS::EC2::Instance
- Inherits:
-
Object
- Object
- AWS::EC2::Instance
- Defined in:
- lib/instance.rb
Instance Attribute Summary collapse
-
#connection ⇒ Object
Returns the value of attribute connection.
-
#dns ⇒ Object
Returns the value of attribute dns.
-
#instance_id ⇒ Object
Returns the value of attribute instance_id.
-
#launch_time ⇒ Object
Returns the value of attribute launch_time.
-
#status ⇒ Object
Returns the value of attribute status.
-
#tags ⇒ Object
Returns the value of attribute tags.
Instance Method Summary collapse
-
#initialize(init_hash = {}) ⇒ Instance
constructor
A new instance of Instance.
- #match?(tag) ⇒ Boolean
-
#self_destruct ⇒ Object
If connection available, terminate self.
Constructor Details
#initialize(init_hash = {}) ⇒ Instance
Returns a new instance of Instance.
8 9 10 11 12 |
# File 'lib/instance.rb', line 8 def initialize(init_hash = {}) init_hash.each do |k, v| self.send(k.to_s + "=", v) unless !self.respond_to?(k.to_s + "=") end end |
Instance Attribute Details
#connection ⇒ Object
Returns the value of attribute connection.
5 6 7 |
# File 'lib/instance.rb', line 5 def connection @connection end |
#dns ⇒ Object
Returns the value of attribute dns.
6 7 8 |
# File 'lib/instance.rb', line 6 def dns @dns end |
#instance_id ⇒ Object
Returns the value of attribute instance_id.
6 7 8 |
# File 'lib/instance.rb', line 6 def instance_id @instance_id end |
#launch_time ⇒ Object
Returns the value of attribute launch_time.
6 7 8 |
# File 'lib/instance.rb', line 6 def launch_time @launch_time end |
#status ⇒ Object
Returns the value of attribute status.
6 7 8 |
# File 'lib/instance.rb', line 6 def status @status end |
#tags ⇒ Object
Returns the value of attribute tags.
6 7 8 |
# File 'lib/instance.rb', line 6 def @tags end |
Instance Method Details
#match?(tag) ⇒ Boolean
14 15 16 |
# File 'lib/instance.rb', line 14 def match?(tag) self..detect {|h| h.detect { |k, v| v.to_s.match /#{tag}/ } } end |
#self_destruct ⇒ Object
If connection available, terminate self.
21 22 23 24 25 |
# File 'lib/instance.rb', line 21 def self_destruct raise "No Connection Associated With This Instance." unless !@connection.nil? @connection.terminate_instances(:instance_id => self.instance_id) # Have a Nice Day. end |