Sha256: ef7e34d203dace24e375ba39887aa0318ae9b0b5c3e5e42ba7491b252470f584

Contents?: true

Size: 1.03 KB

Versions: 2

Compression:

Stored size: 1.03 KB

Contents

require 'fog/vcloud_director/models/compute/vapp_template'

module Fog
  module VcloudDirector
    class Compute
      class VappTemplates < Collection

        include Fog::VcloudDirector::Query

        model Fog::VcloudDirector::Compute::VappTemplate

        attribute :vdc

        def query_type
          "vAppTemplate"
        end

        private

        def get_by_id(item_id)
          item = service.get_vapp_template(item_id).body
          %w(:Link).each {|key_to_delete| item.delete(key_to_delete) }
          service.add_id_from_href!(item)
          item[:Description] ||= ""
          item
        end

        def item_list
          data = service.get_vdc(vdc.id).body
          return [] if data[:ResourceEntities].empty?
          resource_entities = data[:ResourceEntities][:ResourceEntity]
          items = resource_entities.select { |link| link[:type] == "application/vnd.vmware.vcloud.vAppTemplate+xml" }
          items.each{|item| service.add_id_from_href!(item) }
          items
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
fog-vcloud-director-0.3.1 lib/fog/vcloud_director/models/compute/vapp_templates.rb
fog-vcloud-director-0.3.0 lib/fog/vcloud_director/models/compute/vapp_templates.rb