Class: OpsWorks::Instance
Constant Summary collapse
- FATAL_STATUSES =
%w( connection_lost setup_failed start_failed stop_failed ).freeze
- SETTLED_STATUSES =
( FATAL_STATUSES + %w(online stopped terminated) ).freeze
Instance Attribute Summary collapse
-
#ec2_instance_id ⇒ Object
Returns the value of attribute ec2_instance_id.
-
#hostname ⇒ Object
Returns the value of attribute hostname.
-
#id ⇒ Object
Returns the value of attribute id.
-
#instance_type ⇒ Object
Returns the value of attribute instance_type.
-
#status ⇒ Object
Returns the value of attribute status.
Attributes inherited from Resource
Class Method Summary collapse
Instance Method Summary collapse
Methods inherited from Resource
Constructor Details
This class inherits a constructor from OpsWorks::Resource
Instance Attribute Details
#ec2_instance_id ⇒ Object
Returns the value of attribute ec2_instance_id.
3 4 5 |
# File 'lib/opsworks/instance.rb', line 3 def ec2_instance_id @ec2_instance_id end |
#hostname ⇒ Object
Returns the value of attribute hostname.
3 4 5 |
# File 'lib/opsworks/instance.rb', line 3 def hostname @hostname end |
#id ⇒ Object
Returns the value of attribute id.
3 4 5 |
# File 'lib/opsworks/instance.rb', line 3 def id @id end |
#instance_type ⇒ Object
Returns the value of attribute instance_type.
3 4 5 |
# File 'lib/opsworks/instance.rb', line 3 def instance_type @instance_type end |
#status ⇒ Object
Returns the value of attribute status.
3 4 5 |
# File 'lib/opsworks/instance.rb', line 3 def status @status end |
Class Method Details
.from_collection_response(client, response) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/opsworks/instance.rb', line 13 def self.from_collection_response(client, response) response.data[:instances].map do |hash| new( client, id: hash[:instance_id], hostname: hash[:hostname], ec2_instance_id: hash[:ec2_instance_id], instance_type: hash[:instance_type], status: hash[:status] ) end end |
Instance Method Details
#fatal? ⇒ Boolean
34 35 36 |
# File 'lib/opsworks/instance.rb', line 34 def fatal? FATAL_STATUSES.include?(status) end |
#online? ⇒ Boolean
26 27 28 |
# File 'lib/opsworks/instance.rb', line 26 def online? status == 'online' end |
#settled? ⇒ Boolean
38 39 40 |
# File 'lib/opsworks/instance.rb', line 38 def settled? SETTLED_STATUSES.include?(status) end |
#setup_failed? ⇒ Boolean
30 31 32 |
# File 'lib/opsworks/instance.rb', line 30 def setup_failed? status == 'setup_failed' end |