added server ref
This commit is contained in:
parent
b4a538849a
commit
78911eca56
4 changed files with 107 additions and 68 deletions
13
scheme.go
13
scheme.go
|
|
@ -37,6 +37,19 @@ func ParseURL(s string) (pool, node, id string, err error) {
|
|||
return u.Host, a[1], a[2], nil
|
||||
}
|
||||
|
||||
func ServerRefFromURL(s string) (ref *ServerRef, err error) {
|
||||
pool, node, id, err := ParseURL(s)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
ref = &ServerRef{
|
||||
ID: id,
|
||||
Node: node,
|
||||
Pool: pool,
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func NewURL(pool, node, id string) string {
|
||||
return fmt.Sprintf("%s://%s/%s/%s", PVEScheme, pool, node, id)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue