2012-02-24 06:38:05 -05:00
|
|
|
module Fog
|
|
|
|
module Identity
|
|
|
|
class OpenStack
|
|
|
|
class Real
|
|
|
|
def create_role(name)
|
|
|
|
data = {
|
|
|
|
'role' => {
|
|
|
|
'name' => name
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
request(
|
2013-05-05 14:38:54 -04:00
|
|
|
:body => MultiJson.encode(data),
|
2012-02-24 06:38:05 -05:00
|
|
|
:expects => [200, 202],
|
|
|
|
:method => 'POST',
|
|
|
|
:path => '/OS-KSADM/roles'
|
|
|
|
)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
class Mock
|
|
|
|
def create_role(name)
|
|
|
|
data = {
|
2012-12-06 01:42:25 -05:00
|
|
|
'id' => Fog::Mock.random_hex(32),
|
2012-02-27 11:27:00 -05:00
|
|
|
'name' => name
|
2012-02-24 06:38:05 -05:00
|
|
|
}
|
|
|
|
self.data[:roles][data['id']] = data
|
2012-05-28 17:45:22 -04:00
|
|
|
Excon::Response.new(
|
|
|
|
:body => { 'role' => data },
|
|
|
|
:status => 202
|
|
|
|
)
|
2012-02-24 06:38:05 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|