Sha256: 9a59063e7c2c5aeceb5eb5c96d0877b80b0209c9078e4eee6e47e9d4891b63c3

Contents?: true

Size: 948 Bytes

Versions: 4

Compression:

Stored size: 948 Bytes

Contents

require 'fog/core/model'
require 'rackspace-monitoring/monitoring/models/base'

module Fog
  module Monitoring
    class Rackspace
      class Alarm < Fog::Monitoring::Rackspace::Base

        identity :id
        attribute :entity

        attribute :label
        attribute :criteria
        attribute :check_type
        attribute :check_id
        attribute :notification_plan_id

        def save
          raise Fog::Errors::Error.new('Update not implemented yet.') if identity
          requires :notification_plan_id
          requires :entity
          options = {
            'label'       => label,
            'criteria'    => criteria,
            'check_type'  => check_type,
            'check_id'    => check_id,
          }
          options = options.reject {|key, value| value.nil?}
          data = connection.create_alarm(entity.identity, notification_plan_id, options)
          true
        end

      end

    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rackspace-monitoring-0.1.3 lib/rackspace-monitoring/monitoring/models/alarm.rb
rackspace-monitoring-0.1.2 lib/rackspace-monitoring/monitoring/models/alarm.rb
rackspace-monitoring-0.1.1 lib/rackspace-monitoring/monitoring/models/alarm.rb
rackspace-monitoring-0.1.0 lib/rackspace-monitoring/monitoring/models/alarm.rb