diff --git a/.harness/ffgolangserversdk.yaml b/.harness/ffgolangserversdk.yaml index 5a08893f..35b31736 100644 --- a/.harness/ffgolangserversdk.yaml +++ b/.harness/ffgolangserversdk.yaml @@ -46,7 +46,7 @@ pipeline: identifier: Build_and_Test spec: connectorRef: DockerHub - image: golang:1.19.9 + image: golang:1.20.0 shell: Sh command: |- go install github.com/jstemmer/go-junit-report@latest diff --git a/Makefile b/Makefile index 8c77b699..a71a9a9f 100644 --- a/Makefile +++ b/Makefile @@ -98,7 +98,7 @@ $(GOPATH)/bin/gosec: $(GOPATH)/bin/oapi-codegen: @echo "🔘 Installing oapicodegen ... (`date '+%H:%M:%S'`)" - @go install github.com/deepmap/oapi-codegen/cmd/oapi-codegen@v1.11.0 + @go install github.com/deepmap/oapi-codegen/v2/cmd/oapi-codegen@v2.1.0 PHONY+= tools tools: $(GOPATH)/bin/golangci-lint $(GOPATH)/bin/golint $(GOPATH)/bin/gosec $(GOPATH)/bin/goimports $(GOPATH)/bin/oapi-codegen diff --git a/README.md b/README.md index 4b4f5829..5adc102f 100644 --- a/README.md +++ b/README.md @@ -20,8 +20,9 @@ For a sample FF Golang SDK project, see our [test Golang project](examples/getti ![FeatureFlags](./docs/images/ff-gui.png) ## Requirements -[Golang 1.6](https://go.dev/doc/install) or newer (go version)
- +- Starting with SDK version v0.1.21, Golang version 1.20 or later is required. +- Earlier versions of the SDK require Golang versions newer than 1.6 but older than 1.19. +- For installation details, please refer to [Golang's official installation guide](https://go.dev/doc/install). ## Quickstart To follow along with our test code sample, make sure you’ve: diff --git a/analyticsservice/analytics.go b/analyticsservice/analytics.go index dd5da8eb..e3b26b88 100644 --- a/analyticsservice/analytics.go +++ b/analyticsservice/analytics.go @@ -267,7 +267,7 @@ func (as *AnalyticsService) sendDataAndResetCache(ctx context.Context) { } as.logger.Debug(string(jsonData)) - resp, err := mClient.PostMetricsWithResponse(ctx, metricsclient.EnvironmentPathParam(as.environmentID), analyticsPayload) + resp, err := mClient.PostMetricsWithResponse(ctx, metricsclient.EnvironmentPathParam(as.environmentID), nil, analyticsPayload) if err != nil { as.logger.Warn(err) return diff --git a/client/client.go b/client/client.go index dccde142..30623512 100644 --- a/client/client.go +++ b/client/client.go @@ -24,7 +24,7 @@ import ( "github.com/harness/ff-golang-server-sdk/analyticsservice" "github.com/harness/ff-golang-server-sdk/metricsclient" - "github.com/deepmap/oapi-codegen/pkg/securityprovider" + "github.com/deepmap/oapi-codegen/v2/pkg/securityprovider" "github.com/golang-jwt/jwt" "github.com/harness/ff-golang-server-sdk/rest" "github.com/harness/ff-golang-server-sdk/stream" @@ -333,30 +333,9 @@ func (c *CfClient) authenticate(ctx context.Context) error { return err } - responseError := findErrorInResponse(response) - - // Indicate that we should retry - if responseError != nil && responseError.Code == "500" { - return RetryableAuthError{ - StatusCode: responseError.Code, - Message: responseError.Message, - } - } - - // Indicate that we shouldn't retry on non-500 errors - if responseError != nil { - return NonRetryableAuthError{ - StatusCode: responseError.Code, - Message: responseError.Message, - } - } - - // Defensive check to handle the case that all responses are nil - if response.JSON200 == nil { - return RetryableAuthError{ - StatusCode: "No error status code returned from server", - Message: "No error message returned from server ", - } + // Use processAuthResponse to handle any errors based on the HTTP response + if processedError := processAuthResponse(response); processedError != nil { + return processedError } c.token = response.JSON200.AuthToken @@ -554,7 +533,7 @@ func (c *CfClient) retrieveFlags(ctx context.Context) error { c.mux.RLock() defer c.mux.RUnlock() c.config.Logger.Info("Retrieving flags started") - flags, err := c.api.GetFeatureConfigWithResponse(ctx, c.environmentID) + flags, err := c.api.GetFeatureConfigWithResponse(ctx, c.environmentID, nil) if err != nil { // log return err @@ -579,7 +558,7 @@ func (c *CfClient) retrieveSegments(ctx context.Context) error { c.mux.RLock() defer c.mux.RUnlock() c.config.Logger.Info("Retrieving segments started") - segments, err := c.api.GetAllSegmentsWithResponse(ctx, c.environmentID) + segments, err := c.api.GetAllSegmentsWithResponse(ctx, c.environmentID, nil) if err != nil { // log return err @@ -769,13 +748,52 @@ func getLogger(options ...ConfigOption) logger.Logger { return dummyConfig.Logger } -// findErrorInResponse parses an auth response and returns the response error if it exists -func findErrorInResponse(resp *rest.AuthenticateResponse) *rest.Error { - responseErrors := []*rest.Error{resp.JSON401, resp.JSON403, resp.JSON404, resp.JSON500} - for _, responseError := range responseErrors { - if responseError != nil { - return responseError +// processAuthResponse checks the authentication response for errors and categorizes them as retryable or non-retryable. +func processAuthResponse(response *rest.AuthenticateResponse) error { + if response == nil { + return RetryableAuthError{ + StatusCode: "No error status code returned from server", + Message: "No error message returned from server ", + } + } + + if response.JSON200 != nil { + return nil + } + + // Handle retryable error + if response.JSON500 != nil { + return RetryableAuthError{ + StatusCode: response.JSON500.Code, + Message: response.JSON500.Message, + } + } + + // Handle non-retryable errors. + var nonRetryableError *rest.Error + switch { + case response.JSON401 != nil: + nonRetryableError = &rest.Error{Code: response.JSON401.Code, Message: response.JSON401.Message} + case response.JSON403 != nil: + nonRetryableError = &rest.Error{Code: response.JSON403.Code, Message: response.JSON403.Message} + case response.JSON404 != nil: + nonRetryableError = &rest.Error{Code: response.JSON404.Code, Message: response.JSON404.Message} + } + + if nonRetryableError != nil { + return NonRetryableAuthError{ + StatusCode: nonRetryableError.Code, + Message: nonRetryableError.Message, + } + } + + // Defensive check to handle the case that all responses are nil + if response.JSON200 == nil { + return RetryableAuthError{ + StatusCode: "No error status code returned from server", + Message: "No error message returned from server ", } } + return nil } diff --git a/evaluation/evaluator.go b/evaluation/evaluator.go index 43fe2256..0b447286 100644 --- a/evaluation/evaluator.go +++ b/evaluation/evaluator.go @@ -196,8 +196,8 @@ func (e Evaluator) evaluateVariationMap(variationsMap []rest.VariationMap, targe for _, variationMap := range variationsMap { if variationMap.Targets != nil { for _, t := range *variationMap.Targets { - if *t.Identifier != "" && *t.Identifier == target.Identifier { - e.logger.Debugf("Specific targeting matched in Variation Map: Variation Map (%v) Target(%v), Variation returned (%s)", *t.Identifier, target, variationMap.Variation) + if t.Identifier != "" && t.Identifier == target.Identifier { + e.logger.Debugf("Specific targeting matched in Variation Map: Variation Map (%v) Target(%v), Variation returned (%s)", t.Identifier, target, variationMap.Variation) return variationMap.Variation } } diff --git a/evaluation/evaluator_test.go b/evaluation/evaluator_test.go index 3a1871ec..353cb947 100644 --- a/evaluation/evaluator_test.go +++ b/evaluation/evaluator_test.go @@ -865,7 +865,7 @@ func TestEvaluator_evaluateVariationMap(t *testing.T) { Variation: identifierTrue, Targets: &[]rest.TargetMap{ { - Identifier: &targetIdentifier, + Identifier: targetIdentifier, }, }, }, @@ -1074,7 +1074,7 @@ func TestEvaluator_evaluateFlag(t *testing.T) { Variation: identifierTrue, Targets: &[]rest.TargetMap{ { - Identifier: &targetIdentifier, + Identifier: targetIdentifier, }, }, }, diff --git a/go.mod b/go.mod index b82b87cc..5af1be12 100644 --- a/go.mod +++ b/go.mod @@ -1,13 +1,13 @@ module github.com/harness/ff-golang-server-sdk -go 1.18 +go 1.20 require ( github.com/cenkalti/backoff/v4 v4.2.1 - github.com/deepmap/oapi-codegen v1.11.0 - github.com/getkin/kin-openapi v0.94.0 + github.com/deepmap/oapi-codegen/v2 v2.1.0 + github.com/getkin/kin-openapi v0.124.0 github.com/golang-jwt/jwt v3.2.2+incompatible - github.com/google/uuid v1.3.0 + github.com/google/uuid v1.5.0 github.com/harness-community/sse/v3 v3.1.0 github.com/hashicorp/go-retryablehttp v0.7.4 github.com/hashicorp/golang-lru v0.5.4 @@ -15,28 +15,31 @@ require ( github.com/json-iterator/go v1.1.12 github.com/mitchellh/go-homedir v1.1.0 github.com/mitchellh/mapstructure v1.3.3 + github.com/oapi-codegen/runtime v1.1.1 github.com/spaolacci/murmur3 v1.1.0 - github.com/stretchr/testify v1.7.1 + github.com/stretchr/testify v1.8.4 go.uber.org/zap v1.16.0 golang.org/x/exp v0.0.0-20230905200255-921286631fa9 golang.org/x/sync v0.0.0-20210220032951-036812b2e83c ) require ( + github.com/apapsch/go-jsonmerge/v2 v2.0.0 // indirect github.com/davecgh/go-spew v1.1.1 // indirect - github.com/ghodss/yaml v1.0.0 // indirect - github.com/go-openapi/jsonpointer v0.19.5 // indirect - github.com/go-openapi/swag v0.21.1 // indirect + github.com/go-openapi/jsonpointer v0.20.2 // indirect + github.com/go-openapi/swag v0.22.8 // indirect github.com/hashicorp/go-cleanhttp v0.5.2 // indirect + github.com/invopop/yaml v0.2.0 // indirect github.com/josharian/intern v1.0.0 // indirect github.com/mailru/easyjson v0.7.7 // indirect github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/reflect2 v1.0.2 // indirect + github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 // indirect + github.com/perimeterx/marshmallow v1.1.5 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect go.uber.org/atomic v1.7.0 // indirect go.uber.org/multierr v1.6.0 // indirect - golang.org/x/net v0.17.0 // indirect + golang.org/x/net v0.19.0 // indirect gopkg.in/cenkalti/backoff.v1 v1.1.0 // indirect - gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/go.sum b/go.sum index 0afeee2f..89dd9f7f 100644 --- a/go.sum +++ b/go.sum @@ -1,49 +1,29 @@ -github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= +github.com/BurntSushi/toml v1.3.2 h1:o7IhLm0Msx3BaB+n3Ag7L8EVlByGnpq14C4YWiu/gL8= +github.com/RaveNoX/go-jsoncommentstrip v1.0.0/go.mod h1:78ihd09MekBnJnxpICcwzCMzGrKSKYe4AqU6PDYYpjk= +github.com/apapsch/go-jsonmerge/v2 v2.0.0 h1:axGnT1gRIfimI7gJifB699GoE/oq+F2MU7Dml6nw9rQ= +github.com/apapsch/go-jsonmerge/v2 v2.0.0/go.mod h1:lvDnEdqiQrp0O42VQGgmlKpxL1AP2+08jFMw88y4klk= +github.com/bmatcuk/doublestar v1.1.1/go.mod h1:UD6OnuiIn0yFxxA2le/rnRU1G4RaI4UvFv1sNto9p6w= github.com/cenkalti/backoff/v4 v4.2.1 h1:y4OZtCnogmCPw98Zjyt5a6+QwPLGkiQsYW5oUqylYbM= github.com/cenkalti/backoff/v4 v4.2.1/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE= -github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= -github.com/cyberdelia/templates v0.0.0-20141128023046-ca7fffd4298c/go.mod h1:GyV+0YP4qX0UQ7r2MoYZ+AvYDp12OF5yg4q8rGnyNh4= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/decred/dcrd/crypto/blake256 v1.0.0/go.mod h1:sQl2p6Y26YV+ZOcSTP6thNdn47hh8kt6rqSlvmrXFAc= -github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.0-20210816181553-5444fa50b93d/go.mod h1:tmAIfUFEirG/Y8jhZ9M+h36obRZAk/1fcSpXwAVlfqE= -github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1/go.mod h1:hyedUtir6IdtD/7lIxGeCxkaw7y45JueMRL4DIyJDKs= -github.com/deepmap/oapi-codegen v1.11.0 h1:f/X2NdIkaBKsSdpeuwLnY/vDI0AtPUrmB5LMgc7YD+A= -github.com/deepmap/oapi-codegen v1.11.0/go.mod h1:k+ujhoQGxmQYBZBbxhOZNZf4j08qv5mC+OH+fFTnKxM= -github.com/getkin/kin-openapi v0.94.0 h1:bAxg2vxgnHHHoeefVdmGbR+oxtJlcv5HsJJa3qmAHuo= -github.com/getkin/kin-openapi v0.94.0/go.mod h1:LWZfzOd7PRy8GJ1dJ6mCU6tNdSfOwRac1BUPam4aw6Q= -github.com/ghodss/yaml v1.0.0 h1:wQHKEahhL6wmXdzwWG11gIVCkOv05bNOh+Rxn0yngAk= -github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= -github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI= -github.com/gin-gonic/gin v1.7.7/go.mod h1:axIBovoeJpVj8S3BwE0uPMTeReE4+AfFtqpqaZ1qq1U= -github.com/go-chi/chi/v5 v5.0.7/go.mod h1:DslCQbL2OYiznFReuXYUmQ2hGd1aDpCnlMNITLSKoi8= -github.com/go-openapi/jsonpointer v0.19.5 h1:gZr+CIYByUqjcgeLXnQu2gHYQC9o73G2XUeOFYEICuY= -github.com/go-openapi/jsonpointer v0.19.5/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg= -github.com/go-openapi/swag v0.19.5/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk= -github.com/go-openapi/swag v0.21.1 h1:wm0rhTb5z7qpJRHBdPOMuY4QjVUMbF6/kwoYeRAOrKU= -github.com/go-openapi/swag v0.21.1/go.mod h1:QYRuS/SOXUCsnplDa677K7+DxSOj6IPNl/eQntq43wQ= -github.com/go-playground/assert/v2 v2.0.1/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4= -github.com/go-playground/locales v0.13.0/go.mod h1:taPMhCMXrRLJO55olJkUXHZBHCxTMfnGwq/HNwmWNS8= -github.com/go-playground/locales v0.14.0/go.mod h1:sawfccIbzZTqEDETgFXqTho0QybSa7l++s0DH+LDiLs= -github.com/go-playground/universal-translator v0.17.0/go.mod h1:UkSxE5sNxxRwHyU+Scu5vgOQjsIJAF8j9muTVoKLVtA= -github.com/go-playground/universal-translator v0.18.0/go.mod h1:UvRDBj+xPUEGrFYl+lu/H90nyDXpg0fqeB/AQUGNTVA= -github.com/go-playground/validator/v10 v10.4.1/go.mod h1:nlOn6nFhuKACm19sB/8EGNn9GlaMV7XkbRSipzJ0Ii4= -github.com/go-playground/validator/v10 v10.11.0/go.mod h1:i+3WkQ1FvaUjjxh1kSvIA4dMGDBiPU55YFDl0WbKdWU= -github.com/goccy/go-json v0.9.7/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I= +github.com/deepmap/oapi-codegen/v2 v2.1.0 h1:I/NMVhJCtuvL9x+S2QzZKpSjGi33oDZwPRdemvOZWyQ= +github.com/deepmap/oapi-codegen/v2 v2.1.0/go.mod h1:R1wL226vc5VmCNJUvMyYr3hJMm5reyv25j952zAVXZ8= +github.com/getkin/kin-openapi v0.124.0 h1:VSFNMB9C9rTKBnQ/fpyDU8ytMTr4dWI9QovSKj9kz/M= +github.com/getkin/kin-openapi v0.124.0/go.mod h1:wb1aSZA/iWmorQP9KTAS/phLj/t17B5jT7+fS8ed9NM= +github.com/go-openapi/jsonpointer v0.20.2 h1:mQc3nmndL8ZBzStEo3JYF8wzmeWffDH4VbXz58sAx6Q= +github.com/go-openapi/jsonpointer v0.20.2/go.mod h1:bHen+N0u1KEO3YlmqOjTT9Adn1RfD91Ar825/PuiRVs= +github.com/go-openapi/swag v0.22.8 h1:/9RjDSQ0vbFR+NyjGMkFTsA1IA0fmhKSThmfGZjicbw= +github.com/go-openapi/swag v0.22.8/go.mod h1:6QT22icPLEqAM/z/TChgb4WAveCHF92+2gF0CNjHpPI= +github.com/go-test/deep v1.0.8 h1:TDsG77qcSprGbC6vTN8OuXp5g+J+b5Pcguhf7Zt61VM= github.com/golang-jwt/jwt v3.2.2+incompatible h1:IfV12K8xAKAnZqdXVzCZ+TOjboZ2keLg81eXfW3O+oY= github.com/golang-jwt/jwt v3.2.2+incompatible/go.mod h1:8pz2t5EyA70fFQQSrl6XZXzqecmYZeUEB8OUGHkxJ+I= -github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= -github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= -github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= -github.com/golangci/lint-1 v0.0.0-20181222135242-d2cdd8c08219/go.mod h1:/X8TswGSh1pIozq4ZwCfxS0WA5JGXguxk94ar/4c87Y= -github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= -github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= -github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/gorilla/mux v1.8.0/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So= +github.com/google/uuid v1.5.0 h1:1p67kYwdtXjb0gL0BPiP1Av9wiZPo5A8z2cWkTZ+eyU= +github.com/google/uuid v1.5.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/harness-community/sse/v3 v3.1.0 h1:uaLxXzC9DjpWEV/qTYU3uJV3eLMTRhMY2P6qb/3QAeY= github.com/harness-community/sse/v3 v3.1.0/go.mod h1:v4ft76Eaj+kAsUcc29zIspInWgpzsMLlHLb4x/PYVX0= github.com/hashicorp/go-cleanhttp v0.5.2 h1:035FKYIWjmULyFRBKPs8TBQoi0x6d9G4xc9neXJWAZQ= @@ -54,48 +34,23 @@ github.com/hashicorp/go-retryablehttp v0.7.4 h1:ZQgVdpTdAL7WpMIwLzCfbalOcSUdkDZn github.com/hashicorp/go-retryablehttp v0.7.4/go.mod h1:Jy/gPYAdjqffZ/yFGCFV2doI5wjtH1ewM9u8iYVjtX8= github.com/hashicorp/golang-lru v0.5.4 h1:YDjusn29QI/Das2iO9M0BHnIbxPeyuCHsjMW+lJfyTc= github.com/hashicorp/golang-lru v0.5.4/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4= +github.com/invopop/yaml v0.2.0 h1:7zky/qH+O0DwAyoobXUqvVBwgBFRxKoQ/3FjcVpjTMY= +github.com/invopop/yaml v0.2.0/go.mod h1:2XuRLgs/ouIrW3XNzuNj7J3Nvu/Dig5MXvbCEdiBN3Q= github.com/jarcoal/httpmock v1.0.8 h1:8kI16SoO6LQKgPE7PvQuV+YuD/inwHd7fOOe2zMbo4k= github.com/jarcoal/httpmock v1.0.8/go.mod h1:ATjnClrvW/3tijVmpL/va5Z3aAyGvqU3gCT8nX0Txik= 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= -github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= +github.com/juju/gnuflag v0.0.0-20171113085948-2ce1bb71843d/go.mod h1:2PavIy+JPciBPrBUjwbNvtwB6RQlve+hkpll6QSNmOE= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= -github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= -github.com/kr/pretty v0.3.0 h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0= -github.com/kr/pretty v0.3.0/go.mod h1:640gp4NfQd8pI5XOwp5fnNeVWj67G7CFk/SaSQn7NBk= +github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= -github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= -github.com/labstack/echo/v4 v4.7.2 h1:Kv2/p8OaQ+M6Ex4eGimg9b9e6icoxA42JSlOR3msKtI= -github.com/labstack/echo/v4 v4.7.2/go.mod h1:xkCDAdFCIf8jsFQ5NnbK7oqaF/yU1A1X20Ltm0OvSks= -github.com/labstack/gommon v0.3.1 h1:OomWaJXm7xR6L1HmEtGyQf26TEn7V6X88mktX9kee9o= -github.com/labstack/gommon v0.3.1/go.mod h1:uW6kP17uPlLJsD3ijUYn3/M5bAxtlZhMI6m3MFxTMTM= -github.com/leodido/go-urn v1.2.0/go.mod h1:+8+nEpDfqqsY+g338gtMEUOtuK+4dEMhiQEgxpxOKII= -github.com/leodido/go-urn v1.2.1/go.mod h1:zt4jvISO2HfUBqxjfIshjdMTYS56ZS/qv49ictyFfxY= -github.com/lestrrat-go/backoff/v2 v2.0.8/go.mod h1:rHP/q/r9aT27n24JQLa7JhSQZCKBBOiM/uP402WwN8Y= -github.com/lestrrat-go/blackmagic v1.0.0/go.mod h1:TNgH//0vYSs8VXDCfkZLgIrVTTXQELZffUV0tz3MtdQ= -github.com/lestrrat-go/blackmagic v1.0.1/go.mod h1:UrEqBzIR2U6CnzVyUtfM6oZNMt/7O7Vohk2J0OGSAtU= -github.com/lestrrat-go/httpcc v1.0.1/go.mod h1:qiltp3Mt56+55GPVCbTdM9MlqhvzyuL6W/NMDA8vA5E= -github.com/lestrrat-go/iter v1.0.1/go.mod h1:zIdgO1mRKhn8l9vrZJZz9TUMMFbQbLeTsbqPDrJ/OJc= -github.com/lestrrat-go/iter v1.0.2/go.mod h1:Momfcq3AnRlRjI5b5O8/G5/BvpzrhoFTZcn06fEOPt4= -github.com/lestrrat-go/jwx v1.2.24/go.mod h1:zoNuZymNl5lgdcu6P7K6ie2QRll5HVfF4xwxBBK1NxY= -github.com/lestrrat-go/option v1.0.0/go.mod h1:5ZHFbivi4xwXxhxY9XHDe2FHo6/Z7WWmtT7T5nBBp3I= -github.com/mailru/easyjson v0.0.0-20190614124828-94de47d64c63/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= -github.com/mailru/easyjson v0.0.0-20190626092158-b2ccc519800e/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= -github.com/mailru/easyjson v0.7.6/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc= github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0= github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc= -github.com/matryer/moq v0.2.7/go.mod h1:kITsx543GOENm48TUAQyJ9+SAvFSr7iGQXPoth/VUBk= -github.com/mattn/go-colorable v0.1.11/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4= -github.com/mattn/go-colorable v0.1.12 h1:jF+Du6AlPIjs2BiUiQlKOX0rt3SujHxPnksPKZbaA40= -github.com/mattn/go-colorable v0.1.12/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4= -github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= -github.com/mattn/go-isatty v0.0.14 h1:yVuAays6BHfxijgZPzw+3Zlu5yQgKGP2/hcQbHb7S9Y= -github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94= github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y= github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= github.com/mitchellh/mapstructure v1.3.3 h1:SzB1nHZ2Xi+17FP0zVQBHIZqvwRN9408fJO8h+eeNA8= @@ -103,40 +58,31 @@ github.com/mitchellh/mapstructure v1.3.3/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RR github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= -github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M= github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= -github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= -github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= +github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 h1:RWengNIwukTxcDr9M+97sNutRR1RKhG96O6jWumTTnw= +github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826/go.mod h1:TaXosZuwdSHYgviHp1DAtfrULt5eUgsSMsZf+YrPgl8= +github.com/oapi-codegen/runtime v1.1.1 h1:EXLHh0DXIJnWhdRPN2w4MXAzFyE4CskzhNLUmtpMYro= +github.com/oapi-codegen/runtime v1.1.1/go.mod h1:SK9X900oXmPWilYR5/WKPzt3Kqxn/uS/+lbpREv+eCg= +github.com/perimeterx/marshmallow v1.1.5 h1:a2LALqQ1BlHM8PZblsDdidgv1mWi1DgC2UmX50IvK2s= +github.com/perimeterx/marshmallow v1.1.5/go.mod h1:dsXbUu8CRzfYP5a87xpp0xq9S3u0Vchtcl8we9tYaXw= +github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= -github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= -github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc= -github.com/rogpeppe/go-internal v1.8.0 h1:FCbCCtXNOY3UtUuHUYaghJg4y7Fd14rXifAYUAtL9R8= -github.com/rogpeppe/go-internal v1.8.0/go.mod h1:WmiCO8CzOY8rg0OYDC4/i/2WRWAB6poM+XZ2dLUbcbE= +github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8= github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0bLI= github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= +github.com/spkg/bom v0.0.0-20160624110644-59b7046e48ad/go.mod h1:qLr4V1qq6nMqFKkMo8ZTx3f+BZEkzsRUY10Xsm2mwU0= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= -github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= -github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY= -github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/ugorji/go v1.1.7/go.mod h1:kZn38zHttfInRq0xu/PH0az30d+z6vm202qpg1oXVMw= -github.com/ugorji/go v1.2.7/go.mod h1:nF9osbDWLy6bDVv/Rtoh6QgnvNDpmCalQV5urGCCS6M= -github.com/ugorji/go/codec v1.1.7/go.mod h1:Ax+UKWsSmolVDwsd+7N3ZtXu+yMGCf907BLYF3GoBXY= -github.com/ugorji/go/codec v1.2.7/go.mod h1:WGN1fab3R1fzQlVQTkfxVtIBhWDRqOviHU95kRgeqEY= -github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw= -github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc= -github.com/valyala/fasttemplate v1.2.1 h1:TVEnxayobAdVkhQfrfes2IzOB6o+z4roRkPF52WA1u4= -github.com/valyala/fasttemplate v1.2.1/go.mod h1:KHLXt3tVN2HBp8eijSv/kGJopbvo7S+qRAEEKiv+SiQ= -github.com/yuin/goldmark v1.4.1/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= +github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= +github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= +github.com/ugorji/go/codec v1.2.11 h1:BMaWp1Bb6fHwEtbplGBGJ498wD+LKlNSl25MjdZY4dU= go.uber.org/atomic v1.6.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ= go.uber.org/atomic v1.7.0 h1:ADUqmZGgLDDfbSL9ZmPxKTybcoEYHgpYfELNoN+7hsw= go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= @@ -148,89 +94,41 @@ go.uber.org/zap v1.16.0 h1:uFRZXykJGK9lLY4HtgSw44DnIcAM+kRBP7x5m+NpAOM= go.uber.org/zap v1.16.0/go.mod h1:MA8QOfq0BHJwdXa996Y4dYkAqRKB8/1K1QMMZVaNZjQ= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20210817164053-32db794688a5/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.0.0-20211215153901-e495a2d5b3d3/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= -golang.org/x/crypto v0.0.0-20220427172511-eb4f295cb31f/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= -golang.org/x/crypto v0.0.0-20220513210258-46612604a0f9/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= -golang.org/x/crypto v0.14.0 h1:wBqGXzWJW6m1XrIKlAH0Hs1JJ7+9KBwnIO8v66Q9cHc= golang.org/x/exp v0.0.0-20230905200255-921286631fa9 h1:GoHiUyI/Tp2nVkLI2mCxVkOjsbSXD66ic0XW0js0R9g= golang.org/x/exp v0.0.0-20230905200255-921286631fa9/go.mod h1:S2oDrQGGwySpoQPVqRShND87VCbxmc6bL1Yd2oYrm6k= -golang.org/x/lint v0.0.0-20190930215403-16217165b5de h1:5hukYrvBGR8/eNkX5mdUezrA6JiaEZDtJb9Ei+1LlBs= golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20210508222113-6edffad5e616 h1:VLliZ0d+/avPrXXH+OakdXhpJuEoBZuwh1m2j7U6Iug= golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= -golang.org/x/mod v0.6.0-dev.0.20220106191415-9b9b3d81d5e3/go.mod h1:3p9vT2HGsQu2K1YbXdKPJLVgG5VJdoTa1poYQBtP1AY= golang.org/x/mod v0.12.0 h1:rmsUpXtvNzj340zd98LZ4KntptpfRHwpFOHG188oHXc= golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20191116160921-f9c825593386/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= -golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.0.0-20220513224357-95641704303c/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= -golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM= -golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= +golang.org/x/net v0.19.0 h1:zTwKpTd2XuCqf8huc7Fo2iSy+4RHPd10s4KzeTnVr1c= +golang.org/x/net v0.19.0/go.mod h1:CfAk/cbD4CthTvqiEl8NpboMuiuOYsAr/7NOjZJtv1U= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20210220032951-036812b2e83c h1:5KslGYwFpkhGh+Q16bwMP3cOontH8FOep7tGV86Y7SQ= golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210806184541-e5e7981a1069/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20211019181941-9d821ace8654/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20211103235746-7861aae1554b/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220513210249-45d2b4557a2a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= -golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= -golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= +golang.org/x/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= -golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= -golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= -golang.org/x/time v0.0.0-20201208040808-7e3f01d25324/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/time v0.0.0-20220411224347-583f2d630306/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= golang.org/x/tools v0.0.0-20191029041327-9cc4af7d6b2c/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191029190741-b9c20aec41a5/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.1.10/go.mod h1:Uh6Zz+xoGYZom868N8YTex3t7RhtHDBrE8Gzo9bV56E= golang.org/x/tools v0.13.0 h1:Iey4qkscZuv0VvIt8E0neZjtPVQFSc870HQ448QgEmQ= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20220411194840-2f41105eb62f/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= -google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/cenkalti/backoff.v1 v1.1.0 h1:Arh75ttbsvlpVA7WtVpH4u9h6Zl46xuptxqLxPiSo4Y= gopkg.in/cenkalti/backoff.v1 v1.1.0/go.mod h1:J6Vskwqd+OMVJl8C33mmtxTBs2gyzfv7UDAkHu8BrjI= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= -gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.0/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= honnef.co/go/tools v0.0.1-2019.2.3 h1:3JgtbtFHMiCmsznwGVTUWbgGov+pVqnlf1dEJTNAXeM= diff --git a/metricsclient/services.gen.go b/metricsclient/services.gen.go index 9e9793a4..930db861 100644 --- a/metricsclient/services.gen.go +++ b/metricsclient/services.gen.go @@ -1,6 +1,6 @@ // Package metricsclient provides primitives to interact with the openapi HTTP API. // -// Code generated by github.com/deepmap/oapi-codegen version v1.11.0 DO NOT EDIT. +// Code generated by github.com/deepmap/oapi-codegen/v2 version v2.1.0 DO NOT EDIT. package metricsclient import ( @@ -9,12 +9,11 @@ import ( "encoding/json" "fmt" "io" - "io/ioutil" "net/http" "net/url" "strings" - "github.com/deepmap/oapi-codegen/pkg/runtime" + "github.com/oapi-codegen/runtime" ) // RequestEditorFn is the function signature for the RequestEditor callback function @@ -90,14 +89,14 @@ func WithRequestEditorFn(fn RequestEditorFn) ClientOption { // The interface specification for the client above. type ClientInterface interface { - // PostMetrics request with any body - PostMetricsWithBody(ctx context.Context, environment EnvironmentPathParam, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) + // PostMetricsWithBody request with any body + PostMetricsWithBody(ctx context.Context, environmentUUID EnvironmentPathParam, params *PostMetricsParams, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) - PostMetrics(ctx context.Context, environment EnvironmentPathParam, body PostMetricsJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) + PostMetrics(ctx context.Context, environmentUUID EnvironmentPathParam, params *PostMetricsParams, body PostMetricsJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) } -func (c *Client) PostMetricsWithBody(ctx context.Context, environment EnvironmentPathParam, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewPostMetricsRequestWithBody(c.Server, environment, contentType, body) +func (c *Client) PostMetricsWithBody(ctx context.Context, environmentUUID EnvironmentPathParam, params *PostMetricsParams, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewPostMetricsRequestWithBody(c.Server, environmentUUID, params, contentType, body) if err != nil { return nil, err } @@ -108,8 +107,8 @@ func (c *Client) PostMetricsWithBody(ctx context.Context, environment Environmen return c.Client.Do(req) } -func (c *Client) PostMetrics(ctx context.Context, environment EnvironmentPathParam, body PostMetricsJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewPostMetricsRequest(c.Server, environment, body) +func (c *Client) PostMetrics(ctx context.Context, environmentUUID EnvironmentPathParam, params *PostMetricsParams, body PostMetricsJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewPostMetricsRequest(c.Server, environmentUUID, params, body) if err != nil { return nil, err } @@ -121,23 +120,23 @@ func (c *Client) PostMetrics(ctx context.Context, environment EnvironmentPathPar } // NewPostMetricsRequest calls the generic PostMetrics builder with application/json body -func NewPostMetricsRequest(server string, environment EnvironmentPathParam, body PostMetricsJSONRequestBody) (*http.Request, error) { +func NewPostMetricsRequest(server string, environmentUUID EnvironmentPathParam, params *PostMetricsParams, body PostMetricsJSONRequestBody) (*http.Request, error) { var bodyReader io.Reader buf, err := json.Marshal(body) if err != nil { return nil, err } bodyReader = bytes.NewReader(buf) - return NewPostMetricsRequestWithBody(server, environment, "application/json", bodyReader) + return NewPostMetricsRequestWithBody(server, environmentUUID, params, "application/json", bodyReader) } // NewPostMetricsRequestWithBody generates requests for PostMetrics with any type of body -func NewPostMetricsRequestWithBody(server string, environment EnvironmentPathParam, contentType string, body io.Reader) (*http.Request, error) { +func NewPostMetricsRequestWithBody(server string, environmentUUID EnvironmentPathParam, params *PostMetricsParams, contentType string, body io.Reader) (*http.Request, error) { var err error var pathParam0 string - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "environment", runtime.ParamLocationPath, environment) + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "environmentUUID", runtime.ParamLocationPath, environmentUUID) if err != nil { return nil, err } @@ -157,6 +156,28 @@ func NewPostMetricsRequestWithBody(server string, environment EnvironmentPathPar return nil, err } + if params != nil { + queryValues := queryURL.Query() + + if params.Cluster != nil { + + if queryFrag, err := runtime.StyleParamWithLocation("form", true, "cluster", runtime.ParamLocationQuery, *params.Cluster); err != nil { + return nil, err + } else if parsed, err := url.ParseQuery(queryFrag); err != nil { + return nil, err + } else { + for k, v := range parsed { + for _, v2 := range v { + queryValues.Add(k, v2) + } + } + } + + } + + queryURL.RawQuery = queryValues.Encode() + } + req, err := http.NewRequest("POST", queryURL.String(), body) if err != nil { return nil, err @@ -210,18 +231,18 @@ func WithBaseURL(baseURL string) ClientOption { // ClientWithResponsesInterface is the interface specification for the client with responses above. type ClientWithResponsesInterface interface { - // PostMetrics request with any body - PostMetricsWithBodyWithResponse(ctx context.Context, environment EnvironmentPathParam, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PostMetricsResponse, error) + // PostMetricsWithBodyWithResponse request with any body + PostMetricsWithBodyWithResponse(ctx context.Context, environmentUUID EnvironmentPathParam, params *PostMetricsParams, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PostMetricsResponse, error) - PostMetricsWithResponse(ctx context.Context, environment EnvironmentPathParam, body PostMetricsJSONRequestBody, reqEditors ...RequestEditorFn) (*PostMetricsResponse, error) + PostMetricsWithResponse(ctx context.Context, environmentUUID EnvironmentPathParam, params *PostMetricsParams, body PostMetricsJSONRequestBody, reqEditors ...RequestEditorFn) (*PostMetricsResponse, error) } type PostMetricsResponse struct { Body []byte HTTPResponse *http.Response - JSON401 *Error - JSON403 *Error - JSON500 *Error + JSON401 *Unauthenticated + JSON403 *Unauthorized + JSON500 *InternalServerError } // Status returns HTTPResponse.Status @@ -241,16 +262,16 @@ func (r PostMetricsResponse) StatusCode() int { } // PostMetricsWithBodyWithResponse request with arbitrary body returning *PostMetricsResponse -func (c *ClientWithResponses) PostMetricsWithBodyWithResponse(ctx context.Context, environment EnvironmentPathParam, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PostMetricsResponse, error) { - rsp, err := c.PostMetricsWithBody(ctx, environment, contentType, body, reqEditors...) +func (c *ClientWithResponses) PostMetricsWithBodyWithResponse(ctx context.Context, environmentUUID EnvironmentPathParam, params *PostMetricsParams, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PostMetricsResponse, error) { + rsp, err := c.PostMetricsWithBody(ctx, environmentUUID, params, contentType, body, reqEditors...) if err != nil { return nil, err } return ParsePostMetricsResponse(rsp) } -func (c *ClientWithResponses) PostMetricsWithResponse(ctx context.Context, environment EnvironmentPathParam, body PostMetricsJSONRequestBody, reqEditors ...RequestEditorFn) (*PostMetricsResponse, error) { - rsp, err := c.PostMetrics(ctx, environment, body, reqEditors...) +func (c *ClientWithResponses) PostMetricsWithResponse(ctx context.Context, environmentUUID EnvironmentPathParam, params *PostMetricsParams, body PostMetricsJSONRequestBody, reqEditors ...RequestEditorFn) (*PostMetricsResponse, error) { + rsp, err := c.PostMetrics(ctx, environmentUUID, params, body, reqEditors...) if err != nil { return nil, err } @@ -259,7 +280,7 @@ func (c *ClientWithResponses) PostMetricsWithResponse(ctx context.Context, envir // ParsePostMetricsResponse parses an HTTP response from a PostMetricsWithResponse call func ParsePostMetricsResponse(rsp *http.Response) (*PostMetricsResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) + bodyBytes, err := io.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err @@ -272,21 +293,21 @@ func ParsePostMetricsResponse(rsp *http.Response) (*PostMetricsResponse, error) switch { case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 401: - var dest Error + var dest Unauthenticated if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.JSON401 = &dest case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 403: - var dest Error + var dest Unauthorized if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.JSON403 = &dest case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 500: - var dest Error + var dest InternalServerError if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } diff --git a/metricsclient/types.gen.go b/metricsclient/types.gen.go index 69315ac0..5166c797 100644 --- a/metricsclient/types.gen.go +++ b/metricsclient/types.gen.go @@ -1,9 +1,10 @@ // Package metricsclient provides primitives to interact with the openapi HTTP API. // -// Code generated by github.com/deepmap/oapi-codegen version v1.11.0 DO NOT EDIT. +// Code generated by github.com/deepmap/oapi-codegen/v2 version v2.1.0 DO NOT EDIT. package metricsclient const ( + ApiKeyAuthScopes = "ApiKeyAuth.Scopes" BearerAuthScopes = "BearerAuth.Scopes" ) @@ -14,7 +15,13 @@ const ( // Error defines model for Error. type Error struct { - Code string `json:"code"` + // Code The http error code + Code string `json:"code"` + + // Details Additional details about the error + Details *map[string]interface{} `json:"details,omitempty"` + + // Message The reason the request failed Message string `json:"message"` } @@ -35,14 +42,14 @@ type MetricsData struct { Attributes []KeyValue `json:"attributes"` Count int `json:"count"` - // This can be of type FeatureMetrics + // MetricsType This can be of type FeatureMetrics MetricsType MetricsDataMetricsType `json:"metricsType"` - // time at when this data was recorded + // Timestamp time at when this data was recorded Timestamp int64 `json:"timestamp"` } -// This can be of type FeatureMetrics +// MetricsDataMetricsType This can be of type FeatureMetrics type MetricsDataMetricsType string // TargetData defines model for TargetData. @@ -52,6 +59,9 @@ type TargetData struct { Name string `json:"name"` } +// ClusterQueryOptionalParam defines model for clusterQueryOptionalParam. +type ClusterQueryOptionalParam string + // EnvironmentPathParam defines model for environmentPathParam. type EnvironmentPathParam string @@ -64,8 +74,11 @@ type Unauthenticated Error // Unauthorized defines model for Unauthorized. type Unauthorized Error -// PostMetricsJSONBody defines parameters for PostMetrics. -type PostMetricsJSONBody Metrics +// PostMetricsParams defines parameters for PostMetrics. +type PostMetricsParams struct { + // Cluster Unique identifier for the cluster for the account + Cluster *ClusterQueryOptionalParam `form:"cluster,omitempty" json:"cluster,omitempty"` +} // PostMetricsJSONRequestBody defines body for PostMetrics for application/json ContentType. -type PostMetricsJSONRequestBody PostMetricsJSONBody +type PostMetricsJSONRequestBody Metrics diff --git a/resources/client-v1.yaml b/resources/client-v1.yaml index cc93e055..4105ff49 100644 --- a/resources/client-v1.yaml +++ b/resources/client-v1.yaml @@ -11,12 +11,19 @@ servers: description: no host specified - url: 'http://localhost:3000/api/1.0' description: CfClient description +tags: + - name: client + - name: metrics + - name: Proxy + description: APIs used by the ff-proxy paths: '/client/env/{environmentUUID}/feature-configs': get: summary: Get all feature flags activations description: All feature flags with activations in project environment operationId: GetFeatureConfig + tags: + - client parameters: - name: environmentUUID in: path @@ -24,6 +31,7 @@ paths: description: Unique identifier for the environment object in the API. schema: type: string + - $ref: '#/components/parameters/clusterQueryOptionalParam' security: - BearerAuth: [] responses: @@ -39,6 +47,8 @@ paths: get: summary: Get feature config operationId: GetFeatureConfigByIdentifier + tags: + - client parameters: - name: identifier in: path @@ -52,6 +62,7 @@ paths: description: Unique identifier for the environment object in the API. schema: type: string + - $ref: '#/components/parameters/clusterQueryOptionalParam' security: - BearerAuth: [] responses: @@ -66,6 +77,8 @@ paths: summary: Retrieve all segments. description: Used to retrieve all segments for certain account id. operationId: GetAllSegments + tags: + - client parameters: - name: environmentUUID in: path @@ -73,6 +86,7 @@ paths: description: Unique identifier for the environment object in the API. schema: type: string + - $ref: '#/components/parameters/clusterQueryOptionalParam' security: - BearerAuth: [] responses: @@ -97,6 +111,8 @@ paths: summary: Retrieve a segment by identifier description: Used to retrieve a segment for a certain account id by identifier operationId: GetSegmentByIdentifier + tags: + - client parameters: - name: identifier in: path @@ -110,6 +126,7 @@ paths: description: Unique identifier for the environment object in the API schema: type: string + - $ref: '#/components/parameters/clusterQueryOptionalParam' security: - BearerAuth: [] responses: @@ -132,6 +149,8 @@ paths: summary: Authenticate with the admin server. description: Used to retrieve all target segments for certain account id. operationId: Authenticate + tags: + - client requestBody: content: application/json: @@ -156,6 +175,8 @@ paths: get: summary: Get feature evaluations for target operationId: GetEvaluations + tags: + - client parameters: - name: environmentUUID in: path @@ -169,6 +190,9 @@ paths: description: Unique identifier for the target object in the API. schema: type: string + - $ref: '#/components/parameters/clusterQueryOptionalParam' + security: + - BearerAuth: [] responses: '200': description: OK @@ -182,6 +206,8 @@ paths: get: summary: Get feature evaluations for target operationId: GetEvaluationByIdentifier + tags: + - client parameters: - name: environmentUUID in: path @@ -201,6 +227,9 @@ paths: description: Unique identifier for the target object in the API. schema: type: string + - $ref: '#/components/parameters/clusterQueryOptionalParam' + security: + - BearerAuth: [] responses: '200': description: OK @@ -208,16 +237,46 @@ paths: application/json: schema: $ref: '#/components/schemas/Evaluation' + '/metrics/{environmentUUID}': + post: + tags: + - metrics + summary: Send metrics to the Analytics server. + description: Send metrics to Analytics server + operationId: postMetrics + parameters: + - $ref: '#/components/parameters/environmentPathParam' + - $ref: '#/components/parameters/clusterQueryOptionalParam' + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/Metrics' + security: + - ApiKeyAuth: [] + - BearerAuth: [] + responses: + '200': + description: OK + '401': + $ref: '#/components/responses/Unauthenticated' + '403': + $ref: '#/components/responses/Unauthorized' + '500': + $ref: '#/components/responses/InternalServerError' /stream: get: summary: Stream endpoint. operationId: Stream + tags: + - client parameters: - in: header name: API-Key schema: type: string required: true + - $ref: '#/components/parameters/clusterQueryOptionalParam' security: - BearerAuth: [] responses: @@ -242,65 +301,175 @@ paths: default: '*' '503': description: Service Unavailable + /proxy/config: + get: + summary: Gets Proxy config for multiple environments + description: >- + Gets Proxy config for multiple environments if the Key query param is + provided or gets config for a single environment if an environment query + param is provided + operationId: GetProxyConfig + tags: + - Proxy + parameters: + - $ref: '#/components/parameters/pageNumber' + - $ref: '#/components/parameters/pageSize' + - $ref: '#/components/parameters/clusterQueryOptionalParam' + - in: query + name: environment + description: >- + Accepts an EnvironmentID. If this is provided then the endpoint will + only return config for this environment. If this is left empty then + the Proxy will return config for all environments associated with + the Proxy Key. + required: false + schema: + type: string + - in: query + name: key + description: Accpets a Proxy Key. + required: true + schema: + type: string + security: + - BearerAuth: [] + responses: + '200': + $ref: '#/components/responses/ProxyConfigResponse' + '400': + $ref: '#/components/responses/BadRequest' + '401': + $ref: '#/components/responses/Unauthenticated' + '403': + $ref: '#/components/responses/Unauthorized' + '404': + $ref: '#/components/responses/NotFound' + '500': + $ref: '#/components/responses/InternalServerError' + /proxy/auth: + post: + summary: Endpoint that the Proxy can use to authenticate with the client server + description: Endpoint that the Proxy can use to authenticate with the client server + operationId: AuthenticateProxyKey + tags: + - Proxy + requestBody: + content: + application/json: + schema: + type: object + properties: + proxyKey: + type: string + example: 896045f3-42ee-4e73-9154-086644768b96 + required: + - proxyKey + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/AuthenticationResponse' + '401': + $ref: '#/components/responses/Unauthenticated' + '403': + $ref: '#/components/responses/Unauthorized' + '404': + $ref: '#/components/responses/NotFound' + '500': + $ref: '#/components/responses/InternalServerError' components: schemas: FeatureState: type: string + description: The state of a flag either off or on enum: - 'on' - 'off' Variation: type: object + description: A variation of a flag that can be returned to a target properties: identifier: type: string + description: The unique identifier for the variation + example: off-variation value: type: string + description: >- + The variation value to serve such as true or false for a boolean + flag + example: 'true' name: type: string + description: The user friendly name of the variation + example: Off VAriation description: type: string + description: A description of the variation required: - identifier - value Clause: type: object + description: A clause describes what conditions are used to evaluate a flag properties: id: type: string + description: The unique ID for the clause + example: 32434243 attribute: type: string + description: >- + The attribute to use in the clause. This can be any target + attribute + example: identifier op: type: string + description: 'The type of operation such as equals, starts_with, contains' + example: starts_with values: type: array + description: The values that are compared against the operator items: type: string negate: type: boolean + description: Is the operation negated? + example: false required: - - id - attribute - op - negate - values WeightedVariation: type: object + description: >- + A variation and the weighting it should receive as part of a percentage + rollout properties: variation: type: string + description: The variation identifier + example: off-variation weight: type: integer + description: The weight to be given to the variation in percent + example: 50 required: - variation - weight Distribution: type: object + description: Describes a distribution rule properties: bucketBy: type: string + description: The attribute to use when distributing targets across buckets variations: type: array + description: A list of variations and the weight that should be given to each items: $ref: '#/components/schemas/WeightedVariation' required: @@ -308,6 +477,9 @@ components: - variations Serve: type: object + description: >- + Describe the distribution rule and the variation that should be served + to the target properties: distribution: $ref: '#/components/schemas/Distribution' @@ -315,13 +487,20 @@ components: type: string ServingRule: type: object + description: The rule used to determine what variation to serve to a target properties: ruleId: type: string + description: The unique identifier for this rule priority: type: integer + description: >- + The rules priority relative to other rules. The rules are evaluated + in order with 1 being the highest + example: 1 clauses: type: array + description: A list of clauses to use in the rule items: $ref: '#/components/schemas/Clause' serve: @@ -330,14 +509,16 @@ components: - priority - clauses - serve - - ruleId Prerequisite: type: object + description: Feature Flag pre-requisites properties: feature: type: string + description: The feature identifier that is the prerequisite variations: type: array + description: A list of variations that must be met items: type: string required: @@ -345,25 +526,35 @@ components: - variations TargetMap: type: object + description: Target map provides the details of a target that belongs to a flag properties: identifier: type: string + description: The identifier for the target name: type: string + description: The name of the target required: - - idenfifier + - identifier - name VariationMap: type: object + description: >- + A mapping of variations to targets and target groups (segments). The + targets listed here should receive this variation. properties: variation: type: string + description: The variation identifier + example: off-variation targets: type: array + description: A list of target mappings items: $ref: '#/components/schemas/TargetMap' targetSegments: type: array + description: A list of target groups (segments) items: type: string required: @@ -417,86 +608,123 @@ components: - state - kind - variations - - defaultTarget - offVariation - defaultServe Tag: type: object - description: A name and value pair. + description: A Tag object used to tag feature flags - consists of name and identifier properties: name: type: string - value: + description: The name of the tag + example: feature-flag-tag-1 + identifier: type: string + description: The identifier of the tag + example: feature-flag-tag-1 required: - name + - identifier Segment: type: object + description: A Target Group (Segment) response properties: identifier: type: string - description: Unique identifier for the segment. + description: Unique identifier for the target group. name: type: string - description: Name of the segment. + description: Name of the target group. example: Beta Testers environment: type: string + description: The environment this target group belongs to + example: Production tags: type: array + description: Tags for this target group items: $ref: '#/components/schemas/Tag' included: type: array + description: A list of Targets who belong to this target group items: $ref: '#/components/schemas/Target' excluded: type: array + description: A list of Targets who are excluded from this target group items: $ref: '#/components/schemas/Target' rules: type: array items: $ref: '#/components/schemas/Clause' + servingRules: + type: array + items: + $ref: '#/components/schemas/GroupServingRule' description: >- An array of rules that can cause a user to be included in this segment. createdAt: type: integer + description: The data and time in milliseconds when the group was created format: int64 modifiedAt: type: integer + description: The data and time in milliseconds when the group was last modified format: int64 version: type: integer + description: >- + The version of this group. Each time it is modified the version is + incremented + example: 1 format: int64 required: - identifier - name Target: type: object + description: A Target object properties: identifier: type: string + description: The unique identifier for this target + example: john-doe account: type: string + description: The account ID that the target belongs to + example: abcXDdffdaffd org: type: string + description: The identifier for the organization that the target belongs to environment: type: string + description: The identifier for the environment that the target belongs to project: type: string + description: The identifier for the project that this target belongs to name: type: string + description: The name of this Target + example: John Doe anonymous: type: boolean + description: Indicates if this target is anonymous attributes: type: object + description: a JSON representation of the attributes for this target + example: + age: 20 + location: Belfast createdAt: type: integer + description: The date and time in milliseconds when this Target was created format: int64 segments: type: array + description: A list of Target Groups (Segments) that this Target belongs to items: $ref: '#/components/schemas/Segment' required: @@ -506,13 +734,42 @@ components: - project - account - org + GroupServingRule: + type: object + description: The rule used to determine what variation to serve to a target + properties: + ruleId: + type: string + description: The unique identifier for this rule + priority: + type: integer + description: >- + The rules priority relative to other rules. The rules are evaluated + in order with 1 being the highest + example: 1 + clauses: + type: array + description: A list of clauses to use in the rule + items: + $ref: '#/components/schemas/Clause' + required: + - ruleId + - clauses + - priority Error: type: object properties: code: type: string + description: The http error code + example: 404 message: type: string + description: The reason the request failed + example: 'Error retrieving projects, organization ''default_org'' does not exist' + details: + type: object + description: Additional details about the error required: - code - message @@ -549,23 +806,31 @@ components: properties: version: type: integer + description: >- + The version of this object. The version will be incremented each + time the object is modified + example: 5 pageCount: type: integer + description: The total number of pages + example: 100 itemCount: type: integer + description: The total number of items example: 1 pageSize: type: integer + description: The number of items per page example: 1 pageIndex: type: integer + description: The current page example: 0 required: - pageCount - itemCount - pageSize - pageIndex - - pageIndex Evaluation: type: object properties: @@ -585,11 +850,129 @@ components: type: array items: $ref: '#/components/schemas/Evaluation' + KeyValue: + type: object + properties: + key: + type: string + value: + type: string + required: + - key + - value + TargetData: + type: object + properties: + identifier: + type: string + name: + type: string + attributes: + type: array + items: + $ref: '#/components/schemas/KeyValue' + required: + - name + - identifier + - attributes + MetricsData: + type: object + properties: + timestamp: + type: integer + format: int64 + example: 1608175465 + description: time at when this data was recorded + count: + type: integer + metricsType: + type: string + enum: + - FFMETRICS + description: This can be of type FeatureMetrics + attributes: + type: array + items: + $ref: '#/components/schemas/KeyValue' + required: + - attributes + - count + - timestamp + - metricsType + Metrics: + type: object + properties: + targetData: + type: array + items: + $ref: '#/components/schemas/TargetData' + metricsData: + type: array + items: + $ref: '#/components/schemas/MetricsData' + ProxyConfig: + type: object + description: TBD + allOf: + - $ref: '#/components/schemas/Pagination' + - properties: + environments: + type: array + items: + type: object + properties: + id: + type: string + apiKeys: + type: array + items: + type: string + featureConfigs: + type: array + items: + $ref: '#/components/schemas/FeatureConfig' + segments: + type: array + items: + $ref: '#/components/schemas/Segment' securitySchemes: + ApiKeyAuth: + type: apiKey + in: header + name: api-key BearerAuth: type: http scheme: bearer bearerFormat: JWT + parameters: + clusterQueryOptionalParam: + name: cluster + in: query + required: false + description: Unique identifier for the cluster for the account + schema: + type: string + environmentPathParam: + name: environmentUUID + in: path + required: true + description: environment parameter in query. + schema: + type: string + pageNumber: + name: pageNumber + in: query + required: false + description: PageNumber + schema: + type: integer + pageSize: + name: pageSize + in: query + required: false + description: PageSize + schema: + type: integer responses: Unauthenticated: description: Unauthenticated @@ -615,3 +998,15 @@ components: application/json: schema: $ref: '#/components/schemas/Error' + ProxyConfigResponse: + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/ProxyConfig' + BadRequest: + description: Bad request + content: + application/json: + schema: + $ref: '#/components/schemas/Error' diff --git a/resources/metrics-v1.yaml b/resources/metrics-v1.yaml index 2ad1b46f..b02788fc 100644 --- a/resources/metrics-v1.yaml +++ b/resources/metrics-v1.yaml @@ -11,20 +11,26 @@ servers: description: no host specified - url: 'http://localhost:3000/api/1.0' description: CfClient description +tags: + - name: metrics paths: - '/metrics/{environment}': + '/metrics/{environmentUUID}': post: summary: Send metrics to the Analytics server. description: Send metrics to Analytics server operationId: postMetrics + tags: + - metrics parameters: - $ref: '#/components/parameters/environmentPathParam' + - $ref: '#/components/parameters/clusterQueryOptionalParam' requestBody: content: application/json: schema: $ref: '#/components/schemas/Metrics' security: + - ApiKeyAuth: [] - BearerAuth: [] responses: '200': @@ -102,24 +108,42 @@ components: properties: code: type: string + description: The http error code + example: 404 message: type: string + description: The reason the request failed + example: 'Error retrieving projects, organization ''default_org'' does not exist' + details: + type: object + description: Additional details about the error required: - code - message securitySchemes: + ApiKeyAuth: + type: apiKey + in: header + name: api-key BearerAuth: type: http scheme: bearer bearerFormat: JWT parameters: environmentPathParam: - name: environment + name: environmentUUID in: path required: true description: environment parameter in query. schema: type: string + clusterQueryOptionalParam: + name: cluster + in: query + required: false + description: Unique identifier for the cluster for the account + schema: + type: string responses: Unauthenticated: description: Unauthenticated diff --git a/rest/services.gen.go b/rest/services.gen.go index c17fad5c..a65ad943 100644 --- a/rest/services.gen.go +++ b/rest/services.gen.go @@ -1,6 +1,6 @@ // Package rest provides primitives to interact with the openapi HTTP API. // -// Code generated by github.com/deepmap/oapi-codegen version v1.11.0 DO NOT EDIT. +// Code generated by github.com/deepmap/oapi-codegen/v2 version v2.1.0 DO NOT EDIT. package rest import ( @@ -11,14 +11,13 @@ import ( "encoding/json" "fmt" "io" - "io/ioutil" "net/http" "net/url" "path" "strings" - "github.com/deepmap/oapi-codegen/pkg/runtime" "github.com/getkin/kin-openapi/openapi3" + "github.com/oapi-codegen/runtime" ) // RequestEditorFn is the function signature for the RequestEditor callback function @@ -94,28 +93,41 @@ func WithRequestEditorFn(fn RequestEditorFn) ClientOption { // The interface specification for the client above. type ClientInterface interface { - // Authenticate request with any body + // AuthenticateWithBody request with any body AuthenticateWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) Authenticate(ctx context.Context, body AuthenticateJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) // GetFeatureConfig request - GetFeatureConfig(ctx context.Context, environmentUUID string, reqEditors ...RequestEditorFn) (*http.Response, error) + GetFeatureConfig(ctx context.Context, environmentUUID string, params *GetFeatureConfigParams, reqEditors ...RequestEditorFn) (*http.Response, error) // GetFeatureConfigByIdentifier request - GetFeatureConfigByIdentifier(ctx context.Context, environmentUUID string, identifier string, reqEditors ...RequestEditorFn) (*http.Response, error) + GetFeatureConfigByIdentifier(ctx context.Context, environmentUUID string, identifier string, params *GetFeatureConfigByIdentifierParams, reqEditors ...RequestEditorFn) (*http.Response, error) // GetAllSegments request - GetAllSegments(ctx context.Context, environmentUUID string, reqEditors ...RequestEditorFn) (*http.Response, error) + GetAllSegments(ctx context.Context, environmentUUID string, params *GetAllSegmentsParams, reqEditors ...RequestEditorFn) (*http.Response, error) // GetSegmentByIdentifier request - GetSegmentByIdentifier(ctx context.Context, environmentUUID string, identifier string, reqEditors ...RequestEditorFn) (*http.Response, error) + GetSegmentByIdentifier(ctx context.Context, environmentUUID string, identifier string, params *GetSegmentByIdentifierParams, reqEditors ...RequestEditorFn) (*http.Response, error) // GetEvaluations request - GetEvaluations(ctx context.Context, environmentUUID string, target string, reqEditors ...RequestEditorFn) (*http.Response, error) + GetEvaluations(ctx context.Context, environmentUUID string, target string, params *GetEvaluationsParams, reqEditors ...RequestEditorFn) (*http.Response, error) // GetEvaluationByIdentifier request - GetEvaluationByIdentifier(ctx context.Context, environmentUUID string, target string, feature string, reqEditors ...RequestEditorFn) (*http.Response, error) + GetEvaluationByIdentifier(ctx context.Context, environmentUUID string, target string, feature string, params *GetEvaluationByIdentifierParams, reqEditors ...RequestEditorFn) (*http.Response, error) + + // PostMetricsWithBody request with any body + PostMetricsWithBody(ctx context.Context, environmentUUID EnvironmentPathParam, params *PostMetricsParams, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) + + PostMetrics(ctx context.Context, environmentUUID EnvironmentPathParam, params *PostMetricsParams, body PostMetricsJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) + + // AuthenticateProxyKeyWithBody request with any body + AuthenticateProxyKeyWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) + + AuthenticateProxyKey(ctx context.Context, body AuthenticateProxyKeyJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) + + // GetProxyConfig request + GetProxyConfig(ctx context.Context, params *GetProxyConfigParams, reqEditors ...RequestEditorFn) (*http.Response, error) // Stream request Stream(ctx context.Context, params *StreamParams, reqEditors ...RequestEditorFn) (*http.Response, error) @@ -145,8 +157,44 @@ func (c *Client) Authenticate(ctx context.Context, body AuthenticateJSONRequestB return c.Client.Do(req) } -func (c *Client) GetFeatureConfig(ctx context.Context, environmentUUID string, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewGetFeatureConfigRequest(c.Server, environmentUUID) +func (c *Client) GetFeatureConfig(ctx context.Context, environmentUUID string, params *GetFeatureConfigParams, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewGetFeatureConfigRequest(c.Server, environmentUUID, params) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + +func (c *Client) GetFeatureConfigByIdentifier(ctx context.Context, environmentUUID string, identifier string, params *GetFeatureConfigByIdentifierParams, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewGetFeatureConfigByIdentifierRequest(c.Server, environmentUUID, identifier, params) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + +func (c *Client) GetAllSegments(ctx context.Context, environmentUUID string, params *GetAllSegmentsParams, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewGetAllSegmentsRequest(c.Server, environmentUUID, params) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + +func (c *Client) GetSegmentByIdentifier(ctx context.Context, environmentUUID string, identifier string, params *GetSegmentByIdentifierParams, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewGetSegmentByIdentifierRequest(c.Server, environmentUUID, identifier, params) if err != nil { return nil, err } @@ -157,8 +205,8 @@ func (c *Client) GetFeatureConfig(ctx context.Context, environmentUUID string, r return c.Client.Do(req) } -func (c *Client) GetFeatureConfigByIdentifier(ctx context.Context, environmentUUID string, identifier string, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewGetFeatureConfigByIdentifierRequest(c.Server, environmentUUID, identifier) +func (c *Client) GetEvaluations(ctx context.Context, environmentUUID string, target string, params *GetEvaluationsParams, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewGetEvaluationsRequest(c.Server, environmentUUID, target, params) if err != nil { return nil, err } @@ -169,8 +217,8 @@ func (c *Client) GetFeatureConfigByIdentifier(ctx context.Context, environmentUU return c.Client.Do(req) } -func (c *Client) GetAllSegments(ctx context.Context, environmentUUID string, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewGetAllSegmentsRequest(c.Server, environmentUUID) +func (c *Client) GetEvaluationByIdentifier(ctx context.Context, environmentUUID string, target string, feature string, params *GetEvaluationByIdentifierParams, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewGetEvaluationByIdentifierRequest(c.Server, environmentUUID, target, feature, params) if err != nil { return nil, err } @@ -181,8 +229,8 @@ func (c *Client) GetAllSegments(ctx context.Context, environmentUUID string, req return c.Client.Do(req) } -func (c *Client) GetSegmentByIdentifier(ctx context.Context, environmentUUID string, identifier string, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewGetSegmentByIdentifierRequest(c.Server, environmentUUID, identifier) +func (c *Client) PostMetricsWithBody(ctx context.Context, environmentUUID EnvironmentPathParam, params *PostMetricsParams, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewPostMetricsRequestWithBody(c.Server, environmentUUID, params, contentType, body) if err != nil { return nil, err } @@ -193,8 +241,8 @@ func (c *Client) GetSegmentByIdentifier(ctx context.Context, environmentUUID str return c.Client.Do(req) } -func (c *Client) GetEvaluations(ctx context.Context, environmentUUID string, target string, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewGetEvaluationsRequest(c.Server, environmentUUID, target) +func (c *Client) PostMetrics(ctx context.Context, environmentUUID EnvironmentPathParam, params *PostMetricsParams, body PostMetricsJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewPostMetricsRequest(c.Server, environmentUUID, params, body) if err != nil { return nil, err } @@ -205,8 +253,32 @@ func (c *Client) GetEvaluations(ctx context.Context, environmentUUID string, tar return c.Client.Do(req) } -func (c *Client) GetEvaluationByIdentifier(ctx context.Context, environmentUUID string, target string, feature string, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewGetEvaluationByIdentifierRequest(c.Server, environmentUUID, target, feature) +func (c *Client) AuthenticateProxyKeyWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewAuthenticateProxyKeyRequestWithBody(c.Server, contentType, body) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + +func (c *Client) AuthenticateProxyKey(ctx context.Context, body AuthenticateProxyKeyJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewAuthenticateProxyKeyRequest(c.Server, body) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + +func (c *Client) GetProxyConfig(ctx context.Context, params *GetProxyConfigParams, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewGetProxyConfigRequest(c.Server, params) if err != nil { return nil, err } @@ -270,7 +342,7 @@ func NewAuthenticateRequestWithBody(server string, contentType string, body io.R } // NewGetFeatureConfigRequest generates requests for GetFeatureConfig -func NewGetFeatureConfigRequest(server string, environmentUUID string) (*http.Request, error) { +func NewGetFeatureConfigRequest(server string, environmentUUID string, params *GetFeatureConfigParams) (*http.Request, error) { var err error var pathParam0 string @@ -295,6 +367,28 @@ func NewGetFeatureConfigRequest(server string, environmentUUID string) (*http.Re return nil, err } + if params != nil { + queryValues := queryURL.Query() + + if params.Cluster != nil { + + if queryFrag, err := runtime.StyleParamWithLocation("form", true, "cluster", runtime.ParamLocationQuery, *params.Cluster); err != nil { + return nil, err + } else if parsed, err := url.ParseQuery(queryFrag); err != nil { + return nil, err + } else { + for k, v := range parsed { + for _, v2 := range v { + queryValues.Add(k, v2) + } + } + } + + } + + queryURL.RawQuery = queryValues.Encode() + } + req, err := http.NewRequest("GET", queryURL.String(), nil) if err != nil { return nil, err @@ -304,7 +398,7 @@ func NewGetFeatureConfigRequest(server string, environmentUUID string) (*http.Re } // NewGetFeatureConfigByIdentifierRequest generates requests for GetFeatureConfigByIdentifier -func NewGetFeatureConfigByIdentifierRequest(server string, environmentUUID string, identifier string) (*http.Request, error) { +func NewGetFeatureConfigByIdentifierRequest(server string, environmentUUID string, identifier string, params *GetFeatureConfigByIdentifierParams) (*http.Request, error) { var err error var pathParam0 string @@ -336,6 +430,28 @@ func NewGetFeatureConfigByIdentifierRequest(server string, environmentUUID strin return nil, err } + if params != nil { + queryValues := queryURL.Query() + + if params.Cluster != nil { + + if queryFrag, err := runtime.StyleParamWithLocation("form", true, "cluster", runtime.ParamLocationQuery, *params.Cluster); err != nil { + return nil, err + } else if parsed, err := url.ParseQuery(queryFrag); err != nil { + return nil, err + } else { + for k, v := range parsed { + for _, v2 := range v { + queryValues.Add(k, v2) + } + } + } + + } + + queryURL.RawQuery = queryValues.Encode() + } + req, err := http.NewRequest("GET", queryURL.String(), nil) if err != nil { return nil, err @@ -345,7 +461,7 @@ func NewGetFeatureConfigByIdentifierRequest(server string, environmentUUID strin } // NewGetAllSegmentsRequest generates requests for GetAllSegments -func NewGetAllSegmentsRequest(server string, environmentUUID string) (*http.Request, error) { +func NewGetAllSegmentsRequest(server string, environmentUUID string, params *GetAllSegmentsParams) (*http.Request, error) { var err error var pathParam0 string @@ -370,6 +486,28 @@ func NewGetAllSegmentsRequest(server string, environmentUUID string) (*http.Requ return nil, err } + if params != nil { + queryValues := queryURL.Query() + + if params.Cluster != nil { + + if queryFrag, err := runtime.StyleParamWithLocation("form", true, "cluster", runtime.ParamLocationQuery, *params.Cluster); err != nil { + return nil, err + } else if parsed, err := url.ParseQuery(queryFrag); err != nil { + return nil, err + } else { + for k, v := range parsed { + for _, v2 := range v { + queryValues.Add(k, v2) + } + } + } + + } + + queryURL.RawQuery = queryValues.Encode() + } + req, err := http.NewRequest("GET", queryURL.String(), nil) if err != nil { return nil, err @@ -379,7 +517,7 @@ func NewGetAllSegmentsRequest(server string, environmentUUID string) (*http.Requ } // NewGetSegmentByIdentifierRequest generates requests for GetSegmentByIdentifier -func NewGetSegmentByIdentifierRequest(server string, environmentUUID string, identifier string) (*http.Request, error) { +func NewGetSegmentByIdentifierRequest(server string, environmentUUID string, identifier string, params *GetSegmentByIdentifierParams) (*http.Request, error) { var err error var pathParam0 string @@ -411,6 +549,28 @@ func NewGetSegmentByIdentifierRequest(server string, environmentUUID string, ide return nil, err } + if params != nil { + queryValues := queryURL.Query() + + if params.Cluster != nil { + + if queryFrag, err := runtime.StyleParamWithLocation("form", true, "cluster", runtime.ParamLocationQuery, *params.Cluster); err != nil { + return nil, err + } else if parsed, err := url.ParseQuery(queryFrag); err != nil { + return nil, err + } else { + for k, v := range parsed { + for _, v2 := range v { + queryValues.Add(k, v2) + } + } + } + + } + + queryURL.RawQuery = queryValues.Encode() + } + req, err := http.NewRequest("GET", queryURL.String(), nil) if err != nil { return nil, err @@ -420,7 +580,7 @@ func NewGetSegmentByIdentifierRequest(server string, environmentUUID string, ide } // NewGetEvaluationsRequest generates requests for GetEvaluations -func NewGetEvaluationsRequest(server string, environmentUUID string, target string) (*http.Request, error) { +func NewGetEvaluationsRequest(server string, environmentUUID string, target string, params *GetEvaluationsParams) (*http.Request, error) { var err error var pathParam0 string @@ -452,6 +612,28 @@ func NewGetEvaluationsRequest(server string, environmentUUID string, target stri return nil, err } + if params != nil { + queryValues := queryURL.Query() + + if params.Cluster != nil { + + if queryFrag, err := runtime.StyleParamWithLocation("form", true, "cluster", runtime.ParamLocationQuery, *params.Cluster); err != nil { + return nil, err + } else if parsed, err := url.ParseQuery(queryFrag); err != nil { + return nil, err + } else { + for k, v := range parsed { + for _, v2 := range v { + queryValues.Add(k, v2) + } + } + } + + } + + queryURL.RawQuery = queryValues.Encode() + } + req, err := http.NewRequest("GET", queryURL.String(), nil) if err != nil { return nil, err @@ -461,7 +643,7 @@ func NewGetEvaluationsRequest(server string, environmentUUID string, target stri } // NewGetEvaluationByIdentifierRequest generates requests for GetEvaluationByIdentifier -func NewGetEvaluationByIdentifierRequest(server string, environmentUUID string, target string, feature string) (*http.Request, error) { +func NewGetEvaluationByIdentifierRequest(server string, environmentUUID string, target string, feature string, params *GetEvaluationByIdentifierParams) (*http.Request, error) { var err error var pathParam0 string @@ -500,6 +682,28 @@ func NewGetEvaluationByIdentifierRequest(server string, environmentUUID string, return nil, err } + if params != nil { + queryValues := queryURL.Query() + + if params.Cluster != nil { + + if queryFrag, err := runtime.StyleParamWithLocation("form", true, "cluster", runtime.ParamLocationQuery, *params.Cluster); err != nil { + return nil, err + } else if parsed, err := url.ParseQuery(queryFrag); err != nil { + return nil, err + } else { + for k, v := range parsed { + for _, v2 := range v { + queryValues.Add(k, v2) + } + } + } + + } + + queryURL.RawQuery = queryValues.Encode() + } + req, err := http.NewRequest("GET", queryURL.String(), nil) if err != nil { return nil, err @@ -508,16 +712,34 @@ func NewGetEvaluationByIdentifierRequest(server string, environmentUUID string, return req, nil } -// NewStreamRequest generates requests for Stream -func NewStreamRequest(server string, params *StreamParams) (*http.Request, error) { +// NewPostMetricsRequest calls the generic PostMetrics builder with application/json body +func NewPostMetricsRequest(server string, environmentUUID EnvironmentPathParam, params *PostMetricsParams, body PostMetricsJSONRequestBody) (*http.Request, error) { + var bodyReader io.Reader + buf, err := json.Marshal(body) + if err != nil { + return nil, err + } + bodyReader = bytes.NewReader(buf) + return NewPostMetricsRequestWithBody(server, environmentUUID, params, "application/json", bodyReader) +} + +// NewPostMetricsRequestWithBody generates requests for PostMetrics with any type of body +func NewPostMetricsRequestWithBody(server string, environmentUUID EnvironmentPathParam, params *PostMetricsParams, contentType string, body io.Reader) (*http.Request, error) { var err error + var pathParam0 string + + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "environmentUUID", runtime.ParamLocationPath, environmentUUID) + if err != nil { + return nil, err + } + serverURL, err := url.Parse(server) if err != nil { return nil, err } - operationPath := fmt.Sprintf("/stream") + operationPath := fmt.Sprintf("/metrics/%s", pathParam0) if operationPath[0] == '/' { operationPath = "." + operationPath } @@ -527,19 +749,245 @@ func NewStreamRequest(server string, params *StreamParams) (*http.Request, error return nil, err } + if params != nil { + queryValues := queryURL.Query() + + if params.Cluster != nil { + + if queryFrag, err := runtime.StyleParamWithLocation("form", true, "cluster", runtime.ParamLocationQuery, *params.Cluster); err != nil { + return nil, err + } else if parsed, err := url.ParseQuery(queryFrag); err != nil { + return nil, err + } else { + for k, v := range parsed { + for _, v2 := range v { + queryValues.Add(k, v2) + } + } + } + + } + + queryURL.RawQuery = queryValues.Encode() + } + + req, err := http.NewRequest("POST", queryURL.String(), body) + if err != nil { + return nil, err + } + + req.Header.Add("Content-Type", contentType) + + return req, nil +} + +// NewAuthenticateProxyKeyRequest calls the generic AuthenticateProxyKey builder with application/json body +func NewAuthenticateProxyKeyRequest(server string, body AuthenticateProxyKeyJSONRequestBody) (*http.Request, error) { + var bodyReader io.Reader + buf, err := json.Marshal(body) + if err != nil { + return nil, err + } + bodyReader = bytes.NewReader(buf) + return NewAuthenticateProxyKeyRequestWithBody(server, "application/json", bodyReader) +} + +// NewAuthenticateProxyKeyRequestWithBody generates requests for AuthenticateProxyKey with any type of body +func NewAuthenticateProxyKeyRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error) { + var err error + + serverURL, err := url.Parse(server) + if err != nil { + return nil, err + } + + operationPath := fmt.Sprintf("/proxy/auth") + if operationPath[0] == '/' { + operationPath = "." + operationPath + } + + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } + + req, err := http.NewRequest("POST", queryURL.String(), body) + if err != nil { + return nil, err + } + + req.Header.Add("Content-Type", contentType) + + return req, nil +} + +// NewGetProxyConfigRequest generates requests for GetProxyConfig +func NewGetProxyConfigRequest(server string, params *GetProxyConfigParams) (*http.Request, error) { + var err error + + serverURL, err := url.Parse(server) + if err != nil { + return nil, err + } + + operationPath := fmt.Sprintf("/proxy/config") + if operationPath[0] == '/' { + operationPath = "." + operationPath + } + + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } + + if params != nil { + queryValues := queryURL.Query() + + if params.PageNumber != nil { + + if queryFrag, err := runtime.StyleParamWithLocation("form", true, "pageNumber", runtime.ParamLocationQuery, *params.PageNumber); err != nil { + return nil, err + } else if parsed, err := url.ParseQuery(queryFrag); err != nil { + return nil, err + } else { + for k, v := range parsed { + for _, v2 := range v { + queryValues.Add(k, v2) + } + } + } + + } + + if params.PageSize != nil { + + if queryFrag, err := runtime.StyleParamWithLocation("form", true, "pageSize", runtime.ParamLocationQuery, *params.PageSize); err != nil { + return nil, err + } else if parsed, err := url.ParseQuery(queryFrag); err != nil { + return nil, err + } else { + for k, v := range parsed { + for _, v2 := range v { + queryValues.Add(k, v2) + } + } + } + + } + + if params.Cluster != nil { + + if queryFrag, err := runtime.StyleParamWithLocation("form", true, "cluster", runtime.ParamLocationQuery, *params.Cluster); err != nil { + return nil, err + } else if parsed, err := url.ParseQuery(queryFrag); err != nil { + return nil, err + } else { + for k, v := range parsed { + for _, v2 := range v { + queryValues.Add(k, v2) + } + } + } + + } + + if params.Environment != nil { + + if queryFrag, err := runtime.StyleParamWithLocation("form", true, "environment", runtime.ParamLocationQuery, *params.Environment); err != nil { + return nil, err + } else if parsed, err := url.ParseQuery(queryFrag); err != nil { + return nil, err + } else { + for k, v := range parsed { + for _, v2 := range v { + queryValues.Add(k, v2) + } + } + } + + } + + if queryFrag, err := runtime.StyleParamWithLocation("form", true, "key", runtime.ParamLocationQuery, params.Key); err != nil { + return nil, err + } else if parsed, err := url.ParseQuery(queryFrag); err != nil { + return nil, err + } else { + for k, v := range parsed { + for _, v2 := range v { + queryValues.Add(k, v2) + } + } + } + + queryURL.RawQuery = queryValues.Encode() + } + req, err := http.NewRequest("GET", queryURL.String(), nil) if err != nil { return nil, err } - var headerParam0 string + return req, nil +} + +// NewStreamRequest generates requests for Stream +func NewStreamRequest(server string, params *StreamParams) (*http.Request, error) { + var err error + + serverURL, err := url.Parse(server) + if err != nil { + return nil, err + } + + operationPath := fmt.Sprintf("/stream") + if operationPath[0] == '/' { + operationPath = "." + operationPath + } + + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } + + if params != nil { + queryValues := queryURL.Query() + + if params.Cluster != nil { + + if queryFrag, err := runtime.StyleParamWithLocation("form", true, "cluster", runtime.ParamLocationQuery, *params.Cluster); err != nil { + return nil, err + } else if parsed, err := url.ParseQuery(queryFrag); err != nil { + return nil, err + } else { + for k, v := range parsed { + for _, v2 := range v { + queryValues.Add(k, v2) + } + } + } + + } + + queryURL.RawQuery = queryValues.Encode() + } - headerParam0, err = runtime.StyleParamWithLocation("simple", false, "API-Key", runtime.ParamLocationHeader, params.APIKey) + req, err := http.NewRequest("GET", queryURL.String(), nil) if err != nil { return nil, err } - req.Header.Set("API-Key", headerParam0) + if params != nil { + + var headerParam0 string + + headerParam0, err = runtime.StyleParamWithLocation("simple", false, "API-Key", runtime.ParamLocationHeader, params.APIKey) + if err != nil { + return nil, err + } + + req.Header.Set("API-Key", headerParam0) + + } return req, nil } @@ -587,30 +1035,43 @@ func WithBaseURL(baseURL string) ClientOption { // ClientWithResponsesInterface is the interface specification for the client with responses above. type ClientWithResponsesInterface interface { - // Authenticate request with any body + // AuthenticateWithBodyWithResponse request with any body AuthenticateWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*AuthenticateResponse, error) AuthenticateWithResponse(ctx context.Context, body AuthenticateJSONRequestBody, reqEditors ...RequestEditorFn) (*AuthenticateResponse, error) - // GetFeatureConfig request - GetFeatureConfigWithResponse(ctx context.Context, environmentUUID string, reqEditors ...RequestEditorFn) (*GetFeatureConfigResponse, error) + // GetFeatureConfigWithResponse request + GetFeatureConfigWithResponse(ctx context.Context, environmentUUID string, params *GetFeatureConfigParams, reqEditors ...RequestEditorFn) (*GetFeatureConfigResponse, error) - // GetFeatureConfigByIdentifier request - GetFeatureConfigByIdentifierWithResponse(ctx context.Context, environmentUUID string, identifier string, reqEditors ...RequestEditorFn) (*GetFeatureConfigByIdentifierResponse, error) + // GetFeatureConfigByIdentifierWithResponse request + GetFeatureConfigByIdentifierWithResponse(ctx context.Context, environmentUUID string, identifier string, params *GetFeatureConfigByIdentifierParams, reqEditors ...RequestEditorFn) (*GetFeatureConfigByIdentifierResponse, error) - // GetAllSegments request - GetAllSegmentsWithResponse(ctx context.Context, environmentUUID string, reqEditors ...RequestEditorFn) (*GetAllSegmentsResponse, error) + // GetAllSegmentsWithResponse request + GetAllSegmentsWithResponse(ctx context.Context, environmentUUID string, params *GetAllSegmentsParams, reqEditors ...RequestEditorFn) (*GetAllSegmentsResponse, error) - // GetSegmentByIdentifier request - GetSegmentByIdentifierWithResponse(ctx context.Context, environmentUUID string, identifier string, reqEditors ...RequestEditorFn) (*GetSegmentByIdentifierResponse, error) + // GetSegmentByIdentifierWithResponse request + GetSegmentByIdentifierWithResponse(ctx context.Context, environmentUUID string, identifier string, params *GetSegmentByIdentifierParams, reqEditors ...RequestEditorFn) (*GetSegmentByIdentifierResponse, error) - // GetEvaluations request - GetEvaluationsWithResponse(ctx context.Context, environmentUUID string, target string, reqEditors ...RequestEditorFn) (*GetEvaluationsResponse, error) + // GetEvaluationsWithResponse request + GetEvaluationsWithResponse(ctx context.Context, environmentUUID string, target string, params *GetEvaluationsParams, reqEditors ...RequestEditorFn) (*GetEvaluationsResponse, error) - // GetEvaluationByIdentifier request - GetEvaluationByIdentifierWithResponse(ctx context.Context, environmentUUID string, target string, feature string, reqEditors ...RequestEditorFn) (*GetEvaluationByIdentifierResponse, error) + // GetEvaluationByIdentifierWithResponse request + GetEvaluationByIdentifierWithResponse(ctx context.Context, environmentUUID string, target string, feature string, params *GetEvaluationByIdentifierParams, reqEditors ...RequestEditorFn) (*GetEvaluationByIdentifierResponse, error) - // Stream request + // PostMetricsWithBodyWithResponse request with any body + PostMetricsWithBodyWithResponse(ctx context.Context, environmentUUID EnvironmentPathParam, params *PostMetricsParams, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PostMetricsResponse, error) + + PostMetricsWithResponse(ctx context.Context, environmentUUID EnvironmentPathParam, params *PostMetricsParams, body PostMetricsJSONRequestBody, reqEditors ...RequestEditorFn) (*PostMetricsResponse, error) + + // AuthenticateProxyKeyWithBodyWithResponse request with any body + AuthenticateProxyKeyWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*AuthenticateProxyKeyResponse, error) + + AuthenticateProxyKeyWithResponse(ctx context.Context, body AuthenticateProxyKeyJSONRequestBody, reqEditors ...RequestEditorFn) (*AuthenticateProxyKeyResponse, error) + + // GetProxyConfigWithResponse request + GetProxyConfigWithResponse(ctx context.Context, params *GetProxyConfigParams, reqEditors ...RequestEditorFn) (*GetProxyConfigResponse, error) + + // StreamWithResponse request StreamWithResponse(ctx context.Context, params *StreamParams, reqEditors ...RequestEditorFn) (*StreamResponse, error) } @@ -618,10 +1079,10 @@ type AuthenticateResponse struct { Body []byte HTTPResponse *http.Response JSON200 *AuthenticationResponse - JSON401 *Error - JSON403 *Error - JSON404 *Error - JSON500 *Error + JSON401 *Unauthenticated + JSON403 *Unauthorized + JSON404 *NotFound + JSON500 *InternalServerError } // Status returns HTTPResponse.Status @@ -688,10 +1149,10 @@ type GetAllSegmentsResponse struct { Body []byte HTTPResponse *http.Response JSON200 *[]Segment - JSON401 *Error - JSON403 *Error - JSON404 *Error - JSON500 *Error + JSON401 *Unauthenticated + JSON403 *Unauthorized + JSON404 *NotFound + JSON500 *InternalServerError } // Status returns HTTPResponse.Status @@ -714,10 +1175,10 @@ type GetSegmentByIdentifierResponse struct { Body []byte HTTPResponse *http.Response JSON200 *Segment - JSON401 *Error - JSON403 *Error - JSON404 *Error - JSON500 *Error + JSON401 *Unauthenticated + JSON403 *Unauthorized + JSON404 *NotFound + JSON500 *InternalServerError } // Status returns HTTPResponse.Status @@ -785,6 +1246,83 @@ func (r GetEvaluationByIdentifierResponse) StatusCode() int { return 0 } +type PostMetricsResponse struct { + Body []byte + HTTPResponse *http.Response + JSON401 *Unauthenticated + JSON403 *Unauthorized + JSON500 *InternalServerError +} + +// Status returns HTTPResponse.Status +func (r PostMetricsResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status + } + return http.StatusText(0) +} + +// StatusCode returns HTTPResponse.StatusCode +func (r PostMetricsResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode + } + return 0 +} + +type AuthenticateProxyKeyResponse struct { + Body []byte + HTTPResponse *http.Response + JSON200 *AuthenticationResponse + JSON401 *Unauthenticated + JSON403 *Unauthorized + JSON404 *NotFound + JSON500 *InternalServerError +} + +// Status returns HTTPResponse.Status +func (r AuthenticateProxyKeyResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status + } + return http.StatusText(0) +} + +// StatusCode returns HTTPResponse.StatusCode +func (r AuthenticateProxyKeyResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode + } + return 0 +} + +type GetProxyConfigResponse struct { + Body []byte + HTTPResponse *http.Response + JSON200 *ProxyConfigResponse + JSON400 *BadRequest + JSON401 *Unauthenticated + JSON403 *Unauthorized + JSON404 *NotFound + JSON500 *InternalServerError +} + +// Status returns HTTPResponse.Status +func (r GetProxyConfigResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status + } + return http.StatusText(0) +} + +// StatusCode returns HTTPResponse.StatusCode +func (r GetProxyConfigResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode + } + return 0 +} + type StreamResponse struct { Body []byte HTTPResponse *http.Response @@ -824,8 +1362,8 @@ func (c *ClientWithResponses) AuthenticateWithResponse(ctx context.Context, body } // GetFeatureConfigWithResponse request returning *GetFeatureConfigResponse -func (c *ClientWithResponses) GetFeatureConfigWithResponse(ctx context.Context, environmentUUID string, reqEditors ...RequestEditorFn) (*GetFeatureConfigResponse, error) { - rsp, err := c.GetFeatureConfig(ctx, environmentUUID, reqEditors...) +func (c *ClientWithResponses) GetFeatureConfigWithResponse(ctx context.Context, environmentUUID string, params *GetFeatureConfigParams, reqEditors ...RequestEditorFn) (*GetFeatureConfigResponse, error) { + rsp, err := c.GetFeatureConfig(ctx, environmentUUID, params, reqEditors...) if err != nil { return nil, err } @@ -833,8 +1371,8 @@ func (c *ClientWithResponses) GetFeatureConfigWithResponse(ctx context.Context, } // GetFeatureConfigByIdentifierWithResponse request returning *GetFeatureConfigByIdentifierResponse -func (c *ClientWithResponses) GetFeatureConfigByIdentifierWithResponse(ctx context.Context, environmentUUID string, identifier string, reqEditors ...RequestEditorFn) (*GetFeatureConfigByIdentifierResponse, error) { - rsp, err := c.GetFeatureConfigByIdentifier(ctx, environmentUUID, identifier, reqEditors...) +func (c *ClientWithResponses) GetFeatureConfigByIdentifierWithResponse(ctx context.Context, environmentUUID string, identifier string, params *GetFeatureConfigByIdentifierParams, reqEditors ...RequestEditorFn) (*GetFeatureConfigByIdentifierResponse, error) { + rsp, err := c.GetFeatureConfigByIdentifier(ctx, environmentUUID, identifier, params, reqEditors...) if err != nil { return nil, err } @@ -842,8 +1380,8 @@ func (c *ClientWithResponses) GetFeatureConfigByIdentifierWithResponse(ctx conte } // GetAllSegmentsWithResponse request returning *GetAllSegmentsResponse -func (c *ClientWithResponses) GetAllSegmentsWithResponse(ctx context.Context, environmentUUID string, reqEditors ...RequestEditorFn) (*GetAllSegmentsResponse, error) { - rsp, err := c.GetAllSegments(ctx, environmentUUID, reqEditors...) +func (c *ClientWithResponses) GetAllSegmentsWithResponse(ctx context.Context, environmentUUID string, params *GetAllSegmentsParams, reqEditors ...RequestEditorFn) (*GetAllSegmentsResponse, error) { + rsp, err := c.GetAllSegments(ctx, environmentUUID, params, reqEditors...) if err != nil { return nil, err } @@ -851,8 +1389,8 @@ func (c *ClientWithResponses) GetAllSegmentsWithResponse(ctx context.Context, en } // GetSegmentByIdentifierWithResponse request returning *GetSegmentByIdentifierResponse -func (c *ClientWithResponses) GetSegmentByIdentifierWithResponse(ctx context.Context, environmentUUID string, identifier string, reqEditors ...RequestEditorFn) (*GetSegmentByIdentifierResponse, error) { - rsp, err := c.GetSegmentByIdentifier(ctx, environmentUUID, identifier, reqEditors...) +func (c *ClientWithResponses) GetSegmentByIdentifierWithResponse(ctx context.Context, environmentUUID string, identifier string, params *GetSegmentByIdentifierParams, reqEditors ...RequestEditorFn) (*GetSegmentByIdentifierResponse, error) { + rsp, err := c.GetSegmentByIdentifier(ctx, environmentUUID, identifier, params, reqEditors...) if err != nil { return nil, err } @@ -860,8 +1398,8 @@ func (c *ClientWithResponses) GetSegmentByIdentifierWithResponse(ctx context.Con } // GetEvaluationsWithResponse request returning *GetEvaluationsResponse -func (c *ClientWithResponses) GetEvaluationsWithResponse(ctx context.Context, environmentUUID string, target string, reqEditors ...RequestEditorFn) (*GetEvaluationsResponse, error) { - rsp, err := c.GetEvaluations(ctx, environmentUUID, target, reqEditors...) +func (c *ClientWithResponses) GetEvaluationsWithResponse(ctx context.Context, environmentUUID string, target string, params *GetEvaluationsParams, reqEditors ...RequestEditorFn) (*GetEvaluationsResponse, error) { + rsp, err := c.GetEvaluations(ctx, environmentUUID, target, params, reqEditors...) if err != nil { return nil, err } @@ -869,14 +1407,57 @@ func (c *ClientWithResponses) GetEvaluationsWithResponse(ctx context.Context, en } // GetEvaluationByIdentifierWithResponse request returning *GetEvaluationByIdentifierResponse -func (c *ClientWithResponses) GetEvaluationByIdentifierWithResponse(ctx context.Context, environmentUUID string, target string, feature string, reqEditors ...RequestEditorFn) (*GetEvaluationByIdentifierResponse, error) { - rsp, err := c.GetEvaluationByIdentifier(ctx, environmentUUID, target, feature, reqEditors...) +func (c *ClientWithResponses) GetEvaluationByIdentifierWithResponse(ctx context.Context, environmentUUID string, target string, feature string, params *GetEvaluationByIdentifierParams, reqEditors ...RequestEditorFn) (*GetEvaluationByIdentifierResponse, error) { + rsp, err := c.GetEvaluationByIdentifier(ctx, environmentUUID, target, feature, params, reqEditors...) if err != nil { return nil, err } return ParseGetEvaluationByIdentifierResponse(rsp) } +// PostMetricsWithBodyWithResponse request with arbitrary body returning *PostMetricsResponse +func (c *ClientWithResponses) PostMetricsWithBodyWithResponse(ctx context.Context, environmentUUID EnvironmentPathParam, params *PostMetricsParams, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PostMetricsResponse, error) { + rsp, err := c.PostMetricsWithBody(ctx, environmentUUID, params, contentType, body, reqEditors...) + if err != nil { + return nil, err + } + return ParsePostMetricsResponse(rsp) +} + +func (c *ClientWithResponses) PostMetricsWithResponse(ctx context.Context, environmentUUID EnvironmentPathParam, params *PostMetricsParams, body PostMetricsJSONRequestBody, reqEditors ...RequestEditorFn) (*PostMetricsResponse, error) { + rsp, err := c.PostMetrics(ctx, environmentUUID, params, body, reqEditors...) + if err != nil { + return nil, err + } + return ParsePostMetricsResponse(rsp) +} + +// AuthenticateProxyKeyWithBodyWithResponse request with arbitrary body returning *AuthenticateProxyKeyResponse +func (c *ClientWithResponses) AuthenticateProxyKeyWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*AuthenticateProxyKeyResponse, error) { + rsp, err := c.AuthenticateProxyKeyWithBody(ctx, contentType, body, reqEditors...) + if err != nil { + return nil, err + } + return ParseAuthenticateProxyKeyResponse(rsp) +} + +func (c *ClientWithResponses) AuthenticateProxyKeyWithResponse(ctx context.Context, body AuthenticateProxyKeyJSONRequestBody, reqEditors ...RequestEditorFn) (*AuthenticateProxyKeyResponse, error) { + rsp, err := c.AuthenticateProxyKey(ctx, body, reqEditors...) + if err != nil { + return nil, err + } + return ParseAuthenticateProxyKeyResponse(rsp) +} + +// GetProxyConfigWithResponse request returning *GetProxyConfigResponse +func (c *ClientWithResponses) GetProxyConfigWithResponse(ctx context.Context, params *GetProxyConfigParams, reqEditors ...RequestEditorFn) (*GetProxyConfigResponse, error) { + rsp, err := c.GetProxyConfig(ctx, params, reqEditors...) + if err != nil { + return nil, err + } + return ParseGetProxyConfigResponse(rsp) +} + // StreamWithResponse request returning *StreamResponse func (c *ClientWithResponses) StreamWithResponse(ctx context.Context, params *StreamParams, reqEditors ...RequestEditorFn) (*StreamResponse, error) { rsp, err := c.Stream(ctx, params, reqEditors...) @@ -888,7 +1469,7 @@ func (c *ClientWithResponses) StreamWithResponse(ctx context.Context, params *St // ParseAuthenticateResponse parses an HTTP response from a AuthenticateWithResponse call func ParseAuthenticateResponse(rsp *http.Response) (*AuthenticateResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) + bodyBytes, err := io.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err @@ -908,28 +1489,28 @@ func ParseAuthenticateResponse(rsp *http.Response) (*AuthenticateResponse, error response.JSON200 = &dest case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 401: - var dest Error + var dest Unauthenticated if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.JSON401 = &dest case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 403: - var dest Error + var dest Unauthorized if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.JSON403 = &dest case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404: - var dest Error + var dest NotFound if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.JSON404 = &dest case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 500: - var dest Error + var dest InternalServerError if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } @@ -942,7 +1523,7 @@ func ParseAuthenticateResponse(rsp *http.Response) (*AuthenticateResponse, error // ParseGetFeatureConfigResponse parses an HTTP response from a GetFeatureConfigWithResponse call func ParseGetFeatureConfigResponse(rsp *http.Response) (*GetFeatureConfigResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) + bodyBytes, err := io.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err @@ -968,7 +1549,7 @@ func ParseGetFeatureConfigResponse(rsp *http.Response) (*GetFeatureConfigRespons // ParseGetFeatureConfigByIdentifierResponse parses an HTTP response from a GetFeatureConfigByIdentifierWithResponse call func ParseGetFeatureConfigByIdentifierResponse(rsp *http.Response) (*GetFeatureConfigByIdentifierResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) + bodyBytes, err := io.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err @@ -994,7 +1575,7 @@ func ParseGetFeatureConfigByIdentifierResponse(rsp *http.Response) (*GetFeatureC // ParseGetAllSegmentsResponse parses an HTTP response from a GetAllSegmentsWithResponse call func ParseGetAllSegmentsResponse(rsp *http.Response) (*GetAllSegmentsResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) + bodyBytes, err := io.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err @@ -1014,28 +1595,28 @@ func ParseGetAllSegmentsResponse(rsp *http.Response) (*GetAllSegmentsResponse, e response.JSON200 = &dest case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 401: - var dest Error + var dest Unauthenticated if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.JSON401 = &dest case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 403: - var dest Error + var dest Unauthorized if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.JSON403 = &dest case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404: - var dest Error + var dest NotFound if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.JSON404 = &dest case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 500: - var dest Error + var dest InternalServerError if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } @@ -1048,7 +1629,7 @@ func ParseGetAllSegmentsResponse(rsp *http.Response) (*GetAllSegmentsResponse, e // ParseGetSegmentByIdentifierResponse parses an HTTP response from a GetSegmentByIdentifierWithResponse call func ParseGetSegmentByIdentifierResponse(rsp *http.Response) (*GetSegmentByIdentifierResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) + bodyBytes, err := io.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err @@ -1068,28 +1649,28 @@ func ParseGetSegmentByIdentifierResponse(rsp *http.Response) (*GetSegmentByIdent response.JSON200 = &dest case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 401: - var dest Error + var dest Unauthenticated if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.JSON401 = &dest case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 403: - var dest Error + var dest Unauthorized if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.JSON403 = &dest case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404: - var dest Error + var dest NotFound if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.JSON404 = &dest case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 500: - var dest Error + var dest InternalServerError if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } @@ -1102,7 +1683,7 @@ func ParseGetSegmentByIdentifierResponse(rsp *http.Response) (*GetSegmentByIdent // ParseGetEvaluationsResponse parses an HTTP response from a GetEvaluationsWithResponse call func ParseGetEvaluationsResponse(rsp *http.Response) (*GetEvaluationsResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) + bodyBytes, err := io.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err @@ -1133,7 +1714,7 @@ func ParseGetEvaluationsResponse(rsp *http.Response) (*GetEvaluationsResponse, e // ParseGetEvaluationByIdentifierResponse parses an HTTP response from a GetEvaluationByIdentifierWithResponse call func ParseGetEvaluationByIdentifierResponse(rsp *http.Response) (*GetEvaluationByIdentifierResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) + bodyBytes, err := io.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err @@ -1157,9 +1738,164 @@ func ParseGetEvaluationByIdentifierResponse(rsp *http.Response) (*GetEvaluationB return response, nil } +// ParsePostMetricsResponse parses an HTTP response from a PostMetricsWithResponse call +func ParsePostMetricsResponse(rsp *http.Response) (*PostMetricsResponse, error) { + bodyBytes, err := io.ReadAll(rsp.Body) + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err + } + + response := &PostMetricsResponse{ + Body: bodyBytes, + HTTPResponse: rsp, + } + + switch { + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 401: + var dest Unauthenticated + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON401 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 403: + var dest Unauthorized + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON403 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 500: + var dest InternalServerError + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON500 = &dest + + } + + return response, nil +} + +// ParseAuthenticateProxyKeyResponse parses an HTTP response from a AuthenticateProxyKeyWithResponse call +func ParseAuthenticateProxyKeyResponse(rsp *http.Response) (*AuthenticateProxyKeyResponse, error) { + bodyBytes, err := io.ReadAll(rsp.Body) + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err + } + + response := &AuthenticateProxyKeyResponse{ + Body: bodyBytes, + HTTPResponse: rsp, + } + + switch { + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: + var dest AuthenticationResponse + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON200 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 401: + var dest Unauthenticated + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON401 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 403: + var dest Unauthorized + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON403 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404: + var dest NotFound + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON404 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 500: + var dest InternalServerError + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON500 = &dest + + } + + return response, nil +} + +// ParseGetProxyConfigResponse parses an HTTP response from a GetProxyConfigWithResponse call +func ParseGetProxyConfigResponse(rsp *http.Response) (*GetProxyConfigResponse, error) { + bodyBytes, err := io.ReadAll(rsp.Body) + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err + } + + response := &GetProxyConfigResponse{ + Body: bodyBytes, + HTTPResponse: rsp, + } + + switch { + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: + var dest ProxyConfigResponse + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON200 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400: + var dest BadRequest + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON400 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 401: + var dest Unauthenticated + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON401 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 403: + var dest Unauthorized + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON403 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404: + var dest NotFound + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON404 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 500: + var dest InternalServerError + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON500 = &dest + + } + + return response, nil +} + // ParseStreamResponse parses an HTTP response from a StreamWithResponse call func ParseStreamResponse(rsp *http.Response) (*StreamResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) + bodyBytes, err := io.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err @@ -1176,41 +1912,75 @@ func ParseStreamResponse(rsp *http.Response) (*StreamResponse, error) { // Base64 encoded, gzipped, json marshaled Swagger object var swaggerSpec = []string{ - "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", + "283/BQAA///yttJsTlgAAA==", } // GetSwagger returns the content of the embedded swagger specification file @@ -1218,16 +1988,16 @@ var swaggerSpec = []string{ func decodeSpec() ([]byte, error) { zipped, err := base64.StdEncoding.DecodeString(strings.Join(swaggerSpec, "")) if err != nil { - return nil, fmt.Errorf("error base64 decoding spec: %s", err) + return nil, fmt.Errorf("error base64 decoding spec: %w", err) } zr, err := gzip.NewReader(bytes.NewReader(zipped)) if err != nil { - return nil, fmt.Errorf("error decompressing spec: %s", err) + return nil, fmt.Errorf("error decompressing spec: %w", err) } var buf bytes.Buffer _, err = buf.ReadFrom(zr) if err != nil { - return nil, fmt.Errorf("error decompressing spec: %s", err) + return nil, fmt.Errorf("error decompressing spec: %w", err) } return buf.Bytes(), nil @@ -1245,7 +2015,7 @@ func decodeSpecCached() func() ([]byte, error) { // Constructs a synthetic filesystem for resolving external references when loading openapi specifications. func PathToRawSpec(pathToFile string) map[string]func() ([]byte, error) { - var res = make(map[string]func() ([]byte, error)) + res := make(map[string]func() ([]byte, error)) if len(pathToFile) > 0 { res[pathToFile] = rawSpec } @@ -1259,12 +2029,12 @@ func PathToRawSpec(pathToFile string) map[string]func() ([]byte, error) { // Externally referenced files must be embedded in the corresponding golang packages. // Urls can be supported but this task was out of the scope. func GetSwagger() (swagger *openapi3.T, err error) { - var resolvePath = PathToRawSpec("") + resolvePath := PathToRawSpec("") loader := openapi3.NewLoader() loader.IsExternalRefsAllowed = true loader.ReadFromURIFunc = func(loader *openapi3.Loader, url *url.URL) ([]byte, error) { - var pathToFile = url.String() + pathToFile := url.String() pathToFile = path.Clean(pathToFile) getSpec, ok := resolvePath[pathToFile] if !ok { diff --git a/rest/types.gen.go b/rest/types.gen.go index a6a1b785..ac872d8c 100644 --- a/rest/types.gen.go +++ b/rest/types.gen.go @@ -1,9 +1,10 @@ // Package rest provides primitives to interact with the openapi HTTP API. // -// Code generated by github.com/deepmap/oapi-codegen version v1.11.0 DO NOT EDIT. +// Code generated by github.com/deepmap/oapi-codegen/v2 version v2.1.0 DO NOT EDIT. package rest const ( + ApiKeyAuthScopes = "ApiKeyAuth.Scopes" BearerAuthScopes = "BearerAuth.Scopes" ) @@ -21,6 +22,11 @@ const ( FeatureStateOn FeatureState = "on" ) +// Defines values for MetricsDataMetricsType. +const ( + MetricsDataMetricsTypeFFMETRICS MetricsDataMetricsType = "FFMETRICS" +) + // AuthenticationRequest defines model for AuthenticationRequest. type AuthenticationRequest struct { ApiKey string `json:"apiKey"` @@ -37,24 +43,42 @@ type AuthenticationResponse struct { AuthToken string `json:"authToken"` } -// Clause defines model for Clause. +// Clause A clause describes what conditions are used to evaluate a flag type Clause struct { - Attribute string `json:"attribute"` - Id string `json:"id"` - Negate bool `json:"negate"` - Op string `json:"op"` - Values []string `json:"values"` + // Attribute The attribute to use in the clause. This can be any target attribute + Attribute string `json:"attribute"` + + // Id The unique ID for the clause + Id *string `json:"id,omitempty"` + + // Negate Is the operation negated? + Negate bool `json:"negate"` + + // Op The type of operation such as equals, starts_with, contains + Op string `json:"op"` + + // Values The values that are compared against the operator + Values []string `json:"values"` } -// Distribution defines model for Distribution. +// Distribution Describes a distribution rule type Distribution struct { - BucketBy string `json:"bucketBy"` + // BucketBy The attribute to use when distributing targets across buckets + BucketBy string `json:"bucketBy"` + + // Variations A list of variations and the weight that should be given to each Variations []WeightedVariation `json:"variations"` } // Error defines model for Error. type Error struct { - Code string `json:"code"` + // Code The http error code + Code string `json:"code"` + + // Details Additional details about the error + Details *map[string]interface{} `json:"details,omitempty"` + + // Message The reason the request failed Message string `json:"message"` } @@ -71,141 +95,365 @@ type Evaluations []Evaluation // FeatureConfig defines model for FeatureConfig. type FeatureConfig struct { - DefaultServe Serve `json:"defaultServe"` - Environment string `json:"environment"` - Feature string `json:"feature"` - Kind FeatureConfigKind `json:"kind"` - OffVariation string `json:"offVariation"` - Prerequisites *[]Prerequisite `json:"prerequisites,omitempty"` - Project string `json:"project"` - Rules *[]ServingRule `json:"rules,omitempty"` - State FeatureState `json:"state"` - VariationToTargetMap *[]VariationMap `json:"variationToTargetMap,omitempty"` - Variations []Variation `json:"variations"` - Version *int64 `json:"version,omitempty"` + // DefaultServe Describe the distribution rule and the variation that should be served to the target + DefaultServe Serve `json:"defaultServe"` + Environment string `json:"environment"` + Feature string `json:"feature"` + Kind FeatureConfigKind `json:"kind"` + OffVariation string `json:"offVariation"` + Prerequisites *[]Prerequisite `json:"prerequisites,omitempty"` + Project string `json:"project"` + Rules *[]ServingRule `json:"rules,omitempty"` + + // State The state of a flag either off or on + State FeatureState `json:"state"` + VariationToTargetMap *[]VariationMap `json:"variationToTargetMap,omitempty"` + Variations []Variation `json:"variations"` + Version *int64 `json:"version,omitempty"` } // FeatureConfigKind defines model for FeatureConfig.Kind. type FeatureConfigKind string -// FeatureState defines model for FeatureState. +// FeatureState The state of a flag either off or on type FeatureState string +// GroupServingRule The rule used to determine what variation to serve to a target +type GroupServingRule struct { + // Clauses A list of clauses to use in the rule + Clauses []Clause `json:"clauses"` + + // Priority The rules priority relative to other rules. The rules are evaluated in order with 1 being the highest + Priority int `json:"priority"` + + // RuleId The unique identifier for this rule + RuleId string `json:"ruleId"` +} + +// KeyValue defines model for KeyValue. +type KeyValue struct { + Key string `json:"key"` + Value string `json:"value"` +} + +// Metrics defines model for Metrics. +type Metrics struct { + MetricsData *[]MetricsData `json:"metricsData,omitempty"` + TargetData *[]TargetData `json:"targetData,omitempty"` +} + +// MetricsData defines model for MetricsData. +type MetricsData struct { + Attributes []KeyValue `json:"attributes"` + Count int `json:"count"` + + // MetricsType This can be of type FeatureMetrics + MetricsType MetricsDataMetricsType `json:"metricsType"` + + // Timestamp time at when this data was recorded + Timestamp int64 `json:"timestamp"` +} + +// MetricsDataMetricsType This can be of type FeatureMetrics +type MetricsDataMetricsType string + // Pagination defines model for Pagination. type Pagination struct { - ItemCount int `json:"itemCount"` - PageCount int `json:"pageCount"` - PageIndex int `json:"pageIndex"` - PageSize int `json:"pageSize"` - Version *int `json:"version,omitempty"` + // ItemCount The total number of items + ItemCount int `json:"itemCount"` + + // PageCount The total number of pages + PageCount int `json:"pageCount"` + + // PageIndex The current page + PageIndex int `json:"pageIndex"` + + // PageSize The number of items per page + PageSize int `json:"pageSize"` + + // Version The version of this object. The version will be incremented each time the object is modified + Version *int `json:"version,omitempty"` } -// Prerequisite defines model for Prerequisite. +// Prerequisite Feature Flag pre-requisites type Prerequisite struct { - Feature string `json:"feature"` + // Feature The feature identifier that is the prerequisite + Feature string `json:"feature"` + + // Variations A list of variations that must be met Variations []string `json:"variations"` } -// Segment defines model for Segment. +// ProxyConfig defines model for ProxyConfig. +type ProxyConfig struct { + // Embedded struct due to allOf(#/components/schemas/Pagination) + Pagination `yaml:",inline"` + // Embedded fields due to inline allOf schema + Environments *[]struct { + ApiKeys *[]string `json:"apiKeys,omitempty"` + FeatureConfigs *[]FeatureConfig `json:"featureConfigs,omitempty"` + Id *string `json:"id,omitempty"` + Segments *[]Segment `json:"segments,omitempty"` + } `json:"environments,omitempty"` +} + +// Segment A Target Group (Segment) response type Segment struct { - CreatedAt *int64 `json:"createdAt,omitempty"` - Environment *string `json:"environment,omitempty"` - Excluded *[]Target `json:"excluded,omitempty"` + // CreatedAt The data and time in milliseconds when the group was created + CreatedAt *int64 `json:"createdAt,omitempty"` - // Unique identifier for the segment. - Identifier string `json:"identifier"` - Included *[]Target `json:"included,omitempty"` - ModifiedAt *int64 `json:"modifiedAt,omitempty"` + // Environment The environment this target group belongs to + Environment *string `json:"environment,omitempty"` - // Name of the segment. - Name string `json:"name"` + // Excluded A list of Targets who are excluded from this target group + Excluded *[]Target `json:"excluded,omitempty"` + + // Identifier Unique identifier for the target group. + Identifier string `json:"identifier"` + + // Included A list of Targets who belong to this target group + Included *[]Target `json:"included,omitempty"` + + // ModifiedAt The data and time in milliseconds when the group was last modified + ModifiedAt *int64 `json:"modifiedAt,omitempty"` + + // Name Name of the target group. + Name string `json:"name"` + Rules *[]Clause `json:"rules,omitempty"` + + // ServingRules An array of rules that can cause a user to be included in this segment. + ServingRules *[]GroupServingRule `json:"servingRules,omitempty"` - // An array of rules that can cause a user to be included in this segment. - Rules *[]Clause `json:"rules,omitempty"` - Tags *[]Tag `json:"tags,omitempty"` - Version *int64 `json:"version,omitempty"` + // Tags Tags for this target group + Tags *[]Tag `json:"tags,omitempty"` + + // Version The version of this group. Each time it is modified the version is incremented + Version *int64 `json:"version,omitempty"` } -// Serve defines model for Serve. +// Serve Describe the distribution rule and the variation that should be served to the target type Serve struct { + // Distribution Describes a distribution rule Distribution *Distribution `json:"distribution,omitempty"` Variation *string `json:"variation,omitempty"` } -// ServingRule defines model for ServingRule. +// ServingRule The rule used to determine what variation to serve to a target type ServingRule struct { - Clauses []Clause `json:"clauses"` - Priority int `json:"priority"` - RuleId string `json:"ruleId"` - Serve Serve `json:"serve"` + // Clauses A list of clauses to use in the rule + Clauses []Clause `json:"clauses"` + + // Priority The rules priority relative to other rules. The rules are evaluated in order with 1 being the highest + Priority int `json:"priority"` + + // RuleId The unique identifier for this rule + RuleId *string `json:"ruleId,omitempty"` + + // Serve Describe the distribution rule and the variation that should be served to the target + Serve Serve `json:"serve"` } -// A name and value pair. +// Tag A Tag object used to tag feature flags - consists of name and identifier type Tag struct { - Name string `json:"name"` - Value *string `json:"value,omitempty"` + // Identifier The identifier of the tag + Identifier string `json:"identifier"` + + // Name The name of the tag + Name string `json:"name"` } -// Target defines model for Target. +// Target A Target object type Target struct { - Account string `json:"account"` - Anonymous *bool `json:"anonymous,omitempty"` - Attributes *map[string]interface{} `json:"attributes,omitempty"` - CreatedAt *int64 `json:"createdAt,omitempty"` - Environment string `json:"environment"` - Identifier string `json:"identifier"` - Name string `json:"name"` - Org string `json:"org"` - Project string `json:"project"` - Segments *[]Segment `json:"segments,omitempty"` -} - -// TargetMap defines model for TargetMap. + // Account The account ID that the target belongs to + Account string `json:"account"` + + // Anonymous Indicates if this target is anonymous + Anonymous *bool `json:"anonymous,omitempty"` + + // Attributes a JSON representation of the attributes for this target + Attributes *map[string]interface{} `json:"attributes,omitempty"` + + // CreatedAt The date and time in milliseconds when this Target was created + CreatedAt *int64 `json:"createdAt,omitempty"` + + // Environment The identifier for the environment that the target belongs to + Environment string `json:"environment"` + + // Identifier The unique identifier for this target + Identifier string `json:"identifier"` + + // Name The name of this Target + Name string `json:"name"` + + // Org The identifier for the organization that the target belongs to + Org string `json:"org"` + + // Project The identifier for the project that this target belongs to + Project string `json:"project"` + + // Segments A list of Target Groups (Segments) that this Target belongs to + Segments *[]Segment `json:"segments,omitempty"` +} + +// TargetData defines model for TargetData. +type TargetData struct { + Attributes []KeyValue `json:"attributes"` + Identifier string `json:"identifier"` + Name string `json:"name"` +} + +// TargetMap Target map provides the details of a target that belongs to a flag type TargetMap struct { - Identifier *string `json:"identifier,omitempty"` - Name string `json:"name"` + // Identifier The identifier for the target + Identifier string `json:"identifier"` + + // Name The name of the target + Name string `json:"name"` } -// Variation defines model for Variation. +// Variation A variation of a flag that can be returned to a target type Variation struct { + // Description A description of the variation Description *string `json:"description,omitempty"` - Identifier string `json:"identifier"` - Name *string `json:"name,omitempty"` - Value string `json:"value"` + + // Identifier The unique identifier for the variation + Identifier string `json:"identifier"` + + // Name The user friendly name of the variation + Name *string `json:"name,omitempty"` + + // Value The variation value to serve such as true or false for a boolean flag + Value string `json:"value"` } -// VariationMap defines model for VariationMap. +// VariationMap A mapping of variations to targets and target groups (segments). The targets listed here should receive this variation. type VariationMap struct { - TargetSegments *[]string `json:"targetSegments,omitempty"` - Targets *[]TargetMap `json:"targets,omitempty"` - Variation string `json:"variation"` + // TargetSegments A list of target groups (segments) + TargetSegments *[]string `json:"targetSegments,omitempty"` + + // Targets A list of target mappings + Targets *[]TargetMap `json:"targets,omitempty"` + + // Variation The variation identifier + Variation string `json:"variation"` } -// WeightedVariation defines model for WeightedVariation. +// WeightedVariation A variation and the weighting it should receive as part of a percentage rollout type WeightedVariation struct { + // Variation The variation identifier Variation string `json:"variation"` - Weight int `json:"weight"` + + // Weight The weight to be given to the variation in percent + Weight int `json:"weight"` } +// ClusterQueryOptionalParam defines model for clusterQueryOptionalParam. +type ClusterQueryOptionalParam string + +// EnvironmentPathParam defines model for environmentPathParam. +type EnvironmentPathParam string + +// PageNumber defines model for pageNumber. +type PageNumber int + +// PageSize defines model for pageSize. +type PageSize int + +// BadRequest defines model for BadRequest. +type BadRequest Error + // InternalServerError defines model for InternalServerError. type InternalServerError Error // NotFound defines model for NotFound. type NotFound Error +// ProxyConfigResponse TBD +type ProxyConfigResponse ProxyConfig + // Unauthenticated defines model for Unauthenticated. type Unauthenticated Error // Unauthorized defines model for Unauthorized. type Unauthorized Error -// AuthenticateJSONBody defines parameters for Authenticate. -type AuthenticateJSONBody AuthenticationRequest +// GetFeatureConfigParams defines parameters for GetFeatureConfig. +type GetFeatureConfigParams struct { + // Cluster Unique identifier for the cluster for the account + Cluster *ClusterQueryOptionalParam `form:"cluster,omitempty" json:"cluster,omitempty"` +} + +// GetFeatureConfigByIdentifierParams defines parameters for GetFeatureConfigByIdentifier. +type GetFeatureConfigByIdentifierParams struct { + // Cluster Unique identifier for the cluster for the account + Cluster *ClusterQueryOptionalParam `form:"cluster,omitempty" json:"cluster,omitempty"` +} + +// GetAllSegmentsParams defines parameters for GetAllSegments. +type GetAllSegmentsParams struct { + // Cluster Unique identifier for the cluster for the account + Cluster *ClusterQueryOptionalParam `form:"cluster,omitempty" json:"cluster,omitempty"` +} + +// GetSegmentByIdentifierParams defines parameters for GetSegmentByIdentifier. +type GetSegmentByIdentifierParams struct { + // Cluster Unique identifier for the cluster for the account + Cluster *ClusterQueryOptionalParam `form:"cluster,omitempty" json:"cluster,omitempty"` +} + +// GetEvaluationsParams defines parameters for GetEvaluations. +type GetEvaluationsParams struct { + // Cluster Unique identifier for the cluster for the account + Cluster *ClusterQueryOptionalParam `form:"cluster,omitempty" json:"cluster,omitempty"` +} + +// GetEvaluationByIdentifierParams defines parameters for GetEvaluationByIdentifier. +type GetEvaluationByIdentifierParams struct { + // Cluster Unique identifier for the cluster for the account + Cluster *ClusterQueryOptionalParam `form:"cluster,omitempty" json:"cluster,omitempty"` +} + +// PostMetricsParams defines parameters for PostMetrics. +type PostMetricsParams struct { + // Cluster Unique identifier for the cluster for the account + Cluster *ClusterQueryOptionalParam `form:"cluster,omitempty" json:"cluster,omitempty"` +} + +// AuthenticateProxyKeyJSONBody defines parameters for AuthenticateProxyKey. +type AuthenticateProxyKeyJSONBody struct { + ProxyKey string `json:"proxyKey"` +} + +// GetProxyConfigParams defines parameters for GetProxyConfig. +type GetProxyConfigParams struct { + // PageNumber PageNumber + PageNumber *PageNumber `form:"pageNumber,omitempty" json:"pageNumber,omitempty"` + + // PageSize PageSize + PageSize *PageSize `form:"pageSize,omitempty" json:"pageSize,omitempty"` + + // Cluster Unique identifier for the cluster for the account + Cluster *ClusterQueryOptionalParam `form:"cluster,omitempty" json:"cluster,omitempty"` + + // Environment Accepts an EnvironmentID. If this is provided then the endpoint will only return config for this environment. If this is left empty then the Proxy will return config for all environments associated with the Proxy Key. + Environment *string `form:"environment,omitempty" json:"environment,omitempty"` + + // Key Accpets a Proxy Key. + Key string `form:"key" json:"key"` +} // StreamParams defines parameters for Stream. type StreamParams struct { - APIKey string `json:"API-Key"` + // Cluster Unique identifier for the cluster for the account + Cluster *ClusterQueryOptionalParam `form:"cluster,omitempty" json:"cluster,omitempty"` + APIKey string `json:"API-Key"` } // AuthenticateJSONRequestBody defines body for Authenticate for application/json ContentType. -type AuthenticateJSONRequestBody AuthenticateJSONBody +type AuthenticateJSONRequestBody AuthenticationRequest + +// PostMetricsJSONRequestBody defines body for PostMetrics for application/json ContentType. +type PostMetricsJSONRequestBody Metrics + +// AuthenticateProxyKeyJSONRequestBody defines body for AuthenticateProxyKey for application/json ContentType. +type AuthenticateProxyKeyJSONRequestBody AuthenticateProxyKeyJSONBody diff --git a/stream/sse.go b/stream/sse.go index 63be3153..02707934 100644 --- a/stream/sse.go +++ b/stream/sse.go @@ -4,9 +4,10 @@ import ( "context" "errors" "fmt" - "github.com/harness/ff-golang-server-sdk/sdk_codes" "time" + "github.com/harness/ff-golang-server-sdk/sdk_codes" + "github.com/harness/ff-golang-server-sdk/pkg/repository" "github.com/cenkalti/backoff/v4" @@ -186,7 +187,7 @@ func (c *SSEClient) handleEvent(event Event) { ctx, cancel := context.WithTimeout(context.Background(), time.Second*60) defer cancel() - response, err := c.api.GetFeatureConfigByIdentifierWithResponse(ctx, event.Environment, cfMsg.Identifier) + response, err := c.api.GetFeatureConfigByIdentifierWithResponse(ctx, event.Environment, cfMsg.Identifier, nil) if err != nil { c.logger.Errorf("error while pulling flag, err: %s", err.Error()) return @@ -203,7 +204,7 @@ func (c *SSEClient) handleEvent(event Event) { ctx, cancel := context.WithTimeout(context.Background(), time.Second*60) defer cancel() - response, err := c.api.GetFeatureConfigWithResponse(ctx, event.Environment) + response, err := c.api.GetFeatureConfigWithResponse(ctx, event.Environment, nil) if err != nil { c.logger.Errorf("error while pulling flags, err: %s", err.Error()) return @@ -230,7 +231,7 @@ func (c *SSEClient) handleEvent(event Event) { ctx, cancel := context.WithTimeout(context.Background(), time.Second*60) defer cancel() - response, err := c.api.GetSegmentByIdentifierWithResponse(ctx, event.Environment, cfMsg.Identifier) + response, err := c.api.GetSegmentByIdentifierWithResponse(ctx, event.Environment, cfMsg.Identifier, nil) if err != nil { c.logger.Errorf("error while pulling segment, err: %s", err.Error()) return @@ -246,7 +247,7 @@ func (c *SSEClient) handleEvent(event Event) { ctx, cancel := context.WithTimeout(context.Background(), time.Second*60) defer cancel() - response, err := c.api.GetAllSegmentsWithResponse(ctx, event.Environment) + response, err := c.api.GetAllSegmentsWithResponse(ctx, event.Environment, nil) if err != nil { c.logger.Errorf("error while pulling segment, err: %s", err.Error()) return