Sha256: 9551122892eeb5e9a1d58ecb8f5adda0fac658692871966d2e773f8450643af7

Contents?: true

Size: 1.43 KB

Versions: 60

Compression:

Stored size: 1.43 KB

Contents

# -*- encoding: utf-8 -*-
module Fog
  module Vcloud
    class Compute
      class Real

        def configure_vm_network(network_info)
          edit_uri = network_info.select {|k,v| k == :Link && v[:rel] == 'edit'}
          edit_uri = edit_uri.kind_of?(Array) ? edit_uri.flatten[1][:href] : edit_uri[:Link][:href]

          body = <<EOF
            <NetworkConnectionSection xmlns="http://www.vmware.com/vcloud/v1.5" xmlns:ovf="http://schemas.dmtf.org/ovf/envelope/1" type="application/vnd.vmware.vcloud.networkConnectionSection+xml" href="#{edit_uri}">
              <ovf:Info>Specifies the available VM network connections</ovf:Info>
              <PrimaryNetworkConnectionIndex>0</PrimaryNetworkConnectionIndex>
              <NetworkConnection network="#{network_info[:NetworkConnection][:network]}" needsCustomization="true">
                <NetworkConnectionIndex>0</NetworkConnectionIndex>
                <IsConnected>true</IsConnected>
                <IpAddressAllocationMode>#{network_info[:NetworkConnection][:IpAddressAllocationMode]}</IpAddressAllocationMode>
              </NetworkConnection>
            </NetworkConnectionSection>
EOF
          request(
            :body     => body,
            :expects  => 202,
            :headers  => {'Content-Type' => network_info[:"type"] },
            :method   => 'PUT',
            :uri      => "#{edit_uri}",
            :parse    => true
          )
        end

      end

    end
  end
end

Version data entries

60 entries across 60 versions & 6 rubygems

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