| 1 |
package opsgenie |
| 2 |
|
| 3 |
// AlertPayload represents the payload being sent to the OpsGenie API |
| 4 |
// |
| 5 |
// See: https://docs.opsgenie.com/docs/alert-api#create-alert |
| 6 |
// |
| 7 |
// Some fields contain complex values like arrays and objects. |
| 8 |
// Because `params` are strings only we cannot pass in slices |
| 9 |
// or maps. Instead we "preserve" the JSON in those fields. That |
| 10 |
// way we can pass in complex types as JSON like so: |
| 11 |
// |
| 12 |
// service.Send("An example alert message", &types.Params{ |
| 13 |
// "alias": "Life is too short for no alias", |
| 14 |
// "description": "Every alert needs a description", |
| 15 |
// "responders": `[{"id":"4513b7ea-3b91-438f-b7e4-e3e54af9147c","type":"team"},{"name":"NOC","type":"team"}]`, |
| 16 |
// "visibleTo": `[{"id":"4513b7ea-3b91-438f-b7e4-e3e54af9147c","type":"team"},{"name":"rocket_team","type":"team"}]`, |
| 17 |
// "details": `{"key1": "value1", "key2": "value2"}`, |
| 18 |
// }) |
| 19 |
type AlertPayload struct { |
| 20 |
Message string `json:"message"` |
| 21 |
Alias string `json:"alias,omitempty"` |
| 22 |
Description string `json:"description,omitempty"` |
| 23 |
Responders []Entity `json:"responders,omitempty"` |
| 24 |
VisibleTo []Entity `json:"visibleTo,omitempty"` |
| 25 |
Actions []string `json:"actions,omitempty"` |
| 26 |
Tags []string `json:"tags,omitempty"` |
| 27 |
Details map[string]string `json:"details,omitempty"` |
| 28 |
Entity string `json:"entity,omitempty"` |
| 29 |
Source string `json:"source,omitempty"` |
| 30 |
Priority string `json:"priority,omitempty"` |
| 31 |
User string `json:"user,omitempty"` |
| 32 |
Note string `json:"note,omitempty"` |
| 33 |
} |