From c43b635bf0e9313b78ea7174dc138080f9eed885 Mon Sep 17 00:00:00 2001 From: Guilherme Cassolato Date: Mon, 15 Jul 2024 10:35:23 +0200 Subject: [PATCH] Export controller generic Object type so it can be used to wrap any kind of runtime object --- controller/topology.go | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/controller/topology.go b/controller/topology.go index 753ac42..e388bcd 100644 --- a/controller/topology.go +++ b/controller/topology.go @@ -96,7 +96,7 @@ func (t *GatewayAPITopology) Refresh(objs Store) { if ok { return object, ok } - return &genericObject{obj}, true + return &Object{obj}, true }) opts = append(opts, machinery.WithGatewayAPITopologyObjects(objects...)) @@ -115,24 +115,24 @@ func (t *GatewayAPITopology) Get() *machinery.Topology { return &topology } -type genericObject struct { - obj RuntimeObject +type Object struct { + RuntimeObject RuntimeObject } -func (g *genericObject) GroupVersionKind() schema.GroupVersionKind { - return g.obj.GetObjectKind().GroupVersionKind() +func (g *Object) GroupVersionKind() schema.GroupVersionKind { + return g.RuntimeObject.GetObjectKind().GroupVersionKind() } -func (g *genericObject) SetGroupVersionKind(schema.GroupVersionKind) {} +func (g *Object) SetGroupVersionKind(schema.GroupVersionKind) {} -func (g *genericObject) GetNamespace() string { - return g.obj.GetNamespace() +func (g *Object) GetNamespace() string { + return g.RuntimeObject.GetNamespace() } -func (g *genericObject) GetName() string { - return g.obj.GetName() +func (g *Object) GetName() string { + return g.RuntimeObject.GetName() } -func (g *genericObject) GetURL() string { +func (g *Object) GetURL() string { return machinery.UrlFromObject(g) }