Sha256: 4831e47ab33fe3bb8256aa501079cad5f0edf684e0ad7f5480b4ddaafe6dbf89

Contents?: true

Size: 1.9 KB

Versions: 20

Compression:

Stored size: 1.9 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 '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

20 entries across 20 versions & 2 rubygems

Version Path
fog-maestrodev-1.18.0.20131209091424 lib/fog/vcloud_director/parsers/compute/vm_customization.rb
fog-maestrodev-1.18.0.20131209090811 lib/fog/vcloud_director/parsers/compute/vm_customization.rb
fog-maestrodev-1.18.0.20131206115947 lib/fog/vcloud_director/parsers/compute/vm_customization.rb
fog-maestrodev-1.18.0.20131205181604 lib/fog/vcloud_director/parsers/compute/vm_customization.rb
fog-maestrodev-1.18.0.20131127194823 lib/fog/vcloud_director/parsers/compute/vm_customization.rb
fog-maestrodev-1.18.0.20131126183714 lib/fog/vcloud_director/parsers/compute/vm_customization.rb
fog-maestrodev-1.18.0.20131126122111 lib/fog/vcloud_director/parsers/compute/vm_customization.rb
fog-maestrodev-1.18.0.20131125111730 lib/fog/vcloud_director/parsers/compute/vm_customization.rb
fog-maestrodev-1.18.0.20131125083406 lib/fog/vcloud_director/parsers/compute/vm_customization.rb
fog-maestrodev-1.18.0.20131123105121 lib/fog/vcloud_director/parsers/compute/vm_customization.rb
fog-maestrodev-1.18.0.20131122203507 lib/fog/vcloud_director/parsers/compute/vm_customization.rb
fog-maestrodev-1.18.0.20131121075022 lib/fog/vcloud_director/parsers/compute/vm_customization.rb
fog-maestrodev-1.18.0.20131118164830 lib/fog/vcloud_director/parsers/compute/vm_customization.rb
fog-maestrodev-1.18.0.20131115184302 lib/fog/vcloud_director/parsers/compute/vm_customization.rb
fog-maestrodev-1.18.0.20131114200144 lib/fog/vcloud_director/parsers/compute/vm_customization.rb
fog-maestrodev-1.18.0.20131112185232 lib/fog/vcloud_director/parsers/compute/vm_customization.rb
fog-maestrodev-1.18.0.20131111203459 lib/fog/vcloud_director/parsers/compute/vm_customization.rb
fog-1.18.0 lib/fog/vcloud_director/parsers/compute/vm_customization.rb
fog-1.17.0 lib/fog/vcloud_director/parsers/compute/vm_customization.rb
fog-1.16.0 lib/fog/vcloud_director/parsers/compute/vm_customization.rb