mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
28 lines
550 B
Ruby
28 lines
550 B
Ruby
require 'fog/core/collection'
|
|
require 'fog/rackspace/models/identity/tenant'
|
|
|
|
module Fog
|
|
module Rackspace
|
|
class Identity
|
|
class Tenants < Fog::Collection
|
|
|
|
model Fog::Rackspace::Identity::Tenant
|
|
|
|
def all
|
|
load(retrieve_tenants)
|
|
end
|
|
|
|
def get(id)
|
|
data = retrieve_tenants.find{ |tenant| tenant['id'] == id }
|
|
data && new(data)
|
|
end
|
|
|
|
private
|
|
|
|
def retrieve_tenants
|
|
data = connection.list_tenants.body['tenants']
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|