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


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

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

  load(data['values'])
end

#get(entity_id) ⇒ Object


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

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

#load_all(objects) ⇒ Object


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

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


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

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

  load_all(body['values'])
end