From 5f667f8796fb051e110449dd8d775e947cc1801e Mon Sep 17 00:00:00 2001 From: Bjørn Erik Pedersen Date: Sun, 25 Aug 2024 22:51:38 +0200 Subject: Fix missing method NameNormalized panic Closes #12795 --- resources/resource/resourcetypes.go | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'resources') diff --git a/resources/resource/resourcetypes.go b/resources/resource/resourcetypes.go index 8d982b00a..0fb87f371 100644 --- a/resources/resource/resourcetypes.go +++ b/resources/resource/resourcetypes.go @@ -298,3 +298,11 @@ func (r resourceTypesHolder) ResourceType() string { func NewResourceTypesProvider(mediaType media.Type, resourceType string) ResourceTypesProvider { return resourceTypesHolder{mediaType: mediaType, resourceType: resourceType} } + +// NameNormalizedOrName returns the normalized name if available, otherwise the name. +func NameNormalizedOrName(r Resource) string { + if nn, ok := r.(NameNormalizedProvider); ok { + return nn.NameNormalized() + } + return r.Name() +} -- cgit v1.2.3