Sha256: dfd802d4c84c142b1e2bcc0c9213236e3e77a3cc9fdc8c170dc9bc9bb95e3f0c

Contents?: true

Size: 912 Bytes

Versions: 4

Compression:

Stored size: 912 Bytes

Contents

require 'fog/compute/models/vcloud/vdc'

module Fog
  module Vcloud
    class Compute

      class Vdcs < Collection

        model Fog::Vcloud::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
          @organization_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

4 entries across 4 versions & 2 rubygems

Version Path
brightbox-cli-0.13.1 lib/brightbox-cli/vendor/fog/lib/fog/compute/models/vcloud/vdcs.rb
brightbox-cli-0.13.0 lib/brightbox-cli/vendor/fog/lib/fog/compute/models/vcloud/vdcs.rb
fog-0.11.0 lib/fog/compute/models/vcloud/vdcs.rb
fog-0.10.0 lib/fog/compute/models/vcloud/vdcs.rb