-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathcheck_custom_event.go
31 lines (28 loc) · 1.47 KB
/
check_custom_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
package opslevel
type CustomEventCheckFragment struct {
Integration IntegrationId `graphql:"integration"` // The integration this check uses.
PassPending bool `graphql:"passPending"` // True if this check should pass by default. Otherwise the default 'pending' state counts as a failure.
ResultMessage string `graphql:"resultMessage"` // The check result message template.
ServiceSelector string `graphql:"serviceSelector"` // A jq expression that will be ran against your payload to select the service.
SuccessCondition string `graphql:"successCondition"` // A jq expression that will be ran against your payload to evaluate the check result. A truthy value will result in the check passing.
}
func (client *Client) CreateCheckCustomEvent(input CheckCustomEventCreateInput) (*Check, error) {
var m struct {
Payload CheckResponsePayload `graphql:"checkCustomEventCreate(input: $input)"`
}
v := PayloadVariables{
"input": input,
}
err := client.Mutate(&m, v, WithName("CheckCustomEventCreate"))
return &m.Payload.Check, HandleErrors(err, m.Payload.Errors)
}
func (client *Client) UpdateCheckCustomEvent(input CheckCustomEventUpdateInput) (*Check, error) {
var m struct {
Payload CheckResponsePayload `graphql:"checkCustomEventUpdate(input: $input)"`
}
v := PayloadVariables{
"input": input,
}
err := client.Mutate(&m, v, WithName("CheckCustomEventUpdate"))
return &m.Payload.Check, HandleErrors(err, m.Payload.Errors)
}