(cmd *cobra.Command, deps commandDeps, opts supportBundleOptions)
| 78 | } |
| 79 | |
| 80 | func runSupportBundleCommand(cmd *cobra.Command, deps commandDeps, opts supportBundleOptions) error { |
| 81 | confirmed, err := confirmSupportBundleCreation(cmd, opts.yes) |
| 82 | if err != nil { |
| 83 | return err |
| 84 | } |
| 85 | client, err := clientFromDeps(deps) |
| 86 | if err != nil { |
| 87 | return err |
| 88 | } |
| 89 | includeStatus := !opts.noStatus |
| 90 | created, err := client.CreateSupportBundle(cmd.Context(), CreateSupportBundleRequest{ |
| 91 | Yes: confirmed, |
| 92 | IncludeStatus: &includeStatus, |
| 93 | }) |
| 94 | if err != nil { |
| 95 | return err |
| 96 | } |
| 97 | operation, err := waitForSupportBundle(cmd.Context(), deps, client, created.OperationID) |
| 98 | if err != nil { |
| 99 | return err |
| 100 | } |
| 101 | path, err := resolveSupportBundleOutputPath(deps, opts.outputPath, operation) |
| 102 | if err != nil { |
| 103 | return err |
| 104 | } |
| 105 | if err := downloadSupportBundle(cmd.Context(), client, operation.OperationID, path); err != nil { |
| 106 | return err |
| 107 | } |
| 108 | return writeSupportBundleResult(cmd, supportBundleResult{ |
| 109 | Operation: operation, |
| 110 | Path: path, |
| 111 | }) |
| 112 | } |
| 113 | |
| 114 | func confirmSupportBundleCreation(cmd *cobra.Command, yes bool) (bool, error) { |
| 115 | if yes { |
no test coverage detected