Sha256: 3d92911dd2a22cf8ede429fdbf31ebf63a4a09b51656b0a65ec45d445a539f2d

Contents?: true

Size: 915 Bytes

Versions: 14

Compression:

Stored size: 915 Bytes

Contents

require '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

14 entries across 14 versions & 1 rubygems

Version Path
rackspace-monitoring-0.2.8 lib/rackspace-monitoring/monitoring/models/alarms.rb
rackspace-monitoring-0.2.7 lib/rackspace-monitoring/monitoring/models/alarms.rb
rackspace-monitoring-0.2.6 lib/rackspace-monitoring/monitoring/models/alarms.rb
rackspace-monitoring-0.2.5 lib/rackspace-monitoring/monitoring/models/alarms.rb
rackspace-monitoring-0.2.4 lib/rackspace-monitoring/monitoring/models/alarms.rb
rackspace-monitoring-0.2.3 lib/rackspace-monitoring/monitoring/models/alarms.rb
rackspace-monitoring-0.2.2 lib/rackspace-monitoring/monitoring/models/alarms.rb
rackspace-monitoring-0.2.1 lib/rackspace-monitoring/monitoring/models/alarms.rb
rackspace-monitoring-0.2.0 lib/rackspace-monitoring/monitoring/models/alarms.rb
rackspace-monitoring-0.1.4 lib/rackspace-monitoring/monitoring/models/alarms.rb
rackspace-monitoring-0.1.3 lib/rackspace-monitoring/monitoring/models/alarms.rb
rackspace-monitoring-0.1.2 lib/rackspace-monitoring/monitoring/models/alarms.rb
rackspace-monitoring-0.1.1 lib/rackspace-monitoring/monitoring/models/alarms.rb
rackspace-monitoring-0.1.0 lib/rackspace-monitoring/monitoring/models/alarms.rb