added pool finder

This commit is contained in:
ston1th 2020-06-04 21:37:23 +02:00
commit 59ad9d8ec5
3 changed files with 53 additions and 11 deletions

View file

@ -40,3 +40,11 @@ func ParseURL(s string) (pool, node, id string, err error) {
func NewURL(pool, node, id string) string {
return fmt.Sprintf("%s://%s/%s/%s", PVEScheme, pool, node, id)
}
func K8sURL(url string) (string, error) {
pool, _, id, err := ParseURL(url)
if err != nil {
return "", nil
}
return NewURL(pool, "", id), nil
}