Sha256: 72031f0afd1a3b60afaa8bf9213af6e64500281c6c1126e37f2696ae7d04a204

Contents?: true

Size: 1.98 KB

Versions: 19

Compression:

Stored size: 1.98 KB

Contents

module Fog
  module Parsers
    module Compute
      module VcloudDirector

        class VmCustomization < VcloudDirectorParser

          def reset
            @response = { }
          end

          def start_element(name, attributes)
            super
            case name
            when 'GuestCustomizationSection'
              customizations = extract_attributes(attributes)
              @response[:href] = customizations[:href]
              @response[:type] = customizations[:type]
              # href looks like this:
              #  "https://example.com/api/vApp/vm-2bbbf556-55dc-4974-82e6-aa6e814f0b64/guestCustomizationSection/"
              @response[:id] = @response[:href].split('/')[-2]
            end
          end

          def end_element(name)
            case name
            when 'Enabled'
              @response[:enabled] = (value == "true")
            when 'ChangeSid'
              @response[:change_sid] = (value == "true")
            when 'JoinDomainEnabled'
              @response[:join_domain_enabled] = (value == "true")
            when 'UseOrgSettings'
              @response[:use_org_settings] = (value == "true")
            when 'AdminPassword'
              @response[:admin_password] = value
            when 'AdminPasswordEnabled'
              @response[:admin_password_enabled] = (value == "true")
            when 'AdminPasswordAuto'
              @response[:admin_password_auto] = (value == "true")
            when 'ResetPasswordRequired'
              @response[:reset_password_required] = (value == "true")
            when 'VirtualMachineId'
              @response[:virtual_machine_id] = value
            when 'ComputerName'
              @response[:computer_name] = value
            when 'CustomizationScript'
              @response[:has_customization_script] = !value.empty?
              @response[:customization_script] = CGI::unescapeHTML(value) if @response[:has_customization_script]
            end
          end

        end

      end
    end
  end
end

Version data entries

19 entries across 19 versions & 2 rubygems

Version Path
fog-1.22.0 lib/fog/vcloud_director/parsers/compute/vm_customization.rb
fog-1.21.0 lib/fog/vcloud_director/parsers/compute/vm_customization.rb
fog-maestrodev-1.20.0.20140305101839 lib/fog/vcloud_director/parsers/compute/vm_customization.rb
fog-maestrodev-1.20.0.20140305101305 lib/fog/vcloud_director/parsers/compute/vm_customization.rb
fog-maestrodev-1.19.0.20140212012611 lib/fog/vcloud_director/parsers/compute/vm_customization.rb
fog-1.20.0 lib/fog/vcloud_director/parsers/compute/vm_customization.rb
fog-maestrodev-1.19.0.20140110004459 lib/fog/vcloud_director/parsers/compute/vm_customization.rb
fog-maestrodev-1.19.0.20140110003812 lib/fog/vcloud_director/parsers/compute/vm_customization.rb
fog-maestrodev-1.19.0.20140109202555 lib/fog/vcloud_director/parsers/compute/vm_customization.rb
fog-maestrodev-1.19.0.20140107192102 lib/fog/vcloud_director/parsers/compute/vm_customization.rb
fog-maestrodev-1.19.0.20140107142106 lib/fog/vcloud_director/parsers/compute/vm_customization.rb
fog-maestrodev-1.19.0.20131219203941 lib/fog/vcloud_director/parsers/compute/vm_customization.rb
fog-maestrodev-1.18.0.20131219193542 lib/fog/vcloud_director/parsers/compute/vm_customization.rb
fog-1.19.0 lib/fog/vcloud_director/parsers/compute/vm_customization.rb
fog-maestrodev-1.18.0.20131219033443 lib/fog/vcloud_director/parsers/compute/vm_customization.rb
fog-maestrodev-1.18.0.20131219032002 lib/fog/vcloud_director/parsers/compute/vm_customization.rb
fog-maestrodev-1.18.0.20131219030716 lib/fog/vcloud_director/parsers/compute/vm_customization.rb
fog-maestrodev-1.18.0.20131219022322 lib/fog/vcloud_director/parsers/compute/vm_customization.rb
fog-maestrodev-1.18.0.20131218202447 lib/fog/vcloud_director/parsers/compute/vm_customization.rb