How to use the policyuniverse._action_categories.get function in policyuniverse

To help you get started, we’ve selected a few policyuniverse examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Netflix-Skunkworks / policyuniverse / policyuniverse / action_categories.py View on Github external
def categories_for_actions(actions):
    """
    Given an iterable of actions, return a mapping of action groups.
    
    actions: {'ec2:authorizesecuritygroupingress', 'iam:putrolepolicy', 'iam:listroles'}
    
    Returns:
        {
            'ec2': {'Write'},
            'iam': {'Permissions', 'List'})
        }
    """
    groups = defaultdict(set)
    for action in actions:
        service = action.split(":")[0]
        groups[service].add(_action_categories.get(action))
    return groups