Class: Fog::AWS::STS::Real
- Inherits:
-
Object
- Object
- Fog::AWS::STS::Real
- Defined in:
- lib/fog/aws/sts.rb,
lib/fog/aws/requests/sts/get_session_token.rb,
lib/fog/aws/requests/sts/get_federation_token.rb
Instance Method Summary collapse
- #get_federation_token(name, policy, duration = 43200) ⇒ Object
- #get_session_token(duration = 43200) ⇒ Object
-
#initialize(options = {}) ⇒ Real
constructor
Initialize connection to STS.
- #reload ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Real
Initialize connection to STS
Notes
options parameter must include values for :aws_access_key_id and :aws_secret_access_key in order to create a connection
Examples
iam = STS.new(
:aws_access_key_id => your_aws_access_key_id,
:aws_secret_access_key => your_aws_secret_access_key
)
Parameters
-
options<~Hash> - config arguments for connection. Defaults to {}.
Returns
-
STS object with connection to AWS.
67 68 69 70 71 72 73 74 75 76 77 78 79 80 |
# File 'lib/fog/aws/sts.rb', line 67 def initialize(={}) require 'fog/core/parser' @aws_access_key_id = [:aws_access_key_id] @aws_secret_access_key = [:aws_secret_access_key] @connection_options = [:connection_options] || {} @hmac = Fog::HMAC.new('sha256', @aws_secret_access_key) @host = [:host] || 'sts.amazonaws.com' @path = [:path] || '/' @persistent = [:persistent] || false @port = [:port] || 443 @scheme = [:scheme] || 'https' @connection = Fog::Connection.new("#{@scheme}://#{@host}:#{@port}#{@path}", @persistent, @connection_options) end |
Instance Method Details
#get_federation_token(name, policy, duration = 43200) ⇒ Object
8 9 10 11 12 13 14 15 16 17 |
# 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 |
#get_session_token(duration = 43200) ⇒ Object
8 9 10 11 12 13 14 15 |
# 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 |
#reload ⇒ Object
82 83 84 |
# File 'lib/fog/aws/sts.rb', line 82 def reload @connection.reset end |