Sha256: 10b5dcef01d02fbd8db6d0ce0af8de55f246c0255a4df28e3c879348843e8369

Contents?: true

Size: 911 Bytes

Versions: 7

Compression:

Stored size: 911 Bytes

Contents

require 'fog/compute/models/ecloud/vdc'

module Fog
  module Ecloud
    class Compute

      class Vdcs < Collection

        model Fog::Ecloud::Compute::Vdc

        undef_method :create

        def all
          data = connection.get_organization(organization_uri).body[:Link].select { |link| link[:type] == "application/vnd.vmware.vcloud.vdc+xml" }
          data.each { |link| link.delete_if { |key, value| [:rel].include?(key) } }
          load(data)
        end

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

        def organization_uri
          @organizatio_uri ||= connection.default_organization_uri
        end

        private

        def organization_uri=(new_organization_uri)
          @organization_uri = new_organization_uri
        end

      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
fog-0.8.2 lib/fog/compute/models/ecloud/vdcs.rb
fog-0.8.1 lib/fog/compute/models/ecloud/vdcs.rb
fog-0.8.0 lib/fog/compute/models/ecloud/vdcs.rb
fog-0.7.2 lib/fog/compute/models/ecloud/vdcs.rb
fog-0.7.1 lib/fog/compute/models/ecloud/vdcs.rb
fog-0.7.0 lib/fog/compute/models/ecloud/vdcs.rb
fog-0.6.0 lib/fog/compute/models/ecloud/vdcs.rb