MCPcopy Create free account
hub / github.com/VirusTotal/vt-cli / NewMonitorItemsDeleteCmd

Function NewMonitorItemsDeleteCmd

cmd/monitor.go:268–299  ·  view source on GitHub ↗

NewMonitorItemsDeleteCmd returns a command for deleting files in your monitor account.

()

Source from the content-addressed store, hash-verified

266// NewMonitorItemsDeleteCmd returns a command for deleting files in your monitor
267// account.
268func NewMonitorItemsDeleteCmd() *cobra.Command {
269 cmd := &cobra.Command{
270 Use: "delete [monitor_id]...",
271 Short: "Delete monitor files",
272 Long: monitorItemsDeleteCmdHelp,
273 RunE: func(cmd *cobra.Command, args []string) error {
274 if len(args) == 0 {
275 return errors.New("No item provided")
276 }
277
278 client, err := NewAPIClient()
279 if err != nil {
280 return err
281 }
282 var waitGroup sync.WaitGroup
283 for _, arg := range args {
284 waitGroup.Add(1)
285 go func(monitorItemID string) {
286 url := vt.URL("monitor/items/%s", monitorItemID)
287 if _, err := client.Delete(url); err != nil {
288 fmt.Fprintf(os.Stderr, "%v\n", err)
289 }
290 waitGroup.Done()
291 }(arg)
292 }
293 waitGroup.Wait()
294 return err
295 },
296 }
297
298 return cmd
299}
300
301// MonitorFileUpload doer
302

Callers 1

NewMonitorCmdFunction · 0.85

Calls 1

NewAPIClientFunction · 0.70

Tested by

no test coverage detected