Skip to content

Commit

Permalink
Support for a 'generic' aws value in options that can hold region, se…
Browse files Browse the repository at this point in the history
…cret key and access id to be shared among other AWS services
  • Loading branch information
kalaspuff committed May 22, 2017
1 parent 6857817 commit ee7ec6b
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions tomodachi/transport/aws_sns_sqs.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,9 +170,12 @@ def create_client(cls, name, context):
loop = asyncio.get_event_loop()
session = aiobotocore.get_session(loop=loop)

region_name = context.get('options', {}).get('aws_sns_sqs', {}).get('region_name')
aws_secret_access_key = context.get('options', {}).get('aws_sns_sqs', {}).get('aws_secret_access_key')
aws_access_key_id = context.get('options', {}).get('aws_sns_sqs', {}).get('aws_access_key_id')
config_base = context.get('options', {}).get('aws_sns_sqs', context.get('options', {}).get('aws', {}))
aws_config_base = context.get('options', {}).get('aws', {})

region_name = config_base.get('aws_region_name', config_base.get('region_name')) or aws_config_base.get('aws_region_name', config_base.get('region_name'))
aws_secret_access_key = config_base.get('aws_secret_access_key', config_base.get('secret_access_key')) or aws_config_base.get('aws_secret_access_key', config_base.get('secret_access_key'))
aws_access_key_id = config_base.get('aws_access_key_id', config_base.get('access_key_id')) or aws_config_base.get('aws_access_key_id', config_base.get('access_key_id'))

try:
cls.clients[name] = session.create_client(name, region_name=region_name, aws_secret_access_key=aws_secret_access_key, aws_access_key_id=aws_access_key_id)
Expand Down

0 comments on commit ee7ec6b

Please # to comment.