From 052c496c35ffead98694bd9456a715c9f6fd4813 Mon Sep 17 00:00:00 2001 From: Matthew Rich Date: Wed, 27 Mar 2024 14:14:40 -0700 Subject: [PATCH] implement exec SetURI --- internal/resource/exec.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/internal/resource/exec.go b/internal/resource/exec.go index 6c9adeb..be6aa0a 100644 --- a/internal/resource/exec.go +++ b/internal/resource/exec.go @@ -10,6 +10,7 @@ import ( "net/url" _ "os" _ "os/exec" + "path/filepath" _ "strings" ) @@ -41,7 +42,13 @@ func (x *Exec) URI() string { } 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 {