awslimitchecker.connectable module¶
-
class
awslimitchecker.connectable.
Connectable
[source]¶ Bases:
object
Mix-in helper class for connecting to AWS APIs. Centralizes logic of connecting via regions and/or STS.
-
__dict__
= dict_proxy({'connect_via': <function connect_via at 0x7f9b469fec08>, '__module__': 'awslimitchecker.connectable', '_get_sts_token': <function _get_sts_token at 0x7f9b469fec80>, '__dict__': <attribute '__dict__' of 'Connectable' objects>, '__weakref__': <attribute '__weakref__' of 'Connectable' objects>, '__doc__': '\n Mix-in helper class for connecting to AWS APIs. Centralizes logic of\n connecting via regions and/or STS.\n '})¶
-
__module__
= 'awslimitchecker.connectable'¶
-
__weakref__
¶ list of weak references to the object (if defined)
-
_get_sts_token
()[source]¶ Assume a role via STS and return the credentials.
First connect to STS via
boto.sts.connect_to_region()
, then assume a role usingboto.sts.STSConnection.assume_role()
usingself.account_id
andself.account_role
(and optionallyself.external_id
). Return the resultingboto.sts.credentials.Credentials
object.Returns: STS assumed role credentials Return type: boto.sts.credentials.Credentials
-
connect_via
(driver)[source]¶ Connect to an AWS API and return the connection object. If
self.account_id
is None, calldriver(self.region)
. Otherwise, call_get_sts_token()
to get STS token credentials usingboto.sts.STSConnection.assume_role()
and calldriver()
with those credentials to use an assumed role.Parameters: driver ( function
) – the connect_to_region() function of the boto submodule to use to create this connectionReturns: connected boto service class instance
-