Sha256: 5d3bad7a4ff16ee9bfd54c4a9730452d232f5887c256260379b83f875dbee9a9

Contents?: true

Size: 998 Bytes

Versions: 2

Compression:

Stored size: 998 Bytes

Contents

module Fog
  module VcloudDirector
    module Generators
      module Compute
        # @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/types/VmType.html
        class Vm
          attr_reader :attrs

          def initialize(attrs={})
            @attrs = attrs
          end

          def generate_xml
            attrs = @attrs
            Nokogiri::XML::Builder.new do
              Vm('xmlns' => 'http://www.vmware.com/vcloud/v1.5', 'name' => attrs[:name]) {
                Description attrs[:Description] if attrs.key?(:Description)
                if  attrs.key?(:StorageProfile)
                  StorageProfile(
                    'type' => 'application/vnd.vmware.vcloud.vdcStorageProfile+xml',
                    'name' => attrs[:StorageProfile][:name],
                    'href' => attrs[:StorageProfile][:href]
                  )
                end
              }
            end.to_xml
          end
        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/generators/compute/vm.rb
fog-vcloud-director-0.3.0 lib/fog/vcloud_director/generators/compute/vm.rb