From 07acdc00a9096fe55ab3d38abd46a8a8cbf3ae26 Mon Sep 17 00:00:00 2001 From: Scott Weiss Date: Mon, 23 Sep 2024 16:53:50 -0400 Subject: [PATCH] generate k8s gw apis --- codegen/k8s_gw_groups.go | 37 + .../gateway.networking.k8s.io/v1/clients.go | 512 ++++++ .../v1/controller/event_handlers.go | 339 ++++ .../v1/controller/mocks/event_handlers.go | 378 ++++ .../mocks/multicluster_reconcilers.go | 361 ++++ .../v1/controller/mocks/reconcilers.go | 565 ++++++ .../v1/controller/multicluster_reconcilers.go | 232 +++ .../v1/controller/reconcilers.go | 369 ++++ .../v1/mocks/clients.go | 1630 +++++++++++++++++ .../v1/providers/client_providers.go | 102 ++ .../v1/sets/mocks/sets.go | 784 ++++++++ .../gateway.networking.k8s.io/v1/sets/sets.go | 683 +++++++ .../v1/type_helpers.go | 17 + 13 files changed, 6009 insertions(+) create mode 100644 codegen/k8s_gw_groups.go create mode 100644 pkg/api/k8s-gw/apis/gateway.networking.k8s.io/v1/clients.go create mode 100644 pkg/api/k8s-gw/apis/gateway.networking.k8s.io/v1/controller/event_handlers.go create mode 100644 pkg/api/k8s-gw/apis/gateway.networking.k8s.io/v1/controller/mocks/event_handlers.go create mode 100644 pkg/api/k8s-gw/apis/gateway.networking.k8s.io/v1/controller/mocks/multicluster_reconcilers.go create mode 100644 pkg/api/k8s-gw/apis/gateway.networking.k8s.io/v1/controller/mocks/reconcilers.go create mode 100644 pkg/api/k8s-gw/apis/gateway.networking.k8s.io/v1/controller/multicluster_reconcilers.go create mode 100644 pkg/api/k8s-gw/apis/gateway.networking.k8s.io/v1/controller/reconcilers.go create mode 100644 pkg/api/k8s-gw/apis/gateway.networking.k8s.io/v1/mocks/clients.go create mode 100644 pkg/api/k8s-gw/apis/gateway.networking.k8s.io/v1/providers/client_providers.go create mode 100644 pkg/api/k8s-gw/apis/gateway.networking.k8s.io/v1/sets/mocks/sets.go create mode 100644 pkg/api/k8s-gw/apis/gateway.networking.k8s.io/v1/sets/sets.go create mode 100644 pkg/api/k8s-gw/apis/gateway.networking.k8s.io/v1/type_helpers.go diff --git a/codegen/k8s_gw_groups.go b/codegen/k8s_gw_groups.go new file mode 100644 index 0000000..c49df50 --- /dev/null +++ b/codegen/k8s_gw_groups.go @@ -0,0 +1,37 @@ +package codegen + +import ( + "github.com/solo-io/skv2/codegen/model" + gwapiv1 "sigs.k8s.io/gateway-api/apis/v1" +) + +const ( + k8sGwApiRoot = apiRoot + "/k8s-gw" + k8sGwModule = "sigs.k8s.io/gateway-api" +) + +func init() { + Groups = append(Groups, k8sGwGroups()...) +} + +func k8sGwGroups() []model.Group { + return []model.Group{ + { + GroupVersion: gwapiv1.SchemeGroupVersion, + Module: k8sGwModule, + Resources: []model.Resource{ + { + Kind: "GatewayClass", + }, + { + Kind: "Gateway", + }, + { + Kind: "HTTPRoute", + }, + }, + CustomTypesImportPath: k8sGwModule + "/apis/v1", + ApiRoot: k8sGwApiRoot + "/apis", + }, + } +} diff --git a/pkg/api/k8s-gw/apis/gateway.networking.k8s.io/v1/clients.go b/pkg/api/k8s-gw/apis/gateway.networking.k8s.io/v1/clients.go new file mode 100644 index 0000000..92563c4 --- /dev/null +++ b/pkg/api/k8s-gw/apis/gateway.networking.k8s.io/v1/clients.go @@ -0,0 +1,512 @@ +// Code generated by skv2. DO NOT EDIT. + +//go:generate mockgen -source ./clients.go -destination mocks/clients.go + +package v1 + +import ( + "context" + + "github.com/solo-io/skv2/pkg/controllerutils" + "github.com/solo-io/skv2/pkg/multicluster" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/client-go/kubernetes/scheme" + "k8s.io/client-go/rest" + "sigs.k8s.io/controller-runtime/pkg/client" + gateway_networking_k8s_io_v1 "sigs.k8s.io/gateway-api/apis/v1" +) + +// MulticlusterClientset for the gateway.networking.k8s.io/v1 APIs +type MulticlusterClientset interface { + // Cluster returns a Clientset for the given cluster + Cluster(cluster string) (Clientset, error) +} + +type multiclusterClientset struct { + client multicluster.Client +} + +func NewMulticlusterClientset(client multicluster.Client) MulticlusterClientset { + return &multiclusterClientset{client: client} +} + +func (m *multiclusterClientset) Cluster(cluster string) (Clientset, error) { + client, err := m.client.Cluster(cluster) + if err != nil { + return nil, err + } + return NewClientset(client), nil +} + +// clienset for the gateway.networking.k8s.io/v1 APIs +type Clientset interface { + // clienset for the gateway.networking.k8s.io/v1/v1 APIs + GatewayClasses() GatewayClassClient + // clienset for the gateway.networking.k8s.io/v1/v1 APIs + Gateways() GatewayClient + // clienset for the gateway.networking.k8s.io/v1/v1 APIs + HTTPRoutes() HTTPRouteClient +} + +type clientSet struct { + client client.Client +} + +func NewClientsetFromConfig(cfg *rest.Config) (Clientset, error) { + scheme := scheme.Scheme + if err := gateway_networking_k8s_io_v1.SchemeBuilder.AddToScheme(scheme); err != nil { + return nil, err + } + client, err := client.New(cfg, client.Options{ + Scheme: scheme, + }) + if err != nil { + return nil, err + } + return NewClientset(client), nil +} + +func NewClientset(client client.Client) Clientset { + return &clientSet{client: client} +} + +// clienset for the gateway.networking.k8s.io/v1/v1 APIs +func (c *clientSet) GatewayClasses() GatewayClassClient { + return NewGatewayClassClient(c.client) +} + +// clienset for the gateway.networking.k8s.io/v1/v1 APIs +func (c *clientSet) Gateways() GatewayClient { + return NewGatewayClient(c.client) +} + +// clienset for the gateway.networking.k8s.io/v1/v1 APIs +func (c *clientSet) HTTPRoutes() HTTPRouteClient { + return NewHTTPRouteClient(c.client) +} + +// Reader knows how to read and list GatewayClasss. +type GatewayClassReader interface { + // Get retrieves a GatewayClass for the given object key + GetGatewayClass(ctx context.Context, key client.ObjectKey) (*gateway_networking_k8s_io_v1.GatewayClass, error) + + // List retrieves list of GatewayClasss for a given namespace and list options. + ListGatewayClass(ctx context.Context, opts ...client.ListOption) (*gateway_networking_k8s_io_v1.GatewayClassList, error) +} + +// GatewayClassTransitionFunction instructs the GatewayClassWriter how to transition between an existing +// GatewayClass object and a desired on an Upsert +type GatewayClassTransitionFunction func(existing, desired *gateway_networking_k8s_io_v1.GatewayClass) error + +// Writer knows how to create, delete, and update GatewayClasss. +type GatewayClassWriter interface { + // Create saves the GatewayClass object. + CreateGatewayClass(ctx context.Context, obj *gateway_networking_k8s_io_v1.GatewayClass, opts ...client.CreateOption) error + + // Delete deletes the GatewayClass object. + DeleteGatewayClass(ctx context.Context, key client.ObjectKey, opts ...client.DeleteOption) error + + // Update updates the given GatewayClass object. + UpdateGatewayClass(ctx context.Context, obj *gateway_networking_k8s_io_v1.GatewayClass, opts ...client.UpdateOption) error + + // Patch patches the given GatewayClass object. + PatchGatewayClass(ctx context.Context, obj *gateway_networking_k8s_io_v1.GatewayClass, patch client.Patch, opts ...client.PatchOption) error + + // DeleteAllOf deletes all GatewayClass objects matching the given options. + DeleteAllOfGatewayClass(ctx context.Context, opts ...client.DeleteAllOfOption) error + + // Create or Update the GatewayClass object. + UpsertGatewayClass(ctx context.Context, obj *gateway_networking_k8s_io_v1.GatewayClass, transitionFuncs ...GatewayClassTransitionFunction) error +} + +// StatusWriter knows how to update status subresource of a GatewayClass object. +type GatewayClassStatusWriter interface { + // Update updates the fields corresponding to the status subresource for the + // given GatewayClass object. + UpdateGatewayClassStatus(ctx context.Context, obj *gateway_networking_k8s_io_v1.GatewayClass, opts ...client.SubResourceUpdateOption) error + + // Patch patches the given GatewayClass object's subresource. + PatchGatewayClassStatus(ctx context.Context, obj *gateway_networking_k8s_io_v1.GatewayClass, patch client.Patch, opts ...client.SubResourcePatchOption) error +} + +// Client knows how to perform CRUD operations on GatewayClasss. +type GatewayClassClient interface { + GatewayClassReader + GatewayClassWriter + GatewayClassStatusWriter +} + +type gatewayClassClient struct { + client client.Client +} + +func NewGatewayClassClient(client client.Client) *gatewayClassClient { + return &gatewayClassClient{client: client} +} + +func (c *gatewayClassClient) GetGatewayClass(ctx context.Context, key client.ObjectKey) (*gateway_networking_k8s_io_v1.GatewayClass, error) { + obj := &gateway_networking_k8s_io_v1.GatewayClass{} + if err := c.client.Get(ctx, key, obj); err != nil { + return nil, err + } + return obj, nil +} + +func (c *gatewayClassClient) ListGatewayClass(ctx context.Context, opts ...client.ListOption) (*gateway_networking_k8s_io_v1.GatewayClassList, error) { + list := &gateway_networking_k8s_io_v1.GatewayClassList{} + if err := c.client.List(ctx, list, opts...); err != nil { + return nil, err + } + return list, nil +} + +func (c *gatewayClassClient) CreateGatewayClass(ctx context.Context, obj *gateway_networking_k8s_io_v1.GatewayClass, opts ...client.CreateOption) error { + return c.client.Create(ctx, obj, opts...) +} + +func (c *gatewayClassClient) DeleteGatewayClass(ctx context.Context, key client.ObjectKey, opts ...client.DeleteOption) error { + obj := &gateway_networking_k8s_io_v1.GatewayClass{} + obj.SetName(key.Name) + obj.SetNamespace(key.Namespace) + return c.client.Delete(ctx, obj, opts...) +} + +func (c *gatewayClassClient) UpdateGatewayClass(ctx context.Context, obj *gateway_networking_k8s_io_v1.GatewayClass, opts ...client.UpdateOption) error { + return c.client.Update(ctx, obj, opts...) +} + +func (c *gatewayClassClient) PatchGatewayClass(ctx context.Context, obj *gateway_networking_k8s_io_v1.GatewayClass, patch client.Patch, opts ...client.PatchOption) error { + return c.client.Patch(ctx, obj, patch, opts...) +} + +func (c *gatewayClassClient) DeleteAllOfGatewayClass(ctx context.Context, opts ...client.DeleteAllOfOption) error { + obj := &gateway_networking_k8s_io_v1.GatewayClass{} + return c.client.DeleteAllOf(ctx, obj, opts...) +} + +func (c *gatewayClassClient) UpsertGatewayClass(ctx context.Context, obj *gateway_networking_k8s_io_v1.GatewayClass, transitionFuncs ...GatewayClassTransitionFunction) error { + genericTxFunc := func(existing, desired runtime.Object) error { + for _, txFunc := range transitionFuncs { + if err := txFunc(existing.(*gateway_networking_k8s_io_v1.GatewayClass), desired.(*gateway_networking_k8s_io_v1.GatewayClass)); err != nil { + return err + } + } + return nil + } + _, err := controllerutils.Upsert(ctx, c.client, obj, genericTxFunc) + return err +} + +func (c *gatewayClassClient) UpdateGatewayClassStatus(ctx context.Context, obj *gateway_networking_k8s_io_v1.GatewayClass, opts ...client.SubResourceUpdateOption) error { + return c.client.Status().Update(ctx, obj, opts...) +} + +func (c *gatewayClassClient) PatchGatewayClassStatus(ctx context.Context, obj *gateway_networking_k8s_io_v1.GatewayClass, patch client.Patch, opts ...client.SubResourcePatchOption) error { + return c.client.Status().Patch(ctx, obj, patch, opts...) +} + +// Provides GatewayClassClients for multiple clusters. +type MulticlusterGatewayClassClient interface { + // Cluster returns a GatewayClassClient for the given cluster + Cluster(cluster string) (GatewayClassClient, error) +} + +type multiclusterGatewayClassClient struct { + client multicluster.Client +} + +func NewMulticlusterGatewayClassClient(client multicluster.Client) MulticlusterGatewayClassClient { + return &multiclusterGatewayClassClient{client: client} +} + +func (m *multiclusterGatewayClassClient) Cluster(cluster string) (GatewayClassClient, error) { + client, err := m.client.Cluster(cluster) + if err != nil { + return nil, err + } + return NewGatewayClassClient(client), nil +} + +// Reader knows how to read and list Gateways. +type GatewayReader interface { + // Get retrieves a Gateway for the given object key + GetGateway(ctx context.Context, key client.ObjectKey) (*gateway_networking_k8s_io_v1.Gateway, error) + + // List retrieves list of Gateways for a given namespace and list options. + ListGateway(ctx context.Context, opts ...client.ListOption) (*gateway_networking_k8s_io_v1.GatewayList, error) +} + +// GatewayTransitionFunction instructs the GatewayWriter how to transition between an existing +// Gateway object and a desired on an Upsert +type GatewayTransitionFunction func(existing, desired *gateway_networking_k8s_io_v1.Gateway) error + +// Writer knows how to create, delete, and update Gateways. +type GatewayWriter interface { + // Create saves the Gateway object. + CreateGateway(ctx context.Context, obj *gateway_networking_k8s_io_v1.Gateway, opts ...client.CreateOption) error + + // Delete deletes the Gateway object. + DeleteGateway(ctx context.Context, key client.ObjectKey, opts ...client.DeleteOption) error + + // Update updates the given Gateway object. + UpdateGateway(ctx context.Context, obj *gateway_networking_k8s_io_v1.Gateway, opts ...client.UpdateOption) error + + // Patch patches the given Gateway object. + PatchGateway(ctx context.Context, obj *gateway_networking_k8s_io_v1.Gateway, patch client.Patch, opts ...client.PatchOption) error + + // DeleteAllOf deletes all Gateway objects matching the given options. + DeleteAllOfGateway(ctx context.Context, opts ...client.DeleteAllOfOption) error + + // Create or Update the Gateway object. + UpsertGateway(ctx context.Context, obj *gateway_networking_k8s_io_v1.Gateway, transitionFuncs ...GatewayTransitionFunction) error +} + +// StatusWriter knows how to update status subresource of a Gateway object. +type GatewayStatusWriter interface { + // Update updates the fields corresponding to the status subresource for the + // given Gateway object. + UpdateGatewayStatus(ctx context.Context, obj *gateway_networking_k8s_io_v1.Gateway, opts ...client.SubResourceUpdateOption) error + + // Patch patches the given Gateway object's subresource. + PatchGatewayStatus(ctx context.Context, obj *gateway_networking_k8s_io_v1.Gateway, patch client.Patch, opts ...client.SubResourcePatchOption) error +} + +// Client knows how to perform CRUD operations on Gateways. +type GatewayClient interface { + GatewayReader + GatewayWriter + GatewayStatusWriter +} + +type gatewayClient struct { + client client.Client +} + +func NewGatewayClient(client client.Client) *gatewayClient { + return &gatewayClient{client: client} +} + +func (c *gatewayClient) GetGateway(ctx context.Context, key client.ObjectKey) (*gateway_networking_k8s_io_v1.Gateway, error) { + obj := &gateway_networking_k8s_io_v1.Gateway{} + if err := c.client.Get(ctx, key, obj); err != nil { + return nil, err + } + return obj, nil +} + +func (c *gatewayClient) ListGateway(ctx context.Context, opts ...client.ListOption) (*gateway_networking_k8s_io_v1.GatewayList, error) { + list := &gateway_networking_k8s_io_v1.GatewayList{} + if err := c.client.List(ctx, list, opts...); err != nil { + return nil, err + } + return list, nil +} + +func (c *gatewayClient) CreateGateway(ctx context.Context, obj *gateway_networking_k8s_io_v1.Gateway, opts ...client.CreateOption) error { + return c.client.Create(ctx, obj, opts...) +} + +func (c *gatewayClient) DeleteGateway(ctx context.Context, key client.ObjectKey, opts ...client.DeleteOption) error { + obj := &gateway_networking_k8s_io_v1.Gateway{} + obj.SetName(key.Name) + obj.SetNamespace(key.Namespace) + return c.client.Delete(ctx, obj, opts...) +} + +func (c *gatewayClient) UpdateGateway(ctx context.Context, obj *gateway_networking_k8s_io_v1.Gateway, opts ...client.UpdateOption) error { + return c.client.Update(ctx, obj, opts...) +} + +func (c *gatewayClient) PatchGateway(ctx context.Context, obj *gateway_networking_k8s_io_v1.Gateway, patch client.Patch, opts ...client.PatchOption) error { + return c.client.Patch(ctx, obj, patch, opts...) +} + +func (c *gatewayClient) DeleteAllOfGateway(ctx context.Context, opts ...client.DeleteAllOfOption) error { + obj := &gateway_networking_k8s_io_v1.Gateway{} + return c.client.DeleteAllOf(ctx, obj, opts...) +} + +func (c *gatewayClient) UpsertGateway(ctx context.Context, obj *gateway_networking_k8s_io_v1.Gateway, transitionFuncs ...GatewayTransitionFunction) error { + genericTxFunc := func(existing, desired runtime.Object) error { + for _, txFunc := range transitionFuncs { + if err := txFunc(existing.(*gateway_networking_k8s_io_v1.Gateway), desired.(*gateway_networking_k8s_io_v1.Gateway)); err != nil { + return err + } + } + return nil + } + _, err := controllerutils.Upsert(ctx, c.client, obj, genericTxFunc) + return err +} + +func (c *gatewayClient) UpdateGatewayStatus(ctx context.Context, obj *gateway_networking_k8s_io_v1.Gateway, opts ...client.SubResourceUpdateOption) error { + return c.client.Status().Update(ctx, obj, opts...) +} + +func (c *gatewayClient) PatchGatewayStatus(ctx context.Context, obj *gateway_networking_k8s_io_v1.Gateway, patch client.Patch, opts ...client.SubResourcePatchOption) error { + return c.client.Status().Patch(ctx, obj, patch, opts...) +} + +// Provides GatewayClients for multiple clusters. +type MulticlusterGatewayClient interface { + // Cluster returns a GatewayClient for the given cluster + Cluster(cluster string) (GatewayClient, error) +} + +type multiclusterGatewayClient struct { + client multicluster.Client +} + +func NewMulticlusterGatewayClient(client multicluster.Client) MulticlusterGatewayClient { + return &multiclusterGatewayClient{client: client} +} + +func (m *multiclusterGatewayClient) Cluster(cluster string) (GatewayClient, error) { + client, err := m.client.Cluster(cluster) + if err != nil { + return nil, err + } + return NewGatewayClient(client), nil +} + +// Reader knows how to read and list HTTPRoutes. +type HTTPRouteReader interface { + // Get retrieves a HTTPRoute for the given object key + GetHTTPRoute(ctx context.Context, key client.ObjectKey) (*gateway_networking_k8s_io_v1.HTTPRoute, error) + + // List retrieves list of HTTPRoutes for a given namespace and list options. + ListHTTPRoute(ctx context.Context, opts ...client.ListOption) (*gateway_networking_k8s_io_v1.HTTPRouteList, error) +} + +// HTTPRouteTransitionFunction instructs the HTTPRouteWriter how to transition between an existing +// HTTPRoute object and a desired on an Upsert +type HTTPRouteTransitionFunction func(existing, desired *gateway_networking_k8s_io_v1.HTTPRoute) error + +// Writer knows how to create, delete, and update HTTPRoutes. +type HTTPRouteWriter interface { + // Create saves the HTTPRoute object. + CreateHTTPRoute(ctx context.Context, obj *gateway_networking_k8s_io_v1.HTTPRoute, opts ...client.CreateOption) error + + // Delete deletes the HTTPRoute object. + DeleteHTTPRoute(ctx context.Context, key client.ObjectKey, opts ...client.DeleteOption) error + + // Update updates the given HTTPRoute object. + UpdateHTTPRoute(ctx context.Context, obj *gateway_networking_k8s_io_v1.HTTPRoute, opts ...client.UpdateOption) error + + // Patch patches the given HTTPRoute object. + PatchHTTPRoute(ctx context.Context, obj *gateway_networking_k8s_io_v1.HTTPRoute, patch client.Patch, opts ...client.PatchOption) error + + // DeleteAllOf deletes all HTTPRoute objects matching the given options. + DeleteAllOfHTTPRoute(ctx context.Context, opts ...client.DeleteAllOfOption) error + + // Create or Update the HTTPRoute object. + UpsertHTTPRoute(ctx context.Context, obj *gateway_networking_k8s_io_v1.HTTPRoute, transitionFuncs ...HTTPRouteTransitionFunction) error +} + +// StatusWriter knows how to update status subresource of a HTTPRoute object. +type HTTPRouteStatusWriter interface { + // Update updates the fields corresponding to the status subresource for the + // given HTTPRoute object. + UpdateHTTPRouteStatus(ctx context.Context, obj *gateway_networking_k8s_io_v1.HTTPRoute, opts ...client.SubResourceUpdateOption) error + + // Patch patches the given HTTPRoute object's subresource. + PatchHTTPRouteStatus(ctx context.Context, obj *gateway_networking_k8s_io_v1.HTTPRoute, patch client.Patch, opts ...client.SubResourcePatchOption) error +} + +// Client knows how to perform CRUD operations on HTTPRoutes. +type HTTPRouteClient interface { + HTTPRouteReader + HTTPRouteWriter + HTTPRouteStatusWriter +} + +type hTTPRouteClient struct { + client client.Client +} + +func NewHTTPRouteClient(client client.Client) *hTTPRouteClient { + return &hTTPRouteClient{client: client} +} + +func (c *hTTPRouteClient) GetHTTPRoute(ctx context.Context, key client.ObjectKey) (*gateway_networking_k8s_io_v1.HTTPRoute, error) { + obj := &gateway_networking_k8s_io_v1.HTTPRoute{} + if err := c.client.Get(ctx, key, obj); err != nil { + return nil, err + } + return obj, nil +} + +func (c *hTTPRouteClient) ListHTTPRoute(ctx context.Context, opts ...client.ListOption) (*gateway_networking_k8s_io_v1.HTTPRouteList, error) { + list := &gateway_networking_k8s_io_v1.HTTPRouteList{} + if err := c.client.List(ctx, list, opts...); err != nil { + return nil, err + } + return list, nil +} + +func (c *hTTPRouteClient) CreateHTTPRoute(ctx context.Context, obj *gateway_networking_k8s_io_v1.HTTPRoute, opts ...client.CreateOption) error { + return c.client.Create(ctx, obj, opts...) +} + +func (c *hTTPRouteClient) DeleteHTTPRoute(ctx context.Context, key client.ObjectKey, opts ...client.DeleteOption) error { + obj := &gateway_networking_k8s_io_v1.HTTPRoute{} + obj.SetName(key.Name) + obj.SetNamespace(key.Namespace) + return c.client.Delete(ctx, obj, opts...) +} + +func (c *hTTPRouteClient) UpdateHTTPRoute(ctx context.Context, obj *gateway_networking_k8s_io_v1.HTTPRoute, opts ...client.UpdateOption) error { + return c.client.Update(ctx, obj, opts...) +} + +func (c *hTTPRouteClient) PatchHTTPRoute(ctx context.Context, obj *gateway_networking_k8s_io_v1.HTTPRoute, patch client.Patch, opts ...client.PatchOption) error { + return c.client.Patch(ctx, obj, patch, opts...) +} + +func (c *hTTPRouteClient) DeleteAllOfHTTPRoute(ctx context.Context, opts ...client.DeleteAllOfOption) error { + obj := &gateway_networking_k8s_io_v1.HTTPRoute{} + return c.client.DeleteAllOf(ctx, obj, opts...) +} + +func (c *hTTPRouteClient) UpsertHTTPRoute(ctx context.Context, obj *gateway_networking_k8s_io_v1.HTTPRoute, transitionFuncs ...HTTPRouteTransitionFunction) error { + genericTxFunc := func(existing, desired runtime.Object) error { + for _, txFunc := range transitionFuncs { + if err := txFunc(existing.(*gateway_networking_k8s_io_v1.HTTPRoute), desired.(*gateway_networking_k8s_io_v1.HTTPRoute)); err != nil { + return err + } + } + return nil + } + _, err := controllerutils.Upsert(ctx, c.client, obj, genericTxFunc) + return err +} + +func (c *hTTPRouteClient) UpdateHTTPRouteStatus(ctx context.Context, obj *gateway_networking_k8s_io_v1.HTTPRoute, opts ...client.SubResourceUpdateOption) error { + return c.client.Status().Update(ctx, obj, opts...) +} + +func (c *hTTPRouteClient) PatchHTTPRouteStatus(ctx context.Context, obj *gateway_networking_k8s_io_v1.HTTPRoute, patch client.Patch, opts ...client.SubResourcePatchOption) error { + return c.client.Status().Patch(ctx, obj, patch, opts...) +} + +// Provides HTTPRouteClients for multiple clusters. +type MulticlusterHTTPRouteClient interface { + // Cluster returns a HTTPRouteClient for the given cluster + Cluster(cluster string) (HTTPRouteClient, error) +} + +type multiclusterHTTPRouteClient struct { + client multicluster.Client +} + +func NewMulticlusterHTTPRouteClient(client multicluster.Client) MulticlusterHTTPRouteClient { + return &multiclusterHTTPRouteClient{client: client} +} + +func (m *multiclusterHTTPRouteClient) Cluster(cluster string) (HTTPRouteClient, error) { + client, err := m.client.Cluster(cluster) + if err != nil { + return nil, err + } + return NewHTTPRouteClient(client), nil +} diff --git a/pkg/api/k8s-gw/apis/gateway.networking.k8s.io/v1/controller/event_handlers.go b/pkg/api/k8s-gw/apis/gateway.networking.k8s.io/v1/controller/event_handlers.go new file mode 100644 index 0000000..54aa215 --- /dev/null +++ b/pkg/api/k8s-gw/apis/gateway.networking.k8s.io/v1/controller/event_handlers.go @@ -0,0 +1,339 @@ +// Code generated by skv2. DO NOT EDIT. + +//go:generate mockgen -source ./event_handlers.go -destination mocks/event_handlers.go + +// Definitions for the Kubernetes Controllers +package controller + +import ( + "context" + + gateway_networking_k8s_io_v1 "sigs.k8s.io/gateway-api/apis/v1" + + "github.com/pkg/errors" + "github.com/solo-io/skv2/pkg/events" + "sigs.k8s.io/controller-runtime/pkg/client" + "sigs.k8s.io/controller-runtime/pkg/manager" + "sigs.k8s.io/controller-runtime/pkg/predicate" +) + +// Handle events for the GatewayClass Resource +// DEPRECATED: Prefer reconciler pattern. +type GatewayClassEventHandler interface { + CreateGatewayClass(obj *gateway_networking_k8s_io_v1.GatewayClass) error + UpdateGatewayClass(old, new *gateway_networking_k8s_io_v1.GatewayClass) error + DeleteGatewayClass(obj *gateway_networking_k8s_io_v1.GatewayClass) error + GenericGatewayClass(obj *gateway_networking_k8s_io_v1.GatewayClass) error +} + +type GatewayClassEventHandlerFuncs struct { + OnCreate func(obj *gateway_networking_k8s_io_v1.GatewayClass) error + OnUpdate func(old, new *gateway_networking_k8s_io_v1.GatewayClass) error + OnDelete func(obj *gateway_networking_k8s_io_v1.GatewayClass) error + OnGeneric func(obj *gateway_networking_k8s_io_v1.GatewayClass) error +} + +func (f *GatewayClassEventHandlerFuncs) CreateGatewayClass(obj *gateway_networking_k8s_io_v1.GatewayClass) error { + if f.OnCreate == nil { + return nil + } + return f.OnCreate(obj) +} + +func (f *GatewayClassEventHandlerFuncs) DeleteGatewayClass(obj *gateway_networking_k8s_io_v1.GatewayClass) error { + if f.OnDelete == nil { + return nil + } + return f.OnDelete(obj) +} + +func (f *GatewayClassEventHandlerFuncs) UpdateGatewayClass(objOld, objNew *gateway_networking_k8s_io_v1.GatewayClass) error { + if f.OnUpdate == nil { + return nil + } + return f.OnUpdate(objOld, objNew) +} + +func (f *GatewayClassEventHandlerFuncs) GenericGatewayClass(obj *gateway_networking_k8s_io_v1.GatewayClass) error { + if f.OnGeneric == nil { + return nil + } + return f.OnGeneric(obj) +} + +type GatewayClassEventWatcher interface { + AddEventHandler(ctx context.Context, h GatewayClassEventHandler, predicates ...predicate.Predicate) error +} + +type gatewayClassEventWatcher struct { + watcher events.EventWatcher +} + +func NewGatewayClassEventWatcher(name string, mgr manager.Manager) GatewayClassEventWatcher { + return &gatewayClassEventWatcher{ + watcher: events.NewWatcher(name, mgr, &gateway_networking_k8s_io_v1.GatewayClass{}), + } +} + +func (c *gatewayClassEventWatcher) AddEventHandler(ctx context.Context, h GatewayClassEventHandler, predicates ...predicate.Predicate) error { + handler := genericGatewayClassHandler{handler: h} + if err := c.watcher.Watch(ctx, handler, predicates...); err != nil { + return err + } + return nil +} + +// genericGatewayClassHandler implements a generic events.EventHandler +type genericGatewayClassHandler struct { + handler GatewayClassEventHandler +} + +func (h genericGatewayClassHandler) Create(object client.Object) error { + obj, ok := object.(*gateway_networking_k8s_io_v1.GatewayClass) + if !ok { + return errors.Errorf("internal error: GatewayClass handler received event for %T", object) + } + return h.handler.CreateGatewayClass(obj) +} + +func (h genericGatewayClassHandler) Delete(object client.Object) error { + obj, ok := object.(*gateway_networking_k8s_io_v1.GatewayClass) + if !ok { + return errors.Errorf("internal error: GatewayClass handler received event for %T", object) + } + return h.handler.DeleteGatewayClass(obj) +} + +func (h genericGatewayClassHandler) Update(old, new client.Object) error { + objOld, ok := old.(*gateway_networking_k8s_io_v1.GatewayClass) + if !ok { + return errors.Errorf("internal error: GatewayClass handler received event for %T", old) + } + objNew, ok := new.(*gateway_networking_k8s_io_v1.GatewayClass) + if !ok { + return errors.Errorf("internal error: GatewayClass handler received event for %T", new) + } + return h.handler.UpdateGatewayClass(objOld, objNew) +} + +func (h genericGatewayClassHandler) Generic(object client.Object) error { + obj, ok := object.(*gateway_networking_k8s_io_v1.GatewayClass) + if !ok { + return errors.Errorf("internal error: GatewayClass handler received event for %T", object) + } + return h.handler.GenericGatewayClass(obj) +} + +// Handle events for the Gateway Resource +// DEPRECATED: Prefer reconciler pattern. +type GatewayEventHandler interface { + CreateGateway(obj *gateway_networking_k8s_io_v1.Gateway) error + UpdateGateway(old, new *gateway_networking_k8s_io_v1.Gateway) error + DeleteGateway(obj *gateway_networking_k8s_io_v1.Gateway) error + GenericGateway(obj *gateway_networking_k8s_io_v1.Gateway) error +} + +type GatewayEventHandlerFuncs struct { + OnCreate func(obj *gateway_networking_k8s_io_v1.Gateway) error + OnUpdate func(old, new *gateway_networking_k8s_io_v1.Gateway) error + OnDelete func(obj *gateway_networking_k8s_io_v1.Gateway) error + OnGeneric func(obj *gateway_networking_k8s_io_v1.Gateway) error +} + +func (f *GatewayEventHandlerFuncs) CreateGateway(obj *gateway_networking_k8s_io_v1.Gateway) error { + if f.OnCreate == nil { + return nil + } + return f.OnCreate(obj) +} + +func (f *GatewayEventHandlerFuncs) DeleteGateway(obj *gateway_networking_k8s_io_v1.Gateway) error { + if f.OnDelete == nil { + return nil + } + return f.OnDelete(obj) +} + +func (f *GatewayEventHandlerFuncs) UpdateGateway(objOld, objNew *gateway_networking_k8s_io_v1.Gateway) error { + if f.OnUpdate == nil { + return nil + } + return f.OnUpdate(objOld, objNew) +} + +func (f *GatewayEventHandlerFuncs) GenericGateway(obj *gateway_networking_k8s_io_v1.Gateway) error { + if f.OnGeneric == nil { + return nil + } + return f.OnGeneric(obj) +} + +type GatewayEventWatcher interface { + AddEventHandler(ctx context.Context, h GatewayEventHandler, predicates ...predicate.Predicate) error +} + +type gatewayEventWatcher struct { + watcher events.EventWatcher +} + +func NewGatewayEventWatcher(name string, mgr manager.Manager) GatewayEventWatcher { + return &gatewayEventWatcher{ + watcher: events.NewWatcher(name, mgr, &gateway_networking_k8s_io_v1.Gateway{}), + } +} + +func (c *gatewayEventWatcher) AddEventHandler(ctx context.Context, h GatewayEventHandler, predicates ...predicate.Predicate) error { + handler := genericGatewayHandler{handler: h} + if err := c.watcher.Watch(ctx, handler, predicates...); err != nil { + return err + } + return nil +} + +// genericGatewayHandler implements a generic events.EventHandler +type genericGatewayHandler struct { + handler GatewayEventHandler +} + +func (h genericGatewayHandler) Create(object client.Object) error { + obj, ok := object.(*gateway_networking_k8s_io_v1.Gateway) + if !ok { + return errors.Errorf("internal error: Gateway handler received event for %T", object) + } + return h.handler.CreateGateway(obj) +} + +func (h genericGatewayHandler) Delete(object client.Object) error { + obj, ok := object.(*gateway_networking_k8s_io_v1.Gateway) + if !ok { + return errors.Errorf("internal error: Gateway handler received event for %T", object) + } + return h.handler.DeleteGateway(obj) +} + +func (h genericGatewayHandler) Update(old, new client.Object) error { + objOld, ok := old.(*gateway_networking_k8s_io_v1.Gateway) + if !ok { + return errors.Errorf("internal error: Gateway handler received event for %T", old) + } + objNew, ok := new.(*gateway_networking_k8s_io_v1.Gateway) + if !ok { + return errors.Errorf("internal error: Gateway handler received event for %T", new) + } + return h.handler.UpdateGateway(objOld, objNew) +} + +func (h genericGatewayHandler) Generic(object client.Object) error { + obj, ok := object.(*gateway_networking_k8s_io_v1.Gateway) + if !ok { + return errors.Errorf("internal error: Gateway handler received event for %T", object) + } + return h.handler.GenericGateway(obj) +} + +// Handle events for the HTTPRoute Resource +// DEPRECATED: Prefer reconciler pattern. +type HTTPRouteEventHandler interface { + CreateHTTPRoute(obj *gateway_networking_k8s_io_v1.HTTPRoute) error + UpdateHTTPRoute(old, new *gateway_networking_k8s_io_v1.HTTPRoute) error + DeleteHTTPRoute(obj *gateway_networking_k8s_io_v1.HTTPRoute) error + GenericHTTPRoute(obj *gateway_networking_k8s_io_v1.HTTPRoute) error +} + +type HTTPRouteEventHandlerFuncs struct { + OnCreate func(obj *gateway_networking_k8s_io_v1.HTTPRoute) error + OnUpdate func(old, new *gateway_networking_k8s_io_v1.HTTPRoute) error + OnDelete func(obj *gateway_networking_k8s_io_v1.HTTPRoute) error + OnGeneric func(obj *gateway_networking_k8s_io_v1.HTTPRoute) error +} + +func (f *HTTPRouteEventHandlerFuncs) CreateHTTPRoute(obj *gateway_networking_k8s_io_v1.HTTPRoute) error { + if f.OnCreate == nil { + return nil + } + return f.OnCreate(obj) +} + +func (f *HTTPRouteEventHandlerFuncs) DeleteHTTPRoute(obj *gateway_networking_k8s_io_v1.HTTPRoute) error { + if f.OnDelete == nil { + return nil + } + return f.OnDelete(obj) +} + +func (f *HTTPRouteEventHandlerFuncs) UpdateHTTPRoute(objOld, objNew *gateway_networking_k8s_io_v1.HTTPRoute) error { + if f.OnUpdate == nil { + return nil + } + return f.OnUpdate(objOld, objNew) +} + +func (f *HTTPRouteEventHandlerFuncs) GenericHTTPRoute(obj *gateway_networking_k8s_io_v1.HTTPRoute) error { + if f.OnGeneric == nil { + return nil + } + return f.OnGeneric(obj) +} + +type HTTPRouteEventWatcher interface { + AddEventHandler(ctx context.Context, h HTTPRouteEventHandler, predicates ...predicate.Predicate) error +} + +type hTTPRouteEventWatcher struct { + watcher events.EventWatcher +} + +func NewHTTPRouteEventWatcher(name string, mgr manager.Manager) HTTPRouteEventWatcher { + return &hTTPRouteEventWatcher{ + watcher: events.NewWatcher(name, mgr, &gateway_networking_k8s_io_v1.HTTPRoute{}), + } +} + +func (c *hTTPRouteEventWatcher) AddEventHandler(ctx context.Context, h HTTPRouteEventHandler, predicates ...predicate.Predicate) error { + handler := genericHTTPRouteHandler{handler: h} + if err := c.watcher.Watch(ctx, handler, predicates...); err != nil { + return err + } + return nil +} + +// genericHTTPRouteHandler implements a generic events.EventHandler +type genericHTTPRouteHandler struct { + handler HTTPRouteEventHandler +} + +func (h genericHTTPRouteHandler) Create(object client.Object) error { + obj, ok := object.(*gateway_networking_k8s_io_v1.HTTPRoute) + if !ok { + return errors.Errorf("internal error: HTTPRoute handler received event for %T", object) + } + return h.handler.CreateHTTPRoute(obj) +} + +func (h genericHTTPRouteHandler) Delete(object client.Object) error { + obj, ok := object.(*gateway_networking_k8s_io_v1.HTTPRoute) + if !ok { + return errors.Errorf("internal error: HTTPRoute handler received event for %T", object) + } + return h.handler.DeleteHTTPRoute(obj) +} + +func (h genericHTTPRouteHandler) Update(old, new client.Object) error { + objOld, ok := old.(*gateway_networking_k8s_io_v1.HTTPRoute) + if !ok { + return errors.Errorf("internal error: HTTPRoute handler received event for %T", old) + } + objNew, ok := new.(*gateway_networking_k8s_io_v1.HTTPRoute) + if !ok { + return errors.Errorf("internal error: HTTPRoute handler received event for %T", new) + } + return h.handler.UpdateHTTPRoute(objOld, objNew) +} + +func (h genericHTTPRouteHandler) Generic(object client.Object) error { + obj, ok := object.(*gateway_networking_k8s_io_v1.HTTPRoute) + if !ok { + return errors.Errorf("internal error: HTTPRoute handler received event for %T", object) + } + return h.handler.GenericHTTPRoute(obj) +} diff --git a/pkg/api/k8s-gw/apis/gateway.networking.k8s.io/v1/controller/mocks/event_handlers.go b/pkg/api/k8s-gw/apis/gateway.networking.k8s.io/v1/controller/mocks/event_handlers.go new file mode 100644 index 0000000..db2d6bd --- /dev/null +++ b/pkg/api/k8s-gw/apis/gateway.networking.k8s.io/v1/controller/mocks/event_handlers.go @@ -0,0 +1,378 @@ +// Code generated by MockGen. DO NOT EDIT. +// Source: ./event_handlers.go + +// Package mock_controller is a generated GoMock package. +package mock_controller + +import ( + context "context" + reflect "reflect" + + gomock "github.com/golang/mock/gomock" + controller "github.com/solo-io/external-apis/pkg/api/k8s-gw/apis/gateway.networking.k8s.io/v1/controller" + predicate "sigs.k8s.io/controller-runtime/pkg/predicate" + v1 "sigs.k8s.io/gateway-api/apis/v1" +) + +// MockGatewayClassEventHandler is a mock of GatewayClassEventHandler interface. +type MockGatewayClassEventHandler struct { + ctrl *gomock.Controller + recorder *MockGatewayClassEventHandlerMockRecorder +} + +// MockGatewayClassEventHandlerMockRecorder is the mock recorder for MockGatewayClassEventHandler. +type MockGatewayClassEventHandlerMockRecorder struct { + mock *MockGatewayClassEventHandler +} + +// NewMockGatewayClassEventHandler creates a new mock instance. +func NewMockGatewayClassEventHandler(ctrl *gomock.Controller) *MockGatewayClassEventHandler { + mock := &MockGatewayClassEventHandler{ctrl: ctrl} + mock.recorder = &MockGatewayClassEventHandlerMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockGatewayClassEventHandler) EXPECT() *MockGatewayClassEventHandlerMockRecorder { + return m.recorder +} + +// CreateGatewayClass mocks base method. +func (m *MockGatewayClassEventHandler) CreateGatewayClass(obj *v1.GatewayClass) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "CreateGatewayClass", obj) + ret0, _ := ret[0].(error) + return ret0 +} + +// CreateGatewayClass indicates an expected call of CreateGatewayClass. +func (mr *MockGatewayClassEventHandlerMockRecorder) CreateGatewayClass(obj interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateGatewayClass", reflect.TypeOf((*MockGatewayClassEventHandler)(nil).CreateGatewayClass), obj) +} + +// DeleteGatewayClass mocks base method. +func (m *MockGatewayClassEventHandler) DeleteGatewayClass(obj *v1.GatewayClass) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "DeleteGatewayClass", obj) + ret0, _ := ret[0].(error) + return ret0 +} + +// DeleteGatewayClass indicates an expected call of DeleteGatewayClass. +func (mr *MockGatewayClassEventHandlerMockRecorder) DeleteGatewayClass(obj interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteGatewayClass", reflect.TypeOf((*MockGatewayClassEventHandler)(nil).DeleteGatewayClass), obj) +} + +// GenericGatewayClass mocks base method. +func (m *MockGatewayClassEventHandler) GenericGatewayClass(obj *v1.GatewayClass) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GenericGatewayClass", obj) + ret0, _ := ret[0].(error) + return ret0 +} + +// GenericGatewayClass indicates an expected call of GenericGatewayClass. +func (mr *MockGatewayClassEventHandlerMockRecorder) GenericGatewayClass(obj interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GenericGatewayClass", reflect.TypeOf((*MockGatewayClassEventHandler)(nil).GenericGatewayClass), obj) +} + +// UpdateGatewayClass mocks base method. +func (m *MockGatewayClassEventHandler) UpdateGatewayClass(old, new *v1.GatewayClass) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "UpdateGatewayClass", old, new) + ret0, _ := ret[0].(error) + return ret0 +} + +// UpdateGatewayClass indicates an expected call of UpdateGatewayClass. +func (mr *MockGatewayClassEventHandlerMockRecorder) UpdateGatewayClass(old, new interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateGatewayClass", reflect.TypeOf((*MockGatewayClassEventHandler)(nil).UpdateGatewayClass), old, new) +} + +// MockGatewayClassEventWatcher is a mock of GatewayClassEventWatcher interface. +type MockGatewayClassEventWatcher struct { + ctrl *gomock.Controller + recorder *MockGatewayClassEventWatcherMockRecorder +} + +// MockGatewayClassEventWatcherMockRecorder is the mock recorder for MockGatewayClassEventWatcher. +type MockGatewayClassEventWatcherMockRecorder struct { + mock *MockGatewayClassEventWatcher +} + +// NewMockGatewayClassEventWatcher creates a new mock instance. +func NewMockGatewayClassEventWatcher(ctrl *gomock.Controller) *MockGatewayClassEventWatcher { + mock := &MockGatewayClassEventWatcher{ctrl: ctrl} + mock.recorder = &MockGatewayClassEventWatcherMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockGatewayClassEventWatcher) EXPECT() *MockGatewayClassEventWatcherMockRecorder { + return m.recorder +} + +// AddEventHandler mocks base method. +func (m *MockGatewayClassEventWatcher) AddEventHandler(ctx context.Context, h controller.GatewayClassEventHandler, predicates ...predicate.Predicate) error { + m.ctrl.T.Helper() + varargs := []interface{}{ctx, h} + for _, a := range predicates { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "AddEventHandler", varargs...) + ret0, _ := ret[0].(error) + return ret0 +} + +// AddEventHandler indicates an expected call of AddEventHandler. +func (mr *MockGatewayClassEventWatcherMockRecorder) AddEventHandler(ctx, h interface{}, predicates ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{ctx, h}, predicates...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddEventHandler", reflect.TypeOf((*MockGatewayClassEventWatcher)(nil).AddEventHandler), varargs...) +} + +// MockGatewayEventHandler is a mock of GatewayEventHandler interface. +type MockGatewayEventHandler struct { + ctrl *gomock.Controller + recorder *MockGatewayEventHandlerMockRecorder +} + +// MockGatewayEventHandlerMockRecorder is the mock recorder for MockGatewayEventHandler. +type MockGatewayEventHandlerMockRecorder struct { + mock *MockGatewayEventHandler +} + +// NewMockGatewayEventHandler creates a new mock instance. +func NewMockGatewayEventHandler(ctrl *gomock.Controller) *MockGatewayEventHandler { + mock := &MockGatewayEventHandler{ctrl: ctrl} + mock.recorder = &MockGatewayEventHandlerMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockGatewayEventHandler) EXPECT() *MockGatewayEventHandlerMockRecorder { + return m.recorder +} + +// CreateGateway mocks base method. +func (m *MockGatewayEventHandler) CreateGateway(obj *v1.Gateway) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "CreateGateway", obj) + ret0, _ := ret[0].(error) + return ret0 +} + +// CreateGateway indicates an expected call of CreateGateway. +func (mr *MockGatewayEventHandlerMockRecorder) CreateGateway(obj interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateGateway", reflect.TypeOf((*MockGatewayEventHandler)(nil).CreateGateway), obj) +} + +// DeleteGateway mocks base method. +func (m *MockGatewayEventHandler) DeleteGateway(obj *v1.Gateway) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "DeleteGateway", obj) + ret0, _ := ret[0].(error) + return ret0 +} + +// DeleteGateway indicates an expected call of DeleteGateway. +func (mr *MockGatewayEventHandlerMockRecorder) DeleteGateway(obj interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteGateway", reflect.TypeOf((*MockGatewayEventHandler)(nil).DeleteGateway), obj) +} + +// GenericGateway mocks base method. +func (m *MockGatewayEventHandler) GenericGateway(obj *v1.Gateway) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GenericGateway", obj) + ret0, _ := ret[0].(error) + return ret0 +} + +// GenericGateway indicates an expected call of GenericGateway. +func (mr *MockGatewayEventHandlerMockRecorder) GenericGateway(obj interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GenericGateway", reflect.TypeOf((*MockGatewayEventHandler)(nil).GenericGateway), obj) +} + +// UpdateGateway mocks base method. +func (m *MockGatewayEventHandler) UpdateGateway(old, new *v1.Gateway) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "UpdateGateway", old, new) + ret0, _ := ret[0].(error) + return ret0 +} + +// UpdateGateway indicates an expected call of UpdateGateway. +func (mr *MockGatewayEventHandlerMockRecorder) UpdateGateway(old, new interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateGateway", reflect.TypeOf((*MockGatewayEventHandler)(nil).UpdateGateway), old, new) +} + +// MockGatewayEventWatcher is a mock of GatewayEventWatcher interface. +type MockGatewayEventWatcher struct { + ctrl *gomock.Controller + recorder *MockGatewayEventWatcherMockRecorder +} + +// MockGatewayEventWatcherMockRecorder is the mock recorder for MockGatewayEventWatcher. +type MockGatewayEventWatcherMockRecorder struct { + mock *MockGatewayEventWatcher +} + +// NewMockGatewayEventWatcher creates a new mock instance. +func NewMockGatewayEventWatcher(ctrl *gomock.Controller) *MockGatewayEventWatcher { + mock := &MockGatewayEventWatcher{ctrl: ctrl} + mock.recorder = &MockGatewayEventWatcherMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockGatewayEventWatcher) EXPECT() *MockGatewayEventWatcherMockRecorder { + return m.recorder +} + +// AddEventHandler mocks base method. +func (m *MockGatewayEventWatcher) AddEventHandler(ctx context.Context, h controller.GatewayEventHandler, predicates ...predicate.Predicate) error { + m.ctrl.T.Helper() + varargs := []interface{}{ctx, h} + for _, a := range predicates { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "AddEventHandler", varargs...) + ret0, _ := ret[0].(error) + return ret0 +} + +// AddEventHandler indicates an expected call of AddEventHandler. +func (mr *MockGatewayEventWatcherMockRecorder) AddEventHandler(ctx, h interface{}, predicates ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{ctx, h}, predicates...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddEventHandler", reflect.TypeOf((*MockGatewayEventWatcher)(nil).AddEventHandler), varargs...) +} + +// MockHTTPRouteEventHandler is a mock of HTTPRouteEventHandler interface. +type MockHTTPRouteEventHandler struct { + ctrl *gomock.Controller + recorder *MockHTTPRouteEventHandlerMockRecorder +} + +// MockHTTPRouteEventHandlerMockRecorder is the mock recorder for MockHTTPRouteEventHandler. +type MockHTTPRouteEventHandlerMockRecorder struct { + mock *MockHTTPRouteEventHandler +} + +// NewMockHTTPRouteEventHandler creates a new mock instance. +func NewMockHTTPRouteEventHandler(ctrl *gomock.Controller) *MockHTTPRouteEventHandler { + mock := &MockHTTPRouteEventHandler{ctrl: ctrl} + mock.recorder = &MockHTTPRouteEventHandlerMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockHTTPRouteEventHandler) EXPECT() *MockHTTPRouteEventHandlerMockRecorder { + return m.recorder +} + +// CreateHTTPRoute mocks base method. +func (m *MockHTTPRouteEventHandler) CreateHTTPRoute(obj *v1.HTTPRoute) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "CreateHTTPRoute", obj) + ret0, _ := ret[0].(error) + return ret0 +} + +// CreateHTTPRoute indicates an expected call of CreateHTTPRoute. +func (mr *MockHTTPRouteEventHandlerMockRecorder) CreateHTTPRoute(obj interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateHTTPRoute", reflect.TypeOf((*MockHTTPRouteEventHandler)(nil).CreateHTTPRoute), obj) +} + +// DeleteHTTPRoute mocks base method. +func (m *MockHTTPRouteEventHandler) DeleteHTTPRoute(obj *v1.HTTPRoute) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "DeleteHTTPRoute", obj) + ret0, _ := ret[0].(error) + return ret0 +} + +// DeleteHTTPRoute indicates an expected call of DeleteHTTPRoute. +func (mr *MockHTTPRouteEventHandlerMockRecorder) DeleteHTTPRoute(obj interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteHTTPRoute", reflect.TypeOf((*MockHTTPRouteEventHandler)(nil).DeleteHTTPRoute), obj) +} + +// GenericHTTPRoute mocks base method. +func (m *MockHTTPRouteEventHandler) GenericHTTPRoute(obj *v1.HTTPRoute) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GenericHTTPRoute", obj) + ret0, _ := ret[0].(error) + return ret0 +} + +// GenericHTTPRoute indicates an expected call of GenericHTTPRoute. +func (mr *MockHTTPRouteEventHandlerMockRecorder) GenericHTTPRoute(obj interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GenericHTTPRoute", reflect.TypeOf((*MockHTTPRouteEventHandler)(nil).GenericHTTPRoute), obj) +} + +// UpdateHTTPRoute mocks base method. +func (m *MockHTTPRouteEventHandler) UpdateHTTPRoute(old, new *v1.HTTPRoute) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "UpdateHTTPRoute", old, new) + ret0, _ := ret[0].(error) + return ret0 +} + +// UpdateHTTPRoute indicates an expected call of UpdateHTTPRoute. +func (mr *MockHTTPRouteEventHandlerMockRecorder) UpdateHTTPRoute(old, new interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateHTTPRoute", reflect.TypeOf((*MockHTTPRouteEventHandler)(nil).UpdateHTTPRoute), old, new) +} + +// MockHTTPRouteEventWatcher is a mock of HTTPRouteEventWatcher interface. +type MockHTTPRouteEventWatcher struct { + ctrl *gomock.Controller + recorder *MockHTTPRouteEventWatcherMockRecorder +} + +// MockHTTPRouteEventWatcherMockRecorder is the mock recorder for MockHTTPRouteEventWatcher. +type MockHTTPRouteEventWatcherMockRecorder struct { + mock *MockHTTPRouteEventWatcher +} + +// NewMockHTTPRouteEventWatcher creates a new mock instance. +func NewMockHTTPRouteEventWatcher(ctrl *gomock.Controller) *MockHTTPRouteEventWatcher { + mock := &MockHTTPRouteEventWatcher{ctrl: ctrl} + mock.recorder = &MockHTTPRouteEventWatcherMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockHTTPRouteEventWatcher) EXPECT() *MockHTTPRouteEventWatcherMockRecorder { + return m.recorder +} + +// AddEventHandler mocks base method. +func (m *MockHTTPRouteEventWatcher) AddEventHandler(ctx context.Context, h controller.HTTPRouteEventHandler, predicates ...predicate.Predicate) error { + m.ctrl.T.Helper() + varargs := []interface{}{ctx, h} + for _, a := range predicates { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "AddEventHandler", varargs...) + ret0, _ := ret[0].(error) + return ret0 +} + +// AddEventHandler indicates an expected call of AddEventHandler. +func (mr *MockHTTPRouteEventWatcherMockRecorder) AddEventHandler(ctx, h interface{}, predicates ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{ctx, h}, predicates...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddEventHandler", reflect.TypeOf((*MockHTTPRouteEventWatcher)(nil).AddEventHandler), varargs...) +} diff --git a/pkg/api/k8s-gw/apis/gateway.networking.k8s.io/v1/controller/mocks/multicluster_reconcilers.go b/pkg/api/k8s-gw/apis/gateway.networking.k8s.io/v1/controller/mocks/multicluster_reconcilers.go new file mode 100644 index 0000000..9aecb32 --- /dev/null +++ b/pkg/api/k8s-gw/apis/gateway.networking.k8s.io/v1/controller/mocks/multicluster_reconcilers.go @@ -0,0 +1,361 @@ +// Code generated by MockGen. DO NOT EDIT. +// Source: ./multicluster_reconcilers.go + +// Package mock_controller is a generated GoMock package. +package mock_controller + +import ( + context "context" + reflect "reflect" + + gomock "github.com/golang/mock/gomock" + controller "github.com/solo-io/external-apis/pkg/api/k8s-gw/apis/gateway.networking.k8s.io/v1/controller" + reconcile "github.com/solo-io/skv2/pkg/reconcile" + predicate "sigs.k8s.io/controller-runtime/pkg/predicate" + v1 "sigs.k8s.io/gateway-api/apis/v1" +) + +// MockMulticlusterGatewayClassReconciler is a mock of MulticlusterGatewayClassReconciler interface. +type MockMulticlusterGatewayClassReconciler struct { + ctrl *gomock.Controller + recorder *MockMulticlusterGatewayClassReconcilerMockRecorder +} + +// MockMulticlusterGatewayClassReconcilerMockRecorder is the mock recorder for MockMulticlusterGatewayClassReconciler. +type MockMulticlusterGatewayClassReconcilerMockRecorder struct { + mock *MockMulticlusterGatewayClassReconciler +} + +// NewMockMulticlusterGatewayClassReconciler creates a new mock instance. +func NewMockMulticlusterGatewayClassReconciler(ctrl *gomock.Controller) *MockMulticlusterGatewayClassReconciler { + mock := &MockMulticlusterGatewayClassReconciler{ctrl: ctrl} + mock.recorder = &MockMulticlusterGatewayClassReconcilerMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockMulticlusterGatewayClassReconciler) EXPECT() *MockMulticlusterGatewayClassReconcilerMockRecorder { + return m.recorder +} + +// ReconcileGatewayClass mocks base method. +func (m *MockMulticlusterGatewayClassReconciler) ReconcileGatewayClass(clusterName string, obj *v1.GatewayClass) (reconcile.Result, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ReconcileGatewayClass", clusterName, obj) + ret0, _ := ret[0].(reconcile.Result) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ReconcileGatewayClass indicates an expected call of ReconcileGatewayClass. +func (mr *MockMulticlusterGatewayClassReconcilerMockRecorder) ReconcileGatewayClass(clusterName, obj interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ReconcileGatewayClass", reflect.TypeOf((*MockMulticlusterGatewayClassReconciler)(nil).ReconcileGatewayClass), clusterName, obj) +} + +// MockMulticlusterGatewayClassDeletionReconciler is a mock of MulticlusterGatewayClassDeletionReconciler interface. +type MockMulticlusterGatewayClassDeletionReconciler struct { + ctrl *gomock.Controller + recorder *MockMulticlusterGatewayClassDeletionReconcilerMockRecorder +} + +// MockMulticlusterGatewayClassDeletionReconcilerMockRecorder is the mock recorder for MockMulticlusterGatewayClassDeletionReconciler. +type MockMulticlusterGatewayClassDeletionReconcilerMockRecorder struct { + mock *MockMulticlusterGatewayClassDeletionReconciler +} + +// NewMockMulticlusterGatewayClassDeletionReconciler creates a new mock instance. +func NewMockMulticlusterGatewayClassDeletionReconciler(ctrl *gomock.Controller) *MockMulticlusterGatewayClassDeletionReconciler { + mock := &MockMulticlusterGatewayClassDeletionReconciler{ctrl: ctrl} + mock.recorder = &MockMulticlusterGatewayClassDeletionReconcilerMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockMulticlusterGatewayClassDeletionReconciler) EXPECT() *MockMulticlusterGatewayClassDeletionReconcilerMockRecorder { + return m.recorder +} + +// ReconcileGatewayClassDeletion mocks base method. +func (m *MockMulticlusterGatewayClassDeletionReconciler) ReconcileGatewayClassDeletion(clusterName string, req reconcile.Request) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ReconcileGatewayClassDeletion", clusterName, req) + ret0, _ := ret[0].(error) + return ret0 +} + +// ReconcileGatewayClassDeletion indicates an expected call of ReconcileGatewayClassDeletion. +func (mr *MockMulticlusterGatewayClassDeletionReconcilerMockRecorder) ReconcileGatewayClassDeletion(clusterName, req interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ReconcileGatewayClassDeletion", reflect.TypeOf((*MockMulticlusterGatewayClassDeletionReconciler)(nil).ReconcileGatewayClassDeletion), clusterName, req) +} + +// MockMulticlusterGatewayClassReconcileLoop is a mock of MulticlusterGatewayClassReconcileLoop interface. +type MockMulticlusterGatewayClassReconcileLoop struct { + ctrl *gomock.Controller + recorder *MockMulticlusterGatewayClassReconcileLoopMockRecorder +} + +// MockMulticlusterGatewayClassReconcileLoopMockRecorder is the mock recorder for MockMulticlusterGatewayClassReconcileLoop. +type MockMulticlusterGatewayClassReconcileLoopMockRecorder struct { + mock *MockMulticlusterGatewayClassReconcileLoop +} + +// NewMockMulticlusterGatewayClassReconcileLoop creates a new mock instance. +func NewMockMulticlusterGatewayClassReconcileLoop(ctrl *gomock.Controller) *MockMulticlusterGatewayClassReconcileLoop { + mock := &MockMulticlusterGatewayClassReconcileLoop{ctrl: ctrl} + mock.recorder = &MockMulticlusterGatewayClassReconcileLoopMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockMulticlusterGatewayClassReconcileLoop) EXPECT() *MockMulticlusterGatewayClassReconcileLoopMockRecorder { + return m.recorder +} + +// AddMulticlusterGatewayClassReconciler mocks base method. +func (m *MockMulticlusterGatewayClassReconcileLoop) AddMulticlusterGatewayClassReconciler(ctx context.Context, rec controller.MulticlusterGatewayClassReconciler, predicates ...predicate.Predicate) { + m.ctrl.T.Helper() + varargs := []interface{}{ctx, rec} + for _, a := range predicates { + varargs = append(varargs, a) + } + m.ctrl.Call(m, "AddMulticlusterGatewayClassReconciler", varargs...) +} + +// AddMulticlusterGatewayClassReconciler indicates an expected call of AddMulticlusterGatewayClassReconciler. +func (mr *MockMulticlusterGatewayClassReconcileLoopMockRecorder) AddMulticlusterGatewayClassReconciler(ctx, rec interface{}, predicates ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{ctx, rec}, predicates...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddMulticlusterGatewayClassReconciler", reflect.TypeOf((*MockMulticlusterGatewayClassReconcileLoop)(nil).AddMulticlusterGatewayClassReconciler), varargs...) +} + +// MockMulticlusterGatewayReconciler is a mock of MulticlusterGatewayReconciler interface. +type MockMulticlusterGatewayReconciler struct { + ctrl *gomock.Controller + recorder *MockMulticlusterGatewayReconcilerMockRecorder +} + +// MockMulticlusterGatewayReconcilerMockRecorder is the mock recorder for MockMulticlusterGatewayReconciler. +type MockMulticlusterGatewayReconcilerMockRecorder struct { + mock *MockMulticlusterGatewayReconciler +} + +// NewMockMulticlusterGatewayReconciler creates a new mock instance. +func NewMockMulticlusterGatewayReconciler(ctrl *gomock.Controller) *MockMulticlusterGatewayReconciler { + mock := &MockMulticlusterGatewayReconciler{ctrl: ctrl} + mock.recorder = &MockMulticlusterGatewayReconcilerMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockMulticlusterGatewayReconciler) EXPECT() *MockMulticlusterGatewayReconcilerMockRecorder { + return m.recorder +} + +// ReconcileGateway mocks base method. +func (m *MockMulticlusterGatewayReconciler) ReconcileGateway(clusterName string, obj *v1.Gateway) (reconcile.Result, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ReconcileGateway", clusterName, obj) + ret0, _ := ret[0].(reconcile.Result) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ReconcileGateway indicates an expected call of ReconcileGateway. +func (mr *MockMulticlusterGatewayReconcilerMockRecorder) ReconcileGateway(clusterName, obj interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ReconcileGateway", reflect.TypeOf((*MockMulticlusterGatewayReconciler)(nil).ReconcileGateway), clusterName, obj) +} + +// MockMulticlusterGatewayDeletionReconciler is a mock of MulticlusterGatewayDeletionReconciler interface. +type MockMulticlusterGatewayDeletionReconciler struct { + ctrl *gomock.Controller + recorder *MockMulticlusterGatewayDeletionReconcilerMockRecorder +} + +// MockMulticlusterGatewayDeletionReconcilerMockRecorder is the mock recorder for MockMulticlusterGatewayDeletionReconciler. +type MockMulticlusterGatewayDeletionReconcilerMockRecorder struct { + mock *MockMulticlusterGatewayDeletionReconciler +} + +// NewMockMulticlusterGatewayDeletionReconciler creates a new mock instance. +func NewMockMulticlusterGatewayDeletionReconciler(ctrl *gomock.Controller) *MockMulticlusterGatewayDeletionReconciler { + mock := &MockMulticlusterGatewayDeletionReconciler{ctrl: ctrl} + mock.recorder = &MockMulticlusterGatewayDeletionReconcilerMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockMulticlusterGatewayDeletionReconciler) EXPECT() *MockMulticlusterGatewayDeletionReconcilerMockRecorder { + return m.recorder +} + +// ReconcileGatewayDeletion mocks base method. +func (m *MockMulticlusterGatewayDeletionReconciler) ReconcileGatewayDeletion(clusterName string, req reconcile.Request) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ReconcileGatewayDeletion", clusterName, req) + ret0, _ := ret[0].(error) + return ret0 +} + +// ReconcileGatewayDeletion indicates an expected call of ReconcileGatewayDeletion. +func (mr *MockMulticlusterGatewayDeletionReconcilerMockRecorder) ReconcileGatewayDeletion(clusterName, req interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ReconcileGatewayDeletion", reflect.TypeOf((*MockMulticlusterGatewayDeletionReconciler)(nil).ReconcileGatewayDeletion), clusterName, req) +} + +// MockMulticlusterGatewayReconcileLoop is a mock of MulticlusterGatewayReconcileLoop interface. +type MockMulticlusterGatewayReconcileLoop struct { + ctrl *gomock.Controller + recorder *MockMulticlusterGatewayReconcileLoopMockRecorder +} + +// MockMulticlusterGatewayReconcileLoopMockRecorder is the mock recorder for MockMulticlusterGatewayReconcileLoop. +type MockMulticlusterGatewayReconcileLoopMockRecorder struct { + mock *MockMulticlusterGatewayReconcileLoop +} + +// NewMockMulticlusterGatewayReconcileLoop creates a new mock instance. +func NewMockMulticlusterGatewayReconcileLoop(ctrl *gomock.Controller) *MockMulticlusterGatewayReconcileLoop { + mock := &MockMulticlusterGatewayReconcileLoop{ctrl: ctrl} + mock.recorder = &MockMulticlusterGatewayReconcileLoopMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockMulticlusterGatewayReconcileLoop) EXPECT() *MockMulticlusterGatewayReconcileLoopMockRecorder { + return m.recorder +} + +// AddMulticlusterGatewayReconciler mocks base method. +func (m *MockMulticlusterGatewayReconcileLoop) AddMulticlusterGatewayReconciler(ctx context.Context, rec controller.MulticlusterGatewayReconciler, predicates ...predicate.Predicate) { + m.ctrl.T.Helper() + varargs := []interface{}{ctx, rec} + for _, a := range predicates { + varargs = append(varargs, a) + } + m.ctrl.Call(m, "AddMulticlusterGatewayReconciler", varargs...) +} + +// AddMulticlusterGatewayReconciler indicates an expected call of AddMulticlusterGatewayReconciler. +func (mr *MockMulticlusterGatewayReconcileLoopMockRecorder) AddMulticlusterGatewayReconciler(ctx, rec interface{}, predicates ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{ctx, rec}, predicates...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddMulticlusterGatewayReconciler", reflect.TypeOf((*MockMulticlusterGatewayReconcileLoop)(nil).AddMulticlusterGatewayReconciler), varargs...) +} + +// MockMulticlusterHTTPRouteReconciler is a mock of MulticlusterHTTPRouteReconciler interface. +type MockMulticlusterHTTPRouteReconciler struct { + ctrl *gomock.Controller + recorder *MockMulticlusterHTTPRouteReconcilerMockRecorder +} + +// MockMulticlusterHTTPRouteReconcilerMockRecorder is the mock recorder for MockMulticlusterHTTPRouteReconciler. +type MockMulticlusterHTTPRouteReconcilerMockRecorder struct { + mock *MockMulticlusterHTTPRouteReconciler +} + +// NewMockMulticlusterHTTPRouteReconciler creates a new mock instance. +func NewMockMulticlusterHTTPRouteReconciler(ctrl *gomock.Controller) *MockMulticlusterHTTPRouteReconciler { + mock := &MockMulticlusterHTTPRouteReconciler{ctrl: ctrl} + mock.recorder = &MockMulticlusterHTTPRouteReconcilerMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockMulticlusterHTTPRouteReconciler) EXPECT() *MockMulticlusterHTTPRouteReconcilerMockRecorder { + return m.recorder +} + +// ReconcileHTTPRoute mocks base method. +func (m *MockMulticlusterHTTPRouteReconciler) ReconcileHTTPRoute(clusterName string, obj *v1.HTTPRoute) (reconcile.Result, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ReconcileHTTPRoute", clusterName, obj) + ret0, _ := ret[0].(reconcile.Result) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ReconcileHTTPRoute indicates an expected call of ReconcileHTTPRoute. +func (mr *MockMulticlusterHTTPRouteReconcilerMockRecorder) ReconcileHTTPRoute(clusterName, obj interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ReconcileHTTPRoute", reflect.TypeOf((*MockMulticlusterHTTPRouteReconciler)(nil).ReconcileHTTPRoute), clusterName, obj) +} + +// MockMulticlusterHTTPRouteDeletionReconciler is a mock of MulticlusterHTTPRouteDeletionReconciler interface. +type MockMulticlusterHTTPRouteDeletionReconciler struct { + ctrl *gomock.Controller + recorder *MockMulticlusterHTTPRouteDeletionReconcilerMockRecorder +} + +// MockMulticlusterHTTPRouteDeletionReconcilerMockRecorder is the mock recorder for MockMulticlusterHTTPRouteDeletionReconciler. +type MockMulticlusterHTTPRouteDeletionReconcilerMockRecorder struct { + mock *MockMulticlusterHTTPRouteDeletionReconciler +} + +// NewMockMulticlusterHTTPRouteDeletionReconciler creates a new mock instance. +func NewMockMulticlusterHTTPRouteDeletionReconciler(ctrl *gomock.Controller) *MockMulticlusterHTTPRouteDeletionReconciler { + mock := &MockMulticlusterHTTPRouteDeletionReconciler{ctrl: ctrl} + mock.recorder = &MockMulticlusterHTTPRouteDeletionReconcilerMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockMulticlusterHTTPRouteDeletionReconciler) EXPECT() *MockMulticlusterHTTPRouteDeletionReconcilerMockRecorder { + return m.recorder +} + +// ReconcileHTTPRouteDeletion mocks base method. +func (m *MockMulticlusterHTTPRouteDeletionReconciler) ReconcileHTTPRouteDeletion(clusterName string, req reconcile.Request) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ReconcileHTTPRouteDeletion", clusterName, req) + ret0, _ := ret[0].(error) + return ret0 +} + +// ReconcileHTTPRouteDeletion indicates an expected call of ReconcileHTTPRouteDeletion. +func (mr *MockMulticlusterHTTPRouteDeletionReconcilerMockRecorder) ReconcileHTTPRouteDeletion(clusterName, req interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ReconcileHTTPRouteDeletion", reflect.TypeOf((*MockMulticlusterHTTPRouteDeletionReconciler)(nil).ReconcileHTTPRouteDeletion), clusterName, req) +} + +// MockMulticlusterHTTPRouteReconcileLoop is a mock of MulticlusterHTTPRouteReconcileLoop interface. +type MockMulticlusterHTTPRouteReconcileLoop struct { + ctrl *gomock.Controller + recorder *MockMulticlusterHTTPRouteReconcileLoopMockRecorder +} + +// MockMulticlusterHTTPRouteReconcileLoopMockRecorder is the mock recorder for MockMulticlusterHTTPRouteReconcileLoop. +type MockMulticlusterHTTPRouteReconcileLoopMockRecorder struct { + mock *MockMulticlusterHTTPRouteReconcileLoop +} + +// NewMockMulticlusterHTTPRouteReconcileLoop creates a new mock instance. +func NewMockMulticlusterHTTPRouteReconcileLoop(ctrl *gomock.Controller) *MockMulticlusterHTTPRouteReconcileLoop { + mock := &MockMulticlusterHTTPRouteReconcileLoop{ctrl: ctrl} + mock.recorder = &MockMulticlusterHTTPRouteReconcileLoopMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockMulticlusterHTTPRouteReconcileLoop) EXPECT() *MockMulticlusterHTTPRouteReconcileLoopMockRecorder { + return m.recorder +} + +// AddMulticlusterHTTPRouteReconciler mocks base method. +func (m *MockMulticlusterHTTPRouteReconcileLoop) AddMulticlusterHTTPRouteReconciler(ctx context.Context, rec controller.MulticlusterHTTPRouteReconciler, predicates ...predicate.Predicate) { + m.ctrl.T.Helper() + varargs := []interface{}{ctx, rec} + for _, a := range predicates { + varargs = append(varargs, a) + } + m.ctrl.Call(m, "AddMulticlusterHTTPRouteReconciler", varargs...) +} + +// AddMulticlusterHTTPRouteReconciler indicates an expected call of AddMulticlusterHTTPRouteReconciler. +func (mr *MockMulticlusterHTTPRouteReconcileLoopMockRecorder) AddMulticlusterHTTPRouteReconciler(ctx, rec interface{}, predicates ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{ctx, rec}, predicates...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddMulticlusterHTTPRouteReconciler", reflect.TypeOf((*MockMulticlusterHTTPRouteReconcileLoop)(nil).AddMulticlusterHTTPRouteReconciler), varargs...) +} diff --git a/pkg/api/k8s-gw/apis/gateway.networking.k8s.io/v1/controller/mocks/reconcilers.go b/pkg/api/k8s-gw/apis/gateway.networking.k8s.io/v1/controller/mocks/reconcilers.go new file mode 100644 index 0000000..25d007d --- /dev/null +++ b/pkg/api/k8s-gw/apis/gateway.networking.k8s.io/v1/controller/mocks/reconcilers.go @@ -0,0 +1,565 @@ +// Code generated by MockGen. DO NOT EDIT. +// Source: ./reconcilers.go + +// Package mock_controller is a generated GoMock package. +package mock_controller + +import ( + context "context" + reflect "reflect" + + gomock "github.com/golang/mock/gomock" + controller "github.com/solo-io/external-apis/pkg/api/k8s-gw/apis/gateway.networking.k8s.io/v1/controller" + reconcile "github.com/solo-io/skv2/pkg/reconcile" + predicate "sigs.k8s.io/controller-runtime/pkg/predicate" + v1 "sigs.k8s.io/gateway-api/apis/v1" +) + +// MockGatewayClassReconciler is a mock of GatewayClassReconciler interface. +type MockGatewayClassReconciler struct { + ctrl *gomock.Controller + recorder *MockGatewayClassReconcilerMockRecorder +} + +// MockGatewayClassReconcilerMockRecorder is the mock recorder for MockGatewayClassReconciler. +type MockGatewayClassReconcilerMockRecorder struct { + mock *MockGatewayClassReconciler +} + +// NewMockGatewayClassReconciler creates a new mock instance. +func NewMockGatewayClassReconciler(ctrl *gomock.Controller) *MockGatewayClassReconciler { + mock := &MockGatewayClassReconciler{ctrl: ctrl} + mock.recorder = &MockGatewayClassReconcilerMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockGatewayClassReconciler) EXPECT() *MockGatewayClassReconcilerMockRecorder { + return m.recorder +} + +// ReconcileGatewayClass mocks base method. +func (m *MockGatewayClassReconciler) ReconcileGatewayClass(obj *v1.GatewayClass) (reconcile.Result, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ReconcileGatewayClass", obj) + ret0, _ := ret[0].(reconcile.Result) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ReconcileGatewayClass indicates an expected call of ReconcileGatewayClass. +func (mr *MockGatewayClassReconcilerMockRecorder) ReconcileGatewayClass(obj interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ReconcileGatewayClass", reflect.TypeOf((*MockGatewayClassReconciler)(nil).ReconcileGatewayClass), obj) +} + +// MockGatewayClassDeletionReconciler is a mock of GatewayClassDeletionReconciler interface. +type MockGatewayClassDeletionReconciler struct { + ctrl *gomock.Controller + recorder *MockGatewayClassDeletionReconcilerMockRecorder +} + +// MockGatewayClassDeletionReconcilerMockRecorder is the mock recorder for MockGatewayClassDeletionReconciler. +type MockGatewayClassDeletionReconcilerMockRecorder struct { + mock *MockGatewayClassDeletionReconciler +} + +// NewMockGatewayClassDeletionReconciler creates a new mock instance. +func NewMockGatewayClassDeletionReconciler(ctrl *gomock.Controller) *MockGatewayClassDeletionReconciler { + mock := &MockGatewayClassDeletionReconciler{ctrl: ctrl} + mock.recorder = &MockGatewayClassDeletionReconcilerMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockGatewayClassDeletionReconciler) EXPECT() *MockGatewayClassDeletionReconcilerMockRecorder { + return m.recorder +} + +// ReconcileGatewayClassDeletion mocks base method. +func (m *MockGatewayClassDeletionReconciler) ReconcileGatewayClassDeletion(req reconcile.Request) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ReconcileGatewayClassDeletion", req) + ret0, _ := ret[0].(error) + return ret0 +} + +// ReconcileGatewayClassDeletion indicates an expected call of ReconcileGatewayClassDeletion. +func (mr *MockGatewayClassDeletionReconcilerMockRecorder) ReconcileGatewayClassDeletion(req interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ReconcileGatewayClassDeletion", reflect.TypeOf((*MockGatewayClassDeletionReconciler)(nil).ReconcileGatewayClassDeletion), req) +} + +// MockGatewayClassFinalizer is a mock of GatewayClassFinalizer interface. +type MockGatewayClassFinalizer struct { + ctrl *gomock.Controller + recorder *MockGatewayClassFinalizerMockRecorder +} + +// MockGatewayClassFinalizerMockRecorder is the mock recorder for MockGatewayClassFinalizer. +type MockGatewayClassFinalizerMockRecorder struct { + mock *MockGatewayClassFinalizer +} + +// NewMockGatewayClassFinalizer creates a new mock instance. +func NewMockGatewayClassFinalizer(ctrl *gomock.Controller) *MockGatewayClassFinalizer { + mock := &MockGatewayClassFinalizer{ctrl: ctrl} + mock.recorder = &MockGatewayClassFinalizerMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockGatewayClassFinalizer) EXPECT() *MockGatewayClassFinalizerMockRecorder { + return m.recorder +} + +// FinalizeGatewayClass mocks base method. +func (m *MockGatewayClassFinalizer) FinalizeGatewayClass(obj *v1.GatewayClass) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "FinalizeGatewayClass", obj) + ret0, _ := ret[0].(error) + return ret0 +} + +// FinalizeGatewayClass indicates an expected call of FinalizeGatewayClass. +func (mr *MockGatewayClassFinalizerMockRecorder) FinalizeGatewayClass(obj interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "FinalizeGatewayClass", reflect.TypeOf((*MockGatewayClassFinalizer)(nil).FinalizeGatewayClass), obj) +} + +// GatewayClassFinalizerName mocks base method. +func (m *MockGatewayClassFinalizer) GatewayClassFinalizerName() string { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GatewayClassFinalizerName") + ret0, _ := ret[0].(string) + return ret0 +} + +// GatewayClassFinalizerName indicates an expected call of GatewayClassFinalizerName. +func (mr *MockGatewayClassFinalizerMockRecorder) GatewayClassFinalizerName() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GatewayClassFinalizerName", reflect.TypeOf((*MockGatewayClassFinalizer)(nil).GatewayClassFinalizerName)) +} + +// ReconcileGatewayClass mocks base method. +func (m *MockGatewayClassFinalizer) ReconcileGatewayClass(obj *v1.GatewayClass) (reconcile.Result, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ReconcileGatewayClass", obj) + ret0, _ := ret[0].(reconcile.Result) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ReconcileGatewayClass indicates an expected call of ReconcileGatewayClass. +func (mr *MockGatewayClassFinalizerMockRecorder) ReconcileGatewayClass(obj interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ReconcileGatewayClass", reflect.TypeOf((*MockGatewayClassFinalizer)(nil).ReconcileGatewayClass), obj) +} + +// MockGatewayClassReconcileLoop is a mock of GatewayClassReconcileLoop interface. +type MockGatewayClassReconcileLoop struct { + ctrl *gomock.Controller + recorder *MockGatewayClassReconcileLoopMockRecorder +} + +// MockGatewayClassReconcileLoopMockRecorder is the mock recorder for MockGatewayClassReconcileLoop. +type MockGatewayClassReconcileLoopMockRecorder struct { + mock *MockGatewayClassReconcileLoop +} + +// NewMockGatewayClassReconcileLoop creates a new mock instance. +func NewMockGatewayClassReconcileLoop(ctrl *gomock.Controller) *MockGatewayClassReconcileLoop { + mock := &MockGatewayClassReconcileLoop{ctrl: ctrl} + mock.recorder = &MockGatewayClassReconcileLoopMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockGatewayClassReconcileLoop) EXPECT() *MockGatewayClassReconcileLoopMockRecorder { + return m.recorder +} + +// RunGatewayClassReconciler mocks base method. +func (m *MockGatewayClassReconcileLoop) RunGatewayClassReconciler(ctx context.Context, rec controller.GatewayClassReconciler, predicates ...predicate.Predicate) error { + m.ctrl.T.Helper() + varargs := []interface{}{ctx, rec} + for _, a := range predicates { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "RunGatewayClassReconciler", varargs...) + ret0, _ := ret[0].(error) + return ret0 +} + +// RunGatewayClassReconciler indicates an expected call of RunGatewayClassReconciler. +func (mr *MockGatewayClassReconcileLoopMockRecorder) RunGatewayClassReconciler(ctx, rec interface{}, predicates ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{ctx, rec}, predicates...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RunGatewayClassReconciler", reflect.TypeOf((*MockGatewayClassReconcileLoop)(nil).RunGatewayClassReconciler), varargs...) +} + +// MockGatewayReconciler is a mock of GatewayReconciler interface. +type MockGatewayReconciler struct { + ctrl *gomock.Controller + recorder *MockGatewayReconcilerMockRecorder +} + +// MockGatewayReconcilerMockRecorder is the mock recorder for MockGatewayReconciler. +type MockGatewayReconcilerMockRecorder struct { + mock *MockGatewayReconciler +} + +// NewMockGatewayReconciler creates a new mock instance. +func NewMockGatewayReconciler(ctrl *gomock.Controller) *MockGatewayReconciler { + mock := &MockGatewayReconciler{ctrl: ctrl} + mock.recorder = &MockGatewayReconcilerMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockGatewayReconciler) EXPECT() *MockGatewayReconcilerMockRecorder { + return m.recorder +} + +// ReconcileGateway mocks base method. +func (m *MockGatewayReconciler) ReconcileGateway(obj *v1.Gateway) (reconcile.Result, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ReconcileGateway", obj) + ret0, _ := ret[0].(reconcile.Result) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ReconcileGateway indicates an expected call of ReconcileGateway. +func (mr *MockGatewayReconcilerMockRecorder) ReconcileGateway(obj interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ReconcileGateway", reflect.TypeOf((*MockGatewayReconciler)(nil).ReconcileGateway), obj) +} + +// MockGatewayDeletionReconciler is a mock of GatewayDeletionReconciler interface. +type MockGatewayDeletionReconciler struct { + ctrl *gomock.Controller + recorder *MockGatewayDeletionReconcilerMockRecorder +} + +// MockGatewayDeletionReconcilerMockRecorder is the mock recorder for MockGatewayDeletionReconciler. +type MockGatewayDeletionReconcilerMockRecorder struct { + mock *MockGatewayDeletionReconciler +} + +// NewMockGatewayDeletionReconciler creates a new mock instance. +func NewMockGatewayDeletionReconciler(ctrl *gomock.Controller) *MockGatewayDeletionReconciler { + mock := &MockGatewayDeletionReconciler{ctrl: ctrl} + mock.recorder = &MockGatewayDeletionReconcilerMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockGatewayDeletionReconciler) EXPECT() *MockGatewayDeletionReconcilerMockRecorder { + return m.recorder +} + +// ReconcileGatewayDeletion mocks base method. +func (m *MockGatewayDeletionReconciler) ReconcileGatewayDeletion(req reconcile.Request) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ReconcileGatewayDeletion", req) + ret0, _ := ret[0].(error) + return ret0 +} + +// ReconcileGatewayDeletion indicates an expected call of ReconcileGatewayDeletion. +func (mr *MockGatewayDeletionReconcilerMockRecorder) ReconcileGatewayDeletion(req interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ReconcileGatewayDeletion", reflect.TypeOf((*MockGatewayDeletionReconciler)(nil).ReconcileGatewayDeletion), req) +} + +// MockGatewayFinalizer is a mock of GatewayFinalizer interface. +type MockGatewayFinalizer struct { + ctrl *gomock.Controller + recorder *MockGatewayFinalizerMockRecorder +} + +// MockGatewayFinalizerMockRecorder is the mock recorder for MockGatewayFinalizer. +type MockGatewayFinalizerMockRecorder struct { + mock *MockGatewayFinalizer +} + +// NewMockGatewayFinalizer creates a new mock instance. +func NewMockGatewayFinalizer(ctrl *gomock.Controller) *MockGatewayFinalizer { + mock := &MockGatewayFinalizer{ctrl: ctrl} + mock.recorder = &MockGatewayFinalizerMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockGatewayFinalizer) EXPECT() *MockGatewayFinalizerMockRecorder { + return m.recorder +} + +// FinalizeGateway mocks base method. +func (m *MockGatewayFinalizer) FinalizeGateway(obj *v1.Gateway) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "FinalizeGateway", obj) + ret0, _ := ret[0].(error) + return ret0 +} + +// FinalizeGateway indicates an expected call of FinalizeGateway. +func (mr *MockGatewayFinalizerMockRecorder) FinalizeGateway(obj interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "FinalizeGateway", reflect.TypeOf((*MockGatewayFinalizer)(nil).FinalizeGateway), obj) +} + +// GatewayFinalizerName mocks base method. +func (m *MockGatewayFinalizer) GatewayFinalizerName() string { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GatewayFinalizerName") + ret0, _ := ret[0].(string) + return ret0 +} + +// GatewayFinalizerName indicates an expected call of GatewayFinalizerName. +func (mr *MockGatewayFinalizerMockRecorder) GatewayFinalizerName() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GatewayFinalizerName", reflect.TypeOf((*MockGatewayFinalizer)(nil).GatewayFinalizerName)) +} + +// ReconcileGateway mocks base method. +func (m *MockGatewayFinalizer) ReconcileGateway(obj *v1.Gateway) (reconcile.Result, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ReconcileGateway", obj) + ret0, _ := ret[0].(reconcile.Result) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ReconcileGateway indicates an expected call of ReconcileGateway. +func (mr *MockGatewayFinalizerMockRecorder) ReconcileGateway(obj interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ReconcileGateway", reflect.TypeOf((*MockGatewayFinalizer)(nil).ReconcileGateway), obj) +} + +// MockGatewayReconcileLoop is a mock of GatewayReconcileLoop interface. +type MockGatewayReconcileLoop struct { + ctrl *gomock.Controller + recorder *MockGatewayReconcileLoopMockRecorder +} + +// MockGatewayReconcileLoopMockRecorder is the mock recorder for MockGatewayReconcileLoop. +type MockGatewayReconcileLoopMockRecorder struct { + mock *MockGatewayReconcileLoop +} + +// NewMockGatewayReconcileLoop creates a new mock instance. +func NewMockGatewayReconcileLoop(ctrl *gomock.Controller) *MockGatewayReconcileLoop { + mock := &MockGatewayReconcileLoop{ctrl: ctrl} + mock.recorder = &MockGatewayReconcileLoopMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockGatewayReconcileLoop) EXPECT() *MockGatewayReconcileLoopMockRecorder { + return m.recorder +} + +// RunGatewayReconciler mocks base method. +func (m *MockGatewayReconcileLoop) RunGatewayReconciler(ctx context.Context, rec controller.GatewayReconciler, predicates ...predicate.Predicate) error { + m.ctrl.T.Helper() + varargs := []interface{}{ctx, rec} + for _, a := range predicates { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "RunGatewayReconciler", varargs...) + ret0, _ := ret[0].(error) + return ret0 +} + +// RunGatewayReconciler indicates an expected call of RunGatewayReconciler. +func (mr *MockGatewayReconcileLoopMockRecorder) RunGatewayReconciler(ctx, rec interface{}, predicates ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{ctx, rec}, predicates...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RunGatewayReconciler", reflect.TypeOf((*MockGatewayReconcileLoop)(nil).RunGatewayReconciler), varargs...) +} + +// MockHTTPRouteReconciler is a mock of HTTPRouteReconciler interface. +type MockHTTPRouteReconciler struct { + ctrl *gomock.Controller + recorder *MockHTTPRouteReconcilerMockRecorder +} + +// MockHTTPRouteReconcilerMockRecorder is the mock recorder for MockHTTPRouteReconciler. +type MockHTTPRouteReconcilerMockRecorder struct { + mock *MockHTTPRouteReconciler +} + +// NewMockHTTPRouteReconciler creates a new mock instance. +func NewMockHTTPRouteReconciler(ctrl *gomock.Controller) *MockHTTPRouteReconciler { + mock := &MockHTTPRouteReconciler{ctrl: ctrl} + mock.recorder = &MockHTTPRouteReconcilerMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockHTTPRouteReconciler) EXPECT() *MockHTTPRouteReconcilerMockRecorder { + return m.recorder +} + +// ReconcileHTTPRoute mocks base method. +func (m *MockHTTPRouteReconciler) ReconcileHTTPRoute(obj *v1.HTTPRoute) (reconcile.Result, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ReconcileHTTPRoute", obj) + ret0, _ := ret[0].(reconcile.Result) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ReconcileHTTPRoute indicates an expected call of ReconcileHTTPRoute. +func (mr *MockHTTPRouteReconcilerMockRecorder) ReconcileHTTPRoute(obj interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ReconcileHTTPRoute", reflect.TypeOf((*MockHTTPRouteReconciler)(nil).ReconcileHTTPRoute), obj) +} + +// MockHTTPRouteDeletionReconciler is a mock of HTTPRouteDeletionReconciler interface. +type MockHTTPRouteDeletionReconciler struct { + ctrl *gomock.Controller + recorder *MockHTTPRouteDeletionReconcilerMockRecorder +} + +// MockHTTPRouteDeletionReconcilerMockRecorder is the mock recorder for MockHTTPRouteDeletionReconciler. +type MockHTTPRouteDeletionReconcilerMockRecorder struct { + mock *MockHTTPRouteDeletionReconciler +} + +// NewMockHTTPRouteDeletionReconciler creates a new mock instance. +func NewMockHTTPRouteDeletionReconciler(ctrl *gomock.Controller) *MockHTTPRouteDeletionReconciler { + mock := &MockHTTPRouteDeletionReconciler{ctrl: ctrl} + mock.recorder = &MockHTTPRouteDeletionReconcilerMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockHTTPRouteDeletionReconciler) EXPECT() *MockHTTPRouteDeletionReconcilerMockRecorder { + return m.recorder +} + +// ReconcileHTTPRouteDeletion mocks base method. +func (m *MockHTTPRouteDeletionReconciler) ReconcileHTTPRouteDeletion(req reconcile.Request) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ReconcileHTTPRouteDeletion", req) + ret0, _ := ret[0].(error) + return ret0 +} + +// ReconcileHTTPRouteDeletion indicates an expected call of ReconcileHTTPRouteDeletion. +func (mr *MockHTTPRouteDeletionReconcilerMockRecorder) ReconcileHTTPRouteDeletion(req interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ReconcileHTTPRouteDeletion", reflect.TypeOf((*MockHTTPRouteDeletionReconciler)(nil).ReconcileHTTPRouteDeletion), req) +} + +// MockHTTPRouteFinalizer is a mock of HTTPRouteFinalizer interface. +type MockHTTPRouteFinalizer struct { + ctrl *gomock.Controller + recorder *MockHTTPRouteFinalizerMockRecorder +} + +// MockHTTPRouteFinalizerMockRecorder is the mock recorder for MockHTTPRouteFinalizer. +type MockHTTPRouteFinalizerMockRecorder struct { + mock *MockHTTPRouteFinalizer +} + +// NewMockHTTPRouteFinalizer creates a new mock instance. +func NewMockHTTPRouteFinalizer(ctrl *gomock.Controller) *MockHTTPRouteFinalizer { + mock := &MockHTTPRouteFinalizer{ctrl: ctrl} + mock.recorder = &MockHTTPRouteFinalizerMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockHTTPRouteFinalizer) EXPECT() *MockHTTPRouteFinalizerMockRecorder { + return m.recorder +} + +// FinalizeHTTPRoute mocks base method. +func (m *MockHTTPRouteFinalizer) FinalizeHTTPRoute(obj *v1.HTTPRoute) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "FinalizeHTTPRoute", obj) + ret0, _ := ret[0].(error) + return ret0 +} + +// FinalizeHTTPRoute indicates an expected call of FinalizeHTTPRoute. +func (mr *MockHTTPRouteFinalizerMockRecorder) FinalizeHTTPRoute(obj interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "FinalizeHTTPRoute", reflect.TypeOf((*MockHTTPRouteFinalizer)(nil).FinalizeHTTPRoute), obj) +} + +// HTTPRouteFinalizerName mocks base method. +func (m *MockHTTPRouteFinalizer) HTTPRouteFinalizerName() string { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "HTTPRouteFinalizerName") + ret0, _ := ret[0].(string) + return ret0 +} + +// HTTPRouteFinalizerName indicates an expected call of HTTPRouteFinalizerName. +func (mr *MockHTTPRouteFinalizerMockRecorder) HTTPRouteFinalizerName() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "HTTPRouteFinalizerName", reflect.TypeOf((*MockHTTPRouteFinalizer)(nil).HTTPRouteFinalizerName)) +} + +// ReconcileHTTPRoute mocks base method. +func (m *MockHTTPRouteFinalizer) ReconcileHTTPRoute(obj *v1.HTTPRoute) (reconcile.Result, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ReconcileHTTPRoute", obj) + ret0, _ := ret[0].(reconcile.Result) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ReconcileHTTPRoute indicates an expected call of ReconcileHTTPRoute. +func (mr *MockHTTPRouteFinalizerMockRecorder) ReconcileHTTPRoute(obj interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ReconcileHTTPRoute", reflect.TypeOf((*MockHTTPRouteFinalizer)(nil).ReconcileHTTPRoute), obj) +} + +// MockHTTPRouteReconcileLoop is a mock of HTTPRouteReconcileLoop interface. +type MockHTTPRouteReconcileLoop struct { + ctrl *gomock.Controller + recorder *MockHTTPRouteReconcileLoopMockRecorder +} + +// MockHTTPRouteReconcileLoopMockRecorder is the mock recorder for MockHTTPRouteReconcileLoop. +type MockHTTPRouteReconcileLoopMockRecorder struct { + mock *MockHTTPRouteReconcileLoop +} + +// NewMockHTTPRouteReconcileLoop creates a new mock instance. +func NewMockHTTPRouteReconcileLoop(ctrl *gomock.Controller) *MockHTTPRouteReconcileLoop { + mock := &MockHTTPRouteReconcileLoop{ctrl: ctrl} + mock.recorder = &MockHTTPRouteReconcileLoopMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockHTTPRouteReconcileLoop) EXPECT() *MockHTTPRouteReconcileLoopMockRecorder { + return m.recorder +} + +// RunHTTPRouteReconciler mocks base method. +func (m *MockHTTPRouteReconcileLoop) RunHTTPRouteReconciler(ctx context.Context, rec controller.HTTPRouteReconciler, predicates ...predicate.Predicate) error { + m.ctrl.T.Helper() + varargs := []interface{}{ctx, rec} + for _, a := range predicates { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "RunHTTPRouteReconciler", varargs...) + ret0, _ := ret[0].(error) + return ret0 +} + +// RunHTTPRouteReconciler indicates an expected call of RunHTTPRouteReconciler. +func (mr *MockHTTPRouteReconcileLoopMockRecorder) RunHTTPRouteReconciler(ctx, rec interface{}, predicates ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{ctx, rec}, predicates...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RunHTTPRouteReconciler", reflect.TypeOf((*MockHTTPRouteReconcileLoop)(nil).RunHTTPRouteReconciler), varargs...) +} diff --git a/pkg/api/k8s-gw/apis/gateway.networking.k8s.io/v1/controller/multicluster_reconcilers.go b/pkg/api/k8s-gw/apis/gateway.networking.k8s.io/v1/controller/multicluster_reconcilers.go new file mode 100644 index 0000000..022f3a0 --- /dev/null +++ b/pkg/api/k8s-gw/apis/gateway.networking.k8s.io/v1/controller/multicluster_reconcilers.go @@ -0,0 +1,232 @@ +// Code generated by skv2. DO NOT EDIT. + +//go:generate mockgen -source ./multicluster_reconcilers.go -destination mocks/multicluster_reconcilers.go + +// Definitions for the multicluster Kubernetes Controllers +package controller + +import ( + "context" + + gateway_networking_k8s_io_v1 "sigs.k8s.io/gateway-api/apis/v1" + + "github.com/pkg/errors" + "github.com/solo-io/skv2/pkg/ezkube" + "github.com/solo-io/skv2/pkg/multicluster" + mc_reconcile "github.com/solo-io/skv2/pkg/multicluster/reconcile" + "github.com/solo-io/skv2/pkg/reconcile" + "sigs.k8s.io/controller-runtime/pkg/predicate" +) + +// Reconcile Upsert events for the GatewayClass Resource across clusters. +// implemented by the user +type MulticlusterGatewayClassReconciler interface { + ReconcileGatewayClass(clusterName string, obj *gateway_networking_k8s_io_v1.GatewayClass) (reconcile.Result, error) +} + +// Reconcile deletion events for the GatewayClass Resource across clusters. +// Deletion receives a reconcile.Request as we cannot guarantee the last state of the object +// before being deleted. +// implemented by the user +type MulticlusterGatewayClassDeletionReconciler interface { + ReconcileGatewayClassDeletion(clusterName string, req reconcile.Request) error +} + +type MulticlusterGatewayClassReconcilerFuncs struct { + OnReconcileGatewayClass func(clusterName string, obj *gateway_networking_k8s_io_v1.GatewayClass) (reconcile.Result, error) + OnReconcileGatewayClassDeletion func(clusterName string, req reconcile.Request) error +} + +func (f *MulticlusterGatewayClassReconcilerFuncs) ReconcileGatewayClass(clusterName string, obj *gateway_networking_k8s_io_v1.GatewayClass) (reconcile.Result, error) { + if f.OnReconcileGatewayClass == nil { + return reconcile.Result{}, nil + } + return f.OnReconcileGatewayClass(clusterName, obj) +} + +func (f *MulticlusterGatewayClassReconcilerFuncs) ReconcileGatewayClassDeletion(clusterName string, req reconcile.Request) error { + if f.OnReconcileGatewayClassDeletion == nil { + return nil + } + return f.OnReconcileGatewayClassDeletion(clusterName, req) +} + +type MulticlusterGatewayClassReconcileLoop interface { + // AddMulticlusterGatewayClassReconciler adds a MulticlusterGatewayClassReconciler to the MulticlusterGatewayClassReconcileLoop. + AddMulticlusterGatewayClassReconciler(ctx context.Context, rec MulticlusterGatewayClassReconciler, predicates ...predicate.Predicate) +} + +type multiclusterGatewayClassReconcileLoop struct { + loop multicluster.Loop +} + +func (m *multiclusterGatewayClassReconcileLoop) AddMulticlusterGatewayClassReconciler(ctx context.Context, rec MulticlusterGatewayClassReconciler, predicates ...predicate.Predicate) { + genericReconciler := genericGatewayClassMulticlusterReconciler{reconciler: rec} + + m.loop.AddReconciler(ctx, genericReconciler, predicates...) +} + +func NewMulticlusterGatewayClassReconcileLoop(name string, cw multicluster.ClusterWatcher, options reconcile.Options) MulticlusterGatewayClassReconcileLoop { + return &multiclusterGatewayClassReconcileLoop{loop: mc_reconcile.NewLoop(name, cw, &gateway_networking_k8s_io_v1.GatewayClass{}, options)} +} + +type genericGatewayClassMulticlusterReconciler struct { + reconciler MulticlusterGatewayClassReconciler +} + +func (g genericGatewayClassMulticlusterReconciler) ReconcileDeletion(cluster string, req reconcile.Request) error { + if deletionReconciler, ok := g.reconciler.(MulticlusterGatewayClassDeletionReconciler); ok { + return deletionReconciler.ReconcileGatewayClassDeletion(cluster, req) + } + return nil +} + +func (g genericGatewayClassMulticlusterReconciler) Reconcile(cluster string, object ezkube.Object) (reconcile.Result, error) { + obj, ok := object.(*gateway_networking_k8s_io_v1.GatewayClass) + if !ok { + return reconcile.Result{}, errors.Errorf("internal error: GatewayClass handler received event for %T", object) + } + return g.reconciler.ReconcileGatewayClass(cluster, obj) +} + +// Reconcile Upsert events for the Gateway Resource across clusters. +// implemented by the user +type MulticlusterGatewayReconciler interface { + ReconcileGateway(clusterName string, obj *gateway_networking_k8s_io_v1.Gateway) (reconcile.Result, error) +} + +// Reconcile deletion events for the Gateway Resource across clusters. +// Deletion receives a reconcile.Request as we cannot guarantee the last state of the object +// before being deleted. +// implemented by the user +type MulticlusterGatewayDeletionReconciler interface { + ReconcileGatewayDeletion(clusterName string, req reconcile.Request) error +} + +type MulticlusterGatewayReconcilerFuncs struct { + OnReconcileGateway func(clusterName string, obj *gateway_networking_k8s_io_v1.Gateway) (reconcile.Result, error) + OnReconcileGatewayDeletion func(clusterName string, req reconcile.Request) error +} + +func (f *MulticlusterGatewayReconcilerFuncs) ReconcileGateway(clusterName string, obj *gateway_networking_k8s_io_v1.Gateway) (reconcile.Result, error) { + if f.OnReconcileGateway == nil { + return reconcile.Result{}, nil + } + return f.OnReconcileGateway(clusterName, obj) +} + +func (f *MulticlusterGatewayReconcilerFuncs) ReconcileGatewayDeletion(clusterName string, req reconcile.Request) error { + if f.OnReconcileGatewayDeletion == nil { + return nil + } + return f.OnReconcileGatewayDeletion(clusterName, req) +} + +type MulticlusterGatewayReconcileLoop interface { + // AddMulticlusterGatewayReconciler adds a MulticlusterGatewayReconciler to the MulticlusterGatewayReconcileLoop. + AddMulticlusterGatewayReconciler(ctx context.Context, rec MulticlusterGatewayReconciler, predicates ...predicate.Predicate) +} + +type multiclusterGatewayReconcileLoop struct { + loop multicluster.Loop +} + +func (m *multiclusterGatewayReconcileLoop) AddMulticlusterGatewayReconciler(ctx context.Context, rec MulticlusterGatewayReconciler, predicates ...predicate.Predicate) { + genericReconciler := genericGatewayMulticlusterReconciler{reconciler: rec} + + m.loop.AddReconciler(ctx, genericReconciler, predicates...) +} + +func NewMulticlusterGatewayReconcileLoop(name string, cw multicluster.ClusterWatcher, options reconcile.Options) MulticlusterGatewayReconcileLoop { + return &multiclusterGatewayReconcileLoop{loop: mc_reconcile.NewLoop(name, cw, &gateway_networking_k8s_io_v1.Gateway{}, options)} +} + +type genericGatewayMulticlusterReconciler struct { + reconciler MulticlusterGatewayReconciler +} + +func (g genericGatewayMulticlusterReconciler) ReconcileDeletion(cluster string, req reconcile.Request) error { + if deletionReconciler, ok := g.reconciler.(MulticlusterGatewayDeletionReconciler); ok { + return deletionReconciler.ReconcileGatewayDeletion(cluster, req) + } + return nil +} + +func (g genericGatewayMulticlusterReconciler) Reconcile(cluster string, object ezkube.Object) (reconcile.Result, error) { + obj, ok := object.(*gateway_networking_k8s_io_v1.Gateway) + if !ok { + return reconcile.Result{}, errors.Errorf("internal error: Gateway handler received event for %T", object) + } + return g.reconciler.ReconcileGateway(cluster, obj) +} + +// Reconcile Upsert events for the HTTPRoute Resource across clusters. +// implemented by the user +type MulticlusterHTTPRouteReconciler interface { + ReconcileHTTPRoute(clusterName string, obj *gateway_networking_k8s_io_v1.HTTPRoute) (reconcile.Result, error) +} + +// Reconcile deletion events for the HTTPRoute Resource across clusters. +// Deletion receives a reconcile.Request as we cannot guarantee the last state of the object +// before being deleted. +// implemented by the user +type MulticlusterHTTPRouteDeletionReconciler interface { + ReconcileHTTPRouteDeletion(clusterName string, req reconcile.Request) error +} + +type MulticlusterHTTPRouteReconcilerFuncs struct { + OnReconcileHTTPRoute func(clusterName string, obj *gateway_networking_k8s_io_v1.HTTPRoute) (reconcile.Result, error) + OnReconcileHTTPRouteDeletion func(clusterName string, req reconcile.Request) error +} + +func (f *MulticlusterHTTPRouteReconcilerFuncs) ReconcileHTTPRoute(clusterName string, obj *gateway_networking_k8s_io_v1.HTTPRoute) (reconcile.Result, error) { + if f.OnReconcileHTTPRoute == nil { + return reconcile.Result{}, nil + } + return f.OnReconcileHTTPRoute(clusterName, obj) +} + +func (f *MulticlusterHTTPRouteReconcilerFuncs) ReconcileHTTPRouteDeletion(clusterName string, req reconcile.Request) error { + if f.OnReconcileHTTPRouteDeletion == nil { + return nil + } + return f.OnReconcileHTTPRouteDeletion(clusterName, req) +} + +type MulticlusterHTTPRouteReconcileLoop interface { + // AddMulticlusterHTTPRouteReconciler adds a MulticlusterHTTPRouteReconciler to the MulticlusterHTTPRouteReconcileLoop. + AddMulticlusterHTTPRouteReconciler(ctx context.Context, rec MulticlusterHTTPRouteReconciler, predicates ...predicate.Predicate) +} + +type multiclusterHTTPRouteReconcileLoop struct { + loop multicluster.Loop +} + +func (m *multiclusterHTTPRouteReconcileLoop) AddMulticlusterHTTPRouteReconciler(ctx context.Context, rec MulticlusterHTTPRouteReconciler, predicates ...predicate.Predicate) { + genericReconciler := genericHTTPRouteMulticlusterReconciler{reconciler: rec} + + m.loop.AddReconciler(ctx, genericReconciler, predicates...) +} + +func NewMulticlusterHTTPRouteReconcileLoop(name string, cw multicluster.ClusterWatcher, options reconcile.Options) MulticlusterHTTPRouteReconcileLoop { + return &multiclusterHTTPRouteReconcileLoop{loop: mc_reconcile.NewLoop(name, cw, &gateway_networking_k8s_io_v1.HTTPRoute{}, options)} +} + +type genericHTTPRouteMulticlusterReconciler struct { + reconciler MulticlusterHTTPRouteReconciler +} + +func (g genericHTTPRouteMulticlusterReconciler) ReconcileDeletion(cluster string, req reconcile.Request) error { + if deletionReconciler, ok := g.reconciler.(MulticlusterHTTPRouteDeletionReconciler); ok { + return deletionReconciler.ReconcileHTTPRouteDeletion(cluster, req) + } + return nil +} + +func (g genericHTTPRouteMulticlusterReconciler) Reconcile(cluster string, object ezkube.Object) (reconcile.Result, error) { + obj, ok := object.(*gateway_networking_k8s_io_v1.HTTPRoute) + if !ok { + return reconcile.Result{}, errors.Errorf("internal error: HTTPRoute handler received event for %T", object) + } + return g.reconciler.ReconcileHTTPRoute(cluster, obj) +} diff --git a/pkg/api/k8s-gw/apis/gateway.networking.k8s.io/v1/controller/reconcilers.go b/pkg/api/k8s-gw/apis/gateway.networking.k8s.io/v1/controller/reconcilers.go new file mode 100644 index 0000000..053a749 --- /dev/null +++ b/pkg/api/k8s-gw/apis/gateway.networking.k8s.io/v1/controller/reconcilers.go @@ -0,0 +1,369 @@ +// Code generated by skv2. DO NOT EDIT. + +//go:generate mockgen -source ./reconcilers.go -destination mocks/reconcilers.go + +// Definitions for the Kubernetes Controllers +package controller + +import ( + "context" + + gateway_networking_k8s_io_v1 "sigs.k8s.io/gateway-api/apis/v1" + + "github.com/pkg/errors" + "github.com/solo-io/skv2/pkg/ezkube" + "github.com/solo-io/skv2/pkg/reconcile" + "sigs.k8s.io/controller-runtime/pkg/manager" + "sigs.k8s.io/controller-runtime/pkg/predicate" +) + +// Reconcile Upsert events for the GatewayClass Resource. +// implemented by the user +type GatewayClassReconciler interface { + ReconcileGatewayClass(obj *gateway_networking_k8s_io_v1.GatewayClass) (reconcile.Result, error) +} + +// Reconcile deletion events for the GatewayClass Resource. +// Deletion receives a reconcile.Request as we cannot guarantee the last state of the object +// before being deleted. +// implemented by the user +type GatewayClassDeletionReconciler interface { + ReconcileGatewayClassDeletion(req reconcile.Request) error +} + +type GatewayClassReconcilerFuncs struct { + OnReconcileGatewayClass func(obj *gateway_networking_k8s_io_v1.GatewayClass) (reconcile.Result, error) + OnReconcileGatewayClassDeletion func(req reconcile.Request) error +} + +func (f *GatewayClassReconcilerFuncs) ReconcileGatewayClass(obj *gateway_networking_k8s_io_v1.GatewayClass) (reconcile.Result, error) { + if f.OnReconcileGatewayClass == nil { + return reconcile.Result{}, nil + } + return f.OnReconcileGatewayClass(obj) +} + +func (f *GatewayClassReconcilerFuncs) ReconcileGatewayClassDeletion(req reconcile.Request) error { + if f.OnReconcileGatewayClassDeletion == nil { + return nil + } + return f.OnReconcileGatewayClassDeletion(req) +} + +// Reconcile and finalize the GatewayClass Resource +// implemented by the user +type GatewayClassFinalizer interface { + GatewayClassReconciler + + // name of the finalizer used by this handler. + // finalizer names should be unique for a single task + GatewayClassFinalizerName() string + + // finalize the object before it is deleted. + // Watchers created with a finalizing handler will a + FinalizeGatewayClass(obj *gateway_networking_k8s_io_v1.GatewayClass) error +} + +type GatewayClassReconcileLoop interface { + RunGatewayClassReconciler(ctx context.Context, rec GatewayClassReconciler, predicates ...predicate.Predicate) error +} + +type gatewayClassReconcileLoop struct { + loop reconcile.Loop +} + +func NewGatewayClassReconcileLoop(name string, mgr manager.Manager, options reconcile.Options) GatewayClassReconcileLoop { + return &gatewayClassReconcileLoop{ + // empty cluster indicates this reconciler is built for the local cluster + loop: reconcile.NewLoop(name, "", mgr, &gateway_networking_k8s_io_v1.GatewayClass{}, options), + } +} + +func (c *gatewayClassReconcileLoop) RunGatewayClassReconciler(ctx context.Context, reconciler GatewayClassReconciler, predicates ...predicate.Predicate) error { + genericReconciler := genericGatewayClassReconciler{ + reconciler: reconciler, + } + + var reconcilerWrapper reconcile.Reconciler + if finalizingReconciler, ok := reconciler.(GatewayClassFinalizer); ok { + reconcilerWrapper = genericGatewayClassFinalizer{ + genericGatewayClassReconciler: genericReconciler, + finalizingReconciler: finalizingReconciler, + } + } else { + reconcilerWrapper = genericReconciler + } + return c.loop.RunReconciler(ctx, reconcilerWrapper, predicates...) +} + +// genericGatewayClassHandler implements a generic reconcile.Reconciler +type genericGatewayClassReconciler struct { + reconciler GatewayClassReconciler +} + +func (r genericGatewayClassReconciler) Reconcile(object ezkube.Object) (reconcile.Result, error) { + obj, ok := object.(*gateway_networking_k8s_io_v1.GatewayClass) + if !ok { + return reconcile.Result{}, errors.Errorf("internal error: GatewayClass handler received event for %T", object) + } + return r.reconciler.ReconcileGatewayClass(obj) +} + +func (r genericGatewayClassReconciler) ReconcileDeletion(request reconcile.Request) error { + if deletionReconciler, ok := r.reconciler.(GatewayClassDeletionReconciler); ok { + return deletionReconciler.ReconcileGatewayClassDeletion(request) + } + return nil +} + +// genericGatewayClassFinalizer implements a generic reconcile.FinalizingReconciler +type genericGatewayClassFinalizer struct { + genericGatewayClassReconciler + finalizingReconciler GatewayClassFinalizer +} + +func (r genericGatewayClassFinalizer) FinalizerName() string { + return r.finalizingReconciler.GatewayClassFinalizerName() +} + +func (r genericGatewayClassFinalizer) Finalize(object ezkube.Object) error { + obj, ok := object.(*gateway_networking_k8s_io_v1.GatewayClass) + if !ok { + return errors.Errorf("internal error: GatewayClass handler received event for %T", object) + } + return r.finalizingReconciler.FinalizeGatewayClass(obj) +} + +// Reconcile Upsert events for the Gateway Resource. +// implemented by the user +type GatewayReconciler interface { + ReconcileGateway(obj *gateway_networking_k8s_io_v1.Gateway) (reconcile.Result, error) +} + +// Reconcile deletion events for the Gateway Resource. +// Deletion receives a reconcile.Request as we cannot guarantee the last state of the object +// before being deleted. +// implemented by the user +type GatewayDeletionReconciler interface { + ReconcileGatewayDeletion(req reconcile.Request) error +} + +type GatewayReconcilerFuncs struct { + OnReconcileGateway func(obj *gateway_networking_k8s_io_v1.Gateway) (reconcile.Result, error) + OnReconcileGatewayDeletion func(req reconcile.Request) error +} + +func (f *GatewayReconcilerFuncs) ReconcileGateway(obj *gateway_networking_k8s_io_v1.Gateway) (reconcile.Result, error) { + if f.OnReconcileGateway == nil { + return reconcile.Result{}, nil + } + return f.OnReconcileGateway(obj) +} + +func (f *GatewayReconcilerFuncs) ReconcileGatewayDeletion(req reconcile.Request) error { + if f.OnReconcileGatewayDeletion == nil { + return nil + } + return f.OnReconcileGatewayDeletion(req) +} + +// Reconcile and finalize the Gateway Resource +// implemented by the user +type GatewayFinalizer interface { + GatewayReconciler + + // name of the finalizer used by this handler. + // finalizer names should be unique for a single task + GatewayFinalizerName() string + + // finalize the object before it is deleted. + // Watchers created with a finalizing handler will a + FinalizeGateway(obj *gateway_networking_k8s_io_v1.Gateway) error +} + +type GatewayReconcileLoop interface { + RunGatewayReconciler(ctx context.Context, rec GatewayReconciler, predicates ...predicate.Predicate) error +} + +type gatewayReconcileLoop struct { + loop reconcile.Loop +} + +func NewGatewayReconcileLoop(name string, mgr manager.Manager, options reconcile.Options) GatewayReconcileLoop { + return &gatewayReconcileLoop{ + // empty cluster indicates this reconciler is built for the local cluster + loop: reconcile.NewLoop(name, "", mgr, &gateway_networking_k8s_io_v1.Gateway{}, options), + } +} + +func (c *gatewayReconcileLoop) RunGatewayReconciler(ctx context.Context, reconciler GatewayReconciler, predicates ...predicate.Predicate) error { + genericReconciler := genericGatewayReconciler{ + reconciler: reconciler, + } + + var reconcilerWrapper reconcile.Reconciler + if finalizingReconciler, ok := reconciler.(GatewayFinalizer); ok { + reconcilerWrapper = genericGatewayFinalizer{ + genericGatewayReconciler: genericReconciler, + finalizingReconciler: finalizingReconciler, + } + } else { + reconcilerWrapper = genericReconciler + } + return c.loop.RunReconciler(ctx, reconcilerWrapper, predicates...) +} + +// genericGatewayHandler implements a generic reconcile.Reconciler +type genericGatewayReconciler struct { + reconciler GatewayReconciler +} + +func (r genericGatewayReconciler) Reconcile(object ezkube.Object) (reconcile.Result, error) { + obj, ok := object.(*gateway_networking_k8s_io_v1.Gateway) + if !ok { + return reconcile.Result{}, errors.Errorf("internal error: Gateway handler received event for %T", object) + } + return r.reconciler.ReconcileGateway(obj) +} + +func (r genericGatewayReconciler) ReconcileDeletion(request reconcile.Request) error { + if deletionReconciler, ok := r.reconciler.(GatewayDeletionReconciler); ok { + return deletionReconciler.ReconcileGatewayDeletion(request) + } + return nil +} + +// genericGatewayFinalizer implements a generic reconcile.FinalizingReconciler +type genericGatewayFinalizer struct { + genericGatewayReconciler + finalizingReconciler GatewayFinalizer +} + +func (r genericGatewayFinalizer) FinalizerName() string { + return r.finalizingReconciler.GatewayFinalizerName() +} + +func (r genericGatewayFinalizer) Finalize(object ezkube.Object) error { + obj, ok := object.(*gateway_networking_k8s_io_v1.Gateway) + if !ok { + return errors.Errorf("internal error: Gateway handler received event for %T", object) + } + return r.finalizingReconciler.FinalizeGateway(obj) +} + +// Reconcile Upsert events for the HTTPRoute Resource. +// implemented by the user +type HTTPRouteReconciler interface { + ReconcileHTTPRoute(obj *gateway_networking_k8s_io_v1.HTTPRoute) (reconcile.Result, error) +} + +// Reconcile deletion events for the HTTPRoute Resource. +// Deletion receives a reconcile.Request as we cannot guarantee the last state of the object +// before being deleted. +// implemented by the user +type HTTPRouteDeletionReconciler interface { + ReconcileHTTPRouteDeletion(req reconcile.Request) error +} + +type HTTPRouteReconcilerFuncs struct { + OnReconcileHTTPRoute func(obj *gateway_networking_k8s_io_v1.HTTPRoute) (reconcile.Result, error) + OnReconcileHTTPRouteDeletion func(req reconcile.Request) error +} + +func (f *HTTPRouteReconcilerFuncs) ReconcileHTTPRoute(obj *gateway_networking_k8s_io_v1.HTTPRoute) (reconcile.Result, error) { + if f.OnReconcileHTTPRoute == nil { + return reconcile.Result{}, nil + } + return f.OnReconcileHTTPRoute(obj) +} + +func (f *HTTPRouteReconcilerFuncs) ReconcileHTTPRouteDeletion(req reconcile.Request) error { + if f.OnReconcileHTTPRouteDeletion == nil { + return nil + } + return f.OnReconcileHTTPRouteDeletion(req) +} + +// Reconcile and finalize the HTTPRoute Resource +// implemented by the user +type HTTPRouteFinalizer interface { + HTTPRouteReconciler + + // name of the finalizer used by this handler. + // finalizer names should be unique for a single task + HTTPRouteFinalizerName() string + + // finalize the object before it is deleted. + // Watchers created with a finalizing handler will a + FinalizeHTTPRoute(obj *gateway_networking_k8s_io_v1.HTTPRoute) error +} + +type HTTPRouteReconcileLoop interface { + RunHTTPRouteReconciler(ctx context.Context, rec HTTPRouteReconciler, predicates ...predicate.Predicate) error +} + +type hTTPRouteReconcileLoop struct { + loop reconcile.Loop +} + +func NewHTTPRouteReconcileLoop(name string, mgr manager.Manager, options reconcile.Options) HTTPRouteReconcileLoop { + return &hTTPRouteReconcileLoop{ + // empty cluster indicates this reconciler is built for the local cluster + loop: reconcile.NewLoop(name, "", mgr, &gateway_networking_k8s_io_v1.HTTPRoute{}, options), + } +} + +func (c *hTTPRouteReconcileLoop) RunHTTPRouteReconciler(ctx context.Context, reconciler HTTPRouteReconciler, predicates ...predicate.Predicate) error { + genericReconciler := genericHTTPRouteReconciler{ + reconciler: reconciler, + } + + var reconcilerWrapper reconcile.Reconciler + if finalizingReconciler, ok := reconciler.(HTTPRouteFinalizer); ok { + reconcilerWrapper = genericHTTPRouteFinalizer{ + genericHTTPRouteReconciler: genericReconciler, + finalizingReconciler: finalizingReconciler, + } + } else { + reconcilerWrapper = genericReconciler + } + return c.loop.RunReconciler(ctx, reconcilerWrapper, predicates...) +} + +// genericHTTPRouteHandler implements a generic reconcile.Reconciler +type genericHTTPRouteReconciler struct { + reconciler HTTPRouteReconciler +} + +func (r genericHTTPRouteReconciler) Reconcile(object ezkube.Object) (reconcile.Result, error) { + obj, ok := object.(*gateway_networking_k8s_io_v1.HTTPRoute) + if !ok { + return reconcile.Result{}, errors.Errorf("internal error: HTTPRoute handler received event for %T", object) + } + return r.reconciler.ReconcileHTTPRoute(obj) +} + +func (r genericHTTPRouteReconciler) ReconcileDeletion(request reconcile.Request) error { + if deletionReconciler, ok := r.reconciler.(HTTPRouteDeletionReconciler); ok { + return deletionReconciler.ReconcileHTTPRouteDeletion(request) + } + return nil +} + +// genericHTTPRouteFinalizer implements a generic reconcile.FinalizingReconciler +type genericHTTPRouteFinalizer struct { + genericHTTPRouteReconciler + finalizingReconciler HTTPRouteFinalizer +} + +func (r genericHTTPRouteFinalizer) FinalizerName() string { + return r.finalizingReconciler.HTTPRouteFinalizerName() +} + +func (r genericHTTPRouteFinalizer) Finalize(object ezkube.Object) error { + obj, ok := object.(*gateway_networking_k8s_io_v1.HTTPRoute) + if !ok { + return errors.Errorf("internal error: HTTPRoute handler received event for %T", object) + } + return r.finalizingReconciler.FinalizeHTTPRoute(obj) +} diff --git a/pkg/api/k8s-gw/apis/gateway.networking.k8s.io/v1/mocks/clients.go b/pkg/api/k8s-gw/apis/gateway.networking.k8s.io/v1/mocks/clients.go new file mode 100644 index 0000000..f5ed7c1 --- /dev/null +++ b/pkg/api/k8s-gw/apis/gateway.networking.k8s.io/v1/mocks/clients.go @@ -0,0 +1,1630 @@ +// Code generated by MockGen. DO NOT EDIT. +// Source: ./clients.go + +// Package mock_v1 is a generated GoMock package. +package mock_v1 + +import ( + context "context" + reflect "reflect" + + gomock "github.com/golang/mock/gomock" + v1 "github.com/solo-io/external-apis/pkg/api/k8s-gw/apis/gateway.networking.k8s.io/v1" + client "sigs.k8s.io/controller-runtime/pkg/client" + v10 "sigs.k8s.io/gateway-api/apis/v1" +) + +// MockMulticlusterClientset is a mock of MulticlusterClientset interface. +type MockMulticlusterClientset struct { + ctrl *gomock.Controller + recorder *MockMulticlusterClientsetMockRecorder +} + +// MockMulticlusterClientsetMockRecorder is the mock recorder for MockMulticlusterClientset. +type MockMulticlusterClientsetMockRecorder struct { + mock *MockMulticlusterClientset +} + +// NewMockMulticlusterClientset creates a new mock instance. +func NewMockMulticlusterClientset(ctrl *gomock.Controller) *MockMulticlusterClientset { + mock := &MockMulticlusterClientset{ctrl: ctrl} + mock.recorder = &MockMulticlusterClientsetMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockMulticlusterClientset) EXPECT() *MockMulticlusterClientsetMockRecorder { + return m.recorder +} + +// Cluster mocks base method. +func (m *MockMulticlusterClientset) Cluster(cluster string) (v1.Clientset, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Cluster", cluster) + ret0, _ := ret[0].(v1.Clientset) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// Cluster indicates an expected call of Cluster. +func (mr *MockMulticlusterClientsetMockRecorder) Cluster(cluster interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Cluster", reflect.TypeOf((*MockMulticlusterClientset)(nil).Cluster), cluster) +} + +// MockClientset is a mock of Clientset interface. +type MockClientset struct { + ctrl *gomock.Controller + recorder *MockClientsetMockRecorder +} + +// MockClientsetMockRecorder is the mock recorder for MockClientset. +type MockClientsetMockRecorder struct { + mock *MockClientset +} + +// NewMockClientset creates a new mock instance. +func NewMockClientset(ctrl *gomock.Controller) *MockClientset { + mock := &MockClientset{ctrl: ctrl} + mock.recorder = &MockClientsetMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockClientset) EXPECT() *MockClientsetMockRecorder { + return m.recorder +} + +// GatewayClasses mocks base method. +func (m *MockClientset) GatewayClasses() v1.GatewayClassClient { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GatewayClasses") + ret0, _ := ret[0].(v1.GatewayClassClient) + return ret0 +} + +// GatewayClasses indicates an expected call of GatewayClasses. +func (mr *MockClientsetMockRecorder) GatewayClasses() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GatewayClasses", reflect.TypeOf((*MockClientset)(nil).GatewayClasses)) +} + +// Gateways mocks base method. +func (m *MockClientset) Gateways() v1.GatewayClient { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Gateways") + ret0, _ := ret[0].(v1.GatewayClient) + return ret0 +} + +// Gateways indicates an expected call of Gateways. +func (mr *MockClientsetMockRecorder) Gateways() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Gateways", reflect.TypeOf((*MockClientset)(nil).Gateways)) +} + +// HTTPRoutes mocks base method. +func (m *MockClientset) HTTPRoutes() v1.HTTPRouteClient { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "HTTPRoutes") + ret0, _ := ret[0].(v1.HTTPRouteClient) + return ret0 +} + +// HTTPRoutes indicates an expected call of HTTPRoutes. +func (mr *MockClientsetMockRecorder) HTTPRoutes() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "HTTPRoutes", reflect.TypeOf((*MockClientset)(nil).HTTPRoutes)) +} + +// MockGatewayClassReader is a mock of GatewayClassReader interface. +type MockGatewayClassReader struct { + ctrl *gomock.Controller + recorder *MockGatewayClassReaderMockRecorder +} + +// MockGatewayClassReaderMockRecorder is the mock recorder for MockGatewayClassReader. +type MockGatewayClassReaderMockRecorder struct { + mock *MockGatewayClassReader +} + +// NewMockGatewayClassReader creates a new mock instance. +func NewMockGatewayClassReader(ctrl *gomock.Controller) *MockGatewayClassReader { + mock := &MockGatewayClassReader{ctrl: ctrl} + mock.recorder = &MockGatewayClassReaderMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockGatewayClassReader) EXPECT() *MockGatewayClassReaderMockRecorder { + return m.recorder +} + +// GetGatewayClass mocks base method. +func (m *MockGatewayClassReader) GetGatewayClass(ctx context.Context, key client.ObjectKey) (*v10.GatewayClass, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetGatewayClass", ctx, key) + ret0, _ := ret[0].(*v10.GatewayClass) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetGatewayClass indicates an expected call of GetGatewayClass. +func (mr *MockGatewayClassReaderMockRecorder) GetGatewayClass(ctx, key interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetGatewayClass", reflect.TypeOf((*MockGatewayClassReader)(nil).GetGatewayClass), ctx, key) +} + +// ListGatewayClass mocks base method. +func (m *MockGatewayClassReader) ListGatewayClass(ctx context.Context, opts ...client.ListOption) (*v10.GatewayClassList, error) { + m.ctrl.T.Helper() + varargs := []interface{}{ctx} + for _, a := range opts { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "ListGatewayClass", varargs...) + ret0, _ := ret[0].(*v10.GatewayClassList) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ListGatewayClass indicates an expected call of ListGatewayClass. +func (mr *MockGatewayClassReaderMockRecorder) ListGatewayClass(ctx interface{}, opts ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{ctx}, opts...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListGatewayClass", reflect.TypeOf((*MockGatewayClassReader)(nil).ListGatewayClass), varargs...) +} + +// MockGatewayClassWriter is a mock of GatewayClassWriter interface. +type MockGatewayClassWriter struct { + ctrl *gomock.Controller + recorder *MockGatewayClassWriterMockRecorder +} + +// MockGatewayClassWriterMockRecorder is the mock recorder for MockGatewayClassWriter. +type MockGatewayClassWriterMockRecorder struct { + mock *MockGatewayClassWriter +} + +// NewMockGatewayClassWriter creates a new mock instance. +func NewMockGatewayClassWriter(ctrl *gomock.Controller) *MockGatewayClassWriter { + mock := &MockGatewayClassWriter{ctrl: ctrl} + mock.recorder = &MockGatewayClassWriterMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockGatewayClassWriter) EXPECT() *MockGatewayClassWriterMockRecorder { + return m.recorder +} + +// CreateGatewayClass mocks base method. +func (m *MockGatewayClassWriter) CreateGatewayClass(ctx context.Context, obj *v10.GatewayClass, opts ...client.CreateOption) error { + m.ctrl.T.Helper() + varargs := []interface{}{ctx, obj} + for _, a := range opts { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "CreateGatewayClass", varargs...) + ret0, _ := ret[0].(error) + return ret0 +} + +// CreateGatewayClass indicates an expected call of CreateGatewayClass. +func (mr *MockGatewayClassWriterMockRecorder) CreateGatewayClass(ctx, obj interface{}, opts ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{ctx, obj}, opts...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateGatewayClass", reflect.TypeOf((*MockGatewayClassWriter)(nil).CreateGatewayClass), varargs...) +} + +// DeleteAllOfGatewayClass mocks base method. +func (m *MockGatewayClassWriter) DeleteAllOfGatewayClass(ctx context.Context, opts ...client.DeleteAllOfOption) error { + m.ctrl.T.Helper() + varargs := []interface{}{ctx} + for _, a := range opts { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "DeleteAllOfGatewayClass", varargs...) + ret0, _ := ret[0].(error) + return ret0 +} + +// DeleteAllOfGatewayClass indicates an expected call of DeleteAllOfGatewayClass. +func (mr *MockGatewayClassWriterMockRecorder) DeleteAllOfGatewayClass(ctx interface{}, opts ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{ctx}, opts...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteAllOfGatewayClass", reflect.TypeOf((*MockGatewayClassWriter)(nil).DeleteAllOfGatewayClass), varargs...) +} + +// DeleteGatewayClass mocks base method. +func (m *MockGatewayClassWriter) DeleteGatewayClass(ctx context.Context, key client.ObjectKey, opts ...client.DeleteOption) error { + m.ctrl.T.Helper() + varargs := []interface{}{ctx, key} + for _, a := range opts { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "DeleteGatewayClass", varargs...) + ret0, _ := ret[0].(error) + return ret0 +} + +// DeleteGatewayClass indicates an expected call of DeleteGatewayClass. +func (mr *MockGatewayClassWriterMockRecorder) DeleteGatewayClass(ctx, key interface{}, opts ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{ctx, key}, opts...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteGatewayClass", reflect.TypeOf((*MockGatewayClassWriter)(nil).DeleteGatewayClass), varargs...) +} + +// PatchGatewayClass mocks base method. +func (m *MockGatewayClassWriter) PatchGatewayClass(ctx context.Context, obj *v10.GatewayClass, patch client.Patch, opts ...client.PatchOption) error { + m.ctrl.T.Helper() + varargs := []interface{}{ctx, obj, patch} + for _, a := range opts { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "PatchGatewayClass", varargs...) + ret0, _ := ret[0].(error) + return ret0 +} + +// PatchGatewayClass indicates an expected call of PatchGatewayClass. +func (mr *MockGatewayClassWriterMockRecorder) PatchGatewayClass(ctx, obj, patch interface{}, opts ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{ctx, obj, patch}, opts...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "PatchGatewayClass", reflect.TypeOf((*MockGatewayClassWriter)(nil).PatchGatewayClass), varargs...) +} + +// UpdateGatewayClass mocks base method. +func (m *MockGatewayClassWriter) UpdateGatewayClass(ctx context.Context, obj *v10.GatewayClass, opts ...client.UpdateOption) error { + m.ctrl.T.Helper() + varargs := []interface{}{ctx, obj} + for _, a := range opts { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "UpdateGatewayClass", varargs...) + ret0, _ := ret[0].(error) + return ret0 +} + +// UpdateGatewayClass indicates an expected call of UpdateGatewayClass. +func (mr *MockGatewayClassWriterMockRecorder) UpdateGatewayClass(ctx, obj interface{}, opts ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{ctx, obj}, opts...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateGatewayClass", reflect.TypeOf((*MockGatewayClassWriter)(nil).UpdateGatewayClass), varargs...) +} + +// UpsertGatewayClass mocks base method. +func (m *MockGatewayClassWriter) UpsertGatewayClass(ctx context.Context, obj *v10.GatewayClass, transitionFuncs ...v1.GatewayClassTransitionFunction) error { + m.ctrl.T.Helper() + varargs := []interface{}{ctx, obj} + for _, a := range transitionFuncs { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "UpsertGatewayClass", varargs...) + ret0, _ := ret[0].(error) + return ret0 +} + +// UpsertGatewayClass indicates an expected call of UpsertGatewayClass. +func (mr *MockGatewayClassWriterMockRecorder) UpsertGatewayClass(ctx, obj interface{}, transitionFuncs ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{ctx, obj}, transitionFuncs...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpsertGatewayClass", reflect.TypeOf((*MockGatewayClassWriter)(nil).UpsertGatewayClass), varargs...) +} + +// MockGatewayClassStatusWriter is a mock of GatewayClassStatusWriter interface. +type MockGatewayClassStatusWriter struct { + ctrl *gomock.Controller + recorder *MockGatewayClassStatusWriterMockRecorder +} + +// MockGatewayClassStatusWriterMockRecorder is the mock recorder for MockGatewayClassStatusWriter. +type MockGatewayClassStatusWriterMockRecorder struct { + mock *MockGatewayClassStatusWriter +} + +// NewMockGatewayClassStatusWriter creates a new mock instance. +func NewMockGatewayClassStatusWriter(ctrl *gomock.Controller) *MockGatewayClassStatusWriter { + mock := &MockGatewayClassStatusWriter{ctrl: ctrl} + mock.recorder = &MockGatewayClassStatusWriterMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockGatewayClassStatusWriter) EXPECT() *MockGatewayClassStatusWriterMockRecorder { + return m.recorder +} + +// PatchGatewayClassStatus mocks base method. +func (m *MockGatewayClassStatusWriter) PatchGatewayClassStatus(ctx context.Context, obj *v10.GatewayClass, patch client.Patch, opts ...client.SubResourcePatchOption) error { + m.ctrl.T.Helper() + varargs := []interface{}{ctx, obj, patch} + for _, a := range opts { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "PatchGatewayClassStatus", varargs...) + ret0, _ := ret[0].(error) + return ret0 +} + +// PatchGatewayClassStatus indicates an expected call of PatchGatewayClassStatus. +func (mr *MockGatewayClassStatusWriterMockRecorder) PatchGatewayClassStatus(ctx, obj, patch interface{}, opts ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{ctx, obj, patch}, opts...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "PatchGatewayClassStatus", reflect.TypeOf((*MockGatewayClassStatusWriter)(nil).PatchGatewayClassStatus), varargs...) +} + +// UpdateGatewayClassStatus mocks base method. +func (m *MockGatewayClassStatusWriter) UpdateGatewayClassStatus(ctx context.Context, obj *v10.GatewayClass, opts ...client.SubResourceUpdateOption) error { + m.ctrl.T.Helper() + varargs := []interface{}{ctx, obj} + for _, a := range opts { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "UpdateGatewayClassStatus", varargs...) + ret0, _ := ret[0].(error) + return ret0 +} + +// UpdateGatewayClassStatus indicates an expected call of UpdateGatewayClassStatus. +func (mr *MockGatewayClassStatusWriterMockRecorder) UpdateGatewayClassStatus(ctx, obj interface{}, opts ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{ctx, obj}, opts...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateGatewayClassStatus", reflect.TypeOf((*MockGatewayClassStatusWriter)(nil).UpdateGatewayClassStatus), varargs...) +} + +// MockGatewayClassClient is a mock of GatewayClassClient interface. +type MockGatewayClassClient struct { + ctrl *gomock.Controller + recorder *MockGatewayClassClientMockRecorder +} + +// MockGatewayClassClientMockRecorder is the mock recorder for MockGatewayClassClient. +type MockGatewayClassClientMockRecorder struct { + mock *MockGatewayClassClient +} + +// NewMockGatewayClassClient creates a new mock instance. +func NewMockGatewayClassClient(ctrl *gomock.Controller) *MockGatewayClassClient { + mock := &MockGatewayClassClient{ctrl: ctrl} + mock.recorder = &MockGatewayClassClientMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockGatewayClassClient) EXPECT() *MockGatewayClassClientMockRecorder { + return m.recorder +} + +// CreateGatewayClass mocks base method. +func (m *MockGatewayClassClient) CreateGatewayClass(ctx context.Context, obj *v10.GatewayClass, opts ...client.CreateOption) error { + m.ctrl.T.Helper() + varargs := []interface{}{ctx, obj} + for _, a := range opts { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "CreateGatewayClass", varargs...) + ret0, _ := ret[0].(error) + return ret0 +} + +// CreateGatewayClass indicates an expected call of CreateGatewayClass. +func (mr *MockGatewayClassClientMockRecorder) CreateGatewayClass(ctx, obj interface{}, opts ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{ctx, obj}, opts...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateGatewayClass", reflect.TypeOf((*MockGatewayClassClient)(nil).CreateGatewayClass), varargs...) +} + +// DeleteAllOfGatewayClass mocks base method. +func (m *MockGatewayClassClient) DeleteAllOfGatewayClass(ctx context.Context, opts ...client.DeleteAllOfOption) error { + m.ctrl.T.Helper() + varargs := []interface{}{ctx} + for _, a := range opts { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "DeleteAllOfGatewayClass", varargs...) + ret0, _ := ret[0].(error) + return ret0 +} + +// DeleteAllOfGatewayClass indicates an expected call of DeleteAllOfGatewayClass. +func (mr *MockGatewayClassClientMockRecorder) DeleteAllOfGatewayClass(ctx interface{}, opts ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{ctx}, opts...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteAllOfGatewayClass", reflect.TypeOf((*MockGatewayClassClient)(nil).DeleteAllOfGatewayClass), varargs...) +} + +// DeleteGatewayClass mocks base method. +func (m *MockGatewayClassClient) DeleteGatewayClass(ctx context.Context, key client.ObjectKey, opts ...client.DeleteOption) error { + m.ctrl.T.Helper() + varargs := []interface{}{ctx, key} + for _, a := range opts { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "DeleteGatewayClass", varargs...) + ret0, _ := ret[0].(error) + return ret0 +} + +// DeleteGatewayClass indicates an expected call of DeleteGatewayClass. +func (mr *MockGatewayClassClientMockRecorder) DeleteGatewayClass(ctx, key interface{}, opts ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{ctx, key}, opts...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteGatewayClass", reflect.TypeOf((*MockGatewayClassClient)(nil).DeleteGatewayClass), varargs...) +} + +// GetGatewayClass mocks base method. +func (m *MockGatewayClassClient) GetGatewayClass(ctx context.Context, key client.ObjectKey) (*v10.GatewayClass, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetGatewayClass", ctx, key) + ret0, _ := ret[0].(*v10.GatewayClass) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetGatewayClass indicates an expected call of GetGatewayClass. +func (mr *MockGatewayClassClientMockRecorder) GetGatewayClass(ctx, key interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetGatewayClass", reflect.TypeOf((*MockGatewayClassClient)(nil).GetGatewayClass), ctx, key) +} + +// ListGatewayClass mocks base method. +func (m *MockGatewayClassClient) ListGatewayClass(ctx context.Context, opts ...client.ListOption) (*v10.GatewayClassList, error) { + m.ctrl.T.Helper() + varargs := []interface{}{ctx} + for _, a := range opts { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "ListGatewayClass", varargs...) + ret0, _ := ret[0].(*v10.GatewayClassList) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ListGatewayClass indicates an expected call of ListGatewayClass. +func (mr *MockGatewayClassClientMockRecorder) ListGatewayClass(ctx interface{}, opts ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{ctx}, opts...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListGatewayClass", reflect.TypeOf((*MockGatewayClassClient)(nil).ListGatewayClass), varargs...) +} + +// PatchGatewayClass mocks base method. +func (m *MockGatewayClassClient) PatchGatewayClass(ctx context.Context, obj *v10.GatewayClass, patch client.Patch, opts ...client.PatchOption) error { + m.ctrl.T.Helper() + varargs := []interface{}{ctx, obj, patch} + for _, a := range opts { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "PatchGatewayClass", varargs...) + ret0, _ := ret[0].(error) + return ret0 +} + +// PatchGatewayClass indicates an expected call of PatchGatewayClass. +func (mr *MockGatewayClassClientMockRecorder) PatchGatewayClass(ctx, obj, patch interface{}, opts ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{ctx, obj, patch}, opts...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "PatchGatewayClass", reflect.TypeOf((*MockGatewayClassClient)(nil).PatchGatewayClass), varargs...) +} + +// PatchGatewayClassStatus mocks base method. +func (m *MockGatewayClassClient) PatchGatewayClassStatus(ctx context.Context, obj *v10.GatewayClass, patch client.Patch, opts ...client.SubResourcePatchOption) error { + m.ctrl.T.Helper() + varargs := []interface{}{ctx, obj, patch} + for _, a := range opts { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "PatchGatewayClassStatus", varargs...) + ret0, _ := ret[0].(error) + return ret0 +} + +// PatchGatewayClassStatus indicates an expected call of PatchGatewayClassStatus. +func (mr *MockGatewayClassClientMockRecorder) PatchGatewayClassStatus(ctx, obj, patch interface{}, opts ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{ctx, obj, patch}, opts...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "PatchGatewayClassStatus", reflect.TypeOf((*MockGatewayClassClient)(nil).PatchGatewayClassStatus), varargs...) +} + +// UpdateGatewayClass mocks base method. +func (m *MockGatewayClassClient) UpdateGatewayClass(ctx context.Context, obj *v10.GatewayClass, opts ...client.UpdateOption) error { + m.ctrl.T.Helper() + varargs := []interface{}{ctx, obj} + for _, a := range opts { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "UpdateGatewayClass", varargs...) + ret0, _ := ret[0].(error) + return ret0 +} + +// UpdateGatewayClass indicates an expected call of UpdateGatewayClass. +func (mr *MockGatewayClassClientMockRecorder) UpdateGatewayClass(ctx, obj interface{}, opts ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{ctx, obj}, opts...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateGatewayClass", reflect.TypeOf((*MockGatewayClassClient)(nil).UpdateGatewayClass), varargs...) +} + +// UpdateGatewayClassStatus mocks base method. +func (m *MockGatewayClassClient) UpdateGatewayClassStatus(ctx context.Context, obj *v10.GatewayClass, opts ...client.SubResourceUpdateOption) error { + m.ctrl.T.Helper() + varargs := []interface{}{ctx, obj} + for _, a := range opts { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "UpdateGatewayClassStatus", varargs...) + ret0, _ := ret[0].(error) + return ret0 +} + +// UpdateGatewayClassStatus indicates an expected call of UpdateGatewayClassStatus. +func (mr *MockGatewayClassClientMockRecorder) UpdateGatewayClassStatus(ctx, obj interface{}, opts ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{ctx, obj}, opts...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateGatewayClassStatus", reflect.TypeOf((*MockGatewayClassClient)(nil).UpdateGatewayClassStatus), varargs...) +} + +// UpsertGatewayClass mocks base method. +func (m *MockGatewayClassClient) UpsertGatewayClass(ctx context.Context, obj *v10.GatewayClass, transitionFuncs ...v1.GatewayClassTransitionFunction) error { + m.ctrl.T.Helper() + varargs := []interface{}{ctx, obj} + for _, a := range transitionFuncs { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "UpsertGatewayClass", varargs...) + ret0, _ := ret[0].(error) + return ret0 +} + +// UpsertGatewayClass indicates an expected call of UpsertGatewayClass. +func (mr *MockGatewayClassClientMockRecorder) UpsertGatewayClass(ctx, obj interface{}, transitionFuncs ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{ctx, obj}, transitionFuncs...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpsertGatewayClass", reflect.TypeOf((*MockGatewayClassClient)(nil).UpsertGatewayClass), varargs...) +} + +// MockMulticlusterGatewayClassClient is a mock of MulticlusterGatewayClassClient interface. +type MockMulticlusterGatewayClassClient struct { + ctrl *gomock.Controller + recorder *MockMulticlusterGatewayClassClientMockRecorder +} + +// MockMulticlusterGatewayClassClientMockRecorder is the mock recorder for MockMulticlusterGatewayClassClient. +type MockMulticlusterGatewayClassClientMockRecorder struct { + mock *MockMulticlusterGatewayClassClient +} + +// NewMockMulticlusterGatewayClassClient creates a new mock instance. +func NewMockMulticlusterGatewayClassClient(ctrl *gomock.Controller) *MockMulticlusterGatewayClassClient { + mock := &MockMulticlusterGatewayClassClient{ctrl: ctrl} + mock.recorder = &MockMulticlusterGatewayClassClientMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockMulticlusterGatewayClassClient) EXPECT() *MockMulticlusterGatewayClassClientMockRecorder { + return m.recorder +} + +// Cluster mocks base method. +func (m *MockMulticlusterGatewayClassClient) Cluster(cluster string) (v1.GatewayClassClient, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Cluster", cluster) + ret0, _ := ret[0].(v1.GatewayClassClient) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// Cluster indicates an expected call of Cluster. +func (mr *MockMulticlusterGatewayClassClientMockRecorder) Cluster(cluster interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Cluster", reflect.TypeOf((*MockMulticlusterGatewayClassClient)(nil).Cluster), cluster) +} + +// MockGatewayReader is a mock of GatewayReader interface. +type MockGatewayReader struct { + ctrl *gomock.Controller + recorder *MockGatewayReaderMockRecorder +} + +// MockGatewayReaderMockRecorder is the mock recorder for MockGatewayReader. +type MockGatewayReaderMockRecorder struct { + mock *MockGatewayReader +} + +// NewMockGatewayReader creates a new mock instance. +func NewMockGatewayReader(ctrl *gomock.Controller) *MockGatewayReader { + mock := &MockGatewayReader{ctrl: ctrl} + mock.recorder = &MockGatewayReaderMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockGatewayReader) EXPECT() *MockGatewayReaderMockRecorder { + return m.recorder +} + +// GetGateway mocks base method. +func (m *MockGatewayReader) GetGateway(ctx context.Context, key client.ObjectKey) (*v10.Gateway, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetGateway", ctx, key) + ret0, _ := ret[0].(*v10.Gateway) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetGateway indicates an expected call of GetGateway. +func (mr *MockGatewayReaderMockRecorder) GetGateway(ctx, key interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetGateway", reflect.TypeOf((*MockGatewayReader)(nil).GetGateway), ctx, key) +} + +// ListGateway mocks base method. +func (m *MockGatewayReader) ListGateway(ctx context.Context, opts ...client.ListOption) (*v10.GatewayList, error) { + m.ctrl.T.Helper() + varargs := []interface{}{ctx} + for _, a := range opts { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "ListGateway", varargs...) + ret0, _ := ret[0].(*v10.GatewayList) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ListGateway indicates an expected call of ListGateway. +func (mr *MockGatewayReaderMockRecorder) ListGateway(ctx interface{}, opts ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{ctx}, opts...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListGateway", reflect.TypeOf((*MockGatewayReader)(nil).ListGateway), varargs...) +} + +// MockGatewayWriter is a mock of GatewayWriter interface. +type MockGatewayWriter struct { + ctrl *gomock.Controller + recorder *MockGatewayWriterMockRecorder +} + +// MockGatewayWriterMockRecorder is the mock recorder for MockGatewayWriter. +type MockGatewayWriterMockRecorder struct { + mock *MockGatewayWriter +} + +// NewMockGatewayWriter creates a new mock instance. +func NewMockGatewayWriter(ctrl *gomock.Controller) *MockGatewayWriter { + mock := &MockGatewayWriter{ctrl: ctrl} + mock.recorder = &MockGatewayWriterMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockGatewayWriter) EXPECT() *MockGatewayWriterMockRecorder { + return m.recorder +} + +// CreateGateway mocks base method. +func (m *MockGatewayWriter) CreateGateway(ctx context.Context, obj *v10.Gateway, opts ...client.CreateOption) error { + m.ctrl.T.Helper() + varargs := []interface{}{ctx, obj} + for _, a := range opts { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "CreateGateway", varargs...) + ret0, _ := ret[0].(error) + return ret0 +} + +// CreateGateway indicates an expected call of CreateGateway. +func (mr *MockGatewayWriterMockRecorder) CreateGateway(ctx, obj interface{}, opts ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{ctx, obj}, opts...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateGateway", reflect.TypeOf((*MockGatewayWriter)(nil).CreateGateway), varargs...) +} + +// DeleteAllOfGateway mocks base method. +func (m *MockGatewayWriter) DeleteAllOfGateway(ctx context.Context, opts ...client.DeleteAllOfOption) error { + m.ctrl.T.Helper() + varargs := []interface{}{ctx} + for _, a := range opts { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "DeleteAllOfGateway", varargs...) + ret0, _ := ret[0].(error) + return ret0 +} + +// DeleteAllOfGateway indicates an expected call of DeleteAllOfGateway. +func (mr *MockGatewayWriterMockRecorder) DeleteAllOfGateway(ctx interface{}, opts ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{ctx}, opts...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteAllOfGateway", reflect.TypeOf((*MockGatewayWriter)(nil).DeleteAllOfGateway), varargs...) +} + +// DeleteGateway mocks base method. +func (m *MockGatewayWriter) DeleteGateway(ctx context.Context, key client.ObjectKey, opts ...client.DeleteOption) error { + m.ctrl.T.Helper() + varargs := []interface{}{ctx, key} + for _, a := range opts { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "DeleteGateway", varargs...) + ret0, _ := ret[0].(error) + return ret0 +} + +// DeleteGateway indicates an expected call of DeleteGateway. +func (mr *MockGatewayWriterMockRecorder) DeleteGateway(ctx, key interface{}, opts ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{ctx, key}, opts...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteGateway", reflect.TypeOf((*MockGatewayWriter)(nil).DeleteGateway), varargs...) +} + +// PatchGateway mocks base method. +func (m *MockGatewayWriter) PatchGateway(ctx context.Context, obj *v10.Gateway, patch client.Patch, opts ...client.PatchOption) error { + m.ctrl.T.Helper() + varargs := []interface{}{ctx, obj, patch} + for _, a := range opts { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "PatchGateway", varargs...) + ret0, _ := ret[0].(error) + return ret0 +} + +// PatchGateway indicates an expected call of PatchGateway. +func (mr *MockGatewayWriterMockRecorder) PatchGateway(ctx, obj, patch interface{}, opts ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{ctx, obj, patch}, opts...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "PatchGateway", reflect.TypeOf((*MockGatewayWriter)(nil).PatchGateway), varargs...) +} + +// UpdateGateway mocks base method. +func (m *MockGatewayWriter) UpdateGateway(ctx context.Context, obj *v10.Gateway, opts ...client.UpdateOption) error { + m.ctrl.T.Helper() + varargs := []interface{}{ctx, obj} + for _, a := range opts { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "UpdateGateway", varargs...) + ret0, _ := ret[0].(error) + return ret0 +} + +// UpdateGateway indicates an expected call of UpdateGateway. +func (mr *MockGatewayWriterMockRecorder) UpdateGateway(ctx, obj interface{}, opts ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{ctx, obj}, opts...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateGateway", reflect.TypeOf((*MockGatewayWriter)(nil).UpdateGateway), varargs...) +} + +// UpsertGateway mocks base method. +func (m *MockGatewayWriter) UpsertGateway(ctx context.Context, obj *v10.Gateway, transitionFuncs ...v1.GatewayTransitionFunction) error { + m.ctrl.T.Helper() + varargs := []interface{}{ctx, obj} + for _, a := range transitionFuncs { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "UpsertGateway", varargs...) + ret0, _ := ret[0].(error) + return ret0 +} + +// UpsertGateway indicates an expected call of UpsertGateway. +func (mr *MockGatewayWriterMockRecorder) UpsertGateway(ctx, obj interface{}, transitionFuncs ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{ctx, obj}, transitionFuncs...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpsertGateway", reflect.TypeOf((*MockGatewayWriter)(nil).UpsertGateway), varargs...) +} + +// MockGatewayStatusWriter is a mock of GatewayStatusWriter interface. +type MockGatewayStatusWriter struct { + ctrl *gomock.Controller + recorder *MockGatewayStatusWriterMockRecorder +} + +// MockGatewayStatusWriterMockRecorder is the mock recorder for MockGatewayStatusWriter. +type MockGatewayStatusWriterMockRecorder struct { + mock *MockGatewayStatusWriter +} + +// NewMockGatewayStatusWriter creates a new mock instance. +func NewMockGatewayStatusWriter(ctrl *gomock.Controller) *MockGatewayStatusWriter { + mock := &MockGatewayStatusWriter{ctrl: ctrl} + mock.recorder = &MockGatewayStatusWriterMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockGatewayStatusWriter) EXPECT() *MockGatewayStatusWriterMockRecorder { + return m.recorder +} + +// PatchGatewayStatus mocks base method. +func (m *MockGatewayStatusWriter) PatchGatewayStatus(ctx context.Context, obj *v10.Gateway, patch client.Patch, opts ...client.SubResourcePatchOption) error { + m.ctrl.T.Helper() + varargs := []interface{}{ctx, obj, patch} + for _, a := range opts { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "PatchGatewayStatus", varargs...) + ret0, _ := ret[0].(error) + return ret0 +} + +// PatchGatewayStatus indicates an expected call of PatchGatewayStatus. +func (mr *MockGatewayStatusWriterMockRecorder) PatchGatewayStatus(ctx, obj, patch interface{}, opts ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{ctx, obj, patch}, opts...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "PatchGatewayStatus", reflect.TypeOf((*MockGatewayStatusWriter)(nil).PatchGatewayStatus), varargs...) +} + +// UpdateGatewayStatus mocks base method. +func (m *MockGatewayStatusWriter) UpdateGatewayStatus(ctx context.Context, obj *v10.Gateway, opts ...client.SubResourceUpdateOption) error { + m.ctrl.T.Helper() + varargs := []interface{}{ctx, obj} + for _, a := range opts { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "UpdateGatewayStatus", varargs...) + ret0, _ := ret[0].(error) + return ret0 +} + +// UpdateGatewayStatus indicates an expected call of UpdateGatewayStatus. +func (mr *MockGatewayStatusWriterMockRecorder) UpdateGatewayStatus(ctx, obj interface{}, opts ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{ctx, obj}, opts...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateGatewayStatus", reflect.TypeOf((*MockGatewayStatusWriter)(nil).UpdateGatewayStatus), varargs...) +} + +// MockGatewayClient is a mock of GatewayClient interface. +type MockGatewayClient struct { + ctrl *gomock.Controller + recorder *MockGatewayClientMockRecorder +} + +// MockGatewayClientMockRecorder is the mock recorder for MockGatewayClient. +type MockGatewayClientMockRecorder struct { + mock *MockGatewayClient +} + +// NewMockGatewayClient creates a new mock instance. +func NewMockGatewayClient(ctrl *gomock.Controller) *MockGatewayClient { + mock := &MockGatewayClient{ctrl: ctrl} + mock.recorder = &MockGatewayClientMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockGatewayClient) EXPECT() *MockGatewayClientMockRecorder { + return m.recorder +} + +// CreateGateway mocks base method. +func (m *MockGatewayClient) CreateGateway(ctx context.Context, obj *v10.Gateway, opts ...client.CreateOption) error { + m.ctrl.T.Helper() + varargs := []interface{}{ctx, obj} + for _, a := range opts { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "CreateGateway", varargs...) + ret0, _ := ret[0].(error) + return ret0 +} + +// CreateGateway indicates an expected call of CreateGateway. +func (mr *MockGatewayClientMockRecorder) CreateGateway(ctx, obj interface{}, opts ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{ctx, obj}, opts...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateGateway", reflect.TypeOf((*MockGatewayClient)(nil).CreateGateway), varargs...) +} + +// DeleteAllOfGateway mocks base method. +func (m *MockGatewayClient) DeleteAllOfGateway(ctx context.Context, opts ...client.DeleteAllOfOption) error { + m.ctrl.T.Helper() + varargs := []interface{}{ctx} + for _, a := range opts { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "DeleteAllOfGateway", varargs...) + ret0, _ := ret[0].(error) + return ret0 +} + +// DeleteAllOfGateway indicates an expected call of DeleteAllOfGateway. +func (mr *MockGatewayClientMockRecorder) DeleteAllOfGateway(ctx interface{}, opts ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{ctx}, opts...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteAllOfGateway", reflect.TypeOf((*MockGatewayClient)(nil).DeleteAllOfGateway), varargs...) +} + +// DeleteGateway mocks base method. +func (m *MockGatewayClient) DeleteGateway(ctx context.Context, key client.ObjectKey, opts ...client.DeleteOption) error { + m.ctrl.T.Helper() + varargs := []interface{}{ctx, key} + for _, a := range opts { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "DeleteGateway", varargs...) + ret0, _ := ret[0].(error) + return ret0 +} + +// DeleteGateway indicates an expected call of DeleteGateway. +func (mr *MockGatewayClientMockRecorder) DeleteGateway(ctx, key interface{}, opts ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{ctx, key}, opts...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteGateway", reflect.TypeOf((*MockGatewayClient)(nil).DeleteGateway), varargs...) +} + +// GetGateway mocks base method. +func (m *MockGatewayClient) GetGateway(ctx context.Context, key client.ObjectKey) (*v10.Gateway, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetGateway", ctx, key) + ret0, _ := ret[0].(*v10.Gateway) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetGateway indicates an expected call of GetGateway. +func (mr *MockGatewayClientMockRecorder) GetGateway(ctx, key interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetGateway", reflect.TypeOf((*MockGatewayClient)(nil).GetGateway), ctx, key) +} + +// ListGateway mocks base method. +func (m *MockGatewayClient) ListGateway(ctx context.Context, opts ...client.ListOption) (*v10.GatewayList, error) { + m.ctrl.T.Helper() + varargs := []interface{}{ctx} + for _, a := range opts { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "ListGateway", varargs...) + ret0, _ := ret[0].(*v10.GatewayList) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ListGateway indicates an expected call of ListGateway. +func (mr *MockGatewayClientMockRecorder) ListGateway(ctx interface{}, opts ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{ctx}, opts...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListGateway", reflect.TypeOf((*MockGatewayClient)(nil).ListGateway), varargs...) +} + +// PatchGateway mocks base method. +func (m *MockGatewayClient) PatchGateway(ctx context.Context, obj *v10.Gateway, patch client.Patch, opts ...client.PatchOption) error { + m.ctrl.T.Helper() + varargs := []interface{}{ctx, obj, patch} + for _, a := range opts { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "PatchGateway", varargs...) + ret0, _ := ret[0].(error) + return ret0 +} + +// PatchGateway indicates an expected call of PatchGateway. +func (mr *MockGatewayClientMockRecorder) PatchGateway(ctx, obj, patch interface{}, opts ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{ctx, obj, patch}, opts...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "PatchGateway", reflect.TypeOf((*MockGatewayClient)(nil).PatchGateway), varargs...) +} + +// PatchGatewayStatus mocks base method. +func (m *MockGatewayClient) PatchGatewayStatus(ctx context.Context, obj *v10.Gateway, patch client.Patch, opts ...client.SubResourcePatchOption) error { + m.ctrl.T.Helper() + varargs := []interface{}{ctx, obj, patch} + for _, a := range opts { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "PatchGatewayStatus", varargs...) + ret0, _ := ret[0].(error) + return ret0 +} + +// PatchGatewayStatus indicates an expected call of PatchGatewayStatus. +func (mr *MockGatewayClientMockRecorder) PatchGatewayStatus(ctx, obj, patch interface{}, opts ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{ctx, obj, patch}, opts...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "PatchGatewayStatus", reflect.TypeOf((*MockGatewayClient)(nil).PatchGatewayStatus), varargs...) +} + +// UpdateGateway mocks base method. +func (m *MockGatewayClient) UpdateGateway(ctx context.Context, obj *v10.Gateway, opts ...client.UpdateOption) error { + m.ctrl.T.Helper() + varargs := []interface{}{ctx, obj} + for _, a := range opts { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "UpdateGateway", varargs...) + ret0, _ := ret[0].(error) + return ret0 +} + +// UpdateGateway indicates an expected call of UpdateGateway. +func (mr *MockGatewayClientMockRecorder) UpdateGateway(ctx, obj interface{}, opts ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{ctx, obj}, opts...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateGateway", reflect.TypeOf((*MockGatewayClient)(nil).UpdateGateway), varargs...) +} + +// UpdateGatewayStatus mocks base method. +func (m *MockGatewayClient) UpdateGatewayStatus(ctx context.Context, obj *v10.Gateway, opts ...client.SubResourceUpdateOption) error { + m.ctrl.T.Helper() + varargs := []interface{}{ctx, obj} + for _, a := range opts { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "UpdateGatewayStatus", varargs...) + ret0, _ := ret[0].(error) + return ret0 +} + +// UpdateGatewayStatus indicates an expected call of UpdateGatewayStatus. +func (mr *MockGatewayClientMockRecorder) UpdateGatewayStatus(ctx, obj interface{}, opts ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{ctx, obj}, opts...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateGatewayStatus", reflect.TypeOf((*MockGatewayClient)(nil).UpdateGatewayStatus), varargs...) +} + +// UpsertGateway mocks base method. +func (m *MockGatewayClient) UpsertGateway(ctx context.Context, obj *v10.Gateway, transitionFuncs ...v1.GatewayTransitionFunction) error { + m.ctrl.T.Helper() + varargs := []interface{}{ctx, obj} + for _, a := range transitionFuncs { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "UpsertGateway", varargs...) + ret0, _ := ret[0].(error) + return ret0 +} + +// UpsertGateway indicates an expected call of UpsertGateway. +func (mr *MockGatewayClientMockRecorder) UpsertGateway(ctx, obj interface{}, transitionFuncs ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{ctx, obj}, transitionFuncs...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpsertGateway", reflect.TypeOf((*MockGatewayClient)(nil).UpsertGateway), varargs...) +} + +// MockMulticlusterGatewayClient is a mock of MulticlusterGatewayClient interface. +type MockMulticlusterGatewayClient struct { + ctrl *gomock.Controller + recorder *MockMulticlusterGatewayClientMockRecorder +} + +// MockMulticlusterGatewayClientMockRecorder is the mock recorder for MockMulticlusterGatewayClient. +type MockMulticlusterGatewayClientMockRecorder struct { + mock *MockMulticlusterGatewayClient +} + +// NewMockMulticlusterGatewayClient creates a new mock instance. +func NewMockMulticlusterGatewayClient(ctrl *gomock.Controller) *MockMulticlusterGatewayClient { + mock := &MockMulticlusterGatewayClient{ctrl: ctrl} + mock.recorder = &MockMulticlusterGatewayClientMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockMulticlusterGatewayClient) EXPECT() *MockMulticlusterGatewayClientMockRecorder { + return m.recorder +} + +// Cluster mocks base method. +func (m *MockMulticlusterGatewayClient) Cluster(cluster string) (v1.GatewayClient, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Cluster", cluster) + ret0, _ := ret[0].(v1.GatewayClient) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// Cluster indicates an expected call of Cluster. +func (mr *MockMulticlusterGatewayClientMockRecorder) Cluster(cluster interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Cluster", reflect.TypeOf((*MockMulticlusterGatewayClient)(nil).Cluster), cluster) +} + +// MockHTTPRouteReader is a mock of HTTPRouteReader interface. +type MockHTTPRouteReader struct { + ctrl *gomock.Controller + recorder *MockHTTPRouteReaderMockRecorder +} + +// MockHTTPRouteReaderMockRecorder is the mock recorder for MockHTTPRouteReader. +type MockHTTPRouteReaderMockRecorder struct { + mock *MockHTTPRouteReader +} + +// NewMockHTTPRouteReader creates a new mock instance. +func NewMockHTTPRouteReader(ctrl *gomock.Controller) *MockHTTPRouteReader { + mock := &MockHTTPRouteReader{ctrl: ctrl} + mock.recorder = &MockHTTPRouteReaderMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockHTTPRouteReader) EXPECT() *MockHTTPRouteReaderMockRecorder { + return m.recorder +} + +// GetHTTPRoute mocks base method. +func (m *MockHTTPRouteReader) GetHTTPRoute(ctx context.Context, key client.ObjectKey) (*v10.HTTPRoute, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetHTTPRoute", ctx, key) + ret0, _ := ret[0].(*v10.HTTPRoute) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetHTTPRoute indicates an expected call of GetHTTPRoute. +func (mr *MockHTTPRouteReaderMockRecorder) GetHTTPRoute(ctx, key interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetHTTPRoute", reflect.TypeOf((*MockHTTPRouteReader)(nil).GetHTTPRoute), ctx, key) +} + +// ListHTTPRoute mocks base method. +func (m *MockHTTPRouteReader) ListHTTPRoute(ctx context.Context, opts ...client.ListOption) (*v10.HTTPRouteList, error) { + m.ctrl.T.Helper() + varargs := []interface{}{ctx} + for _, a := range opts { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "ListHTTPRoute", varargs...) + ret0, _ := ret[0].(*v10.HTTPRouteList) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ListHTTPRoute indicates an expected call of ListHTTPRoute. +func (mr *MockHTTPRouteReaderMockRecorder) ListHTTPRoute(ctx interface{}, opts ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{ctx}, opts...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListHTTPRoute", reflect.TypeOf((*MockHTTPRouteReader)(nil).ListHTTPRoute), varargs...) +} + +// MockHTTPRouteWriter is a mock of HTTPRouteWriter interface. +type MockHTTPRouteWriter struct { + ctrl *gomock.Controller + recorder *MockHTTPRouteWriterMockRecorder +} + +// MockHTTPRouteWriterMockRecorder is the mock recorder for MockHTTPRouteWriter. +type MockHTTPRouteWriterMockRecorder struct { + mock *MockHTTPRouteWriter +} + +// NewMockHTTPRouteWriter creates a new mock instance. +func NewMockHTTPRouteWriter(ctrl *gomock.Controller) *MockHTTPRouteWriter { + mock := &MockHTTPRouteWriter{ctrl: ctrl} + mock.recorder = &MockHTTPRouteWriterMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockHTTPRouteWriter) EXPECT() *MockHTTPRouteWriterMockRecorder { + return m.recorder +} + +// CreateHTTPRoute mocks base method. +func (m *MockHTTPRouteWriter) CreateHTTPRoute(ctx context.Context, obj *v10.HTTPRoute, opts ...client.CreateOption) error { + m.ctrl.T.Helper() + varargs := []interface{}{ctx, obj} + for _, a := range opts { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "CreateHTTPRoute", varargs...) + ret0, _ := ret[0].(error) + return ret0 +} + +// CreateHTTPRoute indicates an expected call of CreateHTTPRoute. +func (mr *MockHTTPRouteWriterMockRecorder) CreateHTTPRoute(ctx, obj interface{}, opts ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{ctx, obj}, opts...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateHTTPRoute", reflect.TypeOf((*MockHTTPRouteWriter)(nil).CreateHTTPRoute), varargs...) +} + +// DeleteAllOfHTTPRoute mocks base method. +func (m *MockHTTPRouteWriter) DeleteAllOfHTTPRoute(ctx context.Context, opts ...client.DeleteAllOfOption) error { + m.ctrl.T.Helper() + varargs := []interface{}{ctx} + for _, a := range opts { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "DeleteAllOfHTTPRoute", varargs...) + ret0, _ := ret[0].(error) + return ret0 +} + +// DeleteAllOfHTTPRoute indicates an expected call of DeleteAllOfHTTPRoute. +func (mr *MockHTTPRouteWriterMockRecorder) DeleteAllOfHTTPRoute(ctx interface{}, opts ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{ctx}, opts...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteAllOfHTTPRoute", reflect.TypeOf((*MockHTTPRouteWriter)(nil).DeleteAllOfHTTPRoute), varargs...) +} + +// DeleteHTTPRoute mocks base method. +func (m *MockHTTPRouteWriter) DeleteHTTPRoute(ctx context.Context, key client.ObjectKey, opts ...client.DeleteOption) error { + m.ctrl.T.Helper() + varargs := []interface{}{ctx, key} + for _, a := range opts { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "DeleteHTTPRoute", varargs...) + ret0, _ := ret[0].(error) + return ret0 +} + +// DeleteHTTPRoute indicates an expected call of DeleteHTTPRoute. +func (mr *MockHTTPRouteWriterMockRecorder) DeleteHTTPRoute(ctx, key interface{}, opts ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{ctx, key}, opts...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteHTTPRoute", reflect.TypeOf((*MockHTTPRouteWriter)(nil).DeleteHTTPRoute), varargs...) +} + +// PatchHTTPRoute mocks base method. +func (m *MockHTTPRouteWriter) PatchHTTPRoute(ctx context.Context, obj *v10.HTTPRoute, patch client.Patch, opts ...client.PatchOption) error { + m.ctrl.T.Helper() + varargs := []interface{}{ctx, obj, patch} + for _, a := range opts { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "PatchHTTPRoute", varargs...) + ret0, _ := ret[0].(error) + return ret0 +} + +// PatchHTTPRoute indicates an expected call of PatchHTTPRoute. +func (mr *MockHTTPRouteWriterMockRecorder) PatchHTTPRoute(ctx, obj, patch interface{}, opts ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{ctx, obj, patch}, opts...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "PatchHTTPRoute", reflect.TypeOf((*MockHTTPRouteWriter)(nil).PatchHTTPRoute), varargs...) +} + +// UpdateHTTPRoute mocks base method. +func (m *MockHTTPRouteWriter) UpdateHTTPRoute(ctx context.Context, obj *v10.HTTPRoute, opts ...client.UpdateOption) error { + m.ctrl.T.Helper() + varargs := []interface{}{ctx, obj} + for _, a := range opts { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "UpdateHTTPRoute", varargs...) + ret0, _ := ret[0].(error) + return ret0 +} + +// UpdateHTTPRoute indicates an expected call of UpdateHTTPRoute. +func (mr *MockHTTPRouteWriterMockRecorder) UpdateHTTPRoute(ctx, obj interface{}, opts ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{ctx, obj}, opts...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateHTTPRoute", reflect.TypeOf((*MockHTTPRouteWriter)(nil).UpdateHTTPRoute), varargs...) +} + +// UpsertHTTPRoute mocks base method. +func (m *MockHTTPRouteWriter) UpsertHTTPRoute(ctx context.Context, obj *v10.HTTPRoute, transitionFuncs ...v1.HTTPRouteTransitionFunction) error { + m.ctrl.T.Helper() + varargs := []interface{}{ctx, obj} + for _, a := range transitionFuncs { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "UpsertHTTPRoute", varargs...) + ret0, _ := ret[0].(error) + return ret0 +} + +// UpsertHTTPRoute indicates an expected call of UpsertHTTPRoute. +func (mr *MockHTTPRouteWriterMockRecorder) UpsertHTTPRoute(ctx, obj interface{}, transitionFuncs ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{ctx, obj}, transitionFuncs...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpsertHTTPRoute", reflect.TypeOf((*MockHTTPRouteWriter)(nil).UpsertHTTPRoute), varargs...) +} + +// MockHTTPRouteStatusWriter is a mock of HTTPRouteStatusWriter interface. +type MockHTTPRouteStatusWriter struct { + ctrl *gomock.Controller + recorder *MockHTTPRouteStatusWriterMockRecorder +} + +// MockHTTPRouteStatusWriterMockRecorder is the mock recorder for MockHTTPRouteStatusWriter. +type MockHTTPRouteStatusWriterMockRecorder struct { + mock *MockHTTPRouteStatusWriter +} + +// NewMockHTTPRouteStatusWriter creates a new mock instance. +func NewMockHTTPRouteStatusWriter(ctrl *gomock.Controller) *MockHTTPRouteStatusWriter { + mock := &MockHTTPRouteStatusWriter{ctrl: ctrl} + mock.recorder = &MockHTTPRouteStatusWriterMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockHTTPRouteStatusWriter) EXPECT() *MockHTTPRouteStatusWriterMockRecorder { + return m.recorder +} + +// PatchHTTPRouteStatus mocks base method. +func (m *MockHTTPRouteStatusWriter) PatchHTTPRouteStatus(ctx context.Context, obj *v10.HTTPRoute, patch client.Patch, opts ...client.SubResourcePatchOption) error { + m.ctrl.T.Helper() + varargs := []interface{}{ctx, obj, patch} + for _, a := range opts { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "PatchHTTPRouteStatus", varargs...) + ret0, _ := ret[0].(error) + return ret0 +} + +// PatchHTTPRouteStatus indicates an expected call of PatchHTTPRouteStatus. +func (mr *MockHTTPRouteStatusWriterMockRecorder) PatchHTTPRouteStatus(ctx, obj, patch interface{}, opts ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{ctx, obj, patch}, opts...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "PatchHTTPRouteStatus", reflect.TypeOf((*MockHTTPRouteStatusWriter)(nil).PatchHTTPRouteStatus), varargs...) +} + +// UpdateHTTPRouteStatus mocks base method. +func (m *MockHTTPRouteStatusWriter) UpdateHTTPRouteStatus(ctx context.Context, obj *v10.HTTPRoute, opts ...client.SubResourceUpdateOption) error { + m.ctrl.T.Helper() + varargs := []interface{}{ctx, obj} + for _, a := range opts { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "UpdateHTTPRouteStatus", varargs...) + ret0, _ := ret[0].(error) + return ret0 +} + +// UpdateHTTPRouteStatus indicates an expected call of UpdateHTTPRouteStatus. +func (mr *MockHTTPRouteStatusWriterMockRecorder) UpdateHTTPRouteStatus(ctx, obj interface{}, opts ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{ctx, obj}, opts...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateHTTPRouteStatus", reflect.TypeOf((*MockHTTPRouteStatusWriter)(nil).UpdateHTTPRouteStatus), varargs...) +} + +// MockHTTPRouteClient is a mock of HTTPRouteClient interface. +type MockHTTPRouteClient struct { + ctrl *gomock.Controller + recorder *MockHTTPRouteClientMockRecorder +} + +// MockHTTPRouteClientMockRecorder is the mock recorder for MockHTTPRouteClient. +type MockHTTPRouteClientMockRecorder struct { + mock *MockHTTPRouteClient +} + +// NewMockHTTPRouteClient creates a new mock instance. +func NewMockHTTPRouteClient(ctrl *gomock.Controller) *MockHTTPRouteClient { + mock := &MockHTTPRouteClient{ctrl: ctrl} + mock.recorder = &MockHTTPRouteClientMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockHTTPRouteClient) EXPECT() *MockHTTPRouteClientMockRecorder { + return m.recorder +} + +// CreateHTTPRoute mocks base method. +func (m *MockHTTPRouteClient) CreateHTTPRoute(ctx context.Context, obj *v10.HTTPRoute, opts ...client.CreateOption) error { + m.ctrl.T.Helper() + varargs := []interface{}{ctx, obj} + for _, a := range opts { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "CreateHTTPRoute", varargs...) + ret0, _ := ret[0].(error) + return ret0 +} + +// CreateHTTPRoute indicates an expected call of CreateHTTPRoute. +func (mr *MockHTTPRouteClientMockRecorder) CreateHTTPRoute(ctx, obj interface{}, opts ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{ctx, obj}, opts...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateHTTPRoute", reflect.TypeOf((*MockHTTPRouteClient)(nil).CreateHTTPRoute), varargs...) +} + +// DeleteAllOfHTTPRoute mocks base method. +func (m *MockHTTPRouteClient) DeleteAllOfHTTPRoute(ctx context.Context, opts ...client.DeleteAllOfOption) error { + m.ctrl.T.Helper() + varargs := []interface{}{ctx} + for _, a := range opts { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "DeleteAllOfHTTPRoute", varargs...) + ret0, _ := ret[0].(error) + return ret0 +} + +// DeleteAllOfHTTPRoute indicates an expected call of DeleteAllOfHTTPRoute. +func (mr *MockHTTPRouteClientMockRecorder) DeleteAllOfHTTPRoute(ctx interface{}, opts ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{ctx}, opts...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteAllOfHTTPRoute", reflect.TypeOf((*MockHTTPRouteClient)(nil).DeleteAllOfHTTPRoute), varargs...) +} + +// DeleteHTTPRoute mocks base method. +func (m *MockHTTPRouteClient) DeleteHTTPRoute(ctx context.Context, key client.ObjectKey, opts ...client.DeleteOption) error { + m.ctrl.T.Helper() + varargs := []interface{}{ctx, key} + for _, a := range opts { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "DeleteHTTPRoute", varargs...) + ret0, _ := ret[0].(error) + return ret0 +} + +// DeleteHTTPRoute indicates an expected call of DeleteHTTPRoute. +func (mr *MockHTTPRouteClientMockRecorder) DeleteHTTPRoute(ctx, key interface{}, opts ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{ctx, key}, opts...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteHTTPRoute", reflect.TypeOf((*MockHTTPRouteClient)(nil).DeleteHTTPRoute), varargs...) +} + +// GetHTTPRoute mocks base method. +func (m *MockHTTPRouteClient) GetHTTPRoute(ctx context.Context, key client.ObjectKey) (*v10.HTTPRoute, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetHTTPRoute", ctx, key) + ret0, _ := ret[0].(*v10.HTTPRoute) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetHTTPRoute indicates an expected call of GetHTTPRoute. +func (mr *MockHTTPRouteClientMockRecorder) GetHTTPRoute(ctx, key interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetHTTPRoute", reflect.TypeOf((*MockHTTPRouteClient)(nil).GetHTTPRoute), ctx, key) +} + +// ListHTTPRoute mocks base method. +func (m *MockHTTPRouteClient) ListHTTPRoute(ctx context.Context, opts ...client.ListOption) (*v10.HTTPRouteList, error) { + m.ctrl.T.Helper() + varargs := []interface{}{ctx} + for _, a := range opts { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "ListHTTPRoute", varargs...) + ret0, _ := ret[0].(*v10.HTTPRouteList) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ListHTTPRoute indicates an expected call of ListHTTPRoute. +func (mr *MockHTTPRouteClientMockRecorder) ListHTTPRoute(ctx interface{}, opts ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{ctx}, opts...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListHTTPRoute", reflect.TypeOf((*MockHTTPRouteClient)(nil).ListHTTPRoute), varargs...) +} + +// PatchHTTPRoute mocks base method. +func (m *MockHTTPRouteClient) PatchHTTPRoute(ctx context.Context, obj *v10.HTTPRoute, patch client.Patch, opts ...client.PatchOption) error { + m.ctrl.T.Helper() + varargs := []interface{}{ctx, obj, patch} + for _, a := range opts { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "PatchHTTPRoute", varargs...) + ret0, _ := ret[0].(error) + return ret0 +} + +// PatchHTTPRoute indicates an expected call of PatchHTTPRoute. +func (mr *MockHTTPRouteClientMockRecorder) PatchHTTPRoute(ctx, obj, patch interface{}, opts ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{ctx, obj, patch}, opts...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "PatchHTTPRoute", reflect.TypeOf((*MockHTTPRouteClient)(nil).PatchHTTPRoute), varargs...) +} + +// PatchHTTPRouteStatus mocks base method. +func (m *MockHTTPRouteClient) PatchHTTPRouteStatus(ctx context.Context, obj *v10.HTTPRoute, patch client.Patch, opts ...client.SubResourcePatchOption) error { + m.ctrl.T.Helper() + varargs := []interface{}{ctx, obj, patch} + for _, a := range opts { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "PatchHTTPRouteStatus", varargs...) + ret0, _ := ret[0].(error) + return ret0 +} + +// PatchHTTPRouteStatus indicates an expected call of PatchHTTPRouteStatus. +func (mr *MockHTTPRouteClientMockRecorder) PatchHTTPRouteStatus(ctx, obj, patch interface{}, opts ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{ctx, obj, patch}, opts...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "PatchHTTPRouteStatus", reflect.TypeOf((*MockHTTPRouteClient)(nil).PatchHTTPRouteStatus), varargs...) +} + +// UpdateHTTPRoute mocks base method. +func (m *MockHTTPRouteClient) UpdateHTTPRoute(ctx context.Context, obj *v10.HTTPRoute, opts ...client.UpdateOption) error { + m.ctrl.T.Helper() + varargs := []interface{}{ctx, obj} + for _, a := range opts { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "UpdateHTTPRoute", varargs...) + ret0, _ := ret[0].(error) + return ret0 +} + +// UpdateHTTPRoute indicates an expected call of UpdateHTTPRoute. +func (mr *MockHTTPRouteClientMockRecorder) UpdateHTTPRoute(ctx, obj interface{}, opts ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{ctx, obj}, opts...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateHTTPRoute", reflect.TypeOf((*MockHTTPRouteClient)(nil).UpdateHTTPRoute), varargs...) +} + +// UpdateHTTPRouteStatus mocks base method. +func (m *MockHTTPRouteClient) UpdateHTTPRouteStatus(ctx context.Context, obj *v10.HTTPRoute, opts ...client.SubResourceUpdateOption) error { + m.ctrl.T.Helper() + varargs := []interface{}{ctx, obj} + for _, a := range opts { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "UpdateHTTPRouteStatus", varargs...) + ret0, _ := ret[0].(error) + return ret0 +} + +// UpdateHTTPRouteStatus indicates an expected call of UpdateHTTPRouteStatus. +func (mr *MockHTTPRouteClientMockRecorder) UpdateHTTPRouteStatus(ctx, obj interface{}, opts ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{ctx, obj}, opts...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateHTTPRouteStatus", reflect.TypeOf((*MockHTTPRouteClient)(nil).UpdateHTTPRouteStatus), varargs...) +} + +// UpsertHTTPRoute mocks base method. +func (m *MockHTTPRouteClient) UpsertHTTPRoute(ctx context.Context, obj *v10.HTTPRoute, transitionFuncs ...v1.HTTPRouteTransitionFunction) error { + m.ctrl.T.Helper() + varargs := []interface{}{ctx, obj} + for _, a := range transitionFuncs { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "UpsertHTTPRoute", varargs...) + ret0, _ := ret[0].(error) + return ret0 +} + +// UpsertHTTPRoute indicates an expected call of UpsertHTTPRoute. +func (mr *MockHTTPRouteClientMockRecorder) UpsertHTTPRoute(ctx, obj interface{}, transitionFuncs ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{ctx, obj}, transitionFuncs...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpsertHTTPRoute", reflect.TypeOf((*MockHTTPRouteClient)(nil).UpsertHTTPRoute), varargs...) +} + +// MockMulticlusterHTTPRouteClient is a mock of MulticlusterHTTPRouteClient interface. +type MockMulticlusterHTTPRouteClient struct { + ctrl *gomock.Controller + recorder *MockMulticlusterHTTPRouteClientMockRecorder +} + +// MockMulticlusterHTTPRouteClientMockRecorder is the mock recorder for MockMulticlusterHTTPRouteClient. +type MockMulticlusterHTTPRouteClientMockRecorder struct { + mock *MockMulticlusterHTTPRouteClient +} + +// NewMockMulticlusterHTTPRouteClient creates a new mock instance. +func NewMockMulticlusterHTTPRouteClient(ctrl *gomock.Controller) *MockMulticlusterHTTPRouteClient { + mock := &MockMulticlusterHTTPRouteClient{ctrl: ctrl} + mock.recorder = &MockMulticlusterHTTPRouteClientMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockMulticlusterHTTPRouteClient) EXPECT() *MockMulticlusterHTTPRouteClientMockRecorder { + return m.recorder +} + +// Cluster mocks base method. +func (m *MockMulticlusterHTTPRouteClient) Cluster(cluster string) (v1.HTTPRouteClient, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Cluster", cluster) + ret0, _ := ret[0].(v1.HTTPRouteClient) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// Cluster indicates an expected call of Cluster. +func (mr *MockMulticlusterHTTPRouteClientMockRecorder) Cluster(cluster interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Cluster", reflect.TypeOf((*MockMulticlusterHTTPRouteClient)(nil).Cluster), cluster) +} diff --git a/pkg/api/k8s-gw/apis/gateway.networking.k8s.io/v1/providers/client_providers.go b/pkg/api/k8s-gw/apis/gateway.networking.k8s.io/v1/providers/client_providers.go new file mode 100644 index 0000000..d9812c3 --- /dev/null +++ b/pkg/api/k8s-gw/apis/gateway.networking.k8s.io/v1/providers/client_providers.go @@ -0,0 +1,102 @@ +// Code generated by skv2. DO NOT EDIT. + +package v1 + +import ( + gateway_networking_k8s_io_v1 "github.com/solo-io/external-apis/pkg/api/k8s-gw/apis/gateway.networking.k8s.io/v1" + + "k8s.io/client-go/rest" + "sigs.k8s.io/controller-runtime/pkg/client" +) + +/* + The intention of these providers are to be used for Mocking. + They expose the Clients as interfaces, as well as factories to provide mocked versions + of the clients when they require building within a component. + + See package `github.com/solo-io/skv2/pkg/multicluster/register` for example +*/ + +// Provider for GatewayClassClient from Clientset +func GatewayClassClientFromClientsetProvider(clients gateway_networking_k8s_io_v1.Clientset) gateway_networking_k8s_io_v1.GatewayClassClient { + return clients.GatewayClasses() +} + +// Provider for GatewayClass Client from Client +func GatewayClassClientProvider(client client.Client) gateway_networking_k8s_io_v1.GatewayClassClient { + return gateway_networking_k8s_io_v1.NewGatewayClassClient(client) +} + +type GatewayClassClientFactory func(client client.Client) gateway_networking_k8s_io_v1.GatewayClassClient + +func GatewayClassClientFactoryProvider() GatewayClassClientFactory { + return GatewayClassClientProvider +} + +type GatewayClassClientFromConfigFactory func(cfg *rest.Config) (gateway_networking_k8s_io_v1.GatewayClassClient, error) + +func GatewayClassClientFromConfigFactoryProvider() GatewayClassClientFromConfigFactory { + return func(cfg *rest.Config) (gateway_networking_k8s_io_v1.GatewayClassClient, error) { + clients, err := gateway_networking_k8s_io_v1.NewClientsetFromConfig(cfg) + if err != nil { + return nil, err + } + return clients.GatewayClasses(), nil + } +} + +// Provider for GatewayClient from Clientset +func GatewayClientFromClientsetProvider(clients gateway_networking_k8s_io_v1.Clientset) gateway_networking_k8s_io_v1.GatewayClient { + return clients.Gateways() +} + +// Provider for Gateway Client from Client +func GatewayClientProvider(client client.Client) gateway_networking_k8s_io_v1.GatewayClient { + return gateway_networking_k8s_io_v1.NewGatewayClient(client) +} + +type GatewayClientFactory func(client client.Client) gateway_networking_k8s_io_v1.GatewayClient + +func GatewayClientFactoryProvider() GatewayClientFactory { + return GatewayClientProvider +} + +type GatewayClientFromConfigFactory func(cfg *rest.Config) (gateway_networking_k8s_io_v1.GatewayClient, error) + +func GatewayClientFromConfigFactoryProvider() GatewayClientFromConfigFactory { + return func(cfg *rest.Config) (gateway_networking_k8s_io_v1.GatewayClient, error) { + clients, err := gateway_networking_k8s_io_v1.NewClientsetFromConfig(cfg) + if err != nil { + return nil, err + } + return clients.Gateways(), nil + } +} + +// Provider for HTTPRouteClient from Clientset +func HTTPRouteClientFromClientsetProvider(clients gateway_networking_k8s_io_v1.Clientset) gateway_networking_k8s_io_v1.HTTPRouteClient { + return clients.HTTPRoutes() +} + +// Provider for HTTPRoute Client from Client +func HTTPRouteClientProvider(client client.Client) gateway_networking_k8s_io_v1.HTTPRouteClient { + return gateway_networking_k8s_io_v1.NewHTTPRouteClient(client) +} + +type HTTPRouteClientFactory func(client client.Client) gateway_networking_k8s_io_v1.HTTPRouteClient + +func HTTPRouteClientFactoryProvider() HTTPRouteClientFactory { + return HTTPRouteClientProvider +} + +type HTTPRouteClientFromConfigFactory func(cfg *rest.Config) (gateway_networking_k8s_io_v1.HTTPRouteClient, error) + +func HTTPRouteClientFromConfigFactoryProvider() HTTPRouteClientFromConfigFactory { + return func(cfg *rest.Config) (gateway_networking_k8s_io_v1.HTTPRouteClient, error) { + clients, err := gateway_networking_k8s_io_v1.NewClientsetFromConfig(cfg) + if err != nil { + return nil, err + } + return clients.HTTPRoutes(), nil + } +} diff --git a/pkg/api/k8s-gw/apis/gateway.networking.k8s.io/v1/sets/mocks/sets.go b/pkg/api/k8s-gw/apis/gateway.networking.k8s.io/v1/sets/mocks/sets.go new file mode 100644 index 0000000..ad244f8 --- /dev/null +++ b/pkg/api/k8s-gw/apis/gateway.networking.k8s.io/v1/sets/mocks/sets.go @@ -0,0 +1,784 @@ +// Code generated by MockGen. DO NOT EDIT. +// Source: ./sets.go + +// Package mock_v1sets is a generated GoMock package. +package mock_v1sets + +import ( + reflect "reflect" + + gomock "github.com/golang/mock/gomock" + v1sets "github.com/solo-io/external-apis/pkg/api/k8s-gw/apis/gateway.networking.k8s.io/v1/sets" + sets "github.com/solo-io/skv2/contrib/pkg/sets" + ezkube "github.com/solo-io/skv2/pkg/ezkube" + sets0 "k8s.io/apimachinery/pkg/util/sets" + v1 "sigs.k8s.io/gateway-api/apis/v1" +) + +// MockGatewayClassSet is a mock of GatewayClassSet interface. +type MockGatewayClassSet struct { + ctrl *gomock.Controller + recorder *MockGatewayClassSetMockRecorder +} + +// MockGatewayClassSetMockRecorder is the mock recorder for MockGatewayClassSet. +type MockGatewayClassSetMockRecorder struct { + mock *MockGatewayClassSet +} + +// NewMockGatewayClassSet creates a new mock instance. +func NewMockGatewayClassSet(ctrl *gomock.Controller) *MockGatewayClassSet { + mock := &MockGatewayClassSet{ctrl: ctrl} + mock.recorder = &MockGatewayClassSetMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockGatewayClassSet) EXPECT() *MockGatewayClassSetMockRecorder { + return m.recorder +} + +// Clone mocks base method. +func (m *MockGatewayClassSet) Clone() v1sets.GatewayClassSet { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Clone") + ret0, _ := ret[0].(v1sets.GatewayClassSet) + return ret0 +} + +// Clone indicates an expected call of Clone. +func (mr *MockGatewayClassSetMockRecorder) Clone() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Clone", reflect.TypeOf((*MockGatewayClassSet)(nil).Clone)) +} + +// Delete mocks base method. +func (m *MockGatewayClassSet) Delete(gatewayClass ezkube.ResourceId) { + m.ctrl.T.Helper() + m.ctrl.Call(m, "Delete", gatewayClass) +} + +// Delete indicates an expected call of Delete. +func (mr *MockGatewayClassSetMockRecorder) Delete(gatewayClass interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Delete", reflect.TypeOf((*MockGatewayClassSet)(nil).Delete), gatewayClass) +} + +// Delta mocks base method. +func (m *MockGatewayClassSet) Delta(newSet v1sets.GatewayClassSet) sets.ResourceDelta { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Delta", newSet) + ret0, _ := ret[0].(sets.ResourceDelta) + return ret0 +} + +// Delta indicates an expected call of Delta. +func (mr *MockGatewayClassSetMockRecorder) Delta(newSet interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Delta", reflect.TypeOf((*MockGatewayClassSet)(nil).Delta), newSet) +} + +// Difference mocks base method. +func (m *MockGatewayClassSet) Difference(set v1sets.GatewayClassSet) v1sets.GatewayClassSet { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Difference", set) + ret0, _ := ret[0].(v1sets.GatewayClassSet) + return ret0 +} + +// Difference indicates an expected call of Difference. +func (mr *MockGatewayClassSetMockRecorder) Difference(set interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Difference", reflect.TypeOf((*MockGatewayClassSet)(nil).Difference), set) +} + +// Equal mocks base method. +func (m *MockGatewayClassSet) Equal(gatewayClassSet v1sets.GatewayClassSet) bool { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Equal", gatewayClassSet) + ret0, _ := ret[0].(bool) + return ret0 +} + +// Equal indicates an expected call of Equal. +func (mr *MockGatewayClassSetMockRecorder) Equal(gatewayClassSet interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Equal", reflect.TypeOf((*MockGatewayClassSet)(nil).Equal), gatewayClassSet) +} + +// Find mocks base method. +func (m *MockGatewayClassSet) Find(id ezkube.ResourceId) (*v1.GatewayClass, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Find", id) + ret0, _ := ret[0].(*v1.GatewayClass) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// Find indicates an expected call of Find. +func (mr *MockGatewayClassSetMockRecorder) Find(id interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Find", reflect.TypeOf((*MockGatewayClassSet)(nil).Find), id) +} + +// Generic mocks base method. +func (m *MockGatewayClassSet) Generic() sets.ResourceSet { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Generic") + ret0, _ := ret[0].(sets.ResourceSet) + return ret0 +} + +// Generic indicates an expected call of Generic. +func (mr *MockGatewayClassSetMockRecorder) Generic() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Generic", reflect.TypeOf((*MockGatewayClassSet)(nil).Generic)) +} + +// Has mocks base method. +func (m *MockGatewayClassSet) Has(gatewayClass ezkube.ResourceId) bool { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Has", gatewayClass) + ret0, _ := ret[0].(bool) + return ret0 +} + +// Has indicates an expected call of Has. +func (mr *MockGatewayClassSetMockRecorder) Has(gatewayClass interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Has", reflect.TypeOf((*MockGatewayClassSet)(nil).Has), gatewayClass) +} + +// Insert mocks base method. +func (m *MockGatewayClassSet) Insert(gatewayClass ...*v1.GatewayClass) { + m.ctrl.T.Helper() + varargs := []interface{}{} + for _, a := range gatewayClass { + varargs = append(varargs, a) + } + m.ctrl.Call(m, "Insert", varargs...) +} + +// Insert indicates an expected call of Insert. +func (mr *MockGatewayClassSetMockRecorder) Insert(gatewayClass ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Insert", reflect.TypeOf((*MockGatewayClassSet)(nil).Insert), gatewayClass...) +} + +// Intersection mocks base method. +func (m *MockGatewayClassSet) Intersection(set v1sets.GatewayClassSet) v1sets.GatewayClassSet { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Intersection", set) + ret0, _ := ret[0].(v1sets.GatewayClassSet) + return ret0 +} + +// Intersection indicates an expected call of Intersection. +func (mr *MockGatewayClassSetMockRecorder) Intersection(set interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Intersection", reflect.TypeOf((*MockGatewayClassSet)(nil).Intersection), set) +} + +// Keys mocks base method. +func (m *MockGatewayClassSet) Keys() sets0.String { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Keys") + ret0, _ := ret[0].(sets0.String) + return ret0 +} + +// Keys indicates an expected call of Keys. +func (mr *MockGatewayClassSetMockRecorder) Keys() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Keys", reflect.TypeOf((*MockGatewayClassSet)(nil).Keys)) +} + +// Length mocks base method. +func (m *MockGatewayClassSet) Length() int { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Length") + ret0, _ := ret[0].(int) + return ret0 +} + +// Length indicates an expected call of Length. +func (mr *MockGatewayClassSetMockRecorder) Length() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Length", reflect.TypeOf((*MockGatewayClassSet)(nil).Length)) +} + +// List mocks base method. +func (m *MockGatewayClassSet) List(filterResource ...func(*v1.GatewayClass) bool) []*v1.GatewayClass { + m.ctrl.T.Helper() + varargs := []interface{}{} + for _, a := range filterResource { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "List", varargs...) + ret0, _ := ret[0].([]*v1.GatewayClass) + return ret0 +} + +// List indicates an expected call of List. +func (mr *MockGatewayClassSetMockRecorder) List(filterResource ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "List", reflect.TypeOf((*MockGatewayClassSet)(nil).List), filterResource...) +} + +// Map mocks base method. +func (m *MockGatewayClassSet) Map() map[string]*v1.GatewayClass { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Map") + ret0, _ := ret[0].(map[string]*v1.GatewayClass) + return ret0 +} + +// Map indicates an expected call of Map. +func (mr *MockGatewayClassSetMockRecorder) Map() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Map", reflect.TypeOf((*MockGatewayClassSet)(nil).Map)) +} + +// Union mocks base method. +func (m *MockGatewayClassSet) Union(set v1sets.GatewayClassSet) v1sets.GatewayClassSet { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Union", set) + ret0, _ := ret[0].(v1sets.GatewayClassSet) + return ret0 +} + +// Union indicates an expected call of Union. +func (mr *MockGatewayClassSetMockRecorder) Union(set interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Union", reflect.TypeOf((*MockGatewayClassSet)(nil).Union), set) +} + +// UnsortedList mocks base method. +func (m *MockGatewayClassSet) UnsortedList(filterResource ...func(*v1.GatewayClass) bool) []*v1.GatewayClass { + m.ctrl.T.Helper() + varargs := []interface{}{} + for _, a := range filterResource { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "UnsortedList", varargs...) + ret0, _ := ret[0].([]*v1.GatewayClass) + return ret0 +} + +// UnsortedList indicates an expected call of UnsortedList. +func (mr *MockGatewayClassSetMockRecorder) UnsortedList(filterResource ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UnsortedList", reflect.TypeOf((*MockGatewayClassSet)(nil).UnsortedList), filterResource...) +} + +// MockGatewaySet is a mock of GatewaySet interface. +type MockGatewaySet struct { + ctrl *gomock.Controller + recorder *MockGatewaySetMockRecorder +} + +// MockGatewaySetMockRecorder is the mock recorder for MockGatewaySet. +type MockGatewaySetMockRecorder struct { + mock *MockGatewaySet +} + +// NewMockGatewaySet creates a new mock instance. +func NewMockGatewaySet(ctrl *gomock.Controller) *MockGatewaySet { + mock := &MockGatewaySet{ctrl: ctrl} + mock.recorder = &MockGatewaySetMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockGatewaySet) EXPECT() *MockGatewaySetMockRecorder { + return m.recorder +} + +// Clone mocks base method. +func (m *MockGatewaySet) Clone() v1sets.GatewaySet { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Clone") + ret0, _ := ret[0].(v1sets.GatewaySet) + return ret0 +} + +// Clone indicates an expected call of Clone. +func (mr *MockGatewaySetMockRecorder) Clone() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Clone", reflect.TypeOf((*MockGatewaySet)(nil).Clone)) +} + +// Delete mocks base method. +func (m *MockGatewaySet) Delete(gateway ezkube.ResourceId) { + m.ctrl.T.Helper() + m.ctrl.Call(m, "Delete", gateway) +} + +// Delete indicates an expected call of Delete. +func (mr *MockGatewaySetMockRecorder) Delete(gateway interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Delete", reflect.TypeOf((*MockGatewaySet)(nil).Delete), gateway) +} + +// Delta mocks base method. +func (m *MockGatewaySet) Delta(newSet v1sets.GatewaySet) sets.ResourceDelta { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Delta", newSet) + ret0, _ := ret[0].(sets.ResourceDelta) + return ret0 +} + +// Delta indicates an expected call of Delta. +func (mr *MockGatewaySetMockRecorder) Delta(newSet interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Delta", reflect.TypeOf((*MockGatewaySet)(nil).Delta), newSet) +} + +// Difference mocks base method. +func (m *MockGatewaySet) Difference(set v1sets.GatewaySet) v1sets.GatewaySet { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Difference", set) + ret0, _ := ret[0].(v1sets.GatewaySet) + return ret0 +} + +// Difference indicates an expected call of Difference. +func (mr *MockGatewaySetMockRecorder) Difference(set interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Difference", reflect.TypeOf((*MockGatewaySet)(nil).Difference), set) +} + +// Equal mocks base method. +func (m *MockGatewaySet) Equal(gatewaySet v1sets.GatewaySet) bool { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Equal", gatewaySet) + ret0, _ := ret[0].(bool) + return ret0 +} + +// Equal indicates an expected call of Equal. +func (mr *MockGatewaySetMockRecorder) Equal(gatewaySet interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Equal", reflect.TypeOf((*MockGatewaySet)(nil).Equal), gatewaySet) +} + +// Find mocks base method. +func (m *MockGatewaySet) Find(id ezkube.ResourceId) (*v1.Gateway, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Find", id) + ret0, _ := ret[0].(*v1.Gateway) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// Find indicates an expected call of Find. +func (mr *MockGatewaySetMockRecorder) Find(id interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Find", reflect.TypeOf((*MockGatewaySet)(nil).Find), id) +} + +// Generic mocks base method. +func (m *MockGatewaySet) Generic() sets.ResourceSet { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Generic") + ret0, _ := ret[0].(sets.ResourceSet) + return ret0 +} + +// Generic indicates an expected call of Generic. +func (mr *MockGatewaySetMockRecorder) Generic() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Generic", reflect.TypeOf((*MockGatewaySet)(nil).Generic)) +} + +// Has mocks base method. +func (m *MockGatewaySet) Has(gateway ezkube.ResourceId) bool { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Has", gateway) + ret0, _ := ret[0].(bool) + return ret0 +} + +// Has indicates an expected call of Has. +func (mr *MockGatewaySetMockRecorder) Has(gateway interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Has", reflect.TypeOf((*MockGatewaySet)(nil).Has), gateway) +} + +// Insert mocks base method. +func (m *MockGatewaySet) Insert(gateway ...*v1.Gateway) { + m.ctrl.T.Helper() + varargs := []interface{}{} + for _, a := range gateway { + varargs = append(varargs, a) + } + m.ctrl.Call(m, "Insert", varargs...) +} + +// Insert indicates an expected call of Insert. +func (mr *MockGatewaySetMockRecorder) Insert(gateway ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Insert", reflect.TypeOf((*MockGatewaySet)(nil).Insert), gateway...) +} + +// Intersection mocks base method. +func (m *MockGatewaySet) Intersection(set v1sets.GatewaySet) v1sets.GatewaySet { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Intersection", set) + ret0, _ := ret[0].(v1sets.GatewaySet) + return ret0 +} + +// Intersection indicates an expected call of Intersection. +func (mr *MockGatewaySetMockRecorder) Intersection(set interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Intersection", reflect.TypeOf((*MockGatewaySet)(nil).Intersection), set) +} + +// Keys mocks base method. +func (m *MockGatewaySet) Keys() sets0.String { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Keys") + ret0, _ := ret[0].(sets0.String) + return ret0 +} + +// Keys indicates an expected call of Keys. +func (mr *MockGatewaySetMockRecorder) Keys() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Keys", reflect.TypeOf((*MockGatewaySet)(nil).Keys)) +} + +// Length mocks base method. +func (m *MockGatewaySet) Length() int { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Length") + ret0, _ := ret[0].(int) + return ret0 +} + +// Length indicates an expected call of Length. +func (mr *MockGatewaySetMockRecorder) Length() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Length", reflect.TypeOf((*MockGatewaySet)(nil).Length)) +} + +// List mocks base method. +func (m *MockGatewaySet) List(filterResource ...func(*v1.Gateway) bool) []*v1.Gateway { + m.ctrl.T.Helper() + varargs := []interface{}{} + for _, a := range filterResource { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "List", varargs...) + ret0, _ := ret[0].([]*v1.Gateway) + return ret0 +} + +// List indicates an expected call of List. +func (mr *MockGatewaySetMockRecorder) List(filterResource ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "List", reflect.TypeOf((*MockGatewaySet)(nil).List), filterResource...) +} + +// Map mocks base method. +func (m *MockGatewaySet) Map() map[string]*v1.Gateway { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Map") + ret0, _ := ret[0].(map[string]*v1.Gateway) + return ret0 +} + +// Map indicates an expected call of Map. +func (mr *MockGatewaySetMockRecorder) Map() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Map", reflect.TypeOf((*MockGatewaySet)(nil).Map)) +} + +// Union mocks base method. +func (m *MockGatewaySet) Union(set v1sets.GatewaySet) v1sets.GatewaySet { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Union", set) + ret0, _ := ret[0].(v1sets.GatewaySet) + return ret0 +} + +// Union indicates an expected call of Union. +func (mr *MockGatewaySetMockRecorder) Union(set interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Union", reflect.TypeOf((*MockGatewaySet)(nil).Union), set) +} + +// UnsortedList mocks base method. +func (m *MockGatewaySet) UnsortedList(filterResource ...func(*v1.Gateway) bool) []*v1.Gateway { + m.ctrl.T.Helper() + varargs := []interface{}{} + for _, a := range filterResource { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "UnsortedList", varargs...) + ret0, _ := ret[0].([]*v1.Gateway) + return ret0 +} + +// UnsortedList indicates an expected call of UnsortedList. +func (mr *MockGatewaySetMockRecorder) UnsortedList(filterResource ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UnsortedList", reflect.TypeOf((*MockGatewaySet)(nil).UnsortedList), filterResource...) +} + +// MockHTTPRouteSet is a mock of HTTPRouteSet interface. +type MockHTTPRouteSet struct { + ctrl *gomock.Controller + recorder *MockHTTPRouteSetMockRecorder +} + +// MockHTTPRouteSetMockRecorder is the mock recorder for MockHTTPRouteSet. +type MockHTTPRouteSetMockRecorder struct { + mock *MockHTTPRouteSet +} + +// NewMockHTTPRouteSet creates a new mock instance. +func NewMockHTTPRouteSet(ctrl *gomock.Controller) *MockHTTPRouteSet { + mock := &MockHTTPRouteSet{ctrl: ctrl} + mock.recorder = &MockHTTPRouteSetMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockHTTPRouteSet) EXPECT() *MockHTTPRouteSetMockRecorder { + return m.recorder +} + +// Clone mocks base method. +func (m *MockHTTPRouteSet) Clone() v1sets.HTTPRouteSet { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Clone") + ret0, _ := ret[0].(v1sets.HTTPRouteSet) + return ret0 +} + +// Clone indicates an expected call of Clone. +func (mr *MockHTTPRouteSetMockRecorder) Clone() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Clone", reflect.TypeOf((*MockHTTPRouteSet)(nil).Clone)) +} + +// Delete mocks base method. +func (m *MockHTTPRouteSet) Delete(hTTPRoute ezkube.ResourceId) { + m.ctrl.T.Helper() + m.ctrl.Call(m, "Delete", hTTPRoute) +} + +// Delete indicates an expected call of Delete. +func (mr *MockHTTPRouteSetMockRecorder) Delete(hTTPRoute interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Delete", reflect.TypeOf((*MockHTTPRouteSet)(nil).Delete), hTTPRoute) +} + +// Delta mocks base method. +func (m *MockHTTPRouteSet) Delta(newSet v1sets.HTTPRouteSet) sets.ResourceDelta { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Delta", newSet) + ret0, _ := ret[0].(sets.ResourceDelta) + return ret0 +} + +// Delta indicates an expected call of Delta. +func (mr *MockHTTPRouteSetMockRecorder) Delta(newSet interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Delta", reflect.TypeOf((*MockHTTPRouteSet)(nil).Delta), newSet) +} + +// Difference mocks base method. +func (m *MockHTTPRouteSet) Difference(set v1sets.HTTPRouteSet) v1sets.HTTPRouteSet { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Difference", set) + ret0, _ := ret[0].(v1sets.HTTPRouteSet) + return ret0 +} + +// Difference indicates an expected call of Difference. +func (mr *MockHTTPRouteSetMockRecorder) Difference(set interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Difference", reflect.TypeOf((*MockHTTPRouteSet)(nil).Difference), set) +} + +// Equal mocks base method. +func (m *MockHTTPRouteSet) Equal(hTTPRouteSet v1sets.HTTPRouteSet) bool { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Equal", hTTPRouteSet) + ret0, _ := ret[0].(bool) + return ret0 +} + +// Equal indicates an expected call of Equal. +func (mr *MockHTTPRouteSetMockRecorder) Equal(hTTPRouteSet interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Equal", reflect.TypeOf((*MockHTTPRouteSet)(nil).Equal), hTTPRouteSet) +} + +// Find mocks base method. +func (m *MockHTTPRouteSet) Find(id ezkube.ResourceId) (*v1.HTTPRoute, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Find", id) + ret0, _ := ret[0].(*v1.HTTPRoute) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// Find indicates an expected call of Find. +func (mr *MockHTTPRouteSetMockRecorder) Find(id interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Find", reflect.TypeOf((*MockHTTPRouteSet)(nil).Find), id) +} + +// Generic mocks base method. +func (m *MockHTTPRouteSet) Generic() sets.ResourceSet { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Generic") + ret0, _ := ret[0].(sets.ResourceSet) + return ret0 +} + +// Generic indicates an expected call of Generic. +func (mr *MockHTTPRouteSetMockRecorder) Generic() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Generic", reflect.TypeOf((*MockHTTPRouteSet)(nil).Generic)) +} + +// Has mocks base method. +func (m *MockHTTPRouteSet) Has(hTTPRoute ezkube.ResourceId) bool { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Has", hTTPRoute) + ret0, _ := ret[0].(bool) + return ret0 +} + +// Has indicates an expected call of Has. +func (mr *MockHTTPRouteSetMockRecorder) Has(hTTPRoute interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Has", reflect.TypeOf((*MockHTTPRouteSet)(nil).Has), hTTPRoute) +} + +// Insert mocks base method. +func (m *MockHTTPRouteSet) Insert(hTTPRoute ...*v1.HTTPRoute) { + m.ctrl.T.Helper() + varargs := []interface{}{} + for _, a := range hTTPRoute { + varargs = append(varargs, a) + } + m.ctrl.Call(m, "Insert", varargs...) +} + +// Insert indicates an expected call of Insert. +func (mr *MockHTTPRouteSetMockRecorder) Insert(hTTPRoute ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Insert", reflect.TypeOf((*MockHTTPRouteSet)(nil).Insert), hTTPRoute...) +} + +// Intersection mocks base method. +func (m *MockHTTPRouteSet) Intersection(set v1sets.HTTPRouteSet) v1sets.HTTPRouteSet { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Intersection", set) + ret0, _ := ret[0].(v1sets.HTTPRouteSet) + return ret0 +} + +// Intersection indicates an expected call of Intersection. +func (mr *MockHTTPRouteSetMockRecorder) Intersection(set interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Intersection", reflect.TypeOf((*MockHTTPRouteSet)(nil).Intersection), set) +} + +// Keys mocks base method. +func (m *MockHTTPRouteSet) Keys() sets0.String { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Keys") + ret0, _ := ret[0].(sets0.String) + return ret0 +} + +// Keys indicates an expected call of Keys. +func (mr *MockHTTPRouteSetMockRecorder) Keys() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Keys", reflect.TypeOf((*MockHTTPRouteSet)(nil).Keys)) +} + +// Length mocks base method. +func (m *MockHTTPRouteSet) Length() int { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Length") + ret0, _ := ret[0].(int) + return ret0 +} + +// Length indicates an expected call of Length. +func (mr *MockHTTPRouteSetMockRecorder) Length() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Length", reflect.TypeOf((*MockHTTPRouteSet)(nil).Length)) +} + +// List mocks base method. +func (m *MockHTTPRouteSet) List(filterResource ...func(*v1.HTTPRoute) bool) []*v1.HTTPRoute { + m.ctrl.T.Helper() + varargs := []interface{}{} + for _, a := range filterResource { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "List", varargs...) + ret0, _ := ret[0].([]*v1.HTTPRoute) + return ret0 +} + +// List indicates an expected call of List. +func (mr *MockHTTPRouteSetMockRecorder) List(filterResource ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "List", reflect.TypeOf((*MockHTTPRouteSet)(nil).List), filterResource...) +} + +// Map mocks base method. +func (m *MockHTTPRouteSet) Map() map[string]*v1.HTTPRoute { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Map") + ret0, _ := ret[0].(map[string]*v1.HTTPRoute) + return ret0 +} + +// Map indicates an expected call of Map. +func (mr *MockHTTPRouteSetMockRecorder) Map() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Map", reflect.TypeOf((*MockHTTPRouteSet)(nil).Map)) +} + +// Union mocks base method. +func (m *MockHTTPRouteSet) Union(set v1sets.HTTPRouteSet) v1sets.HTTPRouteSet { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Union", set) + ret0, _ := ret[0].(v1sets.HTTPRouteSet) + return ret0 +} + +// Union indicates an expected call of Union. +func (mr *MockHTTPRouteSetMockRecorder) Union(set interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Union", reflect.TypeOf((*MockHTTPRouteSet)(nil).Union), set) +} + +// UnsortedList mocks base method. +func (m *MockHTTPRouteSet) UnsortedList(filterResource ...func(*v1.HTTPRoute) bool) []*v1.HTTPRoute { + m.ctrl.T.Helper() + varargs := []interface{}{} + for _, a := range filterResource { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "UnsortedList", varargs...) + ret0, _ := ret[0].([]*v1.HTTPRoute) + return ret0 +} + +// UnsortedList indicates an expected call of UnsortedList. +func (mr *MockHTTPRouteSetMockRecorder) UnsortedList(filterResource ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UnsortedList", reflect.TypeOf((*MockHTTPRouteSet)(nil).UnsortedList), filterResource...) +} diff --git a/pkg/api/k8s-gw/apis/gateway.networking.k8s.io/v1/sets/sets.go b/pkg/api/k8s-gw/apis/gateway.networking.k8s.io/v1/sets/sets.go new file mode 100644 index 0000000..4221f34 --- /dev/null +++ b/pkg/api/k8s-gw/apis/gateway.networking.k8s.io/v1/sets/sets.go @@ -0,0 +1,683 @@ +// Code generated by skv2. DO NOT EDIT. + +//go:generate mockgen -source ./sets.go -destination mocks/sets.go + +package v1sets + +import ( + gateway_networking_k8s_io_v1 "sigs.k8s.io/gateway-api/apis/v1" + + "github.com/rotisserie/eris" + sksets "github.com/solo-io/skv2/contrib/pkg/sets" + "github.com/solo-io/skv2/pkg/ezkube" + "k8s.io/apimachinery/pkg/util/sets" +) + +type GatewayClassSet interface { + // Get the set stored keys + Keys() sets.String + // List of resources stored in the set. Pass an optional filter function to filter on the list. + // The filter function should return false to keep the resource, true to drop it. + List(filterResource ...func(*gateway_networking_k8s_io_v1.GatewayClass) bool) []*gateway_networking_k8s_io_v1.GatewayClass + // Unsorted list of resources stored in the set. Pass an optional filter function to filter on the list. + // The filter function should return false to keep the resource, true to drop it. + UnsortedList(filterResource ...func(*gateway_networking_k8s_io_v1.GatewayClass) bool) []*gateway_networking_k8s_io_v1.GatewayClass + // Return the Set as a map of key to resource. + Map() map[string]*gateway_networking_k8s_io_v1.GatewayClass + // Insert a resource into the set. + Insert(gatewayClass ...*gateway_networking_k8s_io_v1.GatewayClass) + // Compare the equality of the keys in two sets (not the resources themselves) + Equal(gatewayClassSet GatewayClassSet) bool + // Check if the set contains a key matching the resource (not the resource itself) + Has(gatewayClass ezkube.ResourceId) bool + // Delete the key matching the resource + Delete(gatewayClass ezkube.ResourceId) + // Return the union with the provided set + Union(set GatewayClassSet) GatewayClassSet + // Return the difference with the provided set + Difference(set GatewayClassSet) GatewayClassSet + // Return the intersection with the provided set + Intersection(set GatewayClassSet) GatewayClassSet + // Find the resource with the given ID + Find(id ezkube.ResourceId) (*gateway_networking_k8s_io_v1.GatewayClass, error) + // Get the length of the set + Length() int + // returns the generic implementation of the set + Generic() sksets.ResourceSet + // returns the delta between this and and another GatewayClassSet + Delta(newSet GatewayClassSet) sksets.ResourceDelta + // Create a deep copy of the current GatewayClassSet + Clone() GatewayClassSet +} + +func makeGenericGatewayClassSet(gatewayClassList []*gateway_networking_k8s_io_v1.GatewayClass) sksets.ResourceSet { + var genericResources []ezkube.ResourceId + for _, obj := range gatewayClassList { + genericResources = append(genericResources, obj) + } + return sksets.NewResourceSet(genericResources...) +} + +type gatewayClassSet struct { + set sksets.ResourceSet +} + +func NewGatewayClassSet(gatewayClassList ...*gateway_networking_k8s_io_v1.GatewayClass) GatewayClassSet { + return &gatewayClassSet{set: makeGenericGatewayClassSet(gatewayClassList)} +} + +func NewGatewayClassSetFromList(gatewayClassList *gateway_networking_k8s_io_v1.GatewayClassList) GatewayClassSet { + list := make([]*gateway_networking_k8s_io_v1.GatewayClass, 0, len(gatewayClassList.Items)) + for idx := range gatewayClassList.Items { + list = append(list, &gatewayClassList.Items[idx]) + } + return &gatewayClassSet{set: makeGenericGatewayClassSet(list)} +} + +func (s *gatewayClassSet) Keys() sets.String { + if s == nil { + return sets.String{} + } + return s.Generic().Keys() +} + +func (s *gatewayClassSet) List(filterResource ...func(*gateway_networking_k8s_io_v1.GatewayClass) bool) []*gateway_networking_k8s_io_v1.GatewayClass { + if s == nil { + return nil + } + var genericFilters []func(ezkube.ResourceId) bool + for _, filter := range filterResource { + filter := filter + genericFilters = append(genericFilters, func(obj ezkube.ResourceId) bool { + return filter(obj.(*gateway_networking_k8s_io_v1.GatewayClass)) + }) + } + + objs := s.Generic().List(genericFilters...) + gatewayClassList := make([]*gateway_networking_k8s_io_v1.GatewayClass, 0, len(objs)) + for _, obj := range objs { + gatewayClassList = append(gatewayClassList, obj.(*gateway_networking_k8s_io_v1.GatewayClass)) + } + return gatewayClassList +} + +func (s *gatewayClassSet) UnsortedList(filterResource ...func(*gateway_networking_k8s_io_v1.GatewayClass) bool) []*gateway_networking_k8s_io_v1.GatewayClass { + if s == nil { + return nil + } + var genericFilters []func(ezkube.ResourceId) bool + for _, filter := range filterResource { + filter := filter + genericFilters = append(genericFilters, func(obj ezkube.ResourceId) bool { + return filter(obj.(*gateway_networking_k8s_io_v1.GatewayClass)) + }) + } + + var gatewayClassList []*gateway_networking_k8s_io_v1.GatewayClass + for _, obj := range s.Generic().UnsortedList(genericFilters...) { + gatewayClassList = append(gatewayClassList, obj.(*gateway_networking_k8s_io_v1.GatewayClass)) + } + return gatewayClassList +} + +func (s *gatewayClassSet) Map() map[string]*gateway_networking_k8s_io_v1.GatewayClass { + if s == nil { + return nil + } + + newMap := map[string]*gateway_networking_k8s_io_v1.GatewayClass{} + for k, v := range s.Generic().Map() { + newMap[k] = v.(*gateway_networking_k8s_io_v1.GatewayClass) + } + return newMap +} + +func (s *gatewayClassSet) Insert( + gatewayClassList ...*gateway_networking_k8s_io_v1.GatewayClass, +) { + if s == nil { + panic("cannot insert into nil set") + } + + for _, obj := range gatewayClassList { + s.Generic().Insert(obj) + } +} + +func (s *gatewayClassSet) Has(gatewayClass ezkube.ResourceId) bool { + if s == nil { + return false + } + return s.Generic().Has(gatewayClass) +} + +func (s *gatewayClassSet) Equal( + gatewayClassSet GatewayClassSet, +) bool { + if s == nil { + return gatewayClassSet == nil + } + return s.Generic().Equal(gatewayClassSet.Generic()) +} + +func (s *gatewayClassSet) Delete(GatewayClass ezkube.ResourceId) { + if s == nil { + return + } + s.Generic().Delete(GatewayClass) +} + +func (s *gatewayClassSet) Union(set GatewayClassSet) GatewayClassSet { + if s == nil { + return set + } + return NewGatewayClassSet(append(s.List(), set.List()...)...) +} + +func (s *gatewayClassSet) Difference(set GatewayClassSet) GatewayClassSet { + if s == nil { + return set + } + newSet := s.Generic().Difference(set.Generic()) + return &gatewayClassSet{set: newSet} +} + +func (s *gatewayClassSet) Intersection(set GatewayClassSet) GatewayClassSet { + if s == nil { + return nil + } + newSet := s.Generic().Intersection(set.Generic()) + var gatewayClassList []*gateway_networking_k8s_io_v1.GatewayClass + for _, obj := range newSet.List() { + gatewayClassList = append(gatewayClassList, obj.(*gateway_networking_k8s_io_v1.GatewayClass)) + } + return NewGatewayClassSet(gatewayClassList...) +} + +func (s *gatewayClassSet) Find(id ezkube.ResourceId) (*gateway_networking_k8s_io_v1.GatewayClass, error) { + if s == nil { + return nil, eris.Errorf("empty set, cannot find GatewayClass %v", sksets.Key(id)) + } + obj, err := s.Generic().Find(&gateway_networking_k8s_io_v1.GatewayClass{}, id) + if err != nil { + return nil, err + } + + return obj.(*gateway_networking_k8s_io_v1.GatewayClass), nil +} + +func (s *gatewayClassSet) Length() int { + if s == nil { + return 0 + } + return s.Generic().Length() +} + +func (s *gatewayClassSet) Generic() sksets.ResourceSet { + if s == nil { + return nil + } + return s.set +} + +func (s *gatewayClassSet) Delta(newSet GatewayClassSet) sksets.ResourceDelta { + if s == nil { + return sksets.ResourceDelta{ + Inserted: newSet.Generic(), + } + } + return s.Generic().Delta(newSet.Generic()) +} + +func (s *gatewayClassSet) Clone() GatewayClassSet { + if s == nil { + return nil + } + return &gatewayClassSet{set: sksets.NewResourceSet(s.Generic().Clone().List()...)} +} + +type GatewaySet interface { + // Get the set stored keys + Keys() sets.String + // List of resources stored in the set. Pass an optional filter function to filter on the list. + // The filter function should return false to keep the resource, true to drop it. + List(filterResource ...func(*gateway_networking_k8s_io_v1.Gateway) bool) []*gateway_networking_k8s_io_v1.Gateway + // Unsorted list of resources stored in the set. Pass an optional filter function to filter on the list. + // The filter function should return false to keep the resource, true to drop it. + UnsortedList(filterResource ...func(*gateway_networking_k8s_io_v1.Gateway) bool) []*gateway_networking_k8s_io_v1.Gateway + // Return the Set as a map of key to resource. + Map() map[string]*gateway_networking_k8s_io_v1.Gateway + // Insert a resource into the set. + Insert(gateway ...*gateway_networking_k8s_io_v1.Gateway) + // Compare the equality of the keys in two sets (not the resources themselves) + Equal(gatewaySet GatewaySet) bool + // Check if the set contains a key matching the resource (not the resource itself) + Has(gateway ezkube.ResourceId) bool + // Delete the key matching the resource + Delete(gateway ezkube.ResourceId) + // Return the union with the provided set + Union(set GatewaySet) GatewaySet + // Return the difference with the provided set + Difference(set GatewaySet) GatewaySet + // Return the intersection with the provided set + Intersection(set GatewaySet) GatewaySet + // Find the resource with the given ID + Find(id ezkube.ResourceId) (*gateway_networking_k8s_io_v1.Gateway, error) + // Get the length of the set + Length() int + // returns the generic implementation of the set + Generic() sksets.ResourceSet + // returns the delta between this and and another GatewaySet + Delta(newSet GatewaySet) sksets.ResourceDelta + // Create a deep copy of the current GatewaySet + Clone() GatewaySet +} + +func makeGenericGatewaySet(gatewayList []*gateway_networking_k8s_io_v1.Gateway) sksets.ResourceSet { + var genericResources []ezkube.ResourceId + for _, obj := range gatewayList { + genericResources = append(genericResources, obj) + } + return sksets.NewResourceSet(genericResources...) +} + +type gatewaySet struct { + set sksets.ResourceSet +} + +func NewGatewaySet(gatewayList ...*gateway_networking_k8s_io_v1.Gateway) GatewaySet { + return &gatewaySet{set: makeGenericGatewaySet(gatewayList)} +} + +func NewGatewaySetFromList(gatewayList *gateway_networking_k8s_io_v1.GatewayList) GatewaySet { + list := make([]*gateway_networking_k8s_io_v1.Gateway, 0, len(gatewayList.Items)) + for idx := range gatewayList.Items { + list = append(list, &gatewayList.Items[idx]) + } + return &gatewaySet{set: makeGenericGatewaySet(list)} +} + +func (s *gatewaySet) Keys() sets.String { + if s == nil { + return sets.String{} + } + return s.Generic().Keys() +} + +func (s *gatewaySet) List(filterResource ...func(*gateway_networking_k8s_io_v1.Gateway) bool) []*gateway_networking_k8s_io_v1.Gateway { + if s == nil { + return nil + } + var genericFilters []func(ezkube.ResourceId) bool + for _, filter := range filterResource { + filter := filter + genericFilters = append(genericFilters, func(obj ezkube.ResourceId) bool { + return filter(obj.(*gateway_networking_k8s_io_v1.Gateway)) + }) + } + + objs := s.Generic().List(genericFilters...) + gatewayList := make([]*gateway_networking_k8s_io_v1.Gateway, 0, len(objs)) + for _, obj := range objs { + gatewayList = append(gatewayList, obj.(*gateway_networking_k8s_io_v1.Gateway)) + } + return gatewayList +} + +func (s *gatewaySet) UnsortedList(filterResource ...func(*gateway_networking_k8s_io_v1.Gateway) bool) []*gateway_networking_k8s_io_v1.Gateway { + if s == nil { + return nil + } + var genericFilters []func(ezkube.ResourceId) bool + for _, filter := range filterResource { + filter := filter + genericFilters = append(genericFilters, func(obj ezkube.ResourceId) bool { + return filter(obj.(*gateway_networking_k8s_io_v1.Gateway)) + }) + } + + var gatewayList []*gateway_networking_k8s_io_v1.Gateway + for _, obj := range s.Generic().UnsortedList(genericFilters...) { + gatewayList = append(gatewayList, obj.(*gateway_networking_k8s_io_v1.Gateway)) + } + return gatewayList +} + +func (s *gatewaySet) Map() map[string]*gateway_networking_k8s_io_v1.Gateway { + if s == nil { + return nil + } + + newMap := map[string]*gateway_networking_k8s_io_v1.Gateway{} + for k, v := range s.Generic().Map() { + newMap[k] = v.(*gateway_networking_k8s_io_v1.Gateway) + } + return newMap +} + +func (s *gatewaySet) Insert( + gatewayList ...*gateway_networking_k8s_io_v1.Gateway, +) { + if s == nil { + panic("cannot insert into nil set") + } + + for _, obj := range gatewayList { + s.Generic().Insert(obj) + } +} + +func (s *gatewaySet) Has(gateway ezkube.ResourceId) bool { + if s == nil { + return false + } + return s.Generic().Has(gateway) +} + +func (s *gatewaySet) Equal( + gatewaySet GatewaySet, +) bool { + if s == nil { + return gatewaySet == nil + } + return s.Generic().Equal(gatewaySet.Generic()) +} + +func (s *gatewaySet) Delete(Gateway ezkube.ResourceId) { + if s == nil { + return + } + s.Generic().Delete(Gateway) +} + +func (s *gatewaySet) Union(set GatewaySet) GatewaySet { + if s == nil { + return set + } + return NewGatewaySet(append(s.List(), set.List()...)...) +} + +func (s *gatewaySet) Difference(set GatewaySet) GatewaySet { + if s == nil { + return set + } + newSet := s.Generic().Difference(set.Generic()) + return &gatewaySet{set: newSet} +} + +func (s *gatewaySet) Intersection(set GatewaySet) GatewaySet { + if s == nil { + return nil + } + newSet := s.Generic().Intersection(set.Generic()) + var gatewayList []*gateway_networking_k8s_io_v1.Gateway + for _, obj := range newSet.List() { + gatewayList = append(gatewayList, obj.(*gateway_networking_k8s_io_v1.Gateway)) + } + return NewGatewaySet(gatewayList...) +} + +func (s *gatewaySet) Find(id ezkube.ResourceId) (*gateway_networking_k8s_io_v1.Gateway, error) { + if s == nil { + return nil, eris.Errorf("empty set, cannot find Gateway %v", sksets.Key(id)) + } + obj, err := s.Generic().Find(&gateway_networking_k8s_io_v1.Gateway{}, id) + if err != nil { + return nil, err + } + + return obj.(*gateway_networking_k8s_io_v1.Gateway), nil +} + +func (s *gatewaySet) Length() int { + if s == nil { + return 0 + } + return s.Generic().Length() +} + +func (s *gatewaySet) Generic() sksets.ResourceSet { + if s == nil { + return nil + } + return s.set +} + +func (s *gatewaySet) Delta(newSet GatewaySet) sksets.ResourceDelta { + if s == nil { + return sksets.ResourceDelta{ + Inserted: newSet.Generic(), + } + } + return s.Generic().Delta(newSet.Generic()) +} + +func (s *gatewaySet) Clone() GatewaySet { + if s == nil { + return nil + } + return &gatewaySet{set: sksets.NewResourceSet(s.Generic().Clone().List()...)} +} + +type HTTPRouteSet interface { + // Get the set stored keys + Keys() sets.String + // List of resources stored in the set. Pass an optional filter function to filter on the list. + // The filter function should return false to keep the resource, true to drop it. + List(filterResource ...func(*gateway_networking_k8s_io_v1.HTTPRoute) bool) []*gateway_networking_k8s_io_v1.HTTPRoute + // Unsorted list of resources stored in the set. Pass an optional filter function to filter on the list. + // The filter function should return false to keep the resource, true to drop it. + UnsortedList(filterResource ...func(*gateway_networking_k8s_io_v1.HTTPRoute) bool) []*gateway_networking_k8s_io_v1.HTTPRoute + // Return the Set as a map of key to resource. + Map() map[string]*gateway_networking_k8s_io_v1.HTTPRoute + // Insert a resource into the set. + Insert(hTTPRoute ...*gateway_networking_k8s_io_v1.HTTPRoute) + // Compare the equality of the keys in two sets (not the resources themselves) + Equal(hTTPRouteSet HTTPRouteSet) bool + // Check if the set contains a key matching the resource (not the resource itself) + Has(hTTPRoute ezkube.ResourceId) bool + // Delete the key matching the resource + Delete(hTTPRoute ezkube.ResourceId) + // Return the union with the provided set + Union(set HTTPRouteSet) HTTPRouteSet + // Return the difference with the provided set + Difference(set HTTPRouteSet) HTTPRouteSet + // Return the intersection with the provided set + Intersection(set HTTPRouteSet) HTTPRouteSet + // Find the resource with the given ID + Find(id ezkube.ResourceId) (*gateway_networking_k8s_io_v1.HTTPRoute, error) + // Get the length of the set + Length() int + // returns the generic implementation of the set + Generic() sksets.ResourceSet + // returns the delta between this and and another HTTPRouteSet + Delta(newSet HTTPRouteSet) sksets.ResourceDelta + // Create a deep copy of the current HTTPRouteSet + Clone() HTTPRouteSet +} + +func makeGenericHTTPRouteSet(hTTPRouteList []*gateway_networking_k8s_io_v1.HTTPRoute) sksets.ResourceSet { + var genericResources []ezkube.ResourceId + for _, obj := range hTTPRouteList { + genericResources = append(genericResources, obj) + } + return sksets.NewResourceSet(genericResources...) +} + +type hTTPRouteSet struct { + set sksets.ResourceSet +} + +func NewHTTPRouteSet(hTTPRouteList ...*gateway_networking_k8s_io_v1.HTTPRoute) HTTPRouteSet { + return &hTTPRouteSet{set: makeGenericHTTPRouteSet(hTTPRouteList)} +} + +func NewHTTPRouteSetFromList(hTTPRouteList *gateway_networking_k8s_io_v1.HTTPRouteList) HTTPRouteSet { + list := make([]*gateway_networking_k8s_io_v1.HTTPRoute, 0, len(hTTPRouteList.Items)) + for idx := range hTTPRouteList.Items { + list = append(list, &hTTPRouteList.Items[idx]) + } + return &hTTPRouteSet{set: makeGenericHTTPRouteSet(list)} +} + +func (s *hTTPRouteSet) Keys() sets.String { + if s == nil { + return sets.String{} + } + return s.Generic().Keys() +} + +func (s *hTTPRouteSet) List(filterResource ...func(*gateway_networking_k8s_io_v1.HTTPRoute) bool) []*gateway_networking_k8s_io_v1.HTTPRoute { + if s == nil { + return nil + } + var genericFilters []func(ezkube.ResourceId) bool + for _, filter := range filterResource { + filter := filter + genericFilters = append(genericFilters, func(obj ezkube.ResourceId) bool { + return filter(obj.(*gateway_networking_k8s_io_v1.HTTPRoute)) + }) + } + + objs := s.Generic().List(genericFilters...) + hTTPRouteList := make([]*gateway_networking_k8s_io_v1.HTTPRoute, 0, len(objs)) + for _, obj := range objs { + hTTPRouteList = append(hTTPRouteList, obj.(*gateway_networking_k8s_io_v1.HTTPRoute)) + } + return hTTPRouteList +} + +func (s *hTTPRouteSet) UnsortedList(filterResource ...func(*gateway_networking_k8s_io_v1.HTTPRoute) bool) []*gateway_networking_k8s_io_v1.HTTPRoute { + if s == nil { + return nil + } + var genericFilters []func(ezkube.ResourceId) bool + for _, filter := range filterResource { + filter := filter + genericFilters = append(genericFilters, func(obj ezkube.ResourceId) bool { + return filter(obj.(*gateway_networking_k8s_io_v1.HTTPRoute)) + }) + } + + var hTTPRouteList []*gateway_networking_k8s_io_v1.HTTPRoute + for _, obj := range s.Generic().UnsortedList(genericFilters...) { + hTTPRouteList = append(hTTPRouteList, obj.(*gateway_networking_k8s_io_v1.HTTPRoute)) + } + return hTTPRouteList +} + +func (s *hTTPRouteSet) Map() map[string]*gateway_networking_k8s_io_v1.HTTPRoute { + if s == nil { + return nil + } + + newMap := map[string]*gateway_networking_k8s_io_v1.HTTPRoute{} + for k, v := range s.Generic().Map() { + newMap[k] = v.(*gateway_networking_k8s_io_v1.HTTPRoute) + } + return newMap +} + +func (s *hTTPRouteSet) Insert( + hTTPRouteList ...*gateway_networking_k8s_io_v1.HTTPRoute, +) { + if s == nil { + panic("cannot insert into nil set") + } + + for _, obj := range hTTPRouteList { + s.Generic().Insert(obj) + } +} + +func (s *hTTPRouteSet) Has(hTTPRoute ezkube.ResourceId) bool { + if s == nil { + return false + } + return s.Generic().Has(hTTPRoute) +} + +func (s *hTTPRouteSet) Equal( + hTTPRouteSet HTTPRouteSet, +) bool { + if s == nil { + return hTTPRouteSet == nil + } + return s.Generic().Equal(hTTPRouteSet.Generic()) +} + +func (s *hTTPRouteSet) Delete(HTTPRoute ezkube.ResourceId) { + if s == nil { + return + } + s.Generic().Delete(HTTPRoute) +} + +func (s *hTTPRouteSet) Union(set HTTPRouteSet) HTTPRouteSet { + if s == nil { + return set + } + return NewHTTPRouteSet(append(s.List(), set.List()...)...) +} + +func (s *hTTPRouteSet) Difference(set HTTPRouteSet) HTTPRouteSet { + if s == nil { + return set + } + newSet := s.Generic().Difference(set.Generic()) + return &hTTPRouteSet{set: newSet} +} + +func (s *hTTPRouteSet) Intersection(set HTTPRouteSet) HTTPRouteSet { + if s == nil { + return nil + } + newSet := s.Generic().Intersection(set.Generic()) + var hTTPRouteList []*gateway_networking_k8s_io_v1.HTTPRoute + for _, obj := range newSet.List() { + hTTPRouteList = append(hTTPRouteList, obj.(*gateway_networking_k8s_io_v1.HTTPRoute)) + } + return NewHTTPRouteSet(hTTPRouteList...) +} + +func (s *hTTPRouteSet) Find(id ezkube.ResourceId) (*gateway_networking_k8s_io_v1.HTTPRoute, error) { + if s == nil { + return nil, eris.Errorf("empty set, cannot find HTTPRoute %v", sksets.Key(id)) + } + obj, err := s.Generic().Find(&gateway_networking_k8s_io_v1.HTTPRoute{}, id) + if err != nil { + return nil, err + } + + return obj.(*gateway_networking_k8s_io_v1.HTTPRoute), nil +} + +func (s *hTTPRouteSet) Length() int { + if s == nil { + return 0 + } + return s.Generic().Length() +} + +func (s *hTTPRouteSet) Generic() sksets.ResourceSet { + if s == nil { + return nil + } + return s.set +} + +func (s *hTTPRouteSet) Delta(newSet HTTPRouteSet) sksets.ResourceDelta { + if s == nil { + return sksets.ResourceDelta{ + Inserted: newSet.Generic(), + } + } + return s.Generic().Delta(newSet.Generic()) +} + +func (s *hTTPRouteSet) Clone() HTTPRouteSet { + if s == nil { + return nil + } + return &hTTPRouteSet{set: sksets.NewResourceSet(s.Generic().Clone().List()...)} +} diff --git a/pkg/api/k8s-gw/apis/gateway.networking.k8s.io/v1/type_helpers.go b/pkg/api/k8s-gw/apis/gateway.networking.k8s.io/v1/type_helpers.go new file mode 100644 index 0000000..7734b2b --- /dev/null +++ b/pkg/api/k8s-gw/apis/gateway.networking.k8s.io/v1/type_helpers.go @@ -0,0 +1,17 @@ +// Code generated by skv2. DO NOT EDIT. + +// Definitions for the Kubernetes types +package v1 + +import ( + . "sigs.k8s.io/gateway-api/apis/v1" +) + +// GatewayClassSlice represents a slice of *GatewayClass +type GatewayClassSlice []*GatewayClass + +// GatewaySlice represents a slice of *Gateway +type GatewaySlice []*Gateway + +// HTTPRouteSlice represents a slice of *HTTPRoute +type HTTPRouteSlice []*HTTPRoute