diff --git a/.gitignore b/.gitignore index 05a7332f..b0314f48 100644 --- a/.gitignore +++ b/.gitignore @@ -20,3 +20,11 @@ vendor/ hack/tools +examples/bin/applyconfiguration-gen +examples/bin/client-gen +examples/bin/conversion-gen +examples/bin/deepcopy-gen +examples/bin/defaulter-gen +examples/bin/informer-gen +examples/bin/lister-gen +examples/bin/openapi-gen diff --git a/Makefile b/Makefile index 555cb23f..3f1ae468 100644 --- a/Makefile +++ b/Makefile @@ -20,7 +20,7 @@ TOOLS_DIR=hack/tools GOBIN_DIR := $(abspath $(TOOLS_DIR)) TMPDIR := $(shell mktemp -d) -CONTROLLER_GEN_VER := v0.15.0 +CONTROLLER_GEN_VER := v0.16.1 CONTROLLER_GEN_BIN := controller-gen CONTROLLER_GEN := $(GOBIN_DIR)/$(CONTROLLER_GEN_BIN)-$(CONTROLLER_GEN_VER) export CONTROLLER_GEN @@ -29,13 +29,13 @@ GOLANGCI_LINT_VER := v1.58.1 GOLANGCI_LINT_BIN := golangci-lint GOLANGCI_LINT := $(GOBIN_DIR)/$(GOLANGCI_LINT_BIN)-$(GOLANGCI_LINT_VER) -KUBE_CLIENT_GEN_VER := v0.30.0 +KUBE_CLIENT_GEN_VER := v0.31.0 KUBE_CLIENT_GEN_BIN := client-gen -KUBE_LISTER_GEN_VER := v0.30.0 +KUBE_LISTER_GEN_VER := v0.31.0 KUBE_LISTER_GEN_BIN := lister-gen -KUBE_INFORMER_GEN_VER := v0.30.0 +KUBE_INFORMER_GEN_VER := v0.31.0 KUBE_INFORMER_GEN_BIN := informer-gen -KUBE_APPLYCONFIGURATION_GEN_VER := v0.30.0 +KUBE_APPLYCONFIGURATION_GEN_VER := v0.31.0 KUBE_APPLYCONFIGURATION_GEN_BIN := applyconfiguration-gen KUBE_CLIENT_GEN := $(GOBIN_DIR)/$(KUBE_CLIENT_GEN_BIN)-$(KUBE_CLIENT_GEN_VER) diff --git a/examples/go.mod b/examples/go.mod index 139b8805..96fa3705 100644 --- a/examples/go.mod +++ b/examples/go.mod @@ -8,25 +8,26 @@ require ( github.com/kcp-dev/apimachinery/v2 v2.0.0-alpha.0.0.20240510131959-2fa3992332d0 github.com/kcp-dev/client-go v0.0.0-20230927101349-0416c830e3b1 github.com/kcp-dev/logicalcluster/v3 v3.0.4 - k8s.io/apimachinery v0.30.0 - k8s.io/client-go v0.30.0 + k8s.io/apimachinery v0.31.0 + k8s.io/client-go v0.31.0 sigs.k8s.io/structured-merge-diff/v4 v4.4.1 ) require ( - github.com/davecgh/go-spew v1.1.1 // indirect + github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/emicklei/go-restful/v3 v3.11.0 // indirect github.com/evanphx/json-patch v5.6.0+incompatible // indirect - github.com/go-logr/logr v1.4.1 // 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.19.6 // indirect github.com/go-openapi/jsonreference v0.20.2 // indirect - github.com/go-openapi/swag v0.22.3 // indirect + github.com/go-openapi/swag v0.22.4 // indirect github.com/gogo/protobuf v1.3.2 // 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/google/uuid v1.6.0 // indirect github.com/josharian/intern v1.0.0 // indirect github.com/json-iterator/go v1.1.12 // indirect github.com/mailru/easyjson v0.7.7 // indirect @@ -34,21 +35,22 @@ require ( github.com/modern-go/reflect2 v1.0.2 // indirect github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect github.com/pkg/errors v0.9.1 // indirect - golang.org/x/net v0.23.0 // indirect - golang.org/x/oauth2 v0.10.0 // indirect - golang.org/x/sys v0.18.0 // indirect - golang.org/x/term v0.18.0 // indirect - golang.org/x/text v0.14.0 // indirect + github.com/x448/float16 v0.8.4 // indirect + golang.org/x/net v0.26.0 // indirect + golang.org/x/oauth2 v0.21.0 // indirect + golang.org/x/sys v0.21.0 // indirect + golang.org/x/term v0.21.0 // indirect + golang.org/x/text v0.16.0 // indirect golang.org/x/time v0.3.0 // indirect - google.golang.org/appengine v1.6.7 // indirect - google.golang.org/protobuf v1.33.0 // indirect + google.golang.org/protobuf v1.34.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/api v0.30.0 // indirect - k8s.io/klog/v2 v2.120.1 // indirect + k8s.io/api v0.31.0 // indirect + k8s.io/klog/v2 v2.130.1 // indirect k8s.io/kube-openapi v0.0.0-20240228011516-70dd3763d340 // indirect - k8s.io/utils v0.0.0-20230726121419-3b25d923346b // indirect + k8s.io/utils v0.0.0-20240711033017-18e509b52bc8 // indirect sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect - sigs.k8s.io/yaml v1.3.0 // indirect + sigs.k8s.io/yaml v1.4.0 // indirect ) diff --git a/examples/go.sum b/examples/go.sum index f4bef925..15a075b4 100644 --- a/examples/go.sum +++ b/examples/go.sum @@ -1,24 +1,27 @@ github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= 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/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/evanphx/json-patch v5.6.0+incompatible h1:jBYDEEiFBPxA0v50tFdvOzQQTCvpL6mnFh5mB2/l16U= github.com/evanphx/json-patch v5.6.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk= -github.com/go-logr/logr v1.4.1 h1:pKouT5E8xu9zeFC39JXRDukb6JFQPXM5p5I91188VAQ= -github.com/go-logr/logr v1.4.1/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= +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 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/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/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-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/go-openapi/swag v0.22.4 h1:QLMzNJnMGPRNDCbySlcj1x01tzU8/9LTTL9hZZZogBU= +github.com/go-openapi/swag v0.22.4/go.mod h1:UzaqsxGiab7freDnrUUra0MwWfN/q7tE4j+VcZ0yl14= +github.com/go-task/slim-sprig/v3 v3.0.0 h1:sUs3vkvUymDpBKi3qH1YSqBQk9+9D/8M2mN1vB6EwHI= +github.com/go-task/slim-sprig/v3 v3.0.0/go.mod h1:W848ghGpv3Qj3dhTPRyJypKRiqCdHZiAzKg9hl15HA8= github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= -github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= 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= @@ -29,10 +32,10 @@ github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeN github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= 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/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= -github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/google/pprof v0.0.0-20240525223248-4bfdf5a9a2af h1:kmjWCqn2qkEml422C2Rrd27c3VGxi6a/6HNq8QmHRKM= +github.com/google/pprof v0.0.0-20240525223248-4bfdf5a9a2af/go.mod h1:K1liHPHnj73Fdn/EKuT8nrFqBihUSKXoLYU0BuatOYo= +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/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= @@ -61,16 +64,17 @@ github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9G github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA= github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ= -github.com/onsi/ginkgo/v2 v2.15.0 h1:79HwNRBAZHOEwrczrgSOPy+eFTTlIGELKy5as+ClttY= -github.com/onsi/ginkgo/v2 v2.15.0/go.mod h1:HlxMHtYF57y6Dpf+mc5529KKmSq9h2FpCF+/ZkwUxKM= -github.com/onsi/gomega v1.31.0 h1:54UJxxj6cPInHS3a35wm6BK/F9nHYueZ1NVujHDrnXE= -github.com/onsi/gomega v1.31.0/go.mod h1:DW9aCi7U6Yi40wNVAvT6kzFnEVEI5n3DloYBiKiT6zk= +github.com/onsi/ginkgo/v2 v2.19.0 h1:9Cnnf7UHo57Hy3k6/m5k3dRfGTMXGvxhHFvkDTCTpvA= +github.com/onsi/ginkgo/v2 v2.19.0/go.mod h1:rlwLi9PilAFJ8jCg9UE1QP6VBpd6/xj3SRC0d6TU0To= +github.com/onsi/gomega v1.19.0 h1:4ieX6qQjPP/BfC3mpsAtIGGlxTWPeA3Inl/7DtXw1tw= +github.com/onsi/gomega v1.19.0/go.mod h1:LY+I3pBVzYsTBU1AnDwOSxaYi9WoWiqgwooUqq9yPro= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ= -github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncjaFoBhdsK/akog= +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.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8= +github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99yedzYV+kq4uf4= github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= @@ -80,8 +84,10 @@ github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UV github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= 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= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= @@ -90,48 +96,46 @@ golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPh 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/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.23.0 h1:7EYJ93RZ9vYSZAIb2x3lnuvqO5zneoD6IvWjuhfxjTs= -golang.org/x/net v0.23.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg= -golang.org/x/oauth2 v0.10.0 h1:zHCpF2Khkwy4mMB4bv0U37YtJdTGW8jI0glAApi0Kh8= -golang.org/x/oauth2 v0.10.0/go.mod h1:kTpgurOux7LqtuxjuyZa4Gj2gdezIt/jQtGnNFfypQI= +golang.org/x/net v0.26.0 h1:soB7SVo0PWrY4vPW/+ay0jKDNScG2X9wFeYlXIvJsOQ= +golang.org/x/net v0.26.0/go.mod h1:5YKkiSynbBIh3p6iOc/vibscux0x38BZDkn8sCUPxHE= +golang.org/x/oauth2 v0.21.0 h1:tsimM75w1tF/uws5rbeHzIWxEqElMehnc+iW793zsZs= +golang.org/x/oauth2 v0.21.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/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.18.0 h1:DBdB3niSjOA/O0blCZBqDefyWNYveAYMNF1Wum0DYQ4= -golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/term v0.18.0 h1:FcHjZXDMxI8mM3nwhX9HlKop4C0YQvCVCdwYl2wOtE8= -golang.org/x/term v0.18.0/go.mod h1:ILwASektA3OnRv7amZ1xhE/KTR+u50pbXfZ03+6Nx58= +golang.org/x/sys v0.21.0 h1:rF+pYz3DAGSQAxAu1CbC7catZg4ebC4UIeIhKxBZvws= +golang.org/x/sys v0.21.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/term v0.21.0 h1:WVXCp+/EBEHOj53Rvu+7KiT/iElMrO8ACK16SMZ3jaA= +golang.org/x/term v0.21.0/go.mod h1:ooXLefLobQVslOqselCNF4SxFAaoS6KujMbsGzSDmX0= 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.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= -golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= +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/time v0.3.0 h1:rg5rLMjNzMS1RkNLzCG38eapWhnYLFYXDXj2gOlr8j4= golang.org/x/time v0.3.0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= 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.18.0 h1:k8NLag8AGHnn+PHbl7g43CtqZAwG60vZkLqgyZgIHgQ= -golang.org/x/tools v0.18.0/go.mod h1:GL7B4CwcLLeo59yx/9UWWuNOW1n3VZ4f5axWfML7Lcg= +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/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/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.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg= +google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/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= @@ -140,21 +144,21 @@ gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -k8s.io/api v0.30.0 h1:siWhRq7cNjy2iHssOB9SCGNCl2spiF1dO3dABqZ8niA= -k8s.io/api v0.30.0/go.mod h1:OPlaYhoHs8EQ1ql0R/TsUgaRPhpKNxIMrKQfWUp8QSE= -k8s.io/apimachinery v0.30.0 h1:qxVPsyDM5XS96NIh9Oj6LavoVFYff/Pon9cZeDIkHHA= -k8s.io/apimachinery v0.30.0/go.mod h1:iexa2somDaxdnj7bha06bhb43Zpa6eWH8N8dbqVjTUc= -k8s.io/client-go v0.30.0 h1:sB1AGGlhY/o7KCyCEQ0bPWzYDL0pwOZO4vAtTSh/gJQ= -k8s.io/client-go v0.30.0/go.mod h1:g7li5O5256qe6TYdAMyX/otJqMhIiGgTapdLchhmOaY= -k8s.io/klog/v2 v2.120.1 h1:QXU6cPEOIslTGvZaXvFWiP9VKyeet3sawzTOvdXb4Vw= -k8s.io/klog/v2 v2.120.1/go.mod h1:3Jpz1GvMt720eyJH1ckRHK1EDfpxISzJ7I9OYgaDtPE= +k8s.io/api v0.31.0 h1:b9LiSjR2ym/SzTOlfMHm1tr7/21aD7fSkqgD/CVJBCo= +k8s.io/api v0.31.0/go.mod h1:0YiFF+JfFxMM6+1hQei8FY8M7s1Mth+z/q7eF1aJkTE= +k8s.io/apimachinery v0.31.0 h1:m9jOiSr3FoSSL5WO9bjm1n6B9KROYYgNZOb4tyZ1lBc= +k8s.io/apimachinery v0.31.0/go.mod h1:rsPdaZJfTfLsNJSQzNHQvYoTmxhoOEofxtOsF3rtsMo= +k8s.io/client-go v0.31.0 h1:QqEJzNjbN2Yv1H79SsS+SWnXkBgVu4Pj3CJQgbx0gI8= +k8s.io/client-go v0.31.0/go.mod h1:Y9wvC76g4fLjmU0BA+rV+h2cncoadjvjjkkIGoTLcGU= +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-20240228011516-70dd3763d340 h1:BZqlfIlq5YbRMFko6/PM7FjZpUb45WallggurYhKGag= k8s.io/kube-openapi v0.0.0-20240228011516-70dd3763d340/go.mod h1:yD4MZYeKMBwQKVht279WycxKyM84kkAx2DPrTXaeb98= -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-20240711033017-18e509b52bc8 h1:pUdcCO1Lk/tbT5ztQWOBi5HBgbBP1J8+AsQnQCKsi8A= +k8s.io/utils v0.0.0-20240711033017-18e509b52bc8/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/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/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/examples/pkg/apis/example/v1beta1/types.go b/examples/pkg/apis/example/v1beta1/types.go index e153e640..8445bdd0 100644 --- a/examples/pkg/apis/example/v1beta1/types.go +++ b/examples/pkg/apis/example/v1beta1/types.go @@ -19,7 +19,6 @@ package v1beta1 import metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" // +genclient -// +genclient:skipVerbs=list,watch // TestType is a top-level type. A client is created for it. // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object type TestType struct { diff --git a/examples/pkg/generated/applyconfigurations/example/v1/clustertesttype.go b/examples/pkg/generated/applyconfigurations/example/v1/clustertesttype.go index cfbb64d6..4fc9e35f 100644 --- a/examples/pkg/generated/applyconfigurations/example/v1/clustertesttype.go +++ b/examples/pkg/generated/applyconfigurations/example/v1/clustertesttype.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -// Code generated by applyconfiguration-gen-v0.30. DO NOT EDIT. +// Code generated by applyconfiguration-gen-v0.31. DO NOT EDIT. package v1 @@ -24,7 +24,7 @@ import ( v1 "k8s.io/client-go/applyconfigurations/meta/v1" ) -// ClusterTestTypeApplyConfiguration represents an declarative configuration of the ClusterTestType type for use +// ClusterTestTypeApplyConfiguration represents a declarative configuration of the ClusterTestType type for use // with apply. type ClusterTestTypeApplyConfiguration struct { v1.TypeMetaApplyConfiguration `json:",inline"` @@ -34,7 +34,7 @@ type ClusterTestTypeApplyConfiguration struct { Status *ClusterTestTypeStatusApplyConfiguration `json:"status,omitempty"` } -// ClusterTestType constructs an declarative configuration of the ClusterTestType type for use with +// ClusterTestType constructs a declarative configuration of the ClusterTestType type for use with // apply. func ClusterTestType(name string) *ClusterTestTypeApplyConfiguration { b := &ClusterTestTypeApplyConfiguration{} @@ -225,3 +225,9 @@ func (b *ClusterTestTypeApplyConfiguration) WithStatus(value *ClusterTestTypeSta b.Status = value return b } + +// GetName retrieves the value of the Name field in the declarative configuration. +func (b *ClusterTestTypeApplyConfiguration) GetName() *string { + b.ensureObjectMetaApplyConfigurationExists() + return b.Name +} diff --git a/examples/pkg/generated/applyconfigurations/example/v1/clustertesttypestatus.go b/examples/pkg/generated/applyconfigurations/example/v1/clustertesttypestatus.go index 3314019d..9c966d9a 100644 --- a/examples/pkg/generated/applyconfigurations/example/v1/clustertesttypestatus.go +++ b/examples/pkg/generated/applyconfigurations/example/v1/clustertesttypestatus.go @@ -14,17 +14,17 @@ See the License for the specific language governing permissions and limitations under the License. */ -// Code generated by applyconfiguration-gen-v0.30. DO NOT EDIT. +// Code generated by applyconfiguration-gen-v0.31. DO NOT EDIT. package v1 -// ClusterTestTypeStatusApplyConfiguration represents an declarative configuration of the ClusterTestTypeStatus type for use +// ClusterTestTypeStatusApplyConfiguration represents a declarative configuration of the ClusterTestTypeStatus type for use // with apply. type ClusterTestTypeStatusApplyConfiguration struct { Blah *string `json:"blah,omitempty"` } -// ClusterTestTypeStatusApplyConfiguration constructs an declarative configuration of the ClusterTestTypeStatus type for use with +// ClusterTestTypeStatusApplyConfiguration constructs a declarative configuration of the ClusterTestTypeStatus type for use with // apply. func ClusterTestTypeStatus() *ClusterTestTypeStatusApplyConfiguration { return &ClusterTestTypeStatusApplyConfiguration{} diff --git a/examples/pkg/generated/applyconfigurations/example/v1/testtype.go b/examples/pkg/generated/applyconfigurations/example/v1/testtype.go index 69e576af..c3a9c72f 100644 --- a/examples/pkg/generated/applyconfigurations/example/v1/testtype.go +++ b/examples/pkg/generated/applyconfigurations/example/v1/testtype.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -// Code generated by applyconfiguration-gen-v0.30. DO NOT EDIT. +// Code generated by applyconfiguration-gen-v0.31. DO NOT EDIT. package v1 @@ -24,7 +24,7 @@ import ( v1 "k8s.io/client-go/applyconfigurations/meta/v1" ) -// TestTypeApplyConfiguration represents an declarative configuration of the TestType type for use +// TestTypeApplyConfiguration represents a declarative configuration of the TestType type for use // with apply. type TestTypeApplyConfiguration struct { v1.TypeMetaApplyConfiguration `json:",inline"` @@ -32,7 +32,7 @@ type TestTypeApplyConfiguration struct { APIGroups []string `json:"apiGroups,omitempty"` } -// TestType constructs an declarative configuration of the TestType type for use with +// TestType constructs a declarative configuration of the TestType type for use with // apply. func TestType(name, namespace string) *TestTypeApplyConfiguration { b := &TestTypeApplyConfiguration{} @@ -210,3 +210,9 @@ func (b *TestTypeApplyConfiguration) WithAPIGroups(values ...string) *TestTypeAp } return b } + +// GetName retrieves the value of the Name field in the declarative configuration. +func (b *TestTypeApplyConfiguration) GetName() *string { + b.ensureObjectMetaApplyConfigurationExists() + return b.Name +} diff --git a/examples/pkg/generated/applyconfigurations/example/v1/withoutverbtype.go b/examples/pkg/generated/applyconfigurations/example/v1/withoutverbtype.go index 082a56f5..b5f0f7bb 100644 --- a/examples/pkg/generated/applyconfigurations/example/v1/withoutverbtype.go +++ b/examples/pkg/generated/applyconfigurations/example/v1/withoutverbtype.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -// Code generated by applyconfiguration-gen-v0.30. DO NOT EDIT. +// Code generated by applyconfiguration-gen-v0.31. DO NOT EDIT. package v1 @@ -24,14 +24,14 @@ import ( v1 "k8s.io/client-go/applyconfigurations/meta/v1" ) -// WithoutVerbTypeApplyConfiguration represents an declarative configuration of the WithoutVerbType type for use +// WithoutVerbTypeApplyConfiguration represents a declarative configuration of the WithoutVerbType type for use // with apply. type WithoutVerbTypeApplyConfiguration struct { v1.TypeMetaApplyConfiguration `json:",inline"` *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` } -// WithoutVerbType constructs an declarative configuration of the WithoutVerbType type for use with +// WithoutVerbType constructs a declarative configuration of the WithoutVerbType type for use with // apply. func WithoutVerbType(name, namespace string) *WithoutVerbTypeApplyConfiguration { b := &WithoutVerbTypeApplyConfiguration{} @@ -199,3 +199,9 @@ func (b *WithoutVerbTypeApplyConfiguration) ensureObjectMetaApplyConfigurationEx b.ObjectMetaApplyConfiguration = &v1.ObjectMetaApplyConfiguration{} } } + +// GetName retrieves the value of the Name field in the declarative configuration. +func (b *WithoutVerbTypeApplyConfiguration) GetName() *string { + b.ensureObjectMetaApplyConfigurationExists() + return b.Name +} diff --git a/examples/pkg/generated/applyconfigurations/example/v1alpha1/clustertesttype.go b/examples/pkg/generated/applyconfigurations/example/v1alpha1/clustertesttype.go index 246f43ac..58a0bc60 100644 --- a/examples/pkg/generated/applyconfigurations/example/v1alpha1/clustertesttype.go +++ b/examples/pkg/generated/applyconfigurations/example/v1alpha1/clustertesttype.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -// Code generated by applyconfiguration-gen-v0.30. DO NOT EDIT. +// Code generated by applyconfiguration-gen-v0.31. DO NOT EDIT. package v1alpha1 @@ -24,7 +24,7 @@ import ( v1 "k8s.io/client-go/applyconfigurations/meta/v1" ) -// ClusterTestTypeApplyConfiguration represents an declarative configuration of the ClusterTestType type for use +// ClusterTestTypeApplyConfiguration represents a declarative configuration of the ClusterTestType type for use // with apply. type ClusterTestTypeApplyConfiguration struct { v1.TypeMetaApplyConfiguration `json:",inline"` @@ -34,7 +34,7 @@ type ClusterTestTypeApplyConfiguration struct { Status *ClusterTestTypeStatusApplyConfiguration `json:"status,omitempty"` } -// ClusterTestType constructs an declarative configuration of the ClusterTestType type for use with +// ClusterTestType constructs a declarative configuration of the ClusterTestType type for use with // apply. func ClusterTestType(name string) *ClusterTestTypeApplyConfiguration { b := &ClusterTestTypeApplyConfiguration{} @@ -225,3 +225,9 @@ func (b *ClusterTestTypeApplyConfiguration) WithStatus(value *ClusterTestTypeSta b.Status = value return b } + +// GetName retrieves the value of the Name field in the declarative configuration. +func (b *ClusterTestTypeApplyConfiguration) GetName() *string { + b.ensureObjectMetaApplyConfigurationExists() + return b.Name +} diff --git a/examples/pkg/generated/applyconfigurations/example/v1alpha1/clustertesttypestatus.go b/examples/pkg/generated/applyconfigurations/example/v1alpha1/clustertesttypestatus.go index 2313afe7..b2f8d1d3 100644 --- a/examples/pkg/generated/applyconfigurations/example/v1alpha1/clustertesttypestatus.go +++ b/examples/pkg/generated/applyconfigurations/example/v1alpha1/clustertesttypestatus.go @@ -14,17 +14,17 @@ See the License for the specific language governing permissions and limitations under the License. */ -// Code generated by applyconfiguration-gen-v0.30. DO NOT EDIT. +// Code generated by applyconfiguration-gen-v0.31. DO NOT EDIT. package v1alpha1 -// ClusterTestTypeStatusApplyConfiguration represents an declarative configuration of the ClusterTestTypeStatus type for use +// ClusterTestTypeStatusApplyConfiguration represents a declarative configuration of the ClusterTestTypeStatus type for use // with apply. type ClusterTestTypeStatusApplyConfiguration struct { Blah *string `json:"blah,omitempty"` } -// ClusterTestTypeStatusApplyConfiguration constructs an declarative configuration of the ClusterTestTypeStatus type for use with +// ClusterTestTypeStatusApplyConfiguration constructs a declarative configuration of the ClusterTestTypeStatus type for use with // apply. func ClusterTestTypeStatus() *ClusterTestTypeStatusApplyConfiguration { return &ClusterTestTypeStatusApplyConfiguration{} diff --git a/examples/pkg/generated/applyconfigurations/example/v1alpha1/testtype.go b/examples/pkg/generated/applyconfigurations/example/v1alpha1/testtype.go index cf7f4475..12b329a4 100644 --- a/examples/pkg/generated/applyconfigurations/example/v1alpha1/testtype.go +++ b/examples/pkg/generated/applyconfigurations/example/v1alpha1/testtype.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -// Code generated by applyconfiguration-gen-v0.30. DO NOT EDIT. +// Code generated by applyconfiguration-gen-v0.31. DO NOT EDIT. package v1alpha1 @@ -24,7 +24,7 @@ import ( v1 "k8s.io/client-go/applyconfigurations/meta/v1" ) -// TestTypeApplyConfiguration represents an declarative configuration of the TestType type for use +// TestTypeApplyConfiguration represents a declarative configuration of the TestType type for use // with apply. type TestTypeApplyConfiguration struct { v1.TypeMetaApplyConfiguration `json:",inline"` @@ -32,7 +32,7 @@ type TestTypeApplyConfiguration struct { APIGroups []string `json:"apiGroups,omitempty"` } -// TestType constructs an declarative configuration of the TestType type for use with +// TestType constructs a declarative configuration of the TestType type for use with // apply. func TestType(name, namespace string) *TestTypeApplyConfiguration { b := &TestTypeApplyConfiguration{} @@ -210,3 +210,9 @@ func (b *TestTypeApplyConfiguration) WithAPIGroups(values ...string) *TestTypeAp } return b } + +// GetName retrieves the value of the Name field in the declarative configuration. +func (b *TestTypeApplyConfiguration) GetName() *string { + b.ensureObjectMetaApplyConfigurationExists() + return b.Name +} diff --git a/examples/pkg/generated/applyconfigurations/example/v1beta1/clustertesttype.go b/examples/pkg/generated/applyconfigurations/example/v1beta1/clustertesttype.go index b2a73257..105bcc91 100644 --- a/examples/pkg/generated/applyconfigurations/example/v1beta1/clustertesttype.go +++ b/examples/pkg/generated/applyconfigurations/example/v1beta1/clustertesttype.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -// Code generated by applyconfiguration-gen-v0.30. DO NOT EDIT. +// Code generated by applyconfiguration-gen-v0.31. DO NOT EDIT. package v1beta1 @@ -24,7 +24,7 @@ import ( v1 "k8s.io/client-go/applyconfigurations/meta/v1" ) -// ClusterTestTypeApplyConfiguration represents an declarative configuration of the ClusterTestType type for use +// ClusterTestTypeApplyConfiguration represents a declarative configuration of the ClusterTestType type for use // with apply. type ClusterTestTypeApplyConfiguration struct { v1.TypeMetaApplyConfiguration `json:",inline"` @@ -34,7 +34,7 @@ type ClusterTestTypeApplyConfiguration struct { Status *ClusterTestTypeStatusApplyConfiguration `json:"status,omitempty"` } -// ClusterTestType constructs an declarative configuration of the ClusterTestType type for use with +// ClusterTestType constructs a declarative configuration of the ClusterTestType type for use with // apply. func ClusterTestType(name string) *ClusterTestTypeApplyConfiguration { b := &ClusterTestTypeApplyConfiguration{} @@ -225,3 +225,9 @@ func (b *ClusterTestTypeApplyConfiguration) WithStatus(value *ClusterTestTypeSta b.Status = value return b } + +// GetName retrieves the value of the Name field in the declarative configuration. +func (b *ClusterTestTypeApplyConfiguration) GetName() *string { + b.ensureObjectMetaApplyConfigurationExists() + return b.Name +} diff --git a/examples/pkg/generated/applyconfigurations/example/v1beta1/clustertesttypestatus.go b/examples/pkg/generated/applyconfigurations/example/v1beta1/clustertesttypestatus.go index c781952c..b50e1122 100644 --- a/examples/pkg/generated/applyconfigurations/example/v1beta1/clustertesttypestatus.go +++ b/examples/pkg/generated/applyconfigurations/example/v1beta1/clustertesttypestatus.go @@ -14,17 +14,17 @@ See the License for the specific language governing permissions and limitations under the License. */ -// Code generated by applyconfiguration-gen-v0.30. DO NOT EDIT. +// Code generated by applyconfiguration-gen-v0.31. DO NOT EDIT. package v1beta1 -// ClusterTestTypeStatusApplyConfiguration represents an declarative configuration of the ClusterTestTypeStatus type for use +// ClusterTestTypeStatusApplyConfiguration represents a declarative configuration of the ClusterTestTypeStatus type for use // with apply. type ClusterTestTypeStatusApplyConfiguration struct { Blah *string `json:"blah,omitempty"` } -// ClusterTestTypeStatusApplyConfiguration constructs an declarative configuration of the ClusterTestTypeStatus type for use with +// ClusterTestTypeStatusApplyConfiguration constructs a declarative configuration of the ClusterTestTypeStatus type for use with // apply. func ClusterTestTypeStatus() *ClusterTestTypeStatusApplyConfiguration { return &ClusterTestTypeStatusApplyConfiguration{} diff --git a/examples/pkg/generated/applyconfigurations/example/v1beta1/testtype.go b/examples/pkg/generated/applyconfigurations/example/v1beta1/testtype.go index 76f7314e..cb3b8387 100644 --- a/examples/pkg/generated/applyconfigurations/example/v1beta1/testtype.go +++ b/examples/pkg/generated/applyconfigurations/example/v1beta1/testtype.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -// Code generated by applyconfiguration-gen-v0.30. DO NOT EDIT. +// Code generated by applyconfiguration-gen-v0.31. DO NOT EDIT. package v1beta1 @@ -24,7 +24,7 @@ import ( v1 "k8s.io/client-go/applyconfigurations/meta/v1" ) -// TestTypeApplyConfiguration represents an declarative configuration of the TestType type for use +// TestTypeApplyConfiguration represents a declarative configuration of the TestType type for use // with apply. type TestTypeApplyConfiguration struct { v1.TypeMetaApplyConfiguration `json:",inline"` @@ -32,7 +32,7 @@ type TestTypeApplyConfiguration struct { APIGroups []string `json:"apiGroups,omitempty"` } -// TestType constructs an declarative configuration of the TestType type for use with +// TestType constructs a declarative configuration of the TestType type for use with // apply. func TestType(name, namespace string) *TestTypeApplyConfiguration { b := &TestTypeApplyConfiguration{} @@ -210,3 +210,9 @@ func (b *TestTypeApplyConfiguration) WithAPIGroups(values ...string) *TestTypeAp } return b } + +// GetName retrieves the value of the Name field in the declarative configuration. +func (b *TestTypeApplyConfiguration) GetName() *string { + b.ensureObjectMetaApplyConfigurationExists() + return b.Name +} diff --git a/examples/pkg/generated/applyconfigurations/example/v2/clustertesttype.go b/examples/pkg/generated/applyconfigurations/example/v2/clustertesttype.go index b99f1ba9..cd5e13c5 100644 --- a/examples/pkg/generated/applyconfigurations/example/v2/clustertesttype.go +++ b/examples/pkg/generated/applyconfigurations/example/v2/clustertesttype.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -// Code generated by applyconfiguration-gen-v0.30. DO NOT EDIT. +// Code generated by applyconfiguration-gen-v0.31. DO NOT EDIT. package v2 @@ -24,7 +24,7 @@ import ( v1 "k8s.io/client-go/applyconfigurations/meta/v1" ) -// ClusterTestTypeApplyConfiguration represents an declarative configuration of the ClusterTestType type for use +// ClusterTestTypeApplyConfiguration represents a declarative configuration of the ClusterTestType type for use // with apply. type ClusterTestTypeApplyConfiguration struct { v1.TypeMetaApplyConfiguration `json:",inline"` @@ -34,7 +34,7 @@ type ClusterTestTypeApplyConfiguration struct { Status *ClusterTestTypeStatusApplyConfiguration `json:"status,omitempty"` } -// ClusterTestType constructs an declarative configuration of the ClusterTestType type for use with +// ClusterTestType constructs a declarative configuration of the ClusterTestType type for use with // apply. func ClusterTestType(name string) *ClusterTestTypeApplyConfiguration { b := &ClusterTestTypeApplyConfiguration{} @@ -225,3 +225,9 @@ func (b *ClusterTestTypeApplyConfiguration) WithStatus(value *ClusterTestTypeSta b.Status = value return b } + +// GetName retrieves the value of the Name field in the declarative configuration. +func (b *ClusterTestTypeApplyConfiguration) GetName() *string { + b.ensureObjectMetaApplyConfigurationExists() + return b.Name +} diff --git a/examples/pkg/generated/applyconfigurations/example/v2/clustertesttypestatus.go b/examples/pkg/generated/applyconfigurations/example/v2/clustertesttypestatus.go index 21ab01d9..dfab3fe1 100644 --- a/examples/pkg/generated/applyconfigurations/example/v2/clustertesttypestatus.go +++ b/examples/pkg/generated/applyconfigurations/example/v2/clustertesttypestatus.go @@ -14,17 +14,17 @@ See the License for the specific language governing permissions and limitations under the License. */ -// Code generated by applyconfiguration-gen-v0.30. DO NOT EDIT. +// Code generated by applyconfiguration-gen-v0.31. DO NOT EDIT. package v2 -// ClusterTestTypeStatusApplyConfiguration represents an declarative configuration of the ClusterTestTypeStatus type for use +// ClusterTestTypeStatusApplyConfiguration represents a declarative configuration of the ClusterTestTypeStatus type for use // with apply. type ClusterTestTypeStatusApplyConfiguration struct { Blah *string `json:"blah,omitempty"` } -// ClusterTestTypeStatusApplyConfiguration constructs an declarative configuration of the ClusterTestTypeStatus type for use with +// ClusterTestTypeStatusApplyConfiguration constructs a declarative configuration of the ClusterTestTypeStatus type for use with // apply. func ClusterTestTypeStatus() *ClusterTestTypeStatusApplyConfiguration { return &ClusterTestTypeStatusApplyConfiguration{} diff --git a/examples/pkg/generated/applyconfigurations/example/v2/testtype.go b/examples/pkg/generated/applyconfigurations/example/v2/testtype.go index 4b013d52..d52d0734 100644 --- a/examples/pkg/generated/applyconfigurations/example/v2/testtype.go +++ b/examples/pkg/generated/applyconfigurations/example/v2/testtype.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -// Code generated by applyconfiguration-gen-v0.30. DO NOT EDIT. +// Code generated by applyconfiguration-gen-v0.31. DO NOT EDIT. package v2 @@ -24,7 +24,7 @@ import ( v1 "k8s.io/client-go/applyconfigurations/meta/v1" ) -// TestTypeApplyConfiguration represents an declarative configuration of the TestType type for use +// TestTypeApplyConfiguration represents a declarative configuration of the TestType type for use // with apply. type TestTypeApplyConfiguration struct { v1.TypeMetaApplyConfiguration `json:",inline"` @@ -32,7 +32,7 @@ type TestTypeApplyConfiguration struct { APIGroups []string `json:"apiGroups,omitempty"` } -// TestType constructs an declarative configuration of the TestType type for use with +// TestType constructs a declarative configuration of the TestType type for use with // apply. func TestType(name, namespace string) *TestTypeApplyConfiguration { b := &TestTypeApplyConfiguration{} @@ -210,3 +210,9 @@ func (b *TestTypeApplyConfiguration) WithAPIGroups(values ...string) *TestTypeAp } return b } + +// GetName retrieves the value of the Name field in the declarative configuration. +func (b *TestTypeApplyConfiguration) GetName() *string { + b.ensureObjectMetaApplyConfigurationExists() + return b.Name +} diff --git a/examples/pkg/generated/applyconfigurations/example3/v1/clustertesttype.go b/examples/pkg/generated/applyconfigurations/example3/v1/clustertesttype.go index 427c3f0b..04128cda 100644 --- a/examples/pkg/generated/applyconfigurations/example3/v1/clustertesttype.go +++ b/examples/pkg/generated/applyconfigurations/example3/v1/clustertesttype.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -// Code generated by applyconfiguration-gen-v0.30. DO NOT EDIT. +// Code generated by applyconfiguration-gen-v0.31. DO NOT EDIT. package v1 @@ -24,7 +24,7 @@ import ( v1 "k8s.io/client-go/applyconfigurations/meta/v1" ) -// ClusterTestTypeApplyConfiguration represents an declarative configuration of the ClusterTestType type for use +// ClusterTestTypeApplyConfiguration represents a declarative configuration of the ClusterTestType type for use // with apply. type ClusterTestTypeApplyConfiguration struct { v1.TypeMetaApplyConfiguration `json:",inline"` @@ -34,7 +34,7 @@ type ClusterTestTypeApplyConfiguration struct { Status *ClusterTestTypeStatusApplyConfiguration `json:"status,omitempty"` } -// ClusterTestType constructs an declarative configuration of the ClusterTestType type for use with +// ClusterTestType constructs a declarative configuration of the ClusterTestType type for use with // apply. func ClusterTestType(name string) *ClusterTestTypeApplyConfiguration { b := &ClusterTestTypeApplyConfiguration{} @@ -225,3 +225,9 @@ func (b *ClusterTestTypeApplyConfiguration) WithStatus(value *ClusterTestTypeSta b.Status = value return b } + +// GetName retrieves the value of the Name field in the declarative configuration. +func (b *ClusterTestTypeApplyConfiguration) GetName() *string { + b.ensureObjectMetaApplyConfigurationExists() + return b.Name +} diff --git a/examples/pkg/generated/applyconfigurations/example3/v1/clustertesttypestatus.go b/examples/pkg/generated/applyconfigurations/example3/v1/clustertesttypestatus.go index 3314019d..9c966d9a 100644 --- a/examples/pkg/generated/applyconfigurations/example3/v1/clustertesttypestatus.go +++ b/examples/pkg/generated/applyconfigurations/example3/v1/clustertesttypestatus.go @@ -14,17 +14,17 @@ See the License for the specific language governing permissions and limitations under the License. */ -// Code generated by applyconfiguration-gen-v0.30. DO NOT EDIT. +// Code generated by applyconfiguration-gen-v0.31. DO NOT EDIT. package v1 -// ClusterTestTypeStatusApplyConfiguration represents an declarative configuration of the ClusterTestTypeStatus type for use +// ClusterTestTypeStatusApplyConfiguration represents a declarative configuration of the ClusterTestTypeStatus type for use // with apply. type ClusterTestTypeStatusApplyConfiguration struct { Blah *string `json:"blah,omitempty"` } -// ClusterTestTypeStatusApplyConfiguration constructs an declarative configuration of the ClusterTestTypeStatus type for use with +// ClusterTestTypeStatusApplyConfiguration constructs a declarative configuration of the ClusterTestTypeStatus type for use with // apply. func ClusterTestTypeStatus() *ClusterTestTypeStatusApplyConfiguration { return &ClusterTestTypeStatusApplyConfiguration{} diff --git a/examples/pkg/generated/applyconfigurations/example3/v1/testtype.go b/examples/pkg/generated/applyconfigurations/example3/v1/testtype.go index 6f27968b..b39a1aa7 100644 --- a/examples/pkg/generated/applyconfigurations/example3/v1/testtype.go +++ b/examples/pkg/generated/applyconfigurations/example3/v1/testtype.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -// Code generated by applyconfiguration-gen-v0.30. DO NOT EDIT. +// Code generated by applyconfiguration-gen-v0.31. DO NOT EDIT. package v1 @@ -24,7 +24,7 @@ import ( v1 "k8s.io/client-go/applyconfigurations/meta/v1" ) -// TestTypeApplyConfiguration represents an declarative configuration of the TestType type for use +// TestTypeApplyConfiguration represents a declarative configuration of the TestType type for use // with apply. type TestTypeApplyConfiguration struct { v1.TypeMetaApplyConfiguration `json:",inline"` @@ -32,7 +32,7 @@ type TestTypeApplyConfiguration struct { APIGroups []string `json:"apiGroups,omitempty"` } -// TestType constructs an declarative configuration of the TestType type for use with +// TestType constructs a declarative configuration of the TestType type for use with // apply. func TestType(name, namespace string) *TestTypeApplyConfiguration { b := &TestTypeApplyConfiguration{} @@ -210,3 +210,9 @@ func (b *TestTypeApplyConfiguration) WithAPIGroups(values ...string) *TestTypeAp } return b } + +// GetName retrieves the value of the Name field in the declarative configuration. +func (b *TestTypeApplyConfiguration) GetName() *string { + b.ensureObjectMetaApplyConfigurationExists() + return b.Name +} diff --git a/examples/pkg/generated/applyconfigurations/existinginterfaces/v1/clustertesttype.go b/examples/pkg/generated/applyconfigurations/existinginterfaces/v1/clustertesttype.go index d606444c..a5b7f802 100644 --- a/examples/pkg/generated/applyconfigurations/existinginterfaces/v1/clustertesttype.go +++ b/examples/pkg/generated/applyconfigurations/existinginterfaces/v1/clustertesttype.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -// Code generated by applyconfiguration-gen-v0.30. DO NOT EDIT. +// Code generated by applyconfiguration-gen-v0.31. DO NOT EDIT. package v1 @@ -24,7 +24,7 @@ import ( v1 "k8s.io/client-go/applyconfigurations/meta/v1" ) -// ClusterTestTypeApplyConfiguration represents an declarative configuration of the ClusterTestType type for use +// ClusterTestTypeApplyConfiguration represents a declarative configuration of the ClusterTestType type for use // with apply. type ClusterTestTypeApplyConfiguration struct { v1.TypeMetaApplyConfiguration `json:",inline"` @@ -34,7 +34,7 @@ type ClusterTestTypeApplyConfiguration struct { Status *ClusterTestTypeStatusApplyConfiguration `json:"status,omitempty"` } -// ClusterTestType constructs an declarative configuration of the ClusterTestType type for use with +// ClusterTestType constructs a declarative configuration of the ClusterTestType type for use with // apply. func ClusterTestType(name string) *ClusterTestTypeApplyConfiguration { b := &ClusterTestTypeApplyConfiguration{} @@ -225,3 +225,9 @@ func (b *ClusterTestTypeApplyConfiguration) WithStatus(value *ClusterTestTypeSta b.Status = value return b } + +// GetName retrieves the value of the Name field in the declarative configuration. +func (b *ClusterTestTypeApplyConfiguration) GetName() *string { + b.ensureObjectMetaApplyConfigurationExists() + return b.Name +} diff --git a/examples/pkg/generated/applyconfigurations/existinginterfaces/v1/clustertesttypestatus.go b/examples/pkg/generated/applyconfigurations/existinginterfaces/v1/clustertesttypestatus.go index 3314019d..9c966d9a 100644 --- a/examples/pkg/generated/applyconfigurations/existinginterfaces/v1/clustertesttypestatus.go +++ b/examples/pkg/generated/applyconfigurations/existinginterfaces/v1/clustertesttypestatus.go @@ -14,17 +14,17 @@ See the License for the specific language governing permissions and limitations under the License. */ -// Code generated by applyconfiguration-gen-v0.30. DO NOT EDIT. +// Code generated by applyconfiguration-gen-v0.31. DO NOT EDIT. package v1 -// ClusterTestTypeStatusApplyConfiguration represents an declarative configuration of the ClusterTestTypeStatus type for use +// ClusterTestTypeStatusApplyConfiguration represents a declarative configuration of the ClusterTestTypeStatus type for use // with apply. type ClusterTestTypeStatusApplyConfiguration struct { Blah *string `json:"blah,omitempty"` } -// ClusterTestTypeStatusApplyConfiguration constructs an declarative configuration of the ClusterTestTypeStatus type for use with +// ClusterTestTypeStatusApplyConfiguration constructs a declarative configuration of the ClusterTestTypeStatus type for use with // apply. func ClusterTestTypeStatus() *ClusterTestTypeStatusApplyConfiguration { return &ClusterTestTypeStatusApplyConfiguration{} diff --git a/examples/pkg/generated/applyconfigurations/existinginterfaces/v1/testtype.go b/examples/pkg/generated/applyconfigurations/existinginterfaces/v1/testtype.go index eb172739..2764c64b 100644 --- a/examples/pkg/generated/applyconfigurations/existinginterfaces/v1/testtype.go +++ b/examples/pkg/generated/applyconfigurations/existinginterfaces/v1/testtype.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -// Code generated by applyconfiguration-gen-v0.30. DO NOT EDIT. +// Code generated by applyconfiguration-gen-v0.31. DO NOT EDIT. package v1 @@ -24,7 +24,7 @@ import ( v1 "k8s.io/client-go/applyconfigurations/meta/v1" ) -// TestTypeApplyConfiguration represents an declarative configuration of the TestType type for use +// TestTypeApplyConfiguration represents a declarative configuration of the TestType type for use // with apply. type TestTypeApplyConfiguration struct { v1.TypeMetaApplyConfiguration `json:",inline"` @@ -32,7 +32,7 @@ type TestTypeApplyConfiguration struct { APIGroups []string `json:"apiGroups,omitempty"` } -// TestType constructs an declarative configuration of the TestType type for use with +// TestType constructs a declarative configuration of the TestType type for use with // apply. func TestType(name, namespace string) *TestTypeApplyConfiguration { b := &TestTypeApplyConfiguration{} @@ -210,3 +210,9 @@ func (b *TestTypeApplyConfiguration) WithAPIGroups(values ...string) *TestTypeAp } return b } + +// GetName retrieves the value of the Name field in the declarative configuration. +func (b *TestTypeApplyConfiguration) GetName() *string { + b.ensureObjectMetaApplyConfigurationExists() + return b.Name +} diff --git a/examples/pkg/generated/applyconfigurations/internal/internal.go b/examples/pkg/generated/applyconfigurations/internal/internal.go index 0ca11426..82f62ba5 100644 --- a/examples/pkg/generated/applyconfigurations/internal/internal.go +++ b/examples/pkg/generated/applyconfigurations/internal/internal.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -// Code generated by applyconfiguration-gen-v0.30. DO NOT EDIT. +// Code generated by applyconfiguration-gen-v0.31. DO NOT EDIT. package internal diff --git a/examples/pkg/generated/applyconfigurations/secondexample/v1/clustertesttype.go b/examples/pkg/generated/applyconfigurations/secondexample/v1/clustertesttype.go index 25525299..1d93379e 100644 --- a/examples/pkg/generated/applyconfigurations/secondexample/v1/clustertesttype.go +++ b/examples/pkg/generated/applyconfigurations/secondexample/v1/clustertesttype.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -// Code generated by applyconfiguration-gen-v0.30. DO NOT EDIT. +// Code generated by applyconfiguration-gen-v0.31. DO NOT EDIT. package v1 @@ -24,7 +24,7 @@ import ( v1 "k8s.io/client-go/applyconfigurations/meta/v1" ) -// ClusterTestTypeApplyConfiguration represents an declarative configuration of the ClusterTestType type for use +// ClusterTestTypeApplyConfiguration represents a declarative configuration of the ClusterTestType type for use // with apply. type ClusterTestTypeApplyConfiguration struct { v1.TypeMetaApplyConfiguration `json:",inline"` @@ -34,7 +34,7 @@ type ClusterTestTypeApplyConfiguration struct { Status *ClusterTestTypeStatusApplyConfiguration `json:"status,omitempty"` } -// ClusterTestType constructs an declarative configuration of the ClusterTestType type for use with +// ClusterTestType constructs a declarative configuration of the ClusterTestType type for use with // apply. func ClusterTestType(name string) *ClusterTestTypeApplyConfiguration { b := &ClusterTestTypeApplyConfiguration{} @@ -225,3 +225,9 @@ func (b *ClusterTestTypeApplyConfiguration) WithStatus(value *ClusterTestTypeSta b.Status = value return b } + +// GetName retrieves the value of the Name field in the declarative configuration. +func (b *ClusterTestTypeApplyConfiguration) GetName() *string { + b.ensureObjectMetaApplyConfigurationExists() + return b.Name +} diff --git a/examples/pkg/generated/applyconfigurations/secondexample/v1/clustertesttypestatus.go b/examples/pkg/generated/applyconfigurations/secondexample/v1/clustertesttypestatus.go index 3314019d..9c966d9a 100644 --- a/examples/pkg/generated/applyconfigurations/secondexample/v1/clustertesttypestatus.go +++ b/examples/pkg/generated/applyconfigurations/secondexample/v1/clustertesttypestatus.go @@ -14,17 +14,17 @@ See the License for the specific language governing permissions and limitations under the License. */ -// Code generated by applyconfiguration-gen-v0.30. DO NOT EDIT. +// Code generated by applyconfiguration-gen-v0.31. DO NOT EDIT. package v1 -// ClusterTestTypeStatusApplyConfiguration represents an declarative configuration of the ClusterTestTypeStatus type for use +// ClusterTestTypeStatusApplyConfiguration represents a declarative configuration of the ClusterTestTypeStatus type for use // with apply. type ClusterTestTypeStatusApplyConfiguration struct { Blah *string `json:"blah,omitempty"` } -// ClusterTestTypeStatusApplyConfiguration constructs an declarative configuration of the ClusterTestTypeStatus type for use with +// ClusterTestTypeStatusApplyConfiguration constructs a declarative configuration of the ClusterTestTypeStatus type for use with // apply. func ClusterTestTypeStatus() *ClusterTestTypeStatusApplyConfiguration { return &ClusterTestTypeStatusApplyConfiguration{} diff --git a/examples/pkg/generated/applyconfigurations/secondexample/v1/testtype.go b/examples/pkg/generated/applyconfigurations/secondexample/v1/testtype.go index fc0b1cd1..e4e85de6 100644 --- a/examples/pkg/generated/applyconfigurations/secondexample/v1/testtype.go +++ b/examples/pkg/generated/applyconfigurations/secondexample/v1/testtype.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -// Code generated by applyconfiguration-gen-v0.30. DO NOT EDIT. +// Code generated by applyconfiguration-gen-v0.31. DO NOT EDIT. package v1 @@ -24,7 +24,7 @@ import ( v1 "k8s.io/client-go/applyconfigurations/meta/v1" ) -// TestTypeApplyConfiguration represents an declarative configuration of the TestType type for use +// TestTypeApplyConfiguration represents a declarative configuration of the TestType type for use // with apply. type TestTypeApplyConfiguration struct { v1.TypeMetaApplyConfiguration `json:",inline"` @@ -32,7 +32,7 @@ type TestTypeApplyConfiguration struct { APIGroups []string `json:"apiGroups,omitempty"` } -// TestType constructs an declarative configuration of the TestType type for use with +// TestType constructs a declarative configuration of the TestType type for use with // apply. func TestType(name, namespace string) *TestTypeApplyConfiguration { b := &TestTypeApplyConfiguration{} @@ -210,3 +210,9 @@ func (b *TestTypeApplyConfiguration) WithAPIGroups(values ...string) *TestTypeAp } return b } + +// GetName retrieves the value of the Name field in the declarative configuration. +func (b *TestTypeApplyConfiguration) GetName() *string { + b.ensureObjectMetaApplyConfigurationExists() + return b.Name +} diff --git a/examples/pkg/generated/applyconfigurations/utils.go b/examples/pkg/generated/applyconfigurations/utils.go index 6812203d..780dec64 100644 --- a/examples/pkg/generated/applyconfigurations/utils.go +++ b/examples/pkg/generated/applyconfigurations/utils.go @@ -14,12 +14,14 @@ See the License for the specific language governing permissions and limitations under the License. */ -// Code generated by applyconfiguration-gen-v0.30. DO NOT EDIT. +// Code generated by applyconfiguration-gen-v0.31. DO NOT EDIT. package applyconfigurations import ( + runtime "k8s.io/apimachinery/pkg/runtime" schema "k8s.io/apimachinery/pkg/runtime/schema" + testing "k8s.io/client-go/testing" v1 "acme.corp/pkg/apis/example/v1" v1alpha1 "acme.corp/pkg/apis/example/v1alpha1" @@ -34,6 +36,7 @@ import ( examplev2 "acme.corp/pkg/generated/applyconfigurations/example/v2" applyconfigurationsexample3v1 "acme.corp/pkg/generated/applyconfigurations/example3/v1" applyconfigurationsexistinginterfacesv1 "acme.corp/pkg/generated/applyconfigurations/existinginterfaces/v1" + internal "acme.corp/pkg/generated/applyconfigurations/internal" applyconfigurationssecondexamplev1 "acme.corp/pkg/generated/applyconfigurations/secondexample/v1" ) @@ -102,3 +105,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/examples/pkg/generated/clientset/versioned/clientset.go b/examples/pkg/generated/clientset/versioned/clientset.go index ca0a76c5..cbb2b814 100644 --- a/examples/pkg/generated/clientset/versioned/clientset.go +++ b/examples/pkg/generated/clientset/versioned/clientset.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -// Code generated by client-gen-v0.30. DO NOT EDIT. +// Code generated by client-gen-v0.31. DO NOT EDIT. package versioned diff --git a/examples/pkg/generated/clientset/versioned/fake/clientset_generated.go b/examples/pkg/generated/clientset/versioned/fake/clientset_generated.go index e84e61ec..cc6fb5c2 100644 --- a/examples/pkg/generated/clientset/versioned/fake/clientset_generated.go +++ b/examples/pkg/generated/clientset/versioned/fake/clientset_generated.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -// Code generated by client-gen-v0.30. DO NOT EDIT. +// Code generated by client-gen-v0.31. DO NOT EDIT. package fake @@ -44,8 +44,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 { diff --git a/examples/pkg/generated/clientset/versioned/fake/doc.go b/examples/pkg/generated/clientset/versioned/fake/doc.go index 9af97638..4293c8ce 100644 --- a/examples/pkg/generated/clientset/versioned/fake/doc.go +++ b/examples/pkg/generated/clientset/versioned/fake/doc.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -// Code generated by client-gen-v0.30. DO NOT EDIT. +// Code generated by client-gen-v0.31. DO NOT EDIT. // This package has the automatically generated fake clientset. package fake diff --git a/examples/pkg/generated/clientset/versioned/fake/register.go b/examples/pkg/generated/clientset/versioned/fake/register.go index 9be78be6..0b163682 100644 --- a/examples/pkg/generated/clientset/versioned/fake/register.go +++ b/examples/pkg/generated/clientset/versioned/fake/register.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -// Code generated by client-gen-v0.30. DO NOT EDIT. +// Code generated by client-gen-v0.31. DO NOT EDIT. package fake diff --git a/examples/pkg/generated/clientset/versioned/scheme/doc.go b/examples/pkg/generated/clientset/versioned/scheme/doc.go index 0e3cbd47..0ba73696 100644 --- a/examples/pkg/generated/clientset/versioned/scheme/doc.go +++ b/examples/pkg/generated/clientset/versioned/scheme/doc.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -// Code generated by client-gen-v0.30. DO NOT EDIT. +// Code generated by client-gen-v0.31. DO NOT EDIT. // This package contains the scheme of the automatically generated clientset. package scheme diff --git a/examples/pkg/generated/clientset/versioned/scheme/register.go b/examples/pkg/generated/clientset/versioned/scheme/register.go index 25d46540..4dde88ef 100644 --- a/examples/pkg/generated/clientset/versioned/scheme/register.go +++ b/examples/pkg/generated/clientset/versioned/scheme/register.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -// Code generated by client-gen-v0.30. DO NOT EDIT. +// Code generated by client-gen-v0.31. DO NOT EDIT. package scheme diff --git a/examples/pkg/generated/clientset/versioned/typed/example/v1/clustertesttype.go b/examples/pkg/generated/clientset/versioned/typed/example/v1/clustertesttype.go index 11ce0b24..1a5f726d 100644 --- a/examples/pkg/generated/clientset/versioned/typed/example/v1/clustertesttype.go +++ b/examples/pkg/generated/clientset/versioned/typed/example/v1/clustertesttype.go @@ -14,18 +14,17 @@ See the License for the specific language governing permissions and limitations under the License. */ -// Code generated by client-gen-v0.30. DO NOT EDIT. +// Code generated by client-gen-v0.31. DO NOT EDIT. package v1 import ( "context" - "time" metav1 "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" v1 "acme.corp/pkg/apis/example/v1" scheme "acme.corp/pkg/generated/clientset/versioned/scheme" @@ -41,6 +40,7 @@ type ClusterTestTypesGetter interface { type ClusterTestTypeInterface interface { Create(ctx context.Context, clusterTestType *v1.ClusterTestType, opts metav1.CreateOptions) (*v1.ClusterTestType, error) Update(ctx context.Context, clusterTestType *v1.ClusterTestType, opts metav1.UpdateOptions) (*v1.ClusterTestType, error) + // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). UpdateStatus(ctx context.Context, clusterTestType *v1.ClusterTestType, opts metav1.UpdateOptions) (*v1.ClusterTestType, error) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error @@ -53,133 +53,18 @@ type ClusterTestTypeInterface interface { // clusterTestTypes implements ClusterTestTypeInterface type clusterTestTypes struct { - client rest.Interface + *gentype.ClientWithList[*v1.ClusterTestType, *v1.ClusterTestTypeList] } // newClusterTestTypes returns a ClusterTestTypes func newClusterTestTypes(c *ExampleV1Client) *clusterTestTypes { return &clusterTestTypes{ - client: c.RESTClient(), + gentype.NewClientWithList[*v1.ClusterTestType, *v1.ClusterTestTypeList]( + "clustertesttypes", + c.RESTClient(), + scheme.ParameterCodec, + "", + func() *v1.ClusterTestType { return &v1.ClusterTestType{} }, + func() *v1.ClusterTestTypeList { return &v1.ClusterTestTypeList{} }), } } - -// Get takes name of the clusterTestType, and returns the corresponding clusterTestType object, and an error if there is any. -func (c *clusterTestTypes) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.ClusterTestType, err error) { - result = &v1.ClusterTestType{} - err = c.client.Get(). - Resource("clustertesttypes"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of ClusterTestTypes that match those selectors. -func (c *clusterTestTypes) List(ctx context.Context, opts metav1.ListOptions) (result *v1.ClusterTestTypeList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1.ClusterTestTypeList{} - err = c.client.Get(). - Resource("clustertesttypes"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested clusterTestTypes. -func (c *clusterTestTypes) Watch(ctx context.Context, opts metav1.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(). - Resource("clustertesttypes"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a clusterTestType and creates it. Returns the server's representation of the clusterTestType, and an error, if there is any. -func (c *clusterTestTypes) Create(ctx context.Context, clusterTestType *v1.ClusterTestType, opts metav1.CreateOptions) (result *v1.ClusterTestType, err error) { - result = &v1.ClusterTestType{} - err = c.client.Post(). - Resource("clustertesttypes"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(clusterTestType). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a clusterTestType and updates it. Returns the server's representation of the clusterTestType, and an error, if there is any. -func (c *clusterTestTypes) Update(ctx context.Context, clusterTestType *v1.ClusterTestType, opts metav1.UpdateOptions) (result *v1.ClusterTestType, err error) { - result = &v1.ClusterTestType{} - err = c.client.Put(). - Resource("clustertesttypes"). - Name(clusterTestType.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(clusterTestType). - 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 *clusterTestTypes) UpdateStatus(ctx context.Context, clusterTestType *v1.ClusterTestType, opts metav1.UpdateOptions) (result *v1.ClusterTestType, err error) { - result = &v1.ClusterTestType{} - err = c.client.Put(). - Resource("clustertesttypes"). - Name(clusterTestType.Name). - SubResource("status"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(clusterTestType). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the clusterTestType and deletes it. Returns an error if one occurs. -func (c *clusterTestTypes) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { - return c.client.Delete(). - Resource("clustertesttypes"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *clusterTestTypes) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Resource("clustertesttypes"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched clusterTestType. -func (c *clusterTestTypes) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.ClusterTestType, err error) { - result = &v1.ClusterTestType{} - err = c.client.Patch(pt). - Resource("clustertesttypes"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/examples/pkg/generated/clientset/versioned/typed/example/v1/doc.go b/examples/pkg/generated/clientset/versioned/typed/example/v1/doc.go index 29ee4bf0..b2e49efd 100644 --- a/examples/pkg/generated/clientset/versioned/typed/example/v1/doc.go +++ b/examples/pkg/generated/clientset/versioned/typed/example/v1/doc.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -// Code generated by client-gen-v0.30. DO NOT EDIT. +// Code generated by client-gen-v0.31. DO NOT EDIT. // This package has the automatically generated typed clients. package v1 diff --git a/examples/pkg/generated/clientset/versioned/typed/example/v1/example_client.go b/examples/pkg/generated/clientset/versioned/typed/example/v1/example_client.go index 16590571..4b5b332f 100644 --- a/examples/pkg/generated/clientset/versioned/typed/example/v1/example_client.go +++ b/examples/pkg/generated/clientset/versioned/typed/example/v1/example_client.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -// Code generated by client-gen-v0.30. DO NOT EDIT. +// Code generated by client-gen-v0.31. DO NOT EDIT. package v1 diff --git a/examples/pkg/generated/clientset/versioned/typed/example/v1/fake/doc.go b/examples/pkg/generated/clientset/versioned/typed/example/v1/fake/doc.go index e6378fda..43d633d7 100644 --- a/examples/pkg/generated/clientset/versioned/typed/example/v1/fake/doc.go +++ b/examples/pkg/generated/clientset/versioned/typed/example/v1/fake/doc.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -// Code generated by client-gen-v0.30. DO NOT EDIT. +// Code generated by client-gen-v0.31. DO NOT EDIT. // Package fake has the automatically generated clients. package fake diff --git a/examples/pkg/generated/clientset/versioned/typed/example/v1/fake/fake_clustertesttype.go b/examples/pkg/generated/clientset/versioned/typed/example/v1/fake/fake_clustertesttype.go index be09dd88..447de55c 100644 --- a/examples/pkg/generated/clientset/versioned/typed/example/v1/fake/fake_clustertesttype.go +++ b/examples/pkg/generated/clientset/versioned/typed/example/v1/fake/fake_clustertesttype.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -// Code generated by client-gen-v0.30. DO NOT EDIT. +// Code generated by client-gen-v0.31. DO NOT EDIT. package fake @@ -41,20 +41,22 @@ var clustertesttypesKind = v1.SchemeGroupVersion.WithKind("ClusterTestType") // Get takes name of the clusterTestType, and returns the corresponding clusterTestType object, and an error if there is any. func (c *FakeClusterTestTypes) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.ClusterTestType, err error) { + emptyResult := &v1.ClusterTestType{} obj, err := c.Fake. - Invokes(testing.NewRootGetAction(clustertesttypesResource, name), &v1.ClusterTestType{}) + Invokes(testing.NewRootGetActionWithOptions(clustertesttypesResource, name, options), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1.ClusterTestType), err } // List takes label and field selectors, and returns the list of ClusterTestTypes that match those selectors. func (c *FakeClusterTestTypes) List(ctx context.Context, opts metav1.ListOptions) (result *v1.ClusterTestTypeList, err error) { + emptyResult := &v1.ClusterTestTypeList{} obj, err := c.Fake. - Invokes(testing.NewRootListAction(clustertesttypesResource, clustertesttypesKind, opts), &v1.ClusterTestTypeList{}) + Invokes(testing.NewRootListActionWithOptions(clustertesttypesResource, clustertesttypesKind, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } label, _, _ := testing.ExtractFromListOptions(opts) @@ -73,36 +75,39 @@ func (c *FakeClusterTestTypes) List(ctx context.Context, opts metav1.ListOptions // Watch returns a watch.Interface that watches the requested clusterTestTypes. func (c *FakeClusterTestTypes) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { return c.Fake. - InvokesWatch(testing.NewRootWatchAction(clustertesttypesResource, opts)) + InvokesWatch(testing.NewRootWatchActionWithOptions(clustertesttypesResource, opts)) } // Create takes the representation of a clusterTestType and creates it. Returns the server's representation of the clusterTestType, and an error, if there is any. func (c *FakeClusterTestTypes) Create(ctx context.Context, clusterTestType *v1.ClusterTestType, opts metav1.CreateOptions) (result *v1.ClusterTestType, err error) { + emptyResult := &v1.ClusterTestType{} obj, err := c.Fake. - Invokes(testing.NewRootCreateAction(clustertesttypesResource, clusterTestType), &v1.ClusterTestType{}) + Invokes(testing.NewRootCreateActionWithOptions(clustertesttypesResource, clusterTestType, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1.ClusterTestType), err } // Update takes the representation of a clusterTestType and updates it. Returns the server's representation of the clusterTestType, and an error, if there is any. func (c *FakeClusterTestTypes) Update(ctx context.Context, clusterTestType *v1.ClusterTestType, opts metav1.UpdateOptions) (result *v1.ClusterTestType, err error) { + emptyResult := &v1.ClusterTestType{} obj, err := c.Fake. - Invokes(testing.NewRootUpdateAction(clustertesttypesResource, clusterTestType), &v1.ClusterTestType{}) + Invokes(testing.NewRootUpdateActionWithOptions(clustertesttypesResource, clusterTestType, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1.ClusterTestType), 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 *FakeClusterTestTypes) UpdateStatus(ctx context.Context, clusterTestType *v1.ClusterTestType, opts metav1.UpdateOptions) (*v1.ClusterTestType, error) { +func (c *FakeClusterTestTypes) UpdateStatus(ctx context.Context, clusterTestType *v1.ClusterTestType, opts metav1.UpdateOptions) (result *v1.ClusterTestType, err error) { + emptyResult := &v1.ClusterTestType{} obj, err := c.Fake. - Invokes(testing.NewRootUpdateSubresourceAction(clustertesttypesResource, "status", clusterTestType), &v1.ClusterTestType{}) + Invokes(testing.NewRootUpdateSubresourceActionWithOptions(clustertesttypesResource, "status", clusterTestType, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1.ClusterTestType), err } @@ -116,7 +121,7 @@ func (c *FakeClusterTestTypes) Delete(ctx context.Context, name string, opts met // DeleteCollection deletes a collection of objects. func (c *FakeClusterTestTypes) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { - action := testing.NewRootDeleteCollectionAction(clustertesttypesResource, listOpts) + action := testing.NewRootDeleteCollectionActionWithOptions(clustertesttypesResource, opts, listOpts) _, err := c.Fake.Invokes(action, &v1.ClusterTestTypeList{}) return err @@ -124,10 +129,11 @@ func (c *FakeClusterTestTypes) DeleteCollection(ctx context.Context, opts metav1 // Patch applies the patch and returns the patched clusterTestType. func (c *FakeClusterTestTypes) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.ClusterTestType, err error) { + emptyResult := &v1.ClusterTestType{} obj, err := c.Fake. - Invokes(testing.NewRootPatchSubresourceAction(clustertesttypesResource, name, pt, data, subresources...), &v1.ClusterTestType{}) + Invokes(testing.NewRootPatchSubresourceActionWithOptions(clustertesttypesResource, name, pt, data, opts, subresources...), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1.ClusterTestType), err } diff --git a/examples/pkg/generated/clientset/versioned/typed/example/v1/fake/fake_example_client.go b/examples/pkg/generated/clientset/versioned/typed/example/v1/fake/fake_example_client.go index 943380b5..cf29962c 100644 --- a/examples/pkg/generated/clientset/versioned/typed/example/v1/fake/fake_example_client.go +++ b/examples/pkg/generated/clientset/versioned/typed/example/v1/fake/fake_example_client.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -// Code generated by client-gen-v0.30. DO NOT EDIT. +// Code generated by client-gen-v0.31. DO NOT EDIT. package fake diff --git a/examples/pkg/generated/clientset/versioned/typed/example/v1/fake/fake_testtype.go b/examples/pkg/generated/clientset/versioned/typed/example/v1/fake/fake_testtype.go index 6bff116f..d805f4f5 100644 --- a/examples/pkg/generated/clientset/versioned/typed/example/v1/fake/fake_testtype.go +++ b/examples/pkg/generated/clientset/versioned/typed/example/v1/fake/fake_testtype.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -// Code generated by client-gen-v0.30. DO NOT EDIT. +// Code generated by client-gen-v0.31. DO NOT EDIT. package fake @@ -42,22 +42,24 @@ var testtypesKind = v1.SchemeGroupVersion.WithKind("TestType") // Get takes name of the testType, and returns the corresponding testType object, and an error if there is any. func (c *FakeTestTypes) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.TestType, err error) { + emptyResult := &v1.TestType{} obj, err := c.Fake. - Invokes(testing.NewGetAction(testtypesResource, c.ns, name), &v1.TestType{}) + Invokes(testing.NewGetActionWithOptions(testtypesResource, c.ns, name, options), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1.TestType), err } // List takes label and field selectors, and returns the list of TestTypes that match those selectors. func (c *FakeTestTypes) List(ctx context.Context, opts metav1.ListOptions) (result *v1.TestTypeList, err error) { + emptyResult := &v1.TestTypeList{} obj, err := c.Fake. - Invokes(testing.NewListAction(testtypesResource, testtypesKind, c.ns, opts), &v1.TestTypeList{}) + Invokes(testing.NewListActionWithOptions(testtypesResource, testtypesKind, c.ns, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } label, _, _ := testing.ExtractFromListOptions(opts) @@ -76,28 +78,30 @@ func (c *FakeTestTypes) List(ctx context.Context, opts metav1.ListOptions) (resu // Watch returns a watch.Interface that watches the requested testTypes. func (c *FakeTestTypes) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { return c.Fake. - InvokesWatch(testing.NewWatchAction(testtypesResource, c.ns, opts)) + InvokesWatch(testing.NewWatchActionWithOptions(testtypesResource, c.ns, opts)) } // Create takes the representation of a testType and creates it. Returns the server's representation of the testType, and an error, if there is any. func (c *FakeTestTypes) Create(ctx context.Context, testType *v1.TestType, opts metav1.CreateOptions) (result *v1.TestType, err error) { + emptyResult := &v1.TestType{} obj, err := c.Fake. - Invokes(testing.NewCreateAction(testtypesResource, c.ns, testType), &v1.TestType{}) + Invokes(testing.NewCreateActionWithOptions(testtypesResource, c.ns, testType, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1.TestType), err } // Update takes the representation of a testType and updates it. Returns the server's representation of the testType, and an error, if there is any. func (c *FakeTestTypes) Update(ctx context.Context, testType *v1.TestType, opts metav1.UpdateOptions) (result *v1.TestType, err error) { + emptyResult := &v1.TestType{} obj, err := c.Fake. - Invokes(testing.NewUpdateAction(testtypesResource, c.ns, testType), &v1.TestType{}) + Invokes(testing.NewUpdateActionWithOptions(testtypesResource, c.ns, testType, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1.TestType), err } @@ -112,7 +116,7 @@ func (c *FakeTestTypes) Delete(ctx context.Context, name string, opts metav1.Del // DeleteCollection deletes a collection of objects. func (c *FakeTestTypes) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { - action := testing.NewDeleteCollectionAction(testtypesResource, c.ns, listOpts) + action := testing.NewDeleteCollectionActionWithOptions(testtypesResource, c.ns, opts, listOpts) _, err := c.Fake.Invokes(action, &v1.TestTypeList{}) return err @@ -120,44 +124,48 @@ func (c *FakeTestTypes) DeleteCollection(ctx context.Context, opts metav1.Delete // Patch applies the patch and returns the patched testType. func (c *FakeTestTypes) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.TestType, err error) { + emptyResult := &v1.TestType{} obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(testtypesResource, c.ns, name, pt, data, subresources...), &v1.TestType{}) + Invokes(testing.NewPatchSubresourceActionWithOptions(testtypesResource, c.ns, name, pt, data, opts, subresources...), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1.TestType), err } // CreateField takes the representation of a field and creates it. Returns the server's representation of the field, and an error, if there is any. func (c *FakeTestTypes) CreateField(ctx context.Context, testTypeName string, field *v1.Field, opts metav1.CreateOptions) (result *v1.Field, err error) { + emptyResult := &v1.Field{} obj, err := c.Fake. - Invokes(testing.NewCreateSubresourceAction(testtypesResource, testTypeName, "field", c.ns, field), &v1.Field{}) + Invokes(testing.NewCreateSubresourceActionWithOptions(testtypesResource, testTypeName, "field", c.ns, field, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1.Field), err } // UpdateField takes the representation of a field and updates it. Returns the server's representation of the field, and an error, if there is any. func (c *FakeTestTypes) UpdateField(ctx context.Context, testTypeName string, field *v1.Field, opts metav1.UpdateOptions) (result *v1.Field, err error) { + emptyResult := &v1.Field{} obj, err := c.Fake. - Invokes(testing.NewUpdateSubresourceAction(testtypesResource, "field", c.ns, field), &v1.Field{}) + Invokes(testing.NewUpdateSubresourceActionWithOptions(testtypesResource, "field", c.ns, field, opts), &v1.Field{}) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1.Field), err } // GetField takes name of the testType, and returns the corresponding field object, and an error if there is any. func (c *FakeTestTypes) GetField(ctx context.Context, testTypeName string, options metav1.GetOptions) (result *v1.Field, err error) { + emptyResult := &v1.Field{} obj, err := c.Fake. - Invokes(testing.NewGetSubresourceAction(testtypesResource, c.ns, "field", testTypeName), &v1.Field{}) + Invokes(testing.NewGetSubresourceActionWithOptions(testtypesResource, c.ns, "field", testTypeName, options), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1.Field), err } diff --git a/examples/pkg/generated/clientset/versioned/typed/example/v1/fake/fake_withoutverbtype.go b/examples/pkg/generated/clientset/versioned/typed/example/v1/fake/fake_withoutverbtype.go index 7c9001a4..c276bd37 100644 --- a/examples/pkg/generated/clientset/versioned/typed/example/v1/fake/fake_withoutverbtype.go +++ b/examples/pkg/generated/clientset/versioned/typed/example/v1/fake/fake_withoutverbtype.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -// Code generated by client-gen-v0.30. DO NOT EDIT. +// Code generated by client-gen-v0.31. DO NOT EDIT. package fake diff --git a/examples/pkg/generated/clientset/versioned/typed/example/v1/generated_expansion.go b/examples/pkg/generated/clientset/versioned/typed/example/v1/generated_expansion.go index 09ce30b0..87ef21b3 100644 --- a/examples/pkg/generated/clientset/versioned/typed/example/v1/generated_expansion.go +++ b/examples/pkg/generated/clientset/versioned/typed/example/v1/generated_expansion.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -// Code generated by client-gen-v0.30. DO NOT EDIT. +// Code generated by client-gen-v0.31. DO NOT EDIT. package v1 diff --git a/examples/pkg/generated/clientset/versioned/typed/example/v1/testtype.go b/examples/pkg/generated/clientset/versioned/typed/example/v1/testtype.go index 7256cea9..bb7e5589 100644 --- a/examples/pkg/generated/clientset/versioned/typed/example/v1/testtype.go +++ b/examples/pkg/generated/clientset/versioned/typed/example/v1/testtype.go @@ -14,18 +14,17 @@ See the License for the specific language governing permissions and limitations under the License. */ -// Code generated by client-gen-v0.30. DO NOT EDIT. +// Code generated by client-gen-v0.31. DO NOT EDIT. package v1 import ( "context" - "time" metav1 "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" v1 "acme.corp/pkg/apis/example/v1" scheme "acme.corp/pkg/generated/clientset/versioned/scheme" @@ -56,137 +55,27 @@ type TestTypeInterface interface { // testTypes implements TestTypeInterface type testTypes struct { - client rest.Interface - ns string + *gentype.ClientWithList[*v1.TestType, *v1.TestTypeList] } // newTestTypes returns a TestTypes func newTestTypes(c *ExampleV1Client, namespace string) *testTypes { return &testTypes{ - client: c.RESTClient(), - ns: namespace, + gentype.NewClientWithList[*v1.TestType, *v1.TestTypeList]( + "testtypes", + c.RESTClient(), + scheme.ParameterCodec, + namespace, + func() *v1.TestType { return &v1.TestType{} }, + func() *v1.TestTypeList { return &v1.TestTypeList{} }), } } -// Get takes name of the testType, and returns the corresponding testType object, and an error if there is any. -func (c *testTypes) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.TestType, err error) { - result = &v1.TestType{} - err = c.client.Get(). - Namespace(c.ns). - Resource("testtypes"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of TestTypes that match those selectors. -func (c *testTypes) List(ctx context.Context, opts metav1.ListOptions) (result *v1.TestTypeList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1.TestTypeList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("testtypes"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested testTypes. -func (c *testTypes) Watch(ctx context.Context, opts metav1.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("testtypes"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a testType and creates it. Returns the server's representation of the testType, and an error, if there is any. -func (c *testTypes) Create(ctx context.Context, testType *v1.TestType, opts metav1.CreateOptions) (result *v1.TestType, err error) { - result = &v1.TestType{} - err = c.client.Post(). - Namespace(c.ns). - Resource("testtypes"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(testType). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a testType and updates it. Returns the server's representation of the testType, and an error, if there is any. -func (c *testTypes) Update(ctx context.Context, testType *v1.TestType, opts metav1.UpdateOptions) (result *v1.TestType, err error) { - result = &v1.TestType{} - err = c.client.Put(). - Namespace(c.ns). - Resource("testtypes"). - Name(testType.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(testType). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the testType and deletes it. Returns an error if one occurs. -func (c *testTypes) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("testtypes"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *testTypes) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.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("testtypes"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched testType. -func (c *testTypes) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.TestType, err error) { - result = &v1.TestType{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("testtypes"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} - // CreateField takes the representation of a field and creates it. Returns the server's representation of the field, and an error, if there is any. func (c *testTypes) CreateField(ctx context.Context, testTypeName string, field *v1.Field, opts metav1.CreateOptions) (result *v1.Field, err error) { result = &v1.Field{} - err = c.client.Post(). - Namespace(c.ns). + err = c.GetClient().Post(). + Namespace(c.GetNamespace()). Resource("testtypes"). Name(testTypeName). SubResource("field"). @@ -200,8 +89,8 @@ func (c *testTypes) CreateField(ctx context.Context, testTypeName string, field // UpdateField takes the top resource name and the representation of a field and updates it. Returns the server's representation of the field, and an error, if there is any. func (c *testTypes) UpdateField(ctx context.Context, testTypeName string, field *v1.Field, opts metav1.UpdateOptions) (result *v1.Field, err error) { result = &v1.Field{} - err = c.client.Put(). - Namespace(c.ns). + err = c.GetClient().Put(). + Namespace(c.GetNamespace()). Resource("testtypes"). Name(testTypeName). SubResource("field"). @@ -215,8 +104,8 @@ func (c *testTypes) UpdateField(ctx context.Context, testTypeName string, field // GetField takes name of the testType, and returns the corresponding v1.Field object, and an error if there is any. func (c *testTypes) GetField(ctx context.Context, testTypeName string, options metav1.GetOptions) (result *v1.Field, err error) { result = &v1.Field{} - err = c.client.Get(). - Namespace(c.ns). + err = c.GetClient().Get(). + Namespace(c.GetNamespace()). Resource("testtypes"). Name(testTypeName). SubResource("field"). diff --git a/examples/pkg/generated/clientset/versioned/typed/example/v1/withoutverbtype.go b/examples/pkg/generated/clientset/versioned/typed/example/v1/withoutverbtype.go index 86ecf454..3218023d 100644 --- a/examples/pkg/generated/clientset/versioned/typed/example/v1/withoutverbtype.go +++ b/examples/pkg/generated/clientset/versioned/typed/example/v1/withoutverbtype.go @@ -14,12 +14,15 @@ See the License for the specific language governing permissions and limitations under the License. */ -// Code generated by client-gen-v0.30. DO NOT EDIT. +// Code generated by client-gen-v0.31. DO NOT EDIT. package v1 import ( - rest "k8s.io/client-go/rest" + gentype "k8s.io/client-go/gentype" + + v1 "acme.corp/pkg/apis/example/v1" + scheme "acme.corp/pkg/generated/clientset/versioned/scheme" ) // WithoutVerbTypesGetter has a method to return a WithoutVerbTypeInterface. @@ -35,14 +38,17 @@ type WithoutVerbTypeInterface interface { // withoutVerbTypes implements WithoutVerbTypeInterface type withoutVerbTypes struct { - client rest.Interface - ns string + *gentype.Client[*v1.WithoutVerbType] } // newWithoutVerbTypes returns a WithoutVerbTypes func newWithoutVerbTypes(c *ExampleV1Client, namespace string) *withoutVerbTypes { return &withoutVerbTypes{ - client: c.RESTClient(), - ns: namespace, + gentype.NewClient[*v1.WithoutVerbType]( + "withoutverbtypes", + c.RESTClient(), + scheme.ParameterCodec, + namespace, + func() *v1.WithoutVerbType { return &v1.WithoutVerbType{} }), } } diff --git a/examples/pkg/generated/clientset/versioned/typed/example/v1alpha1/clustertesttype.go b/examples/pkg/generated/clientset/versioned/typed/example/v1alpha1/clustertesttype.go index ae8d2c1d..7c612314 100644 --- a/examples/pkg/generated/clientset/versioned/typed/example/v1alpha1/clustertesttype.go +++ b/examples/pkg/generated/clientset/versioned/typed/example/v1alpha1/clustertesttype.go @@ -14,18 +14,17 @@ See the License for the specific language governing permissions and limitations under the License. */ -// Code generated by client-gen-v0.30. DO NOT EDIT. +// Code generated by client-gen-v0.31. DO NOT EDIT. package v1alpha1 import ( "context" - "time" 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" v1alpha1 "acme.corp/pkg/apis/example/v1alpha1" scheme "acme.corp/pkg/generated/clientset/versioned/scheme" @@ -41,6 +40,7 @@ type ClusterTestTypesGetter interface { type ClusterTestTypeInterface interface { Create(ctx context.Context, clusterTestType *v1alpha1.ClusterTestType, opts v1.CreateOptions) (*v1alpha1.ClusterTestType, error) Update(ctx context.Context, clusterTestType *v1alpha1.ClusterTestType, opts v1.UpdateOptions) (*v1alpha1.ClusterTestType, error) + // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). UpdateStatus(ctx context.Context, clusterTestType *v1alpha1.ClusterTestType, opts v1.UpdateOptions) (*v1alpha1.ClusterTestType, error) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error @@ -53,133 +53,18 @@ type ClusterTestTypeInterface interface { // clusterTestTypes implements ClusterTestTypeInterface type clusterTestTypes struct { - client rest.Interface + *gentype.ClientWithList[*v1alpha1.ClusterTestType, *v1alpha1.ClusterTestTypeList] } // newClusterTestTypes returns a ClusterTestTypes func newClusterTestTypes(c *ExampleV1alpha1Client) *clusterTestTypes { return &clusterTestTypes{ - client: c.RESTClient(), + gentype.NewClientWithList[*v1alpha1.ClusterTestType, *v1alpha1.ClusterTestTypeList]( + "clustertesttypes", + c.RESTClient(), + scheme.ParameterCodec, + "", + func() *v1alpha1.ClusterTestType { return &v1alpha1.ClusterTestType{} }, + func() *v1alpha1.ClusterTestTypeList { return &v1alpha1.ClusterTestTypeList{} }), } } - -// Get takes name of the clusterTestType, and returns the corresponding clusterTestType object, and an error if there is any. -func (c *clusterTestTypes) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.ClusterTestType, err error) { - result = &v1alpha1.ClusterTestType{} - err = c.client.Get(). - Resource("clustertesttypes"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of ClusterTestTypes that match those selectors. -func (c *clusterTestTypes) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.ClusterTestTypeList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1alpha1.ClusterTestTypeList{} - err = c.client.Get(). - Resource("clustertesttypes"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested clusterTestTypes. -func (c *clusterTestTypes) 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(). - Resource("clustertesttypes"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a clusterTestType and creates it. Returns the server's representation of the clusterTestType, and an error, if there is any. -func (c *clusterTestTypes) Create(ctx context.Context, clusterTestType *v1alpha1.ClusterTestType, opts v1.CreateOptions) (result *v1alpha1.ClusterTestType, err error) { - result = &v1alpha1.ClusterTestType{} - err = c.client.Post(). - Resource("clustertesttypes"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(clusterTestType). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a clusterTestType and updates it. Returns the server's representation of the clusterTestType, and an error, if there is any. -func (c *clusterTestTypes) Update(ctx context.Context, clusterTestType *v1alpha1.ClusterTestType, opts v1.UpdateOptions) (result *v1alpha1.ClusterTestType, err error) { - result = &v1alpha1.ClusterTestType{} - err = c.client.Put(). - Resource("clustertesttypes"). - Name(clusterTestType.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(clusterTestType). - 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 *clusterTestTypes) UpdateStatus(ctx context.Context, clusterTestType *v1alpha1.ClusterTestType, opts v1.UpdateOptions) (result *v1alpha1.ClusterTestType, err error) { - result = &v1alpha1.ClusterTestType{} - err = c.client.Put(). - Resource("clustertesttypes"). - Name(clusterTestType.Name). - SubResource("status"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(clusterTestType). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the clusterTestType and deletes it. Returns an error if one occurs. -func (c *clusterTestTypes) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Resource("clustertesttypes"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *clusterTestTypes) 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(). - Resource("clustertesttypes"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched clusterTestType. -func (c *clusterTestTypes) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.ClusterTestType, err error) { - result = &v1alpha1.ClusterTestType{} - err = c.client.Patch(pt). - Resource("clustertesttypes"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/examples/pkg/generated/clientset/versioned/typed/example/v1alpha1/doc.go b/examples/pkg/generated/clientset/versioned/typed/example/v1alpha1/doc.go index d08dee84..2319b52c 100644 --- a/examples/pkg/generated/clientset/versioned/typed/example/v1alpha1/doc.go +++ b/examples/pkg/generated/clientset/versioned/typed/example/v1alpha1/doc.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -// Code generated by client-gen-v0.30. DO NOT EDIT. +// Code generated by client-gen-v0.31. DO NOT EDIT. // This package has the automatically generated typed clients. package v1alpha1 diff --git a/examples/pkg/generated/clientset/versioned/typed/example/v1alpha1/example_client.go b/examples/pkg/generated/clientset/versioned/typed/example/v1alpha1/example_client.go index a0f369c6..deef329b 100644 --- a/examples/pkg/generated/clientset/versioned/typed/example/v1alpha1/example_client.go +++ b/examples/pkg/generated/clientset/versioned/typed/example/v1alpha1/example_client.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -// Code generated by client-gen-v0.30. DO NOT EDIT. +// Code generated by client-gen-v0.31. DO NOT EDIT. package v1alpha1 diff --git a/examples/pkg/generated/clientset/versioned/typed/example/v1alpha1/fake/doc.go b/examples/pkg/generated/clientset/versioned/typed/example/v1alpha1/fake/doc.go index e6378fda..43d633d7 100644 --- a/examples/pkg/generated/clientset/versioned/typed/example/v1alpha1/fake/doc.go +++ b/examples/pkg/generated/clientset/versioned/typed/example/v1alpha1/fake/doc.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -// Code generated by client-gen-v0.30. DO NOT EDIT. +// Code generated by client-gen-v0.31. DO NOT EDIT. // Package fake has the automatically generated clients. package fake diff --git a/examples/pkg/generated/clientset/versioned/typed/example/v1alpha1/fake/fake_clustertesttype.go b/examples/pkg/generated/clientset/versioned/typed/example/v1alpha1/fake/fake_clustertesttype.go index 7b2117e2..2da6835e 100644 --- a/examples/pkg/generated/clientset/versioned/typed/example/v1alpha1/fake/fake_clustertesttype.go +++ b/examples/pkg/generated/clientset/versioned/typed/example/v1alpha1/fake/fake_clustertesttype.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -// Code generated by client-gen-v0.30. DO NOT EDIT. +// Code generated by client-gen-v0.31. DO NOT EDIT. package fake @@ -41,20 +41,22 @@ var clustertesttypesKind = v1alpha1.SchemeGroupVersion.WithKind("ClusterTestType // Get takes name of the clusterTestType, and returns the corresponding clusterTestType object, and an error if there is any. func (c *FakeClusterTestTypes) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.ClusterTestType, err error) { + emptyResult := &v1alpha1.ClusterTestType{} obj, err := c.Fake. - Invokes(testing.NewRootGetAction(clustertesttypesResource, name), &v1alpha1.ClusterTestType{}) + Invokes(testing.NewRootGetActionWithOptions(clustertesttypesResource, name, options), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.ClusterTestType), err } // List takes label and field selectors, and returns the list of ClusterTestTypes that match those selectors. func (c *FakeClusterTestTypes) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.ClusterTestTypeList, err error) { + emptyResult := &v1alpha1.ClusterTestTypeList{} obj, err := c.Fake. - Invokes(testing.NewRootListAction(clustertesttypesResource, clustertesttypesKind, opts), &v1alpha1.ClusterTestTypeList{}) + Invokes(testing.NewRootListActionWithOptions(clustertesttypesResource, clustertesttypesKind, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } label, _, _ := testing.ExtractFromListOptions(opts) @@ -73,36 +75,39 @@ func (c *FakeClusterTestTypes) List(ctx context.Context, opts v1.ListOptions) (r // Watch returns a watch.Interface that watches the requested clusterTestTypes. func (c *FakeClusterTestTypes) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { return c.Fake. - InvokesWatch(testing.NewRootWatchAction(clustertesttypesResource, opts)) + InvokesWatch(testing.NewRootWatchActionWithOptions(clustertesttypesResource, opts)) } // Create takes the representation of a clusterTestType and creates it. Returns the server's representation of the clusterTestType, and an error, if there is any. func (c *FakeClusterTestTypes) Create(ctx context.Context, clusterTestType *v1alpha1.ClusterTestType, opts v1.CreateOptions) (result *v1alpha1.ClusterTestType, err error) { + emptyResult := &v1alpha1.ClusterTestType{} obj, err := c.Fake. - Invokes(testing.NewRootCreateAction(clustertesttypesResource, clusterTestType), &v1alpha1.ClusterTestType{}) + Invokes(testing.NewRootCreateActionWithOptions(clustertesttypesResource, clusterTestType, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.ClusterTestType), err } // Update takes the representation of a clusterTestType and updates it. Returns the server's representation of the clusterTestType, and an error, if there is any. func (c *FakeClusterTestTypes) Update(ctx context.Context, clusterTestType *v1alpha1.ClusterTestType, opts v1.UpdateOptions) (result *v1alpha1.ClusterTestType, err error) { + emptyResult := &v1alpha1.ClusterTestType{} obj, err := c.Fake. - Invokes(testing.NewRootUpdateAction(clustertesttypesResource, clusterTestType), &v1alpha1.ClusterTestType{}) + Invokes(testing.NewRootUpdateActionWithOptions(clustertesttypesResource, clusterTestType, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.ClusterTestType), 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 *FakeClusterTestTypes) UpdateStatus(ctx context.Context, clusterTestType *v1alpha1.ClusterTestType, opts v1.UpdateOptions) (*v1alpha1.ClusterTestType, error) { +func (c *FakeClusterTestTypes) UpdateStatus(ctx context.Context, clusterTestType *v1alpha1.ClusterTestType, opts v1.UpdateOptions) (result *v1alpha1.ClusterTestType, err error) { + emptyResult := &v1alpha1.ClusterTestType{} obj, err := c.Fake. - Invokes(testing.NewRootUpdateSubresourceAction(clustertesttypesResource, "status", clusterTestType), &v1alpha1.ClusterTestType{}) + Invokes(testing.NewRootUpdateSubresourceActionWithOptions(clustertesttypesResource, "status", clusterTestType, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.ClusterTestType), err } @@ -116,7 +121,7 @@ func (c *FakeClusterTestTypes) Delete(ctx context.Context, name string, opts v1. // DeleteCollection deletes a collection of objects. func (c *FakeClusterTestTypes) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewRootDeleteCollectionAction(clustertesttypesResource, listOpts) + action := testing.NewRootDeleteCollectionActionWithOptions(clustertesttypesResource, opts, listOpts) _, err := c.Fake.Invokes(action, &v1alpha1.ClusterTestTypeList{}) return err @@ -124,10 +129,11 @@ func (c *FakeClusterTestTypes) DeleteCollection(ctx context.Context, opts v1.Del // Patch applies the patch and returns the patched clusterTestType. func (c *FakeClusterTestTypes) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.ClusterTestType, err error) { + emptyResult := &v1alpha1.ClusterTestType{} obj, err := c.Fake. - Invokes(testing.NewRootPatchSubresourceAction(clustertesttypesResource, name, pt, data, subresources...), &v1alpha1.ClusterTestType{}) + Invokes(testing.NewRootPatchSubresourceActionWithOptions(clustertesttypesResource, name, pt, data, opts, subresources...), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.ClusterTestType), err } diff --git a/examples/pkg/generated/clientset/versioned/typed/example/v1alpha1/fake/fake_example_client.go b/examples/pkg/generated/clientset/versioned/typed/example/v1alpha1/fake/fake_example_client.go index a5ceb8f3..91f0d909 100644 --- a/examples/pkg/generated/clientset/versioned/typed/example/v1alpha1/fake/fake_example_client.go +++ b/examples/pkg/generated/clientset/versioned/typed/example/v1alpha1/fake/fake_example_client.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -// Code generated by client-gen-v0.30. DO NOT EDIT. +// Code generated by client-gen-v0.31. DO NOT EDIT. package fake diff --git a/examples/pkg/generated/clientset/versioned/typed/example/v1alpha1/fake/fake_testtype.go b/examples/pkg/generated/clientset/versioned/typed/example/v1alpha1/fake/fake_testtype.go index 165844e7..3c8977cc 100644 --- a/examples/pkg/generated/clientset/versioned/typed/example/v1alpha1/fake/fake_testtype.go +++ b/examples/pkg/generated/clientset/versioned/typed/example/v1alpha1/fake/fake_testtype.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -// Code generated by client-gen-v0.30. DO NOT EDIT. +// Code generated by client-gen-v0.31. DO NOT EDIT. package fake @@ -42,22 +42,24 @@ var testtypesKind = v1alpha1.SchemeGroupVersion.WithKind("TestType") // Get takes name of the testType, and returns the corresponding testType object, and an error if there is any. func (c *FakeTestTypes) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.TestType, err error) { + emptyResult := &v1alpha1.TestType{} obj, err := c.Fake. - Invokes(testing.NewGetAction(testtypesResource, c.ns, name), &v1alpha1.TestType{}) + Invokes(testing.NewGetActionWithOptions(testtypesResource, c.ns, name, options), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.TestType), err } // List takes label and field selectors, and returns the list of TestTypes that match those selectors. func (c *FakeTestTypes) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.TestTypeList, err error) { + emptyResult := &v1alpha1.TestTypeList{} obj, err := c.Fake. - Invokes(testing.NewListAction(testtypesResource, testtypesKind, c.ns, opts), &v1alpha1.TestTypeList{}) + Invokes(testing.NewListActionWithOptions(testtypesResource, testtypesKind, c.ns, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } label, _, _ := testing.ExtractFromListOptions(opts) @@ -76,28 +78,30 @@ func (c *FakeTestTypes) List(ctx context.Context, opts v1.ListOptions) (result * // Watch returns a watch.Interface that watches the requested testTypes. func (c *FakeTestTypes) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { return c.Fake. - InvokesWatch(testing.NewWatchAction(testtypesResource, c.ns, opts)) + InvokesWatch(testing.NewWatchActionWithOptions(testtypesResource, c.ns, opts)) } // Create takes the representation of a testType and creates it. Returns the server's representation of the testType, and an error, if there is any. func (c *FakeTestTypes) Create(ctx context.Context, testType *v1alpha1.TestType, opts v1.CreateOptions) (result *v1alpha1.TestType, err error) { + emptyResult := &v1alpha1.TestType{} obj, err := c.Fake. - Invokes(testing.NewCreateAction(testtypesResource, c.ns, testType), &v1alpha1.TestType{}) + Invokes(testing.NewCreateActionWithOptions(testtypesResource, c.ns, testType, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.TestType), err } // Update takes the representation of a testType and updates it. Returns the server's representation of the testType, and an error, if there is any. func (c *FakeTestTypes) Update(ctx context.Context, testType *v1alpha1.TestType, opts v1.UpdateOptions) (result *v1alpha1.TestType, err error) { + emptyResult := &v1alpha1.TestType{} obj, err := c.Fake. - Invokes(testing.NewUpdateAction(testtypesResource, c.ns, testType), &v1alpha1.TestType{}) + Invokes(testing.NewUpdateActionWithOptions(testtypesResource, c.ns, testType, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.TestType), err } @@ -112,7 +116,7 @@ func (c *FakeTestTypes) Delete(ctx context.Context, name string, opts v1.DeleteO // DeleteCollection deletes a collection of objects. func (c *FakeTestTypes) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewDeleteCollectionAction(testtypesResource, c.ns, listOpts) + action := testing.NewDeleteCollectionActionWithOptions(testtypesResource, c.ns, opts, listOpts) _, err := c.Fake.Invokes(action, &v1alpha1.TestTypeList{}) return err @@ -120,11 +124,12 @@ func (c *FakeTestTypes) DeleteCollection(ctx context.Context, opts v1.DeleteOpti // Patch applies the patch and returns the patched testType. func (c *FakeTestTypes) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.TestType, err error) { + emptyResult := &v1alpha1.TestType{} obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(testtypesResource, c.ns, name, pt, data, subresources...), &v1alpha1.TestType{}) + Invokes(testing.NewPatchSubresourceActionWithOptions(testtypesResource, c.ns, name, pt, data, opts, subresources...), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.TestType), err } diff --git a/examples/pkg/generated/clientset/versioned/typed/example/v1alpha1/generated_expansion.go b/examples/pkg/generated/clientset/versioned/typed/example/v1alpha1/generated_expansion.go index 172dd408..44006342 100644 --- a/examples/pkg/generated/clientset/versioned/typed/example/v1alpha1/generated_expansion.go +++ b/examples/pkg/generated/clientset/versioned/typed/example/v1alpha1/generated_expansion.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -// Code generated by client-gen-v0.30. DO NOT EDIT. +// Code generated by client-gen-v0.31. DO NOT EDIT. package v1alpha1 diff --git a/examples/pkg/generated/clientset/versioned/typed/example/v1alpha1/testtype.go b/examples/pkg/generated/clientset/versioned/typed/example/v1alpha1/testtype.go index 77bc5d73..6bfc2003 100644 --- a/examples/pkg/generated/clientset/versioned/typed/example/v1alpha1/testtype.go +++ b/examples/pkg/generated/clientset/versioned/typed/example/v1alpha1/testtype.go @@ -14,18 +14,17 @@ See the License for the specific language governing permissions and limitations under the License. */ -// Code generated by client-gen-v0.30. DO NOT EDIT. +// Code generated by client-gen-v0.31. DO NOT EDIT. package v1alpha1 import ( "context" - "time" 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" v1alpha1 "acme.corp/pkg/apis/example/v1alpha1" scheme "acme.corp/pkg/generated/clientset/versioned/scheme" @@ -52,128 +51,18 @@ type TestTypeInterface interface { // testTypes implements TestTypeInterface type testTypes struct { - client rest.Interface - ns string + *gentype.ClientWithList[*v1alpha1.TestType, *v1alpha1.TestTypeList] } // newTestTypes returns a TestTypes func newTestTypes(c *ExampleV1alpha1Client, namespace string) *testTypes { return &testTypes{ - client: c.RESTClient(), - ns: namespace, + gentype.NewClientWithList[*v1alpha1.TestType, *v1alpha1.TestTypeList]( + "testtypes", + c.RESTClient(), + scheme.ParameterCodec, + namespace, + func() *v1alpha1.TestType { return &v1alpha1.TestType{} }, + func() *v1alpha1.TestTypeList { return &v1alpha1.TestTypeList{} }), } } - -// Get takes name of the testType, and returns the corresponding testType object, and an error if there is any. -func (c *testTypes) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.TestType, err error) { - result = &v1alpha1.TestType{} - err = c.client.Get(). - Namespace(c.ns). - Resource("testtypes"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of TestTypes that match those selectors. -func (c *testTypes) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.TestTypeList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1alpha1.TestTypeList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("testtypes"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested testTypes. -func (c *testTypes) 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("testtypes"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a testType and creates it. Returns the server's representation of the testType, and an error, if there is any. -func (c *testTypes) Create(ctx context.Context, testType *v1alpha1.TestType, opts v1.CreateOptions) (result *v1alpha1.TestType, err error) { - result = &v1alpha1.TestType{} - err = c.client.Post(). - Namespace(c.ns). - Resource("testtypes"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(testType). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a testType and updates it. Returns the server's representation of the testType, and an error, if there is any. -func (c *testTypes) Update(ctx context.Context, testType *v1alpha1.TestType, opts v1.UpdateOptions) (result *v1alpha1.TestType, err error) { - result = &v1alpha1.TestType{} - err = c.client.Put(). - Namespace(c.ns). - Resource("testtypes"). - Name(testType.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(testType). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the testType and deletes it. Returns an error if one occurs. -func (c *testTypes) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("testtypes"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *testTypes) 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("testtypes"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched testType. -func (c *testTypes) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.TestType, err error) { - result = &v1alpha1.TestType{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("testtypes"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/examples/pkg/generated/clientset/versioned/typed/example/v1beta1/clustertesttype.go b/examples/pkg/generated/clientset/versioned/typed/example/v1beta1/clustertesttype.go index 9e043d7c..6d2408ba 100644 --- a/examples/pkg/generated/clientset/versioned/typed/example/v1beta1/clustertesttype.go +++ b/examples/pkg/generated/clientset/versioned/typed/example/v1beta1/clustertesttype.go @@ -14,18 +14,17 @@ See the License for the specific language governing permissions and limitations under the License. */ -// Code generated by client-gen-v0.30. DO NOT EDIT. +// Code generated by client-gen-v0.31. DO NOT EDIT. package v1beta1 import ( "context" - "time" 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" v1beta1 "acme.corp/pkg/apis/example/v1beta1" scheme "acme.corp/pkg/generated/clientset/versioned/scheme" @@ -41,6 +40,7 @@ type ClusterTestTypesGetter interface { type ClusterTestTypeInterface interface { Create(ctx context.Context, clusterTestType *v1beta1.ClusterTestType, opts v1.CreateOptions) (*v1beta1.ClusterTestType, error) Update(ctx context.Context, clusterTestType *v1beta1.ClusterTestType, opts v1.UpdateOptions) (*v1beta1.ClusterTestType, error) + // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). UpdateStatus(ctx context.Context, clusterTestType *v1beta1.ClusterTestType, opts v1.UpdateOptions) (*v1beta1.ClusterTestType, error) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error @@ -53,133 +53,18 @@ type ClusterTestTypeInterface interface { // clusterTestTypes implements ClusterTestTypeInterface type clusterTestTypes struct { - client rest.Interface + *gentype.ClientWithList[*v1beta1.ClusterTestType, *v1beta1.ClusterTestTypeList] } // newClusterTestTypes returns a ClusterTestTypes func newClusterTestTypes(c *ExampleV1beta1Client) *clusterTestTypes { return &clusterTestTypes{ - client: c.RESTClient(), + gentype.NewClientWithList[*v1beta1.ClusterTestType, *v1beta1.ClusterTestTypeList]( + "clustertesttypes", + c.RESTClient(), + scheme.ParameterCodec, + "", + func() *v1beta1.ClusterTestType { return &v1beta1.ClusterTestType{} }, + func() *v1beta1.ClusterTestTypeList { return &v1beta1.ClusterTestTypeList{} }), } } - -// Get takes name of the clusterTestType, and returns the corresponding clusterTestType object, and an error if there is any. -func (c *clusterTestTypes) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta1.ClusterTestType, err error) { - result = &v1beta1.ClusterTestType{} - err = c.client.Get(). - Resource("clustertesttypes"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of ClusterTestTypes that match those selectors. -func (c *clusterTestTypes) List(ctx context.Context, opts v1.ListOptions) (result *v1beta1.ClusterTestTypeList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1beta1.ClusterTestTypeList{} - err = c.client.Get(). - Resource("clustertesttypes"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested clusterTestTypes. -func (c *clusterTestTypes) 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(). - Resource("clustertesttypes"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a clusterTestType and creates it. Returns the server's representation of the clusterTestType, and an error, if there is any. -func (c *clusterTestTypes) Create(ctx context.Context, clusterTestType *v1beta1.ClusterTestType, opts v1.CreateOptions) (result *v1beta1.ClusterTestType, err error) { - result = &v1beta1.ClusterTestType{} - err = c.client.Post(). - Resource("clustertesttypes"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(clusterTestType). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a clusterTestType and updates it. Returns the server's representation of the clusterTestType, and an error, if there is any. -func (c *clusterTestTypes) Update(ctx context.Context, clusterTestType *v1beta1.ClusterTestType, opts v1.UpdateOptions) (result *v1beta1.ClusterTestType, err error) { - result = &v1beta1.ClusterTestType{} - err = c.client.Put(). - Resource("clustertesttypes"). - Name(clusterTestType.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(clusterTestType). - 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 *clusterTestTypes) UpdateStatus(ctx context.Context, clusterTestType *v1beta1.ClusterTestType, opts v1.UpdateOptions) (result *v1beta1.ClusterTestType, err error) { - result = &v1beta1.ClusterTestType{} - err = c.client.Put(). - Resource("clustertesttypes"). - Name(clusterTestType.Name). - SubResource("status"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(clusterTestType). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the clusterTestType and deletes it. Returns an error if one occurs. -func (c *clusterTestTypes) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Resource("clustertesttypes"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *clusterTestTypes) 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(). - Resource("clustertesttypes"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched clusterTestType. -func (c *clusterTestTypes) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.ClusterTestType, err error) { - result = &v1beta1.ClusterTestType{} - err = c.client.Patch(pt). - Resource("clustertesttypes"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/examples/pkg/generated/clientset/versioned/typed/example/v1beta1/doc.go b/examples/pkg/generated/clientset/versioned/typed/example/v1beta1/doc.go index 4a85ea55..b8099c9f 100644 --- a/examples/pkg/generated/clientset/versioned/typed/example/v1beta1/doc.go +++ b/examples/pkg/generated/clientset/versioned/typed/example/v1beta1/doc.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -// Code generated by client-gen-v0.30. DO NOT EDIT. +// Code generated by client-gen-v0.31. DO NOT EDIT. // This package has the automatically generated typed clients. package v1beta1 diff --git a/examples/pkg/generated/clientset/versioned/typed/example/v1beta1/example_client.go b/examples/pkg/generated/clientset/versioned/typed/example/v1beta1/example_client.go index 1e1725d4..d87d456b 100644 --- a/examples/pkg/generated/clientset/versioned/typed/example/v1beta1/example_client.go +++ b/examples/pkg/generated/clientset/versioned/typed/example/v1beta1/example_client.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -// Code generated by client-gen-v0.30. DO NOT EDIT. +// Code generated by client-gen-v0.31. DO NOT EDIT. package v1beta1 diff --git a/examples/pkg/generated/clientset/versioned/typed/example/v1beta1/fake/doc.go b/examples/pkg/generated/clientset/versioned/typed/example/v1beta1/fake/doc.go index e6378fda..43d633d7 100644 --- a/examples/pkg/generated/clientset/versioned/typed/example/v1beta1/fake/doc.go +++ b/examples/pkg/generated/clientset/versioned/typed/example/v1beta1/fake/doc.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -// Code generated by client-gen-v0.30. DO NOT EDIT. +// Code generated by client-gen-v0.31. DO NOT EDIT. // Package fake has the automatically generated clients. package fake diff --git a/examples/pkg/generated/clientset/versioned/typed/example/v1beta1/fake/fake_clustertesttype.go b/examples/pkg/generated/clientset/versioned/typed/example/v1beta1/fake/fake_clustertesttype.go index 3ba379a1..ea6790c5 100644 --- a/examples/pkg/generated/clientset/versioned/typed/example/v1beta1/fake/fake_clustertesttype.go +++ b/examples/pkg/generated/clientset/versioned/typed/example/v1beta1/fake/fake_clustertesttype.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -// Code generated by client-gen-v0.30. DO NOT EDIT. +// Code generated by client-gen-v0.31. DO NOT EDIT. package fake @@ -41,20 +41,22 @@ var clustertesttypesKind = v1beta1.SchemeGroupVersion.WithKind("ClusterTestType" // Get takes name of the clusterTestType, and returns the corresponding clusterTestType object, and an error if there is any. func (c *FakeClusterTestTypes) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta1.ClusterTestType, err error) { + emptyResult := &v1beta1.ClusterTestType{} obj, err := c.Fake. - Invokes(testing.NewRootGetAction(clustertesttypesResource, name), &v1beta1.ClusterTestType{}) + Invokes(testing.NewRootGetActionWithOptions(clustertesttypesResource, name, options), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1beta1.ClusterTestType), err } // List takes label and field selectors, and returns the list of ClusterTestTypes that match those selectors. func (c *FakeClusterTestTypes) List(ctx context.Context, opts v1.ListOptions) (result *v1beta1.ClusterTestTypeList, err error) { + emptyResult := &v1beta1.ClusterTestTypeList{} obj, err := c.Fake. - Invokes(testing.NewRootListAction(clustertesttypesResource, clustertesttypesKind, opts), &v1beta1.ClusterTestTypeList{}) + Invokes(testing.NewRootListActionWithOptions(clustertesttypesResource, clustertesttypesKind, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } label, _, _ := testing.ExtractFromListOptions(opts) @@ -73,36 +75,39 @@ func (c *FakeClusterTestTypes) List(ctx context.Context, opts v1.ListOptions) (r // Watch returns a watch.Interface that watches the requested clusterTestTypes. func (c *FakeClusterTestTypes) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { return c.Fake. - InvokesWatch(testing.NewRootWatchAction(clustertesttypesResource, opts)) + InvokesWatch(testing.NewRootWatchActionWithOptions(clustertesttypesResource, opts)) } // Create takes the representation of a clusterTestType and creates it. Returns the server's representation of the clusterTestType, and an error, if there is any. func (c *FakeClusterTestTypes) Create(ctx context.Context, clusterTestType *v1beta1.ClusterTestType, opts v1.CreateOptions) (result *v1beta1.ClusterTestType, err error) { + emptyResult := &v1beta1.ClusterTestType{} obj, err := c.Fake. - Invokes(testing.NewRootCreateAction(clustertesttypesResource, clusterTestType), &v1beta1.ClusterTestType{}) + Invokes(testing.NewRootCreateActionWithOptions(clustertesttypesResource, clusterTestType, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1beta1.ClusterTestType), err } // Update takes the representation of a clusterTestType and updates it. Returns the server's representation of the clusterTestType, and an error, if there is any. func (c *FakeClusterTestTypes) Update(ctx context.Context, clusterTestType *v1beta1.ClusterTestType, opts v1.UpdateOptions) (result *v1beta1.ClusterTestType, err error) { + emptyResult := &v1beta1.ClusterTestType{} obj, err := c.Fake. - Invokes(testing.NewRootUpdateAction(clustertesttypesResource, clusterTestType), &v1beta1.ClusterTestType{}) + Invokes(testing.NewRootUpdateActionWithOptions(clustertesttypesResource, clusterTestType, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1beta1.ClusterTestType), 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 *FakeClusterTestTypes) UpdateStatus(ctx context.Context, clusterTestType *v1beta1.ClusterTestType, opts v1.UpdateOptions) (*v1beta1.ClusterTestType, error) { +func (c *FakeClusterTestTypes) UpdateStatus(ctx context.Context, clusterTestType *v1beta1.ClusterTestType, opts v1.UpdateOptions) (result *v1beta1.ClusterTestType, err error) { + emptyResult := &v1beta1.ClusterTestType{} obj, err := c.Fake. - Invokes(testing.NewRootUpdateSubresourceAction(clustertesttypesResource, "status", clusterTestType), &v1beta1.ClusterTestType{}) + Invokes(testing.NewRootUpdateSubresourceActionWithOptions(clustertesttypesResource, "status", clusterTestType, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1beta1.ClusterTestType), err } @@ -116,7 +121,7 @@ func (c *FakeClusterTestTypes) Delete(ctx context.Context, name string, opts v1. // DeleteCollection deletes a collection of objects. func (c *FakeClusterTestTypes) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewRootDeleteCollectionAction(clustertesttypesResource, listOpts) + action := testing.NewRootDeleteCollectionActionWithOptions(clustertesttypesResource, opts, listOpts) _, err := c.Fake.Invokes(action, &v1beta1.ClusterTestTypeList{}) return err @@ -124,10 +129,11 @@ func (c *FakeClusterTestTypes) DeleteCollection(ctx context.Context, opts v1.Del // Patch applies the patch and returns the patched clusterTestType. func (c *FakeClusterTestTypes) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.ClusterTestType, err error) { + emptyResult := &v1beta1.ClusterTestType{} obj, err := c.Fake. - Invokes(testing.NewRootPatchSubresourceAction(clustertesttypesResource, name, pt, data, subresources...), &v1beta1.ClusterTestType{}) + Invokes(testing.NewRootPatchSubresourceActionWithOptions(clustertesttypesResource, name, pt, data, opts, subresources...), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1beta1.ClusterTestType), err } diff --git a/examples/pkg/generated/clientset/versioned/typed/example/v1beta1/fake/fake_example_client.go b/examples/pkg/generated/clientset/versioned/typed/example/v1beta1/fake/fake_example_client.go index 5c01e090..f4b58eee 100644 --- a/examples/pkg/generated/clientset/versioned/typed/example/v1beta1/fake/fake_example_client.go +++ b/examples/pkg/generated/clientset/versioned/typed/example/v1beta1/fake/fake_example_client.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -// Code generated by client-gen-v0.30. DO NOT EDIT. +// Code generated by client-gen-v0.31. DO NOT EDIT. package fake diff --git a/examples/pkg/generated/clientset/versioned/typed/example/v1beta1/fake/fake_testtype.go b/examples/pkg/generated/clientset/versioned/typed/example/v1beta1/fake/fake_testtype.go index aad22ae6..11c9f12b 100644 --- a/examples/pkg/generated/clientset/versioned/typed/example/v1beta1/fake/fake_testtype.go +++ b/examples/pkg/generated/clientset/versioned/typed/example/v1beta1/fake/fake_testtype.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -// Code generated by client-gen-v0.30. DO NOT EDIT. +// Code generated by client-gen-v0.31. DO NOT EDIT. package fake @@ -22,7 +22,9 @@ import ( "context" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" testing "k8s.io/client-go/testing" v1beta1 "acme.corp/pkg/apis/example/v1beta1" @@ -40,33 +42,66 @@ var testtypesKind = v1beta1.SchemeGroupVersion.WithKind("TestType") // Get takes name of the testType, and returns the corresponding testType object, and an error if there is any. func (c *FakeTestTypes) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta1.TestType, err error) { + emptyResult := &v1beta1.TestType{} obj, err := c.Fake. - Invokes(testing.NewGetAction(testtypesResource, c.ns, name), &v1beta1.TestType{}) + Invokes(testing.NewGetActionWithOptions(testtypesResource, c.ns, name, options), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1beta1.TestType), err } +// List takes label and field selectors, and returns the list of TestTypes that match those selectors. +func (c *FakeTestTypes) List(ctx context.Context, opts v1.ListOptions) (result *v1beta1.TestTypeList, err error) { + emptyResult := &v1beta1.TestTypeList{} + obj, err := c.Fake. + Invokes(testing.NewListActionWithOptions(testtypesResource, testtypesKind, c.ns, opts), emptyResult) + + if obj == nil { + return emptyResult, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1beta1.TestTypeList{ListMeta: obj.(*v1beta1.TestTypeList).ListMeta} + for _, item := range obj.(*v1beta1.TestTypeList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested testTypes. +func (c *FakeTestTypes) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchActionWithOptions(testtypesResource, c.ns, opts)) + +} + // Create takes the representation of a testType and creates it. Returns the server's representation of the testType, and an error, if there is any. func (c *FakeTestTypes) Create(ctx context.Context, testType *v1beta1.TestType, opts v1.CreateOptions) (result *v1beta1.TestType, err error) { + emptyResult := &v1beta1.TestType{} obj, err := c.Fake. - Invokes(testing.NewCreateAction(testtypesResource, c.ns, testType), &v1beta1.TestType{}) + Invokes(testing.NewCreateActionWithOptions(testtypesResource, c.ns, testType, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1beta1.TestType), err } // Update takes the representation of a testType and updates it. Returns the server's representation of the testType, and an error, if there is any. func (c *FakeTestTypes) Update(ctx context.Context, testType *v1beta1.TestType, opts v1.UpdateOptions) (result *v1beta1.TestType, err error) { + emptyResult := &v1beta1.TestType{} obj, err := c.Fake. - Invokes(testing.NewUpdateAction(testtypesResource, c.ns, testType), &v1beta1.TestType{}) + Invokes(testing.NewUpdateActionWithOptions(testtypesResource, c.ns, testType, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1beta1.TestType), err } @@ -81,7 +116,7 @@ func (c *FakeTestTypes) Delete(ctx context.Context, name string, opts v1.DeleteO // DeleteCollection deletes a collection of objects. func (c *FakeTestTypes) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewDeleteCollectionAction(testtypesResource, c.ns, listOpts) + action := testing.NewDeleteCollectionActionWithOptions(testtypesResource, c.ns, opts, listOpts) _, err := c.Fake.Invokes(action, &v1beta1.TestTypeList{}) return err @@ -89,11 +124,12 @@ func (c *FakeTestTypes) DeleteCollection(ctx context.Context, opts v1.DeleteOpti // Patch applies the patch and returns the patched testType. func (c *FakeTestTypes) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.TestType, err error) { + emptyResult := &v1beta1.TestType{} obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(testtypesResource, c.ns, name, pt, data, subresources...), &v1beta1.TestType{}) + Invokes(testing.NewPatchSubresourceActionWithOptions(testtypesResource, c.ns, name, pt, data, opts, subresources...), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1beta1.TestType), err } diff --git a/examples/pkg/generated/clientset/versioned/typed/example/v1beta1/generated_expansion.go b/examples/pkg/generated/clientset/versioned/typed/example/v1beta1/generated_expansion.go index 037d42f6..3561bb83 100644 --- a/examples/pkg/generated/clientset/versioned/typed/example/v1beta1/generated_expansion.go +++ b/examples/pkg/generated/clientset/versioned/typed/example/v1beta1/generated_expansion.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -// Code generated by client-gen-v0.30. DO NOT EDIT. +// Code generated by client-gen-v0.31. DO NOT EDIT. package v1beta1 diff --git a/examples/pkg/generated/clientset/versioned/typed/example/v1beta1/testtype.go b/examples/pkg/generated/clientset/versioned/typed/example/v1beta1/testtype.go index 3b96d09b..e87e5ae9 100644 --- a/examples/pkg/generated/clientset/versioned/typed/example/v1beta1/testtype.go +++ b/examples/pkg/generated/clientset/versioned/typed/example/v1beta1/testtype.go @@ -14,17 +14,17 @@ See the License for the specific language governing permissions and limitations under the License. */ -// Code generated by client-gen-v0.30. DO NOT EDIT. +// Code generated by client-gen-v0.31. DO NOT EDIT. package v1beta1 import ( "context" - "time" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" - rest "k8s.io/client-go/rest" + watch "k8s.io/apimachinery/pkg/watch" + gentype "k8s.io/client-go/gentype" v1beta1 "acme.corp/pkg/apis/example/v1beta1" scheme "acme.corp/pkg/generated/clientset/versioned/scheme" @@ -43,102 +43,26 @@ type TestTypeInterface interface { Delete(ctx context.Context, name string, opts v1.DeleteOptions) error DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error Get(ctx context.Context, name string, opts v1.GetOptions) (*v1beta1.TestType, error) + List(ctx context.Context, opts v1.ListOptions) (*v1beta1.TestTypeList, error) + 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 *v1beta1.TestType, err error) TestTypeExpansion } // testTypes implements TestTypeInterface type testTypes struct { - client rest.Interface - ns string + *gentype.ClientWithList[*v1beta1.TestType, *v1beta1.TestTypeList] } // newTestTypes returns a TestTypes func newTestTypes(c *ExampleV1beta1Client, namespace string) *testTypes { return &testTypes{ - client: c.RESTClient(), - ns: namespace, + gentype.NewClientWithList[*v1beta1.TestType, *v1beta1.TestTypeList]( + "testtypes", + c.RESTClient(), + scheme.ParameterCodec, + namespace, + func() *v1beta1.TestType { return &v1beta1.TestType{} }, + func() *v1beta1.TestTypeList { return &v1beta1.TestTypeList{} }), } } - -// Get takes name of the testType, and returns the corresponding testType object, and an error if there is any. -func (c *testTypes) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta1.TestType, err error) { - result = &v1beta1.TestType{} - err = c.client.Get(). - Namespace(c.ns). - Resource("testtypes"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// Create takes the representation of a testType and creates it. Returns the server's representation of the testType, and an error, if there is any. -func (c *testTypes) Create(ctx context.Context, testType *v1beta1.TestType, opts v1.CreateOptions) (result *v1beta1.TestType, err error) { - result = &v1beta1.TestType{} - err = c.client.Post(). - Namespace(c.ns). - Resource("testtypes"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(testType). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a testType and updates it. Returns the server's representation of the testType, and an error, if there is any. -func (c *testTypes) Update(ctx context.Context, testType *v1beta1.TestType, opts v1.UpdateOptions) (result *v1beta1.TestType, err error) { - result = &v1beta1.TestType{} - err = c.client.Put(). - Namespace(c.ns). - Resource("testtypes"). - Name(testType.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(testType). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the testType and deletes it. Returns an error if one occurs. -func (c *testTypes) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("testtypes"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *testTypes) 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("testtypes"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched testType. -func (c *testTypes) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.TestType, err error) { - result = &v1beta1.TestType{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("testtypes"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/examples/pkg/generated/clientset/versioned/typed/example/v2/clustertesttype.go b/examples/pkg/generated/clientset/versioned/typed/example/v2/clustertesttype.go index 91d18cae..c24a1e3f 100644 --- a/examples/pkg/generated/clientset/versioned/typed/example/v2/clustertesttype.go +++ b/examples/pkg/generated/clientset/versioned/typed/example/v2/clustertesttype.go @@ -14,18 +14,17 @@ See the License for the specific language governing permissions and limitations under the License. */ -// Code generated by client-gen-v0.30. DO NOT EDIT. +// Code generated by client-gen-v0.31. DO NOT EDIT. package v2 import ( "context" - "time" 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" v2 "acme.corp/pkg/apis/example/v2" scheme "acme.corp/pkg/generated/clientset/versioned/scheme" @@ -41,6 +40,7 @@ type ClusterTestTypesGetter interface { type ClusterTestTypeInterface interface { Create(ctx context.Context, clusterTestType *v2.ClusterTestType, opts v1.CreateOptions) (*v2.ClusterTestType, error) Update(ctx context.Context, clusterTestType *v2.ClusterTestType, opts v1.UpdateOptions) (*v2.ClusterTestType, error) + // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). UpdateStatus(ctx context.Context, clusterTestType *v2.ClusterTestType, opts v1.UpdateOptions) (*v2.ClusterTestType, error) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error @@ -53,133 +53,18 @@ type ClusterTestTypeInterface interface { // clusterTestTypes implements ClusterTestTypeInterface type clusterTestTypes struct { - client rest.Interface + *gentype.ClientWithList[*v2.ClusterTestType, *v2.ClusterTestTypeList] } // newClusterTestTypes returns a ClusterTestTypes func newClusterTestTypes(c *ExampleV2Client) *clusterTestTypes { return &clusterTestTypes{ - client: c.RESTClient(), + gentype.NewClientWithList[*v2.ClusterTestType, *v2.ClusterTestTypeList]( + "clustertesttypes", + c.RESTClient(), + scheme.ParameterCodec, + "", + func() *v2.ClusterTestType { return &v2.ClusterTestType{} }, + func() *v2.ClusterTestTypeList { return &v2.ClusterTestTypeList{} }), } } - -// Get takes name of the clusterTestType, and returns the corresponding clusterTestType object, and an error if there is any. -func (c *clusterTestTypes) Get(ctx context.Context, name string, options v1.GetOptions) (result *v2.ClusterTestType, err error) { - result = &v2.ClusterTestType{} - err = c.client.Get(). - Resource("clustertesttypes"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of ClusterTestTypes that match those selectors. -func (c *clusterTestTypes) List(ctx context.Context, opts v1.ListOptions) (result *v2.ClusterTestTypeList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v2.ClusterTestTypeList{} - err = c.client.Get(). - Resource("clustertesttypes"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested clusterTestTypes. -func (c *clusterTestTypes) 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(). - Resource("clustertesttypes"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a clusterTestType and creates it. Returns the server's representation of the clusterTestType, and an error, if there is any. -func (c *clusterTestTypes) Create(ctx context.Context, clusterTestType *v2.ClusterTestType, opts v1.CreateOptions) (result *v2.ClusterTestType, err error) { - result = &v2.ClusterTestType{} - err = c.client.Post(). - Resource("clustertesttypes"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(clusterTestType). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a clusterTestType and updates it. Returns the server's representation of the clusterTestType, and an error, if there is any. -func (c *clusterTestTypes) Update(ctx context.Context, clusterTestType *v2.ClusterTestType, opts v1.UpdateOptions) (result *v2.ClusterTestType, err error) { - result = &v2.ClusterTestType{} - err = c.client.Put(). - Resource("clustertesttypes"). - Name(clusterTestType.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(clusterTestType). - 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 *clusterTestTypes) UpdateStatus(ctx context.Context, clusterTestType *v2.ClusterTestType, opts v1.UpdateOptions) (result *v2.ClusterTestType, err error) { - result = &v2.ClusterTestType{} - err = c.client.Put(). - Resource("clustertesttypes"). - Name(clusterTestType.Name). - SubResource("status"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(clusterTestType). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the clusterTestType and deletes it. Returns an error if one occurs. -func (c *clusterTestTypes) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Resource("clustertesttypes"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *clusterTestTypes) 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(). - Resource("clustertesttypes"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched clusterTestType. -func (c *clusterTestTypes) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2.ClusterTestType, err error) { - result = &v2.ClusterTestType{} - err = c.client.Patch(pt). - Resource("clustertesttypes"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/examples/pkg/generated/clientset/versioned/typed/example/v2/doc.go b/examples/pkg/generated/clientset/versioned/typed/example/v2/doc.go index 1e48f874..c2e5631c 100644 --- a/examples/pkg/generated/clientset/versioned/typed/example/v2/doc.go +++ b/examples/pkg/generated/clientset/versioned/typed/example/v2/doc.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -// Code generated by client-gen-v0.30. DO NOT EDIT. +// Code generated by client-gen-v0.31. DO NOT EDIT. // This package has the automatically generated typed clients. package v2 diff --git a/examples/pkg/generated/clientset/versioned/typed/example/v2/example_client.go b/examples/pkg/generated/clientset/versioned/typed/example/v2/example_client.go index 1b11b918..7d3f1d11 100644 --- a/examples/pkg/generated/clientset/versioned/typed/example/v2/example_client.go +++ b/examples/pkg/generated/clientset/versioned/typed/example/v2/example_client.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -// Code generated by client-gen-v0.30. DO NOT EDIT. +// Code generated by client-gen-v0.31. DO NOT EDIT. package v2 diff --git a/examples/pkg/generated/clientset/versioned/typed/example/v2/fake/doc.go b/examples/pkg/generated/clientset/versioned/typed/example/v2/fake/doc.go index e6378fda..43d633d7 100644 --- a/examples/pkg/generated/clientset/versioned/typed/example/v2/fake/doc.go +++ b/examples/pkg/generated/clientset/versioned/typed/example/v2/fake/doc.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -// Code generated by client-gen-v0.30. DO NOT EDIT. +// Code generated by client-gen-v0.31. DO NOT EDIT. // Package fake has the automatically generated clients. package fake diff --git a/examples/pkg/generated/clientset/versioned/typed/example/v2/fake/fake_clustertesttype.go b/examples/pkg/generated/clientset/versioned/typed/example/v2/fake/fake_clustertesttype.go index cd21aa69..0ba1104e 100644 --- a/examples/pkg/generated/clientset/versioned/typed/example/v2/fake/fake_clustertesttype.go +++ b/examples/pkg/generated/clientset/versioned/typed/example/v2/fake/fake_clustertesttype.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -// Code generated by client-gen-v0.30. DO NOT EDIT. +// Code generated by client-gen-v0.31. DO NOT EDIT. package fake @@ -41,20 +41,22 @@ var clustertesttypesKind = v2.SchemeGroupVersion.WithKind("ClusterTestType") // Get takes name of the clusterTestType, and returns the corresponding clusterTestType object, and an error if there is any. func (c *FakeClusterTestTypes) Get(ctx context.Context, name string, options v1.GetOptions) (result *v2.ClusterTestType, err error) { + emptyResult := &v2.ClusterTestType{} obj, err := c.Fake. - Invokes(testing.NewRootGetAction(clustertesttypesResource, name), &v2.ClusterTestType{}) + Invokes(testing.NewRootGetActionWithOptions(clustertesttypesResource, name, options), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v2.ClusterTestType), err } // List takes label and field selectors, and returns the list of ClusterTestTypes that match those selectors. func (c *FakeClusterTestTypes) List(ctx context.Context, opts v1.ListOptions) (result *v2.ClusterTestTypeList, err error) { + emptyResult := &v2.ClusterTestTypeList{} obj, err := c.Fake. - Invokes(testing.NewRootListAction(clustertesttypesResource, clustertesttypesKind, opts), &v2.ClusterTestTypeList{}) + Invokes(testing.NewRootListActionWithOptions(clustertesttypesResource, clustertesttypesKind, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } label, _, _ := testing.ExtractFromListOptions(opts) @@ -73,36 +75,39 @@ func (c *FakeClusterTestTypes) List(ctx context.Context, opts v1.ListOptions) (r // Watch returns a watch.Interface that watches the requested clusterTestTypes. func (c *FakeClusterTestTypes) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { return c.Fake. - InvokesWatch(testing.NewRootWatchAction(clustertesttypesResource, opts)) + InvokesWatch(testing.NewRootWatchActionWithOptions(clustertesttypesResource, opts)) } // Create takes the representation of a clusterTestType and creates it. Returns the server's representation of the clusterTestType, and an error, if there is any. func (c *FakeClusterTestTypes) Create(ctx context.Context, clusterTestType *v2.ClusterTestType, opts v1.CreateOptions) (result *v2.ClusterTestType, err error) { + emptyResult := &v2.ClusterTestType{} obj, err := c.Fake. - Invokes(testing.NewRootCreateAction(clustertesttypesResource, clusterTestType), &v2.ClusterTestType{}) + Invokes(testing.NewRootCreateActionWithOptions(clustertesttypesResource, clusterTestType, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v2.ClusterTestType), err } // Update takes the representation of a clusterTestType and updates it. Returns the server's representation of the clusterTestType, and an error, if there is any. func (c *FakeClusterTestTypes) Update(ctx context.Context, clusterTestType *v2.ClusterTestType, opts v1.UpdateOptions) (result *v2.ClusterTestType, err error) { + emptyResult := &v2.ClusterTestType{} obj, err := c.Fake. - Invokes(testing.NewRootUpdateAction(clustertesttypesResource, clusterTestType), &v2.ClusterTestType{}) + Invokes(testing.NewRootUpdateActionWithOptions(clustertesttypesResource, clusterTestType, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v2.ClusterTestType), 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 *FakeClusterTestTypes) UpdateStatus(ctx context.Context, clusterTestType *v2.ClusterTestType, opts v1.UpdateOptions) (*v2.ClusterTestType, error) { +func (c *FakeClusterTestTypes) UpdateStatus(ctx context.Context, clusterTestType *v2.ClusterTestType, opts v1.UpdateOptions) (result *v2.ClusterTestType, err error) { + emptyResult := &v2.ClusterTestType{} obj, err := c.Fake. - Invokes(testing.NewRootUpdateSubresourceAction(clustertesttypesResource, "status", clusterTestType), &v2.ClusterTestType{}) + Invokes(testing.NewRootUpdateSubresourceActionWithOptions(clustertesttypesResource, "status", clusterTestType, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v2.ClusterTestType), err } @@ -116,7 +121,7 @@ func (c *FakeClusterTestTypes) Delete(ctx context.Context, name string, opts v1. // DeleteCollection deletes a collection of objects. func (c *FakeClusterTestTypes) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewRootDeleteCollectionAction(clustertesttypesResource, listOpts) + action := testing.NewRootDeleteCollectionActionWithOptions(clustertesttypesResource, opts, listOpts) _, err := c.Fake.Invokes(action, &v2.ClusterTestTypeList{}) return err @@ -124,10 +129,11 @@ func (c *FakeClusterTestTypes) DeleteCollection(ctx context.Context, opts v1.Del // Patch applies the patch and returns the patched clusterTestType. func (c *FakeClusterTestTypes) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2.ClusterTestType, err error) { + emptyResult := &v2.ClusterTestType{} obj, err := c.Fake. - Invokes(testing.NewRootPatchSubresourceAction(clustertesttypesResource, name, pt, data, subresources...), &v2.ClusterTestType{}) + Invokes(testing.NewRootPatchSubresourceActionWithOptions(clustertesttypesResource, name, pt, data, opts, subresources...), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v2.ClusterTestType), err } diff --git a/examples/pkg/generated/clientset/versioned/typed/example/v2/fake/fake_example_client.go b/examples/pkg/generated/clientset/versioned/typed/example/v2/fake/fake_example_client.go index edbeeedc..adc82fd1 100644 --- a/examples/pkg/generated/clientset/versioned/typed/example/v2/fake/fake_example_client.go +++ b/examples/pkg/generated/clientset/versioned/typed/example/v2/fake/fake_example_client.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -// Code generated by client-gen-v0.30. DO NOT EDIT. +// Code generated by client-gen-v0.31. DO NOT EDIT. package fake diff --git a/examples/pkg/generated/clientset/versioned/typed/example/v2/fake/fake_testtype.go b/examples/pkg/generated/clientset/versioned/typed/example/v2/fake/fake_testtype.go index e9dfc6d0..878e5e88 100644 --- a/examples/pkg/generated/clientset/versioned/typed/example/v2/fake/fake_testtype.go +++ b/examples/pkg/generated/clientset/versioned/typed/example/v2/fake/fake_testtype.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -// Code generated by client-gen-v0.30. DO NOT EDIT. +// Code generated by client-gen-v0.31. DO NOT EDIT. package fake @@ -42,22 +42,24 @@ var testtypesKind = v2.SchemeGroupVersion.WithKind("TestType") // Get takes name of the testType, and returns the corresponding testType object, and an error if there is any. func (c *FakeTestTypes) Get(ctx context.Context, name string, options v1.GetOptions) (result *v2.TestType, err error) { + emptyResult := &v2.TestType{} obj, err := c.Fake. - Invokes(testing.NewGetAction(testtypesResource, c.ns, name), &v2.TestType{}) + Invokes(testing.NewGetActionWithOptions(testtypesResource, c.ns, name, options), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v2.TestType), err } // List takes label and field selectors, and returns the list of TestTypes that match those selectors. func (c *FakeTestTypes) List(ctx context.Context, opts v1.ListOptions) (result *v2.TestTypeList, err error) { + emptyResult := &v2.TestTypeList{} obj, err := c.Fake. - Invokes(testing.NewListAction(testtypesResource, testtypesKind, c.ns, opts), &v2.TestTypeList{}) + Invokes(testing.NewListActionWithOptions(testtypesResource, testtypesKind, c.ns, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } label, _, _ := testing.ExtractFromListOptions(opts) @@ -76,28 +78,30 @@ func (c *FakeTestTypes) List(ctx context.Context, opts v1.ListOptions) (result * // Watch returns a watch.Interface that watches the requested testTypes. func (c *FakeTestTypes) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { return c.Fake. - InvokesWatch(testing.NewWatchAction(testtypesResource, c.ns, opts)) + InvokesWatch(testing.NewWatchActionWithOptions(testtypesResource, c.ns, opts)) } // Create takes the representation of a testType and creates it. Returns the server's representation of the testType, and an error, if there is any. func (c *FakeTestTypes) Create(ctx context.Context, testType *v2.TestType, opts v1.CreateOptions) (result *v2.TestType, err error) { + emptyResult := &v2.TestType{} obj, err := c.Fake. - Invokes(testing.NewCreateAction(testtypesResource, c.ns, testType), &v2.TestType{}) + Invokes(testing.NewCreateActionWithOptions(testtypesResource, c.ns, testType, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v2.TestType), err } // Update takes the representation of a testType and updates it. Returns the server's representation of the testType, and an error, if there is any. func (c *FakeTestTypes) Update(ctx context.Context, testType *v2.TestType, opts v1.UpdateOptions) (result *v2.TestType, err error) { + emptyResult := &v2.TestType{} obj, err := c.Fake. - Invokes(testing.NewUpdateAction(testtypesResource, c.ns, testType), &v2.TestType{}) + Invokes(testing.NewUpdateActionWithOptions(testtypesResource, c.ns, testType, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v2.TestType), err } @@ -112,7 +116,7 @@ func (c *FakeTestTypes) Delete(ctx context.Context, name string, opts v1.DeleteO // DeleteCollection deletes a collection of objects. func (c *FakeTestTypes) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewDeleteCollectionAction(testtypesResource, c.ns, listOpts) + action := testing.NewDeleteCollectionActionWithOptions(testtypesResource, c.ns, opts, listOpts) _, err := c.Fake.Invokes(action, &v2.TestTypeList{}) return err @@ -120,11 +124,12 @@ func (c *FakeTestTypes) DeleteCollection(ctx context.Context, opts v1.DeleteOpti // Patch applies the patch and returns the patched testType. func (c *FakeTestTypes) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2.TestType, err error) { + emptyResult := &v2.TestType{} obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(testtypesResource, c.ns, name, pt, data, subresources...), &v2.TestType{}) + Invokes(testing.NewPatchSubresourceActionWithOptions(testtypesResource, c.ns, name, pt, data, opts, subresources...), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v2.TestType), err } diff --git a/examples/pkg/generated/clientset/versioned/typed/example/v2/generated_expansion.go b/examples/pkg/generated/clientset/versioned/typed/example/v2/generated_expansion.go index c8da718e..233b68ad 100644 --- a/examples/pkg/generated/clientset/versioned/typed/example/v2/generated_expansion.go +++ b/examples/pkg/generated/clientset/versioned/typed/example/v2/generated_expansion.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -// Code generated by client-gen-v0.30. DO NOT EDIT. +// Code generated by client-gen-v0.31. DO NOT EDIT. package v2 diff --git a/examples/pkg/generated/clientset/versioned/typed/example/v2/testtype.go b/examples/pkg/generated/clientset/versioned/typed/example/v2/testtype.go index 641663ec..8408c954 100644 --- a/examples/pkg/generated/clientset/versioned/typed/example/v2/testtype.go +++ b/examples/pkg/generated/clientset/versioned/typed/example/v2/testtype.go @@ -14,18 +14,17 @@ See the License for the specific language governing permissions and limitations under the License. */ -// Code generated by client-gen-v0.30. DO NOT EDIT. +// Code generated by client-gen-v0.31. DO NOT EDIT. package v2 import ( "context" - "time" 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" v2 "acme.corp/pkg/apis/example/v2" scheme "acme.corp/pkg/generated/clientset/versioned/scheme" @@ -52,128 +51,18 @@ type TestTypeInterface interface { // testTypes implements TestTypeInterface type testTypes struct { - client rest.Interface - ns string + *gentype.ClientWithList[*v2.TestType, *v2.TestTypeList] } // newTestTypes returns a TestTypes func newTestTypes(c *ExampleV2Client, namespace string) *testTypes { return &testTypes{ - client: c.RESTClient(), - ns: namespace, + gentype.NewClientWithList[*v2.TestType, *v2.TestTypeList]( + "testtypes", + c.RESTClient(), + scheme.ParameterCodec, + namespace, + func() *v2.TestType { return &v2.TestType{} }, + func() *v2.TestTypeList { return &v2.TestTypeList{} }), } } - -// Get takes name of the testType, and returns the corresponding testType object, and an error if there is any. -func (c *testTypes) Get(ctx context.Context, name string, options v1.GetOptions) (result *v2.TestType, err error) { - result = &v2.TestType{} - err = c.client.Get(). - Namespace(c.ns). - Resource("testtypes"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of TestTypes that match those selectors. -func (c *testTypes) List(ctx context.Context, opts v1.ListOptions) (result *v2.TestTypeList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v2.TestTypeList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("testtypes"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested testTypes. -func (c *testTypes) 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("testtypes"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a testType and creates it. Returns the server's representation of the testType, and an error, if there is any. -func (c *testTypes) Create(ctx context.Context, testType *v2.TestType, opts v1.CreateOptions) (result *v2.TestType, err error) { - result = &v2.TestType{} - err = c.client.Post(). - Namespace(c.ns). - Resource("testtypes"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(testType). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a testType and updates it. Returns the server's representation of the testType, and an error, if there is any. -func (c *testTypes) Update(ctx context.Context, testType *v2.TestType, opts v1.UpdateOptions) (result *v2.TestType, err error) { - result = &v2.TestType{} - err = c.client.Put(). - Namespace(c.ns). - Resource("testtypes"). - Name(testType.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(testType). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the testType and deletes it. Returns an error if one occurs. -func (c *testTypes) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("testtypes"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *testTypes) 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("testtypes"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched testType. -func (c *testTypes) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2.TestType, err error) { - result = &v2.TestType{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("testtypes"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/examples/pkg/generated/clientset/versioned/typed/example3/v1/clustertesttype.go b/examples/pkg/generated/clientset/versioned/typed/example3/v1/clustertesttype.go index 6c31eeca..b75ea1bb 100644 --- a/examples/pkg/generated/clientset/versioned/typed/example3/v1/clustertesttype.go +++ b/examples/pkg/generated/clientset/versioned/typed/example3/v1/clustertesttype.go @@ -14,18 +14,17 @@ See the License for the specific language governing permissions and limitations under the License. */ -// Code generated by client-gen-v0.30. DO NOT EDIT. +// Code generated by client-gen-v0.31. DO NOT EDIT. package v1 import ( "context" - "time" metav1 "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" v1 "acme.corp/pkg/apis/example3/v1" scheme "acme.corp/pkg/generated/clientset/versioned/scheme" @@ -41,6 +40,7 @@ type ClusterTestTypesGetter interface { type ClusterTestTypeInterface interface { Create(ctx context.Context, clusterTestType *v1.ClusterTestType, opts metav1.CreateOptions) (*v1.ClusterTestType, error) Update(ctx context.Context, clusterTestType *v1.ClusterTestType, opts metav1.UpdateOptions) (*v1.ClusterTestType, error) + // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). UpdateStatus(ctx context.Context, clusterTestType *v1.ClusterTestType, opts metav1.UpdateOptions) (*v1.ClusterTestType, error) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error @@ -53,133 +53,18 @@ type ClusterTestTypeInterface interface { // clusterTestTypes implements ClusterTestTypeInterface type clusterTestTypes struct { - client rest.Interface + *gentype.ClientWithList[*v1.ClusterTestType, *v1.ClusterTestTypeList] } // newClusterTestTypes returns a ClusterTestTypes func newClusterTestTypes(c *Example3V1Client) *clusterTestTypes { return &clusterTestTypes{ - client: c.RESTClient(), + gentype.NewClientWithList[*v1.ClusterTestType, *v1.ClusterTestTypeList]( + "clustertesttypes", + c.RESTClient(), + scheme.ParameterCodec, + "", + func() *v1.ClusterTestType { return &v1.ClusterTestType{} }, + func() *v1.ClusterTestTypeList { return &v1.ClusterTestTypeList{} }), } } - -// Get takes name of the clusterTestType, and returns the corresponding clusterTestType object, and an error if there is any. -func (c *clusterTestTypes) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.ClusterTestType, err error) { - result = &v1.ClusterTestType{} - err = c.client.Get(). - Resource("clustertesttypes"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of ClusterTestTypes that match those selectors. -func (c *clusterTestTypes) List(ctx context.Context, opts metav1.ListOptions) (result *v1.ClusterTestTypeList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1.ClusterTestTypeList{} - err = c.client.Get(). - Resource("clustertesttypes"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested clusterTestTypes. -func (c *clusterTestTypes) Watch(ctx context.Context, opts metav1.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(). - Resource("clustertesttypes"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a clusterTestType and creates it. Returns the server's representation of the clusterTestType, and an error, if there is any. -func (c *clusterTestTypes) Create(ctx context.Context, clusterTestType *v1.ClusterTestType, opts metav1.CreateOptions) (result *v1.ClusterTestType, err error) { - result = &v1.ClusterTestType{} - err = c.client.Post(). - Resource("clustertesttypes"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(clusterTestType). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a clusterTestType and updates it. Returns the server's representation of the clusterTestType, and an error, if there is any. -func (c *clusterTestTypes) Update(ctx context.Context, clusterTestType *v1.ClusterTestType, opts metav1.UpdateOptions) (result *v1.ClusterTestType, err error) { - result = &v1.ClusterTestType{} - err = c.client.Put(). - Resource("clustertesttypes"). - Name(clusterTestType.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(clusterTestType). - 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 *clusterTestTypes) UpdateStatus(ctx context.Context, clusterTestType *v1.ClusterTestType, opts metav1.UpdateOptions) (result *v1.ClusterTestType, err error) { - result = &v1.ClusterTestType{} - err = c.client.Put(). - Resource("clustertesttypes"). - Name(clusterTestType.Name). - SubResource("status"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(clusterTestType). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the clusterTestType and deletes it. Returns an error if one occurs. -func (c *clusterTestTypes) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { - return c.client.Delete(). - Resource("clustertesttypes"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *clusterTestTypes) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Resource("clustertesttypes"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched clusterTestType. -func (c *clusterTestTypes) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.ClusterTestType, err error) { - result = &v1.ClusterTestType{} - err = c.client.Patch(pt). - Resource("clustertesttypes"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/examples/pkg/generated/clientset/versioned/typed/example3/v1/doc.go b/examples/pkg/generated/clientset/versioned/typed/example3/v1/doc.go index 29ee4bf0..b2e49efd 100644 --- a/examples/pkg/generated/clientset/versioned/typed/example3/v1/doc.go +++ b/examples/pkg/generated/clientset/versioned/typed/example3/v1/doc.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -// Code generated by client-gen-v0.30. DO NOT EDIT. +// Code generated by client-gen-v0.31. DO NOT EDIT. // This package has the automatically generated typed clients. package v1 diff --git a/examples/pkg/generated/clientset/versioned/typed/example3/v1/example3_client.go b/examples/pkg/generated/clientset/versioned/typed/example3/v1/example3_client.go index 6e8e297f..db3fb806 100644 --- a/examples/pkg/generated/clientset/versioned/typed/example3/v1/example3_client.go +++ b/examples/pkg/generated/clientset/versioned/typed/example3/v1/example3_client.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -// Code generated by client-gen-v0.30. DO NOT EDIT. +// Code generated by client-gen-v0.31. DO NOT EDIT. package v1 diff --git a/examples/pkg/generated/clientset/versioned/typed/example3/v1/fake/doc.go b/examples/pkg/generated/clientset/versioned/typed/example3/v1/fake/doc.go index e6378fda..43d633d7 100644 --- a/examples/pkg/generated/clientset/versioned/typed/example3/v1/fake/doc.go +++ b/examples/pkg/generated/clientset/versioned/typed/example3/v1/fake/doc.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -// Code generated by client-gen-v0.30. DO NOT EDIT. +// Code generated by client-gen-v0.31. DO NOT EDIT. // Package fake has the automatically generated clients. package fake diff --git a/examples/pkg/generated/clientset/versioned/typed/example3/v1/fake/fake_clustertesttype.go b/examples/pkg/generated/clientset/versioned/typed/example3/v1/fake/fake_clustertesttype.go index 968595b5..340e736d 100644 --- a/examples/pkg/generated/clientset/versioned/typed/example3/v1/fake/fake_clustertesttype.go +++ b/examples/pkg/generated/clientset/versioned/typed/example3/v1/fake/fake_clustertesttype.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -// Code generated by client-gen-v0.30. DO NOT EDIT. +// Code generated by client-gen-v0.31. DO NOT EDIT. package fake @@ -41,20 +41,22 @@ var clustertesttypesKind = v1.SchemeGroupVersion.WithKind("ClusterTestType") // Get takes name of the clusterTestType, and returns the corresponding clusterTestType object, and an error if there is any. func (c *FakeClusterTestTypes) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.ClusterTestType, err error) { + emptyResult := &v1.ClusterTestType{} obj, err := c.Fake. - Invokes(testing.NewRootGetAction(clustertesttypesResource, name), &v1.ClusterTestType{}) + Invokes(testing.NewRootGetActionWithOptions(clustertesttypesResource, name, options), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1.ClusterTestType), err } // List takes label and field selectors, and returns the list of ClusterTestTypes that match those selectors. func (c *FakeClusterTestTypes) List(ctx context.Context, opts metav1.ListOptions) (result *v1.ClusterTestTypeList, err error) { + emptyResult := &v1.ClusterTestTypeList{} obj, err := c.Fake. - Invokes(testing.NewRootListAction(clustertesttypesResource, clustertesttypesKind, opts), &v1.ClusterTestTypeList{}) + Invokes(testing.NewRootListActionWithOptions(clustertesttypesResource, clustertesttypesKind, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } label, _, _ := testing.ExtractFromListOptions(opts) @@ -73,36 +75,39 @@ func (c *FakeClusterTestTypes) List(ctx context.Context, opts metav1.ListOptions // Watch returns a watch.Interface that watches the requested clusterTestTypes. func (c *FakeClusterTestTypes) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { return c.Fake. - InvokesWatch(testing.NewRootWatchAction(clustertesttypesResource, opts)) + InvokesWatch(testing.NewRootWatchActionWithOptions(clustertesttypesResource, opts)) } // Create takes the representation of a clusterTestType and creates it. Returns the server's representation of the clusterTestType, and an error, if there is any. func (c *FakeClusterTestTypes) Create(ctx context.Context, clusterTestType *v1.ClusterTestType, opts metav1.CreateOptions) (result *v1.ClusterTestType, err error) { + emptyResult := &v1.ClusterTestType{} obj, err := c.Fake. - Invokes(testing.NewRootCreateAction(clustertesttypesResource, clusterTestType), &v1.ClusterTestType{}) + Invokes(testing.NewRootCreateActionWithOptions(clustertesttypesResource, clusterTestType, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1.ClusterTestType), err } // Update takes the representation of a clusterTestType and updates it. Returns the server's representation of the clusterTestType, and an error, if there is any. func (c *FakeClusterTestTypes) Update(ctx context.Context, clusterTestType *v1.ClusterTestType, opts metav1.UpdateOptions) (result *v1.ClusterTestType, err error) { + emptyResult := &v1.ClusterTestType{} obj, err := c.Fake. - Invokes(testing.NewRootUpdateAction(clustertesttypesResource, clusterTestType), &v1.ClusterTestType{}) + Invokes(testing.NewRootUpdateActionWithOptions(clustertesttypesResource, clusterTestType, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1.ClusterTestType), 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 *FakeClusterTestTypes) UpdateStatus(ctx context.Context, clusterTestType *v1.ClusterTestType, opts metav1.UpdateOptions) (*v1.ClusterTestType, error) { +func (c *FakeClusterTestTypes) UpdateStatus(ctx context.Context, clusterTestType *v1.ClusterTestType, opts metav1.UpdateOptions) (result *v1.ClusterTestType, err error) { + emptyResult := &v1.ClusterTestType{} obj, err := c.Fake. - Invokes(testing.NewRootUpdateSubresourceAction(clustertesttypesResource, "status", clusterTestType), &v1.ClusterTestType{}) + Invokes(testing.NewRootUpdateSubresourceActionWithOptions(clustertesttypesResource, "status", clusterTestType, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1.ClusterTestType), err } @@ -116,7 +121,7 @@ func (c *FakeClusterTestTypes) Delete(ctx context.Context, name string, opts met // DeleteCollection deletes a collection of objects. func (c *FakeClusterTestTypes) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { - action := testing.NewRootDeleteCollectionAction(clustertesttypesResource, listOpts) + action := testing.NewRootDeleteCollectionActionWithOptions(clustertesttypesResource, opts, listOpts) _, err := c.Fake.Invokes(action, &v1.ClusterTestTypeList{}) return err @@ -124,10 +129,11 @@ func (c *FakeClusterTestTypes) DeleteCollection(ctx context.Context, opts metav1 // Patch applies the patch and returns the patched clusterTestType. func (c *FakeClusterTestTypes) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.ClusterTestType, err error) { + emptyResult := &v1.ClusterTestType{} obj, err := c.Fake. - Invokes(testing.NewRootPatchSubresourceAction(clustertesttypesResource, name, pt, data, subresources...), &v1.ClusterTestType{}) + Invokes(testing.NewRootPatchSubresourceActionWithOptions(clustertesttypesResource, name, pt, data, opts, subresources...), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1.ClusterTestType), err } diff --git a/examples/pkg/generated/clientset/versioned/typed/example3/v1/fake/fake_example3_client.go b/examples/pkg/generated/clientset/versioned/typed/example3/v1/fake/fake_example3_client.go index 525e6119..32fd0087 100644 --- a/examples/pkg/generated/clientset/versioned/typed/example3/v1/fake/fake_example3_client.go +++ b/examples/pkg/generated/clientset/versioned/typed/example3/v1/fake/fake_example3_client.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -// Code generated by client-gen-v0.30. DO NOT EDIT. +// Code generated by client-gen-v0.31. DO NOT EDIT. package fake diff --git a/examples/pkg/generated/clientset/versioned/typed/example3/v1/fake/fake_testtype.go b/examples/pkg/generated/clientset/versioned/typed/example3/v1/fake/fake_testtype.go index cfeca1e5..8e3e288d 100644 --- a/examples/pkg/generated/clientset/versioned/typed/example3/v1/fake/fake_testtype.go +++ b/examples/pkg/generated/clientset/versioned/typed/example3/v1/fake/fake_testtype.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -// Code generated by client-gen-v0.30. DO NOT EDIT. +// Code generated by client-gen-v0.31. DO NOT EDIT. package fake @@ -43,22 +43,24 @@ var testtypesKind = v1.SchemeGroupVersion.WithKind("TestType") // Get takes name of the testType, and returns the corresponding testType object, and an error if there is any. func (c *FakeTestTypes) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.TestType, err error) { + emptyResult := &v1.TestType{} obj, err := c.Fake. - Invokes(testing.NewGetAction(testtypesResource, c.ns, name), &v1.TestType{}) + Invokes(testing.NewGetActionWithOptions(testtypesResource, c.ns, name, options), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1.TestType), err } // List takes label and field selectors, and returns the list of TestTypes that match those selectors. func (c *FakeTestTypes) List(ctx context.Context, opts metav1.ListOptions) (result *v1.TestTypeList, err error) { + emptyResult := &v1.TestTypeList{} obj, err := c.Fake. - Invokes(testing.NewListAction(testtypesResource, testtypesKind, c.ns, opts), &v1.TestTypeList{}) + Invokes(testing.NewListActionWithOptions(testtypesResource, testtypesKind, c.ns, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } label, _, _ := testing.ExtractFromListOptions(opts) @@ -77,28 +79,30 @@ func (c *FakeTestTypes) List(ctx context.Context, opts metav1.ListOptions) (resu // Watch returns a watch.Interface that watches the requested testTypes. func (c *FakeTestTypes) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { return c.Fake. - InvokesWatch(testing.NewWatchAction(testtypesResource, c.ns, opts)) + InvokesWatch(testing.NewWatchActionWithOptions(testtypesResource, c.ns, opts)) } // Create takes the representation of a testType and creates it. Returns the server's representation of the testType, and an error, if there is any. func (c *FakeTestTypes) Create(ctx context.Context, testType *v1.TestType, opts metav1.CreateOptions) (result *v1.TestType, err error) { + emptyResult := &v1.TestType{} obj, err := c.Fake. - Invokes(testing.NewCreateAction(testtypesResource, c.ns, testType), &v1.TestType{}) + Invokes(testing.NewCreateActionWithOptions(testtypesResource, c.ns, testType, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1.TestType), err } // Update takes the representation of a testType and updates it. Returns the server's representation of the testType, and an error, if there is any. func (c *FakeTestTypes) Update(ctx context.Context, testType *v1.TestType, opts metav1.UpdateOptions) (result *v1.TestType, err error) { + emptyResult := &v1.TestType{} obj, err := c.Fake. - Invokes(testing.NewUpdateAction(testtypesResource, c.ns, testType), &v1.TestType{}) + Invokes(testing.NewUpdateActionWithOptions(testtypesResource, c.ns, testType, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1.TestType), err } @@ -113,7 +117,7 @@ func (c *FakeTestTypes) Delete(ctx context.Context, name string, opts metav1.Del // DeleteCollection deletes a collection of objects. func (c *FakeTestTypes) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { - action := testing.NewDeleteCollectionAction(testtypesResource, c.ns, listOpts) + action := testing.NewDeleteCollectionActionWithOptions(testtypesResource, c.ns, opts, listOpts) _, err := c.Fake.Invokes(action, &v1.TestTypeList{}) return err @@ -121,44 +125,48 @@ func (c *FakeTestTypes) DeleteCollection(ctx context.Context, opts metav1.Delete // Patch applies the patch and returns the patched testType. func (c *FakeTestTypes) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.TestType, err error) { + emptyResult := &v1.TestType{} obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(testtypesResource, c.ns, name, pt, data, subresources...), &v1.TestType{}) + Invokes(testing.NewPatchSubresourceActionWithOptions(testtypesResource, c.ns, name, pt, data, opts, subresources...), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1.TestType), err } // CreateField takes the representation of a field and creates it. Returns the server's representation of the field, and an error, if there is any. func (c *FakeTestTypes) CreateField(ctx context.Context, testTypeName string, field *examplev1.Field, opts metav1.CreateOptions) (result *examplev1.Field, err error) { + emptyResult := &examplev1.Field{} obj, err := c.Fake. - Invokes(testing.NewCreateSubresourceAction(testtypesResource, testTypeName, "field", c.ns, field), &examplev1.Field{}) + Invokes(testing.NewCreateSubresourceActionWithOptions(testtypesResource, testTypeName, "field", c.ns, field, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*examplev1.Field), err } // UpdateField takes the representation of a field and updates it. Returns the server's representation of the field, and an error, if there is any. func (c *FakeTestTypes) UpdateField(ctx context.Context, testTypeName string, field *examplev1.Field, opts metav1.UpdateOptions) (result *examplev1.Field, err error) { + emptyResult := &examplev1.Field{} obj, err := c.Fake. - Invokes(testing.NewUpdateSubresourceAction(testtypesResource, "field", c.ns, field), &examplev1.Field{}) + Invokes(testing.NewUpdateSubresourceActionWithOptions(testtypesResource, "field", c.ns, field, opts), &examplev1.Field{}) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*examplev1.Field), err } // GetField takes name of the testType, and returns the corresponding field object, and an error if there is any. func (c *FakeTestTypes) GetField(ctx context.Context, testTypeName string, options metav1.GetOptions) (result *examplev1.Field, err error) { + emptyResult := &examplev1.Field{} obj, err := c.Fake. - Invokes(testing.NewGetSubresourceAction(testtypesResource, c.ns, "field", testTypeName), &examplev1.Field{}) + Invokes(testing.NewGetSubresourceActionWithOptions(testtypesResource, c.ns, "field", testTypeName, options), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*examplev1.Field), err } diff --git a/examples/pkg/generated/clientset/versioned/typed/example3/v1/generated_expansion.go b/examples/pkg/generated/clientset/versioned/typed/example3/v1/generated_expansion.go index 1a5176b5..4233cb0e 100644 --- a/examples/pkg/generated/clientset/versioned/typed/example3/v1/generated_expansion.go +++ b/examples/pkg/generated/clientset/versioned/typed/example3/v1/generated_expansion.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -// Code generated by client-gen-v0.30. DO NOT EDIT. +// Code generated by client-gen-v0.31. DO NOT EDIT. package v1 diff --git a/examples/pkg/generated/clientset/versioned/typed/example3/v1/testtype.go b/examples/pkg/generated/clientset/versioned/typed/example3/v1/testtype.go index ad27526a..7b1586d1 100644 --- a/examples/pkg/generated/clientset/versioned/typed/example3/v1/testtype.go +++ b/examples/pkg/generated/clientset/versioned/typed/example3/v1/testtype.go @@ -14,18 +14,17 @@ See the License for the specific language governing permissions and limitations under the License. */ -// Code generated by client-gen-v0.30. DO NOT EDIT. +// Code generated by client-gen-v0.31. DO NOT EDIT. package v1 import ( "context" - "time" metav1 "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" examplev1 "acme.corp/pkg/apis/example/v1" v1 "acme.corp/pkg/apis/example3/v1" @@ -57,137 +56,27 @@ type TestTypeInterface interface { // testTypes implements TestTypeInterface type testTypes struct { - client rest.Interface - ns string + *gentype.ClientWithList[*v1.TestType, *v1.TestTypeList] } // newTestTypes returns a TestTypes func newTestTypes(c *Example3V1Client, namespace string) *testTypes { return &testTypes{ - client: c.RESTClient(), - ns: namespace, + gentype.NewClientWithList[*v1.TestType, *v1.TestTypeList]( + "testtypes", + c.RESTClient(), + scheme.ParameterCodec, + namespace, + func() *v1.TestType { return &v1.TestType{} }, + func() *v1.TestTypeList { return &v1.TestTypeList{} }), } } -// Get takes name of the testType, and returns the corresponding testType object, and an error if there is any. -func (c *testTypes) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.TestType, err error) { - result = &v1.TestType{} - err = c.client.Get(). - Namespace(c.ns). - Resource("testtypes"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of TestTypes that match those selectors. -func (c *testTypes) List(ctx context.Context, opts metav1.ListOptions) (result *v1.TestTypeList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1.TestTypeList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("testtypes"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested testTypes. -func (c *testTypes) Watch(ctx context.Context, opts metav1.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("testtypes"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a testType and creates it. Returns the server's representation of the testType, and an error, if there is any. -func (c *testTypes) Create(ctx context.Context, testType *v1.TestType, opts metav1.CreateOptions) (result *v1.TestType, err error) { - result = &v1.TestType{} - err = c.client.Post(). - Namespace(c.ns). - Resource("testtypes"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(testType). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a testType and updates it. Returns the server's representation of the testType, and an error, if there is any. -func (c *testTypes) Update(ctx context.Context, testType *v1.TestType, opts metav1.UpdateOptions) (result *v1.TestType, err error) { - result = &v1.TestType{} - err = c.client.Put(). - Namespace(c.ns). - Resource("testtypes"). - Name(testType.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(testType). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the testType and deletes it. Returns an error if one occurs. -func (c *testTypes) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("testtypes"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *testTypes) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.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("testtypes"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched testType. -func (c *testTypes) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.TestType, err error) { - result = &v1.TestType{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("testtypes"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} - // CreateField takes the representation of a field and creates it. Returns the server's representation of the field, and an error, if there is any. func (c *testTypes) CreateField(ctx context.Context, testTypeName string, field *examplev1.Field, opts metav1.CreateOptions) (result *examplev1.Field, err error) { result = &examplev1.Field{} - err = c.client.Post(). - Namespace(c.ns). + err = c.GetClient().Post(). + Namespace(c.GetNamespace()). Resource("testtypes"). Name(testTypeName). SubResource("field"). @@ -201,8 +90,8 @@ func (c *testTypes) CreateField(ctx context.Context, testTypeName string, field // UpdateField takes the top resource name and the representation of a field and updates it. Returns the server's representation of the field, and an error, if there is any. func (c *testTypes) UpdateField(ctx context.Context, testTypeName string, field *examplev1.Field, opts metav1.UpdateOptions) (result *examplev1.Field, err error) { result = &examplev1.Field{} - err = c.client.Put(). - Namespace(c.ns). + err = c.GetClient().Put(). + Namespace(c.GetNamespace()). Resource("testtypes"). Name(testTypeName). SubResource("field"). @@ -216,8 +105,8 @@ func (c *testTypes) UpdateField(ctx context.Context, testTypeName string, field // GetField takes name of the testType, and returns the corresponding examplev1.Field object, and an error if there is any. func (c *testTypes) GetField(ctx context.Context, testTypeName string, options metav1.GetOptions) (result *examplev1.Field, err error) { result = &examplev1.Field{} - err = c.client.Get(). - Namespace(c.ns). + err = c.GetClient().Get(). + Namespace(c.GetNamespace()). Resource("testtypes"). Name(testTypeName). SubResource("field"). diff --git a/examples/pkg/generated/clientset/versioned/typed/existinginterfaces/v1/clustertesttype.go b/examples/pkg/generated/clientset/versioned/typed/existinginterfaces/v1/clustertesttype.go index 914905dc..c90430c5 100644 --- a/examples/pkg/generated/clientset/versioned/typed/existinginterfaces/v1/clustertesttype.go +++ b/examples/pkg/generated/clientset/versioned/typed/existinginterfaces/v1/clustertesttype.go @@ -14,18 +14,17 @@ See the License for the specific language governing permissions and limitations under the License. */ -// Code generated by client-gen-v0.30. DO NOT EDIT. +// Code generated by client-gen-v0.31. DO NOT EDIT. package v1 import ( "context" - "time" metav1 "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" v1 "acme.corp/pkg/apis/existinginterfaces/v1" scheme "acme.corp/pkg/generated/clientset/versioned/scheme" @@ -41,6 +40,7 @@ type ClusterTestTypesGetter interface { type ClusterTestTypeInterface interface { Create(ctx context.Context, clusterTestType *v1.ClusterTestType, opts metav1.CreateOptions) (*v1.ClusterTestType, error) Update(ctx context.Context, clusterTestType *v1.ClusterTestType, opts metav1.UpdateOptions) (*v1.ClusterTestType, error) + // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). UpdateStatus(ctx context.Context, clusterTestType *v1.ClusterTestType, opts metav1.UpdateOptions) (*v1.ClusterTestType, error) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error @@ -53,133 +53,18 @@ type ClusterTestTypeInterface interface { // clusterTestTypes implements ClusterTestTypeInterface type clusterTestTypes struct { - client rest.Interface + *gentype.ClientWithList[*v1.ClusterTestType, *v1.ClusterTestTypeList] } // newClusterTestTypes returns a ClusterTestTypes func newClusterTestTypes(c *ExistinginterfacesV1Client) *clusterTestTypes { return &clusterTestTypes{ - client: c.RESTClient(), + gentype.NewClientWithList[*v1.ClusterTestType, *v1.ClusterTestTypeList]( + "clustertesttypes", + c.RESTClient(), + scheme.ParameterCodec, + "", + func() *v1.ClusterTestType { return &v1.ClusterTestType{} }, + func() *v1.ClusterTestTypeList { return &v1.ClusterTestTypeList{} }), } } - -// Get takes name of the clusterTestType, and returns the corresponding clusterTestType object, and an error if there is any. -func (c *clusterTestTypes) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.ClusterTestType, err error) { - result = &v1.ClusterTestType{} - err = c.client.Get(). - Resource("clustertesttypes"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of ClusterTestTypes that match those selectors. -func (c *clusterTestTypes) List(ctx context.Context, opts metav1.ListOptions) (result *v1.ClusterTestTypeList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1.ClusterTestTypeList{} - err = c.client.Get(). - Resource("clustertesttypes"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested clusterTestTypes. -func (c *clusterTestTypes) Watch(ctx context.Context, opts metav1.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(). - Resource("clustertesttypes"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a clusterTestType and creates it. Returns the server's representation of the clusterTestType, and an error, if there is any. -func (c *clusterTestTypes) Create(ctx context.Context, clusterTestType *v1.ClusterTestType, opts metav1.CreateOptions) (result *v1.ClusterTestType, err error) { - result = &v1.ClusterTestType{} - err = c.client.Post(). - Resource("clustertesttypes"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(clusterTestType). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a clusterTestType and updates it. Returns the server's representation of the clusterTestType, and an error, if there is any. -func (c *clusterTestTypes) Update(ctx context.Context, clusterTestType *v1.ClusterTestType, opts metav1.UpdateOptions) (result *v1.ClusterTestType, err error) { - result = &v1.ClusterTestType{} - err = c.client.Put(). - Resource("clustertesttypes"). - Name(clusterTestType.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(clusterTestType). - 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 *clusterTestTypes) UpdateStatus(ctx context.Context, clusterTestType *v1.ClusterTestType, opts metav1.UpdateOptions) (result *v1.ClusterTestType, err error) { - result = &v1.ClusterTestType{} - err = c.client.Put(). - Resource("clustertesttypes"). - Name(clusterTestType.Name). - SubResource("status"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(clusterTestType). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the clusterTestType and deletes it. Returns an error if one occurs. -func (c *clusterTestTypes) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { - return c.client.Delete(). - Resource("clustertesttypes"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *clusterTestTypes) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Resource("clustertesttypes"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched clusterTestType. -func (c *clusterTestTypes) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.ClusterTestType, err error) { - result = &v1.ClusterTestType{} - err = c.client.Patch(pt). - Resource("clustertesttypes"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/examples/pkg/generated/clientset/versioned/typed/existinginterfaces/v1/doc.go b/examples/pkg/generated/clientset/versioned/typed/existinginterfaces/v1/doc.go index 29ee4bf0..b2e49efd 100644 --- a/examples/pkg/generated/clientset/versioned/typed/existinginterfaces/v1/doc.go +++ b/examples/pkg/generated/clientset/versioned/typed/existinginterfaces/v1/doc.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -// Code generated by client-gen-v0.30. DO NOT EDIT. +// Code generated by client-gen-v0.31. DO NOT EDIT. // This package has the automatically generated typed clients. package v1 diff --git a/examples/pkg/generated/clientset/versioned/typed/existinginterfaces/v1/existinginterfaces_client.go b/examples/pkg/generated/clientset/versioned/typed/existinginterfaces/v1/existinginterfaces_client.go index 9f22cc07..e780673d 100644 --- a/examples/pkg/generated/clientset/versioned/typed/existinginterfaces/v1/existinginterfaces_client.go +++ b/examples/pkg/generated/clientset/versioned/typed/existinginterfaces/v1/existinginterfaces_client.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -// Code generated by client-gen-v0.30. DO NOT EDIT. +// Code generated by client-gen-v0.31. DO NOT EDIT. package v1 diff --git a/examples/pkg/generated/clientset/versioned/typed/existinginterfaces/v1/fake/doc.go b/examples/pkg/generated/clientset/versioned/typed/existinginterfaces/v1/fake/doc.go index e6378fda..43d633d7 100644 --- a/examples/pkg/generated/clientset/versioned/typed/existinginterfaces/v1/fake/doc.go +++ b/examples/pkg/generated/clientset/versioned/typed/existinginterfaces/v1/fake/doc.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -// Code generated by client-gen-v0.30. DO NOT EDIT. +// Code generated by client-gen-v0.31. DO NOT EDIT. // Package fake has the automatically generated clients. package fake diff --git a/examples/pkg/generated/clientset/versioned/typed/existinginterfaces/v1/fake/fake_clustertesttype.go b/examples/pkg/generated/clientset/versioned/typed/existinginterfaces/v1/fake/fake_clustertesttype.go index 6613859c..0e2ddec9 100644 --- a/examples/pkg/generated/clientset/versioned/typed/existinginterfaces/v1/fake/fake_clustertesttype.go +++ b/examples/pkg/generated/clientset/versioned/typed/existinginterfaces/v1/fake/fake_clustertesttype.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -// Code generated by client-gen-v0.30. DO NOT EDIT. +// Code generated by client-gen-v0.31. DO NOT EDIT. package fake @@ -41,20 +41,22 @@ var clustertesttypesKind = v1.SchemeGroupVersion.WithKind("ClusterTestType") // Get takes name of the clusterTestType, and returns the corresponding clusterTestType object, and an error if there is any. func (c *FakeClusterTestTypes) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.ClusterTestType, err error) { + emptyResult := &v1.ClusterTestType{} obj, err := c.Fake. - Invokes(testing.NewRootGetAction(clustertesttypesResource, name), &v1.ClusterTestType{}) + Invokes(testing.NewRootGetActionWithOptions(clustertesttypesResource, name, options), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1.ClusterTestType), err } // List takes label and field selectors, and returns the list of ClusterTestTypes that match those selectors. func (c *FakeClusterTestTypes) List(ctx context.Context, opts metav1.ListOptions) (result *v1.ClusterTestTypeList, err error) { + emptyResult := &v1.ClusterTestTypeList{} obj, err := c.Fake. - Invokes(testing.NewRootListAction(clustertesttypesResource, clustertesttypesKind, opts), &v1.ClusterTestTypeList{}) + Invokes(testing.NewRootListActionWithOptions(clustertesttypesResource, clustertesttypesKind, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } label, _, _ := testing.ExtractFromListOptions(opts) @@ -73,36 +75,39 @@ func (c *FakeClusterTestTypes) List(ctx context.Context, opts metav1.ListOptions // Watch returns a watch.Interface that watches the requested clusterTestTypes. func (c *FakeClusterTestTypes) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { return c.Fake. - InvokesWatch(testing.NewRootWatchAction(clustertesttypesResource, opts)) + InvokesWatch(testing.NewRootWatchActionWithOptions(clustertesttypesResource, opts)) } // Create takes the representation of a clusterTestType and creates it. Returns the server's representation of the clusterTestType, and an error, if there is any. func (c *FakeClusterTestTypes) Create(ctx context.Context, clusterTestType *v1.ClusterTestType, opts metav1.CreateOptions) (result *v1.ClusterTestType, err error) { + emptyResult := &v1.ClusterTestType{} obj, err := c.Fake. - Invokes(testing.NewRootCreateAction(clustertesttypesResource, clusterTestType), &v1.ClusterTestType{}) + Invokes(testing.NewRootCreateActionWithOptions(clustertesttypesResource, clusterTestType, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1.ClusterTestType), err } // Update takes the representation of a clusterTestType and updates it. Returns the server's representation of the clusterTestType, and an error, if there is any. func (c *FakeClusterTestTypes) Update(ctx context.Context, clusterTestType *v1.ClusterTestType, opts metav1.UpdateOptions) (result *v1.ClusterTestType, err error) { + emptyResult := &v1.ClusterTestType{} obj, err := c.Fake. - Invokes(testing.NewRootUpdateAction(clustertesttypesResource, clusterTestType), &v1.ClusterTestType{}) + Invokes(testing.NewRootUpdateActionWithOptions(clustertesttypesResource, clusterTestType, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1.ClusterTestType), 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 *FakeClusterTestTypes) UpdateStatus(ctx context.Context, clusterTestType *v1.ClusterTestType, opts metav1.UpdateOptions) (*v1.ClusterTestType, error) { +func (c *FakeClusterTestTypes) UpdateStatus(ctx context.Context, clusterTestType *v1.ClusterTestType, opts metav1.UpdateOptions) (result *v1.ClusterTestType, err error) { + emptyResult := &v1.ClusterTestType{} obj, err := c.Fake. - Invokes(testing.NewRootUpdateSubresourceAction(clustertesttypesResource, "status", clusterTestType), &v1.ClusterTestType{}) + Invokes(testing.NewRootUpdateSubresourceActionWithOptions(clustertesttypesResource, "status", clusterTestType, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1.ClusterTestType), err } @@ -116,7 +121,7 @@ func (c *FakeClusterTestTypes) Delete(ctx context.Context, name string, opts met // DeleteCollection deletes a collection of objects. func (c *FakeClusterTestTypes) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { - action := testing.NewRootDeleteCollectionAction(clustertesttypesResource, listOpts) + action := testing.NewRootDeleteCollectionActionWithOptions(clustertesttypesResource, opts, listOpts) _, err := c.Fake.Invokes(action, &v1.ClusterTestTypeList{}) return err @@ -124,10 +129,11 @@ func (c *FakeClusterTestTypes) DeleteCollection(ctx context.Context, opts metav1 // Patch applies the patch and returns the patched clusterTestType. func (c *FakeClusterTestTypes) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.ClusterTestType, err error) { + emptyResult := &v1.ClusterTestType{} obj, err := c.Fake. - Invokes(testing.NewRootPatchSubresourceAction(clustertesttypesResource, name, pt, data, subresources...), &v1.ClusterTestType{}) + Invokes(testing.NewRootPatchSubresourceActionWithOptions(clustertesttypesResource, name, pt, data, opts, subresources...), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1.ClusterTestType), err } diff --git a/examples/pkg/generated/clientset/versioned/typed/existinginterfaces/v1/fake/fake_existinginterfaces_client.go b/examples/pkg/generated/clientset/versioned/typed/existinginterfaces/v1/fake/fake_existinginterfaces_client.go index aec68e47..9c4e1934 100644 --- a/examples/pkg/generated/clientset/versioned/typed/existinginterfaces/v1/fake/fake_existinginterfaces_client.go +++ b/examples/pkg/generated/clientset/versioned/typed/existinginterfaces/v1/fake/fake_existinginterfaces_client.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -// Code generated by client-gen-v0.30. DO NOT EDIT. +// Code generated by client-gen-v0.31. DO NOT EDIT. package fake diff --git a/examples/pkg/generated/clientset/versioned/typed/existinginterfaces/v1/fake/fake_testtype.go b/examples/pkg/generated/clientset/versioned/typed/existinginterfaces/v1/fake/fake_testtype.go index db85fdd4..19a3134b 100644 --- a/examples/pkg/generated/clientset/versioned/typed/existinginterfaces/v1/fake/fake_testtype.go +++ b/examples/pkg/generated/clientset/versioned/typed/existinginterfaces/v1/fake/fake_testtype.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -// Code generated by client-gen-v0.30. DO NOT EDIT. +// Code generated by client-gen-v0.31. DO NOT EDIT. package fake @@ -42,22 +42,24 @@ var testtypesKind = v1.SchemeGroupVersion.WithKind("TestType") // Get takes name of the testType, and returns the corresponding testType object, and an error if there is any. func (c *FakeTestTypes) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.TestType, err error) { + emptyResult := &v1.TestType{} obj, err := c.Fake. - Invokes(testing.NewGetAction(testtypesResource, c.ns, name), &v1.TestType{}) + Invokes(testing.NewGetActionWithOptions(testtypesResource, c.ns, name, options), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1.TestType), err } // List takes label and field selectors, and returns the list of TestTypes that match those selectors. func (c *FakeTestTypes) List(ctx context.Context, opts metav1.ListOptions) (result *v1.TestTypeList, err error) { + emptyResult := &v1.TestTypeList{} obj, err := c.Fake. - Invokes(testing.NewListAction(testtypesResource, testtypesKind, c.ns, opts), &v1.TestTypeList{}) + Invokes(testing.NewListActionWithOptions(testtypesResource, testtypesKind, c.ns, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } label, _, _ := testing.ExtractFromListOptions(opts) @@ -76,28 +78,30 @@ func (c *FakeTestTypes) List(ctx context.Context, opts metav1.ListOptions) (resu // Watch returns a watch.Interface that watches the requested testTypes. func (c *FakeTestTypes) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { return c.Fake. - InvokesWatch(testing.NewWatchAction(testtypesResource, c.ns, opts)) + InvokesWatch(testing.NewWatchActionWithOptions(testtypesResource, c.ns, opts)) } // Create takes the representation of a testType and creates it. Returns the server's representation of the testType, and an error, if there is any. func (c *FakeTestTypes) Create(ctx context.Context, testType *v1.TestType, opts metav1.CreateOptions) (result *v1.TestType, err error) { + emptyResult := &v1.TestType{} obj, err := c.Fake. - Invokes(testing.NewCreateAction(testtypesResource, c.ns, testType), &v1.TestType{}) + Invokes(testing.NewCreateActionWithOptions(testtypesResource, c.ns, testType, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1.TestType), err } // Update takes the representation of a testType and updates it. Returns the server's representation of the testType, and an error, if there is any. func (c *FakeTestTypes) Update(ctx context.Context, testType *v1.TestType, opts metav1.UpdateOptions) (result *v1.TestType, err error) { + emptyResult := &v1.TestType{} obj, err := c.Fake. - Invokes(testing.NewUpdateAction(testtypesResource, c.ns, testType), &v1.TestType{}) + Invokes(testing.NewUpdateActionWithOptions(testtypesResource, c.ns, testType, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1.TestType), err } @@ -112,7 +116,7 @@ func (c *FakeTestTypes) Delete(ctx context.Context, name string, opts metav1.Del // DeleteCollection deletes a collection of objects. func (c *FakeTestTypes) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { - action := testing.NewDeleteCollectionAction(testtypesResource, c.ns, listOpts) + action := testing.NewDeleteCollectionActionWithOptions(testtypesResource, c.ns, opts, listOpts) _, err := c.Fake.Invokes(action, &v1.TestTypeList{}) return err @@ -120,11 +124,12 @@ func (c *FakeTestTypes) DeleteCollection(ctx context.Context, opts metav1.Delete // Patch applies the patch and returns the patched testType. func (c *FakeTestTypes) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.TestType, err error) { + emptyResult := &v1.TestType{} obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(testtypesResource, c.ns, name, pt, data, subresources...), &v1.TestType{}) + Invokes(testing.NewPatchSubresourceActionWithOptions(testtypesResource, c.ns, name, pt, data, opts, subresources...), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1.TestType), err } diff --git a/examples/pkg/generated/clientset/versioned/typed/existinginterfaces/v1/generated_expansion.go b/examples/pkg/generated/clientset/versioned/typed/existinginterfaces/v1/generated_expansion.go index 1a5176b5..4233cb0e 100644 --- a/examples/pkg/generated/clientset/versioned/typed/existinginterfaces/v1/generated_expansion.go +++ b/examples/pkg/generated/clientset/versioned/typed/existinginterfaces/v1/generated_expansion.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -// Code generated by client-gen-v0.30. DO NOT EDIT. +// Code generated by client-gen-v0.31. DO NOT EDIT. package v1 diff --git a/examples/pkg/generated/clientset/versioned/typed/existinginterfaces/v1/testtype.go b/examples/pkg/generated/clientset/versioned/typed/existinginterfaces/v1/testtype.go index 25bc54f0..f91bc869 100644 --- a/examples/pkg/generated/clientset/versioned/typed/existinginterfaces/v1/testtype.go +++ b/examples/pkg/generated/clientset/versioned/typed/existinginterfaces/v1/testtype.go @@ -14,18 +14,17 @@ See the License for the specific language governing permissions and limitations under the License. */ -// Code generated by client-gen-v0.30. DO NOT EDIT. +// Code generated by client-gen-v0.31. DO NOT EDIT. package v1 import ( "context" - "time" metav1 "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" v1 "acme.corp/pkg/apis/existinginterfaces/v1" scheme "acme.corp/pkg/generated/clientset/versioned/scheme" @@ -52,128 +51,18 @@ type TestTypeInterface interface { // testTypes implements TestTypeInterface type testTypes struct { - client rest.Interface - ns string + *gentype.ClientWithList[*v1.TestType, *v1.TestTypeList] } // newTestTypes returns a TestTypes func newTestTypes(c *ExistinginterfacesV1Client, namespace string) *testTypes { return &testTypes{ - client: c.RESTClient(), - ns: namespace, + gentype.NewClientWithList[*v1.TestType, *v1.TestTypeList]( + "testtypes", + c.RESTClient(), + scheme.ParameterCodec, + namespace, + func() *v1.TestType { return &v1.TestType{} }, + func() *v1.TestTypeList { return &v1.TestTypeList{} }), } } - -// Get takes name of the testType, and returns the corresponding testType object, and an error if there is any. -func (c *testTypes) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.TestType, err error) { - result = &v1.TestType{} - err = c.client.Get(). - Namespace(c.ns). - Resource("testtypes"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of TestTypes that match those selectors. -func (c *testTypes) List(ctx context.Context, opts metav1.ListOptions) (result *v1.TestTypeList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1.TestTypeList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("testtypes"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested testTypes. -func (c *testTypes) Watch(ctx context.Context, opts metav1.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("testtypes"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a testType and creates it. Returns the server's representation of the testType, and an error, if there is any. -func (c *testTypes) Create(ctx context.Context, testType *v1.TestType, opts metav1.CreateOptions) (result *v1.TestType, err error) { - result = &v1.TestType{} - err = c.client.Post(). - Namespace(c.ns). - Resource("testtypes"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(testType). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a testType and updates it. Returns the server's representation of the testType, and an error, if there is any. -func (c *testTypes) Update(ctx context.Context, testType *v1.TestType, opts metav1.UpdateOptions) (result *v1.TestType, err error) { - result = &v1.TestType{} - err = c.client.Put(). - Namespace(c.ns). - Resource("testtypes"). - Name(testType.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(testType). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the testType and deletes it. Returns an error if one occurs. -func (c *testTypes) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("testtypes"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *testTypes) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.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("testtypes"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched testType. -func (c *testTypes) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.TestType, err error) { - result = &v1.TestType{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("testtypes"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/examples/pkg/generated/clientset/versioned/typed/secondexample/v1/clustertesttype.go b/examples/pkg/generated/clientset/versioned/typed/secondexample/v1/clustertesttype.go index a6511324..098d780a 100644 --- a/examples/pkg/generated/clientset/versioned/typed/secondexample/v1/clustertesttype.go +++ b/examples/pkg/generated/clientset/versioned/typed/secondexample/v1/clustertesttype.go @@ -14,18 +14,17 @@ See the License for the specific language governing permissions and limitations under the License. */ -// Code generated by client-gen-v0.30. DO NOT EDIT. +// Code generated by client-gen-v0.31. DO NOT EDIT. package v1 import ( "context" - "time" metav1 "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" v1 "acme.corp/pkg/apis/secondexample/v1" scheme "acme.corp/pkg/generated/clientset/versioned/scheme" @@ -41,6 +40,7 @@ type ClusterTestTypesGetter interface { type ClusterTestTypeInterface interface { Create(ctx context.Context, clusterTestType *v1.ClusterTestType, opts metav1.CreateOptions) (*v1.ClusterTestType, error) Update(ctx context.Context, clusterTestType *v1.ClusterTestType, opts metav1.UpdateOptions) (*v1.ClusterTestType, error) + // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). UpdateStatus(ctx context.Context, clusterTestType *v1.ClusterTestType, opts metav1.UpdateOptions) (*v1.ClusterTestType, error) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error @@ -53,133 +53,18 @@ type ClusterTestTypeInterface interface { // clusterTestTypes implements ClusterTestTypeInterface type clusterTestTypes struct { - client rest.Interface + *gentype.ClientWithList[*v1.ClusterTestType, *v1.ClusterTestTypeList] } // newClusterTestTypes returns a ClusterTestTypes func newClusterTestTypes(c *SecondexampleV1Client) *clusterTestTypes { return &clusterTestTypes{ - client: c.RESTClient(), + gentype.NewClientWithList[*v1.ClusterTestType, *v1.ClusterTestTypeList]( + "clustertesttypes", + c.RESTClient(), + scheme.ParameterCodec, + "", + func() *v1.ClusterTestType { return &v1.ClusterTestType{} }, + func() *v1.ClusterTestTypeList { return &v1.ClusterTestTypeList{} }), } } - -// Get takes name of the clusterTestType, and returns the corresponding clusterTestType object, and an error if there is any. -func (c *clusterTestTypes) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.ClusterTestType, err error) { - result = &v1.ClusterTestType{} - err = c.client.Get(). - Resource("clustertesttypes"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of ClusterTestTypes that match those selectors. -func (c *clusterTestTypes) List(ctx context.Context, opts metav1.ListOptions) (result *v1.ClusterTestTypeList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1.ClusterTestTypeList{} - err = c.client.Get(). - Resource("clustertesttypes"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested clusterTestTypes. -func (c *clusterTestTypes) Watch(ctx context.Context, opts metav1.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(). - Resource("clustertesttypes"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a clusterTestType and creates it. Returns the server's representation of the clusterTestType, and an error, if there is any. -func (c *clusterTestTypes) Create(ctx context.Context, clusterTestType *v1.ClusterTestType, opts metav1.CreateOptions) (result *v1.ClusterTestType, err error) { - result = &v1.ClusterTestType{} - err = c.client.Post(). - Resource("clustertesttypes"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(clusterTestType). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a clusterTestType and updates it. Returns the server's representation of the clusterTestType, and an error, if there is any. -func (c *clusterTestTypes) Update(ctx context.Context, clusterTestType *v1.ClusterTestType, opts metav1.UpdateOptions) (result *v1.ClusterTestType, err error) { - result = &v1.ClusterTestType{} - err = c.client.Put(). - Resource("clustertesttypes"). - Name(clusterTestType.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(clusterTestType). - 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 *clusterTestTypes) UpdateStatus(ctx context.Context, clusterTestType *v1.ClusterTestType, opts metav1.UpdateOptions) (result *v1.ClusterTestType, err error) { - result = &v1.ClusterTestType{} - err = c.client.Put(). - Resource("clustertesttypes"). - Name(clusterTestType.Name). - SubResource("status"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(clusterTestType). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the clusterTestType and deletes it. Returns an error if one occurs. -func (c *clusterTestTypes) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { - return c.client.Delete(). - Resource("clustertesttypes"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *clusterTestTypes) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Resource("clustertesttypes"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched clusterTestType. -func (c *clusterTestTypes) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.ClusterTestType, err error) { - result = &v1.ClusterTestType{} - err = c.client.Patch(pt). - Resource("clustertesttypes"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/examples/pkg/generated/clientset/versioned/typed/secondexample/v1/doc.go b/examples/pkg/generated/clientset/versioned/typed/secondexample/v1/doc.go index 29ee4bf0..b2e49efd 100644 --- a/examples/pkg/generated/clientset/versioned/typed/secondexample/v1/doc.go +++ b/examples/pkg/generated/clientset/versioned/typed/secondexample/v1/doc.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -// Code generated by client-gen-v0.30. DO NOT EDIT. +// Code generated by client-gen-v0.31. DO NOT EDIT. // This package has the automatically generated typed clients. package v1 diff --git a/examples/pkg/generated/clientset/versioned/typed/secondexample/v1/fake/doc.go b/examples/pkg/generated/clientset/versioned/typed/secondexample/v1/fake/doc.go index e6378fda..43d633d7 100644 --- a/examples/pkg/generated/clientset/versioned/typed/secondexample/v1/fake/doc.go +++ b/examples/pkg/generated/clientset/versioned/typed/secondexample/v1/fake/doc.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -// Code generated by client-gen-v0.30. DO NOT EDIT. +// Code generated by client-gen-v0.31. DO NOT EDIT. // Package fake has the automatically generated clients. package fake diff --git a/examples/pkg/generated/clientset/versioned/typed/secondexample/v1/fake/fake_clustertesttype.go b/examples/pkg/generated/clientset/versioned/typed/secondexample/v1/fake/fake_clustertesttype.go index 35a67275..54cb4cbd 100644 --- a/examples/pkg/generated/clientset/versioned/typed/secondexample/v1/fake/fake_clustertesttype.go +++ b/examples/pkg/generated/clientset/versioned/typed/secondexample/v1/fake/fake_clustertesttype.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -// Code generated by client-gen-v0.30. DO NOT EDIT. +// Code generated by client-gen-v0.31. DO NOT EDIT. package fake @@ -41,20 +41,22 @@ var clustertesttypesKind = v1.SchemeGroupVersion.WithKind("ClusterTestType") // Get takes name of the clusterTestType, and returns the corresponding clusterTestType object, and an error if there is any. func (c *FakeClusterTestTypes) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.ClusterTestType, err error) { + emptyResult := &v1.ClusterTestType{} obj, err := c.Fake. - Invokes(testing.NewRootGetAction(clustertesttypesResource, name), &v1.ClusterTestType{}) + Invokes(testing.NewRootGetActionWithOptions(clustertesttypesResource, name, options), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1.ClusterTestType), err } // List takes label and field selectors, and returns the list of ClusterTestTypes that match those selectors. func (c *FakeClusterTestTypes) List(ctx context.Context, opts metav1.ListOptions) (result *v1.ClusterTestTypeList, err error) { + emptyResult := &v1.ClusterTestTypeList{} obj, err := c.Fake. - Invokes(testing.NewRootListAction(clustertesttypesResource, clustertesttypesKind, opts), &v1.ClusterTestTypeList{}) + Invokes(testing.NewRootListActionWithOptions(clustertesttypesResource, clustertesttypesKind, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } label, _, _ := testing.ExtractFromListOptions(opts) @@ -73,36 +75,39 @@ func (c *FakeClusterTestTypes) List(ctx context.Context, opts metav1.ListOptions // Watch returns a watch.Interface that watches the requested clusterTestTypes. func (c *FakeClusterTestTypes) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { return c.Fake. - InvokesWatch(testing.NewRootWatchAction(clustertesttypesResource, opts)) + InvokesWatch(testing.NewRootWatchActionWithOptions(clustertesttypesResource, opts)) } // Create takes the representation of a clusterTestType and creates it. Returns the server's representation of the clusterTestType, and an error, if there is any. func (c *FakeClusterTestTypes) Create(ctx context.Context, clusterTestType *v1.ClusterTestType, opts metav1.CreateOptions) (result *v1.ClusterTestType, err error) { + emptyResult := &v1.ClusterTestType{} obj, err := c.Fake. - Invokes(testing.NewRootCreateAction(clustertesttypesResource, clusterTestType), &v1.ClusterTestType{}) + Invokes(testing.NewRootCreateActionWithOptions(clustertesttypesResource, clusterTestType, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1.ClusterTestType), err } // Update takes the representation of a clusterTestType and updates it. Returns the server's representation of the clusterTestType, and an error, if there is any. func (c *FakeClusterTestTypes) Update(ctx context.Context, clusterTestType *v1.ClusterTestType, opts metav1.UpdateOptions) (result *v1.ClusterTestType, err error) { + emptyResult := &v1.ClusterTestType{} obj, err := c.Fake. - Invokes(testing.NewRootUpdateAction(clustertesttypesResource, clusterTestType), &v1.ClusterTestType{}) + Invokes(testing.NewRootUpdateActionWithOptions(clustertesttypesResource, clusterTestType, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1.ClusterTestType), 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 *FakeClusterTestTypes) UpdateStatus(ctx context.Context, clusterTestType *v1.ClusterTestType, opts metav1.UpdateOptions) (*v1.ClusterTestType, error) { +func (c *FakeClusterTestTypes) UpdateStatus(ctx context.Context, clusterTestType *v1.ClusterTestType, opts metav1.UpdateOptions) (result *v1.ClusterTestType, err error) { + emptyResult := &v1.ClusterTestType{} obj, err := c.Fake. - Invokes(testing.NewRootUpdateSubresourceAction(clustertesttypesResource, "status", clusterTestType), &v1.ClusterTestType{}) + Invokes(testing.NewRootUpdateSubresourceActionWithOptions(clustertesttypesResource, "status", clusterTestType, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1.ClusterTestType), err } @@ -116,7 +121,7 @@ func (c *FakeClusterTestTypes) Delete(ctx context.Context, name string, opts met // DeleteCollection deletes a collection of objects. func (c *FakeClusterTestTypes) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { - action := testing.NewRootDeleteCollectionAction(clustertesttypesResource, listOpts) + action := testing.NewRootDeleteCollectionActionWithOptions(clustertesttypesResource, opts, listOpts) _, err := c.Fake.Invokes(action, &v1.ClusterTestTypeList{}) return err @@ -124,10 +129,11 @@ func (c *FakeClusterTestTypes) DeleteCollection(ctx context.Context, opts metav1 // Patch applies the patch and returns the patched clusterTestType. func (c *FakeClusterTestTypes) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.ClusterTestType, err error) { + emptyResult := &v1.ClusterTestType{} obj, err := c.Fake. - Invokes(testing.NewRootPatchSubresourceAction(clustertesttypesResource, name, pt, data, subresources...), &v1.ClusterTestType{}) + Invokes(testing.NewRootPatchSubresourceActionWithOptions(clustertesttypesResource, name, pt, data, opts, subresources...), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1.ClusterTestType), err } diff --git a/examples/pkg/generated/clientset/versioned/typed/secondexample/v1/fake/fake_secondexample_client.go b/examples/pkg/generated/clientset/versioned/typed/secondexample/v1/fake/fake_secondexample_client.go index 4eec1b20..c9ebc7ed 100644 --- a/examples/pkg/generated/clientset/versioned/typed/secondexample/v1/fake/fake_secondexample_client.go +++ b/examples/pkg/generated/clientset/versioned/typed/secondexample/v1/fake/fake_secondexample_client.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -// Code generated by client-gen-v0.30. DO NOT EDIT. +// Code generated by client-gen-v0.31. DO NOT EDIT. package fake diff --git a/examples/pkg/generated/clientset/versioned/typed/secondexample/v1/fake/fake_testtype.go b/examples/pkg/generated/clientset/versioned/typed/secondexample/v1/fake/fake_testtype.go index 3d98806f..7569587f 100644 --- a/examples/pkg/generated/clientset/versioned/typed/secondexample/v1/fake/fake_testtype.go +++ b/examples/pkg/generated/clientset/versioned/typed/secondexample/v1/fake/fake_testtype.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -// Code generated by client-gen-v0.30. DO NOT EDIT. +// Code generated by client-gen-v0.31. DO NOT EDIT. package fake @@ -42,22 +42,24 @@ var testtypesKind = v1.SchemeGroupVersion.WithKind("TestType") // Get takes name of the testType, and returns the corresponding testType object, and an error if there is any. func (c *FakeTestTypes) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.TestType, err error) { + emptyResult := &v1.TestType{} obj, err := c.Fake. - Invokes(testing.NewGetAction(testtypesResource, c.ns, name), &v1.TestType{}) + Invokes(testing.NewGetActionWithOptions(testtypesResource, c.ns, name, options), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1.TestType), err } // List takes label and field selectors, and returns the list of TestTypes that match those selectors. func (c *FakeTestTypes) List(ctx context.Context, opts metav1.ListOptions) (result *v1.TestTypeList, err error) { + emptyResult := &v1.TestTypeList{} obj, err := c.Fake. - Invokes(testing.NewListAction(testtypesResource, testtypesKind, c.ns, opts), &v1.TestTypeList{}) + Invokes(testing.NewListActionWithOptions(testtypesResource, testtypesKind, c.ns, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } label, _, _ := testing.ExtractFromListOptions(opts) @@ -76,28 +78,30 @@ func (c *FakeTestTypes) List(ctx context.Context, opts metav1.ListOptions) (resu // Watch returns a watch.Interface that watches the requested testTypes. func (c *FakeTestTypes) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { return c.Fake. - InvokesWatch(testing.NewWatchAction(testtypesResource, c.ns, opts)) + InvokesWatch(testing.NewWatchActionWithOptions(testtypesResource, c.ns, opts)) } // Create takes the representation of a testType and creates it. Returns the server's representation of the testType, and an error, if there is any. func (c *FakeTestTypes) Create(ctx context.Context, testType *v1.TestType, opts metav1.CreateOptions) (result *v1.TestType, err error) { + emptyResult := &v1.TestType{} obj, err := c.Fake. - Invokes(testing.NewCreateAction(testtypesResource, c.ns, testType), &v1.TestType{}) + Invokes(testing.NewCreateActionWithOptions(testtypesResource, c.ns, testType, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1.TestType), err } // Update takes the representation of a testType and updates it. Returns the server's representation of the testType, and an error, if there is any. func (c *FakeTestTypes) Update(ctx context.Context, testType *v1.TestType, opts metav1.UpdateOptions) (result *v1.TestType, err error) { + emptyResult := &v1.TestType{} obj, err := c.Fake. - Invokes(testing.NewUpdateAction(testtypesResource, c.ns, testType), &v1.TestType{}) + Invokes(testing.NewUpdateActionWithOptions(testtypesResource, c.ns, testType, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1.TestType), err } @@ -112,7 +116,7 @@ func (c *FakeTestTypes) Delete(ctx context.Context, name string, opts metav1.Del // DeleteCollection deletes a collection of objects. func (c *FakeTestTypes) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { - action := testing.NewDeleteCollectionAction(testtypesResource, c.ns, listOpts) + action := testing.NewDeleteCollectionActionWithOptions(testtypesResource, c.ns, opts, listOpts) _, err := c.Fake.Invokes(action, &v1.TestTypeList{}) return err @@ -120,11 +124,12 @@ func (c *FakeTestTypes) DeleteCollection(ctx context.Context, opts metav1.Delete // Patch applies the patch and returns the patched testType. func (c *FakeTestTypes) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.TestType, err error) { + emptyResult := &v1.TestType{} obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(testtypesResource, c.ns, name, pt, data, subresources...), &v1.TestType{}) + Invokes(testing.NewPatchSubresourceActionWithOptions(testtypesResource, c.ns, name, pt, data, opts, subresources...), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1.TestType), err } diff --git a/examples/pkg/generated/clientset/versioned/typed/secondexample/v1/generated_expansion.go b/examples/pkg/generated/clientset/versioned/typed/secondexample/v1/generated_expansion.go index 1a5176b5..4233cb0e 100644 --- a/examples/pkg/generated/clientset/versioned/typed/secondexample/v1/generated_expansion.go +++ b/examples/pkg/generated/clientset/versioned/typed/secondexample/v1/generated_expansion.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -// Code generated by client-gen-v0.30. DO NOT EDIT. +// Code generated by client-gen-v0.31. DO NOT EDIT. package v1 diff --git a/examples/pkg/generated/clientset/versioned/typed/secondexample/v1/secondexample_client.go b/examples/pkg/generated/clientset/versioned/typed/secondexample/v1/secondexample_client.go index 97017d63..4b0a9b0a 100644 --- a/examples/pkg/generated/clientset/versioned/typed/secondexample/v1/secondexample_client.go +++ b/examples/pkg/generated/clientset/versioned/typed/secondexample/v1/secondexample_client.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -// Code generated by client-gen-v0.30. DO NOT EDIT. +// Code generated by client-gen-v0.31. DO NOT EDIT. package v1 diff --git a/examples/pkg/generated/clientset/versioned/typed/secondexample/v1/testtype.go b/examples/pkg/generated/clientset/versioned/typed/secondexample/v1/testtype.go index bab9b504..d343fa3e 100644 --- a/examples/pkg/generated/clientset/versioned/typed/secondexample/v1/testtype.go +++ b/examples/pkg/generated/clientset/versioned/typed/secondexample/v1/testtype.go @@ -14,18 +14,17 @@ See the License for the specific language governing permissions and limitations under the License. */ -// Code generated by client-gen-v0.30. DO NOT EDIT. +// Code generated by client-gen-v0.31. DO NOT EDIT. package v1 import ( "context" - "time" metav1 "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" v1 "acme.corp/pkg/apis/secondexample/v1" scheme "acme.corp/pkg/generated/clientset/versioned/scheme" @@ -52,128 +51,18 @@ type TestTypeInterface interface { // testTypes implements TestTypeInterface type testTypes struct { - client rest.Interface - ns string + *gentype.ClientWithList[*v1.TestType, *v1.TestTypeList] } // newTestTypes returns a TestTypes func newTestTypes(c *SecondexampleV1Client, namespace string) *testTypes { return &testTypes{ - client: c.RESTClient(), - ns: namespace, + gentype.NewClientWithList[*v1.TestType, *v1.TestTypeList]( + "testtypes", + c.RESTClient(), + scheme.ParameterCodec, + namespace, + func() *v1.TestType { return &v1.TestType{} }, + func() *v1.TestTypeList { return &v1.TestTypeList{} }), } } - -// Get takes name of the testType, and returns the corresponding testType object, and an error if there is any. -func (c *testTypes) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.TestType, err error) { - result = &v1.TestType{} - err = c.client.Get(). - Namespace(c.ns). - Resource("testtypes"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of TestTypes that match those selectors. -func (c *testTypes) List(ctx context.Context, opts metav1.ListOptions) (result *v1.TestTypeList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1.TestTypeList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("testtypes"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested testTypes. -func (c *testTypes) Watch(ctx context.Context, opts metav1.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("testtypes"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a testType and creates it. Returns the server's representation of the testType, and an error, if there is any. -func (c *testTypes) Create(ctx context.Context, testType *v1.TestType, opts metav1.CreateOptions) (result *v1.TestType, err error) { - result = &v1.TestType{} - err = c.client.Post(). - Namespace(c.ns). - Resource("testtypes"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(testType). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a testType and updates it. Returns the server's representation of the testType, and an error, if there is any. -func (c *testTypes) Update(ctx context.Context, testType *v1.TestType, opts metav1.UpdateOptions) (result *v1.TestType, err error) { - result = &v1.TestType{} - err = c.client.Put(). - Namespace(c.ns). - Resource("testtypes"). - Name(testType.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(testType). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the testType and deletes it. Returns an error if one occurs. -func (c *testTypes) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("testtypes"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *testTypes) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.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("testtypes"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched testType. -func (c *testTypes) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.TestType, err error) { - result = &v1.TestType{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("testtypes"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/examples/pkg/generated/informers/externalversions/example/interface.go b/examples/pkg/generated/informers/externalversions/example/interface.go index 6ad82d17..2be3f99a 100644 --- a/examples/pkg/generated/informers/externalversions/example/interface.go +++ b/examples/pkg/generated/informers/externalversions/example/interface.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -// Code generated by informer-gen-v0.30. DO NOT EDIT. +// Code generated by informer-gen-v0.31. DO NOT EDIT. package example diff --git a/examples/pkg/generated/informers/externalversions/example/v1/clustertesttype.go b/examples/pkg/generated/informers/externalversions/example/v1/clustertesttype.go index 79cd4263..42689a43 100644 --- a/examples/pkg/generated/informers/externalversions/example/v1/clustertesttype.go +++ b/examples/pkg/generated/informers/externalversions/example/v1/clustertesttype.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -// Code generated by informer-gen-v0.30. DO NOT EDIT. +// Code generated by informer-gen-v0.31. DO NOT EDIT. package v1 diff --git a/examples/pkg/generated/informers/externalversions/example/v1/interface.go b/examples/pkg/generated/informers/externalversions/example/v1/interface.go index b08e9802..066225ba 100644 --- a/examples/pkg/generated/informers/externalversions/example/v1/interface.go +++ b/examples/pkg/generated/informers/externalversions/example/v1/interface.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -// Code generated by informer-gen-v0.30. DO NOT EDIT. +// Code generated by informer-gen-v0.31. DO NOT EDIT. package v1 diff --git a/examples/pkg/generated/informers/externalversions/example/v1/testtype.go b/examples/pkg/generated/informers/externalversions/example/v1/testtype.go index b4251245..f5aaf6d9 100644 --- a/examples/pkg/generated/informers/externalversions/example/v1/testtype.go +++ b/examples/pkg/generated/informers/externalversions/example/v1/testtype.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -// Code generated by informer-gen-v0.30. DO NOT EDIT. +// Code generated by informer-gen-v0.31. DO NOT EDIT. package v1 diff --git a/examples/pkg/generated/informers/externalversions/example/v1alpha1/clustertesttype.go b/examples/pkg/generated/informers/externalversions/example/v1alpha1/clustertesttype.go index 5ddf3f35..9f9b47fd 100644 --- a/examples/pkg/generated/informers/externalversions/example/v1alpha1/clustertesttype.go +++ b/examples/pkg/generated/informers/externalversions/example/v1alpha1/clustertesttype.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -// Code generated by informer-gen-v0.30. DO NOT EDIT. +// Code generated by informer-gen-v0.31. DO NOT EDIT. package v1alpha1 diff --git a/examples/pkg/generated/informers/externalversions/example/v1alpha1/interface.go b/examples/pkg/generated/informers/externalversions/example/v1alpha1/interface.go index eee1ab35..976f09e7 100644 --- a/examples/pkg/generated/informers/externalversions/example/v1alpha1/interface.go +++ b/examples/pkg/generated/informers/externalversions/example/v1alpha1/interface.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -// Code generated by informer-gen-v0.30. DO NOT EDIT. +// Code generated by informer-gen-v0.31. DO NOT EDIT. package v1alpha1 diff --git a/examples/pkg/generated/informers/externalversions/example/v1alpha1/testtype.go b/examples/pkg/generated/informers/externalversions/example/v1alpha1/testtype.go index cfa0fcab..adf49636 100644 --- a/examples/pkg/generated/informers/externalversions/example/v1alpha1/testtype.go +++ b/examples/pkg/generated/informers/externalversions/example/v1alpha1/testtype.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -// Code generated by informer-gen-v0.30. DO NOT EDIT. +// Code generated by informer-gen-v0.31. DO NOT EDIT. package v1alpha1 diff --git a/examples/pkg/generated/informers/externalversions/example/v1beta1/clustertesttype.go b/examples/pkg/generated/informers/externalversions/example/v1beta1/clustertesttype.go index d10e308e..61ed3ecf 100644 --- a/examples/pkg/generated/informers/externalversions/example/v1beta1/clustertesttype.go +++ b/examples/pkg/generated/informers/externalversions/example/v1beta1/clustertesttype.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -// Code generated by informer-gen-v0.30. DO NOT EDIT. +// Code generated by informer-gen-v0.31. DO NOT EDIT. package v1beta1 diff --git a/examples/pkg/generated/informers/externalversions/example/v1beta1/interface.go b/examples/pkg/generated/informers/externalversions/example/v1beta1/interface.go index 29c65d44..4620985b 100644 --- a/examples/pkg/generated/informers/externalversions/example/v1beta1/interface.go +++ b/examples/pkg/generated/informers/externalversions/example/v1beta1/interface.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -// Code generated by informer-gen-v0.30. DO NOT EDIT. +// Code generated by informer-gen-v0.31. DO NOT EDIT. package v1beta1 @@ -26,6 +26,8 @@ import ( type Interface interface { // ClusterTestTypes returns a ClusterTestTypeInformer. ClusterTestTypes() ClusterTestTypeInformer + // TestTypes returns a TestTypeInformer. + TestTypes() TestTypeInformer } type version struct { @@ -43,3 +45,8 @@ func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakList func (v *version) ClusterTestTypes() ClusterTestTypeInformer { return &clusterTestTypeInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} } + +// TestTypes returns a TestTypeInformer. +func (v *version) TestTypes() TestTypeInformer { + return &testTypeInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} diff --git a/examples/pkg/generated/informers/externalversions/example/v1beta1/testtype.go b/examples/pkg/generated/informers/externalversions/example/v1beta1/testtype.go new file mode 100644 index 00000000..1af6b4a5 --- /dev/null +++ b/examples/pkg/generated/informers/externalversions/example/v1beta1/testtype.go @@ -0,0 +1,91 @@ +/* +Copyright The KCP 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 + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by informer-gen-v0.31. DO NOT EDIT. + +package v1beta1 + +import ( + "context" + time "time" + + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" + + examplev1beta1 "acme.corp/pkg/apis/example/v1beta1" + versioned "acme.corp/pkg/generated/clientset/versioned" + internalinterfaces "acme.corp/pkg/generated/informers/externalversions/internalinterfaces" + v1beta1 "acme.corp/pkg/generated/listers/example/v1beta1" +) + +// TestTypeInformer provides access to a shared informer and lister for +// TestTypes. +type TestTypeInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1beta1.TestTypeLister +} + +type testTypeInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewTestTypeInformer constructs a new informer for TestType type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTestTypeInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredTestTypeInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredTestTypeInformer constructs a new informer for TestType type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredTestTypeInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.ExampleV1beta1().TestTypes(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.ExampleV1beta1().TestTypes(namespace).Watch(context.TODO(), options) + }, + }, + &examplev1beta1.TestType{}, + resyncPeriod, + indexers, + ) +} + +func (f *testTypeInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredTestTypeInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *testTypeInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&examplev1beta1.TestType{}, f.defaultInformer) +} + +func (f *testTypeInformer) Lister() v1beta1.TestTypeLister { + return v1beta1.NewTestTypeLister(f.Informer().GetIndexer()) +} diff --git a/examples/pkg/generated/informers/externalversions/example/v2/clustertesttype.go b/examples/pkg/generated/informers/externalversions/example/v2/clustertesttype.go index e3935f58..6538a040 100644 --- a/examples/pkg/generated/informers/externalversions/example/v2/clustertesttype.go +++ b/examples/pkg/generated/informers/externalversions/example/v2/clustertesttype.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -// Code generated by informer-gen-v0.30. DO NOT EDIT. +// Code generated by informer-gen-v0.31. DO NOT EDIT. package v2 diff --git a/examples/pkg/generated/informers/externalversions/example/v2/interface.go b/examples/pkg/generated/informers/externalversions/example/v2/interface.go index 56c1f806..3f37e19a 100644 --- a/examples/pkg/generated/informers/externalversions/example/v2/interface.go +++ b/examples/pkg/generated/informers/externalversions/example/v2/interface.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -// Code generated by informer-gen-v0.30. DO NOT EDIT. +// Code generated by informer-gen-v0.31. DO NOT EDIT. package v2 diff --git a/examples/pkg/generated/informers/externalversions/example/v2/testtype.go b/examples/pkg/generated/informers/externalversions/example/v2/testtype.go index 97055cc5..217f95be 100644 --- a/examples/pkg/generated/informers/externalversions/example/v2/testtype.go +++ b/examples/pkg/generated/informers/externalversions/example/v2/testtype.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -// Code generated by informer-gen-v0.30. DO NOT EDIT. +// Code generated by informer-gen-v0.31. DO NOT EDIT. package v2 diff --git a/examples/pkg/generated/informers/externalversions/example3/interface.go b/examples/pkg/generated/informers/externalversions/example3/interface.go index a2a36d3d..4ccfa568 100644 --- a/examples/pkg/generated/informers/externalversions/example3/interface.go +++ b/examples/pkg/generated/informers/externalversions/example3/interface.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -// Code generated by informer-gen-v0.30. DO NOT EDIT. +// Code generated by informer-gen-v0.31. DO NOT EDIT. package example3 diff --git a/examples/pkg/generated/informers/externalversions/example3/v1/clustertesttype.go b/examples/pkg/generated/informers/externalversions/example3/v1/clustertesttype.go index 20b53389..284219e3 100644 --- a/examples/pkg/generated/informers/externalversions/example3/v1/clustertesttype.go +++ b/examples/pkg/generated/informers/externalversions/example3/v1/clustertesttype.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -// Code generated by informer-gen-v0.30. DO NOT EDIT. +// Code generated by informer-gen-v0.31. DO NOT EDIT. package v1 diff --git a/examples/pkg/generated/informers/externalversions/example3/v1/interface.go b/examples/pkg/generated/informers/externalversions/example3/v1/interface.go index b08e9802..066225ba 100644 --- a/examples/pkg/generated/informers/externalversions/example3/v1/interface.go +++ b/examples/pkg/generated/informers/externalversions/example3/v1/interface.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -// Code generated by informer-gen-v0.30. DO NOT EDIT. +// Code generated by informer-gen-v0.31. DO NOT EDIT. package v1 diff --git a/examples/pkg/generated/informers/externalversions/example3/v1/testtype.go b/examples/pkg/generated/informers/externalversions/example3/v1/testtype.go index 8ea4f5d2..e9b5b1aa 100644 --- a/examples/pkg/generated/informers/externalversions/example3/v1/testtype.go +++ b/examples/pkg/generated/informers/externalversions/example3/v1/testtype.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -// Code generated by informer-gen-v0.30. DO NOT EDIT. +// Code generated by informer-gen-v0.31. DO NOT EDIT. package v1 diff --git a/examples/pkg/generated/informers/externalversions/existinginterfaces/interface.go b/examples/pkg/generated/informers/externalversions/existinginterfaces/interface.go index 571839a8..41744191 100644 --- a/examples/pkg/generated/informers/externalversions/existinginterfaces/interface.go +++ b/examples/pkg/generated/informers/externalversions/existinginterfaces/interface.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -// Code generated by informer-gen-v0.30. DO NOT EDIT. +// Code generated by informer-gen-v0.31. DO NOT EDIT. package existinginterfaces diff --git a/examples/pkg/generated/informers/externalversions/existinginterfaces/v1/clustertesttype.go b/examples/pkg/generated/informers/externalversions/existinginterfaces/v1/clustertesttype.go index 2e12c89f..f2ad5f55 100644 --- a/examples/pkg/generated/informers/externalversions/existinginterfaces/v1/clustertesttype.go +++ b/examples/pkg/generated/informers/externalversions/existinginterfaces/v1/clustertesttype.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -// Code generated by informer-gen-v0.30. DO NOT EDIT. +// Code generated by informer-gen-v0.31. DO NOT EDIT. package v1 diff --git a/examples/pkg/generated/informers/externalversions/existinginterfaces/v1/interface.go b/examples/pkg/generated/informers/externalversions/existinginterfaces/v1/interface.go index b08e9802..066225ba 100644 --- a/examples/pkg/generated/informers/externalversions/existinginterfaces/v1/interface.go +++ b/examples/pkg/generated/informers/externalversions/existinginterfaces/v1/interface.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -// Code generated by informer-gen-v0.30. DO NOT EDIT. +// Code generated by informer-gen-v0.31. DO NOT EDIT. package v1 diff --git a/examples/pkg/generated/informers/externalversions/existinginterfaces/v1/testtype.go b/examples/pkg/generated/informers/externalversions/existinginterfaces/v1/testtype.go index 9a8c0d46..b3f448d7 100644 --- a/examples/pkg/generated/informers/externalversions/existinginterfaces/v1/testtype.go +++ b/examples/pkg/generated/informers/externalversions/existinginterfaces/v1/testtype.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -// Code generated by informer-gen-v0.30. DO NOT EDIT. +// Code generated by informer-gen-v0.31. DO NOT EDIT. package v1 diff --git a/examples/pkg/generated/informers/externalversions/factory.go b/examples/pkg/generated/informers/externalversions/factory.go index a347914b..02a66610 100644 --- a/examples/pkg/generated/informers/externalversions/factory.go +++ b/examples/pkg/generated/informers/externalversions/factory.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -// Code generated by informer-gen-v0.30. DO NOT EDIT. +// Code generated by informer-gen-v0.31. DO NOT EDIT. package externalversions @@ -232,6 +232,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/examples/pkg/generated/informers/externalversions/generic.go b/examples/pkg/generated/informers/externalversions/generic.go index 1af7cda6..9337b236 100644 --- a/examples/pkg/generated/informers/externalversions/generic.go +++ b/examples/pkg/generated/informers/externalversions/generic.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -// Code generated by informer-gen-v0.30. DO NOT EDIT. +// Code generated by informer-gen-v0.31. DO NOT EDIT. package externalversions @@ -74,6 +74,8 @@ func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource // Group=example, Version=v1beta1 case v1beta1.SchemeGroupVersion.WithResource("clustertesttypes"): return &genericInformer{resource: resource.GroupResource(), informer: f.Example().V1beta1().ClusterTestTypes().Informer()}, nil + case v1beta1.SchemeGroupVersion.WithResource("testtypes"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Example().V1beta1().TestTypes().Informer()}, nil // Group=example, Version=v2 case v2.SchemeGroupVersion.WithResource("clustertesttypes"): diff --git a/examples/pkg/generated/informers/externalversions/internalinterfaces/factory_interfaces.go b/examples/pkg/generated/informers/externalversions/internalinterfaces/factory_interfaces.go index 13442cc3..392f9188 100644 --- a/examples/pkg/generated/informers/externalversions/internalinterfaces/factory_interfaces.go +++ b/examples/pkg/generated/informers/externalversions/internalinterfaces/factory_interfaces.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -// Code generated by informer-gen-v0.30. DO NOT EDIT. +// Code generated by informer-gen-v0.31. DO NOT EDIT. package internalinterfaces diff --git a/examples/pkg/generated/informers/externalversions/secondexample/interface.go b/examples/pkg/generated/informers/externalversions/secondexample/interface.go index aac707d2..888852b9 100644 --- a/examples/pkg/generated/informers/externalversions/secondexample/interface.go +++ b/examples/pkg/generated/informers/externalversions/secondexample/interface.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -// Code generated by informer-gen-v0.30. DO NOT EDIT. +// Code generated by informer-gen-v0.31. DO NOT EDIT. package secondexample diff --git a/examples/pkg/generated/informers/externalversions/secondexample/v1/clustertesttype.go b/examples/pkg/generated/informers/externalversions/secondexample/v1/clustertesttype.go index 5c5b723a..bc2d6b57 100644 --- a/examples/pkg/generated/informers/externalversions/secondexample/v1/clustertesttype.go +++ b/examples/pkg/generated/informers/externalversions/secondexample/v1/clustertesttype.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -// Code generated by informer-gen-v0.30. DO NOT EDIT. +// Code generated by informer-gen-v0.31. DO NOT EDIT. package v1 diff --git a/examples/pkg/generated/informers/externalversions/secondexample/v1/interface.go b/examples/pkg/generated/informers/externalversions/secondexample/v1/interface.go index b08e9802..066225ba 100644 --- a/examples/pkg/generated/informers/externalversions/secondexample/v1/interface.go +++ b/examples/pkg/generated/informers/externalversions/secondexample/v1/interface.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -// Code generated by informer-gen-v0.30. DO NOT EDIT. +// Code generated by informer-gen-v0.31. DO NOT EDIT. package v1 diff --git a/examples/pkg/generated/informers/externalversions/secondexample/v1/testtype.go b/examples/pkg/generated/informers/externalversions/secondexample/v1/testtype.go index 59bd0c73..358462eb 100644 --- a/examples/pkg/generated/informers/externalversions/secondexample/v1/testtype.go +++ b/examples/pkg/generated/informers/externalversions/secondexample/v1/testtype.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -// Code generated by informer-gen-v0.30. DO NOT EDIT. +// Code generated by informer-gen-v0.31. DO NOT EDIT. package v1 diff --git a/examples/pkg/generated/listers/example/v1/clustertesttype.go b/examples/pkg/generated/listers/example/v1/clustertesttype.go index eeab7a1b..50afa933 100644 --- a/examples/pkg/generated/listers/example/v1/clustertesttype.go +++ b/examples/pkg/generated/listers/example/v1/clustertesttype.go @@ -14,13 +14,13 @@ See the License for the specific language governing permissions and limitations under the License. */ -// Code generated by lister-gen-v0.30. DO NOT EDIT. +// Code generated by lister-gen-v0.31. DO NOT EDIT. package v1 import ( - "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/listers" "k8s.io/client-go/tools/cache" v1 "acme.corp/pkg/apis/example/v1" @@ -40,30 +40,10 @@ type ClusterTestTypeLister interface { // clusterTestTypeLister implements the ClusterTestTypeLister interface. type clusterTestTypeLister struct { - indexer cache.Indexer + listers.ResourceIndexer[*v1.ClusterTestType] } // NewClusterTestTypeLister returns a new ClusterTestTypeLister. func NewClusterTestTypeLister(indexer cache.Indexer) ClusterTestTypeLister { - return &clusterTestTypeLister{indexer: indexer} -} - -// List lists all ClusterTestTypes in the indexer. -func (s *clusterTestTypeLister) List(selector labels.Selector) (ret []*v1.ClusterTestType, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1.ClusterTestType)) - }) - return ret, err -} - -// Get retrieves the ClusterTestType from the index for a given name. -func (s *clusterTestTypeLister) Get(name string) (*v1.ClusterTestType, error) { - obj, exists, err := s.indexer.GetByKey(name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1.Resource("clustertesttype"), name) - } - return obj.(*v1.ClusterTestType), nil + return &clusterTestTypeLister{listers.New[*v1.ClusterTestType](indexer, v1.Resource("clustertesttype"))} } diff --git a/examples/pkg/generated/listers/example/v1/expansion_generated.go b/examples/pkg/generated/listers/example/v1/expansion_generated.go index 3936f60d..9f9f3335 100644 --- a/examples/pkg/generated/listers/example/v1/expansion_generated.go +++ b/examples/pkg/generated/listers/example/v1/expansion_generated.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -// Code generated by lister-gen-v0.30. DO NOT EDIT. +// Code generated by lister-gen-v0.31. DO NOT EDIT. package v1 diff --git a/examples/pkg/generated/listers/example/v1/testtype.go b/examples/pkg/generated/listers/example/v1/testtype.go index 9da09596..f09bbb15 100644 --- a/examples/pkg/generated/listers/example/v1/testtype.go +++ b/examples/pkg/generated/listers/example/v1/testtype.go @@ -14,13 +14,13 @@ See the License for the specific language governing permissions and limitations under the License. */ -// Code generated by lister-gen-v0.30. DO NOT EDIT. +// Code generated by lister-gen-v0.31. DO NOT EDIT. package v1 import ( - "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/listers" "k8s.io/client-go/tools/cache" v1 "acme.corp/pkg/apis/example/v1" @@ -39,25 +39,17 @@ type TestTypeLister interface { // testTypeLister implements the TestTypeLister interface. type testTypeLister struct { - indexer cache.Indexer + listers.ResourceIndexer[*v1.TestType] } // NewTestTypeLister returns a new TestTypeLister. func NewTestTypeLister(indexer cache.Indexer) TestTypeLister { - return &testTypeLister{indexer: indexer} -} - -// List lists all TestTypes in the indexer. -func (s *testTypeLister) List(selector labels.Selector) (ret []*v1.TestType, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1.TestType)) - }) - return ret, err + return &testTypeLister{listers.New[*v1.TestType](indexer, v1.Resource("testtype"))} } // TestTypes returns an object that can list and get TestTypes. func (s *testTypeLister) TestTypes(namespace string) TestTypeNamespaceLister { - return testTypeNamespaceLister{indexer: s.indexer, namespace: namespace} + return testTypeNamespaceLister{listers.NewNamespaced[*v1.TestType](s.ResourceIndexer, namespace)} } // TestTypeNamespaceLister helps list and get TestTypes. @@ -75,26 +67,5 @@ type TestTypeNamespaceLister interface { // testTypeNamespaceLister implements the TestTypeNamespaceLister // interface. type testTypeNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all TestTypes in the indexer for a given namespace. -func (s testTypeNamespaceLister) List(selector labels.Selector) (ret []*v1.TestType, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1.TestType)) - }) - return ret, err -} - -// Get retrieves the TestType from the indexer for a given namespace and name. -func (s testTypeNamespaceLister) Get(name string) (*v1.TestType, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1.Resource("testtype"), name) - } - return obj.(*v1.TestType), nil + listers.ResourceIndexer[*v1.TestType] } diff --git a/examples/pkg/generated/listers/example/v1/withoutverbtype.go b/examples/pkg/generated/listers/example/v1/withoutverbtype.go index aa163d90..063f2028 100644 --- a/examples/pkg/generated/listers/example/v1/withoutverbtype.go +++ b/examples/pkg/generated/listers/example/v1/withoutverbtype.go @@ -14,13 +14,13 @@ See the License for the specific language governing permissions and limitations under the License. */ -// Code generated by lister-gen-v0.30. DO NOT EDIT. +// Code generated by lister-gen-v0.31. DO NOT EDIT. package v1 import ( - "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/listers" "k8s.io/client-go/tools/cache" v1 "acme.corp/pkg/apis/example/v1" @@ -39,25 +39,17 @@ type WithoutVerbTypeLister interface { // withoutVerbTypeLister implements the WithoutVerbTypeLister interface. type withoutVerbTypeLister struct { - indexer cache.Indexer + listers.ResourceIndexer[*v1.WithoutVerbType] } // NewWithoutVerbTypeLister returns a new WithoutVerbTypeLister. func NewWithoutVerbTypeLister(indexer cache.Indexer) WithoutVerbTypeLister { - return &withoutVerbTypeLister{indexer: indexer} -} - -// List lists all WithoutVerbTypes in the indexer. -func (s *withoutVerbTypeLister) List(selector labels.Selector) (ret []*v1.WithoutVerbType, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1.WithoutVerbType)) - }) - return ret, err + return &withoutVerbTypeLister{listers.New[*v1.WithoutVerbType](indexer, v1.Resource("withoutverbtype"))} } // WithoutVerbTypes returns an object that can list and get WithoutVerbTypes. func (s *withoutVerbTypeLister) WithoutVerbTypes(namespace string) WithoutVerbTypeNamespaceLister { - return withoutVerbTypeNamespaceLister{indexer: s.indexer, namespace: namespace} + return withoutVerbTypeNamespaceLister{listers.NewNamespaced[*v1.WithoutVerbType](s.ResourceIndexer, namespace)} } // WithoutVerbTypeNamespaceLister helps list and get WithoutVerbTypes. @@ -75,26 +67,5 @@ type WithoutVerbTypeNamespaceLister interface { // withoutVerbTypeNamespaceLister implements the WithoutVerbTypeNamespaceLister // interface. type withoutVerbTypeNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all WithoutVerbTypes in the indexer for a given namespace. -func (s withoutVerbTypeNamespaceLister) List(selector labels.Selector) (ret []*v1.WithoutVerbType, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1.WithoutVerbType)) - }) - return ret, err -} - -// Get retrieves the WithoutVerbType from the indexer for a given namespace and name. -func (s withoutVerbTypeNamespaceLister) Get(name string) (*v1.WithoutVerbType, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1.Resource("withoutverbtype"), name) - } - return obj.(*v1.WithoutVerbType), nil + listers.ResourceIndexer[*v1.WithoutVerbType] } diff --git a/examples/pkg/generated/listers/example/v1alpha1/clustertesttype.go b/examples/pkg/generated/listers/example/v1alpha1/clustertesttype.go index 902c4397..b7000795 100644 --- a/examples/pkg/generated/listers/example/v1alpha1/clustertesttype.go +++ b/examples/pkg/generated/listers/example/v1alpha1/clustertesttype.go @@ -14,13 +14,13 @@ See the License for the specific language governing permissions and limitations under the License. */ -// Code generated by lister-gen-v0.30. DO NOT EDIT. +// Code generated by lister-gen-v0.31. DO NOT EDIT. package v1alpha1 import ( - "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/listers" "k8s.io/client-go/tools/cache" v1alpha1 "acme.corp/pkg/apis/example/v1alpha1" @@ -40,30 +40,10 @@ type ClusterTestTypeLister interface { // clusterTestTypeLister implements the ClusterTestTypeLister interface. type clusterTestTypeLister struct { - indexer cache.Indexer + listers.ResourceIndexer[*v1alpha1.ClusterTestType] } // NewClusterTestTypeLister returns a new ClusterTestTypeLister. func NewClusterTestTypeLister(indexer cache.Indexer) ClusterTestTypeLister { - return &clusterTestTypeLister{indexer: indexer} -} - -// List lists all ClusterTestTypes in the indexer. -func (s *clusterTestTypeLister) List(selector labels.Selector) (ret []*v1alpha1.ClusterTestType, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.ClusterTestType)) - }) - return ret, err -} - -// Get retrieves the ClusterTestType from the index for a given name. -func (s *clusterTestTypeLister) Get(name string) (*v1alpha1.ClusterTestType, error) { - obj, exists, err := s.indexer.GetByKey(name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1alpha1.Resource("clustertesttype"), name) - } - return obj.(*v1alpha1.ClusterTestType), nil + return &clusterTestTypeLister{listers.New[*v1alpha1.ClusterTestType](indexer, v1alpha1.Resource("clustertesttype"))} } diff --git a/examples/pkg/generated/listers/example/v1alpha1/expansion_generated.go b/examples/pkg/generated/listers/example/v1alpha1/expansion_generated.go index 47f16da6..29c678e4 100644 --- a/examples/pkg/generated/listers/example/v1alpha1/expansion_generated.go +++ b/examples/pkg/generated/listers/example/v1alpha1/expansion_generated.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -// Code generated by lister-gen-v0.30. DO NOT EDIT. +// Code generated by lister-gen-v0.31. DO NOT EDIT. package v1alpha1 diff --git a/examples/pkg/generated/listers/example/v1alpha1/testtype.go b/examples/pkg/generated/listers/example/v1alpha1/testtype.go index ad979e5c..30b23868 100644 --- a/examples/pkg/generated/listers/example/v1alpha1/testtype.go +++ b/examples/pkg/generated/listers/example/v1alpha1/testtype.go @@ -14,13 +14,13 @@ See the License for the specific language governing permissions and limitations under the License. */ -// Code generated by lister-gen-v0.30. DO NOT EDIT. +// Code generated by lister-gen-v0.31. DO NOT EDIT. package v1alpha1 import ( - "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/listers" "k8s.io/client-go/tools/cache" v1alpha1 "acme.corp/pkg/apis/example/v1alpha1" @@ -39,25 +39,17 @@ type TestTypeLister interface { // testTypeLister implements the TestTypeLister interface. type testTypeLister struct { - indexer cache.Indexer + listers.ResourceIndexer[*v1alpha1.TestType] } // NewTestTypeLister returns a new TestTypeLister. func NewTestTypeLister(indexer cache.Indexer) TestTypeLister { - return &testTypeLister{indexer: indexer} -} - -// List lists all TestTypes in the indexer. -func (s *testTypeLister) List(selector labels.Selector) (ret []*v1alpha1.TestType, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.TestType)) - }) - return ret, err + return &testTypeLister{listers.New[*v1alpha1.TestType](indexer, v1alpha1.Resource("testtype"))} } // TestTypes returns an object that can list and get TestTypes. func (s *testTypeLister) TestTypes(namespace string) TestTypeNamespaceLister { - return testTypeNamespaceLister{indexer: s.indexer, namespace: namespace} + return testTypeNamespaceLister{listers.NewNamespaced[*v1alpha1.TestType](s.ResourceIndexer, namespace)} } // TestTypeNamespaceLister helps list and get TestTypes. @@ -75,26 +67,5 @@ type TestTypeNamespaceLister interface { // testTypeNamespaceLister implements the TestTypeNamespaceLister // interface. type testTypeNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all TestTypes in the indexer for a given namespace. -func (s testTypeNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.TestType, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.TestType)) - }) - return ret, err -} - -// Get retrieves the TestType from the indexer for a given namespace and name. -func (s testTypeNamespaceLister) Get(name string) (*v1alpha1.TestType, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1alpha1.Resource("testtype"), name) - } - return obj.(*v1alpha1.TestType), nil + listers.ResourceIndexer[*v1alpha1.TestType] } diff --git a/examples/pkg/generated/listers/example/v1beta1/clustertesttype.go b/examples/pkg/generated/listers/example/v1beta1/clustertesttype.go index 846d136c..85362c31 100644 --- a/examples/pkg/generated/listers/example/v1beta1/clustertesttype.go +++ b/examples/pkg/generated/listers/example/v1beta1/clustertesttype.go @@ -14,13 +14,13 @@ See the License for the specific language governing permissions and limitations under the License. */ -// Code generated by lister-gen-v0.30. DO NOT EDIT. +// Code generated by lister-gen-v0.31. DO NOT EDIT. package v1beta1 import ( - "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/listers" "k8s.io/client-go/tools/cache" v1beta1 "acme.corp/pkg/apis/example/v1beta1" @@ -40,30 +40,10 @@ type ClusterTestTypeLister interface { // clusterTestTypeLister implements the ClusterTestTypeLister interface. type clusterTestTypeLister struct { - indexer cache.Indexer + listers.ResourceIndexer[*v1beta1.ClusterTestType] } // NewClusterTestTypeLister returns a new ClusterTestTypeLister. func NewClusterTestTypeLister(indexer cache.Indexer) ClusterTestTypeLister { - return &clusterTestTypeLister{indexer: indexer} -} - -// List lists all ClusterTestTypes in the indexer. -func (s *clusterTestTypeLister) List(selector labels.Selector) (ret []*v1beta1.ClusterTestType, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1beta1.ClusterTestType)) - }) - return ret, err -} - -// Get retrieves the ClusterTestType from the index for a given name. -func (s *clusterTestTypeLister) Get(name string) (*v1beta1.ClusterTestType, error) { - obj, exists, err := s.indexer.GetByKey(name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1beta1.Resource("clustertesttype"), name) - } - return obj.(*v1beta1.ClusterTestType), nil + return &clusterTestTypeLister{listers.New[*v1beta1.ClusterTestType](indexer, v1beta1.Resource("clustertesttype"))} } diff --git a/examples/pkg/generated/listers/example/v1beta1/expansion_generated.go b/examples/pkg/generated/listers/example/v1beta1/expansion_generated.go index ff2828e3..37d6e59e 100644 --- a/examples/pkg/generated/listers/example/v1beta1/expansion_generated.go +++ b/examples/pkg/generated/listers/example/v1beta1/expansion_generated.go @@ -14,10 +14,18 @@ See the License for the specific language governing permissions and limitations under the License. */ -// Code generated by lister-gen-v0.30. DO NOT EDIT. +// Code generated by lister-gen-v0.31. DO NOT EDIT. package v1beta1 // ClusterTestTypeListerExpansion allows custom methods to be added to // ClusterTestTypeLister. type ClusterTestTypeListerExpansion interface{} + +// TestTypeListerExpansion allows custom methods to be added to +// TestTypeLister. +type TestTypeListerExpansion interface{} + +// TestTypeNamespaceListerExpansion allows custom methods to be added to +// TestTypeNamespaceLister. +type TestTypeNamespaceListerExpansion interface{} diff --git a/examples/pkg/generated/listers/example/v1beta1/testtype.go b/examples/pkg/generated/listers/example/v1beta1/testtype.go new file mode 100644 index 00000000..7a29a9e2 --- /dev/null +++ b/examples/pkg/generated/listers/example/v1beta1/testtype.go @@ -0,0 +1,71 @@ +/* +Copyright The KCP 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 + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by lister-gen-v0.31. DO NOT EDIT. + +package v1beta1 + +import ( + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/listers" + "k8s.io/client-go/tools/cache" + + v1beta1 "acme.corp/pkg/apis/example/v1beta1" +) + +// TestTypeLister helps list TestTypes. +// All objects returned here must be treated as read-only. +type TestTypeLister interface { + // List lists all TestTypes in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1beta1.TestType, err error) + // TestTypes returns an object that can list and get TestTypes. + TestTypes(namespace string) TestTypeNamespaceLister + TestTypeListerExpansion +} + +// testTypeLister implements the TestTypeLister interface. +type testTypeLister struct { + listers.ResourceIndexer[*v1beta1.TestType] +} + +// NewTestTypeLister returns a new TestTypeLister. +func NewTestTypeLister(indexer cache.Indexer) TestTypeLister { + return &testTypeLister{listers.New[*v1beta1.TestType](indexer, v1beta1.Resource("testtype"))} +} + +// TestTypes returns an object that can list and get TestTypes. +func (s *testTypeLister) TestTypes(namespace string) TestTypeNamespaceLister { + return testTypeNamespaceLister{listers.NewNamespaced[*v1beta1.TestType](s.ResourceIndexer, namespace)} +} + +// TestTypeNamespaceLister helps list and get TestTypes. +// All objects returned here must be treated as read-only. +type TestTypeNamespaceLister interface { + // List lists all TestTypes in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1beta1.TestType, err error) + // Get retrieves the TestType from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1beta1.TestType, error) + TestTypeNamespaceListerExpansion +} + +// testTypeNamespaceLister implements the TestTypeNamespaceLister +// interface. +type testTypeNamespaceLister struct { + listers.ResourceIndexer[*v1beta1.TestType] +} diff --git a/examples/pkg/generated/listers/example/v2/clustertesttype.go b/examples/pkg/generated/listers/example/v2/clustertesttype.go index d434ab84..63bfa0ee 100644 --- a/examples/pkg/generated/listers/example/v2/clustertesttype.go +++ b/examples/pkg/generated/listers/example/v2/clustertesttype.go @@ -14,13 +14,13 @@ See the License for the specific language governing permissions and limitations under the License. */ -// Code generated by lister-gen-v0.30. DO NOT EDIT. +// Code generated by lister-gen-v0.31. DO NOT EDIT. package v2 import ( - "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/listers" "k8s.io/client-go/tools/cache" v2 "acme.corp/pkg/apis/example/v2" @@ -40,30 +40,10 @@ type ClusterTestTypeLister interface { // clusterTestTypeLister implements the ClusterTestTypeLister interface. type clusterTestTypeLister struct { - indexer cache.Indexer + listers.ResourceIndexer[*v2.ClusterTestType] } // NewClusterTestTypeLister returns a new ClusterTestTypeLister. func NewClusterTestTypeLister(indexer cache.Indexer) ClusterTestTypeLister { - return &clusterTestTypeLister{indexer: indexer} -} - -// List lists all ClusterTestTypes in the indexer. -func (s *clusterTestTypeLister) List(selector labels.Selector) (ret []*v2.ClusterTestType, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v2.ClusterTestType)) - }) - return ret, err -} - -// Get retrieves the ClusterTestType from the index for a given name. -func (s *clusterTestTypeLister) Get(name string) (*v2.ClusterTestType, error) { - obj, exists, err := s.indexer.GetByKey(name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v2.Resource("clustertesttype"), name) - } - return obj.(*v2.ClusterTestType), nil + return &clusterTestTypeLister{listers.New[*v2.ClusterTestType](indexer, v2.Resource("clustertesttype"))} } diff --git a/examples/pkg/generated/listers/example/v2/expansion_generated.go b/examples/pkg/generated/listers/example/v2/expansion_generated.go index f9a194d7..f839dcae 100644 --- a/examples/pkg/generated/listers/example/v2/expansion_generated.go +++ b/examples/pkg/generated/listers/example/v2/expansion_generated.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -// Code generated by lister-gen-v0.30. DO NOT EDIT. +// Code generated by lister-gen-v0.31. DO NOT EDIT. package v2 diff --git a/examples/pkg/generated/listers/example/v2/testtype.go b/examples/pkg/generated/listers/example/v2/testtype.go index f54e499e..1103dfba 100644 --- a/examples/pkg/generated/listers/example/v2/testtype.go +++ b/examples/pkg/generated/listers/example/v2/testtype.go @@ -14,13 +14,13 @@ See the License for the specific language governing permissions and limitations under the License. */ -// Code generated by lister-gen-v0.30. DO NOT EDIT. +// Code generated by lister-gen-v0.31. DO NOT EDIT. package v2 import ( - "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/listers" "k8s.io/client-go/tools/cache" v2 "acme.corp/pkg/apis/example/v2" @@ -39,25 +39,17 @@ type TestTypeLister interface { // testTypeLister implements the TestTypeLister interface. type testTypeLister struct { - indexer cache.Indexer + listers.ResourceIndexer[*v2.TestType] } // NewTestTypeLister returns a new TestTypeLister. func NewTestTypeLister(indexer cache.Indexer) TestTypeLister { - return &testTypeLister{indexer: indexer} -} - -// List lists all TestTypes in the indexer. -func (s *testTypeLister) List(selector labels.Selector) (ret []*v2.TestType, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v2.TestType)) - }) - return ret, err + return &testTypeLister{listers.New[*v2.TestType](indexer, v2.Resource("testtype"))} } // TestTypes returns an object that can list and get TestTypes. func (s *testTypeLister) TestTypes(namespace string) TestTypeNamespaceLister { - return testTypeNamespaceLister{indexer: s.indexer, namespace: namespace} + return testTypeNamespaceLister{listers.NewNamespaced[*v2.TestType](s.ResourceIndexer, namespace)} } // TestTypeNamespaceLister helps list and get TestTypes. @@ -75,26 +67,5 @@ type TestTypeNamespaceLister interface { // testTypeNamespaceLister implements the TestTypeNamespaceLister // interface. type testTypeNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all TestTypes in the indexer for a given namespace. -func (s testTypeNamespaceLister) List(selector labels.Selector) (ret []*v2.TestType, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v2.TestType)) - }) - return ret, err -} - -// Get retrieves the TestType from the indexer for a given namespace and name. -func (s testTypeNamespaceLister) Get(name string) (*v2.TestType, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v2.Resource("testtype"), name) - } - return obj.(*v2.TestType), nil + listers.ResourceIndexer[*v2.TestType] } diff --git a/examples/pkg/generated/listers/example3/v1/clustertesttype.go b/examples/pkg/generated/listers/example3/v1/clustertesttype.go index dcd04743..1c9c074e 100644 --- a/examples/pkg/generated/listers/example3/v1/clustertesttype.go +++ b/examples/pkg/generated/listers/example3/v1/clustertesttype.go @@ -14,13 +14,13 @@ See the License for the specific language governing permissions and limitations under the License. */ -// Code generated by lister-gen-v0.30. DO NOT EDIT. +// Code generated by lister-gen-v0.31. DO NOT EDIT. package v1 import ( - "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/listers" "k8s.io/client-go/tools/cache" v1 "acme.corp/pkg/apis/example3/v1" @@ -40,30 +40,10 @@ type ClusterTestTypeLister interface { // clusterTestTypeLister implements the ClusterTestTypeLister interface. type clusterTestTypeLister struct { - indexer cache.Indexer + listers.ResourceIndexer[*v1.ClusterTestType] } // NewClusterTestTypeLister returns a new ClusterTestTypeLister. func NewClusterTestTypeLister(indexer cache.Indexer) ClusterTestTypeLister { - return &clusterTestTypeLister{indexer: indexer} -} - -// List lists all ClusterTestTypes in the indexer. -func (s *clusterTestTypeLister) List(selector labels.Selector) (ret []*v1.ClusterTestType, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1.ClusterTestType)) - }) - return ret, err -} - -// Get retrieves the ClusterTestType from the index for a given name. -func (s *clusterTestTypeLister) Get(name string) (*v1.ClusterTestType, error) { - obj, exists, err := s.indexer.GetByKey(name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1.Resource("clustertesttype"), name) - } - return obj.(*v1.ClusterTestType), nil + return &clusterTestTypeLister{listers.New[*v1.ClusterTestType](indexer, v1.Resource("clustertesttype"))} } diff --git a/examples/pkg/generated/listers/example3/v1/expansion_generated.go b/examples/pkg/generated/listers/example3/v1/expansion_generated.go index 05ca33d8..35b3a43b 100644 --- a/examples/pkg/generated/listers/example3/v1/expansion_generated.go +++ b/examples/pkg/generated/listers/example3/v1/expansion_generated.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -// Code generated by lister-gen-v0.30. DO NOT EDIT. +// Code generated by lister-gen-v0.31. DO NOT EDIT. package v1 diff --git a/examples/pkg/generated/listers/example3/v1/testtype.go b/examples/pkg/generated/listers/example3/v1/testtype.go index 150adcbf..29ae78cf 100644 --- a/examples/pkg/generated/listers/example3/v1/testtype.go +++ b/examples/pkg/generated/listers/example3/v1/testtype.go @@ -14,13 +14,13 @@ See the License for the specific language governing permissions and limitations under the License. */ -// Code generated by lister-gen-v0.30. DO NOT EDIT. +// Code generated by lister-gen-v0.31. DO NOT EDIT. package v1 import ( - "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/listers" "k8s.io/client-go/tools/cache" v1 "acme.corp/pkg/apis/example3/v1" @@ -39,25 +39,17 @@ type TestTypeLister interface { // testTypeLister implements the TestTypeLister interface. type testTypeLister struct { - indexer cache.Indexer + listers.ResourceIndexer[*v1.TestType] } // NewTestTypeLister returns a new TestTypeLister. func NewTestTypeLister(indexer cache.Indexer) TestTypeLister { - return &testTypeLister{indexer: indexer} -} - -// List lists all TestTypes in the indexer. -func (s *testTypeLister) List(selector labels.Selector) (ret []*v1.TestType, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1.TestType)) - }) - return ret, err + return &testTypeLister{listers.New[*v1.TestType](indexer, v1.Resource("testtype"))} } // TestTypes returns an object that can list and get TestTypes. func (s *testTypeLister) TestTypes(namespace string) TestTypeNamespaceLister { - return testTypeNamespaceLister{indexer: s.indexer, namespace: namespace} + return testTypeNamespaceLister{listers.NewNamespaced[*v1.TestType](s.ResourceIndexer, namespace)} } // TestTypeNamespaceLister helps list and get TestTypes. @@ -75,26 +67,5 @@ type TestTypeNamespaceLister interface { // testTypeNamespaceLister implements the TestTypeNamespaceLister // interface. type testTypeNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all TestTypes in the indexer for a given namespace. -func (s testTypeNamespaceLister) List(selector labels.Selector) (ret []*v1.TestType, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1.TestType)) - }) - return ret, err -} - -// Get retrieves the TestType from the indexer for a given namespace and name. -func (s testTypeNamespaceLister) Get(name string) (*v1.TestType, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1.Resource("testtype"), name) - } - return obj.(*v1.TestType), nil + listers.ResourceIndexer[*v1.TestType] } diff --git a/examples/pkg/generated/listers/existinginterfaces/v1/clustertesttype.go b/examples/pkg/generated/listers/existinginterfaces/v1/clustertesttype.go index fb560d4d..20c8d28e 100644 --- a/examples/pkg/generated/listers/existinginterfaces/v1/clustertesttype.go +++ b/examples/pkg/generated/listers/existinginterfaces/v1/clustertesttype.go @@ -14,13 +14,13 @@ See the License for the specific language governing permissions and limitations under the License. */ -// Code generated by lister-gen-v0.30. DO NOT EDIT. +// Code generated by lister-gen-v0.31. DO NOT EDIT. package v1 import ( - "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/listers" "k8s.io/client-go/tools/cache" v1 "acme.corp/pkg/apis/existinginterfaces/v1" @@ -40,30 +40,10 @@ type ClusterTestTypeLister interface { // clusterTestTypeLister implements the ClusterTestTypeLister interface. type clusterTestTypeLister struct { - indexer cache.Indexer + listers.ResourceIndexer[*v1.ClusterTestType] } // NewClusterTestTypeLister returns a new ClusterTestTypeLister. func NewClusterTestTypeLister(indexer cache.Indexer) ClusterTestTypeLister { - return &clusterTestTypeLister{indexer: indexer} -} - -// List lists all ClusterTestTypes in the indexer. -func (s *clusterTestTypeLister) List(selector labels.Selector) (ret []*v1.ClusterTestType, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1.ClusterTestType)) - }) - return ret, err -} - -// Get retrieves the ClusterTestType from the index for a given name. -func (s *clusterTestTypeLister) Get(name string) (*v1.ClusterTestType, error) { - obj, exists, err := s.indexer.GetByKey(name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1.Resource("clustertesttype"), name) - } - return obj.(*v1.ClusterTestType), nil + return &clusterTestTypeLister{listers.New[*v1.ClusterTestType](indexer, v1.Resource("clustertesttype"))} } diff --git a/examples/pkg/generated/listers/existinginterfaces/v1/expansion_generated.go b/examples/pkg/generated/listers/existinginterfaces/v1/expansion_generated.go index 05ca33d8..35b3a43b 100644 --- a/examples/pkg/generated/listers/existinginterfaces/v1/expansion_generated.go +++ b/examples/pkg/generated/listers/existinginterfaces/v1/expansion_generated.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -// Code generated by lister-gen-v0.30. DO NOT EDIT. +// Code generated by lister-gen-v0.31. DO NOT EDIT. package v1 diff --git a/examples/pkg/generated/listers/existinginterfaces/v1/testtype.go b/examples/pkg/generated/listers/existinginterfaces/v1/testtype.go index 2d2e1ec2..1327792e 100644 --- a/examples/pkg/generated/listers/existinginterfaces/v1/testtype.go +++ b/examples/pkg/generated/listers/existinginterfaces/v1/testtype.go @@ -14,13 +14,13 @@ See the License for the specific language governing permissions and limitations under the License. */ -// Code generated by lister-gen-v0.30. DO NOT EDIT. +// Code generated by lister-gen-v0.31. DO NOT EDIT. package v1 import ( - "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/listers" "k8s.io/client-go/tools/cache" v1 "acme.corp/pkg/apis/existinginterfaces/v1" @@ -39,25 +39,17 @@ type TestTypeLister interface { // testTypeLister implements the TestTypeLister interface. type testTypeLister struct { - indexer cache.Indexer + listers.ResourceIndexer[*v1.TestType] } // NewTestTypeLister returns a new TestTypeLister. func NewTestTypeLister(indexer cache.Indexer) TestTypeLister { - return &testTypeLister{indexer: indexer} -} - -// List lists all TestTypes in the indexer. -func (s *testTypeLister) List(selector labels.Selector) (ret []*v1.TestType, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1.TestType)) - }) - return ret, err + return &testTypeLister{listers.New[*v1.TestType](indexer, v1.Resource("testtype"))} } // TestTypes returns an object that can list and get TestTypes. func (s *testTypeLister) TestTypes(namespace string) TestTypeNamespaceLister { - return testTypeNamespaceLister{indexer: s.indexer, namespace: namespace} + return testTypeNamespaceLister{listers.NewNamespaced[*v1.TestType](s.ResourceIndexer, namespace)} } // TestTypeNamespaceLister helps list and get TestTypes. @@ -75,26 +67,5 @@ type TestTypeNamespaceLister interface { // testTypeNamespaceLister implements the TestTypeNamespaceLister // interface. type testTypeNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all TestTypes in the indexer for a given namespace. -func (s testTypeNamespaceLister) List(selector labels.Selector) (ret []*v1.TestType, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1.TestType)) - }) - return ret, err -} - -// Get retrieves the TestType from the indexer for a given namespace and name. -func (s testTypeNamespaceLister) Get(name string) (*v1.TestType, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1.Resource("testtype"), name) - } - return obj.(*v1.TestType), nil + listers.ResourceIndexer[*v1.TestType] } diff --git a/examples/pkg/generated/listers/secondexample/v1/clustertesttype.go b/examples/pkg/generated/listers/secondexample/v1/clustertesttype.go index 1a57301b..9917dcea 100644 --- a/examples/pkg/generated/listers/secondexample/v1/clustertesttype.go +++ b/examples/pkg/generated/listers/secondexample/v1/clustertesttype.go @@ -14,13 +14,13 @@ See the License for the specific language governing permissions and limitations under the License. */ -// Code generated by lister-gen-v0.30. DO NOT EDIT. +// Code generated by lister-gen-v0.31. DO NOT EDIT. package v1 import ( - "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/listers" "k8s.io/client-go/tools/cache" v1 "acme.corp/pkg/apis/secondexample/v1" @@ -40,30 +40,10 @@ type ClusterTestTypeLister interface { // clusterTestTypeLister implements the ClusterTestTypeLister interface. type clusterTestTypeLister struct { - indexer cache.Indexer + listers.ResourceIndexer[*v1.ClusterTestType] } // NewClusterTestTypeLister returns a new ClusterTestTypeLister. func NewClusterTestTypeLister(indexer cache.Indexer) ClusterTestTypeLister { - return &clusterTestTypeLister{indexer: indexer} -} - -// List lists all ClusterTestTypes in the indexer. -func (s *clusterTestTypeLister) List(selector labels.Selector) (ret []*v1.ClusterTestType, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1.ClusterTestType)) - }) - return ret, err -} - -// Get retrieves the ClusterTestType from the index for a given name. -func (s *clusterTestTypeLister) Get(name string) (*v1.ClusterTestType, error) { - obj, exists, err := s.indexer.GetByKey(name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1.Resource("clustertesttype"), name) - } - return obj.(*v1.ClusterTestType), nil + return &clusterTestTypeLister{listers.New[*v1.ClusterTestType](indexer, v1.Resource("clustertesttype"))} } diff --git a/examples/pkg/generated/listers/secondexample/v1/expansion_generated.go b/examples/pkg/generated/listers/secondexample/v1/expansion_generated.go index 05ca33d8..35b3a43b 100644 --- a/examples/pkg/generated/listers/secondexample/v1/expansion_generated.go +++ b/examples/pkg/generated/listers/secondexample/v1/expansion_generated.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -// Code generated by lister-gen-v0.30. DO NOT EDIT. +// Code generated by lister-gen-v0.31. DO NOT EDIT. package v1 diff --git a/examples/pkg/generated/listers/secondexample/v1/testtype.go b/examples/pkg/generated/listers/secondexample/v1/testtype.go index a37ab964..329747ce 100644 --- a/examples/pkg/generated/listers/secondexample/v1/testtype.go +++ b/examples/pkg/generated/listers/secondexample/v1/testtype.go @@ -14,13 +14,13 @@ See the License for the specific language governing permissions and limitations under the License. */ -// Code generated by lister-gen-v0.30. DO NOT EDIT. +// Code generated by lister-gen-v0.31. DO NOT EDIT. package v1 import ( - "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/listers" "k8s.io/client-go/tools/cache" v1 "acme.corp/pkg/apis/secondexample/v1" @@ -39,25 +39,17 @@ type TestTypeLister interface { // testTypeLister implements the TestTypeLister interface. type testTypeLister struct { - indexer cache.Indexer + listers.ResourceIndexer[*v1.TestType] } // NewTestTypeLister returns a new TestTypeLister. func NewTestTypeLister(indexer cache.Indexer) TestTypeLister { - return &testTypeLister{indexer: indexer} -} - -// List lists all TestTypes in the indexer. -func (s *testTypeLister) List(selector labels.Selector) (ret []*v1.TestType, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1.TestType)) - }) - return ret, err + return &testTypeLister{listers.New[*v1.TestType](indexer, v1.Resource("testtype"))} } // TestTypes returns an object that can list and get TestTypes. func (s *testTypeLister) TestTypes(namespace string) TestTypeNamespaceLister { - return testTypeNamespaceLister{indexer: s.indexer, namespace: namespace} + return testTypeNamespaceLister{listers.NewNamespaced[*v1.TestType](s.ResourceIndexer, namespace)} } // TestTypeNamespaceLister helps list and get TestTypes. @@ -75,26 +67,5 @@ type TestTypeNamespaceLister interface { // testTypeNamespaceLister implements the TestTypeNamespaceLister // interface. type testTypeNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all TestTypes in the indexer for a given namespace. -func (s testTypeNamespaceLister) List(selector labels.Selector) (ret []*v1.TestType, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1.TestType)) - }) - return ret, err -} - -// Get retrieves the TestType from the indexer for a given namespace and name. -func (s testTypeNamespaceLister) Get(name string) (*v1.TestType, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1.Resource("testtype"), name) - } - return obj.(*v1.TestType), nil + listers.ResourceIndexer[*v1.TestType] } diff --git a/examples/pkg/kcp/clients/clientset/versioned/typed/example/v1beta1/fake/testtype.go b/examples/pkg/kcp/clients/clientset/versioned/typed/example/v1beta1/fake/testtype.go index 577bc4d7..a23f81fc 100644 --- a/examples/pkg/kcp/clients/clientset/versioned/typed/example/v1beta1/fake/testtype.go +++ b/examples/pkg/kcp/clients/clientset/versioned/typed/example/v1beta1/fake/testtype.go @@ -30,8 +30,11 @@ import ( kcptesting "github.com/kcp-dev/client-go/third_party/k8s.io/client-go/testing" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/labels" "k8s.io/apimachinery/pkg/runtime/schema" "k8s.io/apimachinery/pkg/types" + "k8s.io/apimachinery/pkg/watch" + "k8s.io/client-go/testing" examplev1beta1 "acme.corp/pkg/apis/example/v1beta1" applyconfigurationsexamplev1beta1 "acme.corp/pkg/generated/applyconfigurations/example/v1beta1" @@ -55,6 +58,31 @@ func (c *testTypesClusterClient) Cluster(clusterPath logicalcluster.Path) kcpexa return &testTypesNamespacer{Fake: c.Fake, ClusterPath: clusterPath} } +// List takes label and field selectors, and returns the list of TestTypes that match those selectors across all clusters. +func (c *testTypesClusterClient) List(ctx context.Context, opts metav1.ListOptions) (*examplev1beta1.TestTypeList, error) { + obj, err := c.Fake.Invokes(kcptesting.NewListAction(testTypesResource, testTypesKind, logicalcluster.Wildcard, metav1.NamespaceAll, opts), &examplev1beta1.TestTypeList{}) + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &examplev1beta1.TestTypeList{ListMeta: obj.(*examplev1beta1.TestTypeList).ListMeta} + for _, item := range obj.(*examplev1beta1.TestTypeList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested TestTypes across all clusters. +func (c *testTypesClusterClient) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return c.Fake.InvokesWatch(kcptesting.NewWatchAction(testTypesResource, logicalcluster.Wildcard, metav1.NamespaceAll, opts)) +} + type testTypesNamespacer struct { *kcptesting.Fake ClusterPath logicalcluster.Path @@ -114,6 +142,30 @@ func (c *testTypesClient) Get(ctx context.Context, name string, options metav1.G return obj.(*examplev1beta1.TestType), err } +// List takes label and field selectors, and returns the list of TestTypes that match those selectors. +func (c *testTypesClient) List(ctx context.Context, opts metav1.ListOptions) (*examplev1beta1.TestTypeList, error) { + obj, err := c.Fake.Invokes(kcptesting.NewListAction(testTypesResource, testTypesKind, c.ClusterPath, c.Namespace, opts), &examplev1beta1.TestTypeList{}) + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &examplev1beta1.TestTypeList{ListMeta: obj.(*examplev1beta1.TestTypeList).ListMeta} + for _, item := range obj.(*examplev1beta1.TestTypeList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +func (c *testTypesClient) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return c.Fake.InvokesWatch(kcptesting.NewWatchAction(testTypesResource, c.ClusterPath, c.Namespace, opts)) +} + func (c *testTypesClient) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (*examplev1beta1.TestType, error) { obj, err := c.Fake.Invokes(kcptesting.NewPatchSubresourceAction(testTypesResource, c.ClusterPath, c.Namespace, name, pt, data, subresources...), &examplev1beta1.TestType{}) if obj == nil { diff --git a/examples/pkg/kcp/clients/clientset/versioned/typed/example/v1beta1/testtype.go b/examples/pkg/kcp/clients/clientset/versioned/typed/example/v1beta1/testtype.go index cfae770e..5c84ea00 100644 --- a/examples/pkg/kcp/clients/clientset/versioned/typed/example/v1beta1/testtype.go +++ b/examples/pkg/kcp/clients/clientset/versioned/typed/example/v1beta1/testtype.go @@ -22,9 +22,15 @@ limitations under the License. package v1beta1 import ( + "context" + kcpclient "github.com/kcp-dev/apimachinery/v2/pkg/client" "github.com/kcp-dev/logicalcluster/v3" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/watch" + + examplev1beta1 "acme.corp/pkg/apis/example/v1beta1" examplev1beta1client "acme.corp/pkg/generated/clientset/versioned/typed/example/v1beta1" ) @@ -34,9 +40,12 @@ type TestTypesClusterGetter interface { TestTypes() TestTypeClusterInterface } -// TestTypeClusterInterface can scope down to one cluster and return a TestTypesNamespacer. +// TestTypeClusterInterface can operate on TestTypes across all clusters, +// or scope down to one cluster and return a TestTypesNamespacer. type TestTypeClusterInterface interface { Cluster(logicalcluster.Path) TestTypesNamespacer + List(ctx context.Context, opts metav1.ListOptions) (*examplev1beta1.TestTypeList, error) + Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) } type testTypesClusterInterface struct { @@ -52,6 +61,16 @@ func (c *testTypesClusterInterface) Cluster(clusterPath logicalcluster.Path) Tes return &testTypesNamespacer{clientCache: c.clientCache, clusterPath: clusterPath} } +// List returns the entire collection of all TestTypes across all clusters. +func (c *testTypesClusterInterface) List(ctx context.Context, opts metav1.ListOptions) (*examplev1beta1.TestTypeList, error) { + return c.clientCache.ClusterOrDie(logicalcluster.Wildcard).TestTypes(metav1.NamespaceAll).List(ctx, opts) +} + +// Watch begins to watch all TestTypes across all clusters. +func (c *testTypesClusterInterface) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return c.clientCache.ClusterOrDie(logicalcluster.Wildcard).TestTypes(metav1.NamespaceAll).Watch(ctx, opts) +} + // TestTypesNamespacer can scope to objects within a namespace, returning a examplev1beta1client.TestTypeInterface. type TestTypesNamespacer interface { Namespace(string) examplev1beta1client.TestTypeInterface diff --git a/examples/pkg/kcp/clients/informers/externalversions/example/v1beta1/interface.go b/examples/pkg/kcp/clients/informers/externalversions/example/v1beta1/interface.go index 758358ee..610484c0 100644 --- a/examples/pkg/kcp/clients/informers/externalversions/example/v1beta1/interface.go +++ b/examples/pkg/kcp/clients/informers/externalversions/example/v1beta1/interface.go @@ -26,6 +26,8 @@ import ( ) type ClusterInterface interface { + // TestTypes returns a TestTypeClusterInformer + TestTypes() TestTypeClusterInformer // ClusterTestTypes returns a ClusterTestTypeClusterInformer ClusterTestTypes() ClusterTestTypeClusterInformer } @@ -40,12 +42,19 @@ func New(f internalinterfaces.SharedInformerFactory, tweakListOptions internalin return &version{factory: f, tweakListOptions: tweakListOptions} } +// TestTypes returns a TestTypeClusterInformer +func (v *version) TestTypes() TestTypeClusterInformer { + return &testTypeClusterInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} +} + // ClusterTestTypes returns a ClusterTestTypeClusterInformer func (v *version) ClusterTestTypes() ClusterTestTypeClusterInformer { return &clusterTestTypeClusterInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} } type Interface interface { + // TestTypes returns a TestTypeInformer + TestTypes() TestTypeInformer // ClusterTestTypes returns a ClusterTestTypeInformer ClusterTestTypes() ClusterTestTypeInformer } @@ -61,6 +70,11 @@ func NewScoped(f internalinterfaces.SharedScopedInformerFactory, namespace strin return &scopedVersion{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} } +// TestTypes returns a TestTypeInformer +func (v *scopedVersion) TestTypes() TestTypeInformer { + return &testTypeScopedInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + // ClusterTestTypes returns a ClusterTestTypeInformer func (v *scopedVersion) ClusterTestTypes() ClusterTestTypeInformer { return &clusterTestTypeScopedInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} diff --git a/examples/pkg/kcp/clients/informers/externalversions/example/v1beta1/testtype.go b/examples/pkg/kcp/clients/informers/externalversions/example/v1beta1/testtype.go new file mode 100644 index 00000000..757da52c --- /dev/null +++ b/examples/pkg/kcp/clients/informers/externalversions/example/v1beta1/testtype.go @@ -0,0 +1,182 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The KCP 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 + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1beta1 + +import ( + "context" + "time" + + kcpcache "github.com/kcp-dev/apimachinery/v2/pkg/cache" + kcpinformers "github.com/kcp-dev/apimachinery/v2/third_party/informers" + "github.com/kcp-dev/logicalcluster/v3" + + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/watch" + "k8s.io/client-go/tools/cache" + + examplev1beta1 "acme.corp/pkg/apis/example/v1beta1" + scopedclientset "acme.corp/pkg/generated/clientset/versioned" + clientset "acme.corp/pkg/kcp/clients/clientset/versioned" + "acme.corp/pkg/kcp/clients/informers/externalversions/internalinterfaces" + examplev1beta1listers "acme.corp/pkg/kcp/clients/listers/example/v1beta1" +) + +// TestTypeClusterInformer provides access to a shared informer and lister for +// TestTypes. +type TestTypeClusterInformer interface { + Cluster(logicalcluster.Name) TestTypeInformer + Informer() kcpcache.ScopeableSharedIndexInformer + Lister() examplev1beta1listers.TestTypeClusterLister +} + +type testTypeClusterInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// NewTestTypeClusterInformer constructs a new informer for TestType type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTestTypeClusterInformer(client clientset.ClusterInterface, resyncPeriod time.Duration, indexers cache.Indexers) kcpcache.ScopeableSharedIndexInformer { + return NewFilteredTestTypeClusterInformer(client, resyncPeriod, indexers, nil) +} + +// NewFilteredTestTypeClusterInformer constructs a new informer for TestType type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredTestTypeClusterInformer(client clientset.ClusterInterface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) kcpcache.ScopeableSharedIndexInformer { + return kcpinformers.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.ExampleV1beta1().TestTypes().List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.ExampleV1beta1().TestTypes().Watch(context.TODO(), options) + }, + }, + &examplev1beta1.TestType{}, + resyncPeriod, + indexers, + ) +} + +func (f *testTypeClusterInformer) defaultInformer(client clientset.ClusterInterface, resyncPeriod time.Duration) kcpcache.ScopeableSharedIndexInformer { + return NewFilteredTestTypeClusterInformer(client, resyncPeriod, cache.Indexers{ + kcpcache.ClusterIndexName: kcpcache.ClusterIndexFunc, + kcpcache.ClusterAndNamespaceIndexName: kcpcache.ClusterAndNamespaceIndexFunc}, + f.tweakListOptions, + ) +} + +func (f *testTypeClusterInformer) Informer() kcpcache.ScopeableSharedIndexInformer { + return f.factory.InformerFor(&examplev1beta1.TestType{}, f.defaultInformer) +} + +func (f *testTypeClusterInformer) Lister() examplev1beta1listers.TestTypeClusterLister { + return examplev1beta1listers.NewTestTypeClusterLister(f.Informer().GetIndexer()) +} + +// TestTypeInformer provides access to a shared informer and lister for +// TestTypes. +type TestTypeInformer interface { + Informer() cache.SharedIndexInformer + Lister() examplev1beta1listers.TestTypeLister +} + +func (f *testTypeClusterInformer) Cluster(clusterName logicalcluster.Name) TestTypeInformer { + return &testTypeInformer{ + informer: f.Informer().Cluster(clusterName), + lister: f.Lister().Cluster(clusterName), + } +} + +type testTypeInformer struct { + informer cache.SharedIndexInformer + lister examplev1beta1listers.TestTypeLister +} + +func (f *testTypeInformer) Informer() cache.SharedIndexInformer { + return f.informer +} + +func (f *testTypeInformer) Lister() examplev1beta1listers.TestTypeLister { + return f.lister +} + +type testTypeScopedInformer struct { + factory internalinterfaces.SharedScopedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +func (f *testTypeScopedInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&examplev1beta1.TestType{}, f.defaultInformer) +} + +func (f *testTypeScopedInformer) Lister() examplev1beta1listers.TestTypeLister { + return examplev1beta1listers.NewTestTypeLister(f.Informer().GetIndexer()) +} + +// NewTestTypeInformer constructs a new informer for TestType type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTestTypeInformer(client scopedclientset.Interface, resyncPeriod time.Duration, namespace string, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredTestTypeInformer(client, resyncPeriod, namespace, indexers, nil) +} + +// NewFilteredTestTypeInformer constructs a new informer for TestType type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredTestTypeInformer(client scopedclientset.Interface, resyncPeriod time.Duration, namespace string, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.ExampleV1beta1().TestTypes(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.ExampleV1beta1().TestTypes(namespace).Watch(context.TODO(), options) + }, + }, + &examplev1beta1.TestType{}, + resyncPeriod, + indexers, + ) +} + +func (f *testTypeScopedInformer) defaultInformer(client scopedclientset.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredTestTypeInformer(client, resyncPeriod, f.namespace, cache.Indexers{ + cache.NamespaceIndex: cache.MetaNamespaceIndexFunc, + }, f.tweakListOptions) +} diff --git a/examples/pkg/kcp/clients/informers/externalversions/generic.go b/examples/pkg/kcp/clients/informers/externalversions/generic.go index 02cbb364..0e9e4a29 100644 --- a/examples/pkg/kcp/clients/informers/externalversions/generic.go +++ b/examples/pkg/kcp/clients/informers/externalversions/generic.go @@ -108,6 +108,8 @@ func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource case examplev1alpha1.SchemeGroupVersion.WithResource("clustertesttypes"): return &genericClusterInformer{resource: resource.GroupResource(), informer: f.Example().V1alpha1().ClusterTestTypes().Informer()}, nil // Group=example, Version=V1beta1 + case examplev1beta1.SchemeGroupVersion.WithResource("testtypes"): + return &genericClusterInformer{resource: resource.GroupResource(), informer: f.Example().V1beta1().TestTypes().Informer()}, nil case examplev1beta1.SchemeGroupVersion.WithResource("clustertesttypes"): return &genericClusterInformer{resource: resource.GroupResource(), informer: f.Example().V1beta1().ClusterTestTypes().Informer()}, nil // Group=example, Version=V2 @@ -156,6 +158,9 @@ func (f *sharedScopedInformerFactory) ForResource(resource schema.GroupVersionRe informer := f.Example().V1alpha1().ClusterTestTypes().Informer() return &genericInformer{lister: cache.NewGenericLister(informer.GetIndexer(), resource.GroupResource()), informer: informer}, nil // Group=example, Version=V1beta1 + case examplev1beta1.SchemeGroupVersion.WithResource("testtypes"): + informer := f.Example().V1beta1().TestTypes().Informer() + return &genericInformer{lister: cache.NewGenericLister(informer.GetIndexer(), resource.GroupResource()), informer: informer}, nil case examplev1beta1.SchemeGroupVersion.WithResource("clustertesttypes"): informer := f.Example().V1beta1().ClusterTestTypes().Informer() return &genericInformer{lister: cache.NewGenericLister(informer.GetIndexer(), resource.GroupResource()), informer: informer}, nil diff --git a/examples/pkg/kcp/clients/listers/example/v1beta1/testtype.go b/examples/pkg/kcp/clients/listers/example/v1beta1/testtype.go new file mode 100644 index 00000000..a0673c70 --- /dev/null +++ b/examples/pkg/kcp/clients/listers/example/v1beta1/testtype.go @@ -0,0 +1,196 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The KCP 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 + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1beta1 + +import ( + kcpcache "github.com/kcp-dev/apimachinery/v2/pkg/cache" + "github.com/kcp-dev/logicalcluster/v3" + + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" + + examplev1beta1 "acme.corp/pkg/apis/example/v1beta1" +) + +// TestTypeClusterLister can list TestTypes across all workspaces, or scope down to a TestTypeLister for one workspace. +// All objects returned here must be treated as read-only. +type TestTypeClusterLister interface { + // List lists all TestTypes in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*examplev1beta1.TestType, err error) + // Cluster returns a lister that can list and get TestTypes in one workspace. + Cluster(clusterName logicalcluster.Name) TestTypeLister + TestTypeClusterListerExpansion +} + +type testTypeClusterLister struct { + indexer cache.Indexer +} + +// NewTestTypeClusterLister returns a new TestTypeClusterLister. +// We assume that the indexer: +// - is fed by a cross-workspace LIST+WATCH +// - uses kcpcache.MetaClusterNamespaceKeyFunc as the key function +// - has the kcpcache.ClusterIndex as an index +// - has the kcpcache.ClusterAndNamespaceIndex as an index +func NewTestTypeClusterLister(indexer cache.Indexer) *testTypeClusterLister { + return &testTypeClusterLister{indexer: indexer} +} + +// List lists all TestTypes in the indexer across all workspaces. +func (s *testTypeClusterLister) List(selector labels.Selector) (ret []*examplev1beta1.TestType, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*examplev1beta1.TestType)) + }) + return ret, err +} + +// Cluster scopes the lister to one workspace, allowing users to list and get TestTypes. +func (s *testTypeClusterLister) Cluster(clusterName logicalcluster.Name) TestTypeLister { + return &testTypeLister{indexer: s.indexer, clusterName: clusterName} +} + +// TestTypeLister can list TestTypes across all namespaces, or scope down to a TestTypeNamespaceLister for one namespace. +// All objects returned here must be treated as read-only. +type TestTypeLister interface { + // List lists all TestTypes in the workspace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*examplev1beta1.TestType, err error) + // TestTypes returns a lister that can list and get TestTypes in one workspace and namespace. + TestTypes(namespace string) TestTypeNamespaceLister + TestTypeListerExpansion +} + +// testTypeLister can list all TestTypes inside a workspace or scope down to a TestTypeLister for one namespace. +type testTypeLister struct { + indexer cache.Indexer + clusterName logicalcluster.Name +} + +// List lists all TestTypes in the indexer for a workspace. +func (s *testTypeLister) List(selector labels.Selector) (ret []*examplev1beta1.TestType, err error) { + err = kcpcache.ListAllByCluster(s.indexer, s.clusterName, selector, func(i interface{}) { + ret = append(ret, i.(*examplev1beta1.TestType)) + }) + return ret, err +} + +// TestTypes returns an object that can list and get TestTypes in one namespace. +func (s *testTypeLister) TestTypes(namespace string) TestTypeNamespaceLister { + return &testTypeNamespaceLister{indexer: s.indexer, clusterName: s.clusterName, namespace: namespace} +} + +// testTypeNamespaceLister helps list and get TestTypes. +// All objects returned here must be treated as read-only. +type TestTypeNamespaceLister interface { + // List lists all TestTypes in the workspace and namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*examplev1beta1.TestType, err error) + // Get retrieves the TestType from the indexer for a given workspace, namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*examplev1beta1.TestType, error) + TestTypeNamespaceListerExpansion +} + +// testTypeNamespaceLister helps list and get TestTypes. +// All objects returned here must be treated as read-only. +type testTypeNamespaceLister struct { + indexer cache.Indexer + clusterName logicalcluster.Name + namespace string +} + +// List lists all TestTypes in the indexer for a given workspace and namespace. +func (s *testTypeNamespaceLister) List(selector labels.Selector) (ret []*examplev1beta1.TestType, err error) { + err = kcpcache.ListAllByClusterAndNamespace(s.indexer, s.clusterName, s.namespace, selector, func(i interface{}) { + ret = append(ret, i.(*examplev1beta1.TestType)) + }) + return ret, err +} + +// Get retrieves the TestType from the indexer for a given workspace, namespace and name. +func (s *testTypeNamespaceLister) Get(name string) (*examplev1beta1.TestType, error) { + key := kcpcache.ToClusterAwareKey(s.clusterName.String(), s.namespace, name) + obj, exists, err := s.indexer.GetByKey(key) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(examplev1beta1.Resource("testtypes"), name) + } + return obj.(*examplev1beta1.TestType), nil +} + +// NewTestTypeLister returns a new TestTypeLister. +// We assume that the indexer: +// - is fed by a workspace-scoped LIST+WATCH +// - uses cache.MetaNamespaceKeyFunc as the key function +// - has the cache.NamespaceIndex as an index +func NewTestTypeLister(indexer cache.Indexer) *testTypeScopedLister { + return &testTypeScopedLister{indexer: indexer} +} + +// testTypeScopedLister can list all TestTypes inside a workspace or scope down to a TestTypeLister for one namespace. +type testTypeScopedLister struct { + indexer cache.Indexer +} + +// List lists all TestTypes in the indexer for a workspace. +func (s *testTypeScopedLister) List(selector labels.Selector) (ret []*examplev1beta1.TestType, err error) { + err = cache.ListAll(s.indexer, selector, func(i interface{}) { + ret = append(ret, i.(*examplev1beta1.TestType)) + }) + return ret, err +} + +// TestTypes returns an object that can list and get TestTypes in one namespace. +func (s *testTypeScopedLister) TestTypes(namespace string) TestTypeNamespaceLister { + return &testTypeScopedNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// testTypeScopedNamespaceLister helps list and get TestTypes. +type testTypeScopedNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all TestTypes in the indexer for a given workspace and namespace. +func (s *testTypeScopedNamespaceLister) List(selector labels.Selector) (ret []*examplev1beta1.TestType, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(i interface{}) { + ret = append(ret, i.(*examplev1beta1.TestType)) + }) + return ret, err +} + +// Get retrieves the TestType from the indexer for a given workspace, namespace and name. +func (s *testTypeScopedNamespaceLister) Get(name string) (*examplev1beta1.TestType, error) { + key := s.namespace + "/" + name + obj, exists, err := s.indexer.GetByKey(key) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(examplev1beta1.Resource("testtypes"), name) + } + return obj.(*examplev1beta1.TestType), nil +} diff --git a/examples/pkg/kcp/clients/listers/example/v1beta1/testtype_expansion.go b/examples/pkg/kcp/clients/listers/example/v1beta1/testtype_expansion.go new file mode 100644 index 00000000..bd1291c9 --- /dev/null +++ b/examples/pkg/kcp/clients/listers/example/v1beta1/testtype_expansion.go @@ -0,0 +1,31 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The KCP 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 + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1beta1 + +// TestTypeClusterListerExpansion allows custom methods to be added to TestTypeClusterLister. +type TestTypeClusterListerExpansion interface{} + +// TestTypeListerExpansion allows custom methods to be added to TestTypeLister. +type TestTypeListerExpansion interface{} + +// TestTypeNamespaceListerExpansion allows custom methods to be added to TestTypeNamespaceLister. +type TestTypeNamespaceListerExpansion interface{} diff --git a/examples/pkg/kcpexisting/clients/clientset/versioned/typed/example/v1beta1/fake/testtype.go b/examples/pkg/kcpexisting/clients/clientset/versioned/typed/example/v1beta1/fake/testtype.go index be3536bc..f08cef98 100644 --- a/examples/pkg/kcpexisting/clients/clientset/versioned/typed/example/v1beta1/fake/testtype.go +++ b/examples/pkg/kcpexisting/clients/clientset/versioned/typed/example/v1beta1/fake/testtype.go @@ -30,8 +30,11 @@ import ( kcptesting "github.com/kcp-dev/client-go/third_party/k8s.io/client-go/testing" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/labels" "k8s.io/apimachinery/pkg/runtime/schema" "k8s.io/apimachinery/pkg/types" + "k8s.io/apimachinery/pkg/watch" + "k8s.io/client-go/testing" examplev1beta1 "acme.corp/pkg/apis/example/v1beta1" applyconfigurationsexamplev1beta1 "acme.corp/pkg/generated/applyconfigurations/example/v1beta1" @@ -55,6 +58,31 @@ func (c *testTypesClusterClient) Cluster(clusterPath logicalcluster.Path) kcpexa return &testTypesNamespacer{Fake: c.Fake, ClusterPath: clusterPath} } +// List takes label and field selectors, and returns the list of TestTypes that match those selectors across all clusters. +func (c *testTypesClusterClient) List(ctx context.Context, opts metav1.ListOptions) (*examplev1beta1.TestTypeList, error) { + obj, err := c.Fake.Invokes(kcptesting.NewListAction(testTypesResource, testTypesKind, logicalcluster.Wildcard, metav1.NamespaceAll, opts), &examplev1beta1.TestTypeList{}) + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &examplev1beta1.TestTypeList{ListMeta: obj.(*examplev1beta1.TestTypeList).ListMeta} + for _, item := range obj.(*examplev1beta1.TestTypeList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested TestTypes across all clusters. +func (c *testTypesClusterClient) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return c.Fake.InvokesWatch(kcptesting.NewWatchAction(testTypesResource, logicalcluster.Wildcard, metav1.NamespaceAll, opts)) +} + type testTypesNamespacer struct { *kcptesting.Fake ClusterPath logicalcluster.Path @@ -114,6 +142,30 @@ func (c *testTypesClient) Get(ctx context.Context, name string, options metav1.G return obj.(*examplev1beta1.TestType), err } +// List takes label and field selectors, and returns the list of TestTypes that match those selectors. +func (c *testTypesClient) List(ctx context.Context, opts metav1.ListOptions) (*examplev1beta1.TestTypeList, error) { + obj, err := c.Fake.Invokes(kcptesting.NewListAction(testTypesResource, testTypesKind, c.ClusterPath, c.Namespace, opts), &examplev1beta1.TestTypeList{}) + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &examplev1beta1.TestTypeList{ListMeta: obj.(*examplev1beta1.TestTypeList).ListMeta} + for _, item := range obj.(*examplev1beta1.TestTypeList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +func (c *testTypesClient) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return c.Fake.InvokesWatch(kcptesting.NewWatchAction(testTypesResource, c.ClusterPath, c.Namespace, opts)) +} + func (c *testTypesClient) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (*examplev1beta1.TestType, error) { obj, err := c.Fake.Invokes(kcptesting.NewPatchSubresourceAction(testTypesResource, c.ClusterPath, c.Namespace, name, pt, data, subresources...), &examplev1beta1.TestType{}) if obj == nil { diff --git a/examples/pkg/kcpexisting/clients/clientset/versioned/typed/example/v1beta1/testtype.go b/examples/pkg/kcpexisting/clients/clientset/versioned/typed/example/v1beta1/testtype.go index cfae770e..5c84ea00 100644 --- a/examples/pkg/kcpexisting/clients/clientset/versioned/typed/example/v1beta1/testtype.go +++ b/examples/pkg/kcpexisting/clients/clientset/versioned/typed/example/v1beta1/testtype.go @@ -22,9 +22,15 @@ limitations under the License. package v1beta1 import ( + "context" + kcpclient "github.com/kcp-dev/apimachinery/v2/pkg/client" "github.com/kcp-dev/logicalcluster/v3" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/watch" + + examplev1beta1 "acme.corp/pkg/apis/example/v1beta1" examplev1beta1client "acme.corp/pkg/generated/clientset/versioned/typed/example/v1beta1" ) @@ -34,9 +40,12 @@ type TestTypesClusterGetter interface { TestTypes() TestTypeClusterInterface } -// TestTypeClusterInterface can scope down to one cluster and return a TestTypesNamespacer. +// TestTypeClusterInterface can operate on TestTypes across all clusters, +// or scope down to one cluster and return a TestTypesNamespacer. type TestTypeClusterInterface interface { Cluster(logicalcluster.Path) TestTypesNamespacer + List(ctx context.Context, opts metav1.ListOptions) (*examplev1beta1.TestTypeList, error) + Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) } type testTypesClusterInterface struct { @@ -52,6 +61,16 @@ func (c *testTypesClusterInterface) Cluster(clusterPath logicalcluster.Path) Tes return &testTypesNamespacer{clientCache: c.clientCache, clusterPath: clusterPath} } +// List returns the entire collection of all TestTypes across all clusters. +func (c *testTypesClusterInterface) List(ctx context.Context, opts metav1.ListOptions) (*examplev1beta1.TestTypeList, error) { + return c.clientCache.ClusterOrDie(logicalcluster.Wildcard).TestTypes(metav1.NamespaceAll).List(ctx, opts) +} + +// Watch begins to watch all TestTypes across all clusters. +func (c *testTypesClusterInterface) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return c.clientCache.ClusterOrDie(logicalcluster.Wildcard).TestTypes(metav1.NamespaceAll).Watch(ctx, opts) +} + // TestTypesNamespacer can scope to objects within a namespace, returning a examplev1beta1client.TestTypeInterface. type TestTypesNamespacer interface { Namespace(string) examplev1beta1client.TestTypeInterface diff --git a/examples/pkg/kcpexisting/clients/informers/externalversions/example/v1beta1/interface.go b/examples/pkg/kcpexisting/clients/informers/externalversions/example/v1beta1/interface.go index 667f3555..557112cc 100644 --- a/examples/pkg/kcpexisting/clients/informers/externalversions/example/v1beta1/interface.go +++ b/examples/pkg/kcpexisting/clients/informers/externalversions/example/v1beta1/interface.go @@ -26,6 +26,8 @@ import ( ) type ClusterInterface interface { + // TestTypes returns a TestTypeClusterInformer + TestTypes() TestTypeClusterInformer // ClusterTestTypes returns a ClusterTestTypeClusterInformer ClusterTestTypes() ClusterTestTypeClusterInformer } @@ -40,6 +42,11 @@ func New(f internalinterfaces.SharedInformerFactory, tweakListOptions internalin return &version{factory: f, tweakListOptions: tweakListOptions} } +// TestTypes returns a TestTypeClusterInformer +func (v *version) TestTypes() TestTypeClusterInformer { + return &testTypeClusterInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} +} + // ClusterTestTypes returns a ClusterTestTypeClusterInformer func (v *version) ClusterTestTypes() ClusterTestTypeClusterInformer { return &clusterTestTypeClusterInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} diff --git a/examples/pkg/kcpexisting/clients/informers/externalversions/example/v1beta1/testtype.go b/examples/pkg/kcpexisting/clients/informers/externalversions/example/v1beta1/testtype.go new file mode 100644 index 00000000..471f4ea4 --- /dev/null +++ b/examples/pkg/kcpexisting/clients/informers/externalversions/example/v1beta1/testtype.go @@ -0,0 +1,124 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The KCP 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 + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1beta1 + +import ( + "context" + "time" + + kcpcache "github.com/kcp-dev/apimachinery/v2/pkg/cache" + kcpinformers "github.com/kcp-dev/apimachinery/v2/third_party/informers" + "github.com/kcp-dev/logicalcluster/v3" + + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/watch" + "k8s.io/client-go/tools/cache" + + examplev1beta1 "acme.corp/pkg/apis/example/v1beta1" + upstreamexamplev1beta1informers "acme.corp/pkg/generated/informers/externalversions/example/v1beta1" + upstreamexamplev1beta1listers "acme.corp/pkg/generated/listers/example/v1beta1" + clientset "acme.corp/pkg/kcpexisting/clients/clientset/versioned" + "acme.corp/pkg/kcpexisting/clients/informers/externalversions/internalinterfaces" + examplev1beta1listers "acme.corp/pkg/kcpexisting/clients/listers/example/v1beta1" +) + +// TestTypeClusterInformer provides access to a shared informer and lister for +// TestTypes. +type TestTypeClusterInformer interface { + Cluster(logicalcluster.Name) upstreamexamplev1beta1informers.TestTypeInformer + Informer() kcpcache.ScopeableSharedIndexInformer + Lister() examplev1beta1listers.TestTypeClusterLister +} + +type testTypeClusterInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// NewTestTypeClusterInformer constructs a new informer for TestType type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTestTypeClusterInformer(client clientset.ClusterInterface, resyncPeriod time.Duration, indexers cache.Indexers) kcpcache.ScopeableSharedIndexInformer { + return NewFilteredTestTypeClusterInformer(client, resyncPeriod, indexers, nil) +} + +// NewFilteredTestTypeClusterInformer constructs a new informer for TestType type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredTestTypeClusterInformer(client clientset.ClusterInterface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) kcpcache.ScopeableSharedIndexInformer { + return kcpinformers.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.ExampleV1beta1().TestTypes().List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.ExampleV1beta1().TestTypes().Watch(context.TODO(), options) + }, + }, + &examplev1beta1.TestType{}, + resyncPeriod, + indexers, + ) +} + +func (f *testTypeClusterInformer) defaultInformer(client clientset.ClusterInterface, resyncPeriod time.Duration) kcpcache.ScopeableSharedIndexInformer { + return NewFilteredTestTypeClusterInformer(client, resyncPeriod, cache.Indexers{ + kcpcache.ClusterIndexName: kcpcache.ClusterIndexFunc, + kcpcache.ClusterAndNamespaceIndexName: kcpcache.ClusterAndNamespaceIndexFunc}, + f.tweakListOptions, + ) +} + +func (f *testTypeClusterInformer) Informer() kcpcache.ScopeableSharedIndexInformer { + return f.factory.InformerFor(&examplev1beta1.TestType{}, f.defaultInformer) +} + +func (f *testTypeClusterInformer) Lister() examplev1beta1listers.TestTypeClusterLister { + return examplev1beta1listers.NewTestTypeClusterLister(f.Informer().GetIndexer()) +} + +func (f *testTypeClusterInformer) Cluster(clusterName logicalcluster.Name) upstreamexamplev1beta1informers.TestTypeInformer { + return &testTypeInformer{ + informer: f.Informer().Cluster(clusterName), + lister: f.Lister().Cluster(clusterName), + } +} + +type testTypeInformer struct { + informer cache.SharedIndexInformer + lister upstreamexamplev1beta1listers.TestTypeLister +} + +func (f *testTypeInformer) Informer() cache.SharedIndexInformer { + return f.informer +} + +func (f *testTypeInformer) Lister() upstreamexamplev1beta1listers.TestTypeLister { + return f.lister +} diff --git a/examples/pkg/kcpexisting/clients/informers/externalversions/generic.go b/examples/pkg/kcpexisting/clients/informers/externalversions/generic.go index f6a0e1cc..96a66430 100644 --- a/examples/pkg/kcpexisting/clients/informers/externalversions/generic.go +++ b/examples/pkg/kcpexisting/clients/informers/externalversions/generic.go @@ -104,6 +104,8 @@ func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource case examplev1alpha1.SchemeGroupVersion.WithResource("clustertesttypes"): return &genericClusterInformer{resource: resource.GroupResource(), informer: f.Example().V1alpha1().ClusterTestTypes().Informer()}, nil // Group=example, Version=V1beta1 + case examplev1beta1.SchemeGroupVersion.WithResource("testtypes"): + return &genericClusterInformer{resource: resource.GroupResource(), informer: f.Example().V1beta1().TestTypes().Informer()}, nil case examplev1beta1.SchemeGroupVersion.WithResource("clustertesttypes"): return &genericClusterInformer{resource: resource.GroupResource(), informer: f.Example().V1beta1().ClusterTestTypes().Informer()}, nil // Group=example, Version=V2 diff --git a/examples/pkg/kcpexisting/clients/listers/example/v1beta1/testtype.go b/examples/pkg/kcpexisting/clients/listers/example/v1beta1/testtype.go new file mode 100644 index 00000000..7adb0d19 --- /dev/null +++ b/examples/pkg/kcpexisting/clients/listers/example/v1beta1/testtype.go @@ -0,0 +1,119 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The KCP 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 + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1beta1 + +import ( + kcpcache "github.com/kcp-dev/apimachinery/v2/pkg/cache" + "github.com/kcp-dev/logicalcluster/v3" + + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" + + examplev1beta1 "acme.corp/pkg/apis/example/v1beta1" + examplev1beta1listers "acme.corp/pkg/generated/listers/example/v1beta1" +) + +// TestTypeClusterLister can list TestTypes across all workspaces, or scope down to a TestTypeLister for one workspace. +// All objects returned here must be treated as read-only. +type TestTypeClusterLister interface { + // List lists all TestTypes in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*examplev1beta1.TestType, err error) + // Cluster returns a lister that can list and get TestTypes in one workspace. + Cluster(clusterName logicalcluster.Name) examplev1beta1listers.TestTypeLister + TestTypeClusterListerExpansion +} + +type testTypeClusterLister struct { + indexer cache.Indexer +} + +// NewTestTypeClusterLister returns a new TestTypeClusterLister. +// We assume that the indexer: +// - is fed by a cross-workspace LIST+WATCH +// - uses kcpcache.MetaClusterNamespaceKeyFunc as the key function +// - has the kcpcache.ClusterIndex as an index +// - has the kcpcache.ClusterAndNamespaceIndex as an index +func NewTestTypeClusterLister(indexer cache.Indexer) *testTypeClusterLister { + return &testTypeClusterLister{indexer: indexer} +} + +// List lists all TestTypes in the indexer across all workspaces. +func (s *testTypeClusterLister) List(selector labels.Selector) (ret []*examplev1beta1.TestType, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*examplev1beta1.TestType)) + }) + return ret, err +} + +// Cluster scopes the lister to one workspace, allowing users to list and get TestTypes. +func (s *testTypeClusterLister) Cluster(clusterName logicalcluster.Name) examplev1beta1listers.TestTypeLister { + return &testTypeLister{indexer: s.indexer, clusterName: clusterName} +} + +// testTypeLister implements the examplev1beta1listers.TestTypeLister interface. +type testTypeLister struct { + indexer cache.Indexer + clusterName logicalcluster.Name +} + +// List lists all TestTypes in the indexer for a workspace. +func (s *testTypeLister) List(selector labels.Selector) (ret []*examplev1beta1.TestType, err error) { + err = kcpcache.ListAllByCluster(s.indexer, s.clusterName, selector, func(i interface{}) { + ret = append(ret, i.(*examplev1beta1.TestType)) + }) + return ret, err +} + +// TestTypes returns an object that can list and get TestTypes in one namespace. +func (s *testTypeLister) TestTypes(namespace string) examplev1beta1listers.TestTypeNamespaceLister { + return &testTypeNamespaceLister{indexer: s.indexer, clusterName: s.clusterName, namespace: namespace} +} + +// testTypeNamespaceLister implements the examplev1beta1listers.TestTypeNamespaceLister interface. +type testTypeNamespaceLister struct { + indexer cache.Indexer + clusterName logicalcluster.Name + namespace string +} + +// List lists all TestTypes in the indexer for a given workspace and namespace. +func (s *testTypeNamespaceLister) List(selector labels.Selector) (ret []*examplev1beta1.TestType, err error) { + err = kcpcache.ListAllByClusterAndNamespace(s.indexer, s.clusterName, s.namespace, selector, func(i interface{}) { + ret = append(ret, i.(*examplev1beta1.TestType)) + }) + return ret, err +} + +// Get retrieves the TestType from the indexer for a given workspace, namespace and name. +func (s *testTypeNamespaceLister) Get(name string) (*examplev1beta1.TestType, error) { + key := kcpcache.ToClusterAwareKey(s.clusterName.String(), s.namespace, name) + obj, exists, err := s.indexer.GetByKey(key) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(examplev1beta1.Resource("testtypes"), name) + } + return obj.(*examplev1beta1.TestType), nil +} diff --git a/examples/pkg/generated/clientset/versioned/doc.go b/examples/pkg/kcpexisting/clients/listers/example/v1beta1/testtype_expansion.go similarity index 66% rename from examples/pkg/generated/clientset/versioned/doc.go rename to examples/pkg/kcpexisting/clients/listers/example/v1beta1/testtype_expansion.go index af41e7fd..29500b53 100644 --- a/examples/pkg/generated/clientset/versioned/doc.go +++ b/examples/pkg/kcpexisting/clients/listers/example/v1beta1/testtype_expansion.go @@ -1,3 +1,6 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + /* Copyright The KCP Authors. @@ -14,7 +17,9 @@ See the License for the specific language governing permissions and limitations under the License. */ -// Code generated by client-gen-v0.26.3. DO NOT EDIT. +// Code generated by kcp code-generator. DO NOT EDIT. + +package v1beta1 -// This package has the automatically generated clientset. -package versioned +// TestTypeClusterListerExpansion allows custom methods to be added to TestTypeClusterLister. +type TestTypeClusterListerExpansion interface{} diff --git a/go.mod b/go.mod index beefdebf..1b9a4287 100644 --- a/go.mod +++ b/go.mod @@ -4,34 +4,34 @@ go 1.22.0 require ( github.com/onsi/ginkgo v1.16.5 - github.com/onsi/gomega v1.33.1 - github.com/spf13/cobra v1.8.0 + github.com/onsi/gomega v1.34.1 + github.com/spf13/cobra v1.8.1 github.com/spf13/pflag v1.0.5 - golang.org/x/tools v0.21.0 - k8s.io/apimachinery v0.30.0 - k8s.io/code-generator v0.30.0 - k8s.io/gengo/v2 v2.0.0-20240404160639-a0386bf69313 - k8s.io/klog/v2 v2.120.1 - sigs.k8s.io/controller-tools v0.15.0 + golang.org/x/tools v0.24.0 + k8s.io/apimachinery v0.31.0 + k8s.io/code-generator v0.31.0 + k8s.io/gengo/v2 v2.0.0-20240826214909-a7b603a56eb7 + k8s.io/klog/v2 v2.130.1 + sigs.k8s.io/controller-tools v0.16.1 ) require ( - github.com/fatih/color v1.16.0 // indirect + github.com/fatih/color v1.17.0 // indirect github.com/fsnotify/fsnotify v1.7.0 // indirect - github.com/go-logr/logr v1.4.1 // indirect + github.com/go-logr/logr v1.4.2 // indirect github.com/google/go-cmp v0.6.0 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect github.com/kr/text v0.2.0 // indirect github.com/mattn/go-colorable v0.1.13 // indirect github.com/mattn/go-isatty v0.0.20 // indirect github.com/nxadm/tail v1.4.8 // indirect - github.com/rogpeppe/go-internal v1.11.0 // indirect - golang.org/x/mod v0.17.0 // indirect - golang.org/x/net v0.25.0 // indirect - golang.org/x/sync v0.7.0 // indirect - golang.org/x/sys v0.20.0 // indirect - golang.org/x/text v0.15.0 // indirect - google.golang.org/protobuf v1.34.1 // indirect + github.com/onsi/ginkgo/v2 v2.20.0 // indirect + golang.org/x/exp v0.0.0-20240823005443-9b4947da3948 // indirect + golang.org/x/mod v0.20.0 // indirect + golang.org/x/net v0.28.0 // indirect + golang.org/x/sync v0.8.0 // indirect + golang.org/x/sys v0.24.0 // indirect + golang.org/x/text v0.17.0 // indirect gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect diff --git a/go.sum b/go.sum index ae9d3e90..62c6a389 100644 --- a/go.sum +++ b/go.sum @@ -1,17 +1,17 @@ -github.com/cpuguy83/go-md2man/v2 v2.0.3/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= +github.com/cpuguy83/go-md2man/v2 v2.0.4/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/fatih/color v1.16.0 h1:zmkK9Ngbjj+K0yRhTVONQh1p/HknKYSlNT+vZCzyokM= -github.com/fatih/color v1.16.0/go.mod h1:fL2Sau1YI5c0pdGEVCbKQbLXB6edEj1ZgiY4NijnWvE= +github.com/fatih/color v1.17.0 h1:GlRw1BRJxkpqUCBKzKOw098ed57fEsKeNjpTe3cSjK4= +github.com/fatih/color v1.17.0/go.mod h1:YZ7TlrGPkiz6ku9fK3TLD/pl3CpsiFyu8N92HLgmosI= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= 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/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-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0 h1:p104kn46Q8WdvHunIJ9dAyjPVtrBPhSr3KT2yUst43I= github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg7847qk6SyHyPtNmDHnmrv/HOrqktSC+C9fM+CJOE= -github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 h1:tfuBGBXKqDEevZMzYi5KSi8KkcZtzBcTgAUUtapy0OI= github.com/go-task/slim-sprig/v3 v3.0.0 h1:sUs3vkvUymDpBKi3qH1YSqBQk9+9D/8M2mN1vB6EwHI= github.com/go-task/slim-sprig/v3 v3.0.0/go.mod h1:W848ghGpv3Qj3dhTPRyJypKRiqCdHZiAzKg9hl15HA8= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= @@ -26,8 +26,8 @@ github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMyw github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= -github.com/google/pprof v0.0.0-20240424215950-a892ee059fd6 h1:k7nVchz72niMH6YLQNvHSdIE7iqsQxK1P41mySCvssg= -github.com/google/pprof v0.0.0-20240424215950-a892ee059fd6/go.mod h1:kf6iHlnVGwgKolg33glAes7Yg/8iWP8ukqeldJSO7jw= +github.com/google/pprof v0.0.0-20240727154555-813a5fbdbec8 h1:FKHo8hFI3A+7w0aUQuYXQ+6EN5stWmeY/AZqtM8xk9k= +github.com/google/pprof v0.0.0-20240727154555-813a5fbdbec8/go.mod h1:K1liHPHnj73Fdn/EKuT8nrFqBihUSKXoLYU0BuatOYo= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= @@ -50,18 +50,18 @@ github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+W github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk= github.com/onsi/ginkgo v1.16.5 h1:8xi0RTUf59SOSfEtZMvwTvXYMzG4gV23XVHOZiXNtnE= github.com/onsi/ginkgo v1.16.5/go.mod h1:+E8gABHa3K6zRBolWtd+ROzc/U5bkGt0FwiG042wbpU= -github.com/onsi/ginkgo/v2 v2.17.2 h1:7eMhcy3GimbsA3hEnVKdw/PQM9XN9krpKVXsZdph0/g= -github.com/onsi/ginkgo/v2 v2.17.2/go.mod h1:nP2DPOQoNsQmsVyv5rDA8JkXQoCs6goXIvr/PRJ1eCc= +github.com/onsi/ginkgo/v2 v2.20.0 h1:PE84V2mHqoT1sglvHc8ZdQtPcwmvvt29WLEEO3xmdZw= +github.com/onsi/ginkgo/v2 v2.20.0/go.mod h1:lG9ey2Z29hR41WMVthyJBGUBcBhGOtoPF2VFMvBXFCI= github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= -github.com/onsi/gomega v1.33.1 h1:dsYjIxxSR755MDmKVsaFQTE22ChNBcuuTWgkUDSubOk= -github.com/onsi/gomega v1.33.1/go.mod h1:U4R44UsT+9eLIaYRB2a5qajjtQYn0hauxvRm16AVYg0= +github.com/onsi/gomega v1.34.1 h1:EUMJIKUjM8sKjYbtxQI9A4z2o+rruxnzNvpknOXie6k= +github.com/onsi/gomega v1.34.1/go.mod h1:kU1QgUvBDLXBJq618Xvm2LUX6rSAfRaFRTcdOeDLwwY= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/rogpeppe/go-internal v1.11.0 h1:cWPaGQEPrBb5/AsnsZesgZZ9yb1OQ+GOISoDNXVBh4M= -github.com/rogpeppe/go-internal v1.11.0/go.mod h1:ddIwULY96R17DhadqLgMfk9H9tvdUzkipdSkR5nkCZA= +github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8= +github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99yedzYV+kq4uf4= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= -github.com/spf13/cobra v1.8.0 h1:7aJaZx1B85qltLMc546zn58BxxfZdR/W22ej9CFoEf0= -github.com/spf13/cobra v1.8.0/go.mod h1:WXLWApfZ71AjXPya3WOlMsY9yMs7YeiHhFVlvLyhcho= +github.com/spf13/cobra v1.8.1 h1:e5/vxKd/rZsfSJMUX1agtjeTDf+qv1/JdBF8gg5k9ZM= +github.com/spf13/cobra v1.8.1/go.mod h1:wHxEcudfqmLYa8iTfL+OuZPbBZkmvliBWKIezN3kD9Y= github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= @@ -70,21 +70,23 @@ github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9dec 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/exp v0.0.0-20240823005443-9b4947da3948 h1:kx6Ds3MlpiUHKj7syVnbp57++8WpuKPcR5yjLBjvLEA= +golang.org/x/exp v0.0.0-20240823005443-9b4947da3948/go.mod h1:akd2r19cwCdwSwWeIdzYQGa/EZZyqcOdwWiwj5L5eKQ= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -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.20.0 h1:utOm6MM3R3dnawAiJgn0y+xvuYRsm1RKM/4giyfDgV0= +golang.org/x/mod v0.20.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/net v0.25.0 h1:d/OCCoBEUq33pjydKrGQhw7IlUPI2Oylr+8qLx49kac= -golang.org/x/net v0.25.0/go.mod h1:JkAGAh7GEvH74S6FOH42FLoXpXbE/aqXSrIQjXgsiwM= +golang.org/x/net v0.28.0 h1:a9JDOJc5GMUJ0+UDqmLT86WiEy7iWyIhz8gz8E4e5hE= +golang.org/x/net v0.28.0/go.mod h1:yqtgsTWOOnlGLG9GFRrK3++bGOUEkNBoHZc8MEDWPNg= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/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.7.0 h1:YsImfSBoP9QPYL0xyKJPq0gcaJdG3rInoqxTWbfQu9M= -golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/sync v0.8.0 h1:3NFvSEYkUoMifnESzZl15y791HH1qU2xm6eCJU5ZPXQ= +golang.org/x/sync v0.8.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= 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= @@ -96,17 +98,17 @@ golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20210112080510-489259a85091/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.20.0 h1:Od9JTbYCk261bKm4M/mw7AklTlFYIa0bIp9BgSm1S8Y= -golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.24.0 h1:Twjiwq9dn6R1fQcyiK+wQyHWfaz/BJB+YIpzU/Cv3Xg= +golang.org/x/sys v0.24.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.15.0 h1:h1V/4gjBv8v9cjcR6+AR5+/cIYK5N/WAgiv4xlsEtAk= -golang.org/x/text v0.15.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= +golang.org/x/text v0.17.0 h1:XtiM5bkSOt+ewxlOE/aE/AKEHibwj/6gvWMl9Rsh0Qc= +golang.org/x/text v0.17.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= 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-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.21.0 h1:qc0xYgIbsSDt9EyWz05J5wfa7LOVW0YTLOXrqdLAWIw= -golang.org/x/tools v0.21.0/go.mod h1:aiJjzUbINMkxbQROHiO6hDPo2LHcIPhhQsa9DLh0yGk= +golang.org/x/tools v0.24.0 h1:J1shsA93PJUEVaUSaay7UXAyE8aimq3GW0pjlolpa24= +golang.org/x/tools v0.24.0/go.mod h1:YhNqVBIfWHdzvTLs0d8LCuMhkKUgSUKldakyV7W/WDQ= 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= @@ -117,8 +119,8 @@ google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQ google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.34.1 h1:9ddQBjfCyZPOHPUiPxpYESBLc+T8P3E+Vo4IbKZgFWg= -google.golang.org/protobuf v1.34.1/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= +google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg= +google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/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= @@ -132,13 +134,13 @@ gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -k8s.io/apimachinery v0.30.0 h1:qxVPsyDM5XS96NIh9Oj6LavoVFYff/Pon9cZeDIkHHA= -k8s.io/apimachinery v0.30.0/go.mod h1:iexa2somDaxdnj7bha06bhb43Zpa6eWH8N8dbqVjTUc= -k8s.io/code-generator v0.30.0 h1:3VUVqHvWFSVSm9kqL/G6kD4ZwNdHF6J/jPyo3Jgjy3k= -k8s.io/code-generator v0.30.0/go.mod h1:mBMZhfRR4IunJUh2+7LVmdcWwpouCH5+LNPkZ3t/v7Q= -k8s.io/gengo/v2 v2.0.0-20240404160639-a0386bf69313 h1:bKcdZJOPICVmIIuaM9+MXmapE94dn5AYv5ODs1jA43o= -k8s.io/gengo/v2 v2.0.0-20240404160639-a0386bf69313/go.mod h1:VH3AT8AaQOqiGjMF9p0/IM1Dj+82ZwjfxUP1IxaHE+8= -k8s.io/klog/v2 v2.120.1 h1:QXU6cPEOIslTGvZaXvFWiP9VKyeet3sawzTOvdXb4Vw= -k8s.io/klog/v2 v2.120.1/go.mod h1:3Jpz1GvMt720eyJH1ckRHK1EDfpxISzJ7I9OYgaDtPE= -sigs.k8s.io/controller-tools v0.15.0 h1:4dxdABXGDhIa68Fiwaif0vcu32xfwmgQ+w8p+5CxoAI= -sigs.k8s.io/controller-tools v0.15.0/go.mod h1:8zUSS2T8Hx0APCNRhJWbS3CAQEbIxLa07khzh7pZmXM= +k8s.io/apimachinery v0.31.0 h1:m9jOiSr3FoSSL5WO9bjm1n6B9KROYYgNZOb4tyZ1lBc= +k8s.io/apimachinery v0.31.0/go.mod h1:rsPdaZJfTfLsNJSQzNHQvYoTmxhoOEofxtOsF3rtsMo= +k8s.io/code-generator v0.31.0 h1:w607nrMi1KeDKB3/F/J4lIoOgAwc+gV9ZKew4XRfMp8= +k8s.io/code-generator v0.31.0/go.mod h1:84y4w3es8rOJOUUP1rLsIiGlO1JuEaPFXQPA9e/K6U0= +k8s.io/gengo/v2 v2.0.0-20240826214909-a7b603a56eb7 h1:cErOOTkQ3JW19o4lo91fFurouhP8NcoBvb7CkvhZZpk= +k8s.io/gengo/v2 v2.0.0-20240826214909-a7b603a56eb7/go.mod h1:EJykeLsmFC60UQbYJezXkEsG2FLrt0GPNkU5iK5GWxU= +k8s.io/klog/v2 v2.130.1 h1:n9Xl7H1Xvksem4KFG4PYbdQCQxqc/tTUyrgXaOhHSzk= +k8s.io/klog/v2 v2.130.1/go.mod h1:3Jpz1GvMt720eyJH1ckRHK1EDfpxISzJ7I9OYgaDtPE= +sigs.k8s.io/controller-tools v0.16.1 h1:gvIsZm+2aimFDIBiDKumR7EBkc+oLxljoUVfRbDI6RI= +sigs.k8s.io/controller-tools v0.16.1/go.mod h1:0I0xqjR65YTfoO12iR+mZR6s6UAVcUARgXRlsu0ljB0= diff --git a/main.go b/main.go index 5e286837..b6f4acaf 100644 --- a/main.go +++ b/main.go @@ -70,7 +70,9 @@ var ( func init() { for genName, gen := range allGenerators { // make the generator options marker itself. - defn := markers.Must(markers.MakeDefinition(genName, markers.DescribesPackage, gen)) + def, err := markers.MakeDefinition(genName, markers.DescribesPackage, gen) + def.Strict = false + defn := markers.Must(def, err) if err := optionsRegistry.Register(defn); err != nil { panic(err) } @@ -82,7 +84,9 @@ func init() { // make per-generation output rule markers. for ruleName, rule := range allOutputRules { - ruleMarker := markers.Must(markers.MakeDefinition(fmt.Sprintf("output:%s:%s", genName, ruleName), markers.DescribesPackage, rule)) + def, err := markers.MakeDefinition(fmt.Sprintf("output:%s:%s", genName, ruleName), markers.DescribesPackage, rule) + def.Strict = false + ruleMarker := markers.Must(def, err) if err := optionsRegistry.Register(ruleMarker); err != nil { panic(err) } @@ -96,7 +100,10 @@ func init() { // make "default output" output rule markers. for ruleName, rule := range allOutputRules { - ruleMarker := markers.Must(markers.MakeDefinition("output:"+ruleName, markers.DescribesPackage, rule)) + def, err := markers.MakeDefinition("output:"+ruleName, markers.DescribesPackage, rule) + def.Strict = false + + ruleMarker := markers.Must(def, err) if err := optionsRegistry.Register(ruleMarker); err != nil { panic(err) } @@ -129,7 +136,7 @@ func main() { Long: "Generate Cluster-Aware Kubernetes API libraries.", Example: ` # Generate listers for all types under apis/, # outputting them to /tmp/clients - code-generator lister:apiPackagePath=acme.corp/pkg/apis,singleClusterListerPackagePath=acme.corp/pkg/generated/listers,headerFile=./../hack/boilerplate/boilerplate.go.txt paths=./apis/... output:dir=/tmp + code-generator lister:apiPackagePath=acme.corp/pkg/apis,singleClusterListerPackagePath=acme.corp/pkg/generated/listers,headerFile=./../hack/boilerplate/boilerplate.go.txt paths=./apis/... output:dir=/tmp # Run all the generators for a given project code-generator \ diff --git a/pkg/generators/clientgen/clientgen.go b/pkg/generators/clientgen/clientgen.go index c7bebfaa..d6d10a22 100644 --- a/pkg/generators/clientgen/clientgen.go +++ b/pkg/generators/clientgen/clientgen.go @@ -69,13 +69,13 @@ type Generator struct { func (Generator) RegisterMarkers(into *markers.Registry) error { return markers.RegisterAll(into, - parser.GenclientMarker, - parser.NonNamespacedMarker, - parser.GroupNameMarker, - parser.NoVerbsMarker, - parser.ReadOnlyMarker, - parser.SkipVerbsMarker, - parser.OnlyVerbsMarker, + parser.GenclientMarker(), + parser.NonNamespacedMarker(), + parser.GroupNameMarker(), + parser.NoVerbsMarker(), + parser.ReadOnlyMarker(), + parser.SkipVerbsMarker(), + parser.OnlyVerbsMarker(), ) } diff --git a/pkg/generators/informergen/informergen.go b/pkg/generators/informergen/informergen.go index 37bef92c..157585c8 100644 --- a/pkg/generators/informergen/informergen.go +++ b/pkg/generators/informergen/informergen.go @@ -74,13 +74,13 @@ type Generator struct { func (g Generator) RegisterMarkers(into *markers.Registry) error { return markers.RegisterAll(into, - parser.GenclientMarker, - parser.NonNamespacedMarker, - parser.GroupNameMarker, - parser.NoVerbsMarker, - parser.ReadOnlyMarker, - parser.SkipVerbsMarker, - parser.OnlyVerbsMarker, + parser.GenclientMarker(), + parser.NonNamespacedMarker(), + parser.GroupNameMarker(), + parser.NoVerbsMarker(), + parser.ReadOnlyMarker(), + parser.SkipVerbsMarker(), + parser.OnlyVerbsMarker(), ) } diff --git a/pkg/generators/listergen/listergen.go b/pkg/generators/listergen/listergen.go index e9327fe2..0aa7ebe4 100644 --- a/pkg/generators/listergen/listergen.go +++ b/pkg/generators/listergen/listergen.go @@ -50,13 +50,13 @@ type Generator struct { func (Generator) RegisterMarkers(into *markers.Registry) error { return markers.RegisterAll(into, - parser.GenclientMarker, - parser.NonNamespacedMarker, - parser.GroupNameMarker, - parser.NoVerbsMarker, - parser.ReadOnlyMarker, - parser.SkipVerbsMarker, - parser.OnlyVerbsMarker, + parser.GenclientMarker(), + parser.NonNamespacedMarker(), + parser.GroupNameMarker(), + parser.NoVerbsMarker(), + parser.ReadOnlyMarker(), + parser.SkipVerbsMarker(), + parser.OnlyVerbsMarker(), ) } diff --git a/pkg/parser/extract.go b/pkg/parser/extract.go index 80f1958f..3c4882fa 100644 --- a/pkg/parser/extract.go +++ b/pkg/parser/extract.go @@ -89,7 +89,7 @@ func CollectKinds(ctx *genall.GenerationContext, verbs ...string) (map[Group]map continue } - groupNameRaw, ok := packageMarkers.Get(GroupNameMarker.Name).(markers.RawArguments) + groupNameRaw, ok := packageMarkers.Get(GroupNameMarker().Name).(markers.RawArguments) if ok { // If there's a comment of the form "// +groupName=somegroup" or // "// +groupName=somegroup.foo.bar.io", use the first field (somegroup) as the name of the @@ -104,7 +104,7 @@ func CollectKinds(ctx *genall.GenerationContext, verbs ...string) (map[Group]map groupGoName = namer.IC(parts[0]) } - groupGoNameRaw, ok := packageMarkers.Get(GroupGoNameMarker.Name).(markers.RawArguments) + groupGoNameRaw, ok := packageMarkers.Get(GroupGoNameMarker().Name).(markers.RawArguments) if ok { // If there's a comment of the form "// +groupGoName=SomeUniqueShortName", use that as // the Go group identifier in CamelCase. diff --git a/pkg/parser/markers.go b/pkg/parser/markers.go index 97b394d7..e4ca6c8d 100644 --- a/pkg/parser/markers.go +++ b/pkg/parser/markers.go @@ -28,24 +28,78 @@ import ( var ( // In controller-tool's terms marker's are defined in the following format: :=. These // markers are not a part of genclient, since they do not accept any values. - GenclientMarker = markers.Must(markers.MakeDefinition("genclient", markers.DescribesType, extension{})) - NonNamespacedMarker = markers.Must(markers.MakeDefinition("genclient:nonNamespaced", markers.DescribesType, struct{}{})) + genclientMarker = markers.Must(markers.MakeDefinition("genclient", markers.DescribesType, extension{})) + nonNamespacedMarker = markers.Must(markers.MakeDefinition("genclient:nonNamespaced", markers.DescribesType, struct{}{})) // These markers, are not a part of "+genclient", and are defined separately because they accept a list which is comma separated. In // controller-tools, comma indicates another argument, as multiple arguments need to provided with a semi-colon separator. - SkipVerbsMarker = markers.Must(markers.MakeDefinition("genclient:skipVerbs", markers.DescribesType, markers.RawArguments(""))) - OnlyVerbsMarker = markers.Must(markers.MakeDefinition("genclient:onlyVerbs", markers.DescribesType, markers.RawArguments(""))) + skipVerbsMarker = markers.Must(markers.MakeDefinition("genclient:skipVerbs", markers.DescribesType, markers.RawArguments(""))) + onlyVerbsMarker = markers.Must(markers.MakeDefinition("genclient:onlyVerbs", markers.DescribesType, markers.RawArguments(""))) - GroupNameMarker = markers.Must(markers.MakeDefinition("groupName", markers.DescribesPackage, markers.RawArguments(""))) - GroupGoNameMarker = markers.Must(markers.MakeDefinition("groupGoName", markers.DescribesPackage, markers.RawArguments(""))) + groupNameMarker = markers.Must(markers.MakeDefinition("groupName", markers.DescribesPackage, markers.RawArguments(""))) + groupGoNameMarker = markers.Must(markers.MakeDefinition("groupGoName", markers.DescribesPackage, markers.RawArguments(""))) // In controller-tool's terms marker's are defined in the following format: :=. These // markers are not a part of genclient, since they do not accept any values. - NoStatusMarker = markers.Must(markers.MakeDefinition("genclient:noStatus", markers.DescribesType, struct{}{})) - NoVerbsMarker = markers.Must(markers.MakeDefinition("genclient:noVerbs", markers.DescribesType, struct{}{})) - ReadOnlyMarker = markers.Must(markers.MakeDefinition("genclient:readonly", markers.DescribesType, struct{}{})) + noStatusMarker = markers.Must(markers.MakeDefinition("genclient:noStatus", markers.DescribesType, struct{}{})) + noVerbsMarker = markers.Must(markers.MakeDefinition("genclient:noVerbs", markers.DescribesType, struct{}{})) + readOnlyMarker = markers.Must(markers.MakeDefinition("genclient:readonly", markers.DescribesType, struct{}{})) ) +func GenclientMarker() *markers.Definition { + def := genclientMarker + def.Strict = false + return def +} + +func NonNamespacedMarker() *markers.Definition { + def := nonNamespacedMarker + def.Strict = false + return def +} + +func SkipVerbsMarker() *markers.Definition { + def := skipVerbsMarker + def.Strict = false + return def +} + +func OnlyVerbsMarker() *markers.Definition { + def := onlyVerbsMarker + def.Strict = false + return def +} + +func GroupNameMarker() *markers.Definition { + def := groupNameMarker + def.Strict = false + return def +} + +func GroupGoNameMarker() *markers.Definition { + def := groupGoNameMarker + def.Strict = false + return def +} + +func NoStatusMarker() *markers.Definition { + def := noStatusMarker + def.Strict = false + return def +} + +func NoVerbsMarker() *markers.Definition { + def := noVerbsMarker + def.Strict = false + return def +} + +func ReadOnlyMarker() *markers.Definition { + def := readOnlyMarker + def.Strict = false + return def +} + type extension struct { Method *string Verb *string @@ -85,13 +139,13 @@ func (e *extension) ResultType() (string, string) { // ClientsGeneratedForType verifies if the genclient marker is enabled for // this type or not. func ClientsGeneratedForType(info *markers.TypeInfo) bool { - return info.Markers.Get(GenclientMarker.Name) != nil + return info.Markers.Get(GenclientMarker().Name) != nil } // IsClusterScoped verifies if the genclient marker for this // type is namespaced or clusterscoped. func IsClusterScoped(info *markers.TypeInfo) bool { - return info.Markers.Get(NonNamespacedMarker.Name) != nil + return info.Markers.Get(NonNamespacedMarker().Name) != nil } // IsNamespaced verifies if the genclient marker for this @@ -102,7 +156,7 @@ func IsNamespaced(info *markers.TypeInfo) bool { // SupportedVerbs determines which verbs the type supports. func SupportedVerbs(info *markers.TypeInfo) (sets.Set[string], error) { - if info.Markers.Get(NoVerbsMarker.Name) != nil { + if info.Markers.Get(NoVerbsMarker().Name) != nil { return sets.New[string](), nil } @@ -110,14 +164,14 @@ func SupportedVerbs(info *markers.TypeInfo) (sets.Set[string], error) { if items := info.Markers.Get(name); items != nil { val, ok := items.(markers.RawArguments) if !ok { - return nil, fmt.Errorf("marker defined in wrong format %q", OnlyVerbsMarker.Name) + return nil, fmt.Errorf("marker defined in wrong format %q", OnlyVerbsMarker().Name) } return strings.Split(string(val), ","), nil } return nil, nil } - onlyVerbs, err := extractVerbs(info, OnlyVerbsMarker.Name) + onlyVerbs, err := extractVerbs(info, OnlyVerbsMarker().Name) if err != nil { return sets.New[string](), err } @@ -126,15 +180,15 @@ func SupportedVerbs(info *markers.TypeInfo) (sets.Set[string], error) { } baseVerbs := sets.New[string](genutil.SupportedVerbs...) - if info.Markers.Get(ReadOnlyMarker.Name) != nil { + if info.Markers.Get(ReadOnlyMarker().Name) != nil { baseVerbs = sets.New[string](genutil.ReadonlyVerbs...) } - if info.Markers.Get(NoStatusMarker.Name) != nil { + if info.Markers.Get(NoStatusMarker().Name) != nil { baseVerbs = baseVerbs.Difference(sets.New[string]("updateStatus", "applyStatus")) } - skipVerbs, err := extractVerbs(info, SkipVerbsMarker.Name) + skipVerbs, err := extractVerbs(info, SkipVerbsMarker().Name) if err != nil { return sets.New[string](), err } @@ -142,7 +196,7 @@ func SupportedVerbs(info *markers.TypeInfo) (sets.Set[string], error) { } func ClientExtensions(info *markers.TypeInfo) []Extension { - values, ok := info.Markers[GenclientMarker.Name] + values, ok := info.Markers[GenclientMarker().Name] if !ok || values == nil { return nil }