-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathalert_source.go
63 lines (55 loc) · 1.73 KB
/
alert_source.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
package opslevel
type AlertSourceDeleteInput struct {
Id ID `json:"id"`
}
func NewAlertSource(kind AlertSourceTypeEnum, id string) *AlertSourceExternalIdentifier {
output := AlertSourceExternalIdentifier{
Type: kind,
ExternalId: id,
}
return &output
}
func (client *Client) CreateAlertSourceService(input AlertSourceServiceCreateInput) (*AlertSourceService, error) {
var m struct {
Payload AlertSourceServiceCreatePayload `graphql:"alertSourceServiceCreate(input: $input)"`
}
v := PayloadVariables{
"input": input,
}
err := client.Mutate(&m, v, WithName("AlertSourceServiceCreate"))
return &m.Payload.AlertSourceService, HandleErrors(err, m.Payload.Errors)
}
func (client *Client) GetAlertSourceWithExternalIdentifier(input AlertSourceExternalIdentifier) (*AlertSource, error) {
var q struct {
Account struct {
AlertSource AlertSource `graphql:"alertSource(externalIdentifier: $externalIdentifier)"`
}
}
v := PayloadVariables{
"externalIdentifier": input,
}
err := client.Query(&q, v, WithName("AlertSourceGet"))
return &q.Account.AlertSource, HandleErrors(err, nil)
}
func (client *Client) GetAlertSource(id ID) (*AlertSource, error) {
var q struct {
Account struct {
AlertSource AlertSource `graphql:"alertSource(id: $id)"`
}
}
v := PayloadVariables{
"id": id,
}
err := client.Query(&q, v, WithName("AlertSourceGet"))
return &q.Account.AlertSource, HandleErrors(err, nil)
}
func (client *Client) DeleteAlertSourceService(id ID) error {
var m struct {
Payload BasePayload `graphql:"alertSourceServiceDelete(input: $input)"`
}
v := PayloadVariables{
"input": AlertSourceDeleteInput{Id: id},
}
err := client.Mutate(&m, v, WithName("AlertSourceServiceDelete"))
return HandleErrors(err, m.Payload.Errors)
}