Class: Fog::Monitoring::OpenStack::AlarmDefinitions

Inherits:
OpenStack::Collection show all
Defined in:
lib/fog/monitoring/openstack/models/alarm_definitions.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


22
23
24
# File 'lib/fog/monitoring/openstack/models/alarm_definitions.rb', line 22

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

#create(attributes) ⇒ Object


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

def create(attributes)
  super(attributes)
end

#destroy(id) ⇒ Object


35
36
37
38
# File 'lib/fog/monitoring/openstack/models/alarm_definitions.rb', line 35

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

#find_by_id(id) ⇒ Object


26
27
28
29
30
31
32
33
# File 'lib/fog/monitoring/openstack/models/alarm_definitions.rb', line 26

def find_by_id(id)
  cached_alarm_definition = detect { |alarm_definition| alarm_definition.id == id }
  return cached_alarm_definition if cached_alarm_definition
  alarm_definition_hash = service.get_alarm_definition(id).body
  Fog::Monitoring::OpenStack::AlarmDefinition.new(
    alarm_definition_hash.merge(:service => service)
  )
end

#patch(attributes) ⇒ Object


18
19
20
# File 'lib/fog/monitoring/openstack/models/alarm_definitions.rb', line 18

def patch(attributes)
  super(attributes)
end

#update(attributes) ⇒ Object


14
15
16
# File 'lib/fog/monitoring/openstack/models/alarm_definitions.rb', line 14

def update(attributes)
  super(attributes)
end