Documentation
¶
Index ¶
Constants ¶
const ( // ResourceVersion is the current event resource version ResourceVersion = "v2" // KindEvent is the event resource kind KindEvent = "event" // EventTypeServer is the server-related event type EventTypeServer = "server" // EventTypeUser is the user-related event type EventTypeUser = "user" // EventActionLogin is the event login action EventActionLogin = "login" // KindHeartbeat is the heartbeat resource kind KindHeartbeat = "heartbeat" // NotificationUsage is the usage limit notification type NotificationUsage = "usage" // NotificationTerms is the terms of service violation notification type NotificationTerms = "terms" // SeverityInfo is info notification severity SeverityInfo = "info" // SeverityWarning is warning notification severity SeverityWarning = "warning" // SeverityError is error notification severity SeverityError = "error" )
Variables ¶
This section is empty.
Functions ¶
func MarshalHeartbeat ¶
MarshalHeartbeat marshals heartbeat with schema validation
Types ¶
type Event ¶
type Event interface { // GetName returns the event name GetName() string // GetMetadata returns the event metadata GetMetadata() Metadata // SetAccountID sets the event account ID SetAccountID(string) }
Event defines an interface all event types should implement
func FromGRPCEvent ¶
FromGRPCEvent converts event from the format used by gRPC server/client
func FromGRPCEvents ¶
func FromGRPCEvents(grpcEvents reporting.GRPCEvents) ([]Event, error)
FromGRPCEvents converts a series of events from the format used by gRPC server/client
type Heartbeat ¶
type Heartbeat struct { // Kind is resource kind, for heartbeat it is "heartbeat" Kind string `json:"kind"` // Version is the heartbeat resource version Version string `json:"version"` // Metadata is the heartbeat metadata Metadata Metadata `json:"metadata"` // Spec is the heartbeat spec Spec HeartbeatSpec `json:"spec"` }
Heartbeat represents a heartbeat that is sent from control plane to teleport
func NewHeartbeat ¶
func NewHeartbeat(notifications ...Notification) *Heartbeat
NewHeartbeat returns a new heartbeat
func UnmarshalHeartbeat ¶
UnmarshalHeartbeat unmarshals heartbeat with schema validation
func (*Heartbeat) GetMetadata ¶
GetMetadata returns the heartbeat metadata
type HeartbeatSpec ¶
type HeartbeatSpec struct { // Notifications is a list of notifications sent with the heartbeat Notifications []Notification `json:"notifications,omitempty"` }
HeartbeatSpec is the heartbeat resource spec
type Metadata ¶
type Metadata struct { // Name is the event name Name string `json:"name"` // Created is the event creation timestamp Created time.Time `json:"created"` }
Metadata represents event resource metadata
type Notification ¶
type Notification struct { // Type is the notification type Type string `json:"type"` // Severity is the notification severity: info, warning or error Severity string `json:"severity"` // Text is the notification plain text Text string `json:"text"` // HTML is the notification HTML HTML string `json:"html"` }
Notification represents a user notification message
type ServerEvent ¶
type ServerEvent struct { // Kind is resource kind, for events it is "event" Kind string `json:"kind"` // Version is the event resource version Version string `json:"version"` // Metadata is the event metadata Metadata Metadata `json:"metadata"` // Spec is the event spec Spec ServerEventSpec `json:"spec"` }
ServerEvent represents server-related event, such as "logged into server"
func NewServerLoginEvent ¶
func NewServerLoginEvent(serverID string) *ServerEvent
NewServerLoginEvent creates an instance of "server login" event
func (*ServerEvent) GetMetadata ¶
func (e *ServerEvent) GetMetadata() Metadata
GetMetadata returns the event metadata
func (*ServerEvent) SetAccountID ¶
func (e *ServerEvent) SetAccountID(id string)
SetAccountID sets the event account ID
type ServerEventSpec ¶
type ServerEventSpec struct { // ID is event ID, may be used for de-duplication ID string `json:"id"` // Action is event action, such as "login" Action string `json:"action"` // AccountID is ID of account that triggered the event AccountID string `json:"accountID"` // ServerID is anonymized ID of server that triggered the event ServerID string `json:"serverID"` }
ServerEventSpec is server event specification
type UserEvent ¶
type UserEvent struct { // Kind is resource kind, for events it is "event" Kind string `json:"kind"` // Version is the event resource version Version string `json:"version"` // Metadata is the event metadata Metadata Metadata `json:"metadata"` // Spec is the event spec Spec UserEventSpec `json:"spec"` }
UserEvent represents user-related event, such as "user logged in"
func NewUserLoginEvent ¶
NewUserLoginEvent creates an instance of "user login" event
func (*UserEvent) GetMetadata ¶
GetMetadata returns the event metadata
func (*UserEvent) SetAccountID ¶
SetAccountID sets the event account id
type UserEventSpec ¶
type UserEventSpec struct { // ID is event ID, may be used for de-duplication ID string `json:"id"` // Action is event action, such as "login" Action string `json:"action"` // AccountID is ID of account that triggered the event AccountID string `json:"accountID"` // UserID is anonymized ID of user that triggered the event UserID string `json:"userID"` }
UserEventSpec is user event specification