Skip to content

Commit

Permalink
Merge pull request #84 from humio/mike/dont_fetch_clientMutationId
Browse files Browse the repository at this point in the history
Stop querying deprecated clientMutationId
  • Loading branch information
SaaldjorMike authored Oct 12, 2021
2 parents a564523 + 06f7751 commit cb5be7a
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 15 deletions.
3 changes: 2 additions & 1 deletion api/files.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ func (f *Files) List(viewName string) ([]File, error) {
func (f *Files) Delete(viewName string, fileName string) error {
var q struct {
RemoveFile struct {
TypeName string `graphql:"__typename"`
// We have to make a selection, so just take __typename
Typename graphql.String `graphql:"__typename"`
} `graphql:"removeFile(name:$viewName, fileName: $fileName)"`
}

Expand Down
6 changes: 4 additions & 2 deletions api/ingest-tokens.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,8 @@ func (i *IngestTokens) Add(repositoryName string, tokenName string, parserName s
func (i *IngestTokens) Update(repositoryName string, tokenName string, parserName string) (*IngestToken, error) {
var mutation struct {
Result struct {
Type string `graphql:"__typename"`
// We have to make a selection, so just take __typename
Typename graphql.String `graphql:"__typename"`
} `graphql:"assignIngestToken(repositoryName: $repositoryName, tokenName: $tokenName, parserName: $parserName)"`
}

Expand All @@ -130,7 +131,8 @@ func (i *IngestTokens) Update(repositoryName string, tokenName string, parserNam
func (i *IngestTokens) Remove(repositoryName string, tokenName string) error {
var mutation struct {
Result struct {
Type string `graphql:"__typename"`
// We have to make a selection, so just take __typename
Typename graphql.String `graphql:"__typename"`
} `graphql:"removeIngestToken(repositoryName: $repositoryName, name: $tokenName)"`
}

Expand Down
3 changes: 2 additions & 1 deletion api/license.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ func (l *Licenses) Install(license string) error {

var mutation struct {
UpdateLicenseKey struct {
Type string `graphql:"__typename"`
// We have to make a selection, so just take __typename
Typename graphql.String `graphql:"__typename"`
} `graphql:"updateLicenseKey(license: $license)"`
}
variables := map[string]interface{}{
Expand Down
6 changes: 4 additions & 2 deletions api/parsers.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ func (p *Parsers) List(reposistoryName string) ([]ParserListItem, error) {
func (p *Parsers) Remove(reposistoryName string, parserName string) error {
var mutation struct {
RemoveParser struct {
Type string `graphql:"__typename"`
// We have to make a selection, so just take __typename
Typename graphql.String `graphql:"__typename"`
} `graphql:"removeParser(input: { name: $name, repositoryName: $repositoryName })"`
}

Expand All @@ -68,7 +69,8 @@ func (p *Parsers) Add(reposistoryName string, parser *Parser, force bool) error

var mutation struct {
CreateParser struct {
Type string `graphql:"__typename"`
// We have to make a selection, so just take __typename
Typename graphql.String `graphql:"__typename"`
} `graphql:"createParser(input: { name: $name, repositoryName: $repositoryName, testData: $testData, tagFields: $tagFields, sourceCode: $sourceCode, force: $force})"`
}

Expand Down
18 changes: 12 additions & 6 deletions api/repositories.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,8 @@ func (r *Repositories) Delete(name, reason string, allowDataDeletion bool) error

var m struct {
DeleteSearchDomain struct {
ClientMutationId string
// We have to make a selection, so just take __typename
Typename graphql.String `graphql:"__typename"`
} `graphql:"deleteSearchDomain(name: $name, deleteMessage: $reason)"`
}
variables := map[string]interface{}{
Expand Down Expand Up @@ -143,7 +144,8 @@ func (r *Repositories) UpdateUserGroup(name, username string, groups ...DefaultG

var mutation struct {
UpdateDefaultGroupMembershipsMutation struct {
ClientMutationId string
// We have to make a selection, so just take __typename
Typename graphql.String `graphql:"__typename"`
} `graphql:"updateDefaultGroupMemberships(input: {viewName: $name, userName: $username, groups: $groups})"`
}
variables := map[string]interface{}{
Expand All @@ -164,7 +166,8 @@ func (r *Repositories) UpdateTimeBasedRetention(name string, retentionInDays flo

var m struct {
UpdateRetention struct {
Type string `graphql:"__typename"`
// We have to make a selection, so just take __typename
Typename graphql.String `graphql:"__typename"`
} `graphql:"updateRetention(repositoryName: $name, timeBasedRetention: $retentionInDays)"`
}
variables := map[string]interface{}{
Expand Down Expand Up @@ -197,7 +200,8 @@ func (r *Repositories) UpdateStorageBasedRetention(name string, storageInGB floa

var m struct {
UpdateRetention struct {
Type string `graphql:"__typename"`
// We have to make a selection, so just take __typename
Typename graphql.String `graphql:"__typename"`
} `graphql:"updateRetention(repositoryName: $name, storageSizeBasedRetention: $storageInGB)"`
}
variables := map[string]interface{}{
Expand Down Expand Up @@ -230,7 +234,8 @@ func (r *Repositories) UpdateIngestBasedRetention(name string, ingestInGB float6

var m struct {
UpdateRetention struct {
Type string `graphql:"__typename"`
// We have to make a selection, so just take __typename
Typename graphql.String `graphql:"__typename"`
} `graphql:"updateRetention(repositoryName: $name, ingestSizeBasedRetention: $ingestInGB)"`
}
variables := map[string]interface{}{
Expand All @@ -257,7 +262,8 @@ func (r *Repositories) UpdateIngestBasedRetention(name string, ingestInGB float6
func (r *Repositories) UpdateDescription(name, description string) error {
var m struct {
UpdateDescription struct {
Type string `graphql:"__typename"`
// We have to make a selection, so just take __typename
Typename graphql.String `graphql:"__typename"`
} `graphql:"updateDescriptionForSearchDomain(name: $name, newDescription: $description)"`
}

Expand Down
1 change: 0 additions & 1 deletion api/users.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@ func (u *Users) Add(username string, changeset UserChangeSet) (User, error) {
func (u *Users) Remove(username string) (User, error) {
var mutation struct {
Result struct {
// We have to make a selection, so just take __typename
User User
} `graphql:"removeUser(input: {username: $username})"`
}
Expand Down
6 changes: 4 additions & 2 deletions api/views.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,8 @@ func (c *Views) Create(name, description string, connections map[string]string)
func (c *Views) Delete(name, reason string) error {
var m struct {
DeleteSearchDomain struct {
ClientMutationId string
// We have to make a selection, so just take __typename
Typename graphql.String `graphql:"__typename"`
} `graphql:"deleteSearchDomain(name: $name, deleteMessage: $reason)"`
}
variables := map[string]interface{}{
Expand Down Expand Up @@ -175,7 +176,8 @@ func (c *Views) UpdateConnections(name string, connections map[string]string) er
func (c *Views) UpdateDescription(name string, description string) error {
var m struct {
UpdateDescriptionMutation struct {
ClientMutationId string
// We have to make a selection, so just take __typename
Typename graphql.String `graphql:"__typename"`
} `graphql:"updateDescriptionForSearchDomain(name: $name, newDescription: $description)"`
}

Expand Down

0 comments on commit cb5be7a

Please sign in to comment.