Class: AwsAssumeRole::Credentials::Providers::AssumeRoleCredentials

Inherits:
Object
  • Object
show all
Includes:
Vendored::Aws::CredentialProvider, Vendored::Aws::RefreshingCredentials
Defined in:
lib/aws_assume_role/credentials/providers/assume_role_credentials.rb

Constant Summary collapse

STS_KEYS =
%i[role_arn role_session_name policy duration_seconds external_id client credentials region].freeze

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Vendored::Aws::RefreshingCredentials

#credentials, #expiration, #refresh!

Constructor Details

#initialize(options = {}) ⇒ AssumeRoleCredentials

Returns a new instance of AssumeRoleCredentials.



21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/aws_assume_role/credentials/providers/assume_role_credentials.rb', line 21

def initialize(options = {})
    client_opts = {}
    @assume_role_params = {}
    options.each_pair do |key, value|
        if self.class.assume_role_options.include?(key)
            @assume_role_params[key] = value
        else
            next unless STS_KEYS.include?(key)
            client_opts[key] = value
        end
    end
    @client = client_opts[:client] || ::Aws::STS::Client.new(client_opts)
    super
end

Instance Attribute Details

#clientSTS::Client (readonly)

Returns:

  • (STS::Client)


37
38
39
# File 'lib/aws_assume_role/credentials/providers/assume_role_credentials.rb', line 37

def client
  @client
end

Class Method Details

.assume_role_optionsObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



53
54
55
56
57
58
# File 'lib/aws_assume_role/credentials/providers/assume_role_credentials.rb', line 53

def assume_role_options
    @aro ||= begin
        input = ::Aws::STS::Client.api.operation(:assume_role).input
        Set.new(input.shape.member_names)
    end
end