예제 #1
0
// Returns filtered list of event objects.
// Event list object is filtered to get only warning events.
func getWarningEvents(eventList *api.EventList) []api.Event {
	if !isTypeFilled(eventList.Items) {
		eventList.Items = fillEventsType(eventList.Items)
	}

	return filterEventsByType(eventList.Items, api.EventTypeWarning)
}
예제 #2
0
// Returns list of Pod Event model objects based on kubernetes API event list object
// Event list object is filtered to get only warning events.
func getPodsEventWarnings(eventList *api.EventList) []Event {
	result := make([]Event, 0)

	var events []api.Event
	if !isTypeFilled(eventList.Items) {
		eventList.Items = fillEventsType(eventList.Items)
	}

	events = filterEventsByType(eventList.Items, api.EventTypeWarning)

	for _, event := range events {
		result = append(result, Event{
			Message: event.Message,
			Reason:  event.Reason,
			Type:    event.Type,
		})
	}

	return result
}