Sha256: 41e359e350cc4374a181c341c17d40b150417883e4cea0f1ec22d2a662ee66d4

Contents?: true

Size: 855 Bytes

Versions: 8

Compression:

Stored size: 855 Bytes

Contents

module Fog
  module Vcloud
    module Terremark
      module Ecloud

        class Servers < Fog::Vcloud::Collection

          model Fog::Vcloud::Terremark::Ecloud::Server

          attribute :href, :aliases => :Href

          def all
            load(_vapps)
          end

          def get(uri)
            if data = connection.get_vapp(uri)
              new(data.body)
            end
          rescue Fog::Errors::NotFound
            nil
          end

          private

          def _resource_entities
            connection.get_vdc(href).body[:ResourceEntities][:ResourceEntity]
          end

          def _vapps
            resource_entities = _resource_entities
            if resource_entities.nil?
              []
            else
              resource_entities
            end
          end

        end
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
fog-0.2.8 lib/fog/vcloud/terremark/ecloud/models/servers.rb
fog-0.2.7 lib/fog/vcloud/terremark/ecloud/models/servers.rb
fog-0.2.6 lib/fog/vcloud/terremark/ecloud/models/servers.rb
fog-0.2.5 lib/fog/vcloud/terremark/ecloud/models/servers.rb
fog-0.2.4 lib/fog/vcloud/terremark/ecloud/models/servers.rb
fog-0.2.3 lib/fog/vcloud/terremark/ecloud/models/servers.rb
fog-0.2.2 lib/fog/vcloud/terremark/ecloud/models/servers.rb
fog-0.2.1 lib/fog/vcloud/terremark/ecloud/models/servers.rb