Skip to content

Commit 3172424

Browse files
committed
add generated input.go, use those input structs
1 parent dc0c276 commit 3172424

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+1676
-582
lines changed

actions.go

+50-50
Original file line numberDiff line numberDiff line change
@@ -86,59 +86,59 @@ type CustomActionsTriggerDefinitionsConnection struct {
8686
TotalCount int
8787
}
8888

89-
type CustomActionsWebhookActionCreateInput struct {
90-
Name string `json:"name" yaml:"name" default:"Page The On Call"`
91-
Description *string `json:"description,omitempty" yaml:"description,omitempty" default:"Pages The On Call"`
92-
LiquidTemplate string `json:"liquidTemplate" yaml:"liquidTemplate" default:"{\"token\": \"XXX\", \"ref\":\"main\", \"action\": \"rollback\"}"`
93-
WebhookURL string `json:"webhookUrl" yaml:"webhookUrl" default:"https://api.pagerduty.com/incidents"`
94-
HTTPMethod CustomActionsHttpMethodEnum `json:"httpMethod" yaml:"httpMethod" default:"POST"`
95-
Headers JSON `json:"headers" yaml:"headers" default:"{\"accept\": \"application/vnd.pagerduty+json;version=2\",\"authorization\":\"Token token=XXXXXXXXXXXXX\",\"from\":\"[email protected]\"}"`
96-
}
89+
// type CustomActionsWebhookActionCreateInput struct {
90+
// Name string `json:"name" yaml:"name" default:"Page The On Call"`
91+
// Description *string `json:"description,omitempty" yaml:"description,omitempty" default:"Pages The On Call"`
92+
// LiquidTemplate string `json:"liquidTemplate" yaml:"liquidTemplate" default:"{\"token\": \"XXX\", \"ref\":\"main\", \"action\": \"rollback\"}"`
93+
// WebhookURL string `json:"webhookUrl" yaml:"webhookUrl" default:"https://api.pagerduty.com/incidents"`
94+
// HTTPMethod CustomActionsHttpMethodEnum `json:"httpMethod" yaml:"httpMethod" default:"POST"`
95+
// Headers JSON `json:"headers" yaml:"headers" default:"{\"accept\": \"application/vnd.pagerduty+json;version=2\",\"authorization\":\"Token token=XXXXXXXXXXXXX\",\"from\":\"[email protected]\"}"`
96+
// }
9797

98-
type CustomActionsWebhookActionUpdateInput struct {
99-
Id ID `json:"id"`
100-
Name *string `json:"name,omitempty"`
101-
Description *string `json:"description,omitempty"`
102-
LiquidTemplate *string `json:"liquidTemplate,omitempty"`
103-
WebhookURL *string `json:"webhookUrl,omitempty"`
104-
HTTPMethod CustomActionsHttpMethodEnum `json:"httpMethod,omitempty"`
105-
Headers *JSON `json:"headers,omitempty"`
106-
}
98+
// type CustomActionsWebhookActionUpdateInput struct {
99+
// Id ID `json:"id"`
100+
// Name *string `json:"name,omitempty"`
101+
// Description *string `json:"description,omitempty"`
102+
// LiquidTemplate *string `json:"liquidTemplate,omitempty"`
103+
// WebhookURL *string `json:"webhookUrl,omitempty"`
104+
// HTTPMethod CustomActionsHttpMethodEnum `json:"httpMethod,omitempty"`
105+
// Headers *JSON `json:"headers,omitempty"`
106+
// }
107107

