Module: Fog::Network

Defined in:
lib/fog/network.rb,
lib/fog/openstack/network.rb,
lib/fog/openstack/models/network/port.rb,
lib/fog/openstack/models/network/ports.rb,
lib/fog/openstack/models/network/router.rb,
lib/fog/openstack/models/network/subnet.rb,
lib/fog/openstack/models/network/network.rb,
lib/fog/openstack/models/network/routers.rb,
lib/fog/openstack/models/network/subnets.rb,
lib/fog/openstack/models/network/networks.rb,
lib/fog/openstack/requests/network/get_port.rb,
lib/fog/openstack/models/network/floating_ip.rb,
lib/fog/openstack/models/network/floating_ips.rb,
lib/fog/openstack/requests/network/get_router.rb,
lib/fog/openstack/requests/network/get_subnet.rb,
lib/fog/openstack/requests/network/list_ports.rb,
lib/fog/openstack/requests/network/set_tenant.rb,
lib/fog/openstack/requests/network/create_port.rb,
lib/fog/openstack/requests/network/delete_port.rb,
lib/fog/openstack/requests/network/get_network.rb,
lib/fog/openstack/requests/network/update_port.rb,
lib/fog/openstack/requests/network/list_routers.rb,
lib/fog/openstack/requests/network/list_subnets.rb,
lib/fog/openstack/requests/network/create_router.rb,
lib/fog/openstack/requests/network/create_subnet.rb,
lib/fog/openstack/requests/network/delete_router.rb,
lib/fog/openstack/requests/network/delete_subnet.rb,
lib/fog/openstack/requests/network/list_networks.rb,
lib/fog/openstack/requests/network/update_router.rb,
lib/fog/openstack/requests/network/update_subnet.rb,
lib/fog/openstack/requests/network/create_network.rb,
lib/fog/openstack/requests/network/delete_network.rb,
lib/fog/openstack/requests/network/update_network.rb,
lib/fog/openstack/requests/network/get_floating_ip.rb,
lib/fog/openstack/requests/network/list_floating_ips.rb,
lib/fog/openstack/requests/network/create_floating_ip.rb,
lib/fog/openstack/requests/network/delete_floating_ip.rb,
lib/fog/openstack/requests/network/add_router_interface.rb,
lib/fog/openstack/requests/network/associate_floating_ip.rb,
lib/fog/openstack/requests/network/remove_router_interface.rb,
lib/fog/openstack/requests/network/disassociate_floating_ip.rb

Defined Under Namespace

Classes: OpenStack

Class Method Summary collapse

Class Method Details

.[](provider) ⇒ Object



4
5
6
# File 'lib/fog/network.rb', line 4

def self.[](provider)
  self.new(:provider => provider)
end

.new(attributes) ⇒ Object

Raises:

  • (ArgumentError)


8
9
10
11
12
13
14
15
16
17
18
# File 'lib/fog/network.rb', line 8

def self.new(attributes)
  attributes = attributes.dup # Prevent delete from having side effects
  provider = attributes.delete(:provider).to_s.downcase.to_sym

  if self.providers.include?(provider)
    require "fog/#{provider}/network"
    return Fog::Network.const_get(Fog.providers[provider]).new(attributes)
  end

  raise ArgumentError.new("#{provider} has no network service")
end

.providersObject



20
21
22
# File 'lib/fog/network.rb', line 20

def self.providers
  Fog.services[:network]
end