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/ibm/requests/compute/modify_key.rb
2012-03-20 23:37:46 -04:00

48 lines
1.2 KiB
Ruby

module Fog
module Compute
class IBM
class Real
# Modify a key
#
# ==== Parameters
# * key_name<~String> - name of key to be modified
# * params<~Hash> - depends on type of request
#
# ==== Returns
# * response<~Excon::Response>:
# * body<~Hash>:
# * 'success'<~Bool>: success status of update request
def modify_key(key_name, params={})
request(
:method => 'PUT',
:expects => 200,
:path => "/keys/#{key_name}",
:body => params
)
end
end
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
end
end
end