Sha256: 65b575efccc5d6dc93873579da07ea38662f3e62fa89927c285a0231ddbb7eae

Contents?: true

Size: 970 Bytes

Versions: 4

Compression:

Stored size: 970 Bytes

Contents

module Fog
  module Compute
    class XenServer

      class Real

        # Create a Network
        #
        # @see http://docs.vmd.citrix.com/XenServer/6.0.0/1.0/en_gb/api/?c=network
        #
        def create_network( name, config = {} )
          config.reject! { |k,v| v.nil? }

          default_config = {
            :name_label => name,
            # Description is mandatory in XenAPI but we default to empty
            :name_description => config[:description] || '',
            # Mandatory, but can be empty
            :other_config => {}
          }.merge config

          @connection.request(
            {
              :parser => Fog::Parsers::XenServer::Base.new,
              :method => 'network.create'
            },
            default_config
          )
        end
      end

      class Mock

        def create_network( name, description = '', config = {} )
          Fog::Mock.not_implemented
        end

      end

    end
  end
end

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
fog-xenserver-0.0.1.alpha2 lib/fog/xenserver/requests/compute/create_network.rb
fog-xenserver-0.0.1.alpha lib/fog/xenserver/requests/compute/create_network.rb
fog-1.22.0 lib/fog/xenserver/requests/compute/create_network.rb
fog-1.21.0 lib/fog/xenserver/requests/compute/create_network.rb