Class: Aws::AssumeRoleCredentials
- Inherits:
-
Credentials
- Object
- Credentials
- Aws::AssumeRoleCredentials
- Includes:
- RefreshingCredentials
- Defined in:
- lib/aws-sdk-core/assume_role_credentials.rb
Overview
An auto-refreshing credential provider that works by assuming 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.
Instance Attribute Summary collapse
- #client ⇒ STS::Client readonly
Attributes inherited from Credentials
#access_key_id, #secret_access_key, #session_token
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ AssumeRoleCredentials
constructor
A new instance of AssumeRoleCredentials.
Methods included from RefreshingCredentials
#access_key_id, #expiration, #refresh!, #secret_access_key, #session_token
Methods inherited from Credentials
Constructor Details
#initialize(options = {}) ⇒ AssumeRoleCredentials
Returns a new instance of AssumeRoleCredentials.
26 27 28 29 30 |
# File 'lib/aws-sdk-core/assume_role_credentials.rb', line 26 def initialize( = {}) @options = .dup @client = @options.delete(:client) || STS::Client.new super end |
Instance Attribute Details
#client ⇒ STS::Client (readonly)
33 34 35 |
# File 'lib/aws-sdk-core/assume_role_credentials.rb', line 33 def client @client end |