Sha256: 9c8ea2cbcf0cfeabd4c3c3881fda19aad952b3f633ed6d4cb93d0ca0058b9645

Contents?: true

Size: 1.38 KB

Versions: 17

Compression:

Stored size: 1.38 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.keys.include?(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

17 entries across 17 versions & 4 rubygems

Version Path
brightbox-cli-0.17.1 lib/brightbox-cli/vendor/fog/lib/fog/vcloud/requests/compute/configure_network_ip.rb
brightbox-cli-0.17.0 lib/brightbox-cli/vendor/fog/lib/fog/vcloud/requests/compute/configure_network_ip.rb
fog-1.1.2 lib/fog/vcloud/requests/compute/configure_network_ip.rb
fog_tractical-1.1.4 lib/fog/vcloud/requests/compute/configure_network_ip.rb
fog_tractical-1.1.3 lib/fog/vcloud/requests/compute/configure_network_ip.rb
brightbox-cli-0.16.0 lib/brightbox-cli/vendor/fog/lib/fog/vcloud/requests/compute/configure_network_ip.rb
fog-1.1.1 lib/fog/vcloud/requests/compute/configure_network_ip.rb
fog-1.1.0 lib/fog/vcloud/requests/compute/configure_network_ip.rb
brightbox-cli-0.15.0 lib/brightbox-cli/vendor/fog/lib/fog/vcloud/requests/compute/configure_network_ip.rb
tag-fog-1.0.1 lib/fog/vcloud/requests/compute/configure_network_ip.rb
brightbox-cli-0.14.1 lib/brightbox-cli/vendor/fog/lib/fog/vcloud/requests/compute/configure_network_ip.rb
brightbox-cli-0.14.0 lib/brightbox-cli/vendor/fog/lib/fog/vcloud/requests/compute/configure_network_ip.rb
fog-1.0.0 lib/fog/vcloud/requests/compute/configure_network_ip.rb
brightbox-cli-0.13.1 lib/brightbox-cli/vendor/fog/lib/fog/compute/requests/vcloud/configure_network_ip.rb
brightbox-cli-0.13.0 lib/brightbox-cli/vendor/fog/lib/fog/compute/requests/vcloud/configure_network_ip.rb
fog-0.11.0 lib/fog/compute/requests/vcloud/configure_network_ip.rb
fog-0.10.0 lib/fog/compute/requests/vcloud/configure_network_ip.rb