Sha256: 42eac3533f00bd9623a555df562f6470f34ccc37636f9a9a5973c7a8bee8632f

Contents?: true

Size: 994 Bytes

Versions: 6

Compression:

Stored size: 994 Bytes

Contents

require 'rackspace-fog/core/collection'
require 'rackspace-monitoring/monitoring/models/entity'
require 'rackspace-monitoring/monitoring/models/check'

module Fog
  module Monitoring
    class Rackspace
      class Entities < Fog::Collection

        model Fog::Monitoring::Rackspace::Entity

        def all
          data = connection.list_entities.body['values']
          load(data)
        end

        def get(entity_id)
          data = connection.get_entity(entity_id).body
          new(data)
        rescue Fog::Monitoring::Rackspace::NotFound
          nil
        end

        def overview
          data = connection.list_overview.body['values']
          loadAll(data)
        end

        def loadAll(objects)
          clear
          for object in objects
            en = new(object['entity'])
            self << en
            en.checks.load(object['checks'])
            en.alarms.load(object['alarms'])
          end
          self
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
rackspace-monitoring-0.2.14 lib/rackspace-monitoring/monitoring/models/entities.rb
rackspace-monitoring-0.2.13 lib/rackspace-monitoring/monitoring/models/entities.rb
rackspace-monitoring-0.2.12 lib/rackspace-monitoring/monitoring/models/entities.rb
rackspace-monitoring-0.2.11 lib/rackspace-monitoring/monitoring/models/entities.rb
rackspace-monitoring-0.2.10 lib/rackspace-monitoring/monitoring/models/entities.rb
rackspace-monitoring-0.2.9 lib/rackspace-monitoring/monitoring/models/entities.rb