Class: Aerosol::Instance
- Inherits:
-
Object
show all
- Includes:
- AWSModel
- Defined in:
- lib/aerosol/instance.rb
Class Method Summary
collapse
Instance Method Summary
collapse
Methods included from AWSModel
#create, #default_identifier, #destroy, #exists?, included, #initialize, #namespaced_name
Class Method Details
.request_all ⇒ Object
53
54
55
56
57
58
59
60
61
62
63
64
|
# File 'lib/aerosol/instance.rb', line 53
def self.request_all
next_token = nil
instances = []
begin
new_instances = request_all_for_token(next_token)
instances.concat(new_instances.auto_scaling_instances)
next_token = new_instances.next_token
end until next_token.nil?
instances
end
|
.request_all_for_token(next_token) ⇒ Object
48
49
50
51
|
# File 'lib/aerosol/instance.rb', line 48
def self.request_all_for_token(next_token)
options = next_token.nil? ? {} : { next_token: next_token }
Aerosol::AWS.auto_scaling.describe_auto_scaling_instances(options)
end
|
Instance Method Details
#address ⇒ Object
32
33
34
35
36
37
38
|
# File 'lib/aerosol/instance.rb', line 32
def address
if public_hostname.blank?
private_ip_address
else
public_hostname
end
end
|
#description ⇒ Object
44
45
46
|
# File 'lib/aerosol/instance.rb', line 44
def description
@description ||= describe!
end
|
#image_id ⇒ Object
40
41
42
|
# File 'lib/aerosol/instance.rb', line 40
def image_id
description[:image_id]
end
|
#instance_state_name ⇒ Object
20
21
22
|
# File 'lib/aerosol/instance.rb', line 20
def instance_state_name
description[:state][:name]
end
|
#live? ⇒ Boolean
15
16
17
18
|
# File 'lib/aerosol/instance.rb', line 15
def live?
describe_again
instance_state_name == 'running'
end
|
#private_ip_address ⇒ Object
28
29
30
|
# File 'lib/aerosol/instance.rb', line 28
def private_ip_address
description[:private_ip_address]
end
|
#public_hostname ⇒ Object
24
25
26
|
# File 'lib/aerosol/instance.rb', line 24
def public_hostname
description[:public_dns_name]
end
|