awslimitchecker.trustedadvisor module

class awslimitchecker.trustedadvisor.TrustedAdvisor[source]

Bases: object

Class to contain all TrustedAdvisor-related logic.

__dict__ = dict_proxy({'__module__': 'awslimitchecker.trustedadvisor', '_get_limit_check_id': <function _get_limit_check_id at 0x7f7f884adaa0>, '_poll': <function _poll at 0x7f7f884ada28>, 'update_limits': <function update_limits at 0x7f7f884ad9b0>, '__dict__': <attribute '__dict__' of 'TrustedAdvisor' objects>, '_update_services': <function _update_services at 0x7f7f884adb18>, '__weakref__': <attribute '__weakref__' of 'TrustedAdvisor' objects>, '__doc__': None, '__init__': <function __init__ at 0x7f7f884ad8c0>, 'connect': <function connect at 0x7f7f884ad938>})
__init__()[source]

Class to contain all TrustedAdvisor-related logic.

__module__ = 'awslimitchecker.trustedadvisor'
__weakref__

list of weak references to the object (if defined)

_get_limit_check_id()[source]

Query currently-available TA checks, return the check ID and metadata of the ‘performance/Service Limits’ check.

Returns:2-tuple of Service Limits TA check ID (string), metadata (list), or (None, None).
Return type:tuple
_poll()[source]

Poll Trusted Advisor (Support) API for limit checks.

Return a dict of service name (string) keys to nested dict vals, where each key is a limit name and each value the current numeric limit.

e.g.:

{
    'EC2': {
        'SomeLimit': 10,
    }
}
_update_services(ta_results, services)[source]

Given a dict of TrustedAdvisor check results from _poll() and a dict of Service objects passed in to update_limits(), updated the TrustedAdvisor limits for all services.

Parameters:
  • ta_results (dict) – results returned by _poll()
  • services (dict) – dict of service names to _AwsService objects
connect()[source]
update_limits(services)[source]

Poll ‘Service Limits’ check results from Trusted Advisor, if possible. Iterate over all AwsLimit objects for the given services and update their limits from TA if present in TA checks.

Parameters:services (dict) – dict of service name (string) to _AwsService objects