1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00

[aws|iam] add update_access_key request/tests

This commit is contained in:
geemus 2010-11-17 13:08:48 -08:00
parent c83e1bae00
commit c8fc0f1ffb
3 changed files with 49 additions and 0 deletions

View file

@ -22,6 +22,7 @@ module Fog
request :put_group_policy
request :put_user_policy
request :remove_user_from_group
request :update_access_key
class Mock

View file

@ -0,0 +1,44 @@
module Fog
module AWS
class IAM
class Real
require 'fog/aws/parsers/iam/basic'
# Update an access key for a user
#
# ==== Parameters
# * access_key_id<~String> - Access key id to delete
# * status<~String> - status of keys in ['Active', 'Inactive']
# * options<~Hash>:
# * 'UserName'<~String> - name of the user to create (do not include path)
#
# ==== Returns
# * response<~Excon::Response>:
# * body<~Hash>:
# * 'RequestId'<~String> - Id of the request
#
# ==== See Also
# http://docs.amazonwebservices.com/IAM/latest/APIReference/API_UpdateAccessKey.html
#
def update_access_key(access_key_id, status, options = {})
request({
'AccessKeyId' => access_key_id,
'Action' => 'UpdateAccessKey',
'Status' => status,
:parser => Fog::Parsers::AWS::IAM::Basic.new
}.merge!(options))
end
end
class Mock
def update_access_key(access_key_id, status, user_name = nil)
Fog::Mock.not_implemented
end
end
end
end
end

View file

@ -33,6 +33,10 @@ Shindo.tests('AWS::IAM | access key requests', ['aws']) do
AWS[:iam].list_access_keys('UserName' => 'fog_access_key_tests').body
end
tests("#update_access_key('#{@access_key_id}', 'Inactive', 'UserName' => 'fog_access_key_tests')").formats(AWS::IAM::Formats::BASIC) do
AWS[:iam].update_access_key(@access_key_id, 'Inactive', 'UserName' => 'fog_access_key_tests').body
end
tests("#delete_access_key('#{@access_key_id}', 'UserName' => 'fog_access_key_tests)").formats(AWS::IAM::Formats::BASIC) do
AWS[:iam].delete_access_key(@access_key_id, 'UserName' => 'fog_access_key_tests').body
end