Class: Fog::Monitoring::OpenStack::Alarms

Inherits:
OpenStack::Collection show all
Defined in:
lib/fog/monitoring/openstack/models/alarms.rb

Instance Attribute Summary

Attributes inherited from OpenStack::Collection

#response

Instance Method Summary collapse

Methods inherited from OpenStack::Collection

#get, #load_response, #summary

Instance Method Details

#all(options = {}) ⇒ Object



10
11
12
# File 'lib/fog/monitoring/openstack/models/alarms.rb', line 10

def all(options = {})
  load_response(service.list_alarms(options), 'elements')
end

#destroy(id) ⇒ Object



23
24
25
26
# File 'lib/fog/monitoring/openstack/models/alarms.rb', line 23

def destroy(id)
  alarm = find_by_id(id)
  alarm.destroy
end

#find_by_id(id) ⇒ Object



14
15
16
17
18
19
20
21
# File 'lib/fog/monitoring/openstack/models/alarms.rb', line 14

def find_by_id(id)
  cached_alarm = detect { |alarm| alarm.id == id }
  return cached_alarm if cached_alarm
  alarm_hash = service.get_alarm(id).body
  Fog::Monitoring::OpenStack::Alarm.new(
    alarm_hash.merge(:service => service)
  )
end