-
Notifications
You must be signed in to change notification settings - Fork 54
/
events.go
81 lines (61 loc) · 2.52 KB
/
events.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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
// Copyright 2021, Pulumi Corporation. All rights reserved.
package v1
// StackEvent is a manifestation of a Kubernetes event emitted by the stack controller.
type StackEvent struct {
reason StackEventReason
eventType StackEventType
}
func (e StackEvent) EventType() string {
return string(e.eventType)
}
func (e StackEvent) Reason() string {
return string(e.reason)
}
// StackEventType tracks the types supported by the Kubernetes EventRecorder interface in k8s.io/client-go/tools/record
type StackEventType string
const (
EventTypeNormal StackEventType = "Normal"
EventTypeWarning StackEventType = "Warning"
)
// StackEventReason reflects distinct categorizations of events emitted by the stack controller.
type StackEventReason string
const (
// Warnings
StackConfigInvalid StackEventReason = "StackConfigInvalid"
StackInitializationFailure StackEventReason = "StackInitializationFailure"
StackGitAuthFailure StackEventReason = "StackGitAuthenticationFailure"
StackUpdateFailure StackEventReason = "StackUpdateFailure"
StackUpdateConflictDetected StackEventReason = "StackUpdateConflictDetected"
StackOutputRetrievalFailure StackEventReason = "StackOutputRetrievalFailure"
// Normals
StackUpdateDetected StackEventReason = "StackUpdateDetected"
StackNotFound StackEventReason = "StackNotFound"
StackUpdateSuccessful StackEventReason = "StackCreated"
)
func StackConfigInvalidEvent() StackEvent {
return StackEvent{eventType: EventTypeWarning, reason: StackConfigInvalid}
}
func StackInitializationFailureEvent() StackEvent {
return StackEvent{eventType: EventTypeWarning, reason: StackInitializationFailure}
}
func StackGitAuthFailureEvent() StackEvent {
return StackEvent{eventType: EventTypeWarning, reason: StackGitAuthFailure}
}
func StackUpdateFailureEvent() StackEvent {
return StackEvent{eventType: EventTypeWarning, reason: StackUpdateFailure}
}
func StackUpdateConflictDetectedEvent() StackEvent {
return StackEvent{eventType: EventTypeWarning, reason: StackUpdateConflictDetected}
}
func StackOutputRetrievalFailureEvent() StackEvent {
return StackEvent{eventType: EventTypeWarning, reason: StackOutputRetrievalFailure}
}
func StackUpdateDetectedEvent() StackEvent {
return StackEvent{eventType: EventTypeNormal, reason: StackUpdateDetected}
}
func StackNotFoundEvent() StackEvent {
return StackEvent{eventType: EventTypeNormal, reason: StackNotFound}
}
func StackUpdateSuccessfulEvent() StackEvent {
return StackEvent{eventType: EventTypeNormal, reason: StackUpdateSuccessful}
}