From 298c996e54c4d562c25c2e88e42432a68b1661b7 Mon Sep 17 00:00:00 2001 From: Josh Yan Date: Thu, 30 May 2024 16:02:07 -0700 Subject: [PATCH] added IsValidNamespace function --- types/model/name.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/types/model/name.go b/types/model/name.go index f32b2596..2739b53c 100644 --- a/types/model/name.go +++ b/types/model/name.go @@ -251,6 +251,16 @@ func (n Name) DisplayShortest() string { return sb.String() } +func IsValidNamespace(namespace string) bool { + name := Name{ + Host: "h", + Model: "m", + Namespace: namespace, + Tag: "t", + } + return name.IsValid() +} + // IsValid reports whether all parts of the name are present and valid. The // digest is a special case, and is checked for validity only if present. func (n Name) IsValid() bool {