Sha256: 40dd4c299b53a765c25b1f57ef101762cc96899506dd7585b77a30730a91e1a1

Contents?: true

Size: 1.75 KB

Versions: 33

Compression:

Stored size: 1.75 KB

Contents

module Fog
  class Vcloud
    module Terremark
      class Ecloud
        class Real

          def validate_network_ip_data(network_ip_data, configure=false)
            valid_opts = [:id, :href, :name, :status, :server, :rnat]
            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

          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.tmrk.ecloud.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:i" => "http://www.w3.org/2001/XMLSchema-instance",
                              :xmlns => "urn:tmrk:eCloudExtensions-2.3") {
              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])
              builder.RnatAddress(network_ip_data[:rnat])
            }
          end

        end

        class Mock

          def configure_network_ip(network_ip_uri, network_ip_data)
            Fog::Mock.not_implemented
          end
        end
      end
    end
  end
end

Version data entries

33 entries across 33 versions & 2 rubygems

Version Path
fog-0.3.31 lib/fog/vcloud/terremark/ecloud/requests/configure_network_ip.rb
fog-0.3.30 lib/fog/vcloud/terremark/ecloud/requests/configure_network_ip.rb
fog-0.3.29 lib/fog/vcloud/terremark/ecloud/requests/configure_network_ip.rb
fog-0.3.28 lib/fog/vcloud/terremark/ecloud/requests/configure_network_ip.rb
fog-0.3.27 lib/fog/vcloud/terremark/ecloud/requests/configure_network_ip.rb
fog-0.3.26 lib/fog/vcloud/terremark/ecloud/requests/configure_network_ip.rb
fog-0.3.25 lib/fog/vcloud/terremark/ecloud/requests/configure_network_ip.rb
fog-0.3.24 lib/fog/vcloud/terremark/ecloud/requests/configure_network_ip.rb
bbcloud-0.8.1 lib/bbcloud/vendor/fog-0.3.23/lib/fog/vcloud/terremark/ecloud/requests/configure_network_ip.rb
fog-0.3.23 lib/fog/vcloud/terremark/ecloud/requests/configure_network_ip.rb
fog-0.3.22 lib/fog/vcloud/terremark/ecloud/requests/configure_network_ip.rb
fog-0.3.21 lib/fog/vcloud/terremark/ecloud/requests/configure_network_ip.rb
fog-0.3.20 lib/fog/vcloud/terremark/ecloud/requests/configure_network_ip.rb
fog-0.3.19 lib/fog/vcloud/terremark/ecloud/requests/configure_network_ip.rb
fog-0.3.18 lib/fog/vcloud/terremark/ecloud/requests/configure_network_ip.rb
fog-0.3.17 lib/fog/vcloud/terremark/ecloud/requests/configure_network_ip.rb
fog-0.3.16 lib/fog/vcloud/terremark/ecloud/requests/configure_network_ip.rb
fog-0.3.15 lib/fog/vcloud/terremark/ecloud/requests/configure_network_ip.rb
fog-0.3.14 lib/fog/vcloud/terremark/ecloud/requests/configure_network_ip.rb
fog-0.3.13 lib/fog/vcloud/terremark/ecloud/requests/configure_network_ip.rb