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 APIToken
- type APITokenCreated
- type APITokenDeleted
- type AnnotationMarshaler
- type Common
- type Custom
- type Freight
- type FreightApproved
- type FreightCreated
- 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 PromotionDiscarded
- 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.EventTypePromotionDiscarded, kargoapi.EventTypeFreightCreated, kargoapi.EventTypeFreightApproved, kargoapi.EventTypeFreightVerificationSucceeded, kargoapi.EventTypeFreightVerificationFailed, kargoapi.EventTypeFreightVerificationErrored, kargoapi.EventTypeFreightVerificationAborted, kargoapi.EventTypeFreightVerificationInconclusive, kargoapi.EventTypeFreightVerificationUnknown, kargoapi.EventTypeAPITokenCreated, kargoapi.EventTypeAPITokenDeleted, }
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 APIToken ¶ added in v1.12.0
type APIToken struct {
Name string `json:"name"`
RoleName string `json:"roleName"`
// SystemLevel is true when the token belongs to a system-level Role. Such
// tokens live in Kargo's own namespace, which the event otherwise reports
// as its project.
SystemLevel bool `json:"systemLevel"`
}
APIToken describes the API token an event is about. An API token is a ServiceAccount token Secret bound to a Kargo Role, so the Secret is the event's involved object and the Role is recorded alongside it.
func UnmarshalAPITokenAnnotations ¶ added in v1.12.0
UnmarshalAPITokenAnnotations populates the APIToken fields from the given Kubernetes annotations.
func (*APIToken) MarshalAnnotationsTo ¶ added in v1.12.0
type APITokenCreated ¶ added in v1.12.0
APITokenCreated is emitted by the API server when it mints an API token.
func NewAPITokenCreated ¶ added in v1.12.0
func NewAPITokenCreated( message, actor string, tokenSecret *corev1.Secret, systemLevel bool, ) *APITokenCreated
NewAPITokenCreated creates a new APITokenCreated event for the given token Secret. The Secret's namespace is the event's project; for a system-level token that is Kargo's own namespace.
func UnmarshalAPITokenCreatedAnnotations ¶ added in v1.12.0
func UnmarshalAPITokenCreatedAnnotations( eventID string, annotations map[string]string, ) (*APITokenCreated, error)
UnmarshalAPITokenCreatedAnnotations populates an APITokenCreated event from the given Kubernetes annotations and event ID.
func (*APITokenCreated) MarshalAnnotations ¶ added in v1.12.0
func (a *APITokenCreated) MarshalAnnotations() map[string]string
func (*APITokenCreated) Type ¶ added in v1.12.0
func (a *APITokenCreated) Type() kargoapi.EventType
type APITokenDeleted ¶ added in v1.12.0
APITokenDeleted is emitted by the API server when it deletes an API token.
func NewAPITokenDeleted ¶ added in v1.12.0
func NewAPITokenDeleted( message, actor string, tokenSecret *corev1.Secret, systemLevel bool, ) *APITokenDeleted
NewAPITokenDeleted creates a new APITokenDeleted event for the given token Secret, as it was before deletion.
func UnmarshalAPITokenDeletedAnnotations ¶ added in v1.12.0
func UnmarshalAPITokenDeletedAnnotations( eventID string, annotations map[string]string, ) (*APITokenDeleted, error)
UnmarshalAPITokenDeletedAnnotations populates an APITokenDeleted event from the given Kubernetes annotations and event ID.
func (*APITokenDeleted) MarshalAnnotations ¶ added in v1.12.0
func (a *APITokenDeleted) MarshalAnnotations() map[string]string
func (*APITokenDeleted) Type ¶ added in v1.12.0
func (a *APITokenDeleted) Type() kargoapi.EventType
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"`
WarehouseName string `json:"warehouseName,omitempty"`
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"`
Artifacts []kargoapi.ArtifactReference `json:"artifacts,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 FreightCreated ¶ added in v1.11.0
FreightCreated is an event fired when a new piece of Freight is created by a Warehouse or API server
func NewFreightCreated ¶ added in v1.11.0
func NewFreightCreated(message, actor string, freight *kargoapi.Freight) *FreightCreated
NewFreightCreated creates a new `FreightCreated` event.
func UnmarshalFreightCreatedAnnotations ¶ added in v1.11.0
func UnmarshalFreightCreatedAnnotations( eventID string, annotations map[string]string, ) (*FreightCreated, error)
UnmarshalFreightCreatedAnnotations converts the given annotations into a FreightCreated event. This is used by the main event handler to convert the data into a normal structured event, but is exposed for convenience.
func (*FreightCreated) MarshalAnnotations ¶ added in v1.11.0
func (f *FreightCreated) MarshalAnnotations() map[string]string
func (*FreightCreated) Type ¶ added in v1.11.0
func (f *FreightCreated) 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"`
Rollback bool `json:"rollback,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 PromotionDiscarded ¶ added in v1.12.0
PromotionDiscarded is event data recorded when the control plane removes a Promotion that never ran. Every other way a Promotion can end reports an outcome of its own; this covers the case where the removal *is* the outcome, and the message is the only surviving record of why.
Discarding is narrower than deleting. The garbage collector's retention deletes stay silent, because those Promotions already reached a terminal phase and already reported what happened.
Nothing in OSS discards a Promotion today. Kargo Enterprise does, when a promotion window closes while a Promotion is still Pending. The type is registered here because registration is what gives the event an involvedObject apiVersion, without which it never reaches the project event stream or the UI.
func NewPromotionDiscarded ¶ added in v1.12.0
func NewPromotionDiscarded( message, actor string, promotion *kargoapi.Promotion, freight *kargoapi.Freight, ) *PromotionDiscarded
NewPromotionDiscarded creates a new PromotionDiscarded event from the given promotion and freight data. The message should say why the Promotion was discarded, since that is the only record left of it. The given actor will be used if it is not empty, but it will be overridden if the promotion has an actor annotation.
func UnmarshalPromotionDiscardedAnnotations ¶ added in v1.12.0
func UnmarshalPromotionDiscardedAnnotations( eventID string, annotations map[string]string, ) (*PromotionDiscarded, error)
UnmarshalPromotionDiscardedAnnotations converts the given annotations into a PromotionDiscarded. This is used by the main event handler to convert the data into a normal structured event, but is exposed for convenience.
func (*PromotionDiscarded) MarshalAnnotations ¶ added in v1.12.0
func (p *PromotionDiscarded) MarshalAnnotations() map[string]string
func (*PromotionDiscarded) Type ¶ added in v1.12.0
func (p *PromotionDiscarded) 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
type Sender ¶
type Sender interface {
// Send sends the event to the configured destination, returning an error if the send fails.
Send(ctx context.Context, evt Meta) error
// Shutdown drains any buffered events, blocking until they have been
// delivered or the underlying transport gives up. Callers should
// invoke Shutdown during graceful termination to avoid losing queued
// events.
Shutdown()
}