MCPcopy Create free account
hub / github.com/auth0/auth0-cli / deleteLogStreamCmd

Function deleteLogStreamCmd

internal/cli/log_streams.go:195–244  ·  view source on GitHub ↗
(cli *cli)

Source from the content-addressed store, hash-verified

193}
194
195func deleteLogStreamCmd(cli *cli) *cobra.Command {
196 cmd := &cobra.Command{
197 Use: "delete",
198 Aliases: []string{"rm"},
199 Short: "Delete a log stream",
200 Long: "Delete a log stream.\n\n" +
201 "To delete interactively, use `auth0 logs streams delete` with no arguments.\n\n" +
202 "To delete non-interactively, supply the log stream id and the `--force`" +
203 " flag to skip confirmation.",
204 Example: ` auth0 logs streams delete
205 auth0 logs streams rm
206 auth0 logs streams delete <log-stream-id>
207 auth0 logs streams delete <log-stream-id> --force
208 auth0 logs streams delete <log-stream-id> <log-stream-id2>
209 auth0 logs streams delete <log-stream-id> <log-stream-id2> --force`,
210 RunE: func(cmd *cobra.Command, args []string) error {
211 var ids []string
212 if len(args) == 0 {
213 err := logStreamID.PickMany(cmd, &ids, cli.allLogStreamsPickerOptions)
214 if err != nil {
215 return err
216 }
217 } else {
218 ids = args
219 }
220
221 if !cli.force && canPrompt(cmd) {
222 if confirmed := prompt.Confirm("Are you sure you want to proceed?"); !confirmed {
223 return nil
224 }
225 }
226
227 return ansi.ProgressBar("Deleting Log Stream(s)", ids, func(_ int, id string) error {
228 if id != "" {
229 if _, err := cli.api.LogStream.Read(cmd.Context(), id); err != nil {
230 return fmt.Errorf("failed to delete log stream with ID %q: %w", id, err)
231 }
232 if err := cli.api.LogStream.Delete(cmd.Context(), id); err != nil {
233 return fmt.Errorf("failed to delete log stream with ID %q: %w", id, err)
234 }
235 }
236 return nil
237 })
238 },
239 }
240
241 cmd.Flags().BoolVar(&cli.force, "force", false, "Skip confirmation.")
242
243 return cmd
244}
245
246func openLogStreamsCmd(cli *cli) *cobra.Command {
247 var inputs struct {

Callers 1

logStreamsCmdFunction · 0.85

Calls 7

ConfirmFunction · 0.92
ProgressBarFunction · 0.92
canPromptFunction · 0.85
ErrorfMethod · 0.80
ReadMethod · 0.65
DeleteMethod · 0.65
PickManyMethod · 0.45

Tested by

no test coverage detected