Class: OpsWorks::Instance

Inherits:
Resource show all
Defined in:
lib/opsworks/instance.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Resource

account, client, #initialize

Constructor Details

This class inherits a constructor from OpsWorks::Resource

Instance Attribute Details

#ec2_instance_idObject

Returns the value of attribute ec2_instance_id.



5
6
7
# File 'lib/opsworks/instance.rb', line 5

def ec2_instance_id
  @ec2_instance_id
end

#hostnameObject

Returns the value of attribute hostname.



5
6
7
# File 'lib/opsworks/instance.rb', line 5

def hostname
  @hostname
end

#idObject

Returns the value of attribute id.



5
6
7
# File 'lib/opsworks/instance.rb', line 5

def id
  @id
end

#instance_typeObject

Returns the value of attribute instance_type.



5
6
7
# File 'lib/opsworks/instance.rb', line 5

def instance_type
  @instance_type
end

#statusObject

Returns the value of attribute status.



5
6
7
# File 'lib/opsworks/instance.rb', line 5

def status
  @status
end

Class Method Details

.from_collection_response(response) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
# File 'lib/opsworks/instance.rb', line 7

def self.from_collection_response(response)
  response.data[:instances].map do |hash|
    new(
      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

#online?Boolean

Returns:

  • (Boolean)


19
20
21
# File 'lib/opsworks/instance.rb', line 19

def online?
  status == 'online'
end