Sha256: 61954f47239f2fc501e50071b768683982a5abda4a7d438807f2b3244cafab43

Contents?: true

Size: 1.43 KB

Versions: 43

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

43 entries across 41 versions & 6 rubygems

Version Path
fog-2.3.0 lib/fog/vcloud/requests/compute/configure_vm_network.rb
fog-ifeel-2.2.0 lib/fog/vcloud/requests/compute/configure_vm_network.rb
fog-2.2.0 lib/fog/vcloud/requests/compute/configure_vm_network.rb
fog-2.1.0 lib/fog/vcloud/requests/compute/configure_vm_network.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.4.0/gems/fog-1.42.1/lib/fog/vcloud/requests/compute/configure_vm_network.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.3.0/gems/fog-1.42.1/lib/fog/vcloud/requests/compute/configure_vm_network.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.5.0/gems/fog-1.42.1/lib/fog/vcloud/requests/compute/configure_vm_network.rb
fog-1.42.1 lib/fog/vcloud/requests/compute/configure_vm_network.rb
fog-2.0.0 lib/fog/vcloud/requests/compute/configure_vm_network.rb
fog-1.42.0 lib/fog/vcloud/requests/compute/configure_vm_network.rb
fog-1.41.0 lib/fog/vcloud/requests/compute/configure_vm_network.rb
fog-1.40.0 lib/fog/vcloud/requests/compute/configure_vm_network.rb
fog-1.39.0 lib/fog/vcloud/requests/compute/configure_vm_network.rb
fog-1.38.0 lib/fog/vcloud/requests/compute/configure_vm_network.rb
fog-1.37.0 lib/fog/vcloud/requests/compute/configure_vm_network.rb
fog-1.36.0 lib/fog/vcloud/requests/compute/configure_vm_network.rb
fog-1.35.0 lib/fog/vcloud/requests/compute/configure_vm_network.rb
fog-2.0.0.pre.0 lib/fog/vcloud/requests/compute/configure_vm_network.rb
vagrant-cloudstack-1.2.0 vendor/bundle/gems/fog-1.32.0/lib/fog/vcloud/requests/compute/configure_vm_network.rb
fog-1.34.0 lib/fog/vcloud/requests/compute/configure_vm_network.rb