108-
type CustomActionsTriggerDefinitionCreateInput struct {
109-
Name string `json:"name" yaml:"name" default:"Page The On Call"`
110-
Description *string `json:"description,omitempty" yaml:"description,omitempty" default:"Pages the On Call"`
111-
Owner ID `json:"ownerId" yaml:"ownerId" default:"XXX_owner_id_XXX"`
112-
// In the API actionID is `ID!` but that's because of the CustomActionsWebhookActionCreateInput
113-
// But we are not implementing that because it is used for the UI, so we need to enforce an actionId is given
114-
Action ID `json:"actionId" yaml:"actionId"`
115-
Filter *ID `json:"filterId,omitempty" yaml:"filterId,omitempty"`
116-
// This is being explicitly left out to reduce the complexity of the implementation
117-
// action *CustomActionsWebhookActionCreateInput
118-
ManualInputsDefinition string `json:"manualInputsDefinition" yaml:"manualInputsDefinition"`
119-
Published *bool `json:"published,omitempty" yaml:"published,omitempty"`
120-
AccessControl CustomActionsTriggerDefinitionAccessControlEnum `json:"accessControl" yaml:"accessControl"`
121-
ResponseTemplate string `json:"responseTemplate" yaml:"responseTemplate"`
122-
EntityType CustomActionsEntityTypeEnum `json:"entityType" yaml:"entityType"`
123-
ExtendedTeamAccess *[]IdentifierInput `json:"extendedTeamAccess,omitempty" yaml:"extendedTeamAccess,omitempty"`
124-
}
108+
// type CustomActionsTriggerDefinitionCreateInput struct {
109+
// Name string `json:"name" yaml:"name" default:"Page The On Call"`
110+
// Description *string `json:"description,omitempty" yaml:"description,omitempty" default:"Pages the On Call"`
111+
// Owner ID `json:"ownerId" yaml:"ownerId" default:"XXX_owner_id_XXX"`
112+
// // In the API actionID is `ID!` but that's because of the CustomActionsWebhookActionCreateInput
113+
// // But we are not implementing that because it is used for the UI, so we need to enforce an actionId is given
114+
// Action ID `json:"actionId" yaml:"actionId"`
115+
// Filter *ID `json:"filterId,omitempty" yaml:"filterId,omitempty"`
116+
// // This is being explicitly left out to reduce the complexity of the implementation
117+
// // action *CustomActionsWebhookActionCreateInput
118+
// ManualInputsDefinition string `json:"manualInputsDefinition" yaml:"manualInputsDefinition"`
119+
// Published *bool `json:"published,omitempty" yaml:"published,omitempty"`
120+
// AccessControl CustomActionsTriggerDefinitionAccessControlEnum `json:"accessControl" yaml:"accessControl"`
121+
// ResponseTemplate string `json:"responseTemplate" yaml:"responseTemplate"`
122+
// EntityType CustomActionsEntityTypeEnum `json:"entityType" yaml:"entityType"`
123+
// ExtendedTeamAccess *[]IdentifierInput `json:"extendedTeamAccess,omitempty" yaml:"extendedTeamAccess,omitempty"`
124+
// }
125125

