Class: Fog::Rackspace::Monitoring::Entities

Inherits:
Collection
  • Object
show all
Defined in:
lib/fog/rackspace/models/monitoring/entities.rb

Instance Method Summary collapse

Instance Method Details

#all(options = {}) ⇒ Object



14
15
16
17
18
19
# File 'lib/fog/rackspace/models/monitoring/entities.rb', line 14

def all(options={})
  data = service.list_entities(options).body
  self.marker = data['metadata']['next_marker']

  load(data['values'])
end

#get(entity_id) ⇒ Object



21
22
23
24
25
26
# File 'lib/fog/rackspace/models/monitoring/entities.rb', line 21

def get(entity_id)
  data = service.get_entity(entity_id).body
  new(data)
rescue Fog::Rackspace::Monitoring::NotFound
  nil
end

#load_all(objects) ⇒ Object



35
36
37
38
39
40
41
42
43
44
# File 'lib/fog/rackspace/models/monitoring/entities.rb', line 35

def load_all(objects)
  clear
  for object in objects
    en = new(object['entity'])
    self << en
    en.checks.load(object['checks'])
    en.alarms.load(object['alarms'])
  end
  self
end

#overview(options = {}) ⇒ Object



28
29
30
31
32
33
# File 'lib/fog/rackspace/models/monitoring/entities.rb', line 28

def overview(options={})
  body = service.list_overview(options).body
  marker = body['metadata']['next_marker']

  load_all(body['values'])
end