-
Notifications
You must be signed in to change notification settings - Fork 5
/
event.go
43 lines (35 loc) · 1.46 KB
/
event.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
37
38
39
40
41
42
43
// Copyright 2020, Square, Inc.
package rotate
import (
"time"
)
const (
EVENT_BEGIN_ROTATION = "begin-rotation"
EVENT_BEGIN_PASSWORD_ROTATION = "begin-password-rotation"
EVENT_END_PASSWORD_ROTATION = "end-password-rotation"
EVENT_BEGIN_PASSWORD_VERIFICATION = "begin-password-verification"
EVENT_END_PASSWORD_VERIFICATION = "end-password-verification"
EVENT_NEW_PASSWORD_IS_CURRENT = "new-password-is-current"
EVENT_END_ROTATION = "end-rotation"
EVENT_BEGIN_PASSWORD_ROLLBACK = "begin-password-rollback"
EVENT_ERROR = "error"
)
// Event is an important event during the four-step Secrets Manager rotation process.
type Event struct {
Name string // EVENT_ const
Step string // "createSecret", "setSecret", "testSecret", or "finishSecret"
Time time.Time // when event occurred
Error error // non-nil if Step failed (Name will be EVENT_ERROR)
}
// EventReceiver receives events from a Rotator during the four-step Secrets Manager
// rotation process.
type EventReceiver interface {
// Receive receives the Event sent by a Rotator during the four-step Secrets Manager
// rotation process. If this function blocks, it blocks the rotation process.
Receive(Event)
}
// NullEventReceiver is the default EventReceiver if none is provided in the Config.
// It ignores all events.
type NullEventReceiver struct{}
var _ EventReceiver = NullEventReceiver{}
func (r NullEventReceiver) Receive(Event) {}