Sha256: ec6b172324673dd00cf4b5e668ef6cab3ed75fc3bb69321cd573512213e6fe44

Contents?: true

Size: 717 Bytes

Versions: 2

Compression:

Stored size: 717 Bytes

Contents

module Fog
  module Compute
    module Terremark
      class Servers < Fog::Collection
        model Fog::Compute::Terremark::Server

        def all
          data = []
          service.get_vdc(vdc_id).body['ResourceEntities'].select do |entity|
            data << service.servers.get(entity["href"].split('/').last)
          end
          data
        end

        def get(server_id)
          if server_id
            new(service.get_vapp(server_id).body)
          else
            nil
          end
        end

        def vdc_id
          @vdc_id ||= service.default_vdc_id
        end

        private

        def vdc_id=(new_vdc_id)
          @vdc_id = new_vdc_id
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
fog-terremark-0.0.2 lib/fog/compute/terremark/models/servers.rb
fog-terremark-0.0.1 lib/fog/compute/terremark/models/servers.rb