forked from opsgenie/opsgenie-go-sdk-v2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathresult.go
166 lines (141 loc) · 4.61 KB
/
result.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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
package integration
import (
"github.com/opsgenie/opsgenie-go-sdk-v2/client"
"github.com/opsgenie/opsgenie-go-sdk-v2/og"
)
type ListResult struct {
client.ResultMetadata
Integrations []GenericFields `json:"data"`
}
type GenericFields struct {
Id string `json:"id"`
Name string `json:"name"`
Enabled bool `json:"enabled"`
Type string `json:"type"`
TeamId string `json:"teamId"`
}
type GetResult struct {
client.ResultMetadata
Data map[string]interface{} `json:"data"`
}
type APIBasedIntegrationResult struct {
client.ResultMetadata
GenericFields
ApiKey string `json:"apiKey"`
}
type EmailBasedIntegrationResult struct {
client.ResultMetadata
GenericFields
EmailAddress string `json:"emailAddress"`
}
type UpdateResult struct {
client.ResultMetadata
Data map[string]interface{} `json:"data"`
}
type DeleteResult struct {
client.ResultMetadata
Result string `json:"result"`
}
type EnableResult struct {
client.ResultMetadata
GenericFields
}
type DisableResult struct {
client.ResultMetadata
GenericFields
}
type AuthenticateResult struct {
client.ResultMetadata
Result string `json:"result"`
}
type ActionsResult struct {
client.ResultMetadata
Parent ParentIntegration `json:"_parent"`
Ignore []IgnoreAction `json:"ignore"`
Create []CreateAction `json:"create"`
Close []CloseAction `json:"close"`
Acknowledge []AcknowledgeAction `json:"acknowledge"`
AddNote []AddNoteAction `json:"addNote"`
}
type ParentIntegration struct {
Id string `json:"id"`
Name string `json:"name"`
Enabled bool `json:"enabled"`
Type string `json:"type"`
}
type GenericActionFields struct {
Type string `json:"type"`
Name string `json:"name"`
Order int `json:"order"`
Filter FilterResult `json:"filter"`
}
type FilterResult struct {
ConditionMatchType og.ConditionMatchType `json:"conditionMatchType,omitempty"`
Conditions []ConditionResult `json:"conditions,omitempty"`
}
type ConditionResult struct {
Field og.ConditionFieldType `json:"field,omitempty"`
IsNot bool `json:"not,omitempty"`
Operation og.ConditionOperation `json:"operation,omitempty"`
ExpectedValue string `json:"expectedValue,omitempty"`
Key string `json:"key,omitempty"`
Order *int `json:"order,omitempty"`
}
type CreateAction struct {
GenericActionFields
User string `json:"user"`
Note string `json:"note"`
Alias string `json:"alias"`
Source string `json:"source"`
Message string `json:"message"`
Description string `json:"description"`
Entity string `json:"entity"`
AppendAttachments bool `json:"appendAttachments"`
IgnoreAlertActionsFromPayload bool `json:"ignoreAlertActionsFromPayload"`
IgnoreRespondersFromPayload bool `json:"ignoreRespondersFromPayload"`
IgnoreTagsFromPayload bool `json:"ignoreTagsFromPayload"`
IgnoreExtraPropertiesFromPayload bool `json:"ignoreExtraPropertiesFromPayload"`
AlertActions []string `json:"alertActions"`
Responders []Responder `json:"responders"`
Tags []string `json:"tags"`
ExtraProperties map[string]string `json:"extraProperties"`
}
type CloseAction struct {
GenericActionFields
User string `json:"user"`
Note string `json:"note"`
Alias string `json:"alias"`
}
type AcknowledgeAction struct {
GenericActionFields
User string `json:"user"`
Note string `json:"note"`
Alias string `json:"alias"`
}
type AddNoteAction struct {
GenericActionFields
User string `json:"user"`
Note string `json:"note"`
Alias string `json:"alias"`
}
type IgnoreAction struct {
GenericActionFields
}
type ResponderType string
type ActionType string
const (
User ResponderType = "user"
Team ResponderType = "team"
Escalation ResponderType = "escalation"
Schedule ResponderType = "schedule"
Create ActionType = "create"
Close ActionType = "close"
Acknowledge ActionType = "acknowledge"
AddNote ActionType = "AddNote"
)
type Responder struct {
Type ResponderType `json:"type, omitempty"`
Name string `json:"name,omitempty"`
Id string `json:"id,omitempty"`
Username string `json:"username, omitempty"`
}