Skip to content

Commit

Permalink
Merge pull request #12 from JimPatterson/passthru
Browse files Browse the repository at this point in the history
Allow passthru args for assume_role
  • Loading branch information
djcrabhat authored Feb 12, 2020
2 parents 480aea2 + 5a6b77c commit aa643d7
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions awsrequests/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,16 @@ def __init__(self, region, access_key=None, secret_key=None, session_token=None,
else:
raise EnvironmentError("could not find AWS creds (don't have boto3, so didn't look anywhere fancy)")

def assume_role(self, role_arn):
def assume_role(self, role_arn, role_session_name="AwsBootstrapper", **kwargs):
sts_client = boto3.client('sts',
region_name=self.region,
aws_access_key_id=self.access_key,
aws_secret_access_key=self.secret_key)
try:

temp_security_creds = sts_client.assume_role(RoleArn=role_arn,
RoleSessionName="AwsBootstrapper"
RoleSessionName=role_session_name,
**kwargs
)
self.access_key = temp_security_creds["Credentials"]["AccessKeyId"]
self.secret_key = temp_security_creds["Credentials"]["SecretAccessKey"]
Expand Down

0 comments on commit aa643d7

Please sign in to comment.