126-
type CustomActionsTriggerDefinitionUpdateInput struct {
127-
Id ID `json:"id"`
128-
Name *string `json:"name,omitempty"`
129-
Description *string `json:"description,omitempty"`
130-
Owner *ID `json:"ownerId,omitempty" yaml:"ownerId,omitempty"`
131-
Action *ID `json:"actionId,omitempty" yaml:"actionId,omitempty"`
132-
Filter *ID `json:"filterId,omitempty" yaml:"filterId,omitempty"`
133-
// This is being explicitly left out to reduce the complexity of the implementation
134-
// action *CustomActionsWebhookActionCreateInput
135-
ManualInputsDefinition *string `json:"manualInputsDefinition,omitempty" yaml:"manualInputsDefinition,omitempty"`
136-
Published *bool `json:"published,omitempty" yaml:"published,omitempty"`
137-
AccessControl CustomActionsTriggerDefinitionAccessControlEnum `json:"accessControl,omitempty" yaml:"accessControl,omitempty" default:"service_owners"`
138-
ResponseTemplate *string `json:"responseTemplate,omitempty" yaml:"responseTemplate,omitempty"`
139-
EntityType CustomActionsEntityTypeEnum `json:"entityType,omitempty" yaml:"entityType,omitempty"`
140-
ExtendedTeamAccess *[]IdentifierInput `json:"extendedTeamAccess,omitempty" yaml:"extendedTeamAccess,omitempty" default:"[\"alias\":\"team_alias_1\",\"id\":\"XXX_team_id_XXX\"]"`
141-
}
126+
// type CustomActionsTriggerDefinitionUpdateInput struct {
127+
// Id ID `json:"id"`
128+
// Name *string `json:"name,omitempty"`
129+
// Description *string `json:"description,omitempty"`
130+
// Owner *ID `json:"ownerId,omitempty" yaml:"ownerId,omitempty"`
131+
// Action *ID `json:"actionId,omitempty" yaml:"actionId,omitempty"`
132+
// Filter *ID `json:"filterId,omitempty" yaml:"filterId,omitempty"`
133+
// // This is being explicitly left out to reduce the complexity of the implementation
134+
// // action *CustomActionsWebhookActionCreateInput
135+
// ManualInputsDefinition *string `json:"manualInputsDefinition,omitempty" yaml:"manualInputsDefinition,omitempty"`
136+
// Published *bool `json:"published,omitempty" yaml:"published,omitempty"`
137+
// AccessControl CustomActionsTriggerDefinitionAccessControlEnum `json:"accessControl,omitempty" yaml:"accessControl,omitempty" default:"service_owners"`
138+
// ResponseTemplate *string `json:"responseTemplate,omitempty" yaml:"responseTemplate,omitempty"`
139+
// EntityType CustomActionsEntityTypeEnum `json:"entityType,omitempty" yaml:"entityType,omitempty"`
140+
// ExtendedTeamAccess *[]IdentifierInput `json:"extendedTeamAccess,omitempty" yaml:"extendedTeamAccess,omitempty" default:"[\"alias\":\"team_alias_1\",\"id\":\"XXX_team_id_XXX\"]"`
141+
// }
142142

