Sha256: 947eab3a99663b0d4a2f7e2cf6412b28435147195c280dbebabe17f6f3a798ac

Contents?: true

Size: 925 Bytes

Versions: 8

Compression:

Stored size: 925 Bytes

Contents

require 'rackspace-fog/core/collection'
require 'rackspace-monitoring/monitoring/models/alarm'

module Fog
  module Monitoring
    class Rackspace
      class Alarms < Fog::Collection

        attribute :entity

        model Fog::Monitoring::Rackspace::Alarm

        def all
          requires :entity
          data = connection.list_alarms(entity.identity).body['values']
          load(data)
        end

        def get(alarm_id)
          requires :entity
          data = connection.get_alarm(entity.identity, alarm_id).body
          new(data)
        rescue Fog::Monitoring::Rackspace::NotFound
          nil
        end

        def new(attributes = {})
          requires :entity
          super({ :entity => entity }.merge!(attributes))
        end

        def create(attributes = {})
          requires :entity
          super({ :entity => entity }.merge!(attributes))
        end

      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
rackspace-monitoring-0.2.18 lib/rackspace-monitoring/monitoring/models/alarms.rb
rackspace-monitoring-0.2.15 lib/rackspace-monitoring/monitoring/models/alarms.rb
rackspace-monitoring-0.2.14 lib/rackspace-monitoring/monitoring/models/alarms.rb
rackspace-monitoring-0.2.13 lib/rackspace-monitoring/monitoring/models/alarms.rb
rackspace-monitoring-0.2.12 lib/rackspace-monitoring/monitoring/models/alarms.rb
rackspace-monitoring-0.2.11 lib/rackspace-monitoring/monitoring/models/alarms.rb
rackspace-monitoring-0.2.10 lib/rackspace-monitoring/monitoring/models/alarms.rb
rackspace-monitoring-0.2.9 lib/rackspace-monitoring/monitoring/models/alarms.rb