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

Function deleteTokenExchangeProfileCmd

internal/cli/token_exchange.go:297–341  ·  view source on GitHub ↗
(cli *cli)

Source from the content-addressed store, hash-verified

295}
296
297func deleteTokenExchangeProfileCmd(cli *cli) *cobra.Command {
298 cmd := &cobra.Command{
299 Use: "delete",
300 Aliases: []string{"rm"},
301 Short: "Delete a token exchange profile",
302 Long: "Delete a token exchange profile.\n\n" +
303 "To delete interactively, use `auth0 token-exchange delete` with no arguments.\n\n" +
304 "To delete non-interactively, supply the profile id and the `--force` flag to skip confirmation.",
305 Example: ` auth0 token-exchange delete
306 auth0 token-exchange rm
307 auth0 token-exchange delete <profile-id>
308 auth0 token-exchange delete <profile-id> --force
309 auth0 token-exchange delete <profile-id> <profile-id2> <profile-idn>
310 auth0 token-exchange delete <profile-id> <profile-id2> <profile-idn> --force`,
311 RunE: func(cmd *cobra.Command, args []string) error {
312 var ids []string
313 if len(args) == 0 {
314 if err := tokenExchangeProfileID.PickMany(cmd, &ids, cli.tokenExchangeProfilePickerOptions); err != nil {
315 return err
316 }
317 } else {
318 ids = args
319 }
320
321 if !cli.force && canPrompt(cmd) {
322 if confirmed := prompt.Confirm("Are you sure you want to proceed?"); !confirmed {
323 return nil
324 }
325 }
326
327 return ansi.ProgressBar("Deleting token exchange profile(s)", ids, func(i int, id string) error {
328 if id != "" {
329 if err := cli.api.TokenExchange.Delete(cmd.Context(), id); err != nil {
330 return fmt.Errorf("failed to delete token exchange profile with ID %q: %w", id, err)
331 }
332 }
333 return nil
334 })
335 },
336 }
337
338 cmd.Flags().BoolVar(&cli.force, "force", false, "Skip confirmation.")
339
340 return cmd
341}
342
343func (c *cli) tokenExchangeProfilePickerOptions(ctx context.Context) (pickerOptions, error) {
344 list, err := c.api.TokenExchange.List(ctx)

Callers 1

tokenExchangeCmdFunction · 0.85

Calls 6

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

Tested by

no test coverage detected