Class: Role
- Inherits:
-
Object
- Object
- Role
- Defined in:
- lib/credsummoner/role.rb
Instance Attribute Summary collapse
-
#arn ⇒ Object
readonly
Returns the value of attribute arn.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#principal_arn ⇒ Object
readonly
Returns the value of attribute principal_arn.
Instance Method Summary collapse
- #assume(saml, duration, region) ⇒ Object
-
#initialize(name:, arn:, principal_arn:) ⇒ Role
constructor
A new instance of Role.
- #to_s ⇒ Object
Constructor Details
#initialize(name:, arn:, principal_arn:) ⇒ Role
Returns a new instance of Role.
6 7 8 9 10 |
# File 'lib/credsummoner/role.rb', line 6 def initialize(name:, arn:, principal_arn:) @name = name @arn = arn @principal_arn = principal_arn end |
Instance Attribute Details
#arn ⇒ Object (readonly)
Returns the value of attribute arn.
4 5 6 |
# File 'lib/credsummoner/role.rb', line 4 def arn @arn end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
4 5 6 |
# File 'lib/credsummoner/role.rb', line 4 def name @name end |
#principal_arn ⇒ Object (readonly)
Returns the value of attribute principal_arn.
4 5 6 |
# File 'lib/credsummoner/role.rb', line 4 def principal_arn @principal_arn end |
Instance Method Details
#assume(saml, duration, region) ⇒ Object
12 13 14 15 16 17 18 19 20 |
# File 'lib/credsummoner/role.rb', line 12 def assume(saml, duration, region) sts = Aws::STS::Client.new(region: region) sts.assume_role_with_saml( principal_arn: principal_arn, role_arn: arn, saml_assertion: saml.response, duration_seconds: duration ).credentials end |
#to_s ⇒ Object
22 23 24 |
# File 'lib/credsummoner/role.rb', line 22 def to_s name end |