Class: Fog::Rackspace::Monitoring::Check
- Defined in:
- lib/fog/rackspace/models/monitoring/check.rb
Instance Method Summary collapse
- #destroy ⇒ Object
- #entity=(obj) ⇒ Object
- #metrics ⇒ Object
- #params(options = {}) ⇒ Object
- #save ⇒ Object
Methods inherited from Base
Instance Method Details
#destroy ⇒ Object
56 57 58 59 |
# File 'lib/fog/rackspace/models/monitoring/check.rb', line 56 def destroy requires :id service.delete_check(entity.id, id) end |
#entity=(obj) ⇒ Object
23 24 25 |
# File 'lib/fog/rackspace/models/monitoring/check.rb', line 23 def entity=(obj) attributes[:entity] = obj.is_a?(String) ? Entity.new(:id => obj) : obj end |
#metrics ⇒ Object
61 62 63 64 65 66 67 68 |
# File 'lib/fog/rackspace/models/monitoring/check.rb', line 61 def metrics @metrics ||= begin Fog::Rackspace::Monitoring::Metrics.new( :check => self, :service => service ) end end |
#params(options = {}) ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/fog/rackspace/models/monitoring/check.rb', line 27 def params(={}) h = { 'label' => label, 'metadata' => , 'target_alias'=> target_alias, 'target_resolver' => target_resolver, 'target_hostname' => target_hostname, 'period' => period, 'timeout'=> timeout, 'details'=> details, 'monitoring_zones_poll'=> monitoring_zones_poll, 'disabled'=> disabled }.merge() h.reject {|key, value| value.nil?} end |
#save ⇒ Object
44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/fog/rackspace/models/monitoring/check.rb', line 44 def save if identity data = service.update_check(entity.id, identity, params) else requires :type = params('type' => type) data = service.create_check(entity.id, ) self.id = data.headers['X-Object-ID'] end true end |