2013-06-24 11:04:55 -04:00
|
|
|
require 'fog/core/collection'
|
2013-08-27 05:19:54 -04:00
|
|
|
require 'fog/vcloud_director/models/compute/network'
|
2013-06-24 11:04:55 -04:00
|
|
|
|
|
|
|
module Fog
|
|
|
|
module Compute
|
2013-08-27 05:19:54 -04:00
|
|
|
class VcloudDirector
|
2013-06-24 11:04:55 -04:00
|
|
|
|
2013-07-09 09:01:06 -04:00
|
|
|
class Networks < Collection
|
2013-08-27 05:19:54 -04:00
|
|
|
model Fog::Compute::VcloudDirector::Network
|
2013-09-16 13:13:09 -04:00
|
|
|
|
2013-06-24 11:04:55 -04:00
|
|
|
attribute :organization
|
2013-09-16 13:13:09 -04:00
|
|
|
|
2013-07-09 09:01:06 -04:00
|
|
|
private
|
2013-09-16 13:13:09 -04:00
|
|
|
|
2013-07-09 09:01:06 -04:00
|
|
|
def get_by_id(item_id)
|
|
|
|
item = service.get_network(item_id).body
|
|
|
|
service.add_id_from_href!(item)
|
|
|
|
item
|
2013-06-24 11:04:55 -04:00
|
|
|
end
|
2013-09-16 13:13:09 -04:00
|
|
|
|
2013-07-09 09:01:06 -04:00
|
|
|
def item_list
|
|
|
|
data = service.get_organization(organization.id).body
|
|
|
|
items = data[:Link].select { |link| link[:type] == "application/vnd.vmware.vcloud.orgNetwork+xml" }
|
|
|
|
items.each{|item| service.add_id_from_href!(item) }
|
|
|
|
items
|
2013-06-24 11:04:55 -04:00
|
|
|
end
|
2013-09-16 13:13:09 -04:00
|
|
|
|
2013-06-24 11:04:55 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|