implement exec SetURI
Some checks failed
Lint / golangci-lint (push) Failing after 10m6s
Declarative Tests / test (push) Successful in 1m12s

This commit is contained in:
Matthew Rich 2024-03-27 14:14:40 -07:00
parent 99849a489b
commit 052c496c35

View File

@ -10,6 +10,7 @@ import (
"net/url" "net/url"
_ "os" _ "os"
_ "os/exec" _ "os/exec"
"path/filepath"
_ "strings" _ "strings"
) )
@ -41,7 +42,13 @@ func (x *Exec) URI() string {
} }
func (x *Exec) SetURI(uri string) error { func (x *Exec) SetURI(uri string) error {
return nil resourceUri, e := url.Parse(uri)
if resourceUri.Scheme == "exec" {
x.Id = filepath.Join(resourceUri.Hostname(), resourceUri.RequestURI())
} else {
e = fmt.Errorf("%w: %s is not an exec resource ", ErrInvalidResourceURI, uri)
}
return e
} }
func (x *Exec) ResolveId(ctx context.Context) string { func (x *Exec) ResolveId(ctx context.Context) string {