Module: Aws::RefreshingCredentials Private

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 manner. 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`

Constant Summary collapse

SYNC_EXPIRATION_LENGTH =

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

5 minutes

300
ASYNC_EXPIRATION_LENGTH =

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

10 minutes

600
CLIENT_EXCLUDE_OPTIONS =

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

Set.new([:before_refresh]).freeze

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.

Returns:



32
33
34
35
# File 'lib/aws-sdk-core/refreshing_credentials.rb', line 32

def credentials
  refresh_if_near_expiration!
  @credentials
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.



23
24
25
26
27
28
29
# File 'lib/aws-sdk-core/refreshing_credentials.rb', line 23

def initialize(options = {})
  @mutex = Mutex.new
  @before_refresh = options.delete(:before_refresh) if Hash === options

  @before_refresh.call(self) if @before_refresh
  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.



39
40
41
42
43
44
45
# File 'lib/aws-sdk-core/refreshing_credentials.rb', line 39

def refresh!
  @mutex.synchronize do
    @before_refresh.call(self) if @before_refresh

    refresh
  end
end