143143
func (client *Client) CreateWebhookAction(input CustomActionsWebhookActionCreateInput) (*CustomActionsExternalAction, error) {
144144
var m struct {

actions_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ func TestCreateWebhookAction(t *testing.T) {
2222
// Act
2323
action, err := client.CreateWebhookAction(ol.CustomActionsWebhookActionCreateInput{
2424
Name: "Deploy Rollback",
25-
LiquidTemplate: "{\"token\": \"XXX\", \"ref\":\"main\", \"action\": \"rollback\"}",
25+
LiquidTemplate: ol.NewString("{\"token\": \"XXX\", \"ref\":\"main\", \"action\": \"rollback\"}"),
2626
Headers: ol.JSON{
2727
"Content-Type": "application/json",
2828
},

alert_source.go

+10-10
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
package opslevel
22

3-
type AlertSourceExternalIdentifier struct {
4-
Type AlertSourceTypeEnum `json:"type" yaml:"type"`
5-
ExternalId string `json:"externalId" yaml:"externalId"`
6-
}
3+
// type AlertSourceExternalIdentifier struct {
4+
// Type AlertSourceTypeEnum `json:"type" yaml:"type"`
5+
// ExternalId string `json:"externalId" yaml:"externalId"`
6+
// }
77

88
type AlertSource struct {
99
Name string `graphql:"name"`
@@ -22,11 +22,11 @@ type AlertSourceService struct {
2222
Status AlertSourceStatusTypeEnum `graphql:"status"`
2323
}
2424

25-
type AlertSourceServiceCreateInput struct {
26-
Service IdentifierInput `json:"service" yaml:"service" default:"{\"alias\":\"sound-the-alarm\"}"`
27-
Id ID `json:"alertSourceId,omitempty" yaml:"alertSourceId,omitempty"`
28-
ExternalID *AlertSourceExternalIdentifier `json:"alertSourceExternalIdentifier,omitempty" yaml:"alertSourceExternalIdentifier,omitempty"`
29-
}
25+
// type AlertSourceServiceCreateInput struct {
26+
// Service IdentifierInput `json:"service" yaml:"service" default:"{\"alias\":\"sound-the-alarm\"}"`
27+
// Id ID `json:"alertSourceId,omitempty" yaml:"alertSourceId,omitempty"`
28+
// ExternalID *AlertSourceExternalIdentifier `json:"alertSourceExternalIdentifier,omitempty" yaml:"alertSourceExternalIdentifier,omitempty"`
29+
// }
3030

3131
type AlertSourceDeleteInput struct {
3232
Id ID `json:"id"`
@@ -35,7 +35,7 @@ type AlertSourceDeleteInput struct {
3535
func NewAlertSource(kind AlertSourceTypeEnum, id string) *AlertSourceExternalIdentifier {
3636
output := AlertSourceExternalIdentifier{
3737
Type: kind,
38-
ExternalId: id,
38+
ExternalId: ID(id),
3939
}
4040
return &output
4141
}

alert_source_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ func TestCreateAlertSourceService(t *testing.T) {
1818
client := BestTestClient(t, "alert_source/create", testRequest)
1919
// Act
2020
result, _ := client.CreateAlertSourceService(ol.AlertSourceServiceCreateInput{
21-
Service: *ol.NewIdentifier("example"),
22-
ExternalID: ol.NewAlertSource(ol.AlertSourceTypeEnumDatadog, "QWERTY"),
21+
Service: *ol.NewIdentifier("example"),
22+
AlertSourceExternalIdentifier: ol.NewAlertSource(ol.AlertSourceTypeEnumDatadog, "QWERTY"),
2323
})
2424
// Assert
2525
autopilot.Equals(t, "example", result.Service.Aliases[0])

aliases.go

+8-8
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@ import (
55
"strings"
66
)
77

8-
type AliasCreateInput struct {
9-
Alias string `json:"alias"`
10-
OwnerId ID `json:"ownerId"`
11-
}
8+
// type AliasCreateInput struct {
9+
// Alias string `json:"alias"`
10+
// OwnerId ID `json:"ownerId"`
11+
// }
1212

13-
type AliasDeleteInput struct {
14-
Alias string `json:"alias"`
15-
OwnerType AliasOwnerTypeEnum `json:"ownerType"`
16-
}
13+
// type AliasDeleteInput struct {
14+
// Alias string `json:"alias"`
15+
// OwnerType AliasOwnerTypeEnum `json:"ownerType"`
16+
// }
1717

1818
// #region Create
1919
// TODO: make sure duplicate aliases throw an error that we can catch

category.go

+12-12
Original file line numberDiff line numberDiff line change
@@ -17,18 +17,18 @@ type CategoryConnection struct {
1717
TotalCount int
1818
}
1919

20-
type CategoryCreateInput struct {
21-
Name string `json:"name" yaml:"name" default:"Example Category"`
22-
}
23-
24-
type CategoryUpdateInput struct {
25-
Id ID `json:"id"`
26-
Name string `json:"name"`
27-
}
28-
29-
type CategoryDeleteInput struct {
30-
Id ID `json:"id"`
31-
}
20+
// type CategoryCreateInput struct {
21+
// Name string `json:"name" yaml:"name" default:"Example Category"`
22+
// }
23+
24+
// type CategoryUpdateInput struct {
25+
// Id ID `json:"id"`
26+
// Name string `json:"name"`
27+
// }
28+
29+
// type CategoryDeleteInput struct {
30+
// Id ID `json:"id"`
31+
// }
3232

3333
func (self *Category) Alias() string {
3434
return slug.Make(self.Name)

category_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ func TestUpdateRubricCategory(t *testing.T) {
9393
// Act
9494
result, err := client.UpdateCategory(ol.CategoryUpdateInput{
9595
Id: id4,
96-
Name: "Emily",
96+
Name: ol.NewString("Emily"),
9797
})
9898
// Assert
9999
autopilot.Ok(t, err)

check.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -145,9 +145,9 @@ func (c *CheckUpdateInput) GetCheckUpdateInput() *CheckUpdateInput {
145145
return c
146146
}
147147

148-
type CheckDeleteInput struct {
149-
Id ID `json:"id"`
150-
}
148+
// type CheckDeleteInput struct {
149+
// Id ID `json:"id"`
150+
// }
151151

152152
// Encompass CheckCreatePayload and CheckUpdatePayload into 1 struct
153153
type CheckResponsePayload struct {
@@ -297,7 +297,7 @@ func (client *Client) DeleteCheck(id ID) error {
297297
} `graphql:"checkDelete(input: $input)"`
298298
}
299299
v := PayloadVariables{
300-
"input": CheckDeleteInput{Id: id},
300+
"input": CheckDeleteInput{Id: &id},
301301
}
302302
err := client.Mutate(&m, v, WithName("CheckDelete"))
303303
return HandleErrors(err, m.Payload.Errors)

check_alert_source_usage.go

+10-10
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,19 @@ type AlertSourceUsageCheckFragment struct {
55
AlertSourceType AlertSourceTypeEnum `graphql:"alertSourceType"`
66
}
77

8-
type CheckAlertSourceUsageCreateInput struct {
9-
CheckCreateInput
8+
// type CheckAlertSourceUsageCreateInput struct {
9+
// CheckCreateInput
1010

11-
AlertSourceType AlertSourceTypeEnum `json:"alertSourceType,omitempty"`
12-
AlertSourceNamePredicate *PredicateInput `json:"alertSourceNamePredicate,omitempty"`
13-
}
11+
// AlertSourceType AlertSourceTypeEnum `json:"alertSourceType,omitempty"`
12+
// AlertSourceNamePredicate *PredicateInput `json:"alertSourceNamePredicate,omitempty"`
13+
// }
1414

15-
type CheckAlertSourceUsageUpdateInput struct {
16-
CheckUpdateInput
15+
// type CheckAlertSourceUsageUpdateInput struct {
16+
// CheckUpdateInput
1717

18-
AlertSourceType AlertSourceTypeEnum `json:"alertSourceType,omitempty"`
19-
AlertSourceNamePredicate *PredicateUpdateInput `json:"alertSourceNamePredicate,omitempty"`
20-
}
18+
// AlertSourceType AlertSourceTypeEnum `json:"alertSourceType,omitempty"`
19+
// AlertSourceNamePredicate *PredicateUpdateInput `json:"alertSourceNamePredicate,omitempty"`
20+
// }
2121

2222
func (client *Client) CreateCheckAlertSourceUsage(input CheckAlertSourceUsageCreateInput) (*Check, error) {
2323
var m struct {

check_custom_event.go

+16-16
Original file line numberDiff line numberDiff line change
@@ -8,25 +8,25 @@ type CustomEventCheckFragment struct {
88
SuccessCondition string `graphql:"successCondition"`
99
}
1010

11-
type CheckCustomEventCreateInput struct {
12-
CheckCreateInput
11+
// type CheckCustomEventCreateInput struct {
12+
// CheckCreateInput
1313

14-
Integration ID `json:"integrationId" yaml:"integrationId" default:"XXX_integration_id_XXX"`
15-
ServiceSelector string `json:"serviceSelector" yaml:"serviceSelector" default:".metadata.name"`
16-
SuccessCondition string `json:"successCondition" yaml:"successCondition" default:".metadata.name"`
17-
Message string `json:"resultMessage,omitempty" yaml:"resultMessage,omitempty" default:"#Hello World"`
18-
PassPending *bool `json:"passPending,omitempty" yaml:"passPending,omitempty" default:"false"`
19-
}
14+
// Integration ID `json:"integrationId" yaml:"integrationId" default:"XXX_integration_id_XXX"`
15+
// ServiceSelector string `json:"serviceSelector" yaml:"serviceSelector" default:".metadata.name"`
16+
// SuccessCondition string `json:"successCondition" yaml:"successCondition" default:".metadata.name"`
17+
// Message string `json:"resultMessage,omitempty" yaml:"resultMessage,omitempty" default:"#Hello World"`
18+
// PassPending *bool `json:"passPending,omitempty" yaml:"passPending,omitempty" default:"false"`
19+
// }
2020

21-
type CheckCustomEventUpdateInput struct {
22-
CheckUpdateInput
21+
// type CheckCustomEventUpdateInput struct {
22+
// CheckUpdateInput
2323

24-
ServiceSelector string `json:"serviceSelector,omitempty"`
25-
SuccessCondition string `json:"successCondition,omitempty"`
26-
Message *string `json:"resultMessage,omitempty"`
27-
PassPending *bool `json:"passPending,omitempty"`
28-
Integration *ID `json:"integrationId,omitempty" yaml:"integrationId,omitempty"`
29-
}
24+
// ServiceSelector string `json:"serviceSelector,omitempty"`
25+
// SuccessCondition string `json:"successCondition,omitempty"`
26+
// Message *string `json:"resultMessage,omitempty"`
27+
// PassPending *bool `json:"passPending,omitempty"`
28+
// Integration *ID `json:"integrationId,omitempty" yaml:"integrationId,omitempty"`
29+
// }
3030

3131
func (client *Client) CreateCheckCustomEvent(input CheckCustomEventCreateInput) (*Check, error) {
3232
var m struct {

check_git_branch_protection.go

+6-6
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@ package opslevel
22

33
type GitBranchProtectionCheckFragment struct{}
44

5-
type CheckGitBranchProtectionCreateInput struct {
6-
CheckCreateInput
7-
}
5+
// type CheckGitBranchProtectionCreateInput struct {
6+
// CheckCreateInput
7+
// }
88

9-
type CheckGitBranchProtectionUpdateInput struct {
10-
CheckUpdateInput
11-
}
9+
// type CheckGitBranchProtectionUpdateInput struct {
10+
// CheckUpdateInput
11+
// }
1212

1313
func (client *Client) CreateCheckGitBranchProtection(input CheckGitBranchProtectionCreateInput) (*Check, error) {
1414
var m struct {

check_has_documentation.go

+10-10
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,19 @@ type HasDocumentationCheckFragment struct {
55
DocumentSubtype HasDocumentationSubtypeEnum `graphql:"documentSubtype"`
66
}
77

8-
type CheckHasDocumentationCreateInput struct {
9-
CheckCreateInput
8+
// type CheckHasDocumentationCreateInput struct {
9+
// CheckCreateInput
1010

11-
DocumentType HasDocumentationTypeEnum `json:"documentType" yaml:"documentType" default:"api"`
12-
DocumentSubtype HasDocumentationSubtypeEnum `json:"documentSubtype" yaml:"documentSubtype" default:"openapi"`
13-
}
11+
// DocumentType HasDocumentationTypeEnum `json:"documentType" yaml:"documentType" default:"api"`
12+
// DocumentSubtype HasDocumentationSubtypeEnum `json:"documentSubtype" yaml:"documentSubtype" default:"openapi"`
13+
// }
1414

15-
type CheckHasDocumentationUpdateInput struct {
16-
CheckUpdateInput
15+
// type CheckHasDocumentationUpdateInput struct {
16+
// CheckUpdateInput
1717

18-
DocumentType HasDocumentationTypeEnum `json:"documentType"`
19-
DocumentSubtype HasDocumentationSubtypeEnum `json:"documentSubtype"`
20-
}
18+
// DocumentType HasDocumentationTypeEnum `json:"documentType"`
19+
// DocumentSubtype HasDocumentationSubtypeEnum `json:"documentSubtype"`
20+
// }
2121

2222
func (client *Client) CreateCheckHasDocumentation(input CheckHasDocumentationCreateInput) (*Check, error) {
2323
var m struct {

0 commit comments

Comments
 (0)