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 ControlStatusHooks
- func (c *ControlStatusHooks) OnComplete(ctx context.Context, _ *ControlProgress)
- func (c *ControlStatusHooks) OnControlComplete(ctx context.Context, _ ControlRunStatusProvider, p *ControlProgress)
- func (c *ControlStatusHooks) OnControlError(ctx context.Context, _ ControlRunStatusProvider, p *ControlProgress)
- func (c *ControlStatusHooks) OnControlStart(ctx context.Context, _ ControlRunStatusProvider, p *ControlProgress)
- func (c *ControlStatusHooks) OnStart(ctx context.Context, _ *ControlProgress)
- 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 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 uint32
const ( ControlRunReady ControlRunStatus = 1 << iota ControlRunStarted ControlRunComplete ControlRunError )
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 ControlStatusHooks ¶
type ControlStatusHooks struct {
Enabled bool
}
ControlStatusHooks is a struct which implements ControlHooks, and displays the control progress as a status message
func NewControlStatusHooks ¶
func NewControlStatusHooks() *ControlStatusHooks
func (*ControlStatusHooks) OnComplete ¶
func (c *ControlStatusHooks) OnComplete(ctx context.Context, _ *ControlProgress)
func (*ControlStatusHooks) OnControlComplete ¶
func (c *ControlStatusHooks) OnControlComplete(ctx context.Context, _ ControlRunStatusProvider, p *ControlProgress)
func (*ControlStatusHooks) OnControlError ¶
func (c *ControlStatusHooks) OnControlError(ctx context.Context, _ ControlRunStatusProvider, p *ControlProgress)
func (*ControlStatusHooks) OnControlStart ¶
func (c *ControlStatusHooks) OnControlStart(ctx context.Context, _ ControlRunStatusProvider, p *ControlProgress)
func (*ControlStatusHooks) OnStart ¶
func (c *ControlStatusHooks) OnStart(ctx context.Context, _ *ControlProgress)
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 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.