Initialize connection to STS
options parameter must include values for :aws_access_key_id and :aws_secret_access_key in order to create a connection
iam = STS.new( :aws_access_key_id => your_aws_access_key_id, :aws_secret_access_key => your_aws_secret_access_key )
options<~Hash> - config arguments for connection. Defaults to {}.
# File lib/fog/aws/sts.rb, line 74 def initialize(options={}) require 'fog/core/parser' @use_iam_profile = options[:use_iam_profile] setup_credentials(options) @connection_options = options[:connection_options] || {} @host = options[:host] || 'sts.amazonaws.com' @path = options[:path] || '/' @persistent = options[:persistent] || false @port = options[:port] || 443 @scheme = options[:scheme] || 'https' @connection = Fog::Connection.new("#{@scheme}://#{@host}:#{@port}#{@path}", @persistent, @connection_options) end
Assume Role
role_session_name<~String> - An identifier for the assumed role.
role_arn<~String> - The ARN of the role the caller is assuming.
external_id<~String> - An optional unique identifier required by the assuming role's trust identity.
policy<~String> - An optional JSON policy document
duration<~Integer> - Duration (of seconds) for the assumed role credentials to be valid (default 3600)
response<~Excon::Response>:
body<~Hash>:
'Arn'<~String>: The ARN of the assumed role/user
'AccessKeyId'<~String>: The AWS access key of the temporary credentials for the assumed role
'SecretAccessKey'<~String>: The AWS secret key of the temporary credentials for the assumed role
'SessionToken'<~String>: The AWS session token of the temporary credentials for the assumed role
'Expiration'<~Time>: The expiration time of the temporary credentials for the assumed role
docs.aws.amazon.com/STS/latest/APIReference/API_AssumeRole.html
# File lib/fog/aws/requests/sts/assume_role.rb, line 30 def assume_role(role_session_name, role_arn, external_id=nil, policy=nil, duration=3600) request({ 'Action' => 'AssumeRole', 'RoleSessionName' => role_session_name, 'RoleArn' => role_arn, 'Policy' => policy && Fog::JSON.encode(policy), 'DurationSeconds' => duration, 'ExternalId' => external_id, :idempotent => true, :parser => Fog::Parsers::AWS::STS::AssumeRole.new }) end
# File lib/fog/aws/requests/sts/get_federation_token.rb, line 8 def get_federation_token(name, policy, duration=43200) request({ 'Action' => 'GetFederationToken', 'Name' => name, 'Policy' => Fog::JSON.encode(policy), 'DurationSeconds' => duration, :idempotent => true, :parser => Fog::Parsers::AWS::STS::GetSessionToken.new }) end
# File lib/fog/aws/requests/sts/get_session_token.rb, line 8 def get_session_token(duration=43200) request({ 'Action' => 'GetSessionToken', 'DurationSeconds' => duration, :idempotent => true, :parser => Fog::Parsers::AWS::STS::GetSessionToken.new }) end
Generated with the Darkfish Rdoc Generator 2.