Documentation
¶
Index ¶
- Constants
- func CreateEvent(al *zap.Logger, event *Event, opts ...CreateEventOption) error
- func CreateV1Event(al *zap.Logger, sd *commonv3.SessionData, detail *EventDetail, ...) error
- func GetAuditLogger(opts *AuditOptions) *zap.Logger
- func WriteEvent(event *Event, al *zap.Logger)
- type AuditOptions
- type CreateEventOption
- func WithAccountID(accountID string) CreateEventOption
- func WithCategory(category EventCategory) CreateEventOption
- func WithContext(ctx context.Context) CreateEventOption
- func WithGroups(groups []string) CreateEventOption
- func WithOrigin(origin EventOrigin) CreateEventOption
- func WithProject(project string) CreateEventOption
- func WithTopic(topic EventTopic) CreateEventOption
- func WithUsername(username string) CreateEventOption
- func WithVersion(version EventVersion) CreateEventOption
- type Event
- type EventActor
- type EventActorAccount
- type EventCategory
- type EventClient
- type EventDetail
- type EventOrigin
- type EventTopic
- type EventVersion
Constants ¶
const ( RawLogsEventsTopic EventTopic = "dp-raw-logs-events" VersionV1 EventVersion = "1.0" OriginCore EventOrigin = "core" OriginCluster EventOrigin = "cluster" AuditCategory EventCategory = "AUDIT" )
Audit events constants
const ( DATABASE string = "database" ELASTICSEARCH string = "elasticsearch" )
const ( SYSTEM string = "system" KUBECTL_CMD string = "kubectl_cmd" KUBECTL_API string = "kubectl_api" )
Variables ¶
This section is empty.
Functions ¶
func CreateEvent ¶
func CreateEvent(al *zap.Logger, event *Event, opts ...CreateEventOption) error
CreateEvent creates an event
func CreateV1Event ¶
func CreateV1Event(al *zap.Logger, sd *commonv3.SessionData, detail *EventDetail, eventType string, project string) error
func GetAuditLogger ¶
func GetAuditLogger(opts *AuditOptions) *zap.Logger
func WriteEvent ¶
Types ¶
type AuditOptions ¶
options holds audit options
type CreateEventOption ¶
type CreateEventOption func(opts *createEventOptions)
CreateEventOption is the functional arg for creating audit event
func WithAccountID ¶
func WithAccountID(accountID string) CreateEventOption
WithAccountID sets account id for audit event
func WithCategory ¶
func WithCategory(category EventCategory) CreateEventOption
WithCategory sets category for audit event
func WithContext ¶
func WithContext(ctx context.Context) CreateEventOption
WithContext sets context for audit event
func WithGroups ¶
func WithGroups(groups []string) CreateEventOption
WithGroups sets groups for audit event
func WithOrigin ¶
func WithOrigin(origin EventOrigin) CreateEventOption
WithOrigin sets origin for audit event
func WithProject ¶
func WithProject(project string) CreateEventOption
WithProject sets project id for audit event
func WithTopic ¶
func WithTopic(topic EventTopic) CreateEventOption
WithTopic sets topic for audit event
func WithUsername ¶
func WithUsername(username string) CreateEventOption
WithUsername sets username for audit event
func WithVersion ¶
func WithVersion(version EventVersion) CreateEventOption
WithVersion sets version for audit event
type Event ¶
type Event struct { Version EventVersion `json:"version"` Category EventCategory `json:"category"` Origin EventOrigin `json:"origin"` Portal string `json:"portal"` Type string `json:"type"` Project string `json:"project"` Actor *EventActor `json:"actor"` Client *EventClient `json:"client"` Detail *EventDetail `json:"detail"` Timestamp string `json:"timestamp"` }
Event is struct to hold event data
func GetEvent ¶
func GetEvent(r *http.Request, sd *commonv3.SessionData, detail *EventDetail, eventType string, project string) *Event
type EventActor ¶
type EventActor struct { Type string `json:"type"` // Add org and partner id once we have multi-org support // PartnerID string `json:"partner_id"` // OrganizationID string `json:"organization_id"` Account EventActorAccount `json:"account"` Groups []string `json:"groups"` }
EventActor Event's initiator
func GetActorFromSessionData ¶
func GetActorFromSessionData(sd *commonv3.SessionData) *EventActor
type EventActorAccount ¶
type EventActorAccount struct {
Username string `json:"username"`
}
EventActorAccount Event's initiator account
type EventClient ¶
type EventClient struct { Type string `json:"type"` IP string `json:"ip"` UserAgent string `json:"user_agent"` Host string `json:"host"` }
EventClient Event's client
func GetClientFromRequest ¶
func GetClientFromRequest(r *http.Request) *EventClient
func GetClientFromSessionData ¶
func GetClientFromSessionData(sd *commonv3.SessionData) *EventClient
type EventDetail ¶
EventDetail Event's detail