events

package
v3.9.0 Latest Latest
Warning

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

Go to latest
Published: Jun 27, 2022 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"`
	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 added in v3.4.0

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

func (ErrorPubsubFailedConnect) Error added in v3.4.0

func (e ErrorPubsubFailedConnect) Error() string

func (ErrorPubsubFailedConnect) Unwrap added in v3.4.0

func (e ErrorPubsubFailedConnect) Unwrap() error

type ErrorPubsubFailedPublish added in v3.4.0

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 added in v3.4.0

func (e ErrorPubsubFailedPublish) Error() string

func (ErrorPubsubFailedPublish) Unwrap added in v3.4.0

func (e ErrorPubsubFailedPublish) Unwrap() error

type EventKind added in v3.4.0

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

type GooglePubSubPublisher added in v3.4.0

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 added in v3.4.0

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

func (*GooglePubSubPublisher) Publish added in v3.4.0

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

func (*GooglePubSubPublisher) Stop added in v3.4.0

func (p *GooglePubSubPublisher) Stop()

type Kind added in v3.4.0

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

type NopPublisher added in v3.4.0

type NopPublisher struct{}

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

func NewNopPublisher added in v3.4.0

func NewNopPublisher() *NopPublisher

func (NopPublisher) Publish added in v3.4.0

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

type Publisher added in v3.4.0

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