forked from OpsLevel/opslevel-go
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcheck_tool_usage.go
48 lines (41 loc) · 1.71 KB
/
check_tool_usage.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
package opslevel
type ToolUsageCheckFragment struct {
ToolCategory ToolCategory `graphql:"toolCategory"`
ToolNamePredicate *Predicate `graphql:"toolNamePredicate"`
ToolUrlPredicate *Predicate `graphql:"toolUrlPredicate"`
EnvironmentPredicate *Predicate `graphql:"environmentPredicate"`
}
type CheckToolUsageCreateInput struct {
CheckCreateInput
ToolCategory ToolCategory `json:"toolCategory"`
ToolNamePredicate *PredicateInput `json:"toolNamePredicate,omitempty"`
ToolUrlPredicate *PredicateInput `json:"toolUrlPredicate,omitempty"`
EnvironmentPredicate *PredicateInput `json:"environmentPredicate,omitempty"`
}
type CheckToolUsageUpdateInput struct {
CheckUpdateInput
ToolCategory ToolCategory `json:"toolCategory,omitempty"`
ToolNamePredicate *PredicateInput `json:"toolNamePredicate,omitempty"`
ToolUrlPredicate *PredicateInput `json:"toolUrlPredicate,omitempty"`
EnvironmentPredicate *PredicateInput `json:"environmentPredicate,omitempty"`
}
func (client *Client) CreateCheckToolUsage(input CheckToolUsageCreateInput) (*Check, error) {
var m struct {
Payload CheckResponsePayload `graphql:"checkToolUsageCreate(input: $input)"`
}
v := PayloadVariables{
"input": input,
}
err := client.Mutate(&m, v, WithName("CheckToolUsageCreate"))
return &m.Payload.Check, HandleErrors(err, m.Payload.Errors)
}
func (client *Client) UpdateCheckToolUsage(input CheckToolUsageUpdateInput) (*Check, error) {
var m struct {
Payload CheckResponsePayload `graphql:"checkToolUsageUpdate(input: $input)"`
}
v := PayloadVariables{
"input": input,
}
err := client.Mutate(&m, v, WithName("CheckToolUsageUpdate"))
return &m.Payload.Check, HandleErrors(err, m.Payload.Errors)
}