Sha256: 62a39d01afcdc7d102a2f9dda3a7f9860df4ab85c65faa97c1e08e5f0030d130

Contents?: true

Size: 984 Bytes

Versions: 14

Compression:

Stored size: 984 Bytes

Contents

require '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

14 entries across 14 versions & 1 rubygems

Version Path
rackspace-monitoring-0.2.8 lib/rackspace-monitoring/monitoring/models/entities.rb
rackspace-monitoring-0.2.7 lib/rackspace-monitoring/monitoring/models/entities.rb
rackspace-monitoring-0.2.6 lib/rackspace-monitoring/monitoring/models/entities.rb
rackspace-monitoring-0.2.5 lib/rackspace-monitoring/monitoring/models/entities.rb
rackspace-monitoring-0.2.4 lib/rackspace-monitoring/monitoring/models/entities.rb
rackspace-monitoring-0.2.3 lib/rackspace-monitoring/monitoring/models/entities.rb
rackspace-monitoring-0.2.2 lib/rackspace-monitoring/monitoring/models/entities.rb
rackspace-monitoring-0.2.1 lib/rackspace-monitoring/monitoring/models/entities.rb
rackspace-monitoring-0.2.0 lib/rackspace-monitoring/monitoring/models/entities.rb
rackspace-monitoring-0.1.4 lib/rackspace-monitoring/monitoring/models/entities.rb
rackspace-monitoring-0.1.3 lib/rackspace-monitoring/monitoring/models/entities.rb
rackspace-monitoring-0.1.2 lib/rackspace-monitoring/monitoring/models/entities.rb
rackspace-monitoring-0.1.1 lib/rackspace-monitoring/monitoring/models/entities.rb
rackspace-monitoring-0.1.0 lib/rackspace-monitoring/monitoring/models/entities.rb