extended URL scheme

This commit is contained in:
ston1th 2020-06-03 23:45:54 +02:00
commit 0994baf5b0
4 changed files with 39 additions and 18 deletions

View file

@ -12,6 +12,7 @@ import (
var (
ErrPoolExists = errors.New("pool already exists")
ErrPoolNotExists = errors.New("pool does not exist")
ErrEmptyPoolName = errors.New("pool name is empty")
)
func MakePoolName(namespace, name string) string {
@ -78,6 +79,10 @@ type pool struct {
}
func (c *PoolClient) List(ctx context.Context, name string) (sl ServerList, err error) {
if name == "" {
err = ErrEmptyPoolName
return
}
var p pool
req, err := c.client.NewRequest(ctx, "GET", fmt.Sprintf("/pools/%s", name), nil)
if err != nil {
@ -113,7 +118,7 @@ func (c *PoolClient) FindServerByID(ctx context.Context, poolname, id string) (s
}
func (c *PoolClient) FindServerByURL(ctx context.Context, url string) (s *Server, err error) {
pool, id, err := ParseURL(url)
pool, _, id, err := ParseURL(url)
if err != nil {
return
}