def get_trail_ids(cls, event, mode):
        """extract resources ids from a cloud trail event."""
        resource_ids = ()
        event_name = event['detail']['eventName']
        event_source = event['detail']['eventSource']
        for e in mode.get('events', []):
            if not isinstance(e, dict):
                # Check if we have a short cut / alias
                info = CloudWatchEvents.match(event)
                if info:
                    return info['ids'].search(event)
                continue
            if event_name != e.get('event'):
                continue
            if event_source != e.get('source'):
                continue

            id_query = e.get('ids')
            if not id_query:
                raise ValueError("No id query configured")
            evt = event
            # be forgiving for users specifying with details or without
            if not id_query.startswith('detail.'):
                evt = event.get('detail', {})
            resource_ids = jmespath.search(id_query, evt)
            if resource_ids:
                break
        return resource_ids
def get_trail_ids ( cls , event , mode ) : resource_ids = ( ) event_name = event [ 'detail' ] [ 'eventName' ] event_source = event [ 'detail' ] [ 'eventSource' ] for e in mode . get ( 'events' , [ ] ) : if not isinstance ( e , dict ) : info = CloudWatchEvents . match ( event ) if info : return info [ 'ids' ] . search ( event ) continue if event_name != e . get ( 'event' ) : continue if event_source != e . get ( 'source' ) : continue id_query = e . get ( 'ids' ) if not id_query : raise ValueError ( "No id query configured" ) evt = event if not id_query . startswith ( 'detail.' ) : evt = event . get ( 'detail' , { } ) resource_ids = jmespath . search ( id_query , evt ) if resource_ids : break return resource_ids
extract resources ids from a cloud trail event.