(cmd *cobra.Command, args []string)
| 371 | } |
| 372 | |
| 373 | func runStorageContentDelete(cmd *cobra.Command, args []string) error { |
| 374 | ctx := context.Background() |
| 375 | nodeName := args[0] |
| 376 | storageName := args[1] |
| 377 | volID := args[2] |
| 378 | |
| 379 | session, err := initCLISession(cmd) |
| 380 | if err != nil { |
| 381 | return printError(err) |
| 382 | } |
| 383 | |
| 384 | if session == nil { |
| 385 | return nil |
| 386 | } |
| 387 | |
| 388 | client, err := session.clientForNode(ctx, nodeName) |
| 389 | if err != nil { |
| 390 | return printError(err) |
| 391 | } |
| 392 | |
| 393 | upid, err := client.DeleteStorageContent(nodeName, storageName, volID) |
| 394 | if err != nil { |
| 395 | return printError(fmt.Errorf("failed to delete content: %w", err)) |
| 396 | } |
| 397 | |
| 398 | out := storageTaskOutput{ |
| 399 | Node: nodeName, |
| 400 | Storage: storageName, |
| 401 | VolID: volID, |
| 402 | UPID: upid, |
| 403 | Status: "running", |
| 404 | } |
| 405 | |
| 406 | if getNoWait(cmd) { |
| 407 | return printJSON(out) |
| 408 | } |
| 409 | |
| 410 | exitStatus, waitErr := waitForTask(ctx, client, nodeName, upid, "delete content") |
| 411 | out.Status = "complete" |
| 412 | out.ExitStatus = exitStatus |
| 413 | |
| 414 | if err := printJSON(out); err != nil { |
| 415 | return err |
| 416 | } |
| 417 | |
| 418 | if waitErr != nil { |
| 419 | return waitErr |
| 420 | } |
| 421 | |
| 422 | return nil |
| 423 | } |
| 424 | |
| 425 | // ── storage download ────────────────────────────────────────────────────────── |
| 426 |
nothing calls this directly
no test coverage detected