Skip to content

Commit e8c5eed

Browse files
author
Taimoor Ahmad
authored
Further generating... (#346)
1 parent 3172424 commit e8c5eed

File tree

6 files changed

+66
-31
lines changed

6 files changed

+66
-31
lines changed

enum.go

+36
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

infra.go

+11-9
Original file line numberDiff line numberDiff line change
@@ -119,19 +119,20 @@ func (i *InfrastructureResource) ResourceType() TaggableResource {
119119
}
120120

121121
func (client *Client) CreateInfrastructure(input InfraInput) (*InfrastructureResource, error) {
122+
data := JSON(input.Data)
122123
i := InfrastructureResourceInput{
123124
Schema: &InfrastructureResourceSchemaInput{Type: input.Schema},
124-
Data: input.Data,
125+
Data: &data,
125126
}
126127
if input.Owner != nil {
127128
i.OwnerId = input.Owner
128129
}
129130
if input.Provider != nil {
130131
i.ProviderResourceType = &input.Provider.Type
131-
i.ProviderData = &InfrastructureResourceProviderInput{
132+
i.ProviderData = &InfrastructureResourceProviderDataInput{
132133
AccountName: input.Provider.Account,
133-
ExternalURL: input.Provider.URL,
134-
ProviderName: input.Provider.Name,
134+
ExternalUrl: NewString(input.Provider.URL),
135+
ProviderName: NewString(input.Provider.Name),
135136
}
136137
}
137138
var m struct {
@@ -219,18 +220,19 @@ func (client *Client) ListInfrastructure(variables *PayloadVariables) (Infrastru
219220
}
220221

221222
func (client *Client) UpdateInfrastructure(identifier string, input InfraInput) (*InfrastructureResource, error) {
223+
data := JSON(input.Data)
222224
i := InfrastructureResourceInput{
223-
Data: input.Data,
225+
Data: &data,
224226
}
225227
if input.Owner != nil {
226-
i.Owner = input.Owner
228+
i.OwnerId = input.Owner
227229
}
228230
if input.Provider != nil {
229231
i.ProviderResourceType = &input.Provider.Type
230-
i.ProviderData = &InfrastructureResourceProviderInput{
232+
i.ProviderData = &InfrastructureResourceProviderDataInput{
231233
AccountName: input.Provider.Account,
232-
ExternalURL: input.Provider.URL,
233-
ProviderName: input.Provider.Name,
234+
ExternalUrl: NewString(input.Provider.URL),
235+
ProviderName: NewString(input.Provider.Name),
234236
}
235237
}
236238
var m struct {

input.go

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

service.go

+5-5
Original file line numberDiff line numberDiff line change
@@ -608,16 +608,16 @@ func NewTagArgs(tag string) TagArgs {
608608
switch len(kv) {
609609
case 1:
610610
return TagArgs{
611-
Key: kv[0],
611+
Key: NewString(kv[0]),
612612
}
613613
case 2:
614614
return TagArgs{
615-
Key: kv[0],
616-
Value: kv[1],
615+
Key: NewString(kv[0]),
616+
Value: NewString(kv[1]),
617617
}
618618
default: // TODO: is this the best we can do?
619619
return TagArgs{
620-
Key: tag,
620+
Key: NewString(tag),
621621
}
622622
}
623623
}
@@ -733,7 +733,7 @@ func (client *Client) DeleteService(input ServiceDeleteInput) error {
733733

734734
func (client *Client) DeleteServiceWithAlias(alias string) error {
735735
return client.DeleteService(ServiceDeleteInput{
736-
Alias: alias,
736+
Alias: NewString(alias),
737737
})
738738
}
739739

tags.go

+5-5
Original file line numberDiff line numberDiff line change
@@ -160,9 +160,9 @@ func (client *Client) AssignTags(identifier string, tags map[string]string) ([]T
160160
})
161161
}
162162
if IsID(identifier) {
163-
input.Id = ID(identifier)
163+
input.Id = NewID(identifier)
164164
} else {
165-
input.Alias = identifier
165+
input.Alias = &identifier
166166
}
167167
return client.AssignTag(input)
168168
}
@@ -196,9 +196,9 @@ func (client *Client) CreateTags(identifier string, tags map[string]string) ([]T
196196
Value: value,
197197
}
198198
if IsID(identifier) {
199-
input.Id = ID(identifier)
199+
input.Id = NewID(identifier)
200200
} else {
201-
input.Alias = identifier
201+
input.Alias = &identifier
202202
}
203203
newTag, err := client.CreateTag(input)
204204
if err != nil {
@@ -271,7 +271,7 @@ func (client *Client) UpdateTag(input TagUpdateInput) (*Tag, error) {
271271
Errors []OpsLevelErrors
272272
} `graphql:"tagUpdate(input: $input)"`
273273
}
274-
if err := ValidateTagKey(input.Key); err != nil {
274+
if err := ValidateTagKey(*input.Key); err != nil {
275275
return nil, err
276276
}
277277
v := PayloadVariables{

team.go

+7-10
Original file line numberDiff line numberDiff line change
@@ -339,15 +339,12 @@ func (client *Client) AddContact(team string, contact ContactInput) (*Contact, e
339339
Errors []OpsLevelErrors
340340
} `graphql:"contactCreate(input: $input)"`
341341
}
342+
// TODO: there is no teamId field anymore
342343
contactInput := ContactCreateInput{
343344
Type: contact.Type,
344-
DisplayName: *contact.DisplayName,
345+
DisplayName: contact.DisplayName,
345346
Address: contact.Address,
346-
}
347-
if IsID(team) {
348-
contactInput.TeamId = NewID(team)
349-
} else {
350-
contactInput.TeamAlias = team
347+
TeamAlias: &team,
351348
}
352349
v := PayloadVariables{
353350
"input": contactInput,
@@ -510,8 +507,8 @@ func (client *Client) UpdateContact(id ID, contact ContactInput) (*Contact, erro
510507
}
511508
input := ContactUpdateInput{
512509
Id: id,
513-
DisplayName: *contact.DisplayName,
514-
Address: contact.Address,
510+
DisplayName: contact.DisplayName,
511+
Address: &contact.Address,
515512
}
516513
if contact.Type == "" {
517514
input.Type = nil
@@ -539,7 +536,7 @@ func (client *Client) DeleteTeamWithAlias(alias string) error {
539536
}
540537
v := PayloadVariables{
541538
"input": TeamDeleteInput{
542-
Alias: alias,
539+
Alias: &alias,
543540
},
544541
}
545542
err := client.Mutate(&m, v, WithName("TeamDelete"))
@@ -561,7 +558,7 @@ func (client *Client) DeleteTeam(id ID) error {
561558
}
562559
v := PayloadVariables{
563560
"input": TeamDeleteInput{
564-
Id: id,
561+
Id: &id,
565562
},
566563
}
567564
err := client.Mutate(&m, v, WithName("TeamDelete"))

0 commit comments

Comments
 (0)