events

package
v5.0.1 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewConsoleEventID

func NewConsoleEventID(context, namespace, console string, time time.Time) string

NewConsoleEventID creates a deterministic ID for consoles that can be used to correlate events.

Types

type CommonEvent

type CommonEvent struct {
	Version     string            `json:"apiVersion"`
	Kind        Kind              `json:"kind"`
	Event       EventKind         `json:"event"`
	ObservedAt  time.Time         `json:"observed_at"`
	Id          string            `json:"id"`
	Annotations map[string]string `json:"annotations"`
}

func (CommonEvent) EventKind

func (e CommonEvent) EventKind() string

EventKind returns the Kind/Event of the Event

type ConsoleAttachEvent

type ConsoleAttachEvent struct {
	CommonEvent `json:",inline"`
	Spec        ConsoleAttachSpec `json:"spec"`
}

type ConsoleAttachSpec

type ConsoleAttachSpec struct {
	Username  string `json:"username"`
	Pod       string `json:"pod"`
	Container string `json:"container"`
}

type ConsoleAuthoriseEvent

type ConsoleAuthoriseEvent struct {
	CommonEvent `json:",inline"`
	Spec        ConsoleAuthoriseSpec `json:"spec"`
}

type ConsoleAuthoriseSpec

type ConsoleAuthoriseSpec struct {
	Username string `json:"username"`
}

type ConsoleRequestEvent

type ConsoleRequestEvent struct {
	CommonEvent `json:",inline"`
	Spec        ConsoleRequestSpec `json:"spec"`
}

type ConsoleRequestSpec

type ConsoleRequestSpec struct {
	Reason   string `json:"reason"`
	Username string `json:"username"`
	// Context is used to denote the cluster name,
	Context                string            `json:"context"`
	Namespace              string            `json:"namespace"`
	ConsoleTemplate        string            `json:"console_template"`
	Console                string            `json:"console"`
	RequiredAuthorisations int               `json:"required_authorisations"`
	AuthorisationRuleName  string            `json:"authorisation_rule_name"`
	Timestamp              time.Time         `json:"timestamp"`
	Labels                 map[string]string `json:"labels"`
}

type ConsoleStartEvent

type ConsoleStartEvent struct {
	CommonEvent `json:",inline"`
	Spec        ConsoleStartSpec `json:"spec"`
}

type ConsoleStartSpec

type ConsoleStartSpec struct {
	Job string `json:"job"`
}

type ConsoleTerminatedEvent

type ConsoleTerminatedEvent struct {
	CommonEvent `json:",inline"`
	Spec        ConsoleTerminatedSpec `json:"spec"`
}

type ConsoleTerminatedSpec

type ConsoleTerminatedSpec struct {
	TimedOut          bool              `json:"timed_out"`
	ContainerStatuses map[string]string `json:"container_statuses"`
	ExitCodes         map[string]int32  `json:"exit_codes"`
}

type ErrorPubsubFailedConnect

type ErrorPubsubFailedConnect struct {
	// contains filtered or unexported fields
}

func (ErrorPubsubFailedConnect) Error

func (e ErrorPubsubFailedConnect) Error() string

func (ErrorPubsubFailedConnect) Unwrap

func (e ErrorPubsubFailedConnect) Unwrap() error

type ErrorPubsubFailedPublish

type ErrorPubsubFailedPublish struct {
	Topic   string
	Message interface{}
	// contains filtered or unexported fields
}

ErrorPubsubFailedPublish provides context on the reasons that we failed to publish our message

func (ErrorPubsubFailedPublish) Error

func (e ErrorPubsubFailedPublish) Error() string

func (ErrorPubsubFailedPublish) Unwrap

func (e ErrorPubsubFailedPublish) Unwrap() error

type EventKind

type EventKind string
const (
	EventRequest    EventKind = "Request"
	EventAuthorise  EventKind = "Authorise"
	EventStart      EventKind = "Start"
	EventAttach     EventKind = "Attach"
	EventTerminated EventKind = "Terminate"
)

type GooglePubSubPublisher

type GooglePubSubPublisher struct {
	// contains filtered or unexported fields
}

GooglePubSubPublisher implements the publisher.Publisher interface, allowing us to publish messages to a Google Pub/Sub topic

func NewGooglePubSubPublisher

func NewGooglePubSubPublisher(ctx context.Context, projectName string, topicName string) (*GooglePubSubPublisher, error)

func (*GooglePubSubPublisher) Publish

func (p *GooglePubSubPublisher) Publish(ctx context.Context, msg interface{}) (string, error)

func (*GooglePubSubPublisher) Stop

func (p *GooglePubSubPublisher) Stop()

type Kind

type Kind string
const (
	KindConsole Kind = "Console"
)

type NopPublisher

type NopPublisher struct{}

https://en.wikipedia.org/wiki/NOP_(code)

func NewNopPublisher

func NewNopPublisher() *NopPublisher

func (NopPublisher) Publish

func (nop NopPublisher) Publish(_ context.Context, _ interface{}) (string, error)

type Publisher

type Publisher interface {
	Publish(context.Context, interface{}) (string, error)
}

Jump to

Keyboard shortcuts

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