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 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 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
#credentials, #expiration, #refresh!
Methods included from CredentialProvider
#access_key_id, #secret_access_key, #session_token, #set?
Methods included from Deprecations
Constructor Details
#initialize(options = {}) ⇒ AssumeRoleCredentials
Returns a new instance of AssumeRoleCredentials.
29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/aws-sdk-core/assume_role_credentials.rb', line 29 def initialize( = {}) client_opts = {} @assume_role_params = {} .each_pair do |key, value| if self.class..include?(key) @assume_role_params[key] = value else client_opts[key] = value end end @client = client_opts[:client] || STS::Client.new(client_opts) super end |
Instance Attribute Details
#client ⇒ STS::Client (readonly)
44 45 46 |
# File 'lib/aws-sdk-core/assume_role_credentials.rb', line 44 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.
61 62 63 64 65 66 |
# File 'lib/aws-sdk-core/assume_role_credentials.rb', line 61 def @aro ||= begin input = STS::Client.api.operation(:assume_role).input Set.new(input.shape.member_names) end end |