-
Notifications
You must be signed in to change notification settings - Fork 262
/
control_hooks_snapshot.go
36 lines (28 loc) · 1.09 KB
/
control_hooks_snapshot.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package controlstatus
import (
"context"
"github.com/spf13/viper"
"github.com/turbot/steampipe/pkg/constants"
"github.com/turbot/steampipe/pkg/statushooks"
)
// SnapshotControlHooks is a struct which implements ControlHooks, and displays the control progress as a status message
type SnapshotControlHooks struct {
Enabled bool
}
func NewSnapshotControlHooks() *SnapshotControlHooks {
return &SnapshotControlHooks{
Enabled: viper.GetBool(constants.ArgProgress),
}
}
func (c *SnapshotControlHooks) OnStart(context.Context, *ControlProgress) {
}
func (c *SnapshotControlHooks) OnControlStart(context.Context, ControlRunStatusProvider, *ControlProgress) {
}
func (c *SnapshotControlHooks) OnControlComplete(ctx context.Context, _ ControlRunStatusProvider, progress *ControlProgress) {
statushooks.UpdateSnapshotProgress(ctx, progress.StatusSummaries.TotalCount())
}
func (c *SnapshotControlHooks) OnControlError(ctx context.Context, _ ControlRunStatusProvider, _ *ControlProgress) {
statushooks.SnapshotError(ctx)
}
func (c *SnapshotControlHooks) OnComplete(_ context.Context, _ *ControlProgress) {
}