INNER CODE UNIT · Python
__init__
grycap/scar · scar/providers/aws/clients/__init__.py:29
def __init__(self, client_args: Dict):
self.client_args = client_args.get('client', {})
self.session_args = client_args.get('session', {})
@lazy_property
def client(self):
"""Returns a boto client based on the 'boto_client_name' property,
the region specified on the client args and
the profile specified on the session args."""
# 'default' profile if nothing set
session = boto3.Session(**self.session_args)
self.client_args['config'] = botocore.config.Config(read_timeout=self._READ_TIMEOUT)
return session.client(self._BOTO_CLIENT_NAME, **self.client_args)
def get_access_key(self) -> str:
"""Returns the access key belonging to the boto_profile used."""
session = boto3.Session(**self.session_args)
credentials = session.get_credentials()