Module: AwsAssumeRole::Vendored::Aws::RefreshingCredentials Private

Included in:
Credentials::Providers::AssumeRoleCredentials, Credentials::Providers::MfaSessionCredentials
Defined in:
lib/aws_assume_role/vendored/aws/refreshing_credentials.rb

Overview

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

Base class used credential classes that can be refreshed. This provides basic refresh logic in a thread-safe manor. Classes mixing in this module are expected to implement a #refresh method that populates the following instance variables:

  • `@access_key_id`

  • `@secret_access_key`

  • `@session_token`

  • `@expiration`

Instance Method Summary collapse

Instance Method Details

#credentialsCredentials

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.


20
21
22
23
# File 'lib/aws_assume_role/vendored/aws/refreshing_credentials.rb', line 20

def credentials
    refresh_if_near_expiration
    @credentials
end

#expirationTime?

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.


26
27
28
29
# File 'lib/aws_assume_role/vendored/aws/refreshing_credentials.rb', line 26

def expiration
    refresh_if_near_expiration
    @expiration
end

#initialize(_options = {}) ⇒ Object

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.


14
15
16
17
# File 'lib/aws_assume_role/vendored/aws/refreshing_credentials.rb', line 14

def initialize(_options = {})
      @mutex = Mutex.new
      refresh
end

#refresh!void

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.

This method returns an undefined value.

Refresh credentials.


33
34
35
# File 'lib/aws_assume_role/vendored/aws/refreshing_credentials.rb', line 33

def refresh!
    @mutex.synchronize { refresh }
end