//GetEvents returns a list or a specific events filtered by severity,
//eventCode, or description
420800
func (c *Client) GetEvents(
	severity, eventCode, descRxPatt string) ([]Event, error) {

	events, err := c.api.GetEvents(severity)
	if err != nil {
		return nil, err
	}

	var filtered []Event
	rx, _ := regexp.Compile(descRxPatt)

	for _, e := range events.Events {
		if (eventCode == "" || e.EventCode == eventCode) &&
			(e.Description == "" || rx.MatchString(e.Description)) {
			filtered = append(filtered, e)
		}
	}
	return filtered, nil
}
1248811
func NewGetEventListenersArgs(objectID runtime.RemoteObjectID) *GetEventListenersArgs {
	args := new(GetEventListenersArgs)
	args.ObjectID = objectID
	return args
}
838926
func (_m *APIClient) Events(ctx context.Context, options types.EventsOptions) (<-chan events.Message, <-chan error) {
	ret := _m.Called(ctx, options)

	var r0 <-chan events.Message
	if rf, ok := ret.Get(0).(func(context.Context, types.EventsOptions) <-chan events.Message); ok {
		r0 = rf(ctx, options)
	} else {
		if ret.Get(0) != nil {
			r0 = ret.Get(0).(<-chan events.Message)
		}
	}

	var r1 <-chan error
	if rf, ok := ret.Get(1).(func(context.Context, types.EventsOptions) <-chan error); ok {
		r1 = rf(ctx, options)
	} else {
		if ret.Get(1) != nil {
			r1 = ret.Get(1).(<-chan error)
		}
	}

	return r0, r1
}
658683
func (p *Parser) handleEvents(rawEvents <-chan []string, send chan<- event.Event, wg *sync.WaitGroup) {
	defer wg.Done()
	// TODO: spin up a group of goroutines to do this
	for rawEvent := range rawEvents {
		ev := p.handleEvent(rawEvent)
		if ev != nil {
			send <- *ev
		}
	}
}
541743
func (s *APIServer) searchEvents(auth ClientI, w http.ResponseWriter, r *http.Request, p httprouter.Params, version string) (interface{}, error) {
	var err error
	to := time.Now().In(time.UTC)
	from := to.AddDate(0, -1, 0) // one month ago
	query := r.URL.Query()
	// parse 'to' and 'from' params:
	fromStr := query.Get("from")
	if fromStr != "" {
		from, err = time.Parse(time.RFC3339, fromStr)
		if err != nil {
			return nil, trace.BadParameter("from")
		}
	}
	toStr := query.Get("to")
	if toStr != "" {
		to, err = time.Parse(time.RFC3339, toStr)
		if err != nil {
			return nil, trace.BadParameter("to")
		}
	}
	var limit int
	limitStr := query.Get("limit")
	if limitStr != "" {
		limit, err = strconv.Atoi(limitStr)
		if err != nil {
			return nil, trace.BadParameter("failed to parse limit: %q", limit)
		}
	}
	// remove 'to', 'from' and 'limit' fields, passing the rest of the query unmodified
	// to whatever pluggable search is implemented by the backend
	query.Del("to")
	query.Del("from")
	query.Del("limit")
	eventsList, err := auth.SearchEvents(from, to, query.Encode(), limit)
	if err != nil {
		return nil, trace.Wrap(err)
	}
	return eventsList, nil
}
1020848
func (api *Client) GetCallEvents(id string) ([]*CallEvent, error) {
	result, _, err := api.makeRequest(http.MethodGet, fmt.Sprintf("%s/%s/%s", api.concatUserPath(callsPath), id, "events"), &[]*CallEvent{})
	if err != nil {
		return nil, err
	}
	return *(result.(*[]*CallEvent)), nil
}
670736
func (kea *KamEvapi) ReadEvents() (err error) {
	for {
		if err = <-kea.errReadEvents; err == io.EOF { // Disconnected, try reconnect
			if err = kea.Disconnect(); err != nil {
				break
			}
			if err = kea.ReconnectIfNeeded(); err != nil {
				break
			}
		}
	}
	return err
}
484361
func (e *events) Search(objOrRef runtime.Object) (*api.EventList, error) {
	ref, err := api.GetReference(objOrRef)
	if err != nil {
		return nil, err
	}
	if e.namespace != "" && ref.Namespace != e.namespace {
		return nil, fmt.Errorf("won't be able to find any events of namespace '%v' in namespace '%v'", ref.Namespace, e.namespace)
	}
	stringRefKind := string(ref.Kind)
	var refKind *string
	if stringRefKind != "" {
		refKind = &stringRefKind
	}
	stringRefUID := string(ref.UID)
	var refUID *string
	if stringRefUID != "" {
		refUID = &stringRefUID
	}
	fieldSelector := e.GetFieldSelector(&ref.Name, &ref.Namespace, refKind, refUID)
	return e.List(unversioned.ListOptions{FieldSelector: unversioned.FieldSelector{fieldSelector}})
}
82020
func (r Network_Subnet_Registration) GetEvents() (resp []datatypes.Network_Subnet_Registration_Event, err error) {
	err = r.Session.DoRequest("SoftLayer_Network_Subnet_Registration", "getEvents", nil, &r.Options, &resp)
	return
}
626497
func processEvents(inboundEvents chan []byte, parsedEvents chan *Event) {
	go func(inboundEvents chan []byte, parsedEvents chan *Event) {
		for event := range inboundEvents {
			var e Event
			json.Unmarshal(event, &e)
			parsedEvents <- &e
		}
	}(inboundEvents, parsedEvents)
}
1026791
func (c *Client) ListEventsByQuery(query url.Values) ([]Event, error) {
	var events []Event
	requestURL := fmt.Sprintf("/v2/events?%s", query.Encode())
	for {
		var eventResp EventsResponse
		r := c.NewRequest("GET", requestURL)
		resp, err := c.DoRequest(r)
		if err != nil {
			return nil, errors.Wrap(err, "error requesting events")
		}
		defer resp.Body.Close()
		if err := json.NewDecoder(resp.Body).Decode(&eventResp); err != nil {
			return nil, errors.Wrap(err, "error unmarshaling events")
		}
		for _, e := range eventResp.Resources {
			e.Entity.GUID = e.Meta.Guid
			e.Entity.CreatedAt = e.Meta.CreatedAt
			e.Entity.c = c
			events = append(events, e.Entity)
		}
		requestURL = eventResp.NextURL
		if requestURL == "" {
			break
		}
	}
	return events, nil
}
839044
func (s *Sensu) GetEventsForClient(client string) ([]interface{}, error) {
	//return s.get("events", client)
	// TODO  is this the correct way? need validation??
	return s.getList(fmt.Sprintf("events/%s", client), 0, 0)
}
413154
func (b *eventBatch) events() []wrappedEvent {
	sort.Sort(byTimestamp(b.batch))
	return b.batch
}
1365163
func (e *events) List(opts api.ListOptions) (*api.EventList, error) {
	result := &api.EventList{}
	err := e.client.Get().
		NamespaceIfScoped(e.namespace, len(e.namespace) > 0).
		Resource("events").
		VersionedParams(&opts, api.Scheme).
		Do().
		Into(result)
	return result, err
}
432797
func (a *AdditionalSpanTags) AddEvents(ctx context.Context, events []*event.Event) error {
	return a.next.AddEvents(ctx, events)
}
1208550
func (kea *KamEvapi) readEvents(exitChan chan struct{}, errReadEvents chan error) {
	for {
		select {
		case <-exitChan:
			return
		default: // Unlock waiting here
		}
		dataIn, err := kea.readNetstring()
		if err != nil {
			errReadEvents <- err
			return
		}
		kea.dispatchEvent(dataIn)
	}
	return
}
886486
func (e *Element) LoadEvents() {
	if e.eventManager != nil {
		e.eventManager.DisconnectRemoved()
		// log.Printf("will load events: %s %+s", e.Name(), e.events)

		for _, ev := range e.events {
			if es, _ := e.eventManager.NewEventMeta(ev.Meta); es != nil {
				es.Bind(ev.Fx)
			}
		}

	}

	//load up the children events also
	for _, ech := range e.children {
		if !ech.UseEventManager(e.eventManager) {
			ech.LoadEvents()
		}
	}
}