Class: Fog::Rackspace::Monitoring::Entity

Inherits:
Base
  • Object
show all
Defined in:
lib/fog/rackspace/models/monitoring/entity.rb

Instance Method Summary collapse

Methods inherited from Base

#compare?, #hash

Instance Method Details

#alarmsObject



46
47
48
49
50
51
52
53
# File 'lib/fog/rackspace/models/monitoring/entity.rb', line 46

def alarms
  @alarms ||= begin
    Fog::Rackspace::Monitoring::Alarms.new(
      :entity     => self,
      :service => service
    )
  end
end

#checksObject



37
38
39
40
41
42
43
44
# File 'lib/fog/rackspace/models/monitoring/entity.rb', line 37

def checks
  @checks ||= begin
    Fog::Rackspace::Monitoring::Checks.new(
      :entity     => self,
      :service => service
    )
  end
end

#destroyObject



55
56
57
58
# File 'lib/fog/rackspace/models/monitoring/entity.rb', line 55

def destroy
  requires :id
  service.delete_entity(id)
end

#paramsObject



17
18
19
20
21
22
23
24
25
# File 'lib/fog/rackspace/models/monitoring/entity.rb', line 17

def params
  options = {
    'label'       => label,
    'metadata'    => ,
    'ip_addresses'=> ip_addresses,
    'agent_id'    => agent_id
  }
  options.reject {|key, value| value.nil?}
end

#saveObject



27
28
29
30
31
32
33
34
35
# File 'lib/fog/rackspace/models/monitoring/entity.rb', line 27

def save
  if identity
    data = service.update_entity(identity, params)
  else
    data = service.create_entity(params)
    self.id = data.headers['X-Object-ID']
  end
  true
end