event

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2021 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TypeAdded   = "ADDED"   // resource created
	TypeDeleted = "DELETED" // resource deleted
	TypeUpdated = "UPDATED" // resource updated
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Event

type Event struct {
	// Type is the type of the event
	Type Type `json:"type"`

	// Obj is the resource affected
	Obj *unstructured.Unstructured `json:"obj"`

	// OldObj is only set for EventTypeUpdated
	OldObj *unstructured.Unstructured `json:"oldObj,omitempty"`
	// contains filtered or unexported fields
}

Event is representation of Kubernetes event

func NewAdded

func NewAdded(obj *unstructured.Unstructured) *Event

NewAdded creates added event

func NewDeleted

func NewDeleted(obj *unstructured.Unstructured) *Event

NewDeleted creates deleted event

func NewUpdated

func NewUpdated(obj, oldObj *unstructured.Unstructured) *Event

NewUpdated creates updated event

func (*Event) Color

func (e *Event) Color() string

Color returns theme color for the type of the event

func (*Event) GroupVersionKindName

func (e *Event) GroupVersionKindName() string

GroupVersionKindName returns group, version, kind, namespace and name string for the affected resource

examples:

/v1, Kind=ConfigMap, demo/demo
apps/v1, Kind=Deployment, demo/canary

func (*Event) NamespaceKey

func (e *Event) NamespaceKey() string

NamespaceKey returns namespaced key for the affected resource

func (*Event) ToModel

func (e *Event) ToModel(
	informerName string, gvr schema.GroupVersionResource) *models.Event

ToModel translate Event into *models.Event

type Type

type Type string

Type of event

Jump to

Keyboard shortcuts

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