Sha256: 4f3e81290910bb7fae504629eb1c43a132233bb83bcc7419da49f393c6cfeb29

Contents?: true

Size: 1.37 KB

Versions: 91

Compression:

Stored size: 1.37 KB

Contents

module Fog
  module Vcloud
    class Compute
      module Shared
        private

        def validate_network_ip_data(network_ip_data)
          valid_opts = [:id, :href, :name, :status, :server]
          unless valid_opts.all? { |opt| network_ip_data.has_key?(opt) }
            raise ArgumentError.new("Required data missing: #{(valid_opts - network_ip_data.keys).map(&:inspect).join(", ")}")
          end
        end
      end

      class Real
        include Shared

        def configure_network_ip(network_ip_uri, network_ip_data)
          validate_network_ip_data(network_ip_data)

          request(
            :body     => generate_configure_network_ip_request(network_ip_data),
            :expects  => 200,
            :headers  => {'Content-Type' => 'application/vnd.vmware.vcloud.ip+xml' },
            :method   => 'PUT',
            :uri      => network_ip_uri,
            :parse    => true
          )
        end

        private

        def generate_configure_network_ip_request(network_ip_data)
          builder = Builder::XmlMarkup.new
          builder.IpAddress(xmlns) {
            builder.Id(network_ip_data[:id])
            builder.Href(network_ip_data[:href])
            builder.Name(network_ip_data[:name])
            builder.Status(network_ip_data[:status])
            builder.Server(network_ip_data[:server])
          }
        end
      end
    end
  end
end

Version data entries

91 entries across 91 versions & 16 rubygems

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