From bd369b8d245a90f270746ede105a0c121fa612e5 Mon Sep 17 00:00:00 2001 From: Vishnu Bharathi Date: Fri, 18 Oct 2024 06:19:35 +0530 Subject: [PATCH] cmd: complete scan command --- pkg/client/scan.go | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 pkg/client/scan.go diff --git a/pkg/client/scan.go b/pkg/client/scan.go new file mode 100644 index 0000000..da7c8f4 --- /dev/null +++ b/pkg/client/scan.go @@ -0,0 +1,32 @@ +package client + +import ( + "net/http" +) + +type ScanOpts struct { + ApiHeaders map[string]string + Severity string +} + +func Scan(imageName, apiHost string, opts *ScanOpts) error { + // TODO: Complete this function after completing + // https://github.com/gokakashi/goKakashi/issues/22 + + req, err := http.NewRequest(http.MethodPost, apiHost, nil) + if err != nil { + return err + } + + for k, v := range opts.ApiHeaders { + req.Header.Add(k, v) + } + + resp, err := http.DefaultClient.Do(req) + if err != nil { + return err + } + defer resp.Body.Close() + + return nil +}