awslimitchecker.utils module¶
-
class
awslimitchecker.utils.StoreKeyValuePair(option_strings, dest, nargs=None, const=None, default=None, type=None, choices=None, required=False, help=None, metavar=None)[source]¶ Bases:
argparse.ActionStore key=value options in a dict as {‘key’: ‘value’}.
Supports specifying the option multiple times, but NOT with
nargs.See
Action.-
__init__(option_strings, dest, nargs=None, const=None, default=None, type=None, choices=None, required=False, help=None, metavar=None)[source]¶
-
__module__= 'awslimitchecker.utils'¶
-
-
awslimitchecker.utils._get_dict_value_by_path(d, path)[source]¶ Given a dict (
d) and a list specifying the hierarchical path to a key in that dict (path), return the value at that path or None if it does not exist.Parameters:
-
awslimitchecker.utils._set_dict_value_by_path(d, val, path)[source]¶ Given a dict (
d), a value (val), and a list specifying the hierarchical path to a key in that dict (path), set the value indatpathtoval.Parameters: Raises: TypeError if the path is too short
Returns: the modified dict
-
awslimitchecker.utils.dict2cols(d, spaces=2, separator=' ')[source]¶ Take a dict of string keys and string values, and return a string with them formatted as two columns separated by at least
spacesnumber ofseparatorcharacters.Parameters:
-
awslimitchecker.utils.paginate_dict(function_ref, *argv, **kwargs)[source]¶ Paginate through a query that returns a dict result, and return the combined result.
Note that this function requires some special kwargs to be passed in:
- __alc_marker_path__ - The dictionary path to the Marker for the next result set. If this path does not exist, the raw result will be returned.
- __alc_data_path__ - The dictionary path to the list containing the query results. This will be updated with the results of subsequent queries.
- __alc_marker_param__ - The parameter name to pass to
function_refwith the marker value.
These paths should be lists, in a form usable by
_get_dict_value_by_path().Parameters: