eventschema

package
v1.3.3-0...-f31c912 Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2024 License: AGPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsValidEventType

func IsValidEventType(input string) bool

IsValidEventType takes a string and returns whether it represents a valid event type.

func QueryableEventList

func QueryableEventList() (string, error)

QueryableEventList generates a CSV list of all user-exposed event types that can be queried in Athena and their descriptions The list looks like

table_name, description
user.login, records a successfully or failed user login event
database.session.query, is emitted when a user executes a database query
...

func SQLViewNameForEvent

func SQLViewNameForEvent(eventName string) string

SQLViewNameForEvent returns a SQL compatible view name for a given event. [event code] -> [athena view name] session.start -> session_start

Types

type ColumnSchemaDetails

type ColumnSchemaDetails struct {
	// Path is column field path.
	Path []string
	// Type is the column type.
	Type string
	// Description is the column description.
	Description string
}

ColumnSchemaDetails describe Athena view column schema.

func (*ColumnSchemaDetails) NameJSON

func (c *ColumnSchemaDetails) NameJSON() string

NameJSON returns a JSON compatible column name.

func (*ColumnSchemaDetails) NameSQL

func (c *ColumnSchemaDetails) NameSQL() string

NameSQL returns a SQL compatible column name.

type Event

type Event struct {
	Description string
	Fields      []*EventField
}

func GetEventSchemaFromType

func GetEventSchemaFromType(eventType string) (*Event, error)

GetEventSchemaFromType takes an event type, looks up the corresponding protobuf message, and returns the message schema.

func (*Event) TableSchema

func (event *Event) TableSchema() (string, error)

TableSchema returns a CSV description of the event table schema. This explains to the query writer which field are available. This must not be confused with ViewSchema which returns the Athena SQL statements used to build a view extracting content from raw event_data.

func (*Event) TableSchemaDetails

func (event *Event) TableSchemaDetails() (*TableSchemaDetails, error)

TableSchemaDetails returns a CSV description of the event table schema. This explains to the query writer which field are available. This must not be confused with ViewSchema which returns the Athena SQL statements used to build a view extracting content from raw event_data.

type EventField

type EventField struct {
	Name        string
	Type        string
	Description string
	Fields      []*EventField
	Items       *EventField
}

func (*EventField) TableSchema

func (field *EventField) TableSchema(path []string) (string, error)

TableSchema returns a CSV description of the EventField schema. This explains to the query writer which field are available.

func (*EventField) TableSchemaDetails

func (field *EventField) TableSchemaDetails(path []string) ([]*ColumnSchemaDetails, error)

TableSchemaDetails returns a CSV description of the EventField schema. This explains to the query writer which field are available.

type TableSchemaDetails

type TableSchemaDetails struct {
	// Name is view name
	Name string
	// SQLViewName is SQL compatible table name.
	SQLViewName string
	// Description is Athena view description.
	Description string
	// Columns contains information about columns schema.
	Columns []*ColumnSchemaDetails
}

TableSchemaDetails describe Athena view schema.

func GetViewsDetails

func GetViewsDetails() ([]*TableSchemaDetails, error)

GetViewsDetails returns a list of Athena view schema.

func (*TableSchemaDetails) CreateView

func (d *TableSchemaDetails) CreateView() string

CreateView returns a SQL statement to create an Athena view. This view is used during a user query execution to extract data from the raw event_data column and make data representation more user-friendly. CreateView result will be used as in a user SQL query as a query header to create dynamic tables. Access Monitoring allow users to run any arbitrary Athena SQL query where the query scope is limited to by dedicated IAM Role that allows only read access to Athena audit event table.

Jump to

Keyboard shortcuts

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