1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00
fog--fog/lib/fog/openstack/requests/identity/list_tenants.rb
2012-09-02 14:21:44 +01:00

45 lines
1.3 KiB
Ruby

module Fog
module Identity
class OpenStack
class Real
def list_tenants(limit = nil, marker = nil)
params = Hash.new
params['limit'] = limit if limit
params['marker'] = marker if marker
request(
:expects => [200, 204],
:method => 'GET',
:path => "tenants",
:query => params
)
end
end # class Real
class Mock
def list_tenants
Excon::Response.new(
:body => {
'tenants_links' => [],
'tenants' => [
{'id' => '1',
'description' => 'Has access to everything',
'enabled' => true,
'name' => 'admin'},
{'id' => '2',
'description' => 'Normal tenant',
'enabled' => true,
'name' => 'default'},
{'id' => '3',
'description' => 'Disabled tenant',
'enabled' => false,
'name' => 'disabled'}
]
},
:status => [200, 204][rand(1)]
)
end # def list_tenants
end # class Mock
end # class OpenStack
end # module Identity
end # module Fog