Class: Aws::AssumeRoleCredentials
- Inherits:
- 
      Object
      
        - Object
- Aws::AssumeRoleCredentials
 
- Includes:
- CredentialProvider, RefreshingCredentials
- Defined in:
- lib/aws-sdk-core/assume_role_credentials.rb
Overview
An auto-refreshing credential provider that assumes a role via STS::Client#assume_role.
role_credentials = Aws::AssumeRoleCredentials.new(
  client: Aws::STS::Client.new(...),
  role_arn: "linked::account::arn",
  role_session_name: "session-name"
)
ec2 = Aws::EC2::Client.new(credentials: role_credentials)
If you omit ‘:client` option, a new STS::Client object will be constructed with additional options that were provided.
Constant Summary
Constants included from RefreshingCredentials
RefreshingCredentials::ASYNC_EXPIRATION_LENGTH, RefreshingCredentials::CLIENT_EXCLUDE_OPTIONS, RefreshingCredentials::SYNC_EXPIRATION_LENGTH
Instance Attribute Summary collapse
- #assume_role_params ⇒ Hash readonly
- #client ⇒ STS::Client readonly
Attributes included from CredentialProvider
Class Method Summary collapse
- .assume_role_options ⇒ Object private
Instance Method Summary collapse
- 
  
    
      #initialize(options = {})  ⇒ AssumeRoleCredentials 
    
    
  
  
  
    constructor
  
  
  
  
  
  
  
    A new instance of AssumeRoleCredentials. 
Methods included from RefreshingCredentials
Methods included from CredentialProvider
Constructor Details
#initialize(options = {}) ⇒ AssumeRoleCredentials
Returns a new instance of AssumeRoleCredentials.
| 41 42 43 44 45 46 47 48 49 50 51 52 53 54 | # File 'lib/aws-sdk-core/assume_role_credentials.rb', line 41 def initialize( = {}) client_opts = {} @assume_role_params = {} .each_pair do |key, value| if self.class..include?(key) @assume_role_params[key] = value elsif !CLIENT_EXCLUDE_OPTIONS.include?(key) client_opts[key] = value end end @client = client_opts[:client] || STS::Client.new(client_opts) @async_refresh = true super end | 
Instance Attribute Details
#assume_role_params ⇒ Hash (readonly)
| 60 61 62 | # File 'lib/aws-sdk-core/assume_role_credentials.rb', line 60 def assume_role_params @assume_role_params end | 
#client ⇒ STS::Client (readonly)
| 57 58 59 | # File 'lib/aws-sdk-core/assume_role_credentials.rb', line 57 def client @client end | 
Class Method Details
.assume_role_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.
| 84 85 86 87 88 89 | # File 'lib/aws-sdk-core/assume_role_credentials.rb', line 84 def @aro ||= begin input = STS::Client.api.operation(:assume_role).input Set.new(input.shape.member_names) end end |