Sha256: 6e2a68ed3a072f9792fb5bb01b21358cefa36d5931537b78a9e8df8a1e157768
Contents?: true
Size: 1.61 KB
Versions: 1
Compression:
Stored size: 1.61 KB
Contents
require 'fog/core/model' require 'rackspace-monitoring/monitoring/models/base' module Fog module Monitoring class Rackspace class Entity < Fog::Monitoring::Rackspace::Base identity :id attribute :label attribute :metadata attribute :ip_addresses attribute :agent_id attribute :managed, :default => false attribute :uri def prep options = { 'label' => label, 'metadata' => metadata, 'ip_addresses'=> ip_addresses, 'agent_id' => agent_id } options = options.reject {|key, value| value.nil?} options end def save options = prep if identity then data = connection.update_entity(identity, options) else data = connection.create_entity(options) end true end def checks @checks ||= begin Fog::Monitoring::Rackspace::Checks.new( :entity => self, :connection => connection ) end end def alarms @alarms ||= begin Fog::Monitoring::Rackspace::Alarms.new( :entity => self, :connection => connection ) end end def destroy requires :id connection.delete_entity(id) end def compare?(b) a_o = prep b_o = b.prep remain = a_o.reject {|key, value| b_o[key] === value} remain.empty? end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rackspace-monitoring-0.1.2 | lib/rackspace-monitoring/monitoring/models/entity.rb |