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

45 lines
1 KiB
Ruby
Raw Normal View History

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={})
request(
2012-01-10 17:20:56 -05:00
:method => 'PUT',
:expects => 200,
:path => "/keys/#{key_name}",
: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