Class: EngineyardAPI::Instance

Inherits:
Object
  • Object
show all
Defined in:
lib/engineyard-api/instance.rb

Overview

Store information on instances

Instance Method Summary collapse

Constructor Details

#initialize(instance) ⇒ Instance

:nodoc:


4
5
6
7
8
# File 'lib/engineyard-api/instance.rb', line 4

def initialize(instance) # :nodoc:
  @instance = instance
  @logs = EngineyardAPI::API.get "/instances/#{@instance['id']}/logs"
  @alerts = EngineyardAPI::API.get "/instances/#{@instance['id']}/alerts"
end

Instance Method Details

#[](key) ⇒ Object

:nodoc:


49
50
51
# File 'lib/engineyard-api/instance.rb', line 49

def [](key) # :nodoc:
  @instance['key']
end

#alertsObject

Returns list of alerts as array


54
55
56
# File 'lib/engineyard-api/instance.rb', line 54

def alerts
  return @alerts['alerts']
end

#amazon_idObject

Return amazon ID


31
32
33
# File 'lib/engineyard-api/instance.rb', line 31

def amazon_id
  @instance['amazon_id']
end

#instance_idObject

Return internal ID


11
12
13
# File 'lib/engineyard-api/instance.rb', line 11

def instance_id
  @instance['id']
end

#logsObject

Returns list of log entries as array


46
47
48
# File 'lib/engineyard-api/instance.rb', line 46

def logs
  return @logs['logs']
end

#nameObject

Retruns instance nam


26
27
28
# File 'lib/engineyard-api/instance.rb', line 26

def name
  @instance['name']
end

#public_hostnameObject

Return instance public hostname


36
37
38
# File 'lib/engineyard-api/instance.rb', line 36

def public_hostname
  @instance['public_hostname']
end

#roleObject

Return instance role (i.e., app, utility, db, db_master, app_master


21
22
23
# File 'lib/engineyard-api/instance.rb', line 21

def role
  @instance['role']
end

#statusObject

Return instance status (i.e. :running, :error, etc)


16
17
18
# File 'lib/engineyard-api/instance.rb', line 16

def status
  @instance['status']
end

#zoneObject

Retruns instance zone


41
42
43
# File 'lib/engineyard-api/instance.rb', line 41

def zone
  @instance['availability_zone']
end