2012-01-10 17:20:56 -05:00
|
|
|
module Fog
|
|
|
|
module Compute
|
|
|
|
class IBM
|
|
|
|
class Real
|
|
|
|
|
|
|
|
# Modify a key
|
|
|
|
#
|
|
|
|
# ==== Returns
|
|
|
|
# * response<~Excon::Response>:
|
|
|
|
# * body<~Hash>
|
|
|
|
# TODO: docs
|
|
|
|
def modify_key(key_name, params={})
|
2012-01-17 16:34:47 -05:00
|
|
|
request(
|
2012-01-10 17:20:56 -05:00
|
|
|
:method => 'PUT',
|
|
|
|
:expects => 200,
|
|
|
|
:path => "/keys/#{key_name}",
|
2012-01-17 16:34:47 -05:00
|
|
|
:body => params
|
|
|
|
)
|
2012-01-10 17:20:56 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
end
|
2011-12-02 13:27:44 -05:00
|
|
|
class Mock
|
|
|
|
|
|
|
|
def modify_key(key_name, params={})
|
|
|
|
response = Excon::Response.new
|
|
|
|
if params['public_key']
|
|
|
|
if key_exists? key_name
|
|
|
|
self.data[:keys][key_name]['keyMaterial'] = public_key
|
|
|
|
self.data[:keys][key_name]['lastModifiedTime'] = Fog::IBM::Mock.launch_time,
|
|
|
|
response.status = 200
|
|
|
|
response.body = {"success"=>true}
|
|
|
|
else
|
|
|
|
response.status = 404
|
|
|
|
end
|
|
|
|
else
|
|
|
|
Fog::Mock.not_implemented
|
|
|
|
end
|
|
|
|
response
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
2012-01-10 17:20:56 -05:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|