From 00e3878c4e2411717ea457f70fce6dd145a969e6 Mon Sep 17 00:00:00 2001 From: Samuel Attwood Date: Wed, 20 Nov 2024 03:46:04 -0500 Subject: [PATCH] Migrate to kube_codegen.sh --- Makefile | 28 +-- controllers/jetstream/controller.go | 22 +- controllers/jetstream/controller_test.go | 5 +- go.mod | 88 ++++---- go.sum | 109 ++++++++- .../v1beta1/zz_generated.deepcopy.go | 3 +- .../v1beta2/zz_generated.deepcopy.go | 2 +- .../applyconfiguration/internal/internal.go | 2 +- .../jetstream/v1beta2/account.go | 12 +- .../jetstream/v1beta2/accountspec.go | 6 +- .../jetstream/v1beta2/condition.go | 6 +- .../jetstream/v1beta2/consumer.go | 12 +- .../jetstream/v1beta2/consumerspec.go | 6 +- .../jetstream/v1beta2/credssecret.go | 6 +- .../jetstream/v1beta2/republish.go | 6 +- .../jetstream/v1beta2/secretref.go | 6 +- .../jetstream/v1beta2/status.go | 6 +- .../jetstream/v1beta2/stream.go | 12 +- .../jetstream/v1beta2/streamplacement.go | 6 +- .../jetstream/v1beta2/streamsource.go | 6 +- .../jetstream/v1beta2/streamspec.go | 6 +- .../jetstream/v1beta2/subjecttransform.go | 6 +- .../jetstream/v1beta2/tls.go | 6 +- .../jetstream/v1beta2/tlssecret.go | 6 +- .../generated/applyconfiguration/utils.go | 9 +- .../clientset/versioned/clientset.go | 2 +- .../versioned/fake/clientset_generated.go | 41 +++- .../generated/clientset/versioned/fake/doc.go | 2 +- .../clientset/versioned/fake/register.go | 2 +- .../clientset/versioned/scheme/doc.go | 2 +- .../clientset/versioned/scheme/register.go | 2 +- .../typed/jetstream/v1beta2/account.go | 207 +----------------- .../typed/jetstream/v1beta2/consumer.go | 207 +----------------- .../versioned/typed/jetstream/v1beta2/doc.go | 2 +- .../typed/jetstream/v1beta2/fake/doc.go | 2 +- .../jetstream/v1beta2/fake/fake_account.go | 48 ++-- .../jetstream/v1beta2/fake/fake_consumer.go | 48 ++-- .../v1beta2/fake/fake_jetstream_client.go | 2 +- .../jetstream/v1beta2/fake/fake_stream.go | 48 ++-- .../jetstream/v1beta2/generated_expansion.go | 2 +- .../jetstream/v1beta2/jetstream_client.go | 2 +- .../typed/jetstream/v1beta2/stream.go | 207 +----------------- .../informers/externalversions/factory.go | 3 +- .../informers/externalversions/generic.go | 2 +- .../internalinterfaces/factory_interfaces.go | 2 +- .../externalversions/jetstream/interface.go | 2 +- .../jetstream/v1beta2/account.go | 2 +- .../jetstream/v1beta2/consumer.go | 2 +- .../jetstream/v1beta2/interface.go | 2 +- .../jetstream/v1beta2/stream.go | 2 +- .../listers/jetstream/v1beta2/account.go | 41 +--- .../listers/jetstream/v1beta2/consumer.go | 41 +--- .../jetstream/v1beta2/expansion_generated.go | 2 +- .../listers/jetstream/v1beta2/stream.go | 41 +--- pkg/k8scodegen/file-header.txt | 2 +- 55 files changed, 459 insertions(+), 893 deletions(-) diff --git a/Makefile b/Makefile index aceda292..17dcbb0c 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,7 @@ export GO111MODULE := on +SHELL=/usr/bin/env bash + now := $(shell date -u +%Y-%m-%dT%H:%M:%S%z) gitBranch := $(shell git rev-parse --abbrev-ref HEAD) gitCommit := $(shell git rev-parse --short HEAD) @@ -9,7 +11,6 @@ VERSION ?= version-not-set linkerVars := -X main.BuildTime=$(now) -X main.GitInfo=$(gitBranch)-$(gitCommit)$(repoDirty) -X main.Version=$(VERSION) drepo ?= natsio -jetstreamGenIn:= $(shell grep -l -R -F "// +k8s:" pkg/jetstream/apis) jetstreamSrc := $(shell find cmd/jetstream-controller pkg/jetstream controllers/jetstream -name "*.go") pkg/jetstream/apis/jetstream/v1beta2/zz_generated.deepcopy.go configReloaderSrc := $(shell find cmd/nats-server-config-reloader/ pkg/natsreloader/ -name "*.go") @@ -27,20 +28,21 @@ default: # make nats-server-config-reloader # make nats-boot-config -pkg/jetstream/generated pkg/jetstream/apis/jetstream/v1beta2/zz_generated.deepcopy.go: fetch-modules $(jetstreamGenIn) pkg/k8scodegen/file-header.txt +generate: fetch-modules pkg/k8scodegen/file-header.txt rm -rf pkg/jetstream/generated - # Temporary chmod fix until we migrate to kube_codegen.sh D="$(codeGeneratorDir)"; : "$${D:=`go list -m -f '{{.Dir}}' k8s.io/code-generator`}"; \ - chmod u+x "$$D/generate-internal-groups.sh"; \ - GOFLAGS='' bash "$$D/generate-groups.sh" all \ - github.com/nats-io/nack/pkg/jetstream/generated \ - github.com/nats-io/nack/pkg/jetstream/apis \ - "jetstream:v1beta2" \ - --output-base . \ - --go-header-file pkg/k8scodegen/file-header.txt - mv github.com/nats-io/nack/pkg/jetstream/generated pkg/jetstream/generated - mv github.com/nats-io/nack/pkg/jetstream/apis/jetstream/v1beta2/zz_generated.deepcopy.go pkg/jetstream/apis/jetstream/v1beta2/zz_generated.deepcopy.go - rm -rf github.com + source "$$D/kube_codegen.sh" ; \ + kube::codegen::gen_helpers \ + --boilerplate pkg/k8scodegen/file-header.txt \ + pkg/jetstream/apis; \ + kube::codegen::gen_client \ + --with-watch \ + --with-applyconfig \ + --boilerplate pkg/k8scodegen/file-header.txt \ + --output-dir pkg/jetstream/generated \ + --output-pkg github.com/nats-io/nack/pkg/jetstream/generated \ + --one-input-api jetstream/v1beta2 \ + pkg/jetstream/apis jetstream-controller: $(jetstreamSrc) go build -race -o $@ \ diff --git a/controllers/jetstream/controller.go b/controllers/jetstream/controller.go index 785b3559..f4100ca2 100644 --- a/controllers/jetstream/controller.go +++ b/controllers/jetstream/controller.go @@ -139,15 +139,17 @@ func NewController(opt Options) *Controller { streamQueue := workqueue.NewNamedRateLimitingQueue(workqueue.DefaultControllerRateLimiter(), "Streams") consumerQueue := workqueue.NewNamedRateLimitingQueue(workqueue.DefaultControllerRateLimiter(), "Consumers") - streamInformer.Informer().AddEventHandler(eventHandlers( - opt.Ctx, - streamQueue, - )) - - consumerInformer.Informer().AddEventHandler(eventHandlers( - opt.Ctx, - consumerQueue, - )) + streamInformer.Informer().AddEventHandler( + eventHandlers( + streamQueue, + ), + ) + + consumerInformer.Informer().AddEventHandler( + eventHandlers( + consumerQueue, + ), + ) cacheDir, err := os.MkdirTemp(".", "nack") if err != nil { @@ -528,7 +530,7 @@ func shouldEnqueue(prevObj, nextObj interface{}) bool { return markedDelete || specChanged } -func eventHandlers(ctx context.Context, q workqueue.RateLimitingInterface) cache.ResourceEventHandlerFuncs { +func eventHandlers(q workqueue.RateLimitingInterface) cache.ResourceEventHandlerFuncs { return cache.ResourceEventHandlerFuncs{ AddFunc: func(obj interface{}) { if err := enqueueWork(q, obj); err != nil { diff --git a/controllers/jetstream/controller_test.go b/controllers/jetstream/controller_test.go index 94f831bc..68f8f7fd 100644 --- a/controllers/jetstream/controller_test.go +++ b/controllers/jetstream/controller_test.go @@ -1,6 +1,7 @@ package jetstream import ( + "context" "fmt" "os" "testing" @@ -17,8 +18,8 @@ import ( func TestMain(m *testing.M) { // Disable error logs. - utilruntime.ErrorHandlers = []func(error){ - func(err error) {}, + utilruntime.ErrorHandlers = []utilruntime.ErrorHandler{ + func(ctx context.Context, err error, msg string, args ...any) {}, } os.Exit(m.Run()) diff --git a/go.mod b/go.mod index e53ed0fa..821f97dc 100644 --- a/go.mod +++ b/go.mod @@ -1,74 +1,78 @@ module github.com/nats-io/nack -go 1.22 +go 1.23 -toolchain go1.22.2 +toolchain go1.23.2 require ( - github.com/fsnotify/fsnotify v1.7.0 + github.com/fsnotify/fsnotify v1.8.0 github.com/nats-io/jsm.go v0.1.2 - github.com/nats-io/nats-server/v2 v2.10.18 - github.com/nats-io/nats.go v1.36.0 + github.com/nats-io/nats-server/v2 v2.10.22 + github.com/nats-io/nats.go v1.37.0 github.com/sirupsen/logrus v1.9.3 - github.com/stretchr/testify v1.8.4 - golang.org/x/sync v0.7.0 - k8s.io/api v0.29.1 - k8s.io/apimachinery v0.29.1 - k8s.io/client-go v0.29.1 - k8s.io/code-generator v0.29.1 - k8s.io/klog/v2 v2.120.1 - sigs.k8s.io/structured-merge-diff/v4 v4.4.1 + github.com/stretchr/testify v1.9.0 + golang.org/x/sync v0.9.0 + k8s.io/api v0.31.2 + k8s.io/apimachinery v0.31.2 + k8s.io/client-go v0.31.2 + k8s.io/code-generator v0.31.2 + k8s.io/klog/v2 v2.130.1 + sigs.k8s.io/structured-merge-diff/v4 v4.4.3 ) require ( - github.com/davecgh/go-spew v1.1.1 // indirect + github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/dustin/go-humanize v1.0.1 // indirect - github.com/emicklei/go-restful/v3 v3.11.0 // indirect - github.com/evanphx/json-patch v4.12.0+incompatible // indirect + github.com/emicklei/go-restful/v3 v3.12.1 // indirect + github.com/evanphx/json-patch v5.9.0+incompatible // indirect github.com/expr-lang/expr v1.16.9 // indirect - github.com/go-logr/logr v1.4.1 // indirect - github.com/go-openapi/jsonpointer v0.19.6 // indirect - github.com/go-openapi/jsonreference v0.20.2 // indirect - github.com/go-openapi/swag v0.22.3 // indirect + github.com/fxamacker/cbor/v2 v2.7.0 // indirect + github.com/go-logr/logr v1.4.2 // indirect + github.com/go-openapi/jsonpointer v0.21.0 // indirect + github.com/go-openapi/jsonreference v0.21.0 // indirect + github.com/go-openapi/swag v0.23.0 // indirect github.com/gogo/protobuf v1.3.2 // indirect github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect - github.com/golang/protobuf v1.5.3 // indirect + github.com/golang/protobuf v1.5.4 // indirect github.com/google/gnostic-models v0.6.8 // indirect github.com/google/go-cmp v0.6.0 // indirect github.com/google/gofuzz v1.2.0 // indirect - github.com/google/uuid v1.3.0 // indirect - github.com/imdario/mergo v0.3.6 // indirect + github.com/google/uuid v1.6.0 // indirect + github.com/imdario/mergo v0.3.16 // indirect github.com/josharian/intern v1.0.0 // indirect github.com/json-iterator/go v1.1.12 // indirect - github.com/klauspost/compress v1.17.9 // indirect + github.com/klauspost/compress v1.17.11 // indirect github.com/mailru/easyjson v0.7.7 // indirect github.com/minio/highwayhash v1.0.3 // indirect github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/reflect2 v1.0.2 // indirect github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect - github.com/nats-io/jwt/v2 v2.5.8 // indirect + github.com/nats-io/jwt/v2 v2.7.2 // indirect github.com/nats-io/nkeys v0.4.7 // indirect github.com/nats-io/nuid v1.0.1 // indirect github.com/pkg/errors v0.9.1 // indirect - github.com/pmezard/go-difflib v1.0.0 // indirect + github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect github.com/spf13/pflag v1.0.5 // indirect - golang.org/x/crypto v0.25.0 // indirect - golang.org/x/mod v0.17.0 // indirect - golang.org/x/net v0.27.0 // indirect - golang.org/x/oauth2 v0.10.0 // indirect - golang.org/x/sys v0.22.0 // indirect - golang.org/x/term v0.22.0 // indirect - golang.org/x/text v0.16.0 // indirect - golang.org/x/time v0.5.0 // indirect - golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d // indirect - google.golang.org/appengine v1.6.7 // indirect - google.golang.org/protobuf v1.33.0 // indirect + github.com/x448/float16 v0.8.4 // indirect + golang.org/x/crypto v0.29.0 // indirect + golang.org/x/mod v0.22.0 // indirect + golang.org/x/net v0.31.0 // indirect + golang.org/x/oauth2 v0.24.0 // indirect + golang.org/x/sys v0.27.0 // indirect + golang.org/x/term v0.26.0 // indirect + golang.org/x/text v0.20.0 // indirect + golang.org/x/time v0.8.0 // indirect + golang.org/x/tools v0.27.0 // indirect + google.golang.org/appengine v1.6.8 // indirect + google.golang.org/protobuf v1.35.2 // indirect + gopkg.in/evanphx/json-patch.v4 v4.12.0 // indirect gopkg.in/inf.v0 v0.9.1 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect - k8s.io/gengo v0.0.0-20230829151522-9cce18d56c01 // indirect - k8s.io/kube-openapi v0.0.0-20231010175941-2dd684a91f00 // indirect - k8s.io/utils v0.0.0-20230726121419-3b25d923346b // indirect - sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect - sigs.k8s.io/yaml v1.3.0 // indirect + k8s.io/gengo v0.0.0-20240911193312-2b36238f13e9 // indirect + k8s.io/gengo/v2 v2.0.0-20240911193312-2b36238f13e9 // indirect + k8s.io/kube-openapi v0.0.0-20241105132330-32ad38e42d3f // indirect + k8s.io/utils v0.0.0-20241104163129-6fe5fd82f078 // indirect + sigs.k8s.io/json v0.0.0-20241014173422-cfa47c3a1cc8 // indirect + sigs.k8s.io/yaml v1.4.0 // indirect ) diff --git a/go.sum b/go.sum index 4225366c..eb7f909b 100644 --- a/go.sum +++ b/go.sum @@ -2,25 +2,43 @@ github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ3 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/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= +github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY= github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto= github.com/emicklei/go-restful/v3 v3.11.0 h1:rAQeMHw1c7zTmncogyy8VvRZwtkmkZ4FxERmMY4rD+g= github.com/emicklei/go-restful/v3 v3.11.0/go.mod h1:6n3XBCmQQb25CM2LCACGz8ukIrRry+4bhvbpWn3mrbc= +github.com/emicklei/go-restful/v3 v3.12.1 h1:PJMDIM/ak7btuL8Ex0iYET9hxM3CI2sjZtzpL63nKAU= +github.com/emicklei/go-restful/v3 v3.12.1/go.mod h1:6n3XBCmQQb25CM2LCACGz8ukIrRry+4bhvbpWn3mrbc= github.com/evanphx/json-patch v4.12.0+incompatible h1:4onqiflcdA9EOZ4RxV643DvftH5pOlLGNtQ5lPWQu84= github.com/evanphx/json-patch v4.12.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk= +github.com/evanphx/json-patch v5.9.0+incompatible h1:fBXyNpNMuTTDdquAq/uisOr2lShz4oaXpDTX2bLe7ls= +github.com/evanphx/json-patch v5.9.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk= github.com/expr-lang/expr v1.16.9 h1:WUAzmR0JNI9JCiF0/ewwHB1gmcGw5wW7nWt8gc6PpCI= github.com/expr-lang/expr v1.16.9/go.mod h1:8/vRC7+7HBzESEqt5kKpYXxrxkr31SaO8r40VO/1IT4= github.com/fsnotify/fsnotify v1.7.0 h1:8JEhPFa5W2WU7YfeZzPNqzMP6Lwt7L2715Ggo0nosvA= github.com/fsnotify/fsnotify v1.7.0/go.mod h1:40Bi/Hjc2AVfZrqy+aj+yEI+/bRxZnMJyTJwOpGvigM= +github.com/fsnotify/fsnotify v1.8.0 h1:dAwr6QBTBZIkG8roQaJjGof0pp0EeF+tNV7YBP3F/8M= +github.com/fsnotify/fsnotify v1.8.0/go.mod h1:8jBTzvmWwFyi3Pb8djgCCO5IBqzKJ/Jwo8TRcHyHii0= +github.com/fxamacker/cbor/v2 v2.7.0 h1:iM5WgngdRBanHcxugY4JySA0nk1wZorNOpTgCMedv5E= +github.com/fxamacker/cbor/v2 v2.7.0/go.mod h1:pxXPTn3joSm21Gbwsv0w9OSA2y1HFR9qXEeXQVeNoDQ= github.com/go-logr/logr v0.2.0/go.mod h1:z6/tIYblkpsD+a4lm/fGIIU9mZ+XfAiaFtq7xTgseGU= github.com/go-logr/logr v1.4.1 h1:pKouT5E8xu9zeFC39JXRDukb6JFQPXM5p5I91188VAQ= github.com/go-logr/logr v1.4.1/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= +github.com/go-logr/logr v1.4.2 h1:6pFjapn8bFcIbiKo3XT4j/BhANplGihG6tvd+8rYgrY= +github.com/go-logr/logr v1.4.2/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-openapi/jsonpointer v0.19.6 h1:eCs3fxoIi3Wh6vtgmLTOjdhSpiqphQ+DaPn38N2ZdrE= github.com/go-openapi/jsonpointer v0.19.6/go.mod h1:osyAmYz/mB/C3I+WsTTSgw1ONzaLJoLCyoi6/zppojs= +github.com/go-openapi/jsonpointer v0.21.0 h1:YgdVicSA9vH5RiHs9TZW5oyafXZFc6+2Vc1rr/O9oNQ= +github.com/go-openapi/jsonpointer v0.21.0/go.mod h1:IUyH9l/+uyhIYQ/PXVA41Rexl+kOkAPDdXEYns6fzUY= github.com/go-openapi/jsonreference v0.20.2 h1:3sVjiK66+uXK/6oQ8xgcRKcFgQ5KXa2KvnJRumpMGbE= github.com/go-openapi/jsonreference v0.20.2/go.mod h1:Bl1zwGIM8/wsvqjsOQLJ/SH+En5Ap4rVB5KVcIDZG2k= +github.com/go-openapi/jsonreference v0.21.0 h1:Rs+Y7hSXT83Jacb7kFyjn4ijOuVGSvOdF2+tg1TRrwQ= +github.com/go-openapi/jsonreference v0.21.0/go.mod h1:LmZmgsrTkVg9LG4EaHeY8cBDslNPMo06cago5JNLkm4= github.com/go-openapi/swag v0.22.3 h1:yMBqmnQ0gyZvEb/+KzuWZOXgllrXT4SADYbvDaXHv/g= github.com/go-openapi/swag v0.22.3/go.mod h1:UzaqsxGiab7freDnrUUra0MwWfN/q7tE4j+VcZ0yl14= +github.com/go-openapi/swag v0.23.0 h1:vsEVJDUo2hPJ2tu0/Xc+4noaxyEffXNIs3cOULZ+GrE= +github.com/go-openapi/swag v0.23.0/go.mod h1:esZ8ITTYEsH1V2trKHjAN8Ai7xHb8RV+YSZ577vPjgQ= github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 h1:tfuBGBXKqDEevZMzYi5KSi8KkcZtzBcTgAUUtapy0OI= github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572/go.mod h1:9Pwr4B2jHnOSGXyyzV8ROjYa2ojvAY6HCGYYfMoC3Ls= github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= @@ -29,8 +47,11 @@ github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da h1:oI5xCqsCo564l github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= 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/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= +github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= +github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= github.com/google/gnostic-models v0.6.8 h1:yo/ABAfM5IMRsS1VnXjTBvUb61tFIHozhlYvRgGre9I= github.com/google/gnostic-models v0.6.8/go.mod h1:5n7qKqH0f5wFt+aWF8CW6pZLLNOfYuF5OpfBSENuI8U= github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= @@ -44,10 +65,15 @@ github.com/google/gofuzz v1.2.0 h1:xRy4A+RhZaiKjJ1bPfwQ8sedCA+YS2YcCHW6ec7JMi0= github.com/google/gofuzz v1.2.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1 h1:K6RDEckDVWvDI9JAJYCmNdQXq6neHJOYx3V6jnqNEec= github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= +github.com/google/pprof v0.0.0-20240727154555-813a5fbdbec8 h1:FKHo8hFI3A+7w0aUQuYXQ+6EN5stWmeY/AZqtM8xk9k= 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/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= +github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/imdario/mergo v0.3.6 h1:xTNEAn+kxVO7dTZGu0CegyqKZmoWFI0rF8UxjlB2d28= github.com/imdario/mergo v0.3.6/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA= +github.com/imdario/mergo v0.3.16 h1:wwQJbIsHYGMUyLSPrEq1CT16AhnhNJQ51+4fdHUnCl4= +github.com/imdario/mergo v0.3.16/go.mod h1:WBLT9ZmE3lPoWsEzCh9LPo3TiwVN+ZKEjmz+hD27ysY= 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.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= @@ -56,6 +82,8 @@ github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/klauspost/compress v1.17.9 h1:6KIumPrER1LHsvBVuDa0r5xaG0Es51mhhB9BQB2qeMA= github.com/klauspost/compress v1.17.9/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw= +github.com/klauspost/compress v1.17.11 h1:In6xLpyWOi1+C7tXUUWv2ot1QvBjxevKAaI6IXrJmUc= +github.com/klauspost/compress v1.17.11/go.mod h1:pMDklpSncoRMuLFrf1W9Ss9KT+0rH90U12bZKk7uwG0= github.com/kr/pretty v0.2.0/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= @@ -79,10 +107,16 @@ github.com/nats-io/jsm.go v0.1.2 h1:T4Fq88a03sPAPWYwrOLQ85oanYsC2Bs6517rUiWBMpQ= github.com/nats-io/jsm.go v0.1.2/go.mod h1:tnubE70CAKi5TNfQiq6XHFqWTuSIe1H7X4sDwfq6ZK8= github.com/nats-io/jwt/v2 v2.5.8 h1:uvdSzwWiEGWGXf+0Q+70qv6AQdvcvxrv9hPM0RiPamE= github.com/nats-io/jwt/v2 v2.5.8/go.mod h1:ZdWS1nZa6WMZfFwwgpEaqBV8EPGVgOTDHN/wTbz0Y5A= +github.com/nats-io/jwt/v2 v2.7.2 h1:SCRjfDLJ2q8naXp8YlGJJS5/yj3wGSODFYVi4nnwVMw= +github.com/nats-io/jwt/v2 v2.7.2/go.mod h1:kB6QUmqHG6Wdrzj0KP2L+OX4xiTPBeV+NHVstFaATXU= github.com/nats-io/nats-server/v2 v2.10.18 h1:tRdZmBuWKVAFYtayqlBB2BuCHNGAQPvoQIXOKwU3WSM= github.com/nats-io/nats-server/v2 v2.10.18/go.mod h1:97Qyg7YydD8blKlR8yBsUlPlWyZKjA7Bp5cl3MUE9K8= +github.com/nats-io/nats-server/v2 v2.10.22 h1:Yt63BGu2c3DdMoBZNcR6pjGQwk/asrKU7VX846ibxDA= +github.com/nats-io/nats-server/v2 v2.10.22/go.mod h1:X/m1ye9NYansUXYFrbcDwUi/blHkrgHh2rgCJaakonk= github.com/nats-io/nats.go v1.36.0 h1:suEUPuWzTSse/XhESwqLxXGuj8vGRuPRoG7MoRN/qyU= github.com/nats-io/nats.go v1.36.0/go.mod h1:Ubdu4Nh9exXdSz0RVWRFBbRfrbSxOYd26oF0wkWclB8= +github.com/nats-io/nats.go v1.37.0 h1:07rauXbVnnJvv1gfIyghFEo6lUcYRY0WXc3x7x0vUxE= +github.com/nats-io/nats.go v1.37.0/go.mod h1:Ubdu4Nh9exXdSz0RVWRFBbRfrbSxOYd26oF0wkWclB8= github.com/nats-io/nkeys v0.4.7 h1:RwNJbbIdYCoClSDNY7QVKZlyb/wfT6ugvFCiKy6vDvI= github.com/nats-io/nkeys v0.4.7/go.mod h1:kqXRgRDPlGy7nGaEDMuYzmiJCIAAWDK0IMBtDmGD0nc= github.com/nats-io/nuid v1.0.1 h1:5iA8DT8V7q8WK2EScv2padNa/rTESc1KdnPw4TC2paw= @@ -95,6 +129,8 @@ 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/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= +github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ= github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncjaFoBhdsK/akog= github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ= @@ -111,68 +147,113 @@ github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= 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/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= +github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= +github.com/x448/float16 v0.8.4 h1:qLwI1I70+NjRFUR3zs1JPUCgaCXSh3SW62uAKT1mSBM= +github.com/x448/float16 v0.8.4/go.mod h1:14CWIYCyZA/cWjXOioeEpHeN/83MdbZDRQHoFcYsOfg= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.25.0 h1:ypSNr+bnYL2YhwoMt2zPxHFmbAN1KZs/njMG3hxUp30= golang.org/x/crypto v0.25.0/go.mod h1:T+wALwcMOSE0kXgUAnPAHqTLW+XHgcELELW8VaDgm/M= +golang.org/x/crypto v0.29.0 h1:L5SG1JTTXupVV3n6sUqMTeWbjAyfPwoda2DLX8J8FrQ= +golang.org/x/crypto v0.29.0/go.mod h1:+F4F4N5hv6v38hfeYwTdx20oUvLLc+QfrE9Ax9HtgRg= golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= golang.org/x/mod v0.17.0 h1:zY54UmvipHiNd+pm+m0x9KhZ9hl1/7QNMyxXbc6ICqA= golang.org/x/mod v0.17.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= +golang.org/x/mod v0.22.0 h1:D4nJWe9zXqHOmWqj4VMOJhvzj7bEZg4wEYa759z1pH4= +golang.org/x/mod v0.22.0/go.mod h1:6SkKJ3Xj0I0BrPOZoBy3bdMptDDU9oJrpohJ3eWZ1fY= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= +golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.27.0 h1:5K3Njcw06/l2y9vpGCSdcxWOYHOUk3dVNGDXN+FvAys= golang.org/x/net v0.27.0/go.mod h1:dDi0PyhWNoiUOrAS8uXv/vnScO4wnHQO4mj9fn/RytE= +golang.org/x/net v0.31.0 h1:68CPQngjLL0r2AlUKiSxtQFKvzRVbnzLwMUn5SzcLHo= +golang.org/x/net v0.31.0/go.mod h1:P4fl1q7dY2hnZFxEk4pPSkDHF+QqjitcnDjUQyMM+pM= golang.org/x/oauth2 v0.10.0 h1:zHCpF2Khkwy4mMB4bv0U37YtJdTGW8jI0glAApi0Kh8= golang.org/x/oauth2 v0.10.0/go.mod h1:kTpgurOux7LqtuxjuyZa4Gj2gdezIt/jQtGnNFfypQI= +golang.org/x/oauth2 v0.24.0 h1:KTBBxWqUa0ykRPLtV69rRto9TLXcqYkeswu48x/gvNE= +golang.org/x/oauth2 v0.24.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.7.0 h1:YsImfSBoP9QPYL0xyKJPq0gcaJdG3rInoqxTWbfQu9M= golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/sync v0.9.0 h1:fEo0HyrW1GIgZdpbhCRO0PkJajUS5H9IFUztCgEo2jQ= +golang.org/x/sync v0.9.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= 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-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/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-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.21.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/sys v0.22.0 h1:RI27ohtqKCnwULzJLqkv897zojh5/DwS/ENaMzUOaWI= golang.org/x/sys v0.22.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.27.0 h1:wBqf8DvsY9Y/2P8gAfPDEYNuS30J4lPHJxXSb/nJZ+s= +golang.org/x/sys v0.27.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +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/term v0.22.0 h1:BbsgPEJULsl2fV/AT3v15Mjva5yXKQDyKf+TbDz7QJk= golang.org/x/term v0.22.0/go.mod h1:F3qCibpT5AMpCRfhfT53vVJwhLtIVHhB9XDjfFvnMI4= +golang.org/x/term v0.26.0 h1:WEQa6V3Gja/BhNxg540hBip/kkaYtRg3cxg4oXSw4AU= +golang.org/x/term v0.26.0/go.mod h1:Si5m1o57C5nBNQo5z1iq+XDijt21BDBDp2bK0QI8e3E= 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.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= +golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ= golang.org/x/text v0.16.0 h1:a94ExnEXNtEwYLGJSIUxnWoxoRz/ZcCsV63ROupILh4= golang.org/x/text v0.16.0/go.mod h1:GhwF1Be+LQoKShO3cGOHzqOgRrGaYc9AvblQOmPVHnI= +golang.org/x/text v0.20.0 h1:gK/Kv2otX8gz+wn7Rmb3vT96ZwuoxnQlY+HlJVj7Qug= +golang.org/x/text v0.20.0/go.mod h1:D4IsuqiFMhST5bX19pQ9ikHC2GsaKyk/oF+pn3ducp4= golang.org/x/time v0.5.0 h1:o7cqy6amK/52YcAKIPlM3a+Fpj35zvRj2TP+e1xFSfk= golang.org/x/time v0.5.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= +golang.org/x/time v0.8.0 h1:9i3RxcPv3PZnitoVGMPDKZSq1xW1gK1Xy3ArNOGZfEg= +golang.org/x/time v0.8.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20200505023115-26f46d2f7ef8/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d h1:vU5i/LfpvrRCpgM/VPfJLg5KjxD3E+hfT1SH+d9zLwg= golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d/go.mod h1:aiJjzUbINMkxbQROHiO6hDPo2LHcIPhhQsa9DLh0yGk= +golang.org/x/tools v0.27.0 h1:qEKojBykQkQ4EynWy4S8Weg69NumxKdn40Fce3uc/8o= +golang.org/x/tools v0.27.0/go.mod h1:sUi0ZgbwW9ZPAq26Ekut+weQPR5eIM6GQLQ1Yjm1H0Q= 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= google.golang.org/appengine v1.6.7 h1:FZR1q0exgwxzPzp/aF+VccGrSfxfPpkBqjIIEq3ru6c= google.golang.org/appengine v1.6.7/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= +google.golang.org/appengine v1.6.8 h1:IhEN5q69dyKagZPYMSdIjS2HqprW324FRQZJcGqPAsM= +google.golang.org/appengine v1.6.8/go.mod h1:1jJ3jBArFh5pcgW8gCtRJnepW8FzD1V44FJffLiz/Ds= 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.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI= -google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= +google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= +google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +google.golang.org/protobuf v1.35.2 h1:8Ar7bF+apOIoThw1EdZl0p1oWvMqTHmpA2fRTyZO8io= +google.golang.org/protobuf v1.35.2/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/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/evanphx/json-patch.v4 v4.12.0 h1:n6jtcsulIzXPJaxegRbvFNNrZDjbij7ny3gmSPG+6V4= +gopkg.in/evanphx/json-patch.v4 v4.12.0/go.mod h1:p8EYWUEYMpynmqDbY58zCKCFZw8pRWMG4EsWvDvM72M= gopkg.in/inf.v0 v0.9.1 h1:73M5CoZyi3ZLMOyDlQh031Cx6N9NDJ2Vvfl76EDAgDc= gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw= gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= @@ -183,25 +264,49 @@ gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= k8s.io/api v0.29.1 h1:DAjwWX/9YT7NQD4INu49ROJuZAAAP/Ijki48GUPzxqw= k8s.io/api v0.29.1/go.mod h1:7Kl10vBRUXhnQQI8YR/R327zXC8eJ7887/+Ybta+RoQ= +k8s.io/api v0.31.2 h1:3wLBbL5Uom/8Zy98GRPXpJ254nEFpl+hwndmk9RwmL0= +k8s.io/api v0.31.2/go.mod h1:bWmGvrGPssSK1ljmLzd3pwCQ9MgoTsRCuK35u6SygUk= k8s.io/apimachinery v0.29.1 h1:KY4/E6km/wLBguvCZv8cKTeOwwOBqFNjwJIdMkMbbRc= k8s.io/apimachinery v0.29.1/go.mod h1:6HVkd1FwxIagpYrHSwJlQqZI3G9LfYWRPAkUvLnXTKU= +k8s.io/apimachinery v0.31.2 h1:i4vUt2hPK56W6mlT7Ry+AO8eEsyxMD1U44NR22CLTYw= +k8s.io/apimachinery v0.31.2/go.mod h1:rsPdaZJfTfLsNJSQzNHQvYoTmxhoOEofxtOsF3rtsMo= k8s.io/client-go v0.29.1 h1:19B/+2NGEwnFLzt0uB5kNJnfTsbV8w6TgQRz9l7ti7A= k8s.io/client-go v0.29.1/go.mod h1:TDG/psL9hdet0TI9mGyHJSgRkW3H9JZk2dNEUS7bRks= +k8s.io/client-go v0.31.2 h1:Y2F4dxU5d3AQj+ybwSMqQnpZH9F30//1ObxOKlTI9yc= +k8s.io/client-go v0.31.2/go.mod h1:NPa74jSVR/+eez2dFsEIHNa+3o09vtNaWwWwb1qSxSs= k8s.io/code-generator v0.29.1 h1:8ba8BdtSmAVHgAMpzThb/fuyQeTRtN7NtN7VjMcDLew= k8s.io/code-generator v0.29.1/go.mod h1:FwFi3C9jCrmbPjekhaCYcYG1n07CYiW1+PAPCockaos= +k8s.io/code-generator v0.31.2 h1:xLWxG0HEpMSHfcM//3u3Ro2Hmc6AyyLINQS//Z2GEOI= +k8s.io/code-generator v0.31.2/go.mod h1:eEQHXgBU/m7LDaToDoiz3t97dUUVyOblQdwOr8rivqc= k8s.io/gengo v0.0.0-20230829151522-9cce18d56c01 h1:pWEwq4Asjm4vjW7vcsmijwBhOr1/shsbSYiWXmNGlks= k8s.io/gengo v0.0.0-20230829151522-9cce18d56c01/go.mod h1:FiNAH4ZV3gBg2Kwh89tzAEV2be7d5xI0vBa/VySYy3E= +k8s.io/gengo v0.0.0-20240911193312-2b36238f13e9 h1:B0l8GxRsVc/tP/uCLBQdAjf2nBARx6u/r2OGuL/CyXQ= +k8s.io/gengo v0.0.0-20240911193312-2b36238f13e9/go.mod h1:FiNAH4ZV3gBg2Kwh89tzAEV2be7d5xI0vBa/VySYy3E= +k8s.io/gengo/v2 v2.0.0-20240911193312-2b36238f13e9 h1:si3PfKm8dDYxgfbeA6orqrtLkvvIeH8UqffFJDl0bz4= +k8s.io/gengo/v2 v2.0.0-20240911193312-2b36238f13e9/go.mod h1:EJykeLsmFC60UQbYJezXkEsG2FLrt0GPNkU5iK5GWxU= k8s.io/klog/v2 v2.2.0/go.mod h1:Od+F08eJP+W3HUb4pSrPpgp9DGU4GzlpG/TmITuYh/Y= k8s.io/klog/v2 v2.120.1 h1:QXU6cPEOIslTGvZaXvFWiP9VKyeet3sawzTOvdXb4Vw= k8s.io/klog/v2 v2.120.1/go.mod h1:3Jpz1GvMt720eyJH1ckRHK1EDfpxISzJ7I9OYgaDtPE= +k8s.io/klog/v2 v2.130.1 h1:n9Xl7H1Xvksem4KFG4PYbdQCQxqc/tTUyrgXaOhHSzk= +k8s.io/klog/v2 v2.130.1/go.mod h1:3Jpz1GvMt720eyJH1ckRHK1EDfpxISzJ7I9OYgaDtPE= k8s.io/kube-openapi v0.0.0-20231010175941-2dd684a91f00 h1:aVUu9fTY98ivBPKR9Y5w/AuzbMm96cd3YHRTU83I780= k8s.io/kube-openapi v0.0.0-20231010175941-2dd684a91f00/go.mod h1:AsvuZPBlUDVuCdzJ87iajxtXuR9oktsTctW/R9wwouA= +k8s.io/kube-openapi v0.0.0-20241105132330-32ad38e42d3f h1:GA7//TjRY9yWGy1poLzYYJJ4JRdzg3+O6e8I+e+8T5Y= +k8s.io/kube-openapi v0.0.0-20241105132330-32ad38e42d3f/go.mod h1:R/HEjbvWI0qdfb8viZUeVZm0X6IZnxAydC7YU42CMw4= k8s.io/utils v0.0.0-20230726121419-3b25d923346b h1:sgn3ZU783SCgtaSJjpcVVlRqd6GSnlTLKgpAAttJvpI= k8s.io/utils v0.0.0-20230726121419-3b25d923346b/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= +k8s.io/utils v0.0.0-20241104163129-6fe5fd82f078 h1:jGnCPejIetjiy2gqaJ5V0NLwTpF4wbQ6cZIItJCSHno= +k8s.io/utils v0.0.0-20241104163129-6fe5fd82f078/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd h1:EDPBXCAspyGV4jQlpZSudPeMmr1bNJefnuqLsRAsHZo= sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd/go.mod h1:B8JuhiUyNFVKdsE8h686QcCxMaH6HrOAZj4vswFpcB0= +sigs.k8s.io/json v0.0.0-20241014173422-cfa47c3a1cc8 h1:gBQPwqORJ8d8/YNZWEjoZs7npUVDpVXUUOFfW6CgAqE= +sigs.k8s.io/json v0.0.0-20241014173422-cfa47c3a1cc8/go.mod h1:mdzfpAEoE6DHQEN0uh9ZbOCuHbLK5wOm7dK4ctXE9Tg= sigs.k8s.io/structured-merge-diff/v4 v4.4.1 h1:150L+0vs/8DA78h1u02ooW1/fFq/Lwr+sGiqlzvrtq4= sigs.k8s.io/structured-merge-diff/v4 v4.4.1/go.mod h1:N8hJocpFajUSSeSJ9bOZ77VzejKZaXsTtZo4/u7Io08= +sigs.k8s.io/structured-merge-diff/v4 v4.4.3 h1:sCP7Vv3xx/CWIuTPVN38lUPx0uw0lcLfzaiDa8Ja01A= +sigs.k8s.io/structured-merge-diff/v4 v4.4.3/go.mod h1:N8f93tFZh9U6vpxwRArLiikrE5/2tiu1w1AGfACIGE4= sigs.k8s.io/yaml v1.2.0/go.mod h1:yfXDCHCao9+ENCvLSE62v9VSji2MKu5jeNfTrofGhJc= sigs.k8s.io/yaml v1.3.0 h1:a2VclLzOGrwOHDiV8EfBGhvjHvP46CtW5j6POvhYGGo= sigs.k8s.io/yaml v1.3.0/go.mod h1:GeOyir5tyXNByN85N/dRIT9es5UQNerPYEKK56eTBm8= +sigs.k8s.io/yaml v1.4.0 h1:Mk1wCc2gy/F0THH0TAp1QYyJNzRm2KCLy3o5ASXVI5E= +sigs.k8s.io/yaml v1.4.0/go.mod h1:Ejl7/uTz7PSA4eKMyQCUTnhZYNmLIl+5c2lQPGR2BPY= diff --git a/pkg/jetstream/apis/jetstream/v1beta1/zz_generated.deepcopy.go b/pkg/jetstream/apis/jetstream/v1beta1/zz_generated.deepcopy.go index 9576377b..ce7e3e7e 100644 --- a/pkg/jetstream/apis/jetstream/v1beta1/zz_generated.deepcopy.go +++ b/pkg/jetstream/apis/jetstream/v1beta1/zz_generated.deepcopy.go @@ -1,6 +1,7 @@ +//go:build !ignore_autogenerated // +build !ignore_autogenerated -// Copyright 2020 The NATS Authors +// Copyright 2024 The NATS Authors // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at diff --git a/pkg/jetstream/apis/jetstream/v1beta2/zz_generated.deepcopy.go b/pkg/jetstream/apis/jetstream/v1beta2/zz_generated.deepcopy.go index 5525e111..20ec90b1 100644 --- a/pkg/jetstream/apis/jetstream/v1beta2/zz_generated.deepcopy.go +++ b/pkg/jetstream/apis/jetstream/v1beta2/zz_generated.deepcopy.go @@ -1,7 +1,7 @@ //go:build !ignore_autogenerated // +build !ignore_autogenerated -// Copyright 2020 The NATS Authors +// Copyright 2024 The NATS Authors // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at diff --git a/pkg/jetstream/generated/applyconfiguration/internal/internal.go b/pkg/jetstream/generated/applyconfiguration/internal/internal.go index 6612a2fb..63b69d16 100644 --- a/pkg/jetstream/generated/applyconfiguration/internal/internal.go +++ b/pkg/jetstream/generated/applyconfiguration/internal/internal.go @@ -1,4 +1,4 @@ -// Copyright 2020 The NATS Authors +// Copyright 2024 The NATS Authors // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at diff --git a/pkg/jetstream/generated/applyconfiguration/jetstream/v1beta2/account.go b/pkg/jetstream/generated/applyconfiguration/jetstream/v1beta2/account.go index 56005dd2..42b91e90 100644 --- a/pkg/jetstream/generated/applyconfiguration/jetstream/v1beta2/account.go +++ b/pkg/jetstream/generated/applyconfiguration/jetstream/v1beta2/account.go @@ -1,4 +1,4 @@ -// Copyright 2020 The NATS Authors +// Copyright 2024 The NATS Authors // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at @@ -21,7 +21,7 @@ import ( v1 "k8s.io/client-go/applyconfigurations/meta/v1" ) -// AccountApplyConfiguration represents an declarative configuration of the Account type for use +// AccountApplyConfiguration represents a declarative configuration of the Account type for use // with apply. type AccountApplyConfiguration struct { v1.TypeMetaApplyConfiguration `json:",inline"` @@ -30,7 +30,7 @@ type AccountApplyConfiguration struct { Status *StatusApplyConfiguration `json:"status,omitempty"` } -// Account constructs an declarative configuration of the Account type for use with +// Account constructs a declarative configuration of the Account type for use with // apply. func Account(name, namespace string) *AccountApplyConfiguration { b := &AccountApplyConfiguration{} @@ -214,3 +214,9 @@ func (b *AccountApplyConfiguration) WithStatus(value *StatusApplyConfiguration) b.Status = value return b } + +// GetName retrieves the value of the Name field in the declarative configuration. +func (b *AccountApplyConfiguration) GetName() *string { + b.ensureObjectMetaApplyConfigurationExists() + return b.Name +} diff --git a/pkg/jetstream/generated/applyconfiguration/jetstream/v1beta2/accountspec.go b/pkg/jetstream/generated/applyconfiguration/jetstream/v1beta2/accountspec.go index a3a27b65..8f916234 100644 --- a/pkg/jetstream/generated/applyconfiguration/jetstream/v1beta2/accountspec.go +++ b/pkg/jetstream/generated/applyconfiguration/jetstream/v1beta2/accountspec.go @@ -1,4 +1,4 @@ -// Copyright 2020 The NATS Authors +// Copyright 2024 The NATS Authors // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at @@ -15,7 +15,7 @@ package v1beta2 -// AccountSpecApplyConfiguration represents an declarative configuration of the AccountSpec type for use +// AccountSpecApplyConfiguration represents a declarative configuration of the AccountSpec type for use // with apply. type AccountSpecApplyConfiguration struct { Servers []string `json:"servers,omitempty"` @@ -23,7 +23,7 @@ type AccountSpecApplyConfiguration struct { Creds *CredsSecretApplyConfiguration `json:"creds,omitempty"` } -// AccountSpecApplyConfiguration constructs an declarative configuration of the AccountSpec type for use with +// AccountSpecApplyConfiguration constructs a declarative configuration of the AccountSpec type for use with // apply. func AccountSpec() *AccountSpecApplyConfiguration { return &AccountSpecApplyConfiguration{} diff --git a/pkg/jetstream/generated/applyconfiguration/jetstream/v1beta2/condition.go b/pkg/jetstream/generated/applyconfiguration/jetstream/v1beta2/condition.go index 8875d87d..de299362 100644 --- a/pkg/jetstream/generated/applyconfiguration/jetstream/v1beta2/condition.go +++ b/pkg/jetstream/generated/applyconfiguration/jetstream/v1beta2/condition.go @@ -1,4 +1,4 @@ -// Copyright 2020 The NATS Authors +// Copyright 2024 The NATS Authors // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at @@ -19,7 +19,7 @@ import ( v1 "k8s.io/api/core/v1" ) -// ConditionApplyConfiguration represents an declarative configuration of the Condition type for use +// ConditionApplyConfiguration represents a declarative configuration of the Condition type for use // with apply. type ConditionApplyConfiguration struct { Type *string `json:"type,omitempty"` @@ -29,7 +29,7 @@ type ConditionApplyConfiguration struct { LastTransitionTime *string `json:"lastTransitionTime,omitempty"` } -// ConditionApplyConfiguration constructs an declarative configuration of the Condition type for use with +// ConditionApplyConfiguration constructs a declarative configuration of the Condition type for use with // apply. func Condition() *ConditionApplyConfiguration { return &ConditionApplyConfiguration{} diff --git a/pkg/jetstream/generated/applyconfiguration/jetstream/v1beta2/consumer.go b/pkg/jetstream/generated/applyconfiguration/jetstream/v1beta2/consumer.go index 144ef962..e9cbc92f 100644 --- a/pkg/jetstream/generated/applyconfiguration/jetstream/v1beta2/consumer.go +++ b/pkg/jetstream/generated/applyconfiguration/jetstream/v1beta2/consumer.go @@ -1,4 +1,4 @@ -// Copyright 2020 The NATS Authors +// Copyright 2024 The NATS Authors // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at @@ -21,7 +21,7 @@ import ( v1 "k8s.io/client-go/applyconfigurations/meta/v1" ) -// ConsumerApplyConfiguration represents an declarative configuration of the Consumer type for use +// ConsumerApplyConfiguration represents a declarative configuration of the Consumer type for use // with apply. type ConsumerApplyConfiguration struct { v1.TypeMetaApplyConfiguration `json:",inline"` @@ -30,7 +30,7 @@ type ConsumerApplyConfiguration struct { Status *StatusApplyConfiguration `json:"status,omitempty"` } -// Consumer constructs an declarative configuration of the Consumer type for use with +// Consumer constructs a declarative configuration of the Consumer type for use with // apply. func Consumer(name, namespace string) *ConsumerApplyConfiguration { b := &ConsumerApplyConfiguration{} @@ -214,3 +214,9 @@ func (b *ConsumerApplyConfiguration) WithStatus(value *StatusApplyConfiguration) b.Status = value return b } + +// GetName retrieves the value of the Name field in the declarative configuration. +func (b *ConsumerApplyConfiguration) GetName() *string { + b.ensureObjectMetaApplyConfigurationExists() + return b.Name +} diff --git a/pkg/jetstream/generated/applyconfiguration/jetstream/v1beta2/consumerspec.go b/pkg/jetstream/generated/applyconfiguration/jetstream/v1beta2/consumerspec.go index 02683d96..8700fe3e 100644 --- a/pkg/jetstream/generated/applyconfiguration/jetstream/v1beta2/consumerspec.go +++ b/pkg/jetstream/generated/applyconfiguration/jetstream/v1beta2/consumerspec.go @@ -1,4 +1,4 @@ -// Copyright 2020 The NATS Authors +// Copyright 2024 The NATS Authors // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at @@ -15,7 +15,7 @@ package v1beta2 -// ConsumerSpecApplyConfiguration represents an declarative configuration of the ConsumerSpec type for use +// ConsumerSpecApplyConfiguration represents a declarative configuration of the ConsumerSpec type for use // with apply. type ConsumerSpecApplyConfiguration struct { AckPolicy *string `json:"ackPolicy,omitempty"` @@ -55,7 +55,7 @@ type ConsumerSpecApplyConfiguration struct { Metadata map[string]string `json:"metadata,omitempty"` } -// ConsumerSpecApplyConfiguration constructs an declarative configuration of the ConsumerSpec type for use with +// ConsumerSpecApplyConfiguration constructs a declarative configuration of the ConsumerSpec type for use with // apply. func ConsumerSpec() *ConsumerSpecApplyConfiguration { return &ConsumerSpecApplyConfiguration{} diff --git a/pkg/jetstream/generated/applyconfiguration/jetstream/v1beta2/credssecret.go b/pkg/jetstream/generated/applyconfiguration/jetstream/v1beta2/credssecret.go index 377f34a0..467fb7a4 100644 --- a/pkg/jetstream/generated/applyconfiguration/jetstream/v1beta2/credssecret.go +++ b/pkg/jetstream/generated/applyconfiguration/jetstream/v1beta2/credssecret.go @@ -1,4 +1,4 @@ -// Copyright 2020 The NATS Authors +// Copyright 2024 The NATS Authors // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at @@ -15,14 +15,14 @@ package v1beta2 -// CredsSecretApplyConfiguration represents an declarative configuration of the CredsSecret type for use +// CredsSecretApplyConfiguration represents a declarative configuration of the CredsSecret type for use // with apply. type CredsSecretApplyConfiguration struct { File *string `json:"file,omitempty"` Secret *SecretRefApplyConfiguration `json:"secret,omitempty"` } -// CredsSecretApplyConfiguration constructs an declarative configuration of the CredsSecret type for use with +// CredsSecretApplyConfiguration constructs a declarative configuration of the CredsSecret type for use with // apply. func CredsSecret() *CredsSecretApplyConfiguration { return &CredsSecretApplyConfiguration{} diff --git a/pkg/jetstream/generated/applyconfiguration/jetstream/v1beta2/republish.go b/pkg/jetstream/generated/applyconfiguration/jetstream/v1beta2/republish.go index 0a639c8f..45873e7e 100644 --- a/pkg/jetstream/generated/applyconfiguration/jetstream/v1beta2/republish.go +++ b/pkg/jetstream/generated/applyconfiguration/jetstream/v1beta2/republish.go @@ -1,4 +1,4 @@ -// Copyright 2020 The NATS Authors +// Copyright 2024 The NATS Authors // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at @@ -15,7 +15,7 @@ package v1beta2 -// RePublishApplyConfiguration represents an declarative configuration of the RePublish type for use +// RePublishApplyConfiguration represents a declarative configuration of the RePublish type for use // with apply. type RePublishApplyConfiguration struct { Source *string `json:"source,omitempty"` @@ -23,7 +23,7 @@ type RePublishApplyConfiguration struct { HeadersOnly *bool `json:"headers_only,omitempty"` } -// RePublishApplyConfiguration constructs an declarative configuration of the RePublish type for use with +// RePublishApplyConfiguration constructs a declarative configuration of the RePublish type for use with // apply. func RePublish() *RePublishApplyConfiguration { return &RePublishApplyConfiguration{} diff --git a/pkg/jetstream/generated/applyconfiguration/jetstream/v1beta2/secretref.go b/pkg/jetstream/generated/applyconfiguration/jetstream/v1beta2/secretref.go index 823655b0..57754747 100644 --- a/pkg/jetstream/generated/applyconfiguration/jetstream/v1beta2/secretref.go +++ b/pkg/jetstream/generated/applyconfiguration/jetstream/v1beta2/secretref.go @@ -1,4 +1,4 @@ -// Copyright 2020 The NATS Authors +// Copyright 2024 The NATS Authors // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at @@ -15,13 +15,13 @@ package v1beta2 -// SecretRefApplyConfiguration represents an declarative configuration of the SecretRef type for use +// SecretRefApplyConfiguration represents a declarative configuration of the SecretRef type for use // with apply. type SecretRefApplyConfiguration struct { Name *string `json:"name,omitempty"` } -// SecretRefApplyConfiguration constructs an declarative configuration of the SecretRef type for use with +// SecretRefApplyConfiguration constructs a declarative configuration of the SecretRef type for use with // apply. func SecretRef() *SecretRefApplyConfiguration { return &SecretRefApplyConfiguration{} diff --git a/pkg/jetstream/generated/applyconfiguration/jetstream/v1beta2/status.go b/pkg/jetstream/generated/applyconfiguration/jetstream/v1beta2/status.go index e9334c4d..cebedf26 100644 --- a/pkg/jetstream/generated/applyconfiguration/jetstream/v1beta2/status.go +++ b/pkg/jetstream/generated/applyconfiguration/jetstream/v1beta2/status.go @@ -1,4 +1,4 @@ -// Copyright 2020 The NATS Authors +// Copyright 2024 The NATS Authors // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at @@ -15,14 +15,14 @@ package v1beta2 -// StatusApplyConfiguration represents an declarative configuration of the Status type for use +// StatusApplyConfiguration represents a declarative configuration of the Status type for use // with apply. type StatusApplyConfiguration struct { ObservedGeneration *int64 `json:"observedGeneration,omitempty"` Conditions []ConditionApplyConfiguration `json:"conditions,omitempty"` } -// StatusApplyConfiguration constructs an declarative configuration of the Status type for use with +// StatusApplyConfiguration constructs a declarative configuration of the Status type for use with // apply. func Status() *StatusApplyConfiguration { return &StatusApplyConfiguration{} diff --git a/pkg/jetstream/generated/applyconfiguration/jetstream/v1beta2/stream.go b/pkg/jetstream/generated/applyconfiguration/jetstream/v1beta2/stream.go index e4c6bef4..dc987f23 100644 --- a/pkg/jetstream/generated/applyconfiguration/jetstream/v1beta2/stream.go +++ b/pkg/jetstream/generated/applyconfiguration/jetstream/v1beta2/stream.go @@ -1,4 +1,4 @@ -// Copyright 2020 The NATS Authors +// Copyright 2024 The NATS Authors // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at @@ -21,7 +21,7 @@ import ( v1 "k8s.io/client-go/applyconfigurations/meta/v1" ) -// StreamApplyConfiguration represents an declarative configuration of the Stream type for use +// StreamApplyConfiguration represents a declarative configuration of the Stream type for use // with apply. type StreamApplyConfiguration struct { v1.TypeMetaApplyConfiguration `json:",inline"` @@ -30,7 +30,7 @@ type StreamApplyConfiguration struct { Status *StatusApplyConfiguration `json:"status,omitempty"` } -// Stream constructs an declarative configuration of the Stream type for use with +// Stream constructs a declarative configuration of the Stream type for use with // apply. func Stream(name, namespace string) *StreamApplyConfiguration { b := &StreamApplyConfiguration{} @@ -214,3 +214,9 @@ func (b *StreamApplyConfiguration) WithStatus(value *StatusApplyConfiguration) * b.Status = value return b } + +// GetName retrieves the value of the Name field in the declarative configuration. +func (b *StreamApplyConfiguration) GetName() *string { + b.ensureObjectMetaApplyConfigurationExists() + return b.Name +} diff --git a/pkg/jetstream/generated/applyconfiguration/jetstream/v1beta2/streamplacement.go b/pkg/jetstream/generated/applyconfiguration/jetstream/v1beta2/streamplacement.go index 654b1865..4063166e 100644 --- a/pkg/jetstream/generated/applyconfiguration/jetstream/v1beta2/streamplacement.go +++ b/pkg/jetstream/generated/applyconfiguration/jetstream/v1beta2/streamplacement.go @@ -1,4 +1,4 @@ -// Copyright 2020 The NATS Authors +// Copyright 2024 The NATS Authors // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at @@ -15,14 +15,14 @@ package v1beta2 -// StreamPlacementApplyConfiguration represents an declarative configuration of the StreamPlacement type for use +// StreamPlacementApplyConfiguration represents a declarative configuration of the StreamPlacement type for use // with apply. type StreamPlacementApplyConfiguration struct { Cluster *string `json:"cluster,omitempty"` Tags []string `json:"tags,omitempty"` } -// StreamPlacementApplyConfiguration constructs an declarative configuration of the StreamPlacement type for use with +// StreamPlacementApplyConfiguration constructs a declarative configuration of the StreamPlacement type for use with // apply. func StreamPlacement() *StreamPlacementApplyConfiguration { return &StreamPlacementApplyConfiguration{} diff --git a/pkg/jetstream/generated/applyconfiguration/jetstream/v1beta2/streamsource.go b/pkg/jetstream/generated/applyconfiguration/jetstream/v1beta2/streamsource.go index e0c3e1a2..0d5e63f0 100644 --- a/pkg/jetstream/generated/applyconfiguration/jetstream/v1beta2/streamsource.go +++ b/pkg/jetstream/generated/applyconfiguration/jetstream/v1beta2/streamsource.go @@ -1,4 +1,4 @@ -// Copyright 2020 The NATS Authors +// Copyright 2024 The NATS Authors // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at @@ -19,7 +19,7 @@ import ( v1beta2 "github.com/nats-io/nack/pkg/jetstream/apis/jetstream/v1beta2" ) -// StreamSourceApplyConfiguration represents an declarative configuration of the StreamSource type for use +// StreamSourceApplyConfiguration represents a declarative configuration of the StreamSource type for use // with apply. type StreamSourceApplyConfiguration struct { Name *string `json:"name,omitempty"` @@ -31,7 +31,7 @@ type StreamSourceApplyConfiguration struct { SubjectTransforms []*v1beta2.SubjectTransform `json:"subjectTransforms,omitempty"` } -// StreamSourceApplyConfiguration constructs an declarative configuration of the StreamSource type for use with +// StreamSourceApplyConfiguration constructs a declarative configuration of the StreamSource type for use with // apply. func StreamSource() *StreamSourceApplyConfiguration { return &StreamSourceApplyConfiguration{} diff --git a/pkg/jetstream/generated/applyconfiguration/jetstream/v1beta2/streamspec.go b/pkg/jetstream/generated/applyconfiguration/jetstream/v1beta2/streamspec.go index e52a845a..7be89f6a 100644 --- a/pkg/jetstream/generated/applyconfiguration/jetstream/v1beta2/streamspec.go +++ b/pkg/jetstream/generated/applyconfiguration/jetstream/v1beta2/streamspec.go @@ -1,4 +1,4 @@ -// Copyright 2020 The NATS Authors +// Copyright 2024 The NATS Authors // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at @@ -19,7 +19,7 @@ import ( jetstreamv1beta2 "github.com/nats-io/nack/pkg/jetstream/apis/jetstream/v1beta2" ) -// StreamSpecApplyConfiguration represents an declarative configuration of the StreamSpec type for use +// StreamSpecApplyConfiguration represents a declarative configuration of the StreamSpec type for use // with apply. type StreamSpecApplyConfiguration struct { Account *string `json:"account,omitempty"` @@ -59,7 +59,7 @@ type StreamSpecApplyConfiguration struct { TLS *TLSApplyConfiguration `json:"tls,omitempty"` } -// StreamSpecApplyConfiguration constructs an declarative configuration of the StreamSpec type for use with +// StreamSpecApplyConfiguration constructs a declarative configuration of the StreamSpec type for use with // apply. func StreamSpec() *StreamSpecApplyConfiguration { return &StreamSpecApplyConfiguration{} diff --git a/pkg/jetstream/generated/applyconfiguration/jetstream/v1beta2/subjecttransform.go b/pkg/jetstream/generated/applyconfiguration/jetstream/v1beta2/subjecttransform.go index 2d4b9455..98fc658b 100644 --- a/pkg/jetstream/generated/applyconfiguration/jetstream/v1beta2/subjecttransform.go +++ b/pkg/jetstream/generated/applyconfiguration/jetstream/v1beta2/subjecttransform.go @@ -1,4 +1,4 @@ -// Copyright 2020 The NATS Authors +// Copyright 2024 The NATS Authors // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at @@ -15,14 +15,14 @@ package v1beta2 -// SubjectTransformApplyConfiguration represents an declarative configuration of the SubjectTransform type for use +// SubjectTransformApplyConfiguration represents a declarative configuration of the SubjectTransform type for use // with apply. type SubjectTransformApplyConfiguration struct { Source *string `json:"source,omitempty"` Dest *string `json:"dest,omitempty"` } -// SubjectTransformApplyConfiguration constructs an declarative configuration of the SubjectTransform type for use with +// SubjectTransformApplyConfiguration constructs a declarative configuration of the SubjectTransform type for use with // apply. func SubjectTransform() *SubjectTransformApplyConfiguration { return &SubjectTransformApplyConfiguration{} diff --git a/pkg/jetstream/generated/applyconfiguration/jetstream/v1beta2/tls.go b/pkg/jetstream/generated/applyconfiguration/jetstream/v1beta2/tls.go index 31b51518..806a9ee5 100644 --- a/pkg/jetstream/generated/applyconfiguration/jetstream/v1beta2/tls.go +++ b/pkg/jetstream/generated/applyconfiguration/jetstream/v1beta2/tls.go @@ -1,4 +1,4 @@ -// Copyright 2020 The NATS Authors +// Copyright 2024 The NATS Authors // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at @@ -15,7 +15,7 @@ package v1beta2 -// TLSApplyConfiguration represents an declarative configuration of the TLS type for use +// TLSApplyConfiguration represents a declarative configuration of the TLS type for use // with apply. type TLSApplyConfiguration struct { ClientCert *string `json:"clientCert,omitempty"` @@ -23,7 +23,7 @@ type TLSApplyConfiguration struct { RootCAs []string `json:"rootCas,omitempty"` } -// TLSApplyConfiguration constructs an declarative configuration of the TLS type for use with +// TLSApplyConfiguration constructs a declarative configuration of the TLS type for use with // apply. func TLS() *TLSApplyConfiguration { return &TLSApplyConfiguration{} diff --git a/pkg/jetstream/generated/applyconfiguration/jetstream/v1beta2/tlssecret.go b/pkg/jetstream/generated/applyconfiguration/jetstream/v1beta2/tlssecret.go index 94eebf45..c593036f 100644 --- a/pkg/jetstream/generated/applyconfiguration/jetstream/v1beta2/tlssecret.go +++ b/pkg/jetstream/generated/applyconfiguration/jetstream/v1beta2/tlssecret.go @@ -1,4 +1,4 @@ -// Copyright 2020 The NATS Authors +// Copyright 2024 The NATS Authors // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at @@ -15,7 +15,7 @@ package v1beta2 -// TLSSecretApplyConfiguration represents an declarative configuration of the TLSSecret type for use +// TLSSecretApplyConfiguration represents a declarative configuration of the TLSSecret type for use // with apply. type TLSSecretApplyConfiguration struct { ClientCert *string `json:"cert,omitempty"` @@ -24,7 +24,7 @@ type TLSSecretApplyConfiguration struct { Secret *SecretRefApplyConfiguration `json:"secret,omitempty"` } -// TLSSecretApplyConfiguration constructs an declarative configuration of the TLSSecret type for use with +// TLSSecretApplyConfiguration constructs a declarative configuration of the TLSSecret type for use with // apply. func TLSSecret() *TLSSecretApplyConfiguration { return &TLSSecretApplyConfiguration{} diff --git a/pkg/jetstream/generated/applyconfiguration/utils.go b/pkg/jetstream/generated/applyconfiguration/utils.go index 4e1751e0..70bd2a00 100644 --- a/pkg/jetstream/generated/applyconfiguration/utils.go +++ b/pkg/jetstream/generated/applyconfiguration/utils.go @@ -1,4 +1,4 @@ -// Copyright 2020 The NATS Authors +// Copyright 2024 The NATS Authors // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at @@ -17,8 +17,11 @@ package applyconfiguration import ( v1beta2 "github.com/nats-io/nack/pkg/jetstream/apis/jetstream/v1beta2" + internal "github.com/nats-io/nack/pkg/jetstream/generated/applyconfiguration/internal" jetstreamv1beta2 "github.com/nats-io/nack/pkg/jetstream/generated/applyconfiguration/jetstream/v1beta2" + runtime "k8s.io/apimachinery/pkg/runtime" schema "k8s.io/apimachinery/pkg/runtime/schema" + testing "k8s.io/client-go/testing" ) // ForKind returns an apply configuration type for the given GroupVersionKind, or nil if no @@ -62,3 +65,7 @@ func ForKind(kind schema.GroupVersionKind) interface{} { } return nil } + +func NewTypeConverter(scheme *runtime.Scheme) *testing.TypeConverter { + return &testing.TypeConverter{Scheme: scheme, TypeResolver: internal.Parser()} +} diff --git a/pkg/jetstream/generated/clientset/versioned/clientset.go b/pkg/jetstream/generated/clientset/versioned/clientset.go index 34ddd785..79f86ce7 100644 --- a/pkg/jetstream/generated/clientset/versioned/clientset.go +++ b/pkg/jetstream/generated/clientset/versioned/clientset.go @@ -1,4 +1,4 @@ -// Copyright 2020 The NATS Authors +// Copyright 2024 The NATS Authors // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at diff --git a/pkg/jetstream/generated/clientset/versioned/fake/clientset_generated.go b/pkg/jetstream/generated/clientset/versioned/fake/clientset_generated.go index eecb1ce6..642b047b 100644 --- a/pkg/jetstream/generated/clientset/versioned/fake/clientset_generated.go +++ b/pkg/jetstream/generated/clientset/versioned/fake/clientset_generated.go @@ -1,4 +1,4 @@ -// Copyright 2020 The NATS Authors +// Copyright 2024 The NATS Authors // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at @@ -16,6 +16,7 @@ package fake import ( + applyconfiguration "github.com/nats-io/nack/pkg/jetstream/generated/applyconfiguration" clientset "github.com/nats-io/nack/pkg/jetstream/generated/clientset/versioned" jetstreamv1beta2 "github.com/nats-io/nack/pkg/jetstream/generated/clientset/versioned/typed/jetstream/v1beta2" fakejetstreamv1beta2 "github.com/nats-io/nack/pkg/jetstream/generated/clientset/versioned/typed/jetstream/v1beta2/fake" @@ -28,8 +29,12 @@ import ( // NewSimpleClientset returns a clientset that will respond with the provided objects. // It's backed by a very simple object tracker that processes creates, updates and deletions as-is, -// without applying any validations and/or defaults. It shouldn't be considered a replacement +// without applying any field management, validations and/or defaults. It shouldn't be considered a replacement // for a real clientset and is mostly useful in simple unit tests. +// +// DEPRECATED: NewClientset replaces this with support for field management, which significantly improves +// server side apply testing. NewClientset is only available when apply configurations are generated (e.g. +// via --with-applyconfig). func NewSimpleClientset(objects ...runtime.Object) *Clientset { o := testing.NewObjectTracker(scheme, codecs.UniversalDecoder()) for _, obj := range objects { @@ -71,6 +76,38 @@ func (c *Clientset) Tracker() testing.ObjectTracker { return c.tracker } +// NewClientset returns a clientset that will respond with the provided objects. +// It's backed by a very simple object tracker that processes creates, updates and deletions as-is, +// without applying any validations and/or defaults. It shouldn't be considered a replacement +// for a real clientset and is mostly useful in simple unit tests. +func NewClientset(objects ...runtime.Object) *Clientset { + o := testing.NewFieldManagedObjectTracker( + scheme, + codecs.UniversalDecoder(), + applyconfiguration.NewTypeConverter(scheme), + ) + for _, obj := range objects { + if err := o.Add(obj); err != nil { + panic(err) + } + } + + cs := &Clientset{tracker: o} + cs.discovery = &fakediscovery.FakeDiscovery{Fake: &cs.Fake} + cs.AddReactor("*", "*", testing.ObjectReaction(o)) + cs.AddWatchReactor("*", func(action testing.Action) (handled bool, ret watch.Interface, err error) { + gvr := action.GetResource() + ns := action.GetNamespace() + watch, err := o.Watch(gvr, ns) + if err != nil { + return false, nil, err + } + return true, watch, nil + }) + + return cs +} + var ( _ clientset.Interface = &Clientset{} _ testing.FakeClient = &Clientset{} diff --git a/pkg/jetstream/generated/clientset/versioned/fake/doc.go b/pkg/jetstream/generated/clientset/versioned/fake/doc.go index 301e6b0d..fc05515c 100644 --- a/pkg/jetstream/generated/clientset/versioned/fake/doc.go +++ b/pkg/jetstream/generated/clientset/versioned/fake/doc.go @@ -1,4 +1,4 @@ -// Copyright 2020 The NATS Authors +// Copyright 2024 The NATS Authors // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at diff --git a/pkg/jetstream/generated/clientset/versioned/fake/register.go b/pkg/jetstream/generated/clientset/versioned/fake/register.go index f15e342d..c64246e0 100644 --- a/pkg/jetstream/generated/clientset/versioned/fake/register.go +++ b/pkg/jetstream/generated/clientset/versioned/fake/register.go @@ -1,4 +1,4 @@ -// Copyright 2020 The NATS Authors +// Copyright 2024 The NATS Authors // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at diff --git a/pkg/jetstream/generated/clientset/versioned/scheme/doc.go b/pkg/jetstream/generated/clientset/versioned/scheme/doc.go index 81abe964..31cfa974 100644 --- a/pkg/jetstream/generated/clientset/versioned/scheme/doc.go +++ b/pkg/jetstream/generated/clientset/versioned/scheme/doc.go @@ -1,4 +1,4 @@ -// Copyright 2020 The NATS Authors +// Copyright 2024 The NATS Authors // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at diff --git a/pkg/jetstream/generated/clientset/versioned/scheme/register.go b/pkg/jetstream/generated/clientset/versioned/scheme/register.go index c80af823..c900985f 100644 --- a/pkg/jetstream/generated/clientset/versioned/scheme/register.go +++ b/pkg/jetstream/generated/clientset/versioned/scheme/register.go @@ -1,4 +1,4 @@ -// Copyright 2020 The NATS Authors +// Copyright 2024 The NATS Authors // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at diff --git a/pkg/jetstream/generated/clientset/versioned/typed/jetstream/v1beta2/account.go b/pkg/jetstream/generated/clientset/versioned/typed/jetstream/v1beta2/account.go index 9bde13cc..b495a525 100644 --- a/pkg/jetstream/generated/clientset/versioned/typed/jetstream/v1beta2/account.go +++ b/pkg/jetstream/generated/clientset/versioned/typed/jetstream/v1beta2/account.go @@ -1,4 +1,4 @@ -// Copyright 2020 The NATS Authors +// Copyright 2024 The NATS Authors // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at @@ -17,9 +17,6 @@ package v1beta2 import ( "context" - json "encoding/json" - "fmt" - "time" v1beta2 "github.com/nats-io/nack/pkg/jetstream/apis/jetstream/v1beta2" jetstreamv1beta2 "github.com/nats-io/nack/pkg/jetstream/generated/applyconfiguration/jetstream/v1beta2" @@ -27,7 +24,7 @@ import ( v1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" + gentype "k8s.io/client-go/gentype" ) // AccountsGetter has a method to return a AccountInterface. @@ -40,6 +37,7 @@ type AccountsGetter interface { type AccountInterface interface { Create(ctx context.Context, account *v1beta2.Account, opts v1.CreateOptions) (*v1beta2.Account, error) Update(ctx context.Context, account *v1beta2.Account, opts v1.UpdateOptions) (*v1beta2.Account, error) + // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). UpdateStatus(ctx context.Context, account *v1beta2.Account, opts v1.UpdateOptions) (*v1beta2.Account, error) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error @@ -48,206 +46,25 @@ type AccountInterface interface { Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta2.Account, err error) Apply(ctx context.Context, account *jetstreamv1beta2.AccountApplyConfiguration, opts v1.ApplyOptions) (result *v1beta2.Account, err error) + // Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). ApplyStatus(ctx context.Context, account *jetstreamv1beta2.AccountApplyConfiguration, opts v1.ApplyOptions) (result *v1beta2.Account, err error) AccountExpansion } // accounts implements AccountInterface type accounts struct { - client rest.Interface - ns string + *gentype.ClientWithListAndApply[*v1beta2.Account, *v1beta2.AccountList, *jetstreamv1beta2.AccountApplyConfiguration] } // newAccounts returns a Accounts func newAccounts(c *JetstreamV1beta2Client, namespace string) *accounts { return &accounts{ - client: c.RESTClient(), - ns: namespace, + gentype.NewClientWithListAndApply[*v1beta2.Account, *v1beta2.AccountList, *jetstreamv1beta2.AccountApplyConfiguration]( + "accounts", + c.RESTClient(), + scheme.ParameterCodec, + namespace, + func() *v1beta2.Account { return &v1beta2.Account{} }, + func() *v1beta2.AccountList { return &v1beta2.AccountList{} }), } } - -// Get takes name of the account, and returns the corresponding account object, and an error if there is any. -func (c *accounts) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta2.Account, err error) { - result = &v1beta2.Account{} - err = c.client.Get(). - Namespace(c.ns). - Resource("accounts"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of Accounts that match those selectors. -func (c *accounts) List(ctx context.Context, opts v1.ListOptions) (result *v1beta2.AccountList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1beta2.AccountList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("accounts"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested accounts. -func (c *accounts) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Namespace(c.ns). - Resource("accounts"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a account and creates it. Returns the server's representation of the account, and an error, if there is any. -func (c *accounts) Create(ctx context.Context, account *v1beta2.Account, opts v1.CreateOptions) (result *v1beta2.Account, err error) { - result = &v1beta2.Account{} - err = c.client.Post(). - Namespace(c.ns). - Resource("accounts"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(account). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a account and updates it. Returns the server's representation of the account, and an error, if there is any. -func (c *accounts) Update(ctx context.Context, account *v1beta2.Account, opts v1.UpdateOptions) (result *v1beta2.Account, err error) { - result = &v1beta2.Account{} - err = c.client.Put(). - Namespace(c.ns). - Resource("accounts"). - Name(account.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(account). - Do(ctx). - Into(result) - return -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *accounts) UpdateStatus(ctx context.Context, account *v1beta2.Account, opts v1.UpdateOptions) (result *v1beta2.Account, err error) { - result = &v1beta2.Account{} - err = c.client.Put(). - Namespace(c.ns). - Resource("accounts"). - Name(account.Name). - SubResource("status"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(account). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the account and deletes it. Returns an error if one occurs. -func (c *accounts) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("accounts"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *accounts) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Namespace(c.ns). - Resource("accounts"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched account. -func (c *accounts) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta2.Account, err error) { - result = &v1beta2.Account{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("accounts"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} - -// Apply takes the given apply declarative configuration, applies it and returns the applied account. -func (c *accounts) Apply(ctx context.Context, account *jetstreamv1beta2.AccountApplyConfiguration, opts v1.ApplyOptions) (result *v1beta2.Account, err error) { - if account == nil { - return nil, fmt.Errorf("account provided to Apply must not be nil") - } - patchOpts := opts.ToPatchOptions() - data, err := json.Marshal(account) - if err != nil { - return nil, err - } - name := account.Name - if name == nil { - return nil, fmt.Errorf("account.Name must be provided to Apply") - } - result = &v1beta2.Account{} - err = c.client.Patch(types.ApplyPatchType). - Namespace(c.ns). - Resource("accounts"). - Name(*name). - VersionedParams(&patchOpts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} - -// ApplyStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). -func (c *accounts) ApplyStatus(ctx context.Context, account *jetstreamv1beta2.AccountApplyConfiguration, opts v1.ApplyOptions) (result *v1beta2.Account, err error) { - if account == nil { - return nil, fmt.Errorf("account provided to Apply must not be nil") - } - patchOpts := opts.ToPatchOptions() - data, err := json.Marshal(account) - if err != nil { - return nil, err - } - - name := account.Name - if name == nil { - return nil, fmt.Errorf("account.Name must be provided to Apply") - } - - result = &v1beta2.Account{} - err = c.client.Patch(types.ApplyPatchType). - Namespace(c.ns). - Resource("accounts"). - Name(*name). - SubResource("status"). - VersionedParams(&patchOpts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/pkg/jetstream/generated/clientset/versioned/typed/jetstream/v1beta2/consumer.go b/pkg/jetstream/generated/clientset/versioned/typed/jetstream/v1beta2/consumer.go index 14430d25..de230925 100644 --- a/pkg/jetstream/generated/clientset/versioned/typed/jetstream/v1beta2/consumer.go +++ b/pkg/jetstream/generated/clientset/versioned/typed/jetstream/v1beta2/consumer.go @@ -1,4 +1,4 @@ -// Copyright 2020 The NATS Authors +// Copyright 2024 The NATS Authors // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at @@ -17,9 +17,6 @@ package v1beta2 import ( "context" - json "encoding/json" - "fmt" - "time" v1beta2 "github.com/nats-io/nack/pkg/jetstream/apis/jetstream/v1beta2" jetstreamv1beta2 "github.com/nats-io/nack/pkg/jetstream/generated/applyconfiguration/jetstream/v1beta2" @@ -27,7 +24,7 @@ import ( v1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" + gentype "k8s.io/client-go/gentype" ) // ConsumersGetter has a method to return a ConsumerInterface. @@ -40,6 +37,7 @@ type ConsumersGetter interface { type ConsumerInterface interface { Create(ctx context.Context, consumer *v1beta2.Consumer, opts v1.CreateOptions) (*v1beta2.Consumer, error) Update(ctx context.Context, consumer *v1beta2.Consumer, opts v1.UpdateOptions) (*v1beta2.Consumer, error) + // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). UpdateStatus(ctx context.Context, consumer *v1beta2.Consumer, opts v1.UpdateOptions) (*v1beta2.Consumer, error) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error @@ -48,206 +46,25 @@ type ConsumerInterface interface { Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta2.Consumer, err error) Apply(ctx context.Context, consumer *jetstreamv1beta2.ConsumerApplyConfiguration, opts v1.ApplyOptions) (result *v1beta2.Consumer, err error) + // Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). ApplyStatus(ctx context.Context, consumer *jetstreamv1beta2.ConsumerApplyConfiguration, opts v1.ApplyOptions) (result *v1beta2.Consumer, err error) ConsumerExpansion } // consumers implements ConsumerInterface type consumers struct { - client rest.Interface - ns string + *gentype.ClientWithListAndApply[*v1beta2.Consumer, *v1beta2.ConsumerList, *jetstreamv1beta2.ConsumerApplyConfiguration] } // newConsumers returns a Consumers func newConsumers(c *JetstreamV1beta2Client, namespace string) *consumers { return &consumers{ - client: c.RESTClient(), - ns: namespace, + gentype.NewClientWithListAndApply[*v1beta2.Consumer, *v1beta2.ConsumerList, *jetstreamv1beta2.ConsumerApplyConfiguration]( + "consumers", + c.RESTClient(), + scheme.ParameterCodec, + namespace, + func() *v1beta2.Consumer { return &v1beta2.Consumer{} }, + func() *v1beta2.ConsumerList { return &v1beta2.ConsumerList{} }), } } - -// Get takes name of the consumer, and returns the corresponding consumer object, and an error if there is any. -func (c *consumers) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta2.Consumer, err error) { - result = &v1beta2.Consumer{} - err = c.client.Get(). - Namespace(c.ns). - Resource("consumers"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of Consumers that match those selectors. -func (c *consumers) List(ctx context.Context, opts v1.ListOptions) (result *v1beta2.ConsumerList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1beta2.ConsumerList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("consumers"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested consumers. -func (c *consumers) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Namespace(c.ns). - Resource("consumers"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a consumer and creates it. Returns the server's representation of the consumer, and an error, if there is any. -func (c *consumers) Create(ctx context.Context, consumer *v1beta2.Consumer, opts v1.CreateOptions) (result *v1beta2.Consumer, err error) { - result = &v1beta2.Consumer{} - err = c.client.Post(). - Namespace(c.ns). - Resource("consumers"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(consumer). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a consumer and updates it. Returns the server's representation of the consumer, and an error, if there is any. -func (c *consumers) Update(ctx context.Context, consumer *v1beta2.Consumer, opts v1.UpdateOptions) (result *v1beta2.Consumer, err error) { - result = &v1beta2.Consumer{} - err = c.client.Put(). - Namespace(c.ns). - Resource("consumers"). - Name(consumer.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(consumer). - Do(ctx). - Into(result) - return -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *consumers) UpdateStatus(ctx context.Context, consumer *v1beta2.Consumer, opts v1.UpdateOptions) (result *v1beta2.Consumer, err error) { - result = &v1beta2.Consumer{} - err = c.client.Put(). - Namespace(c.ns). - Resource("consumers"). - Name(consumer.Name). - SubResource("status"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(consumer). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the consumer and deletes it. Returns an error if one occurs. -func (c *consumers) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("consumers"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *consumers) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Namespace(c.ns). - Resource("consumers"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched consumer. -func (c *consumers) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta2.Consumer, err error) { - result = &v1beta2.Consumer{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("consumers"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} - -// Apply takes the given apply declarative configuration, applies it and returns the applied consumer. -func (c *consumers) Apply(ctx context.Context, consumer *jetstreamv1beta2.ConsumerApplyConfiguration, opts v1.ApplyOptions) (result *v1beta2.Consumer, err error) { - if consumer == nil { - return nil, fmt.Errorf("consumer provided to Apply must not be nil") - } - patchOpts := opts.ToPatchOptions() - data, err := json.Marshal(consumer) - if err != nil { - return nil, err - } - name := consumer.Name - if name == nil { - return nil, fmt.Errorf("consumer.Name must be provided to Apply") - } - result = &v1beta2.Consumer{} - err = c.client.Patch(types.ApplyPatchType). - Namespace(c.ns). - Resource("consumers"). - Name(*name). - VersionedParams(&patchOpts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} - -// ApplyStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). -func (c *consumers) ApplyStatus(ctx context.Context, consumer *jetstreamv1beta2.ConsumerApplyConfiguration, opts v1.ApplyOptions) (result *v1beta2.Consumer, err error) { - if consumer == nil { - return nil, fmt.Errorf("consumer provided to Apply must not be nil") - } - patchOpts := opts.ToPatchOptions() - data, err := json.Marshal(consumer) - if err != nil { - return nil, err - } - - name := consumer.Name - if name == nil { - return nil, fmt.Errorf("consumer.Name must be provided to Apply") - } - - result = &v1beta2.Consumer{} - err = c.client.Patch(types.ApplyPatchType). - Namespace(c.ns). - Resource("consumers"). - Name(*name). - SubResource("status"). - VersionedParams(&patchOpts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/pkg/jetstream/generated/clientset/versioned/typed/jetstream/v1beta2/doc.go b/pkg/jetstream/generated/clientset/versioned/typed/jetstream/v1beta2/doc.go index 2d154137..f278ba06 100644 --- a/pkg/jetstream/generated/clientset/versioned/typed/jetstream/v1beta2/doc.go +++ b/pkg/jetstream/generated/clientset/versioned/typed/jetstream/v1beta2/doc.go @@ -1,4 +1,4 @@ -// Copyright 2020 The NATS Authors +// Copyright 2024 The NATS Authors // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at diff --git a/pkg/jetstream/generated/clientset/versioned/typed/jetstream/v1beta2/fake/doc.go b/pkg/jetstream/generated/clientset/versioned/typed/jetstream/v1beta2/fake/doc.go index dbeb4c5b..bd8826c0 100644 --- a/pkg/jetstream/generated/clientset/versioned/typed/jetstream/v1beta2/fake/doc.go +++ b/pkg/jetstream/generated/clientset/versioned/typed/jetstream/v1beta2/fake/doc.go @@ -1,4 +1,4 @@ -// Copyright 2020 The NATS Authors +// Copyright 2024 The NATS Authors // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at diff --git a/pkg/jetstream/generated/clientset/versioned/typed/jetstream/v1beta2/fake/fake_account.go b/pkg/jetstream/generated/clientset/versioned/typed/jetstream/v1beta2/fake/fake_account.go index 24d1a110..fa2a89e2 100644 --- a/pkg/jetstream/generated/clientset/versioned/typed/jetstream/v1beta2/fake/fake_account.go +++ b/pkg/jetstream/generated/clientset/versioned/typed/jetstream/v1beta2/fake/fake_account.go @@ -1,4 +1,4 @@ -// Copyright 2020 The NATS Authors +// Copyright 2024 The NATS Authors // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at @@ -41,22 +41,24 @@ var accountsKind = v1beta2.SchemeGroupVersion.WithKind("Account") // Get takes name of the account, and returns the corresponding account object, and an error if there is any. func (c *FakeAccounts) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta2.Account, err error) { + emptyResult := &v1beta2.Account{} obj, err := c.Fake. - Invokes(testing.NewGetAction(accountsResource, c.ns, name), &v1beta2.Account{}) + Invokes(testing.NewGetActionWithOptions(accountsResource, c.ns, name, options), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1beta2.Account), err } // List takes label and field selectors, and returns the list of Accounts that match those selectors. func (c *FakeAccounts) List(ctx context.Context, opts v1.ListOptions) (result *v1beta2.AccountList, err error) { + emptyResult := &v1beta2.AccountList{} obj, err := c.Fake. - Invokes(testing.NewListAction(accountsResource, accountsKind, c.ns, opts), &v1beta2.AccountList{}) + Invokes(testing.NewListActionWithOptions(accountsResource, accountsKind, c.ns, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } label, _, _ := testing.ExtractFromListOptions(opts) @@ -75,40 +77,43 @@ func (c *FakeAccounts) List(ctx context.Context, opts v1.ListOptions) (result *v // Watch returns a watch.Interface that watches the requested accounts. func (c *FakeAccounts) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { return c.Fake. - InvokesWatch(testing.NewWatchAction(accountsResource, c.ns, opts)) + InvokesWatch(testing.NewWatchActionWithOptions(accountsResource, c.ns, opts)) } // Create takes the representation of a account and creates it. Returns the server's representation of the account, and an error, if there is any. func (c *FakeAccounts) Create(ctx context.Context, account *v1beta2.Account, opts v1.CreateOptions) (result *v1beta2.Account, err error) { + emptyResult := &v1beta2.Account{} obj, err := c.Fake. - Invokes(testing.NewCreateAction(accountsResource, c.ns, account), &v1beta2.Account{}) + Invokes(testing.NewCreateActionWithOptions(accountsResource, c.ns, account, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1beta2.Account), err } // Update takes the representation of a account and updates it. Returns the server's representation of the account, and an error, if there is any. func (c *FakeAccounts) Update(ctx context.Context, account *v1beta2.Account, opts v1.UpdateOptions) (result *v1beta2.Account, err error) { + emptyResult := &v1beta2.Account{} obj, err := c.Fake. - Invokes(testing.NewUpdateAction(accountsResource, c.ns, account), &v1beta2.Account{}) + Invokes(testing.NewUpdateActionWithOptions(accountsResource, c.ns, account, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1beta2.Account), err } // UpdateStatus was generated because the type contains a Status member. // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *FakeAccounts) UpdateStatus(ctx context.Context, account *v1beta2.Account, opts v1.UpdateOptions) (*v1beta2.Account, error) { +func (c *FakeAccounts) UpdateStatus(ctx context.Context, account *v1beta2.Account, opts v1.UpdateOptions) (result *v1beta2.Account, err error) { + emptyResult := &v1beta2.Account{} obj, err := c.Fake. - Invokes(testing.NewUpdateSubresourceAction(accountsResource, "status", c.ns, account), &v1beta2.Account{}) + Invokes(testing.NewUpdateSubresourceActionWithOptions(accountsResource, "status", c.ns, account, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1beta2.Account), err } @@ -123,7 +128,7 @@ func (c *FakeAccounts) Delete(ctx context.Context, name string, opts v1.DeleteOp // DeleteCollection deletes a collection of objects. func (c *FakeAccounts) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewDeleteCollectionAction(accountsResource, c.ns, listOpts) + action := testing.NewDeleteCollectionActionWithOptions(accountsResource, c.ns, opts, listOpts) _, err := c.Fake.Invokes(action, &v1beta2.AccountList{}) return err @@ -131,11 +136,12 @@ func (c *FakeAccounts) DeleteCollection(ctx context.Context, opts v1.DeleteOptio // Patch applies the patch and returns the patched account. func (c *FakeAccounts) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta2.Account, err error) { + emptyResult := &v1beta2.Account{} obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(accountsResource, c.ns, name, pt, data, subresources...), &v1beta2.Account{}) + Invokes(testing.NewPatchSubresourceActionWithOptions(accountsResource, c.ns, name, pt, data, opts, subresources...), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1beta2.Account), err } @@ -153,11 +159,12 @@ func (c *FakeAccounts) Apply(ctx context.Context, account *jetstreamv1beta2.Acco if name == nil { return nil, fmt.Errorf("account.Name must be provided to Apply") } + emptyResult := &v1beta2.Account{} obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(accountsResource, c.ns, *name, types.ApplyPatchType, data), &v1beta2.Account{}) + Invokes(testing.NewPatchSubresourceActionWithOptions(accountsResource, c.ns, *name, types.ApplyPatchType, data, opts.ToPatchOptions()), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1beta2.Account), err } @@ -176,11 +183,12 @@ func (c *FakeAccounts) ApplyStatus(ctx context.Context, account *jetstreamv1beta if name == nil { return nil, fmt.Errorf("account.Name must be provided to Apply") } + emptyResult := &v1beta2.Account{} obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(accountsResource, c.ns, *name, types.ApplyPatchType, data, "status"), &v1beta2.Account{}) + Invokes(testing.NewPatchSubresourceActionWithOptions(accountsResource, c.ns, *name, types.ApplyPatchType, data, opts.ToPatchOptions(), "status"), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1beta2.Account), err } diff --git a/pkg/jetstream/generated/clientset/versioned/typed/jetstream/v1beta2/fake/fake_consumer.go b/pkg/jetstream/generated/clientset/versioned/typed/jetstream/v1beta2/fake/fake_consumer.go index 993aaa62..72e4d444 100644 --- a/pkg/jetstream/generated/clientset/versioned/typed/jetstream/v1beta2/fake/fake_consumer.go +++ b/pkg/jetstream/generated/clientset/versioned/typed/jetstream/v1beta2/fake/fake_consumer.go @@ -1,4 +1,4 @@ -// Copyright 2020 The NATS Authors +// Copyright 2024 The NATS Authors // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at @@ -41,22 +41,24 @@ var consumersKind = v1beta2.SchemeGroupVersion.WithKind("Consumer") // Get takes name of the consumer, and returns the corresponding consumer object, and an error if there is any. func (c *FakeConsumers) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta2.Consumer, err error) { + emptyResult := &v1beta2.Consumer{} obj, err := c.Fake. - Invokes(testing.NewGetAction(consumersResource, c.ns, name), &v1beta2.Consumer{}) + Invokes(testing.NewGetActionWithOptions(consumersResource, c.ns, name, options), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1beta2.Consumer), err } // List takes label and field selectors, and returns the list of Consumers that match those selectors. func (c *FakeConsumers) List(ctx context.Context, opts v1.ListOptions) (result *v1beta2.ConsumerList, err error) { + emptyResult := &v1beta2.ConsumerList{} obj, err := c.Fake. - Invokes(testing.NewListAction(consumersResource, consumersKind, c.ns, opts), &v1beta2.ConsumerList{}) + Invokes(testing.NewListActionWithOptions(consumersResource, consumersKind, c.ns, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } label, _, _ := testing.ExtractFromListOptions(opts) @@ -75,40 +77,43 @@ func (c *FakeConsumers) List(ctx context.Context, opts v1.ListOptions) (result * // Watch returns a watch.Interface that watches the requested consumers. func (c *FakeConsumers) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { return c.Fake. - InvokesWatch(testing.NewWatchAction(consumersResource, c.ns, opts)) + InvokesWatch(testing.NewWatchActionWithOptions(consumersResource, c.ns, opts)) } // Create takes the representation of a consumer and creates it. Returns the server's representation of the consumer, and an error, if there is any. func (c *FakeConsumers) Create(ctx context.Context, consumer *v1beta2.Consumer, opts v1.CreateOptions) (result *v1beta2.Consumer, err error) { + emptyResult := &v1beta2.Consumer{} obj, err := c.Fake. - Invokes(testing.NewCreateAction(consumersResource, c.ns, consumer), &v1beta2.Consumer{}) + Invokes(testing.NewCreateActionWithOptions(consumersResource, c.ns, consumer, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1beta2.Consumer), err } // Update takes the representation of a consumer and updates it. Returns the server's representation of the consumer, and an error, if there is any. func (c *FakeConsumers) Update(ctx context.Context, consumer *v1beta2.Consumer, opts v1.UpdateOptions) (result *v1beta2.Consumer, err error) { + emptyResult := &v1beta2.Consumer{} obj, err := c.Fake. - Invokes(testing.NewUpdateAction(consumersResource, c.ns, consumer), &v1beta2.Consumer{}) + Invokes(testing.NewUpdateActionWithOptions(consumersResource, c.ns, consumer, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1beta2.Consumer), err } // UpdateStatus was generated because the type contains a Status member. // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *FakeConsumers) UpdateStatus(ctx context.Context, consumer *v1beta2.Consumer, opts v1.UpdateOptions) (*v1beta2.Consumer, error) { +func (c *FakeConsumers) UpdateStatus(ctx context.Context, consumer *v1beta2.Consumer, opts v1.UpdateOptions) (result *v1beta2.Consumer, err error) { + emptyResult := &v1beta2.Consumer{} obj, err := c.Fake. - Invokes(testing.NewUpdateSubresourceAction(consumersResource, "status", c.ns, consumer), &v1beta2.Consumer{}) + Invokes(testing.NewUpdateSubresourceActionWithOptions(consumersResource, "status", c.ns, consumer, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1beta2.Consumer), err } @@ -123,7 +128,7 @@ func (c *FakeConsumers) Delete(ctx context.Context, name string, opts v1.DeleteO // DeleteCollection deletes a collection of objects. func (c *FakeConsumers) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewDeleteCollectionAction(consumersResource, c.ns, listOpts) + action := testing.NewDeleteCollectionActionWithOptions(consumersResource, c.ns, opts, listOpts) _, err := c.Fake.Invokes(action, &v1beta2.ConsumerList{}) return err @@ -131,11 +136,12 @@ func (c *FakeConsumers) DeleteCollection(ctx context.Context, opts v1.DeleteOpti // Patch applies the patch and returns the patched consumer. func (c *FakeConsumers) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta2.Consumer, err error) { + emptyResult := &v1beta2.Consumer{} obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(consumersResource, c.ns, name, pt, data, subresources...), &v1beta2.Consumer{}) + Invokes(testing.NewPatchSubresourceActionWithOptions(consumersResource, c.ns, name, pt, data, opts, subresources...), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1beta2.Consumer), err } @@ -153,11 +159,12 @@ func (c *FakeConsumers) Apply(ctx context.Context, consumer *jetstreamv1beta2.Co if name == nil { return nil, fmt.Errorf("consumer.Name must be provided to Apply") } + emptyResult := &v1beta2.Consumer{} obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(consumersResource, c.ns, *name, types.ApplyPatchType, data), &v1beta2.Consumer{}) + Invokes(testing.NewPatchSubresourceActionWithOptions(consumersResource, c.ns, *name, types.ApplyPatchType, data, opts.ToPatchOptions()), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1beta2.Consumer), err } @@ -176,11 +183,12 @@ func (c *FakeConsumers) ApplyStatus(ctx context.Context, consumer *jetstreamv1be if name == nil { return nil, fmt.Errorf("consumer.Name must be provided to Apply") } + emptyResult := &v1beta2.Consumer{} obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(consumersResource, c.ns, *name, types.ApplyPatchType, data, "status"), &v1beta2.Consumer{}) + Invokes(testing.NewPatchSubresourceActionWithOptions(consumersResource, c.ns, *name, types.ApplyPatchType, data, opts.ToPatchOptions(), "status"), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1beta2.Consumer), err } diff --git a/pkg/jetstream/generated/clientset/versioned/typed/jetstream/v1beta2/fake/fake_jetstream_client.go b/pkg/jetstream/generated/clientset/versioned/typed/jetstream/v1beta2/fake/fake_jetstream_client.go index 66d7cd48..31d69c86 100644 --- a/pkg/jetstream/generated/clientset/versioned/typed/jetstream/v1beta2/fake/fake_jetstream_client.go +++ b/pkg/jetstream/generated/clientset/versioned/typed/jetstream/v1beta2/fake/fake_jetstream_client.go @@ -1,4 +1,4 @@ -// Copyright 2020 The NATS Authors +// Copyright 2024 The NATS Authors // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at diff --git a/pkg/jetstream/generated/clientset/versioned/typed/jetstream/v1beta2/fake/fake_stream.go b/pkg/jetstream/generated/clientset/versioned/typed/jetstream/v1beta2/fake/fake_stream.go index cfe11d0d..da603cc1 100644 --- a/pkg/jetstream/generated/clientset/versioned/typed/jetstream/v1beta2/fake/fake_stream.go +++ b/pkg/jetstream/generated/clientset/versioned/typed/jetstream/v1beta2/fake/fake_stream.go @@ -1,4 +1,4 @@ -// Copyright 2020 The NATS Authors +// Copyright 2024 The NATS Authors // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at @@ -41,22 +41,24 @@ var streamsKind = v1beta2.SchemeGroupVersion.WithKind("Stream") // Get takes name of the stream, and returns the corresponding stream object, and an error if there is any. func (c *FakeStreams) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta2.Stream, err error) { + emptyResult := &v1beta2.Stream{} obj, err := c.Fake. - Invokes(testing.NewGetAction(streamsResource, c.ns, name), &v1beta2.Stream{}) + Invokes(testing.NewGetActionWithOptions(streamsResource, c.ns, name, options), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1beta2.Stream), err } // List takes label and field selectors, and returns the list of Streams that match those selectors. func (c *FakeStreams) List(ctx context.Context, opts v1.ListOptions) (result *v1beta2.StreamList, err error) { + emptyResult := &v1beta2.StreamList{} obj, err := c.Fake. - Invokes(testing.NewListAction(streamsResource, streamsKind, c.ns, opts), &v1beta2.StreamList{}) + Invokes(testing.NewListActionWithOptions(streamsResource, streamsKind, c.ns, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } label, _, _ := testing.ExtractFromListOptions(opts) @@ -75,40 +77,43 @@ func (c *FakeStreams) List(ctx context.Context, opts v1.ListOptions) (result *v1 // Watch returns a watch.Interface that watches the requested streams. func (c *FakeStreams) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { return c.Fake. - InvokesWatch(testing.NewWatchAction(streamsResource, c.ns, opts)) + InvokesWatch(testing.NewWatchActionWithOptions(streamsResource, c.ns, opts)) } // Create takes the representation of a stream and creates it. Returns the server's representation of the stream, and an error, if there is any. func (c *FakeStreams) Create(ctx context.Context, stream *v1beta2.Stream, opts v1.CreateOptions) (result *v1beta2.Stream, err error) { + emptyResult := &v1beta2.Stream{} obj, err := c.Fake. - Invokes(testing.NewCreateAction(streamsResource, c.ns, stream), &v1beta2.Stream{}) + Invokes(testing.NewCreateActionWithOptions(streamsResource, c.ns, stream, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1beta2.Stream), err } // Update takes the representation of a stream and updates it. Returns the server's representation of the stream, and an error, if there is any. func (c *FakeStreams) Update(ctx context.Context, stream *v1beta2.Stream, opts v1.UpdateOptions) (result *v1beta2.Stream, err error) { + emptyResult := &v1beta2.Stream{} obj, err := c.Fake. - Invokes(testing.NewUpdateAction(streamsResource, c.ns, stream), &v1beta2.Stream{}) + Invokes(testing.NewUpdateActionWithOptions(streamsResource, c.ns, stream, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1beta2.Stream), err } // UpdateStatus was generated because the type contains a Status member. // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *FakeStreams) UpdateStatus(ctx context.Context, stream *v1beta2.Stream, opts v1.UpdateOptions) (*v1beta2.Stream, error) { +func (c *FakeStreams) UpdateStatus(ctx context.Context, stream *v1beta2.Stream, opts v1.UpdateOptions) (result *v1beta2.Stream, err error) { + emptyResult := &v1beta2.Stream{} obj, err := c.Fake. - Invokes(testing.NewUpdateSubresourceAction(streamsResource, "status", c.ns, stream), &v1beta2.Stream{}) + Invokes(testing.NewUpdateSubresourceActionWithOptions(streamsResource, "status", c.ns, stream, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1beta2.Stream), err } @@ -123,7 +128,7 @@ func (c *FakeStreams) Delete(ctx context.Context, name string, opts v1.DeleteOpt // DeleteCollection deletes a collection of objects. func (c *FakeStreams) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewDeleteCollectionAction(streamsResource, c.ns, listOpts) + action := testing.NewDeleteCollectionActionWithOptions(streamsResource, c.ns, opts, listOpts) _, err := c.Fake.Invokes(action, &v1beta2.StreamList{}) return err @@ -131,11 +136,12 @@ func (c *FakeStreams) DeleteCollection(ctx context.Context, opts v1.DeleteOption // Patch applies the patch and returns the patched stream. func (c *FakeStreams) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta2.Stream, err error) { + emptyResult := &v1beta2.Stream{} obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(streamsResource, c.ns, name, pt, data, subresources...), &v1beta2.Stream{}) + Invokes(testing.NewPatchSubresourceActionWithOptions(streamsResource, c.ns, name, pt, data, opts, subresources...), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1beta2.Stream), err } @@ -153,11 +159,12 @@ func (c *FakeStreams) Apply(ctx context.Context, stream *jetstreamv1beta2.Stream if name == nil { return nil, fmt.Errorf("stream.Name must be provided to Apply") } + emptyResult := &v1beta2.Stream{} obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(streamsResource, c.ns, *name, types.ApplyPatchType, data), &v1beta2.Stream{}) + Invokes(testing.NewPatchSubresourceActionWithOptions(streamsResource, c.ns, *name, types.ApplyPatchType, data, opts.ToPatchOptions()), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1beta2.Stream), err } @@ -176,11 +183,12 @@ func (c *FakeStreams) ApplyStatus(ctx context.Context, stream *jetstreamv1beta2. if name == nil { return nil, fmt.Errorf("stream.Name must be provided to Apply") } + emptyResult := &v1beta2.Stream{} obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(streamsResource, c.ns, *name, types.ApplyPatchType, data, "status"), &v1beta2.Stream{}) + Invokes(testing.NewPatchSubresourceActionWithOptions(streamsResource, c.ns, *name, types.ApplyPatchType, data, opts.ToPatchOptions(), "status"), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1beta2.Stream), err } diff --git a/pkg/jetstream/generated/clientset/versioned/typed/jetstream/v1beta2/generated_expansion.go b/pkg/jetstream/generated/clientset/versioned/typed/jetstream/v1beta2/generated_expansion.go index cc9ab72a..f3410b9a 100644 --- a/pkg/jetstream/generated/clientset/versioned/typed/jetstream/v1beta2/generated_expansion.go +++ b/pkg/jetstream/generated/clientset/versioned/typed/jetstream/v1beta2/generated_expansion.go @@ -1,4 +1,4 @@ -// Copyright 2020 The NATS Authors +// Copyright 2024 The NATS Authors // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at diff --git a/pkg/jetstream/generated/clientset/versioned/typed/jetstream/v1beta2/jetstream_client.go b/pkg/jetstream/generated/clientset/versioned/typed/jetstream/v1beta2/jetstream_client.go index cbf0da3a..b6115fcc 100644 --- a/pkg/jetstream/generated/clientset/versioned/typed/jetstream/v1beta2/jetstream_client.go +++ b/pkg/jetstream/generated/clientset/versioned/typed/jetstream/v1beta2/jetstream_client.go @@ -1,4 +1,4 @@ -// Copyright 2020 The NATS Authors +// Copyright 2024 The NATS Authors // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at diff --git a/pkg/jetstream/generated/clientset/versioned/typed/jetstream/v1beta2/stream.go b/pkg/jetstream/generated/clientset/versioned/typed/jetstream/v1beta2/stream.go index d68f306f..44008042 100644 --- a/pkg/jetstream/generated/clientset/versioned/typed/jetstream/v1beta2/stream.go +++ b/pkg/jetstream/generated/clientset/versioned/typed/jetstream/v1beta2/stream.go @@ -1,4 +1,4 @@ -// Copyright 2020 The NATS Authors +// Copyright 2024 The NATS Authors // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at @@ -17,9 +17,6 @@ package v1beta2 import ( "context" - json "encoding/json" - "fmt" - "time" v1beta2 "github.com/nats-io/nack/pkg/jetstream/apis/jetstream/v1beta2" jetstreamv1beta2 "github.com/nats-io/nack/pkg/jetstream/generated/applyconfiguration/jetstream/v1beta2" @@ -27,7 +24,7 @@ import ( v1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" + gentype "k8s.io/client-go/gentype" ) // StreamsGetter has a method to return a StreamInterface. @@ -40,6 +37,7 @@ type StreamsGetter interface { type StreamInterface interface { Create(ctx context.Context, stream *v1beta2.Stream, opts v1.CreateOptions) (*v1beta2.Stream, error) Update(ctx context.Context, stream *v1beta2.Stream, opts v1.UpdateOptions) (*v1beta2.Stream, error) + // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). UpdateStatus(ctx context.Context, stream *v1beta2.Stream, opts v1.UpdateOptions) (*v1beta2.Stream, error) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error @@ -48,206 +46,25 @@ type StreamInterface interface { Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta2.Stream, err error) Apply(ctx context.Context, stream *jetstreamv1beta2.StreamApplyConfiguration, opts v1.ApplyOptions) (result *v1beta2.Stream, err error) + // Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). ApplyStatus(ctx context.Context, stream *jetstreamv1beta2.StreamApplyConfiguration, opts v1.ApplyOptions) (result *v1beta2.Stream, err error) StreamExpansion } // streams implements StreamInterface type streams struct { - client rest.Interface - ns string + *gentype.ClientWithListAndApply[*v1beta2.Stream, *v1beta2.StreamList, *jetstreamv1beta2.StreamApplyConfiguration] } // newStreams returns a Streams func newStreams(c *JetstreamV1beta2Client, namespace string) *streams { return &streams{ - client: c.RESTClient(), - ns: namespace, + gentype.NewClientWithListAndApply[*v1beta2.Stream, *v1beta2.StreamList, *jetstreamv1beta2.StreamApplyConfiguration]( + "streams", + c.RESTClient(), + scheme.ParameterCodec, + namespace, + func() *v1beta2.Stream { return &v1beta2.Stream{} }, + func() *v1beta2.StreamList { return &v1beta2.StreamList{} }), } } - -// Get takes name of the stream, and returns the corresponding stream object, and an error if there is any. -func (c *streams) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta2.Stream, err error) { - result = &v1beta2.Stream{} - err = c.client.Get(). - Namespace(c.ns). - Resource("streams"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of Streams that match those selectors. -func (c *streams) List(ctx context.Context, opts v1.ListOptions) (result *v1beta2.StreamList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1beta2.StreamList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("streams"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested streams. -func (c *streams) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Namespace(c.ns). - Resource("streams"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a stream and creates it. Returns the server's representation of the stream, and an error, if there is any. -func (c *streams) Create(ctx context.Context, stream *v1beta2.Stream, opts v1.CreateOptions) (result *v1beta2.Stream, err error) { - result = &v1beta2.Stream{} - err = c.client.Post(). - Namespace(c.ns). - Resource("streams"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(stream). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a stream and updates it. Returns the server's representation of the stream, and an error, if there is any. -func (c *streams) Update(ctx context.Context, stream *v1beta2.Stream, opts v1.UpdateOptions) (result *v1beta2.Stream, err error) { - result = &v1beta2.Stream{} - err = c.client.Put(). - Namespace(c.ns). - Resource("streams"). - Name(stream.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(stream). - Do(ctx). - Into(result) - return -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *streams) UpdateStatus(ctx context.Context, stream *v1beta2.Stream, opts v1.UpdateOptions) (result *v1beta2.Stream, err error) { - result = &v1beta2.Stream{} - err = c.client.Put(). - Namespace(c.ns). - Resource("streams"). - Name(stream.Name). - SubResource("status"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(stream). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the stream and deletes it. Returns an error if one occurs. -func (c *streams) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("streams"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *streams) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Namespace(c.ns). - Resource("streams"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched stream. -func (c *streams) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta2.Stream, err error) { - result = &v1beta2.Stream{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("streams"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} - -// Apply takes the given apply declarative configuration, applies it and returns the applied stream. -func (c *streams) Apply(ctx context.Context, stream *jetstreamv1beta2.StreamApplyConfiguration, opts v1.ApplyOptions) (result *v1beta2.Stream, err error) { - if stream == nil { - return nil, fmt.Errorf("stream provided to Apply must not be nil") - } - patchOpts := opts.ToPatchOptions() - data, err := json.Marshal(stream) - if err != nil { - return nil, err - } - name := stream.Name - if name == nil { - return nil, fmt.Errorf("stream.Name must be provided to Apply") - } - result = &v1beta2.Stream{} - err = c.client.Patch(types.ApplyPatchType). - Namespace(c.ns). - Resource("streams"). - Name(*name). - VersionedParams(&patchOpts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} - -// ApplyStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). -func (c *streams) ApplyStatus(ctx context.Context, stream *jetstreamv1beta2.StreamApplyConfiguration, opts v1.ApplyOptions) (result *v1beta2.Stream, err error) { - if stream == nil { - return nil, fmt.Errorf("stream provided to Apply must not be nil") - } - patchOpts := opts.ToPatchOptions() - data, err := json.Marshal(stream) - if err != nil { - return nil, err - } - - name := stream.Name - if name == nil { - return nil, fmt.Errorf("stream.Name must be provided to Apply") - } - - result = &v1beta2.Stream{} - err = c.client.Patch(types.ApplyPatchType). - Namespace(c.ns). - Resource("streams"). - Name(*name). - SubResource("status"). - VersionedParams(&patchOpts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/pkg/jetstream/generated/informers/externalversions/factory.go b/pkg/jetstream/generated/informers/externalversions/factory.go index 9bc8ae93..8e6d034f 100644 --- a/pkg/jetstream/generated/informers/externalversions/factory.go +++ b/pkg/jetstream/generated/informers/externalversions/factory.go @@ -1,4 +1,4 @@ -// Copyright 2020 The NATS Authors +// Copyright 2024 The NATS Authors // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at @@ -225,6 +225,7 @@ type SharedInformerFactory interface { // Start initializes all requested informers. They are handled in goroutines // which run until the stop channel gets closed. + // Warning: Start does not block. When run in a go-routine, it will race with a later WaitForCacheSync. Start(stopCh <-chan struct{}) // Shutdown marks a factory as shutting down. At that point no new diff --git a/pkg/jetstream/generated/informers/externalversions/generic.go b/pkg/jetstream/generated/informers/externalversions/generic.go index 234209be..e5ba543b 100644 --- a/pkg/jetstream/generated/informers/externalversions/generic.go +++ b/pkg/jetstream/generated/informers/externalversions/generic.go @@ -1,4 +1,4 @@ -// Copyright 2020 The NATS Authors +// Copyright 2024 The NATS Authors // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at diff --git a/pkg/jetstream/generated/informers/externalversions/internalinterfaces/factory_interfaces.go b/pkg/jetstream/generated/informers/externalversions/internalinterfaces/factory_interfaces.go index eef59f4c..5156b38f 100644 --- a/pkg/jetstream/generated/informers/externalversions/internalinterfaces/factory_interfaces.go +++ b/pkg/jetstream/generated/informers/externalversions/internalinterfaces/factory_interfaces.go @@ -1,4 +1,4 @@ -// Copyright 2020 The NATS Authors +// Copyright 2024 The NATS Authors // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at diff --git a/pkg/jetstream/generated/informers/externalversions/jetstream/interface.go b/pkg/jetstream/generated/informers/externalversions/jetstream/interface.go index 580e74a4..ba66ab00 100644 --- a/pkg/jetstream/generated/informers/externalversions/jetstream/interface.go +++ b/pkg/jetstream/generated/informers/externalversions/jetstream/interface.go @@ -1,4 +1,4 @@ -// Copyright 2020 The NATS Authors +// Copyright 2024 The NATS Authors // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at diff --git a/pkg/jetstream/generated/informers/externalversions/jetstream/v1beta2/account.go b/pkg/jetstream/generated/informers/externalversions/jetstream/v1beta2/account.go index 754f3394..da16b01b 100644 --- a/pkg/jetstream/generated/informers/externalversions/jetstream/v1beta2/account.go +++ b/pkg/jetstream/generated/informers/externalversions/jetstream/v1beta2/account.go @@ -1,4 +1,4 @@ -// Copyright 2020 The NATS Authors +// Copyright 2024 The NATS Authors // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at diff --git a/pkg/jetstream/generated/informers/externalversions/jetstream/v1beta2/consumer.go b/pkg/jetstream/generated/informers/externalversions/jetstream/v1beta2/consumer.go index 3bd55a4d..ef400250 100644 --- a/pkg/jetstream/generated/informers/externalversions/jetstream/v1beta2/consumer.go +++ b/pkg/jetstream/generated/informers/externalversions/jetstream/v1beta2/consumer.go @@ -1,4 +1,4 @@ -// Copyright 2020 The NATS Authors +// Copyright 2024 The NATS Authors // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at diff --git a/pkg/jetstream/generated/informers/externalversions/jetstream/v1beta2/interface.go b/pkg/jetstream/generated/informers/externalversions/jetstream/v1beta2/interface.go index f0416b62..05bf3fdb 100644 --- a/pkg/jetstream/generated/informers/externalversions/jetstream/v1beta2/interface.go +++ b/pkg/jetstream/generated/informers/externalversions/jetstream/v1beta2/interface.go @@ -1,4 +1,4 @@ -// Copyright 2020 The NATS Authors +// Copyright 2024 The NATS Authors // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at diff --git a/pkg/jetstream/generated/informers/externalversions/jetstream/v1beta2/stream.go b/pkg/jetstream/generated/informers/externalversions/jetstream/v1beta2/stream.go index a8f7b1e3..d8d7dbd4 100644 --- a/pkg/jetstream/generated/informers/externalversions/jetstream/v1beta2/stream.go +++ b/pkg/jetstream/generated/informers/externalversions/jetstream/v1beta2/stream.go @@ -1,4 +1,4 @@ -// Copyright 2020 The NATS Authors +// Copyright 2024 The NATS Authors // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at diff --git a/pkg/jetstream/generated/listers/jetstream/v1beta2/account.go b/pkg/jetstream/generated/listers/jetstream/v1beta2/account.go index 9f92d449..ef987a4e 100644 --- a/pkg/jetstream/generated/listers/jetstream/v1beta2/account.go +++ b/pkg/jetstream/generated/listers/jetstream/v1beta2/account.go @@ -1,4 +1,4 @@ -// Copyright 2020 The NATS Authors +// Copyright 2024 The NATS Authors // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at @@ -17,8 +17,8 @@ package v1beta2 import ( v1beta2 "github.com/nats-io/nack/pkg/jetstream/apis/jetstream/v1beta2" - "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/listers" "k8s.io/client-go/tools/cache" ) @@ -35,25 +35,17 @@ type AccountLister interface { // accountLister implements the AccountLister interface. type accountLister struct { - indexer cache.Indexer + listers.ResourceIndexer[*v1beta2.Account] } // NewAccountLister returns a new AccountLister. func NewAccountLister(indexer cache.Indexer) AccountLister { - return &accountLister{indexer: indexer} -} - -// List lists all Accounts in the indexer. -func (s *accountLister) List(selector labels.Selector) (ret []*v1beta2.Account, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1beta2.Account)) - }) - return ret, err + return &accountLister{listers.New[*v1beta2.Account](indexer, v1beta2.Resource("account"))} } // Accounts returns an object that can list and get Accounts. func (s *accountLister) Accounts(namespace string) AccountNamespaceLister { - return accountNamespaceLister{indexer: s.indexer, namespace: namespace} + return accountNamespaceLister{listers.NewNamespaced[*v1beta2.Account](s.ResourceIndexer, namespace)} } // AccountNamespaceLister helps list and get Accounts. @@ -71,26 +63,5 @@ type AccountNamespaceLister interface { // accountNamespaceLister implements the AccountNamespaceLister // interface. type accountNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all Accounts in the indexer for a given namespace. -func (s accountNamespaceLister) List(selector labels.Selector) (ret []*v1beta2.Account, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1beta2.Account)) - }) - return ret, err -} - -// Get retrieves the Account from the indexer for a given namespace and name. -func (s accountNamespaceLister) Get(name string) (*v1beta2.Account, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1beta2.Resource("account"), name) - } - return obj.(*v1beta2.Account), nil + listers.ResourceIndexer[*v1beta2.Account] } diff --git a/pkg/jetstream/generated/listers/jetstream/v1beta2/consumer.go b/pkg/jetstream/generated/listers/jetstream/v1beta2/consumer.go index 235323c2..1f46c5a0 100644 --- a/pkg/jetstream/generated/listers/jetstream/v1beta2/consumer.go +++ b/pkg/jetstream/generated/listers/jetstream/v1beta2/consumer.go @@ -1,4 +1,4 @@ -// Copyright 2020 The NATS Authors +// Copyright 2024 The NATS Authors // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at @@ -17,8 +17,8 @@ package v1beta2 import ( v1beta2 "github.com/nats-io/nack/pkg/jetstream/apis/jetstream/v1beta2" - "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/listers" "k8s.io/client-go/tools/cache" ) @@ -35,25 +35,17 @@ type ConsumerLister interface { // consumerLister implements the ConsumerLister interface. type consumerLister struct { - indexer cache.Indexer + listers.ResourceIndexer[*v1beta2.Consumer] } // NewConsumerLister returns a new ConsumerLister. func NewConsumerLister(indexer cache.Indexer) ConsumerLister { - return &consumerLister{indexer: indexer} -} - -// List lists all Consumers in the indexer. -func (s *consumerLister) List(selector labels.Selector) (ret []*v1beta2.Consumer, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1beta2.Consumer)) - }) - return ret, err + return &consumerLister{listers.New[*v1beta2.Consumer](indexer, v1beta2.Resource("consumer"))} } // Consumers returns an object that can list and get Consumers. func (s *consumerLister) Consumers(namespace string) ConsumerNamespaceLister { - return consumerNamespaceLister{indexer: s.indexer, namespace: namespace} + return consumerNamespaceLister{listers.NewNamespaced[*v1beta2.Consumer](s.ResourceIndexer, namespace)} } // ConsumerNamespaceLister helps list and get Consumers. @@ -71,26 +63,5 @@ type ConsumerNamespaceLister interface { // consumerNamespaceLister implements the ConsumerNamespaceLister // interface. type consumerNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all Consumers in the indexer for a given namespace. -func (s consumerNamespaceLister) List(selector labels.Selector) (ret []*v1beta2.Consumer, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1beta2.Consumer)) - }) - return ret, err -} - -// Get retrieves the Consumer from the indexer for a given namespace and name. -func (s consumerNamespaceLister) Get(name string) (*v1beta2.Consumer, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1beta2.Resource("consumer"), name) - } - return obj.(*v1beta2.Consumer), nil + listers.ResourceIndexer[*v1beta2.Consumer] } diff --git a/pkg/jetstream/generated/listers/jetstream/v1beta2/expansion_generated.go b/pkg/jetstream/generated/listers/jetstream/v1beta2/expansion_generated.go index 52cf4e10..5cacc517 100644 --- a/pkg/jetstream/generated/listers/jetstream/v1beta2/expansion_generated.go +++ b/pkg/jetstream/generated/listers/jetstream/v1beta2/expansion_generated.go @@ -1,4 +1,4 @@ -// Copyright 2020 The NATS Authors +// Copyright 2024 The NATS Authors // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at diff --git a/pkg/jetstream/generated/listers/jetstream/v1beta2/stream.go b/pkg/jetstream/generated/listers/jetstream/v1beta2/stream.go index bd28aa24..7151a170 100644 --- a/pkg/jetstream/generated/listers/jetstream/v1beta2/stream.go +++ b/pkg/jetstream/generated/listers/jetstream/v1beta2/stream.go @@ -1,4 +1,4 @@ -// Copyright 2020 The NATS Authors +// Copyright 2024 The NATS Authors // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at @@ -17,8 +17,8 @@ package v1beta2 import ( v1beta2 "github.com/nats-io/nack/pkg/jetstream/apis/jetstream/v1beta2" - "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/listers" "k8s.io/client-go/tools/cache" ) @@ -35,25 +35,17 @@ type StreamLister interface { // streamLister implements the StreamLister interface. type streamLister struct { - indexer cache.Indexer + listers.ResourceIndexer[*v1beta2.Stream] } // NewStreamLister returns a new StreamLister. func NewStreamLister(indexer cache.Indexer) StreamLister { - return &streamLister{indexer: indexer} -} - -// List lists all Streams in the indexer. -func (s *streamLister) List(selector labels.Selector) (ret []*v1beta2.Stream, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1beta2.Stream)) - }) - return ret, err + return &streamLister{listers.New[*v1beta2.Stream](indexer, v1beta2.Resource("stream"))} } // Streams returns an object that can list and get Streams. func (s *streamLister) Streams(namespace string) StreamNamespaceLister { - return streamNamespaceLister{indexer: s.indexer, namespace: namespace} + return streamNamespaceLister{listers.NewNamespaced[*v1beta2.Stream](s.ResourceIndexer, namespace)} } // StreamNamespaceLister helps list and get Streams. @@ -71,26 +63,5 @@ type StreamNamespaceLister interface { // streamNamespaceLister implements the StreamNamespaceLister // interface. type streamNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all Streams in the indexer for a given namespace. -func (s streamNamespaceLister) List(selector labels.Selector) (ret []*v1beta2.Stream, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1beta2.Stream)) - }) - return ret, err -} - -// Get retrieves the Stream from the indexer for a given namespace and name. -func (s streamNamespaceLister) Get(name string) (*v1beta2.Stream, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1beta2.Resource("stream"), name) - } - return obj.(*v1beta2.Stream), nil + listers.ResourceIndexer[*v1beta2.Stream] } diff --git a/pkg/k8scodegen/file-header.txt b/pkg/k8scodegen/file-header.txt index b28b54c4..780fa5e9 100644 --- a/pkg/k8scodegen/file-header.txt +++ b/pkg/k8scodegen/file-header.txt @@ -1,4 +1,4 @@ -// Copyright 2020 The NATS Authors +// Copyright 2024 The NATS Authors // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at