From 7b9f496fa0147f4e4bdf8304ac397f10825d5833 Mon Sep 17 00:00:00 2001 From: Mike Rostermund Date: Fri, 8 Sep 2023 15:14:20 +0200 Subject: [PATCH] Switch gql lib --- go.mod | 4 ++-- go.sum | 4 ++-- images/helper/go.mod | 2 +- images/helper/go.sum | 4 ++-- pkg/helpers/helpers.go | 13 +++++++------ pkg/humio/alert_transform.go | 4 ++-- 6 files changed, 16 insertions(+), 15 deletions(-) diff --git a/go.mod b/go.mod index 4092ea9f0..0d8432803 100644 --- a/go.mod +++ b/go.mod @@ -5,11 +5,12 @@ go 1.20 require ( github.com/Masterminds/semver v1.5.0 github.com/cert-manager/cert-manager v1.11.5 + github.com/cli/shurcooL-graphql v0.0.3 github.com/go-logr/logr v1.2.4 github.com/go-logr/zapr v1.2.3 github.com/google/go-cmp v0.5.9 github.com/google/martian v2.1.0+incompatible - github.com/humio/cli v0.31.2-0.20230908121429-a9543de089d0 + github.com/humio/cli v0.31.2-0.20230908130710-8b07e8c22f4e github.com/onsi/ginkgo/v2 v2.11.0 github.com/onsi/gomega v1.27.11-0.20230807134635-babe25fc5472 github.com/openshift/api v3.9.0+incompatible @@ -25,7 +26,6 @@ require ( require ( github.com/beorn7/perks v1.0.1 // indirect github.com/cespare/xxhash/v2 v2.2.0 // indirect - github.com/cli/shurcooL-graphql v0.0.3 // indirect github.com/davecgh/go-spew v1.1.1 // indirect github.com/emicklei/go-restful/v3 v3.9.0 // indirect github.com/evanphx/json-patch v5.6.0+incompatible // indirect diff --git a/go.sum b/go.sum index 1fc5fa43c..c2879a4a2 100644 --- a/go.sum +++ b/go.sum @@ -189,8 +189,8 @@ github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5m github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= -github.com/humio/cli v0.31.2-0.20230908121429-a9543de089d0 h1:FmAk5x3cPV4MJuxvy2URSfOU4oBj/sp+/2Kn1Ks7fBs= -github.com/humio/cli v0.31.2-0.20230908121429-a9543de089d0/go.mod h1:qJQUzDiJbXCJam0ifTKM0gRw1IDbLCUhZMqDCXteg1I= +github.com/humio/cli v0.31.2-0.20230908130710-8b07e8c22f4e h1:INRMUslqX2Ew5nEwZfk9byKQF96j081ZMV5TDy7FQVA= +github.com/humio/cli v0.31.2-0.20230908130710-8b07e8c22f4e/go.mod h1:qJQUzDiJbXCJam0ifTKM0gRw1IDbLCUhZMqDCXteg1I= github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/imdario/mergo v0.3.12 h1:b6R2BslTbIEToALKP7LxUvijTsNI9TAe80pLWN2g/HU= diff --git a/images/helper/go.mod b/images/helper/go.mod index 3ee0c37b3..b867a87ae 100644 --- a/images/helper/go.mod +++ b/images/helper/go.mod @@ -3,7 +3,7 @@ module github.com/humio/humio-operator/images/helper go 1.20 require ( - github.com/humio/cli v0.31.2-0.20230908121429-a9543de089d0 + github.com/humio/cli v0.31.2-0.20230908130710-8b07e8c22f4e k8s.io/api v0.26.8 k8s.io/apimachinery v0.26.8 k8s.io/client-go v0.26.8 diff --git a/images/helper/go.sum b/images/helper/go.sum index 033a2e7ef..c0ee2abf9 100644 --- a/images/helper/go.sum +++ b/images/helper/go.sum @@ -126,8 +126,8 @@ github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+ github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= -github.com/humio/cli v0.31.2-0.20230908121429-a9543de089d0 h1:FmAk5x3cPV4MJuxvy2URSfOU4oBj/sp+/2Kn1Ks7fBs= -github.com/humio/cli v0.31.2-0.20230908121429-a9543de089d0/go.mod h1:qJQUzDiJbXCJam0ifTKM0gRw1IDbLCUhZMqDCXteg1I= +github.com/humio/cli v0.31.2-0.20230908130710-8b07e8c22f4e h1:INRMUslqX2Ew5nEwZfk9byKQF96j081ZMV5TDy7FQVA= +github.com/humio/cli v0.31.2-0.20230908130710-8b07e8c22f4e/go.mod h1:qJQUzDiJbXCJam0ifTKM0gRw1IDbLCUhZMqDCXteg1I= github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY= github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y= diff --git a/pkg/helpers/helpers.go b/pkg/helpers/helpers.go index 2b3a5dc4c..444b478bd 100644 --- a/pkg/helpers/helpers.go +++ b/pkg/helpers/helpers.go @@ -19,6 +19,7 @@ package helpers import ( "crypto/sha256" "fmt" + graphql "github.com/cli/shurcooL-graphql" "os" "reflect" "sort" @@ -71,11 +72,11 @@ func MapStoragePartition(vs []humioapi.StoragePartition, f func(partition humioa func ToStoragePartitionInput(line humioapi.StoragePartition) humioapi.StoragePartitionInput { var input humioapi.StoragePartitionInput - nodeIds := make([]int32, len(line.NodeIds)) + nodeIds := make([]graphql.Int, len(line.NodeIds)) for i, v := range line.NodeIds { - nodeIds[i] = int32(v) + nodeIds[i] = graphql.Int(v) } - input.ID = int32(line.Id) + input.ID = graphql.Int(line.Id) input.NodeIDs = nodeIds return input @@ -91,11 +92,11 @@ func MapIngestPartition(vs []humioapi.IngestPartition, f func(partition humioapi func ToIngestPartitionInput(line humioapi.IngestPartition) humioapi.IngestPartitionInput { var input humioapi.IngestPartitionInput - nodeIds := make([]int32, len(line.NodeIds)) + nodeIds := make([]graphql.Int, len(line.NodeIds)) for i, v := range line.NodeIds { - nodeIds[i] = int32(v) + nodeIds[i] = graphql.Int(v) } - input.ID = int32(line.Id) + input.ID = graphql.Int(line.Id) input.NodeIDs = nodeIds return input diff --git a/pkg/humio/alert_transform.go b/pkg/humio/alert_transform.go index a388bec13..1dc5afea9 100644 --- a/pkg/humio/alert_transform.go +++ b/pkg/humio/alert_transform.go @@ -16,7 +16,7 @@ func AlertTransform(ha *humiov1alpha1.HumioAlert, actionIdMap map[string]string) QueryString: ha.Spec.Query.QueryString, QueryStart: ha.Spec.Query.Start, Description: ha.Spec.Description, - ThrottleTimeMillis: humioapi.Long(ha.Spec.ThrottleTimeMillis), + ThrottleTimeMillis: ha.Spec.ThrottleTimeMillis, ThrottleField: ha.Spec.ThrottleField, Enabled: !ha.Spec.Silenced, Actions: actionIdsFromActionMap(ha.Spec.Actions, actionIdMap), @@ -42,7 +42,7 @@ func AlertHydrate(ha *humiov1alpha1.HumioAlert, alert *humioapi.Alert, actionIdM Start: alert.QueryStart, }, Description: alert.Description, - ThrottleTimeMillis: int(alert.ThrottleTimeMillis), + ThrottleTimeMillis: alert.ThrottleTimeMillis, ThrottleField: alert.ThrottleField, Silenced: !alert.Enabled, Actions: actionIdsFromActionMap(ha.Spec.Actions, actionIdMap),