Sha256: 1b75eceb18860e52ebbed723a5916bacd2d14b8ea3bd989f4b251b400dad85c0

Contents?: true

Size: 1.2 KB

Versions: 19

Compression:

Stored size: 1.2 KB

Contents

module Fog
  module Network
    class OpenStack

      class Real
        def create_network(options = {})
          data = { 'network' => {} }

          vanilla_options = [:name, :shared, :admin_state_up, :tenant_id]
          vanilla_options.reject{ |o| options[o].nil? }.each do |key|
            data['network'][key] = options[key]
          end

          request(
            :body     => Fog::JSON.encode(data),
            :expects  => [201],
            :method   => 'POST',
            :path     => 'networks'
          )
        end
      end

      class Mock
        def create_network(options = {})
          response = Excon::Response.new
          response.status = 201
          data = {
            'id'             => Fog::Mock.random_numbers(6).to_s,
            'name'           => options[:name],
            'shared'         => options[:shared],
            'subnets'        => [],
            'status'         => 'ACTIVE',
            'admin_state_up' => options[:admin_state_up],
            'tenant_id'      => options[:tenant_id],
          }
          self.data[:networks][data['id']] = data
          response.body = { 'network' => data }
          response
        end
      end

    end
  end
end

Version data entries

19 entries across 19 versions & 7 rubygems

Version Path
cifrado-0.2.1 vendor/fog/lib/fog/openstack/requests/network/create_network.rb
cifrado-0.2.0 vendor/fog/lib/fog/openstack/requests/network/create_network.rb
hpfog-0.0.20 lib/fog/openstack/requests/network/create_network.rb
fog-nirvanix-1.8.2 lib/fog/openstack/requests/network/create_network.rb
fog-nirvanix-1.8.1 lib/fog/openstack/requests/network/create_network.rb
cifrado-0.1.3 vendor/fog/lib/fog/openstack/requests/network/create_network.rb
fog-1.10.0 lib/fog/openstack/requests/network/create_network.rb
cifrado-0.1.2 vendor/fog/lib/fog/openstack/requests/network/create_network.rb
cifrado-0.1.1 vendor/fog/lib/fog/openstack/requests/network/create_network.rb
cifrado-0.1 vendor/fog/lib/fog/openstack/requests/network/create_network.rb
fog-1.9.0 lib/fog/openstack/requests/network/create_network.rb
fog-maestrodev-1.8.0.20130114204828 lib/fog/openstack/requests/network/create_network.rb
fog-maestrodev-1.8.0.20130111070250 lib/fog/openstack/requests/network/create_network.rb
fog-maestrodev-1.8.0.20130109172219 lib/fog/openstack/requests/network/create_network.rb
ey-vendored-backup-3.0.27 vendor/gems/fog/lib/fog/openstack/requests/network/create_network.rb
fog-sgonyea-1.8.1 lib/fog/openstack/requests/network/create_network.rb
fog-1.8.0 lib/fog/openstack/requests/network/create_network.rb
fog-maestrodev-1.7.0.20121114190951 lib/fog/openstack/requests/network/create_network.rb
fog-1.7.0 lib/fog/openstack/requests/network/create_network.rb