Sha256: 71242e3c1cb08b25c272cb67a643e7ad0bda446b551c15f8b81c5dc69d53e2b4

Contents?: true

Size: 1.24 KB

Versions: 6

Compression:

Stored size: 1.24 KB

Contents

require 'fog/openstack/models/model'

module Fog
  module Monitoring
    class OpenStack
      class AlarmDefinition < Fog::OpenStack::Model
        identity :id

        attribute :links
        attribute :name
        attribute :description
        attribute :expression
        attribute :expression_data
        attribute :match_by
        attribute :severity
        attribute :actions_enabled
        attribute :alarm_actions
        attribute :ok_actions
        attribute :undetermined_actions

        def create
          requires :name, :expression
          merge_attributes(
            service.create_alarm_definition(attributes).body
          )
          self
        end

        def update(attr = nil)
          requires :name, :expression
          merge_attributes(
            service.update_alarm_definition(id, attr || attributes).body
          )
        end

        def patch(attr = nil)
          requires :id
          merge_attributes(
            service.patch_alarm_definition(id, attr || attributes).body
          )
          self
        end

        def destroy
          requires :id
          service.delete_alarm_definition(id)
          true
        end

        def to_s
          name
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
fog-openstack-0.1.12 lib/fog/monitoring/openstack/models/alarm_definition.rb
fog-openstack-0.1.11 lib/fog/monitoring/openstack/models/alarm_definition.rb
fog-openstack-0.1.10 lib/fog/openstack/models/monitoring/alarm_definition.rb
fog-openstack-0.1.9 lib/fog/openstack/models/monitoring/alarm_definition.rb
fog-openstack-0.1.8 lib/fog/openstack/models/monitoring/alarm_definition.rb
fog-openstack-0.1.7 lib/fog/openstack/models/monitoring/alarm_definition.rb