forked from OpsLevel/opslevel-go
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcheck_custom_event.go
51 lines (44 loc) · 1.74 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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
package opslevel
type CustomEventCheckFragment struct {
Integration IntegrationId `graphql:"integration"`
PassPending bool `graphql:"passPending"`
ResultMessage string `graphql:"resultMessage"`
ServiceSelector string `graphql:"serviceSelector"`
SuccessCondition string `graphql:"successCondition"`
}
type CheckCustomEventCreateInput struct {
CheckCreateInput
Integration ID `json:"integrationId"`
ServiceSelector string `json:"serviceSelector"`
SuccessCondition string `json:"successCondition"`
Message string `json:"resultMessage,omitempty"`
PassPending *bool `json:"passPending,omitempty"`
}
type CheckCustomEventUpdateInput struct {
CheckUpdateInput
ServiceSelector string `json:"serviceSelector,omitempty"`
SuccessCondition string `json:"successCondition,omitempty"`
Message *string `json:"resultMessage,omitempty"`
PassPending *bool `json:"passPending,omitempty"`
Integration *ID `json:"integrationId,omitempty"`
}
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)
}