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

Function NewCollectionDeleteCmd

cmd/collection.go:263–287  ·  view source on GitHub ↗

NewCollectionDeleteCmd returns a command for deleting a collection.

()

Source from the content-addressed store, hash-verified

261
262// NewCollectionDeleteCmd returns a command for deleting a collection.
263func NewCollectionDeleteCmd() *cobra.Command {
264 return &cobra.Command{
265 Use: "delete [collection id]",
266 Short: "Delete a collection.",
267 Args: cobra.MinimumNArgs(1),
268 Long: deleteCollectionCmdHelp,
269 Example: deleteCollectionExample,
270
271 RunE: func(cmd *cobra.Command, args []string) error {
272 c, err := NewAPIClient()
273 if err != nil {
274 return err
275 }
276 url := vt.URL("collections/%s", args[0])
277 response, err := c.Delete(url)
278 if err != nil {
279 return err
280 }
281 if response.Error.Code != "" {
282 return response.Error
283 }
284 return nil
285 },
286 }
287}
288
289func rawFromReader(reader utils.StringReader) string {
290 var lines []string

Callers 1

NewCollectionCmdFunction · 0.85

Calls 1

NewAPIClientFunction · 0.70

Tested by

no test coverage detected