2011-08-24 21:29:14 -04:00
|
|
|
require 'fog/ecloud/models/compute/network'
|
2011-02-17 13:44:46 -05:00
|
|
|
|
|
|
|
module Fog
|
2011-06-16 19:28:54 -04:00
|
|
|
module Compute
|
|
|
|
class Ecloud
|
2011-02-17 13:44:46 -05:00
|
|
|
class Networks < Fog::Ecloud::Collection
|
|
|
|
|
2012-06-07 12:50:11 -04:00
|
|
|
identity :href
|
2011-02-17 13:44:46 -05:00
|
|
|
|
2011-06-20 18:00:48 -04:00
|
|
|
model Fog::Compute::Ecloud::Network
|
2011-02-17 13:44:46 -05:00
|
|
|
|
|
|
|
def all
|
2012-06-07 12:50:11 -04:00
|
|
|
data = connection.get_networks(href).body
|
|
|
|
data = data[:Networks] ? data[:Networks][:Network] : data[:Network]
|
|
|
|
load(data)
|
2011-02-17 13:44:46 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
def get(uri)
|
|
|
|
if data = connection.get_network(uri)
|
|
|
|
new(data.body)
|
|
|
|
end
|
2012-06-07 12:50:11 -04:00
|
|
|
rescue Fog::Errors::NotFound
|
2011-02-17 13:44:46 -05:00
|
|
|
nil
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|