feed

package
v0.0.0-...-43a96cf Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 19, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ProjectTag                = "projects"
	ProducerTypeTag           = "producer_object_type"
	ChefServerProducerTypeTag = "chef_server"
	ChefServerFieldTag        = "chef_infra_server"
	ChefOrganizationFieldTag  = "chef_organization"
	ParentNameFieldTag        = "parent_name"
	ParentIDFieldTag          = "parent_id"
)

Functions

func ConvertAPIKeyToBackendKey

func ConvertAPIKeyToBackendKey(parameter string) string

ConvertAPIKeyToBackendKey Transforms the keys used for the API to the keys used in the backend (Elasticsearch).

func FormatFilters

func FormatFilters(filters []string) (map[string][]string, error)

FormatFilters Will receive an array of filters and will format them into a map of strings To be used on filtering Events

Example:

[
 "environment:adios",
 "environment:hola",
 "cookbook:awesome",
 "roles:lalala",
]

The returned filters would look like:

map[string][]string [

"environment": ["adios","hola"],
"cookbook": ["awesome"],
"roles": ["lalala"],

]

func MillisecondsToTime

func MillisecondsToTime(dateTime int64) time.Time

func StringArrayToInterfaceArray

func StringArrayToInterfaceArray(array []string) []interface{}

func StringDateRangeToTime

func StringDateRangeToTime(date string) (time.Time, bool)

StringDateRangeToTime will transform a Date Range (start/end) to a Time type it verifies that it has a specific layout

The format we want is: YYYY-MM-DD

func ValidateDateRange

func ValidateDateRange(start string, end string) bool

ValidateDateRange will validate that the provided start & end date are valid. That means they both have to have the right format and the start time must be less than or equal to the end time

NOTE: If start or end are empty strings ("") that's consider an ok "empty" parameter

func ValidateMillisecondDateRange

func ValidateMillisecondDateRange(start int64, end int64) (time.Time, time.Time, error)

ValidateMillisecondDateRange will validate that the provided start & end date are valid. That means the start time must be less than or equal to the end time

NOTE: If start or end are 0 that's considered an ok "empty" parameter

func ValidatePagingCursorTime

func ValidatePagingCursorTime(before int64, after int64, cursor string, end int64) (time.Time, bool, error)

ValidatePagingCursorTime will validate the paging parameters

Types

type ActionLine

type ActionLine struct {
	Action    string
	Timeslots []Timeslot
}

a ActionLine feed timeline has multiple lines, one per action (verb)

type EntryCount

type EntryCount struct {
	Category string
	Count    int64
}

each timeslot can have multiple categories of entries (profile, scan job, etc.), each with its own count

type FeedConsumerNetwork

type FeedConsumerNetwork struct {
	ID          string     `json:"id"`
	ProducerIDs []string   `json:"producer_ids"`
	Producers   []Producer `json:"producer"`
	Created     string     `json:"created"`
}

func (*FeedConsumerNetwork) ToJSON

func (network *FeedConsumerNetwork) ToJSON() ([]byte, error)

func (*FeedConsumerNetwork) ToString

func (network *FeedConsumerNetwork) ToString() string

type FeedConsumerNetworkQuery

type FeedConsumerNetworkQuery struct {
	UserID string
}

type FeedEntry

type FeedEntry struct {
	ID                 string    `json:"entity_uuid"`
	ProducerID         string    `json:"producer_id"`
	ProducerName       string    `json:"producer_name"`
	ProducerObjectType string    `json:"producer_object_type"`
	ProducerTags       []string  `json:"producer_tags"`
	FeedType           string    `json:"feed_type"` // e.g., event feed, msg feed, notifications/alerts, audit, other activity feed
	EventType          string    `json:"event_type"`
	Tags               []string  `json:"tags"`
	Published          time.Time `json:"pub_timestamp"`
	ActorID            string    `json:"actor_id"`
	ActorName          string    `json:"actor_name"`
	ActorObjectType    string    `json:"actor_object_type"`
	Verb               string    `json:"verb"`
	ObjectID           string    `json:"object_id"`
	ObjectName         string    `json:"object_name"`
	ObjectObjectType   string    `json:"object_object_type"`
	TargetID           string    `json:"target_id"`
	TargetName         string    `json:"target_name"`
	TargetObjectType   string    `json:"target_object_type"`
	Created            time.Time `json:"created"`
	Projects           []string  `json:"projects"`
	ChefOrganization   string    `json:"chef_organization"`
	ChefInfraServer    string    `json:"chef_infra_server"`
	ParentName         string    `json:"parent_name"`
	ParentID           string    `json:"parent_id"`
}

func (*FeedEntry) ToJSON

func (f *FeedEntry) ToJSON() ([]byte, error)

func (*FeedEntry) ToString

func (f *FeedEntry) ToString() string

type FeedQuery

type FeedQuery struct {
	UserID     string
	Size       int
	Start      time.Time
	End        time.Time
	Before     int64
	After      int64
	Filters    map[string][]string
	CursorID   string
	CursorDate time.Time
	Ascending  bool
}

type FeedSummary

type FeedSummary struct {
	Counts map[string]int64
}

type FeedSummaryQuery

type FeedSummaryQuery struct {
	CountsCategory string
	Buckets        bool
	Start          time.Time
	End            time.Time
	Filters        map[string][]string
}

type Producer

type Producer struct {
	ID         string   `json:"producer_id"`
	Name       string   `json:"producer_name"`
	ObjectType string   `json:"producer_object_type"`
	PTags      []string `json:"producer_tags"`
}

type Timeslot

type Timeslot struct {
	EntryCounts []EntryCount
}

a Timeslot has multiple timeslots

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL