Class: HP::Cloud::Routers

Inherits:
FogCollection show all
Defined in:
lib/hpcloud/routers.rb

Instance Attribute Summary

Attributes inherited from FogCollection

#items, #name

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from FogCollection

#create, #empty?, #filter, #get, #get_array, #matches

Constructor Details

#initializeRouters

Returns a new instance of Routers.



27
28
29
30
# File 'lib/hpcloud/routers.rb', line 27

def initialize
  super("router")
  @items = @connection.network.routers
end

Class Method Details

.parse_gateway(value) ⇒ Object



37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/hpcloud/routers.rb', line 37

def self.parse_gateway(value)
  networks = Networks.new
  unless value.nil?
    unless value.empty?
      netty = networks.get(value)
      return netty
    end
    return nil
  end
  networks.items.each{ |x|
    if x.router_external == true
      return x
    end
  }
  raise HP::Cloud::Exceptions::General.new("Cannot find external network to use as gateway")
end

Instance Method Details

#unique(name) ⇒ Object



32
33
34
35
# File 'lib/hpcloud/routers.rb', line 32

def unique(name)
  super(name)
  Fog::HP::Network::Router.new({:service => Connection.instance.network})
end