Returns the list of current events for a given client.
8275
def get_all_client_events(self, client):
        
        data = self._request('GET', '/events/{}'.format(client))
        return data.json()
770004
def get_event(self, client, check):
        
        data = self._request('GET', '/events/{}/{}'.format(client, check))
        return data.json()
1191109
async def get_events(
        self, device_ids, group_ids=None, from_time=None, to_time=None, event_types=None
    ):
        """"""
        if to_time is None:
            to_time = datetime.utcnow()
        if from_time is None:
            from_time = to_time - timedelta(seconds=EVENT_INTERVAL)
        if event_types is None:
            event_types = ["allEvents"]

        get_params = []

        get_params.extend([("deviceId", value) for value in device_ids])
        if group_ids is not None:
            get_params.extend([("groupId", value) for value in group_ids])
        get_params.extend([("from", from_time.isoformat() + "Z")])
        get_params.extend([("to", to_time.isoformat() + "Z")])
        get_params.extend([("type", value) for value in event_types])

        data = await self.api("reports/events", get_params)

        if self.connected and self.authenticated:
            self._events = data
        else:
            self._events = self._events

        return self._events
207102
def events(self, *events):
        
        return self.send_events(self.create_event(e) for e in events)
1160471
def list_event_sources(self):
        
        # Server does not do pagination on listings of this resource.
        # Return an iterator anyway for similarity with other API methods
        path = '/archive/{}/events/sources'.format(self._instance)
        response = self._client.get_proto(path=path)
        message = archive_pb2.EventSourceInfo()
        message.ParseFromString(response.content)
        sources = getattr(message, 'source')
        return iter(sources)
814244
def GetClientStates(self, client_list, client_chunk=50):
    """"""
    for client_group in collection.Batch(client_list, client_chunk):
      for fd in aff4.FACTORY.MultiOpen(
          client_group,
          mode="r",
          aff4_type=aff4_grr.VFSGRRClient,
          token=self.token):
        result = {}
        result["age"] = fd.Get(fd.Schema.PING)
        result["hostname"] = fd.Get(fd.Schema.HOSTNAME)
        yield (fd.urn, result)
514826
def filter_events(cls, client, event_data):
        """"""

        for event in cls.events:
            # try event filters
            if event.matches(client, event_data):
                yield event
1092860
def event_exists(self, client, check):
        '''
        
        '''
        return self.api_request(
            'get',
            'events/{}/{}'.format(client, check)
            ).status_code == 200
253858
def get_events(object_key: str) -> List[Event]:
    """"""
    events_data = _get_events_data(object_key)
    return [Event.from_config(event_dict) for event_dict in events_data]
1054201
List<EventInfo> getEvents() {
        synchronized (events) {
            List<EventInfo> result = new ArrayList<>(events.size());
            for (ListIterator<EventInfo> iterator = events.listIterator(events.size()); iterator.hasPrevious();) {
                result.add(iterator.previous());
            }
            return result;
        }
    }
1017913
def group_upcoming_events(context, group=None):
    
    request = context.get('request')
    if group is None:
        group = context.get('page')
    if group:
        events = getGroupUpcomingEvents(request, group)
    else:
        events = []
    return {'request': request,
            'events':  events}
720670
def get_events(self, time_period, include_archived=False) -> Optional[int]:
        
        date_filter = '1%20{}'.format(time_period.period)
        if time_period == TimePeriod.ALL:
            # The consoleEvents API uses DATE_SUB, so give it
            # something large
            date_filter = '100%20year'

        archived_filter = '/Archived=:0'
        if include_archived:
            archived_filter = ''

        event = self._client.get_state(
            'api/events/consoleEvents/{}{}.json'.format(
                date_filter,
                archived_filter
            )
        )

        try:
            events_by_monitor = event['results']
            if isinstance(events_by_monitor, list):
                return 0
            return events_by_monitor.get(str(self._monitor_id), 0)
        except (TypeError, KeyError, AttributeError):
            return None
320872
def event_listeners(self):
        """"""
        return (self.__command_listeners[:],
                self.__server_heartbeat_listeners[:],
                self.__server_listeners[:],
                self.__topology_listeners[:])
858490
def events(self):
        
        events = [self.acknowledge_event] + self.verification_events
        return [x for x in events if x]
801087
public List<String> eventNames() {
        return events.stream().map(BEvent::getName).collect( toList() );
    }
481811
def subsite_upcoming_events(context):
    
    request = context['request']
    home = request.site.root_page
    return {'request': request,
            'events':  getAllUpcomingEvents(request, home=home)}
184950
def get_listeners(self, event_type: str) -> List[Callable]:
        """"""
        if event_type not in self.events:
            raise ValueError(f'No event {event_type} in system.')
        return self.events.get_listeners(event_type)