Documentation ¶
Index ¶
- Variables
- func AddControlHooksToContext(ctx context.Context, statusHooks ControlHooks) context.Context
- func OnComplete(ctx context.Context, p *ControlProgress)
- func OnControlComplete(ctx context.Context, controlRun ControlRunStatusProvider, p *ControlProgress)
- func OnControlError(ctx context.Context, controlRun ControlRunStatusProvider, p *ControlProgress)
- func OnControlStart(ctx context.Context, controlRun ControlRunStatusProvider, p *ControlProgress)
- func OnStart(ctx context.Context, p *ControlProgress)
- type ControlHooks
- type ControlProgress
- func (p *ControlProgress) Finish(ctx context.Context)
- func (p *ControlProgress) OnControlComplete(ctx context.Context, controlRun ControlRunStatusProvider)
- func (p *ControlProgress) OnControlError(ctx context.Context, controlRun ControlRunStatusProvider)
- func (p *ControlProgress) OnControlStart(ctx context.Context, controlRun ControlRunStatusProvider)
- func (p *ControlProgress) Start(ctx context.Context)
- type ControlRunStatus
- type ControlRunStatusProvider
- type NullControlHook
- func (*NullControlHook) OnComplete(context.Context, *ControlProgress)
- func (*NullControlHook) OnControlComplete(context.Context, ControlRunStatusProvider, *ControlProgress)
- func (*NullControlHook) OnControlError(context.Context, ControlRunStatusProvider, *ControlProgress)
- func (*NullControlHook) OnControlStart(context.Context, ControlRunStatusProvider, *ControlProgress)
- func (*NullControlHook) OnStart(context.Context, *ControlProgress)
- type SnapshotControlHooks
- func (c *SnapshotControlHooks) OnComplete(_ context.Context, _ *ControlProgress)
- func (c *SnapshotControlHooks) OnControlComplete(ctx context.Context, _ ControlRunStatusProvider, progress *ControlProgress)
- func (c *SnapshotControlHooks) OnControlError(ctx context.Context, _ ControlRunStatusProvider, _ *ControlProgress)
- func (c *SnapshotControlHooks) OnControlStart(context.Context, ControlRunStatusProvider, *ControlProgress)
- func (c *SnapshotControlHooks) OnStart(context.Context, *ControlProgress)
- type StatusControlHooks
- func (c *StatusControlHooks) OnComplete(ctx context.Context, _ *ControlProgress)
- func (c *StatusControlHooks) OnControlComplete(ctx context.Context, _ ControlRunStatusProvider, p *ControlProgress)
- func (c *StatusControlHooks) OnControlError(ctx context.Context, _ ControlRunStatusProvider, p *ControlProgress)
- func (c *StatusControlHooks) OnControlStart(ctx context.Context, _ ControlRunStatusProvider, p *ControlProgress)
- func (c *StatusControlHooks) OnStart(ctx context.Context, _ *ControlProgress)
- type StatusSummary
Constants ¶
This section is empty.
Variables ¶
View Source
var NullHooks = &NullControlHook{}
Functions ¶
func AddControlHooksToContext ¶
func AddControlHooksToContext(ctx context.Context, statusHooks ControlHooks) context.Context
func OnComplete ¶
func OnComplete(ctx context.Context, p *ControlProgress)
func OnControlComplete ¶
func OnControlComplete(ctx context.Context, controlRun ControlRunStatusProvider, p *ControlProgress)
func OnControlError ¶
func OnControlError(ctx context.Context, controlRun ControlRunStatusProvider, p *ControlProgress)
func OnControlStart ¶
func OnControlStart(ctx context.Context, controlRun ControlRunStatusProvider, p *ControlProgress)
func OnStart ¶
func OnStart(ctx context.Context, p *ControlProgress)
Types ¶
type ControlHooks ¶
type ControlHooks interface { OnStart(context.Context, *ControlProgress) OnControlStart(context.Context, ControlRunStatusProvider, *ControlProgress) OnControlComplete(context.Context, ControlRunStatusProvider, *ControlProgress) OnControlError(context.Context, ControlRunStatusProvider, *ControlProgress) OnComplete(context.Context, *ControlProgress) }
func ControlHooksFromContext ¶
func ControlHooksFromContext(ctx context.Context) ControlHooks
type ControlProgress ¶
type ControlProgress struct { Total int `json:"total"` Pending int `json:"pending"` Complete int `json:"complete"` Error int `json:"error"` Executing int `json:"executing"` StatusSummaries *StatusSummary `json:"summary"` // contains filtered or unexported fields }
func NewControlProgress ¶
func NewControlProgress(total int) *ControlProgress
func (*ControlProgress) Finish ¶
func (p *ControlProgress) Finish(ctx context.Context)
func (*ControlProgress) OnControlComplete ¶
func (p *ControlProgress) OnControlComplete(ctx context.Context, controlRun ControlRunStatusProvider)
func (*ControlProgress) OnControlError ¶
func (p *ControlProgress) OnControlError(ctx context.Context, controlRun ControlRunStatusProvider)
func (*ControlProgress) OnControlStart ¶
func (p *ControlProgress) OnControlStart(ctx context.Context, controlRun ControlRunStatusProvider)
func (*ControlProgress) Start ¶
func (p *ControlProgress) Start(ctx context.Context)
type ControlRunStatus ¶
type ControlRunStatus string
const ( ControlRunReady ControlRunStatus = "ready" ControlRunStarted ControlRunStatus = "started" ControlRunComplete ControlRunStatus = "complete" ControlRunError ControlRunStatus = "error" )
type ControlRunStatusProvider ¶
type ControlRunStatusProvider interface { GetControlId() string GetRunStatus() ControlRunStatus GetStatusSummary() *StatusSummary }
ControlRunStatusProvider is an interface used to allow us to pass a control as the payload of ControlComplete and ControlError events -
type NullControlHook ¶
type NullControlHook struct{}
func (*NullControlHook) OnComplete ¶
func (*NullControlHook) OnComplete(context.Context, *ControlProgress)
func (*NullControlHook) OnControlComplete ¶
func (*NullControlHook) OnControlComplete(context.Context, ControlRunStatusProvider, *ControlProgress)
func (*NullControlHook) OnControlError ¶
func (*NullControlHook) OnControlError(context.Context, ControlRunStatusProvider, *ControlProgress)
func (*NullControlHook) OnControlStart ¶
func (*NullControlHook) OnControlStart(context.Context, ControlRunStatusProvider, *ControlProgress)
func (*NullControlHook) OnStart ¶
func (*NullControlHook) OnStart(context.Context, *ControlProgress)
type SnapshotControlHooks ¶ added in v0.17.0
type SnapshotControlHooks struct {
Enabled bool
}
SnapshotControlHooks is a struct which implements ControlHooks, and displays the control progress as a status message
func NewSnapshotControlHooks ¶ added in v0.17.0
func NewSnapshotControlHooks() *SnapshotControlHooks
func (*SnapshotControlHooks) OnComplete ¶ added in v0.17.0
func (c *SnapshotControlHooks) OnComplete(_ context.Context, _ *ControlProgress)
func (*SnapshotControlHooks) OnControlComplete ¶ added in v0.17.0
func (c *SnapshotControlHooks) OnControlComplete(ctx context.Context, _ ControlRunStatusProvider, progress *ControlProgress)
func (*SnapshotControlHooks) OnControlError ¶ added in v0.17.0
func (c *SnapshotControlHooks) OnControlError(ctx context.Context, _ ControlRunStatusProvider, _ *ControlProgress)
func (*SnapshotControlHooks) OnControlStart ¶ added in v0.17.0
func (c *SnapshotControlHooks) OnControlStart(context.Context, ControlRunStatusProvider, *ControlProgress)
func (*SnapshotControlHooks) OnStart ¶ added in v0.17.0
func (c *SnapshotControlHooks) OnStart(context.Context, *ControlProgress)
type StatusControlHooks ¶ added in v0.17.0
type StatusControlHooks struct {
Enabled bool
}
StatusControlHooks is a struct which implements ControlHooks, and displays the control progress as a status message
func NewStatusControlHooks ¶ added in v0.17.0
func NewStatusControlHooks() *StatusControlHooks
func (*StatusControlHooks) OnComplete ¶ added in v0.17.0
func (c *StatusControlHooks) OnComplete(ctx context.Context, _ *ControlProgress)
func (*StatusControlHooks) OnControlComplete ¶ added in v0.17.0
func (c *StatusControlHooks) OnControlComplete(ctx context.Context, _ ControlRunStatusProvider, p *ControlProgress)
func (*StatusControlHooks) OnControlError ¶ added in v0.17.0
func (c *StatusControlHooks) OnControlError(ctx context.Context, _ ControlRunStatusProvider, p *ControlProgress)
func (*StatusControlHooks) OnControlStart ¶ added in v0.17.0
func (c *StatusControlHooks) OnControlStart(ctx context.Context, _ ControlRunStatusProvider, p *ControlProgress)
func (*StatusControlHooks) OnStart ¶ added in v0.17.0
func (c *StatusControlHooks) OnStart(ctx context.Context, _ *ControlProgress)
type StatusSummary ¶
type StatusSummary struct { Alarm int `json:"alarm"` Ok int `json:"ok"` Info int `json:"info"` Skip int `json:"skip"` Error int `json:"error"` }
StatusSummary is a struct containing the counts of each possible control status
func (*StatusSummary) FailedCount ¶
func (s *StatusSummary) FailedCount() int
func (*StatusSummary) Merge ¶
func (s *StatusSummary) Merge(summary *StatusSummary)
func (*StatusSummary) PassedCount ¶
func (s *StatusSummary) PassedCount() int
func (*StatusSummary) TotalCount ¶
func (s *StatusSummary) TotalCount() int
Click to show internal directories.
Click to hide internal directories.