Documentation
¶
Index ¶
- Constants
- Variables
- func NewFreightCommon(message, actor, stageName string, freight *kargoapi.Freight) (Common, Freight)
- func NewPromotionCommon(message, actor string, promotion *kargoapi.Promotion, ...) (Common, Promotion)
- type AnnotationMarshaler
- type Common
- type Custom
- type Freight
- type FreightApproved
- type FreightVerification
- type FreightVerificationAborted
- type FreightVerificationErrored
- type FreightVerificationEventMeta
- type FreightVerificationFailed
- type FreightVerificationInconclusive
- type FreightVerificationSucceeded
- type FreightVerificationUnknown
- type Message
- type Meta
- type Promotion
- type PromotionAborted
- type PromotionCreated
- type PromotionErrored
- type PromotionFailed
- type PromotionSucceeded
- type Sender
Constants ¶
const ( AnnotationEventKeyKind = "kind" AnnotationEventKeyName = "name" AnnotationEventKeyProject = "project" // This is the same as the annotation, but just "project" AnnotationEventKeyMessage = "message" )
Variables ¶
var KnownEventTypes = []kargoapi.EventType{ kargoapi.EventTypePromotionCreated, kargoapi.EventTypePromotionSucceeded, kargoapi.EventTypePromotionFailed, kargoapi.EventTypePromotionErrored, kargoapi.EventTypePromotionAborted, kargoapi.EventTypeFreightApproved, kargoapi.EventTypeFreightVerificationSucceeded, kargoapi.EventTypeFreightVerificationFailed, kargoapi.EventTypeFreightVerificationErrored, kargoapi.EventTypeFreightVerificationAborted, kargoapi.EventTypeFreightVerificationInconclusive, kargoapi.EventTypeFreightVerificationUnknown, }
A list of all known event types
Functions ¶
func NewFreightCommon ¶
func NewFreightCommon(message, actor, stageName string, freight *kargoapi.Freight, ) (Common, Freight)
NewFreightCommon creates a new `Freight` and `Common` event from the given freight data. Since these fields are common to all events, this is exposed for convenience.
func NewPromotionCommon ¶
func NewPromotionCommon(message, actor string, promotion *kargoapi.Promotion, freight *kargoapi.Freight, ) (Common, Promotion)
NewPromotionCommon creates a new `Promotion` and `Common` event from the given promotion and freight data. Since these fields are common to all events, this is exposed for convenience. The given actor will be used if it is not empty, but it will be overridden if the promotion has an actor annotation.
Types ¶
type AnnotationMarshaler ¶
AnnotationMarshaler is an interface for any type that can marshal out to our custom annotation types
type Common ¶
type Common struct {
Project string `json:"project"`
Actor *string `json:"actor,omitempty"`
Message string `json:"message"`
ID string `json:"id"`
}
Common is a struct that contains fields common to all events.
func UnmarshalCommonAnnotations ¶
UnmarshalCommonAnnotations populates the Common fields from the given kubernetes annotations and event ID
func (Common) GetMessage ¶
func (Common) GetProject ¶
func (*Common) MarshalAnnotationsTo ¶
func (*Common) SetMessage ¶
type Custom ¶
type Custom struct {
ObjectKind string `json:"kind"`
Name string `json:"name"`
Project string `json:"project"`
EventType kargoapi.EventType `json:"type"`
Message string `json:"message,omitempty"`
Data map[string]any `json:"data"`
ID string `json:"id,omitempty"`
}
Custom is a representation of an arbitrary custom event. It contains the raw data from the message, deserialized as `map[string]any` as well as additional data that can be pulled from well-known keys. It implements the `Meta` and `Message` interfaces so it can be used by any of the other methods in the package.
This type is only meant as a way to decode events. Sending custom events should be handled by defining your own structs
func (*Custom) GetMessage ¶
func (*Custom) GetProject ¶
func (*Custom) SetMessage ¶
type Freight ¶
type Freight struct {
Name string `json:"name"`
StageName string `json:"stageName"`
CreateTime time.Time `json:"createTime"`
Alias *string `json:"alias,omitempty"`
Commits []kargoapi.GitCommit `json:"commits,omitempty"`
Images []kargoapi.Image `json:"images,omitempty"`
Charts []kargoapi.Chart `json:"charts,omitempty"`
}
Freight is a struct that contains common fields for freight-related events.
func UnmarshalFreightAnnotations ¶
UnmarshalFreightAnnotations populates the Freight fields from the given kubernetes annotations.
func (*Freight) MarshalAnnotationsTo ¶
type FreightApproved ¶
func NewFreightApproved ¶
func NewFreightApproved(message, actor, stageName string, freight *kargoapi.Freight, ) *FreightApproved
NewFreightApproved creates a new `FreightApproved` event.
func UnmarshalFreightApprovedAnnotations ¶
func UnmarshalFreightApprovedAnnotations( eventID string, annotations map[string]string, ) (*FreightApproved, error)
UnmarshalFreightApprovedAnnotations converts the given annotations into a FreightApproved event. This is used by the main event handler to convert the data into a normal structured event, but is exposed for convenience.
func (*FreightApproved) MarshalAnnotations ¶
func (f *FreightApproved) MarshalAnnotations() map[string]string
func (*FreightApproved) Type ¶
func (f *FreightApproved) Type() kargoapi.EventType
type FreightVerification ¶
type FreightVerification struct {
StartTime *time.Time `json:"verificationStartTime,omitempty"`
FinishTime *time.Time `json:"verificationFinishTime,omitempty"`
AnalysisRunName *string `json:"analysisRunName,omitempty"`
// AnalysisTriggeredByPromotion is the name of the promotion that triggered the analysis run.
AnalysisTriggeredByPromotion *string `json:"analysisTriggeredByPromotion,omitempty"`
}
FreightVerification is a struct that contains common fields for a verification event
func NewFreightVerification ¶
func NewFreightVerification(vi *kargoapi.VerificationInfo) FreightVerification
NewFreightVerification creates a new `FreightVerification` struct from a `VerificationInfo`. This is mostly a convenience method if you're constructing an event yourself
func UnmarshalFreightVerificationAnnotations ¶
func UnmarshalFreightVerificationAnnotations(annotations map[string]string) (FreightVerification, error)
func (*FreightVerification) GetTriggeredByPromotion ¶
func (f *FreightVerification) GetTriggeredByPromotion() *string
func (*FreightVerification) MarshalAnnotationsTo ¶
func (f *FreightVerification) MarshalAnnotationsTo(annotations map[string]string)
func (*FreightVerification) SetTriggeredByPromotion ¶
func (f *FreightVerification) SetTriggeredByPromotion(promotionName *string)
type FreightVerificationAborted ¶
type FreightVerificationAborted struct {
Common
Freight
FreightVerification
}
FreightVerificationAborted is an event fired when a freight verification is aborted.
func NewFreightVerificationAborted ¶
func NewFreightVerificationAborted(actor, stageName string, freight *kargoapi.Freight, verification *kargoapi.VerificationInfo, ) *FreightVerificationAborted
NewFreightVerificationAborted creates a new `FreightVerificationAborted` event.
func UnmarshalFreightVerificationAbortedAnnotations ¶
func UnmarshalFreightVerificationAbortedAnnotations( eventID string, annotations map[string]string, ) (*FreightVerificationAborted, error)
UnmarshalFreightVerificationAbortedAnnotations converts the given annotations into a FreightVerificationAborted event. This is used by the main event handler to convert the data into a normal structured event, but is exposed for convenience.
func (*FreightVerificationAborted) MarshalAnnotations ¶
func (f *FreightVerificationAborted) MarshalAnnotations() map[string]string
func (*FreightVerificationAborted) Type ¶
func (f *FreightVerificationAborted) Type() kargoapi.EventType
type FreightVerificationErrored ¶
type FreightVerificationErrored struct {
Common
Freight
FreightVerification
}
FreightVerificationErrored is an event fired when a freight verification errors.
func NewFreightVerificationErrored ¶
func NewFreightVerificationErrored(actor, stageName string, freight *kargoapi.Freight, verification *kargoapi.VerificationInfo, ) *FreightVerificationErrored
NewFreightVerificationErrored creates a new `FreightVerificationErrored` event.
func UnmarshalFreightVerificationErroredAnnotations ¶
func UnmarshalFreightVerificationErroredAnnotations( eventID string, annotations map[string]string, ) (*FreightVerificationErrored, error)
UnmarshalFreightVerificationErroredAnnotations converts the given annotations into a FreightVerificationErrored event. This is used by the main event handler to convert the data into a normal structured event, but is exposed for convenience.
func (*FreightVerificationErrored) MarshalAnnotations ¶
func (f *FreightVerificationErrored) MarshalAnnotations() map[string]string
func (*FreightVerificationErrored) Type ¶
func (f *FreightVerificationErrored) Type() kargoapi.EventType
type FreightVerificationEventMeta ¶
type FreightVerificationEventMeta interface {
Meta
GetTriggeredByPromotion() *string
SetTriggeredByPromotion(promotionName *string)
}
FreightVerificationEventMeta is an interface for metadata associated with freight verification events. It is an extension of the Meta interface with a few verification-specific methods
type FreightVerificationFailed ¶
type FreightVerificationFailed struct {
Common
Freight
FreightVerification
}
FreightVerificationFailed is an event fired when a freight verification fails.
func NewFreightVerificationFailed ¶
func NewFreightVerificationFailed(actor, stageName string, freight *kargoapi.Freight, verification *kargoapi.VerificationInfo, ) *FreightVerificationFailed
NewFreightVerificationFailed creates a new `FreightVerificationFailed` event.
func UnmarshalFreightVerificationFailedAnnotations ¶
func UnmarshalFreightVerificationFailedAnnotations( eventID string, annotations map[string]string, ) (*FreightVerificationFailed, error)
UnmarshalFreightVerificationFailedAnnotations converts the given annotations into a FreightVerificationFailed event. This is used by the main event handler to convert the data into a normal structured event, but is exposed for convenience.
func (*FreightVerificationFailed) MarshalAnnotations ¶
func (f *FreightVerificationFailed) MarshalAnnotations() map[string]string
func (*FreightVerificationFailed) Type ¶
func (f *FreightVerificationFailed) Type() kargoapi.EventType
type FreightVerificationInconclusive ¶
type FreightVerificationInconclusive struct {
Common
Freight
FreightVerification
}
FreightVerificationInconclusive is an event fired when a freight verification is inconclusive.
func NewFreightVerificationInconclusive ¶
func NewFreightVerificationInconclusive(actor, stageName string, freight *kargoapi.Freight, verification *kargoapi.VerificationInfo, ) *FreightVerificationInconclusive
NewFreightVerificationInconclusive creates a new `FreightVerificationInconclusive` event.
func UnmarshalFreightVerificationInconclusiveAnnotations ¶
func UnmarshalFreightVerificationInconclusiveAnnotations( eventID string, annotations map[string]string, ) (*FreightVerificationInconclusive, error)
UnmarshalFreightVerificationInconclusiveAnnotations converts the given annotations into a FreightVerificationInconclusive event. This is used by the main event handler to convert the data into a normal structured event, but is exposed for convenience.
func (*FreightVerificationInconclusive) MarshalAnnotations ¶
func (f *FreightVerificationInconclusive) MarshalAnnotations() map[string]string
func (*FreightVerificationInconclusive) Type ¶
func (f *FreightVerificationInconclusive) Type() kargoapi.EventType
type FreightVerificationSucceeded ¶
type FreightVerificationSucceeded struct {
Common
Freight
FreightVerification
}
FreightVerificationSucceeded is an event fired when a freight verification succeeds.
func NewFreightVerificationSucceeded ¶
func NewFreightVerificationSucceeded(actor, stageName string, freight *kargoapi.Freight, verification *kargoapi.VerificationInfo, ) *FreightVerificationSucceeded
NewFreightVerificationSucceeded creates a new `FreightVerificationSucceeded` event.
func UnmarshalFreightVerificationSucceededAnnotations ¶
func UnmarshalFreightVerificationSucceededAnnotations( eventID string, annotations map[string]string, ) (*FreightVerificationSucceeded, error)
UnmarshalFreightVerificationSucceededAnnotations converts the given annotations into a FreightVerificationSucceeded event. This is used by the main event handler to convert the data into a normal structured event, but is exposed for convenience.
func (*FreightVerificationSucceeded) MarshalAnnotations ¶
func (f *FreightVerificationSucceeded) MarshalAnnotations() map[string]string
func (*FreightVerificationSucceeded) Type ¶
func (f *FreightVerificationSucceeded) Type() kargoapi.EventType
type FreightVerificationUnknown ¶
type FreightVerificationUnknown struct {
Common
Freight
FreightVerification
}
FreightVerificationUnknown is an event fired when a freight verification is unknown.
func NewFreightVerificationUnknown ¶
func NewFreightVerificationUnknown(actor, stageName string, freight *kargoapi.Freight, verification *kargoapi.VerificationInfo, ) *FreightVerificationUnknown
NewFreightVerificationUnknown creates a new `FreightVerificationUnknown` event.
func UnmarshalFreightVerificationUnknownAnnotations ¶
func UnmarshalFreightVerificationUnknownAnnotations( eventID string, annotations map[string]string, ) (*FreightVerificationUnknown, error)
UnmarshalFreightVerificationUnknownAnnotations converts the given annotations into a FreightVerificationUnknown event. This is used by the main event handler to convert the data into a normal structured event, but is exposed for convenience.
func (*FreightVerificationUnknown) MarshalAnnotations ¶
func (f *FreightVerificationUnknown) MarshalAnnotations() map[string]string
func (*FreightVerificationUnknown) Type ¶
func (f *FreightVerificationUnknown) Type() kargoapi.EventType
type Message ¶
type Message interface {
// GetMessage returns the message of the event
GetMessage() string
// SetMessage sets the message of the event
SetMessage(string)
}
Message is an interface for setting and getting the message of any built in event
type Meta ¶
type Meta interface {
// Type returns the event type for the struct
Type() kargoapi.EventType
// Kind returns the object kind the event is related to (e.g. "Promotion", "Freight", etc.).
// This is used for constructing a valid object reference for the event source
Kind() string
// GetProject returns the project associated with the event
GetProject() string
// GetName returns the name of the object associated with the event
GetName() string
// GetID returns a unique identifier for the event
GetID() string
}
Meta is an interface for our built in event types that all of them implement
type Promotion ¶
type Promotion struct {
Freight *Freight `json:"freight,omitempty"`
Name string `json:"name"`
StageName string `json:"stageName"`
CreateTime time.Time `json:"createTime"`
Applications []types.NamespacedName `json:"applications,omitempty"`
}
Promotion is a struct that contains common fields for promotion-related events.
func UnmarshalPromotionAnnotations ¶
UnmarshalPromotionAnnotations populates the Promotion fields from the given kubernetes annotations.
func (*Promotion) MarshalAnnotationsTo ¶
type PromotionAborted ¶
PromotionAborted is event data related to an aborted promotion.
func NewPromotionAborted ¶
func NewPromotionAborted( message, actor string, promotion *kargoapi.Promotion, freight *kargoapi.Freight, ) *PromotionAborted
NewPromotionAborted creates a new PromotionAborted event from the given promotion and freight data. The given actor will be used if it is not empty, but it will be overridden if the promotion has an actor annotation.
func UnmarshalPromotionAbortedAnnotations ¶
func UnmarshalPromotionAbortedAnnotations( eventID string, annotations map[string]string, ) (*PromotionAborted, error)
UnmarshalPromotionAbortedAnnotations converts the given annotations into a PromotionAborted. This is used by the main event handler to convert the data into a normal structured event, but is exposed for convenience.
func (*PromotionAborted) MarshalAnnotations ¶
func (p *PromotionAborted) MarshalAnnotations() map[string]string
func (*PromotionAborted) Type ¶
func (p *PromotionAborted) Type() kargoapi.EventType
type PromotionCreated ¶
PromotionCreated is event data related to a created promotion.
func NewPromotionCreated ¶
func NewPromotionCreated( message, actor string, promotion *kargoapi.Promotion, freight *kargoapi.Freight, ) *PromotionCreated
NewPromotionCreated creates a new PromotionCreated event from the given promotion and freight data. The given actor will be used if it is not empty, but it will be overridden if the promotion has an actor annotation.
func UnmarshalPromotionCreatedAnnotations ¶
func UnmarshalPromotionCreatedAnnotations( eventID string, annotations map[string]string, ) (*PromotionCreated, error)
UnmarshalPromotionCreatedAnnotations converts the given annotations into a PromotionCreated. This is used by the main event handler to convert the data into a normal structured event, but is exposed for convenience.
func (*PromotionCreated) MarshalAnnotations ¶
func (p *PromotionCreated) MarshalAnnotations() map[string]string
func (*PromotionCreated) Type ¶
func (p *PromotionCreated) Type() kargoapi.EventType
type PromotionErrored ¶
PromotionErrored is event data related to an errored promotion.
func NewPromotionErrored ¶
func NewPromotionErrored( message, actor string, promotion *kargoapi.Promotion, freight *kargoapi.Freight, ) *PromotionErrored
NewPromotionErrored creates a new PromotionErrored event from the given promotion and freight data. The given actor will be used if it is not empty, but it will be overridden if the promotion has an actor annotation.
func UnmarshalPromotionErroredAnnotations ¶
func UnmarshalPromotionErroredAnnotations( eventID string, annotations map[string]string, ) (*PromotionErrored, error)
UnmarshalPromotionErroredAnnotations converts the given annotations into a PromotionErrored. This is used by the main event handler to convert the data into a normal structured event, but is exposed for convenience.
func (*PromotionErrored) MarshalAnnotations ¶
func (p *PromotionErrored) MarshalAnnotations() map[string]string
func (*PromotionErrored) Type ¶
func (p *PromotionErrored) Type() kargoapi.EventType
type PromotionFailed ¶
PromotionFailed is event data related to a failed promotion.
func NewPromotionFailed ¶
func NewPromotionFailed( message, actor string, promotion *kargoapi.Promotion, freight *kargoapi.Freight, ) *PromotionFailed
NewPromotionFailed creates a new PromotionFailed event from the given promotion and freight data. The given actor will be used if it is not empty, but it will be overridden if the promotion has an actor annotation.
func UnmarshalPromotionFailedAnnotations ¶
func UnmarshalPromotionFailedAnnotations( eventID string, annotations map[string]string, ) (*PromotionFailed, error)
UnmarshalPromotionFailedAnnotations converts the given annotations into a PromotionFailed. This is used by the main event handler to convert the data into a normal structured event, but is exposed for convenience.
func (*PromotionFailed) MarshalAnnotations ¶
func (p *PromotionFailed) MarshalAnnotations() map[string]string
func (*PromotionFailed) Type ¶
func (p *PromotionFailed) Type() kargoapi.EventType
type PromotionSucceeded ¶
type PromotionSucceeded struct {
Common
Promotion
VerificationPending *bool `json:"verificationPending,omitempty"`
}
PromotionSucceeded is event data related to a successful promotion.
func NewPromotionSucceeded ¶
func NewPromotionSucceeded( message, actor string, promotion *kargoapi.Promotion, freight *kargoapi.Freight, ) *PromotionSucceeded
NewPromotionSucceeded creates a new PromotionSucceeded event from the given promotion and freight data. The given actor will be used if it is not empty, but it will be overridden if the promotion has an actor annotation.
func UnmarshalPromotionSucceededAnnotations ¶
func UnmarshalPromotionSucceededAnnotations( eventID string, annotations map[string]string, ) (*PromotionSucceeded, error)
UnmarshalPromotionSucceededAnnotations converts the given annotations into a PromotionSucceeded. This is used by the main event handler to convert the data into a normal structured event, but is exposed for convenience.
func (*PromotionSucceeded) MarshalAnnotations ¶
func (p *PromotionSucceeded) MarshalAnnotations() map[string]string
func (*PromotionSucceeded) Type ¶
func (p *PromotionSucceeded) Type() kargoapi.EventType