From 29efaab849ee67cfaabd880b19a6ed5aabf49696 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 12 Dec 2024 15:02:29 +0000 Subject: [PATCH] chore(deps): update dependency kubernetes/code-generator to v0.32.0 (#923) * chore(deps): update dependency kubernetes/code-generator to v0.32.0 * chore: regenerate --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Jakub Warczarek --- .tools_versions.yaml | 2 +- pkg/clientset/clientset.go | 4 +- .../typed/apis/v1alpha1/aigateway.go | 25 ++-- .../typed/apis/v1alpha1/apis_client.go | 10 +- .../v1alpha1/dataplanemetricsextension.go | 27 ++-- .../apis/v1alpha1/fake/fake_aigateway.go | 139 +++-------------- .../apis/v1alpha1/fake/fake_apis_client.go | 8 +- .../fake/fake_dataplanemetricsextension.go | 141 +++--------------- .../fake/fake_kongplugininstallation.go | 141 +++--------------- .../v1alpha1/fake/fake_konnectextension.go | 141 +++--------------- .../apis/v1alpha1/kongplugininstallation.go | 25 ++-- .../typed/apis/v1alpha1/konnectextension.go | 25 ++-- .../typed/apis/v1beta1/apis_client.go | 10 +- .../typed/apis/v1beta1/controlplane.go | 25 ++-- pkg/clientset/typed/apis/v1beta1/dataplane.go | 25 ++-- .../apis/v1beta1/fake/fake_apis_client.go | 6 +- .../apis/v1beta1/fake/fake_controlplane.go | 141 +++--------------- .../typed/apis/v1beta1/fake/fake_dataplane.go | 139 +++-------------- .../v1beta1/fake/fake_gatewayconfiguration.go | 141 +++--------------- .../apis/v1beta1/gatewayconfiguration.go | 25 ++-- 20 files changed, 270 insertions(+), 930 deletions(-) diff --git a/.tools_versions.yaml b/.tools_versions.yaml index 393f7266a..4fc1bd980 100644 --- a/.tools_versions.yaml +++ b/.tools_versions.yaml @@ -1,5 +1,5 @@ # renovate: datasource=github-tags depName=kubernetes/code-generator -code-generator: "0.31.4" +code-generator: "0.32.0" # renovate: datasource=github-releases depName=kubernetes-sigs/controller-tools controller-tools: "0.16.5" # renovate: datasource=github-releases depName=kubernetes-sigs/kustomize diff --git a/pkg/clientset/clientset.go b/pkg/clientset/clientset.go index 481a52d2c..938bfe8a7 100644 --- a/pkg/clientset/clientset.go +++ b/pkg/clientset/clientset.go @@ -19,8 +19,8 @@ limitations under the License. package clientset import ( - "fmt" - "net/http" + fmt "fmt" + http "net/http" apisv1alpha1 "github.com/kong/gateway-operator/pkg/clientset/typed/apis/v1alpha1" apisv1beta1 "github.com/kong/gateway-operator/pkg/clientset/typed/apis/v1beta1" diff --git a/pkg/clientset/typed/apis/v1alpha1/aigateway.go b/pkg/clientset/typed/apis/v1alpha1/aigateway.go index 53646b577..17b002214 100644 --- a/pkg/clientset/typed/apis/v1alpha1/aigateway.go +++ b/pkg/clientset/typed/apis/v1alpha1/aigateway.go @@ -19,9 +19,9 @@ limitations under the License. package v1alpha1 import ( - "context" + context "context" - v1alpha1 "github.com/kong/gateway-operator/api/v1alpha1" + apisv1alpha1 "github.com/kong/gateway-operator/api/v1alpha1" scheme "github.com/kong/gateway-operator/pkg/clientset/scheme" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" @@ -37,33 +37,34 @@ type AIGatewaysGetter interface { // AIGatewayInterface has methods to work with AIGateway resources. type AIGatewayInterface interface { - Create(ctx context.Context, aIGateway *v1alpha1.AIGateway, opts v1.CreateOptions) (*v1alpha1.AIGateway, error) - Update(ctx context.Context, aIGateway *v1alpha1.AIGateway, opts v1.UpdateOptions) (*v1alpha1.AIGateway, error) + Create(ctx context.Context, aIGateway *apisv1alpha1.AIGateway, opts v1.CreateOptions) (*apisv1alpha1.AIGateway, error) + Update(ctx context.Context, aIGateway *apisv1alpha1.AIGateway, opts v1.UpdateOptions) (*apisv1alpha1.AIGateway, error) // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). - UpdateStatus(ctx context.Context, aIGateway *v1alpha1.AIGateway, opts v1.UpdateOptions) (*v1alpha1.AIGateway, error) + UpdateStatus(ctx context.Context, aIGateway *apisv1alpha1.AIGateway, opts v1.UpdateOptions) (*apisv1alpha1.AIGateway, error) 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) (*v1alpha1.AIGateway, error) - List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.AIGatewayList, error) + Get(ctx context.Context, name string, opts v1.GetOptions) (*apisv1alpha1.AIGateway, error) + List(ctx context.Context, opts v1.ListOptions) (*apisv1alpha1.AIGatewayList, 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 *v1alpha1.AIGateway, err error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *apisv1alpha1.AIGateway, err error) AIGatewayExpansion } // aIGateways implements AIGatewayInterface type aIGateways struct { - *gentype.ClientWithList[*v1alpha1.AIGateway, *v1alpha1.AIGatewayList] + *gentype.ClientWithList[*apisv1alpha1.AIGateway, *apisv1alpha1.AIGatewayList] } // newAIGateways returns a AIGateways func newAIGateways(c *ApisV1alpha1Client, namespace string) *aIGateways { return &aIGateways{ - gentype.NewClientWithList[*v1alpha1.AIGateway, *v1alpha1.AIGatewayList]( + gentype.NewClientWithList[*apisv1alpha1.AIGateway, *apisv1alpha1.AIGatewayList]( "aigateways", c.RESTClient(), scheme.ParameterCodec, namespace, - func() *v1alpha1.AIGateway { return &v1alpha1.AIGateway{} }, - func() *v1alpha1.AIGatewayList { return &v1alpha1.AIGatewayList{} }), + func() *apisv1alpha1.AIGateway { return &apisv1alpha1.AIGateway{} }, + func() *apisv1alpha1.AIGatewayList { return &apisv1alpha1.AIGatewayList{} }, + ), } } diff --git a/pkg/clientset/typed/apis/v1alpha1/apis_client.go b/pkg/clientset/typed/apis/v1alpha1/apis_client.go index 1844e2a54..c709b064a 100644 --- a/pkg/clientset/typed/apis/v1alpha1/apis_client.go +++ b/pkg/clientset/typed/apis/v1alpha1/apis_client.go @@ -19,10 +19,10 @@ limitations under the License. package v1alpha1 import ( - "net/http" + http "net/http" - v1alpha1 "github.com/kong/gateway-operator/api/v1alpha1" - "github.com/kong/gateway-operator/pkg/clientset/scheme" + apisv1alpha1 "github.com/kong/gateway-operator/api/v1alpha1" + scheme "github.com/kong/gateway-operator/pkg/clientset/scheme" rest "k8s.io/client-go/rest" ) @@ -100,10 +100,10 @@ func New(c rest.Interface) *ApisV1alpha1Client { } func setConfigDefaults(config *rest.Config) error { - gv := v1alpha1.SchemeGroupVersion + gv := apisv1alpha1.SchemeGroupVersion config.GroupVersion = &gv config.APIPath = "/apis" - config.NegotiatedSerializer = scheme.Codecs.WithoutConversion() + config.NegotiatedSerializer = rest.CodecFactoryForGeneratedClient(scheme.Scheme, scheme.Codecs).WithoutConversion() if config.UserAgent == "" { config.UserAgent = rest.DefaultKubernetesUserAgent() diff --git a/pkg/clientset/typed/apis/v1alpha1/dataplanemetricsextension.go b/pkg/clientset/typed/apis/v1alpha1/dataplanemetricsextension.go index 30582bb94..a5b98e2e8 100644 --- a/pkg/clientset/typed/apis/v1alpha1/dataplanemetricsextension.go +++ b/pkg/clientset/typed/apis/v1alpha1/dataplanemetricsextension.go @@ -19,9 +19,9 @@ limitations under the License. package v1alpha1 import ( - "context" + context "context" - v1alpha1 "github.com/kong/gateway-operator/api/v1alpha1" + apisv1alpha1 "github.com/kong/gateway-operator/api/v1alpha1" scheme "github.com/kong/gateway-operator/pkg/clientset/scheme" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" @@ -37,33 +37,36 @@ type DataPlaneMetricsExtensionsGetter interface { // DataPlaneMetricsExtensionInterface has methods to work with DataPlaneMetricsExtension resources. type DataPlaneMetricsExtensionInterface interface { - Create(ctx context.Context, dataPlaneMetricsExtension *v1alpha1.DataPlaneMetricsExtension, opts v1.CreateOptions) (*v1alpha1.DataPlaneMetricsExtension, error) - Update(ctx context.Context, dataPlaneMetricsExtension *v1alpha1.DataPlaneMetricsExtension, opts v1.UpdateOptions) (*v1alpha1.DataPlaneMetricsExtension, error) + Create(ctx context.Context, dataPlaneMetricsExtension *apisv1alpha1.DataPlaneMetricsExtension, opts v1.CreateOptions) (*apisv1alpha1.DataPlaneMetricsExtension, error) + Update(ctx context.Context, dataPlaneMetricsExtension *apisv1alpha1.DataPlaneMetricsExtension, opts v1.UpdateOptions) (*apisv1alpha1.DataPlaneMetricsExtension, error) // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). - UpdateStatus(ctx context.Context, dataPlaneMetricsExtension *v1alpha1.DataPlaneMetricsExtension, opts v1.UpdateOptions) (*v1alpha1.DataPlaneMetricsExtension, error) + UpdateStatus(ctx context.Context, dataPlaneMetricsExtension *apisv1alpha1.DataPlaneMetricsExtension, opts v1.UpdateOptions) (*apisv1alpha1.DataPlaneMetricsExtension, error) 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) (*v1alpha1.DataPlaneMetricsExtension, error) - List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.DataPlaneMetricsExtensionList, error) + Get(ctx context.Context, name string, opts v1.GetOptions) (*apisv1alpha1.DataPlaneMetricsExtension, error) + List(ctx context.Context, opts v1.ListOptions) (*apisv1alpha1.DataPlaneMetricsExtensionList, 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 *v1alpha1.DataPlaneMetricsExtension, err error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *apisv1alpha1.DataPlaneMetricsExtension, err error) DataPlaneMetricsExtensionExpansion } // dataPlaneMetricsExtensions implements DataPlaneMetricsExtensionInterface type dataPlaneMetricsExtensions struct { - *gentype.ClientWithList[*v1alpha1.DataPlaneMetricsExtension, *v1alpha1.DataPlaneMetricsExtensionList] + *gentype.ClientWithList[*apisv1alpha1.DataPlaneMetricsExtension, *apisv1alpha1.DataPlaneMetricsExtensionList] } // newDataPlaneMetricsExtensions returns a DataPlaneMetricsExtensions func newDataPlaneMetricsExtensions(c *ApisV1alpha1Client, namespace string) *dataPlaneMetricsExtensions { return &dataPlaneMetricsExtensions{ - gentype.NewClientWithList[*v1alpha1.DataPlaneMetricsExtension, *v1alpha1.DataPlaneMetricsExtensionList]( + gentype.NewClientWithList[*apisv1alpha1.DataPlaneMetricsExtension, *apisv1alpha1.DataPlaneMetricsExtensionList]( "dataplanemetricsextensions", c.RESTClient(), scheme.ParameterCodec, namespace, - func() *v1alpha1.DataPlaneMetricsExtension { return &v1alpha1.DataPlaneMetricsExtension{} }, - func() *v1alpha1.DataPlaneMetricsExtensionList { return &v1alpha1.DataPlaneMetricsExtensionList{} }), + func() *apisv1alpha1.DataPlaneMetricsExtension { return &apisv1alpha1.DataPlaneMetricsExtension{} }, + func() *apisv1alpha1.DataPlaneMetricsExtensionList { + return &apisv1alpha1.DataPlaneMetricsExtensionList{} + }, + ), } } diff --git a/pkg/clientset/typed/apis/v1alpha1/fake/fake_aigateway.go b/pkg/clientset/typed/apis/v1alpha1/fake/fake_aigateway.go index 213ed4de8..c89c2aee3 100644 --- a/pkg/clientset/typed/apis/v1alpha1/fake/fake_aigateway.go +++ b/pkg/clientset/typed/apis/v1alpha1/fake/fake_aigateway.go @@ -19,129 +19,32 @@ limitations under the License. package fake import ( - "context" - v1alpha1 "github.com/kong/gateway-operator/api/v1alpha1" - 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" + apisv1alpha1 "github.com/kong/gateway-operator/pkg/clientset/typed/apis/v1alpha1" + gentype "k8s.io/client-go/gentype" ) -// FakeAIGateways implements AIGatewayInterface -type FakeAIGateways struct { +// fakeAIGateways implements AIGatewayInterface +type fakeAIGateways struct { + *gentype.FakeClientWithList[*v1alpha1.AIGateway, *v1alpha1.AIGatewayList] Fake *FakeApisV1alpha1 - ns string -} - -var aigatewaysResource = v1alpha1.SchemeGroupVersion.WithResource("aigateways") - -var aigatewaysKind = v1alpha1.SchemeGroupVersion.WithKind("AIGateway") - -// Get takes name of the aIGateway, and returns the corresponding aIGateway object, and an error if there is any. -func (c *FakeAIGateways) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.AIGateway, err error) { - emptyResult := &v1alpha1.AIGateway{} - obj, err := c.Fake. - Invokes(testing.NewGetActionWithOptions(aigatewaysResource, c.ns, name, options), emptyResult) - - if obj == nil { - return emptyResult, err - } - return obj.(*v1alpha1.AIGateway), err -} - -// List takes label and field selectors, and returns the list of AIGateways that match those selectors. -func (c *FakeAIGateways) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.AIGatewayList, err error) { - emptyResult := &v1alpha1.AIGatewayList{} - obj, err := c.Fake. - Invokes(testing.NewListActionWithOptions(aigatewaysResource, aigatewaysKind, c.ns, opts), emptyResult) - - if obj == nil { - return emptyResult, err - } - - label, _, _ := testing.ExtractFromListOptions(opts) - if label == nil { - label = labels.Everything() - } - list := &v1alpha1.AIGatewayList{ListMeta: obj.(*v1alpha1.AIGatewayList).ListMeta} - for _, item := range obj.(*v1alpha1.AIGatewayList).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 aIGateways. -func (c *FakeAIGateways) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - return c.Fake. - InvokesWatch(testing.NewWatchActionWithOptions(aigatewaysResource, c.ns, opts)) - -} - -// Create takes the representation of a aIGateway and creates it. Returns the server's representation of the aIGateway, and an error, if there is any. -func (c *FakeAIGateways) Create(ctx context.Context, aIGateway *v1alpha1.AIGateway, opts v1.CreateOptions) (result *v1alpha1.AIGateway, err error) { - emptyResult := &v1alpha1.AIGateway{} - obj, err := c.Fake. - Invokes(testing.NewCreateActionWithOptions(aigatewaysResource, c.ns, aIGateway, opts), emptyResult) - - if obj == nil { - return emptyResult, err - } - return obj.(*v1alpha1.AIGateway), err -} - -// Update takes the representation of a aIGateway and updates it. Returns the server's representation of the aIGateway, and an error, if there is any. -func (c *FakeAIGateways) Update(ctx context.Context, aIGateway *v1alpha1.AIGateway, opts v1.UpdateOptions) (result *v1alpha1.AIGateway, err error) { - emptyResult := &v1alpha1.AIGateway{} - obj, err := c.Fake. - Invokes(testing.NewUpdateActionWithOptions(aigatewaysResource, c.ns, aIGateway, opts), emptyResult) - - if obj == nil { - return emptyResult, err - } - return obj.(*v1alpha1.AIGateway), 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 *FakeAIGateways) UpdateStatus(ctx context.Context, aIGateway *v1alpha1.AIGateway, opts v1.UpdateOptions) (result *v1alpha1.AIGateway, err error) { - emptyResult := &v1alpha1.AIGateway{} - obj, err := c.Fake. - Invokes(testing.NewUpdateSubresourceActionWithOptions(aigatewaysResource, "status", c.ns, aIGateway, opts), emptyResult) - - if obj == nil { - return emptyResult, err - } - return obj.(*v1alpha1.AIGateway), err -} - -// Delete takes name of the aIGateway and deletes it. Returns an error if one occurs. -func (c *FakeAIGateways) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - _, err := c.Fake. - Invokes(testing.NewDeleteActionWithOptions(aigatewaysResource, c.ns, name, opts), &v1alpha1.AIGateway{}) - - return err } -// DeleteCollection deletes a collection of objects. -func (c *FakeAIGateways) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewDeleteCollectionActionWithOptions(aigatewaysResource, c.ns, opts, listOpts) - - _, err := c.Fake.Invokes(action, &v1alpha1.AIGatewayList{}) - return err -} - -// Patch applies the patch and returns the patched aIGateway. -func (c *FakeAIGateways) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.AIGateway, err error) { - emptyResult := &v1alpha1.AIGateway{} - obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceActionWithOptions(aigatewaysResource, c.ns, name, pt, data, opts, subresources...), emptyResult) - - if obj == nil { - return emptyResult, err +func newFakeAIGateways(fake *FakeApisV1alpha1, namespace string) apisv1alpha1.AIGatewayInterface { + return &fakeAIGateways{ + gentype.NewFakeClientWithList[*v1alpha1.AIGateway, *v1alpha1.AIGatewayList]( + fake.Fake, + namespace, + v1alpha1.SchemeGroupVersion.WithResource("aigateways"), + v1alpha1.SchemeGroupVersion.WithKind("AIGateway"), + func() *v1alpha1.AIGateway { return &v1alpha1.AIGateway{} }, + func() *v1alpha1.AIGatewayList { return &v1alpha1.AIGatewayList{} }, + func(dst, src *v1alpha1.AIGatewayList) { dst.ListMeta = src.ListMeta }, + func(list *v1alpha1.AIGatewayList) []*v1alpha1.AIGateway { return gentype.ToPointerSlice(list.Items) }, + func(list *v1alpha1.AIGatewayList, items []*v1alpha1.AIGateway) { + list.Items = gentype.FromPointerSlice(items) + }, + ), + fake, } - return obj.(*v1alpha1.AIGateway), err } diff --git a/pkg/clientset/typed/apis/v1alpha1/fake/fake_apis_client.go b/pkg/clientset/typed/apis/v1alpha1/fake/fake_apis_client.go index afc35bfd4..1e127551f 100644 --- a/pkg/clientset/typed/apis/v1alpha1/fake/fake_apis_client.go +++ b/pkg/clientset/typed/apis/v1alpha1/fake/fake_apis_client.go @@ -29,19 +29,19 @@ type FakeApisV1alpha1 struct { } func (c *FakeApisV1alpha1) AIGateways(namespace string) v1alpha1.AIGatewayInterface { - return &FakeAIGateways{c, namespace} + return newFakeAIGateways(c, namespace) } func (c *FakeApisV1alpha1) DataPlaneMetricsExtensions(namespace string) v1alpha1.DataPlaneMetricsExtensionInterface { - return &FakeDataPlaneMetricsExtensions{c, namespace} + return newFakeDataPlaneMetricsExtensions(c, namespace) } func (c *FakeApisV1alpha1) KongPluginInstallations(namespace string) v1alpha1.KongPluginInstallationInterface { - return &FakeKongPluginInstallations{c, namespace} + return newFakeKongPluginInstallations(c, namespace) } func (c *FakeApisV1alpha1) KonnectExtensions(namespace string) v1alpha1.KonnectExtensionInterface { - return &FakeKonnectExtensions{c, namespace} + return newFakeKonnectExtensions(c, namespace) } // RESTClient returns a RESTClient that is used to communicate diff --git a/pkg/clientset/typed/apis/v1alpha1/fake/fake_dataplanemetricsextension.go b/pkg/clientset/typed/apis/v1alpha1/fake/fake_dataplanemetricsextension.go index 7d52be0b3..c2dd868df 100644 --- a/pkg/clientset/typed/apis/v1alpha1/fake/fake_dataplanemetricsextension.go +++ b/pkg/clientset/typed/apis/v1alpha1/fake/fake_dataplanemetricsextension.go @@ -19,129 +19,34 @@ limitations under the License. package fake import ( - "context" - v1alpha1 "github.com/kong/gateway-operator/api/v1alpha1" - 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" + apisv1alpha1 "github.com/kong/gateway-operator/pkg/clientset/typed/apis/v1alpha1" + gentype "k8s.io/client-go/gentype" ) -// FakeDataPlaneMetricsExtensions implements DataPlaneMetricsExtensionInterface -type FakeDataPlaneMetricsExtensions struct { +// fakeDataPlaneMetricsExtensions implements DataPlaneMetricsExtensionInterface +type fakeDataPlaneMetricsExtensions struct { + *gentype.FakeClientWithList[*v1alpha1.DataPlaneMetricsExtension, *v1alpha1.DataPlaneMetricsExtensionList] Fake *FakeApisV1alpha1 - ns string -} - -var dataplanemetricsextensionsResource = v1alpha1.SchemeGroupVersion.WithResource("dataplanemetricsextensions") - -var dataplanemetricsextensionsKind = v1alpha1.SchemeGroupVersion.WithKind("DataPlaneMetricsExtension") - -// Get takes name of the dataPlaneMetricsExtension, and returns the corresponding dataPlaneMetricsExtension object, and an error if there is any. -func (c *FakeDataPlaneMetricsExtensions) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.DataPlaneMetricsExtension, err error) { - emptyResult := &v1alpha1.DataPlaneMetricsExtension{} - obj, err := c.Fake. - Invokes(testing.NewGetActionWithOptions(dataplanemetricsextensionsResource, c.ns, name, options), emptyResult) - - if obj == nil { - return emptyResult, err - } - return obj.(*v1alpha1.DataPlaneMetricsExtension), err -} - -// List takes label and field selectors, and returns the list of DataPlaneMetricsExtensions that match those selectors. -func (c *FakeDataPlaneMetricsExtensions) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.DataPlaneMetricsExtensionList, err error) { - emptyResult := &v1alpha1.DataPlaneMetricsExtensionList{} - obj, err := c.Fake. - Invokes(testing.NewListActionWithOptions(dataplanemetricsextensionsResource, dataplanemetricsextensionsKind, c.ns, opts), emptyResult) - - if obj == nil { - return emptyResult, err - } - - label, _, _ := testing.ExtractFromListOptions(opts) - if label == nil { - label = labels.Everything() - } - list := &v1alpha1.DataPlaneMetricsExtensionList{ListMeta: obj.(*v1alpha1.DataPlaneMetricsExtensionList).ListMeta} - for _, item := range obj.(*v1alpha1.DataPlaneMetricsExtensionList).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 dataPlaneMetricsExtensions. -func (c *FakeDataPlaneMetricsExtensions) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - return c.Fake. - InvokesWatch(testing.NewWatchActionWithOptions(dataplanemetricsextensionsResource, c.ns, opts)) - -} - -// Create takes the representation of a dataPlaneMetricsExtension and creates it. Returns the server's representation of the dataPlaneMetricsExtension, and an error, if there is any. -func (c *FakeDataPlaneMetricsExtensions) Create(ctx context.Context, dataPlaneMetricsExtension *v1alpha1.DataPlaneMetricsExtension, opts v1.CreateOptions) (result *v1alpha1.DataPlaneMetricsExtension, err error) { - emptyResult := &v1alpha1.DataPlaneMetricsExtension{} - obj, err := c.Fake. - Invokes(testing.NewCreateActionWithOptions(dataplanemetricsextensionsResource, c.ns, dataPlaneMetricsExtension, opts), emptyResult) - - if obj == nil { - return emptyResult, err - } - return obj.(*v1alpha1.DataPlaneMetricsExtension), err -} - -// Update takes the representation of a dataPlaneMetricsExtension and updates it. Returns the server's representation of the dataPlaneMetricsExtension, and an error, if there is any. -func (c *FakeDataPlaneMetricsExtensions) Update(ctx context.Context, dataPlaneMetricsExtension *v1alpha1.DataPlaneMetricsExtension, opts v1.UpdateOptions) (result *v1alpha1.DataPlaneMetricsExtension, err error) { - emptyResult := &v1alpha1.DataPlaneMetricsExtension{} - obj, err := c.Fake. - Invokes(testing.NewUpdateActionWithOptions(dataplanemetricsextensionsResource, c.ns, dataPlaneMetricsExtension, opts), emptyResult) - - if obj == nil { - return emptyResult, err - } - return obj.(*v1alpha1.DataPlaneMetricsExtension), 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 *FakeDataPlaneMetricsExtensions) UpdateStatus(ctx context.Context, dataPlaneMetricsExtension *v1alpha1.DataPlaneMetricsExtension, opts v1.UpdateOptions) (result *v1alpha1.DataPlaneMetricsExtension, err error) { - emptyResult := &v1alpha1.DataPlaneMetricsExtension{} - obj, err := c.Fake. - Invokes(testing.NewUpdateSubresourceActionWithOptions(dataplanemetricsextensionsResource, "status", c.ns, dataPlaneMetricsExtension, opts), emptyResult) - - if obj == nil { - return emptyResult, err - } - return obj.(*v1alpha1.DataPlaneMetricsExtension), err -} - -// Delete takes name of the dataPlaneMetricsExtension and deletes it. Returns an error if one occurs. -func (c *FakeDataPlaneMetricsExtensions) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - _, err := c.Fake. - Invokes(testing.NewDeleteActionWithOptions(dataplanemetricsextensionsResource, c.ns, name, opts), &v1alpha1.DataPlaneMetricsExtension{}) - - return err } -// DeleteCollection deletes a collection of objects. -func (c *FakeDataPlaneMetricsExtensions) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewDeleteCollectionActionWithOptions(dataplanemetricsextensionsResource, c.ns, opts, listOpts) - - _, err := c.Fake.Invokes(action, &v1alpha1.DataPlaneMetricsExtensionList{}) - return err -} - -// Patch applies the patch and returns the patched dataPlaneMetricsExtension. -func (c *FakeDataPlaneMetricsExtensions) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.DataPlaneMetricsExtension, err error) { - emptyResult := &v1alpha1.DataPlaneMetricsExtension{} - obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceActionWithOptions(dataplanemetricsextensionsResource, c.ns, name, pt, data, opts, subresources...), emptyResult) - - if obj == nil { - return emptyResult, err +func newFakeDataPlaneMetricsExtensions(fake *FakeApisV1alpha1, namespace string) apisv1alpha1.DataPlaneMetricsExtensionInterface { + return &fakeDataPlaneMetricsExtensions{ + gentype.NewFakeClientWithList[*v1alpha1.DataPlaneMetricsExtension, *v1alpha1.DataPlaneMetricsExtensionList]( + fake.Fake, + namespace, + v1alpha1.SchemeGroupVersion.WithResource("dataplanemetricsextensions"), + v1alpha1.SchemeGroupVersion.WithKind("DataPlaneMetricsExtension"), + func() *v1alpha1.DataPlaneMetricsExtension { return &v1alpha1.DataPlaneMetricsExtension{} }, + func() *v1alpha1.DataPlaneMetricsExtensionList { return &v1alpha1.DataPlaneMetricsExtensionList{} }, + func(dst, src *v1alpha1.DataPlaneMetricsExtensionList) { dst.ListMeta = src.ListMeta }, + func(list *v1alpha1.DataPlaneMetricsExtensionList) []*v1alpha1.DataPlaneMetricsExtension { + return gentype.ToPointerSlice(list.Items) + }, + func(list *v1alpha1.DataPlaneMetricsExtensionList, items []*v1alpha1.DataPlaneMetricsExtension) { + list.Items = gentype.FromPointerSlice(items) + }, + ), + fake, } - return obj.(*v1alpha1.DataPlaneMetricsExtension), err } diff --git a/pkg/clientset/typed/apis/v1alpha1/fake/fake_kongplugininstallation.go b/pkg/clientset/typed/apis/v1alpha1/fake/fake_kongplugininstallation.go index b110ce047..c5851ced2 100644 --- a/pkg/clientset/typed/apis/v1alpha1/fake/fake_kongplugininstallation.go +++ b/pkg/clientset/typed/apis/v1alpha1/fake/fake_kongplugininstallation.go @@ -19,129 +19,34 @@ limitations under the License. package fake import ( - "context" - v1alpha1 "github.com/kong/gateway-operator/api/v1alpha1" - 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" + apisv1alpha1 "github.com/kong/gateway-operator/pkg/clientset/typed/apis/v1alpha1" + gentype "k8s.io/client-go/gentype" ) -// FakeKongPluginInstallations implements KongPluginInstallationInterface -type FakeKongPluginInstallations struct { +// fakeKongPluginInstallations implements KongPluginInstallationInterface +type fakeKongPluginInstallations struct { + *gentype.FakeClientWithList[*v1alpha1.KongPluginInstallation, *v1alpha1.KongPluginInstallationList] Fake *FakeApisV1alpha1 - ns string -} - -var kongplugininstallationsResource = v1alpha1.SchemeGroupVersion.WithResource("kongplugininstallations") - -var kongplugininstallationsKind = v1alpha1.SchemeGroupVersion.WithKind("KongPluginInstallation") - -// Get takes name of the kongPluginInstallation, and returns the corresponding kongPluginInstallation object, and an error if there is any. -func (c *FakeKongPluginInstallations) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.KongPluginInstallation, err error) { - emptyResult := &v1alpha1.KongPluginInstallation{} - obj, err := c.Fake. - Invokes(testing.NewGetActionWithOptions(kongplugininstallationsResource, c.ns, name, options), emptyResult) - - if obj == nil { - return emptyResult, err - } - return obj.(*v1alpha1.KongPluginInstallation), err -} - -// List takes label and field selectors, and returns the list of KongPluginInstallations that match those selectors. -func (c *FakeKongPluginInstallations) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.KongPluginInstallationList, err error) { - emptyResult := &v1alpha1.KongPluginInstallationList{} - obj, err := c.Fake. - Invokes(testing.NewListActionWithOptions(kongplugininstallationsResource, kongplugininstallationsKind, c.ns, opts), emptyResult) - - if obj == nil { - return emptyResult, err - } - - label, _, _ := testing.ExtractFromListOptions(opts) - if label == nil { - label = labels.Everything() - } - list := &v1alpha1.KongPluginInstallationList{ListMeta: obj.(*v1alpha1.KongPluginInstallationList).ListMeta} - for _, item := range obj.(*v1alpha1.KongPluginInstallationList).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 kongPluginInstallations. -func (c *FakeKongPluginInstallations) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - return c.Fake. - InvokesWatch(testing.NewWatchActionWithOptions(kongplugininstallationsResource, c.ns, opts)) - -} - -// Create takes the representation of a kongPluginInstallation and creates it. Returns the server's representation of the kongPluginInstallation, and an error, if there is any. -func (c *FakeKongPluginInstallations) Create(ctx context.Context, kongPluginInstallation *v1alpha1.KongPluginInstallation, opts v1.CreateOptions) (result *v1alpha1.KongPluginInstallation, err error) { - emptyResult := &v1alpha1.KongPluginInstallation{} - obj, err := c.Fake. - Invokes(testing.NewCreateActionWithOptions(kongplugininstallationsResource, c.ns, kongPluginInstallation, opts), emptyResult) - - if obj == nil { - return emptyResult, err - } - return obj.(*v1alpha1.KongPluginInstallation), err -} - -// Update takes the representation of a kongPluginInstallation and updates it. Returns the server's representation of the kongPluginInstallation, and an error, if there is any. -func (c *FakeKongPluginInstallations) Update(ctx context.Context, kongPluginInstallation *v1alpha1.KongPluginInstallation, opts v1.UpdateOptions) (result *v1alpha1.KongPluginInstallation, err error) { - emptyResult := &v1alpha1.KongPluginInstallation{} - obj, err := c.Fake. - Invokes(testing.NewUpdateActionWithOptions(kongplugininstallationsResource, c.ns, kongPluginInstallation, opts), emptyResult) - - if obj == nil { - return emptyResult, err - } - return obj.(*v1alpha1.KongPluginInstallation), 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 *FakeKongPluginInstallations) UpdateStatus(ctx context.Context, kongPluginInstallation *v1alpha1.KongPluginInstallation, opts v1.UpdateOptions) (result *v1alpha1.KongPluginInstallation, err error) { - emptyResult := &v1alpha1.KongPluginInstallation{} - obj, err := c.Fake. - Invokes(testing.NewUpdateSubresourceActionWithOptions(kongplugininstallationsResource, "status", c.ns, kongPluginInstallation, opts), emptyResult) - - if obj == nil { - return emptyResult, err - } - return obj.(*v1alpha1.KongPluginInstallation), err -} - -// Delete takes name of the kongPluginInstallation and deletes it. Returns an error if one occurs. -func (c *FakeKongPluginInstallations) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - _, err := c.Fake. - Invokes(testing.NewDeleteActionWithOptions(kongplugininstallationsResource, c.ns, name, opts), &v1alpha1.KongPluginInstallation{}) - - return err } -// DeleteCollection deletes a collection of objects. -func (c *FakeKongPluginInstallations) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewDeleteCollectionActionWithOptions(kongplugininstallationsResource, c.ns, opts, listOpts) - - _, err := c.Fake.Invokes(action, &v1alpha1.KongPluginInstallationList{}) - return err -} - -// Patch applies the patch and returns the patched kongPluginInstallation. -func (c *FakeKongPluginInstallations) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.KongPluginInstallation, err error) { - emptyResult := &v1alpha1.KongPluginInstallation{} - obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceActionWithOptions(kongplugininstallationsResource, c.ns, name, pt, data, opts, subresources...), emptyResult) - - if obj == nil { - return emptyResult, err +func newFakeKongPluginInstallations(fake *FakeApisV1alpha1, namespace string) apisv1alpha1.KongPluginInstallationInterface { + return &fakeKongPluginInstallations{ + gentype.NewFakeClientWithList[*v1alpha1.KongPluginInstallation, *v1alpha1.KongPluginInstallationList]( + fake.Fake, + namespace, + v1alpha1.SchemeGroupVersion.WithResource("kongplugininstallations"), + v1alpha1.SchemeGroupVersion.WithKind("KongPluginInstallation"), + func() *v1alpha1.KongPluginInstallation { return &v1alpha1.KongPluginInstallation{} }, + func() *v1alpha1.KongPluginInstallationList { return &v1alpha1.KongPluginInstallationList{} }, + func(dst, src *v1alpha1.KongPluginInstallationList) { dst.ListMeta = src.ListMeta }, + func(list *v1alpha1.KongPluginInstallationList) []*v1alpha1.KongPluginInstallation { + return gentype.ToPointerSlice(list.Items) + }, + func(list *v1alpha1.KongPluginInstallationList, items []*v1alpha1.KongPluginInstallation) { + list.Items = gentype.FromPointerSlice(items) + }, + ), + fake, } - return obj.(*v1alpha1.KongPluginInstallation), err } diff --git a/pkg/clientset/typed/apis/v1alpha1/fake/fake_konnectextension.go b/pkg/clientset/typed/apis/v1alpha1/fake/fake_konnectextension.go index dba344ef1..fbcdbebe4 100644 --- a/pkg/clientset/typed/apis/v1alpha1/fake/fake_konnectextension.go +++ b/pkg/clientset/typed/apis/v1alpha1/fake/fake_konnectextension.go @@ -19,129 +19,34 @@ limitations under the License. package fake import ( - "context" - v1alpha1 "github.com/kong/gateway-operator/api/v1alpha1" - 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" + apisv1alpha1 "github.com/kong/gateway-operator/pkg/clientset/typed/apis/v1alpha1" + gentype "k8s.io/client-go/gentype" ) -// FakeKonnectExtensions implements KonnectExtensionInterface -type FakeKonnectExtensions struct { +// fakeKonnectExtensions implements KonnectExtensionInterface +type fakeKonnectExtensions struct { + *gentype.FakeClientWithList[*v1alpha1.KonnectExtension, *v1alpha1.KonnectExtensionList] Fake *FakeApisV1alpha1 - ns string -} - -var konnectextensionsResource = v1alpha1.SchemeGroupVersion.WithResource("konnectextensions") - -var konnectextensionsKind = v1alpha1.SchemeGroupVersion.WithKind("KonnectExtension") - -// Get takes name of the konnectExtension, and returns the corresponding konnectExtension object, and an error if there is any. -func (c *FakeKonnectExtensions) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.KonnectExtension, err error) { - emptyResult := &v1alpha1.KonnectExtension{} - obj, err := c.Fake. - Invokes(testing.NewGetActionWithOptions(konnectextensionsResource, c.ns, name, options), emptyResult) - - if obj == nil { - return emptyResult, err - } - return obj.(*v1alpha1.KonnectExtension), err -} - -// List takes label and field selectors, and returns the list of KonnectExtensions that match those selectors. -func (c *FakeKonnectExtensions) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.KonnectExtensionList, err error) { - emptyResult := &v1alpha1.KonnectExtensionList{} - obj, err := c.Fake. - Invokes(testing.NewListActionWithOptions(konnectextensionsResource, konnectextensionsKind, c.ns, opts), emptyResult) - - if obj == nil { - return emptyResult, err - } - - label, _, _ := testing.ExtractFromListOptions(opts) - if label == nil { - label = labels.Everything() - } - list := &v1alpha1.KonnectExtensionList{ListMeta: obj.(*v1alpha1.KonnectExtensionList).ListMeta} - for _, item := range obj.(*v1alpha1.KonnectExtensionList).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 konnectExtensions. -func (c *FakeKonnectExtensions) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - return c.Fake. - InvokesWatch(testing.NewWatchActionWithOptions(konnectextensionsResource, c.ns, opts)) - -} - -// Create takes the representation of a konnectExtension and creates it. Returns the server's representation of the konnectExtension, and an error, if there is any. -func (c *FakeKonnectExtensions) Create(ctx context.Context, konnectExtension *v1alpha1.KonnectExtension, opts v1.CreateOptions) (result *v1alpha1.KonnectExtension, err error) { - emptyResult := &v1alpha1.KonnectExtension{} - obj, err := c.Fake. - Invokes(testing.NewCreateActionWithOptions(konnectextensionsResource, c.ns, konnectExtension, opts), emptyResult) - - if obj == nil { - return emptyResult, err - } - return obj.(*v1alpha1.KonnectExtension), err -} - -// Update takes the representation of a konnectExtension and updates it. Returns the server's representation of the konnectExtension, and an error, if there is any. -func (c *FakeKonnectExtensions) Update(ctx context.Context, konnectExtension *v1alpha1.KonnectExtension, opts v1.UpdateOptions) (result *v1alpha1.KonnectExtension, err error) { - emptyResult := &v1alpha1.KonnectExtension{} - obj, err := c.Fake. - Invokes(testing.NewUpdateActionWithOptions(konnectextensionsResource, c.ns, konnectExtension, opts), emptyResult) - - if obj == nil { - return emptyResult, err - } - return obj.(*v1alpha1.KonnectExtension), 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 *FakeKonnectExtensions) UpdateStatus(ctx context.Context, konnectExtension *v1alpha1.KonnectExtension, opts v1.UpdateOptions) (result *v1alpha1.KonnectExtension, err error) { - emptyResult := &v1alpha1.KonnectExtension{} - obj, err := c.Fake. - Invokes(testing.NewUpdateSubresourceActionWithOptions(konnectextensionsResource, "status", c.ns, konnectExtension, opts), emptyResult) - - if obj == nil { - return emptyResult, err - } - return obj.(*v1alpha1.KonnectExtension), err -} - -// Delete takes name of the konnectExtension and deletes it. Returns an error if one occurs. -func (c *FakeKonnectExtensions) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - _, err := c.Fake. - Invokes(testing.NewDeleteActionWithOptions(konnectextensionsResource, c.ns, name, opts), &v1alpha1.KonnectExtension{}) - - return err } -// DeleteCollection deletes a collection of objects. -func (c *FakeKonnectExtensions) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewDeleteCollectionActionWithOptions(konnectextensionsResource, c.ns, opts, listOpts) - - _, err := c.Fake.Invokes(action, &v1alpha1.KonnectExtensionList{}) - return err -} - -// Patch applies the patch and returns the patched konnectExtension. -func (c *FakeKonnectExtensions) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.KonnectExtension, err error) { - emptyResult := &v1alpha1.KonnectExtension{} - obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceActionWithOptions(konnectextensionsResource, c.ns, name, pt, data, opts, subresources...), emptyResult) - - if obj == nil { - return emptyResult, err +func newFakeKonnectExtensions(fake *FakeApisV1alpha1, namespace string) apisv1alpha1.KonnectExtensionInterface { + return &fakeKonnectExtensions{ + gentype.NewFakeClientWithList[*v1alpha1.KonnectExtension, *v1alpha1.KonnectExtensionList]( + fake.Fake, + namespace, + v1alpha1.SchemeGroupVersion.WithResource("konnectextensions"), + v1alpha1.SchemeGroupVersion.WithKind("KonnectExtension"), + func() *v1alpha1.KonnectExtension { return &v1alpha1.KonnectExtension{} }, + func() *v1alpha1.KonnectExtensionList { return &v1alpha1.KonnectExtensionList{} }, + func(dst, src *v1alpha1.KonnectExtensionList) { dst.ListMeta = src.ListMeta }, + func(list *v1alpha1.KonnectExtensionList) []*v1alpha1.KonnectExtension { + return gentype.ToPointerSlice(list.Items) + }, + func(list *v1alpha1.KonnectExtensionList, items []*v1alpha1.KonnectExtension) { + list.Items = gentype.FromPointerSlice(items) + }, + ), + fake, } - return obj.(*v1alpha1.KonnectExtension), err } diff --git a/pkg/clientset/typed/apis/v1alpha1/kongplugininstallation.go b/pkg/clientset/typed/apis/v1alpha1/kongplugininstallation.go index 99d8dc141..78e8e61be 100644 --- a/pkg/clientset/typed/apis/v1alpha1/kongplugininstallation.go +++ b/pkg/clientset/typed/apis/v1alpha1/kongplugininstallation.go @@ -19,9 +19,9 @@ limitations under the License. package v1alpha1 import ( - "context" + context "context" - v1alpha1 "github.com/kong/gateway-operator/api/v1alpha1" + apisv1alpha1 "github.com/kong/gateway-operator/api/v1alpha1" scheme "github.com/kong/gateway-operator/pkg/clientset/scheme" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" @@ -37,33 +37,34 @@ type KongPluginInstallationsGetter interface { // KongPluginInstallationInterface has methods to work with KongPluginInstallation resources. type KongPluginInstallationInterface interface { - Create(ctx context.Context, kongPluginInstallation *v1alpha1.KongPluginInstallation, opts v1.CreateOptions) (*v1alpha1.KongPluginInstallation, error) - Update(ctx context.Context, kongPluginInstallation *v1alpha1.KongPluginInstallation, opts v1.UpdateOptions) (*v1alpha1.KongPluginInstallation, error) + Create(ctx context.Context, kongPluginInstallation *apisv1alpha1.KongPluginInstallation, opts v1.CreateOptions) (*apisv1alpha1.KongPluginInstallation, error) + Update(ctx context.Context, kongPluginInstallation *apisv1alpha1.KongPluginInstallation, opts v1.UpdateOptions) (*apisv1alpha1.KongPluginInstallation, error) // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). - UpdateStatus(ctx context.Context, kongPluginInstallation *v1alpha1.KongPluginInstallation, opts v1.UpdateOptions) (*v1alpha1.KongPluginInstallation, error) + UpdateStatus(ctx context.Context, kongPluginInstallation *apisv1alpha1.KongPluginInstallation, opts v1.UpdateOptions) (*apisv1alpha1.KongPluginInstallation, error) 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) (*v1alpha1.KongPluginInstallation, error) - List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.KongPluginInstallationList, error) + Get(ctx context.Context, name string, opts v1.GetOptions) (*apisv1alpha1.KongPluginInstallation, error) + List(ctx context.Context, opts v1.ListOptions) (*apisv1alpha1.KongPluginInstallationList, 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 *v1alpha1.KongPluginInstallation, err error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *apisv1alpha1.KongPluginInstallation, err error) KongPluginInstallationExpansion } // kongPluginInstallations implements KongPluginInstallationInterface type kongPluginInstallations struct { - *gentype.ClientWithList[*v1alpha1.KongPluginInstallation, *v1alpha1.KongPluginInstallationList] + *gentype.ClientWithList[*apisv1alpha1.KongPluginInstallation, *apisv1alpha1.KongPluginInstallationList] } // newKongPluginInstallations returns a KongPluginInstallations func newKongPluginInstallations(c *ApisV1alpha1Client, namespace string) *kongPluginInstallations { return &kongPluginInstallations{ - gentype.NewClientWithList[*v1alpha1.KongPluginInstallation, *v1alpha1.KongPluginInstallationList]( + gentype.NewClientWithList[*apisv1alpha1.KongPluginInstallation, *apisv1alpha1.KongPluginInstallationList]( "kongplugininstallations", c.RESTClient(), scheme.ParameterCodec, namespace, - func() *v1alpha1.KongPluginInstallation { return &v1alpha1.KongPluginInstallation{} }, - func() *v1alpha1.KongPluginInstallationList { return &v1alpha1.KongPluginInstallationList{} }), + func() *apisv1alpha1.KongPluginInstallation { return &apisv1alpha1.KongPluginInstallation{} }, + func() *apisv1alpha1.KongPluginInstallationList { return &apisv1alpha1.KongPluginInstallationList{} }, + ), } } diff --git a/pkg/clientset/typed/apis/v1alpha1/konnectextension.go b/pkg/clientset/typed/apis/v1alpha1/konnectextension.go index cda1a9c22..7a94b26a0 100644 --- a/pkg/clientset/typed/apis/v1alpha1/konnectextension.go +++ b/pkg/clientset/typed/apis/v1alpha1/konnectextension.go @@ -19,9 +19,9 @@ limitations under the License. package v1alpha1 import ( - "context" + context "context" - v1alpha1 "github.com/kong/gateway-operator/api/v1alpha1" + apisv1alpha1 "github.com/kong/gateway-operator/api/v1alpha1" scheme "github.com/kong/gateway-operator/pkg/clientset/scheme" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" @@ -37,33 +37,34 @@ type KonnectExtensionsGetter interface { // KonnectExtensionInterface has methods to work with KonnectExtension resources. type KonnectExtensionInterface interface { - Create(ctx context.Context, konnectExtension *v1alpha1.KonnectExtension, opts v1.CreateOptions) (*v1alpha1.KonnectExtension, error) - Update(ctx context.Context, konnectExtension *v1alpha1.KonnectExtension, opts v1.UpdateOptions) (*v1alpha1.KonnectExtension, error) + Create(ctx context.Context, konnectExtension *apisv1alpha1.KonnectExtension, opts v1.CreateOptions) (*apisv1alpha1.KonnectExtension, error) + Update(ctx context.Context, konnectExtension *apisv1alpha1.KonnectExtension, opts v1.UpdateOptions) (*apisv1alpha1.KonnectExtension, error) // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). - UpdateStatus(ctx context.Context, konnectExtension *v1alpha1.KonnectExtension, opts v1.UpdateOptions) (*v1alpha1.KonnectExtension, error) + UpdateStatus(ctx context.Context, konnectExtension *apisv1alpha1.KonnectExtension, opts v1.UpdateOptions) (*apisv1alpha1.KonnectExtension, error) 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) (*v1alpha1.KonnectExtension, error) - List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.KonnectExtensionList, error) + Get(ctx context.Context, name string, opts v1.GetOptions) (*apisv1alpha1.KonnectExtension, error) + List(ctx context.Context, opts v1.ListOptions) (*apisv1alpha1.KonnectExtensionList, 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 *v1alpha1.KonnectExtension, err error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *apisv1alpha1.KonnectExtension, err error) KonnectExtensionExpansion } // konnectExtensions implements KonnectExtensionInterface type konnectExtensions struct { - *gentype.ClientWithList[*v1alpha1.KonnectExtension, *v1alpha1.KonnectExtensionList] + *gentype.ClientWithList[*apisv1alpha1.KonnectExtension, *apisv1alpha1.KonnectExtensionList] } // newKonnectExtensions returns a KonnectExtensions func newKonnectExtensions(c *ApisV1alpha1Client, namespace string) *konnectExtensions { return &konnectExtensions{ - gentype.NewClientWithList[*v1alpha1.KonnectExtension, *v1alpha1.KonnectExtensionList]( + gentype.NewClientWithList[*apisv1alpha1.KonnectExtension, *apisv1alpha1.KonnectExtensionList]( "konnectextensions", c.RESTClient(), scheme.ParameterCodec, namespace, - func() *v1alpha1.KonnectExtension { return &v1alpha1.KonnectExtension{} }, - func() *v1alpha1.KonnectExtensionList { return &v1alpha1.KonnectExtensionList{} }), + func() *apisv1alpha1.KonnectExtension { return &apisv1alpha1.KonnectExtension{} }, + func() *apisv1alpha1.KonnectExtensionList { return &apisv1alpha1.KonnectExtensionList{} }, + ), } } diff --git a/pkg/clientset/typed/apis/v1beta1/apis_client.go b/pkg/clientset/typed/apis/v1beta1/apis_client.go index 0511773b1..2da8e268c 100644 --- a/pkg/clientset/typed/apis/v1beta1/apis_client.go +++ b/pkg/clientset/typed/apis/v1beta1/apis_client.go @@ -19,10 +19,10 @@ limitations under the License. package v1beta1 import ( - "net/http" + http "net/http" - v1beta1 "github.com/kong/gateway-operator/api/v1beta1" - "github.com/kong/gateway-operator/pkg/clientset/scheme" + apisv1beta1 "github.com/kong/gateway-operator/api/v1beta1" + scheme "github.com/kong/gateway-operator/pkg/clientset/scheme" rest "k8s.io/client-go/rest" ) @@ -95,10 +95,10 @@ func New(c rest.Interface) *ApisV1beta1Client { } func setConfigDefaults(config *rest.Config) error { - gv := v1beta1.SchemeGroupVersion + gv := apisv1beta1.SchemeGroupVersion config.GroupVersion = &gv config.APIPath = "/apis" - config.NegotiatedSerializer = scheme.Codecs.WithoutConversion() + config.NegotiatedSerializer = rest.CodecFactoryForGeneratedClient(scheme.Scheme, scheme.Codecs).WithoutConversion() if config.UserAgent == "" { config.UserAgent = rest.DefaultKubernetesUserAgent() diff --git a/pkg/clientset/typed/apis/v1beta1/controlplane.go b/pkg/clientset/typed/apis/v1beta1/controlplane.go index 3cbfbde68..e183f1f03 100644 --- a/pkg/clientset/typed/apis/v1beta1/controlplane.go +++ b/pkg/clientset/typed/apis/v1beta1/controlplane.go @@ -19,9 +19,9 @@ limitations under the License. package v1beta1 import ( - "context" + context "context" - v1beta1 "github.com/kong/gateway-operator/api/v1beta1" + apisv1beta1 "github.com/kong/gateway-operator/api/v1beta1" scheme "github.com/kong/gateway-operator/pkg/clientset/scheme" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" @@ -37,33 +37,34 @@ type ControlPlanesGetter interface { // ControlPlaneInterface has methods to work with ControlPlane resources. type ControlPlaneInterface interface { - Create(ctx context.Context, controlPlane *v1beta1.ControlPlane, opts v1.CreateOptions) (*v1beta1.ControlPlane, error) - Update(ctx context.Context, controlPlane *v1beta1.ControlPlane, opts v1.UpdateOptions) (*v1beta1.ControlPlane, error) + Create(ctx context.Context, controlPlane *apisv1beta1.ControlPlane, opts v1.CreateOptions) (*apisv1beta1.ControlPlane, error) + Update(ctx context.Context, controlPlane *apisv1beta1.ControlPlane, opts v1.UpdateOptions) (*apisv1beta1.ControlPlane, error) // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). - UpdateStatus(ctx context.Context, controlPlane *v1beta1.ControlPlane, opts v1.UpdateOptions) (*v1beta1.ControlPlane, error) + UpdateStatus(ctx context.Context, controlPlane *apisv1beta1.ControlPlane, opts v1.UpdateOptions) (*apisv1beta1.ControlPlane, error) 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.ControlPlane, error) - List(ctx context.Context, opts v1.ListOptions) (*v1beta1.ControlPlaneList, error) + Get(ctx context.Context, name string, opts v1.GetOptions) (*apisv1beta1.ControlPlane, error) + List(ctx context.Context, opts v1.ListOptions) (*apisv1beta1.ControlPlaneList, 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.ControlPlane, err error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *apisv1beta1.ControlPlane, err error) ControlPlaneExpansion } // controlPlanes implements ControlPlaneInterface type controlPlanes struct { - *gentype.ClientWithList[*v1beta1.ControlPlane, *v1beta1.ControlPlaneList] + *gentype.ClientWithList[*apisv1beta1.ControlPlane, *apisv1beta1.ControlPlaneList] } // newControlPlanes returns a ControlPlanes func newControlPlanes(c *ApisV1beta1Client, namespace string) *controlPlanes { return &controlPlanes{ - gentype.NewClientWithList[*v1beta1.ControlPlane, *v1beta1.ControlPlaneList]( + gentype.NewClientWithList[*apisv1beta1.ControlPlane, *apisv1beta1.ControlPlaneList]( "controlplanes", c.RESTClient(), scheme.ParameterCodec, namespace, - func() *v1beta1.ControlPlane { return &v1beta1.ControlPlane{} }, - func() *v1beta1.ControlPlaneList { return &v1beta1.ControlPlaneList{} }), + func() *apisv1beta1.ControlPlane { return &apisv1beta1.ControlPlane{} }, + func() *apisv1beta1.ControlPlaneList { return &apisv1beta1.ControlPlaneList{} }, + ), } } diff --git a/pkg/clientset/typed/apis/v1beta1/dataplane.go b/pkg/clientset/typed/apis/v1beta1/dataplane.go index f1311fe7b..d44ca8362 100644 --- a/pkg/clientset/typed/apis/v1beta1/dataplane.go +++ b/pkg/clientset/typed/apis/v1beta1/dataplane.go @@ -19,9 +19,9 @@ limitations under the License. package v1beta1 import ( - "context" + context "context" - v1beta1 "github.com/kong/gateway-operator/api/v1beta1" + apisv1beta1 "github.com/kong/gateway-operator/api/v1beta1" scheme "github.com/kong/gateway-operator/pkg/clientset/scheme" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" @@ -37,33 +37,34 @@ type DataPlanesGetter interface { // DataPlaneInterface has methods to work with DataPlane resources. type DataPlaneInterface interface { - Create(ctx context.Context, dataPlane *v1beta1.DataPlane, opts v1.CreateOptions) (*v1beta1.DataPlane, error) - Update(ctx context.Context, dataPlane *v1beta1.DataPlane, opts v1.UpdateOptions) (*v1beta1.DataPlane, error) + Create(ctx context.Context, dataPlane *apisv1beta1.DataPlane, opts v1.CreateOptions) (*apisv1beta1.DataPlane, error) + Update(ctx context.Context, dataPlane *apisv1beta1.DataPlane, opts v1.UpdateOptions) (*apisv1beta1.DataPlane, error) // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). - UpdateStatus(ctx context.Context, dataPlane *v1beta1.DataPlane, opts v1.UpdateOptions) (*v1beta1.DataPlane, error) + UpdateStatus(ctx context.Context, dataPlane *apisv1beta1.DataPlane, opts v1.UpdateOptions) (*apisv1beta1.DataPlane, error) 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.DataPlane, error) - List(ctx context.Context, opts v1.ListOptions) (*v1beta1.DataPlaneList, error) + Get(ctx context.Context, name string, opts v1.GetOptions) (*apisv1beta1.DataPlane, error) + List(ctx context.Context, opts v1.ListOptions) (*apisv1beta1.DataPlaneList, 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.DataPlane, err error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *apisv1beta1.DataPlane, err error) DataPlaneExpansion } // dataPlanes implements DataPlaneInterface type dataPlanes struct { - *gentype.ClientWithList[*v1beta1.DataPlane, *v1beta1.DataPlaneList] + *gentype.ClientWithList[*apisv1beta1.DataPlane, *apisv1beta1.DataPlaneList] } // newDataPlanes returns a DataPlanes func newDataPlanes(c *ApisV1beta1Client, namespace string) *dataPlanes { return &dataPlanes{ - gentype.NewClientWithList[*v1beta1.DataPlane, *v1beta1.DataPlaneList]( + gentype.NewClientWithList[*apisv1beta1.DataPlane, *apisv1beta1.DataPlaneList]( "dataplanes", c.RESTClient(), scheme.ParameterCodec, namespace, - func() *v1beta1.DataPlane { return &v1beta1.DataPlane{} }, - func() *v1beta1.DataPlaneList { return &v1beta1.DataPlaneList{} }), + func() *apisv1beta1.DataPlane { return &apisv1beta1.DataPlane{} }, + func() *apisv1beta1.DataPlaneList { return &apisv1beta1.DataPlaneList{} }, + ), } } diff --git a/pkg/clientset/typed/apis/v1beta1/fake/fake_apis_client.go b/pkg/clientset/typed/apis/v1beta1/fake/fake_apis_client.go index 5ab5f73e3..6b40feb36 100644 --- a/pkg/clientset/typed/apis/v1beta1/fake/fake_apis_client.go +++ b/pkg/clientset/typed/apis/v1beta1/fake/fake_apis_client.go @@ -29,15 +29,15 @@ type FakeApisV1beta1 struct { } func (c *FakeApisV1beta1) ControlPlanes(namespace string) v1beta1.ControlPlaneInterface { - return &FakeControlPlanes{c, namespace} + return newFakeControlPlanes(c, namespace) } func (c *FakeApisV1beta1) DataPlanes(namespace string) v1beta1.DataPlaneInterface { - return &FakeDataPlanes{c, namespace} + return newFakeDataPlanes(c, namespace) } func (c *FakeApisV1beta1) GatewayConfigurations(namespace string) v1beta1.GatewayConfigurationInterface { - return &FakeGatewayConfigurations{c, namespace} + return newFakeGatewayConfigurations(c, namespace) } // RESTClient returns a RESTClient that is used to communicate diff --git a/pkg/clientset/typed/apis/v1beta1/fake/fake_controlplane.go b/pkg/clientset/typed/apis/v1beta1/fake/fake_controlplane.go index 12ffecac4..d093bd1d6 100644 --- a/pkg/clientset/typed/apis/v1beta1/fake/fake_controlplane.go +++ b/pkg/clientset/typed/apis/v1beta1/fake/fake_controlplane.go @@ -19,129 +19,34 @@ limitations under the License. package fake import ( - "context" - v1beta1 "github.com/kong/gateway-operator/api/v1beta1" - 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" + apisv1beta1 "github.com/kong/gateway-operator/pkg/clientset/typed/apis/v1beta1" + gentype "k8s.io/client-go/gentype" ) -// FakeControlPlanes implements ControlPlaneInterface -type FakeControlPlanes struct { +// fakeControlPlanes implements ControlPlaneInterface +type fakeControlPlanes struct { + *gentype.FakeClientWithList[*v1beta1.ControlPlane, *v1beta1.ControlPlaneList] Fake *FakeApisV1beta1 - ns string -} - -var controlplanesResource = v1beta1.SchemeGroupVersion.WithResource("controlplanes") - -var controlplanesKind = v1beta1.SchemeGroupVersion.WithKind("ControlPlane") - -// Get takes name of the controlPlane, and returns the corresponding controlPlane object, and an error if there is any. -func (c *FakeControlPlanes) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta1.ControlPlane, err error) { - emptyResult := &v1beta1.ControlPlane{} - obj, err := c.Fake. - Invokes(testing.NewGetActionWithOptions(controlplanesResource, c.ns, name, options), emptyResult) - - if obj == nil { - return emptyResult, err - } - return obj.(*v1beta1.ControlPlane), err -} - -// List takes label and field selectors, and returns the list of ControlPlanes that match those selectors. -func (c *FakeControlPlanes) List(ctx context.Context, opts v1.ListOptions) (result *v1beta1.ControlPlaneList, err error) { - emptyResult := &v1beta1.ControlPlaneList{} - obj, err := c.Fake. - Invokes(testing.NewListActionWithOptions(controlplanesResource, controlplanesKind, c.ns, opts), emptyResult) - - if obj == nil { - return emptyResult, err - } - - label, _, _ := testing.ExtractFromListOptions(opts) - if label == nil { - label = labels.Everything() - } - list := &v1beta1.ControlPlaneList{ListMeta: obj.(*v1beta1.ControlPlaneList).ListMeta} - for _, item := range obj.(*v1beta1.ControlPlaneList).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 controlPlanes. -func (c *FakeControlPlanes) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - return c.Fake. - InvokesWatch(testing.NewWatchActionWithOptions(controlplanesResource, c.ns, opts)) - -} - -// Create takes the representation of a controlPlane and creates it. Returns the server's representation of the controlPlane, and an error, if there is any. -func (c *FakeControlPlanes) Create(ctx context.Context, controlPlane *v1beta1.ControlPlane, opts v1.CreateOptions) (result *v1beta1.ControlPlane, err error) { - emptyResult := &v1beta1.ControlPlane{} - obj, err := c.Fake. - Invokes(testing.NewCreateActionWithOptions(controlplanesResource, c.ns, controlPlane, opts), emptyResult) - - if obj == nil { - return emptyResult, err - } - return obj.(*v1beta1.ControlPlane), err -} - -// Update takes the representation of a controlPlane and updates it. Returns the server's representation of the controlPlane, and an error, if there is any. -func (c *FakeControlPlanes) Update(ctx context.Context, controlPlane *v1beta1.ControlPlane, opts v1.UpdateOptions) (result *v1beta1.ControlPlane, err error) { - emptyResult := &v1beta1.ControlPlane{} - obj, err := c.Fake. - Invokes(testing.NewUpdateActionWithOptions(controlplanesResource, c.ns, controlPlane, opts), emptyResult) - - if obj == nil { - return emptyResult, err - } - return obj.(*v1beta1.ControlPlane), 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 *FakeControlPlanes) UpdateStatus(ctx context.Context, controlPlane *v1beta1.ControlPlane, opts v1.UpdateOptions) (result *v1beta1.ControlPlane, err error) { - emptyResult := &v1beta1.ControlPlane{} - obj, err := c.Fake. - Invokes(testing.NewUpdateSubresourceActionWithOptions(controlplanesResource, "status", c.ns, controlPlane, opts), emptyResult) - - if obj == nil { - return emptyResult, err - } - return obj.(*v1beta1.ControlPlane), err -} - -// Delete takes name of the controlPlane and deletes it. Returns an error if one occurs. -func (c *FakeControlPlanes) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - _, err := c.Fake. - Invokes(testing.NewDeleteActionWithOptions(controlplanesResource, c.ns, name, opts), &v1beta1.ControlPlane{}) - - return err } -// DeleteCollection deletes a collection of objects. -func (c *FakeControlPlanes) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewDeleteCollectionActionWithOptions(controlplanesResource, c.ns, opts, listOpts) - - _, err := c.Fake.Invokes(action, &v1beta1.ControlPlaneList{}) - return err -} - -// Patch applies the patch and returns the patched controlPlane. -func (c *FakeControlPlanes) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.ControlPlane, err error) { - emptyResult := &v1beta1.ControlPlane{} - obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceActionWithOptions(controlplanesResource, c.ns, name, pt, data, opts, subresources...), emptyResult) - - if obj == nil { - return emptyResult, err +func newFakeControlPlanes(fake *FakeApisV1beta1, namespace string) apisv1beta1.ControlPlaneInterface { + return &fakeControlPlanes{ + gentype.NewFakeClientWithList[*v1beta1.ControlPlane, *v1beta1.ControlPlaneList]( + fake.Fake, + namespace, + v1beta1.SchemeGroupVersion.WithResource("controlplanes"), + v1beta1.SchemeGroupVersion.WithKind("ControlPlane"), + func() *v1beta1.ControlPlane { return &v1beta1.ControlPlane{} }, + func() *v1beta1.ControlPlaneList { return &v1beta1.ControlPlaneList{} }, + func(dst, src *v1beta1.ControlPlaneList) { dst.ListMeta = src.ListMeta }, + func(list *v1beta1.ControlPlaneList) []*v1beta1.ControlPlane { + return gentype.ToPointerSlice(list.Items) + }, + func(list *v1beta1.ControlPlaneList, items []*v1beta1.ControlPlane) { + list.Items = gentype.FromPointerSlice(items) + }, + ), + fake, } - return obj.(*v1beta1.ControlPlane), err } diff --git a/pkg/clientset/typed/apis/v1beta1/fake/fake_dataplane.go b/pkg/clientset/typed/apis/v1beta1/fake/fake_dataplane.go index 599e195c1..ee996a6a5 100644 --- a/pkg/clientset/typed/apis/v1beta1/fake/fake_dataplane.go +++ b/pkg/clientset/typed/apis/v1beta1/fake/fake_dataplane.go @@ -19,129 +19,32 @@ limitations under the License. package fake import ( - "context" - v1beta1 "github.com/kong/gateway-operator/api/v1beta1" - 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" + apisv1beta1 "github.com/kong/gateway-operator/pkg/clientset/typed/apis/v1beta1" + gentype "k8s.io/client-go/gentype" ) -// FakeDataPlanes implements DataPlaneInterface -type FakeDataPlanes struct { +// fakeDataPlanes implements DataPlaneInterface +type fakeDataPlanes struct { + *gentype.FakeClientWithList[*v1beta1.DataPlane, *v1beta1.DataPlaneList] Fake *FakeApisV1beta1 - ns string -} - -var dataplanesResource = v1beta1.SchemeGroupVersion.WithResource("dataplanes") - -var dataplanesKind = v1beta1.SchemeGroupVersion.WithKind("DataPlane") - -// Get takes name of the dataPlane, and returns the corresponding dataPlane object, and an error if there is any. -func (c *FakeDataPlanes) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta1.DataPlane, err error) { - emptyResult := &v1beta1.DataPlane{} - obj, err := c.Fake. - Invokes(testing.NewGetActionWithOptions(dataplanesResource, c.ns, name, options), emptyResult) - - if obj == nil { - return emptyResult, err - } - return obj.(*v1beta1.DataPlane), err -} - -// List takes label and field selectors, and returns the list of DataPlanes that match those selectors. -func (c *FakeDataPlanes) List(ctx context.Context, opts v1.ListOptions) (result *v1beta1.DataPlaneList, err error) { - emptyResult := &v1beta1.DataPlaneList{} - obj, err := c.Fake. - Invokes(testing.NewListActionWithOptions(dataplanesResource, dataplanesKind, c.ns, opts), emptyResult) - - if obj == nil { - return emptyResult, err - } - - label, _, _ := testing.ExtractFromListOptions(opts) - if label == nil { - label = labels.Everything() - } - list := &v1beta1.DataPlaneList{ListMeta: obj.(*v1beta1.DataPlaneList).ListMeta} - for _, item := range obj.(*v1beta1.DataPlaneList).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 dataPlanes. -func (c *FakeDataPlanes) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - return c.Fake. - InvokesWatch(testing.NewWatchActionWithOptions(dataplanesResource, c.ns, opts)) - -} - -// Create takes the representation of a dataPlane and creates it. Returns the server's representation of the dataPlane, and an error, if there is any. -func (c *FakeDataPlanes) Create(ctx context.Context, dataPlane *v1beta1.DataPlane, opts v1.CreateOptions) (result *v1beta1.DataPlane, err error) { - emptyResult := &v1beta1.DataPlane{} - obj, err := c.Fake. - Invokes(testing.NewCreateActionWithOptions(dataplanesResource, c.ns, dataPlane, opts), emptyResult) - - if obj == nil { - return emptyResult, err - } - return obj.(*v1beta1.DataPlane), err -} - -// Update takes the representation of a dataPlane and updates it. Returns the server's representation of the dataPlane, and an error, if there is any. -func (c *FakeDataPlanes) Update(ctx context.Context, dataPlane *v1beta1.DataPlane, opts v1.UpdateOptions) (result *v1beta1.DataPlane, err error) { - emptyResult := &v1beta1.DataPlane{} - obj, err := c.Fake. - Invokes(testing.NewUpdateActionWithOptions(dataplanesResource, c.ns, dataPlane, opts), emptyResult) - - if obj == nil { - return emptyResult, err - } - return obj.(*v1beta1.DataPlane), 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 *FakeDataPlanes) UpdateStatus(ctx context.Context, dataPlane *v1beta1.DataPlane, opts v1.UpdateOptions) (result *v1beta1.DataPlane, err error) { - emptyResult := &v1beta1.DataPlane{} - obj, err := c.Fake. - Invokes(testing.NewUpdateSubresourceActionWithOptions(dataplanesResource, "status", c.ns, dataPlane, opts), emptyResult) - - if obj == nil { - return emptyResult, err - } - return obj.(*v1beta1.DataPlane), err -} - -// Delete takes name of the dataPlane and deletes it. Returns an error if one occurs. -func (c *FakeDataPlanes) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - _, err := c.Fake. - Invokes(testing.NewDeleteActionWithOptions(dataplanesResource, c.ns, name, opts), &v1beta1.DataPlane{}) - - return err } -// DeleteCollection deletes a collection of objects. -func (c *FakeDataPlanes) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewDeleteCollectionActionWithOptions(dataplanesResource, c.ns, opts, listOpts) - - _, err := c.Fake.Invokes(action, &v1beta1.DataPlaneList{}) - return err -} - -// Patch applies the patch and returns the patched dataPlane. -func (c *FakeDataPlanes) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.DataPlane, err error) { - emptyResult := &v1beta1.DataPlane{} - obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceActionWithOptions(dataplanesResource, c.ns, name, pt, data, opts, subresources...), emptyResult) - - if obj == nil { - return emptyResult, err +func newFakeDataPlanes(fake *FakeApisV1beta1, namespace string) apisv1beta1.DataPlaneInterface { + return &fakeDataPlanes{ + gentype.NewFakeClientWithList[*v1beta1.DataPlane, *v1beta1.DataPlaneList]( + fake.Fake, + namespace, + v1beta1.SchemeGroupVersion.WithResource("dataplanes"), + v1beta1.SchemeGroupVersion.WithKind("DataPlane"), + func() *v1beta1.DataPlane { return &v1beta1.DataPlane{} }, + func() *v1beta1.DataPlaneList { return &v1beta1.DataPlaneList{} }, + func(dst, src *v1beta1.DataPlaneList) { dst.ListMeta = src.ListMeta }, + func(list *v1beta1.DataPlaneList) []*v1beta1.DataPlane { return gentype.ToPointerSlice(list.Items) }, + func(list *v1beta1.DataPlaneList, items []*v1beta1.DataPlane) { + list.Items = gentype.FromPointerSlice(items) + }, + ), + fake, } - return obj.(*v1beta1.DataPlane), err } diff --git a/pkg/clientset/typed/apis/v1beta1/fake/fake_gatewayconfiguration.go b/pkg/clientset/typed/apis/v1beta1/fake/fake_gatewayconfiguration.go index 1bdcf14c3..61037b7b4 100644 --- a/pkg/clientset/typed/apis/v1beta1/fake/fake_gatewayconfiguration.go +++ b/pkg/clientset/typed/apis/v1beta1/fake/fake_gatewayconfiguration.go @@ -19,129 +19,34 @@ limitations under the License. package fake import ( - "context" - v1beta1 "github.com/kong/gateway-operator/api/v1beta1" - 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" + apisv1beta1 "github.com/kong/gateway-operator/pkg/clientset/typed/apis/v1beta1" + gentype "k8s.io/client-go/gentype" ) -// FakeGatewayConfigurations implements GatewayConfigurationInterface -type FakeGatewayConfigurations struct { +// fakeGatewayConfigurations implements GatewayConfigurationInterface +type fakeGatewayConfigurations struct { + *gentype.FakeClientWithList[*v1beta1.GatewayConfiguration, *v1beta1.GatewayConfigurationList] Fake *FakeApisV1beta1 - ns string -} - -var gatewayconfigurationsResource = v1beta1.SchemeGroupVersion.WithResource("gatewayconfigurations") - -var gatewayconfigurationsKind = v1beta1.SchemeGroupVersion.WithKind("GatewayConfiguration") - -// Get takes name of the gatewayConfiguration, and returns the corresponding gatewayConfiguration object, and an error if there is any. -func (c *FakeGatewayConfigurations) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta1.GatewayConfiguration, err error) { - emptyResult := &v1beta1.GatewayConfiguration{} - obj, err := c.Fake. - Invokes(testing.NewGetActionWithOptions(gatewayconfigurationsResource, c.ns, name, options), emptyResult) - - if obj == nil { - return emptyResult, err - } - return obj.(*v1beta1.GatewayConfiguration), err -} - -// List takes label and field selectors, and returns the list of GatewayConfigurations that match those selectors. -func (c *FakeGatewayConfigurations) List(ctx context.Context, opts v1.ListOptions) (result *v1beta1.GatewayConfigurationList, err error) { - emptyResult := &v1beta1.GatewayConfigurationList{} - obj, err := c.Fake. - Invokes(testing.NewListActionWithOptions(gatewayconfigurationsResource, gatewayconfigurationsKind, c.ns, opts), emptyResult) - - if obj == nil { - return emptyResult, err - } - - label, _, _ := testing.ExtractFromListOptions(opts) - if label == nil { - label = labels.Everything() - } - list := &v1beta1.GatewayConfigurationList{ListMeta: obj.(*v1beta1.GatewayConfigurationList).ListMeta} - for _, item := range obj.(*v1beta1.GatewayConfigurationList).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 gatewayConfigurations. -func (c *FakeGatewayConfigurations) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - return c.Fake. - InvokesWatch(testing.NewWatchActionWithOptions(gatewayconfigurationsResource, c.ns, opts)) - -} - -// Create takes the representation of a gatewayConfiguration and creates it. Returns the server's representation of the gatewayConfiguration, and an error, if there is any. -func (c *FakeGatewayConfigurations) Create(ctx context.Context, gatewayConfiguration *v1beta1.GatewayConfiguration, opts v1.CreateOptions) (result *v1beta1.GatewayConfiguration, err error) { - emptyResult := &v1beta1.GatewayConfiguration{} - obj, err := c.Fake. - Invokes(testing.NewCreateActionWithOptions(gatewayconfigurationsResource, c.ns, gatewayConfiguration, opts), emptyResult) - - if obj == nil { - return emptyResult, err - } - return obj.(*v1beta1.GatewayConfiguration), err -} - -// Update takes the representation of a gatewayConfiguration and updates it. Returns the server's representation of the gatewayConfiguration, and an error, if there is any. -func (c *FakeGatewayConfigurations) Update(ctx context.Context, gatewayConfiguration *v1beta1.GatewayConfiguration, opts v1.UpdateOptions) (result *v1beta1.GatewayConfiguration, err error) { - emptyResult := &v1beta1.GatewayConfiguration{} - obj, err := c.Fake. - Invokes(testing.NewUpdateActionWithOptions(gatewayconfigurationsResource, c.ns, gatewayConfiguration, opts), emptyResult) - - if obj == nil { - return emptyResult, err - } - return obj.(*v1beta1.GatewayConfiguration), 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 *FakeGatewayConfigurations) UpdateStatus(ctx context.Context, gatewayConfiguration *v1beta1.GatewayConfiguration, opts v1.UpdateOptions) (result *v1beta1.GatewayConfiguration, err error) { - emptyResult := &v1beta1.GatewayConfiguration{} - obj, err := c.Fake. - Invokes(testing.NewUpdateSubresourceActionWithOptions(gatewayconfigurationsResource, "status", c.ns, gatewayConfiguration, opts), emptyResult) - - if obj == nil { - return emptyResult, err - } - return obj.(*v1beta1.GatewayConfiguration), err -} - -// Delete takes name of the gatewayConfiguration and deletes it. Returns an error if one occurs. -func (c *FakeGatewayConfigurations) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - _, err := c.Fake. - Invokes(testing.NewDeleteActionWithOptions(gatewayconfigurationsResource, c.ns, name, opts), &v1beta1.GatewayConfiguration{}) - - return err } -// DeleteCollection deletes a collection of objects. -func (c *FakeGatewayConfigurations) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewDeleteCollectionActionWithOptions(gatewayconfigurationsResource, c.ns, opts, listOpts) - - _, err := c.Fake.Invokes(action, &v1beta1.GatewayConfigurationList{}) - return err -} - -// Patch applies the patch and returns the patched gatewayConfiguration. -func (c *FakeGatewayConfigurations) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.GatewayConfiguration, err error) { - emptyResult := &v1beta1.GatewayConfiguration{} - obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceActionWithOptions(gatewayconfigurationsResource, c.ns, name, pt, data, opts, subresources...), emptyResult) - - if obj == nil { - return emptyResult, err +func newFakeGatewayConfigurations(fake *FakeApisV1beta1, namespace string) apisv1beta1.GatewayConfigurationInterface { + return &fakeGatewayConfigurations{ + gentype.NewFakeClientWithList[*v1beta1.GatewayConfiguration, *v1beta1.GatewayConfigurationList]( + fake.Fake, + namespace, + v1beta1.SchemeGroupVersion.WithResource("gatewayconfigurations"), + v1beta1.SchemeGroupVersion.WithKind("GatewayConfiguration"), + func() *v1beta1.GatewayConfiguration { return &v1beta1.GatewayConfiguration{} }, + func() *v1beta1.GatewayConfigurationList { return &v1beta1.GatewayConfigurationList{} }, + func(dst, src *v1beta1.GatewayConfigurationList) { dst.ListMeta = src.ListMeta }, + func(list *v1beta1.GatewayConfigurationList) []*v1beta1.GatewayConfiguration { + return gentype.ToPointerSlice(list.Items) + }, + func(list *v1beta1.GatewayConfigurationList, items []*v1beta1.GatewayConfiguration) { + list.Items = gentype.FromPointerSlice(items) + }, + ), + fake, } - return obj.(*v1beta1.GatewayConfiguration), err } diff --git a/pkg/clientset/typed/apis/v1beta1/gatewayconfiguration.go b/pkg/clientset/typed/apis/v1beta1/gatewayconfiguration.go index d17e6b1dc..dcedabe87 100644 --- a/pkg/clientset/typed/apis/v1beta1/gatewayconfiguration.go +++ b/pkg/clientset/typed/apis/v1beta1/gatewayconfiguration.go @@ -19,9 +19,9 @@ limitations under the License. package v1beta1 import ( - "context" + context "context" - v1beta1 "github.com/kong/gateway-operator/api/v1beta1" + apisv1beta1 "github.com/kong/gateway-operator/api/v1beta1" scheme "github.com/kong/gateway-operator/pkg/clientset/scheme" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" @@ -37,33 +37,34 @@ type GatewayConfigurationsGetter interface { // GatewayConfigurationInterface has methods to work with GatewayConfiguration resources. type GatewayConfigurationInterface interface { - Create(ctx context.Context, gatewayConfiguration *v1beta1.GatewayConfiguration, opts v1.CreateOptions) (*v1beta1.GatewayConfiguration, error) - Update(ctx context.Context, gatewayConfiguration *v1beta1.GatewayConfiguration, opts v1.UpdateOptions) (*v1beta1.GatewayConfiguration, error) + Create(ctx context.Context, gatewayConfiguration *apisv1beta1.GatewayConfiguration, opts v1.CreateOptions) (*apisv1beta1.GatewayConfiguration, error) + Update(ctx context.Context, gatewayConfiguration *apisv1beta1.GatewayConfiguration, opts v1.UpdateOptions) (*apisv1beta1.GatewayConfiguration, error) // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). - UpdateStatus(ctx context.Context, gatewayConfiguration *v1beta1.GatewayConfiguration, opts v1.UpdateOptions) (*v1beta1.GatewayConfiguration, error) + UpdateStatus(ctx context.Context, gatewayConfiguration *apisv1beta1.GatewayConfiguration, opts v1.UpdateOptions) (*apisv1beta1.GatewayConfiguration, error) 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.GatewayConfiguration, error) - List(ctx context.Context, opts v1.ListOptions) (*v1beta1.GatewayConfigurationList, error) + Get(ctx context.Context, name string, opts v1.GetOptions) (*apisv1beta1.GatewayConfiguration, error) + List(ctx context.Context, opts v1.ListOptions) (*apisv1beta1.GatewayConfigurationList, 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.GatewayConfiguration, err error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *apisv1beta1.GatewayConfiguration, err error) GatewayConfigurationExpansion } // gatewayConfigurations implements GatewayConfigurationInterface type gatewayConfigurations struct { - *gentype.ClientWithList[*v1beta1.GatewayConfiguration, *v1beta1.GatewayConfigurationList] + *gentype.ClientWithList[*apisv1beta1.GatewayConfiguration, *apisv1beta1.GatewayConfigurationList] } // newGatewayConfigurations returns a GatewayConfigurations func newGatewayConfigurations(c *ApisV1beta1Client, namespace string) *gatewayConfigurations { return &gatewayConfigurations{ - gentype.NewClientWithList[*v1beta1.GatewayConfiguration, *v1beta1.GatewayConfigurationList]( + gentype.NewClientWithList[*apisv1beta1.GatewayConfiguration, *apisv1beta1.GatewayConfigurationList]( "gatewayconfigurations", c.RESTClient(), scheme.ParameterCodec, namespace, - func() *v1beta1.GatewayConfiguration { return &v1beta1.GatewayConfiguration{} }, - func() *v1beta1.GatewayConfigurationList { return &v1beta1.GatewayConfigurationList{} }), + func() *apisv1beta1.GatewayConfiguration { return &apisv1beta1.GatewayConfiguration{} }, + func() *apisv1beta1.GatewayConfigurationList { return &apisv1beta1.GatewayConfigurationList{} }, + ), } }