2011-11-13 15:16:22 -05:00
|
|
|
module Fog
|
|
|
|
module AWS
|
|
|
|
class STS
|
|
|
|
class Real
|
|
|
|
|
|
|
|
require 'fog/aws/parsers/sts/get_session_token'
|
|
|
|
|
2013-09-04 21:05:39 -04:00
|
|
|
# Get federation token
|
|
|
|
#
|
|
|
|
# ==== Parameters
|
|
|
|
# * name<~String>: The name of the federated user.
|
|
|
|
# Minimum length of 2. Maximum length of 32.
|
|
|
|
# * policy<~String>: Optional policy that specifies the permissions
|
|
|
|
# that are granted to the federated user
|
|
|
|
# Minimum length of 1. Maximum length of 2048.
|
|
|
|
# * duration<~Integer>: Optional duration, in seconds, that the session
|
|
|
|
# should last.
|
|
|
|
# ==== Returns
|
|
|
|
# * response<~Excon::Response>:
|
|
|
|
# * body<~Hash>:
|
|
|
|
# * 'SessionToken'<~String> -
|
|
|
|
# * 'SecretAccessKey'<~String> -
|
|
|
|
# * 'Expiration'<~String> -
|
|
|
|
# * 'AccessKeyId'<~String> -
|
|
|
|
# * 'Arn'<~String> -
|
|
|
|
# * 'FederatedUserId'<~String> -
|
|
|
|
# * 'PackedPolicySize'<~String> -
|
|
|
|
# * 'RequestId'<~String> - Id of the request
|
|
|
|
#
|
|
|
|
# ==== See Also
|
|
|
|
# http://docs.aws.amazon.com/STS/latest/APIReference/API_GetFederationToken.html
|
|
|
|
|
2011-11-13 15:16:22 -05:00
|
|
|
def get_federation_token(name, policy, duration=43200)
|
|
|
|
request({
|
|
|
|
'Action' => 'GetFederationToken',
|
|
|
|
'Name' => name,
|
2012-04-25 10:31:28 -04:00
|
|
|
'Policy' => Fog::JSON.encode(policy),
|
2011-11-13 15:16:22 -05:00
|
|
|
'DurationSeconds' => duration,
|
2012-02-18 11:58:31 -05:00
|
|
|
:idempotent => true,
|
2011-11-13 15:16:22 -05:00
|
|
|
:parser => Fog::Parsers::AWS::STS::GetSessionToken.new
|
|
|
|
})
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|