# This is the data structure it accepts, this is the output of get_vm_disks
#
# {"type"=>"application/vnd.vmware.vcloud.guestCustomizationSection+xml",
# "href"=>
# "https://example.com/api/vApp/vm-2bbbf556-55dc-4974-82e6-aa6e814f0b64/guestCustomizationSection/",
# "id"=>"vm-2bbbf556-55dc-4974-82e6-aa6e814f0b64",
# "enabled"=>false,
# "change_sid"=>false,
# "virtual_machine_id"=>"2bbbf556-55dc-4974-82e6-aa6e814f0b64",
# "join_domain_enabled"=>false,
# "use_org_settings"=>false,
# "admin_password_enabled"=>false,
# "admin_password_auto"=>true,
# "reset_password_required"=>false,
# "customization_script"=>"hola\nmundo",
# "has_customization_script"=>true,
# "computer_name"=>"DEVWEB-001"}
#
# This is what it generates
#
#
# Specifies Guest OS Customization Settings
# true
# true
# 55cc91f2-7e12-48d4-ad90-6f637a51fd88
# false
# false
# true
# true
# false
# DEVWEB-001
#
#
module Fog
module Generators
module Compute
module VcloudDirector
class Customization
def initialize(attrs={})
@attrs = attrs
end
def generate_xml
output = ""
output << header
output << body(@attrs)
output << tail
output
end
def header
''
end
# the order maters http://communities.vmware.com/thread/448760?start=0&tstart=0
# http://www.vmware.com/support/vcd/doc/rest-api-doc-1.5-html/types/GuestCustomizationSectionType.html
# CustomizationScript
# Script to run on guest customization. You could use xml escape sequence
to make multiple lines script. The script could contain any UNICODE symbol by specifying its number in format xxx; where xxxx is the number. The predefined symbols in the XML are: * & & * < < * > > * " " * ' '
def body(opts={})
body = "
Specifies Guest OS Customization Settings
#{opts[:enabled]}
#{opts[:change_sid]}
#{opts[:virtual_machine_id]}
#{opts[:join_domain_enabled]}
#{opts[:use_org_settings]}
#{opts[:admin_password_enabled]}
#{opts[:admin_password_auto]}
#{opts[:reset_password_required]}
#{CGI::escapeHTML(opts[:customization_script]).gsub(/\r/, "
")}
#{opts[:computer_name]}"
end
def tail
''
end
end
end
end
end
end