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

Function deleteCustomDomainCmd

internal/cli/custom_domains.go:415–464  ·  view source on GitHub ↗
(cli *cli)

Source from the content-addressed store, hash-verified

413}
414
415func deleteCustomDomainCmd(cli *cli) *cobra.Command {
416 cmd := &cobra.Command{
417 Use: "delete",
418 Aliases: []string{"rm"},
419 Short: "Delete a custom domain",
420 Long: "Delete a custom domain.\n\n" +
421 "To delete interactively, use `auth0 domains delete` with no arguments.\n\n" +
422 "To delete non-interactively, supply the custom domain id and the `--force` flag to " +
423 "skip confirmation.",
424 Example: ` auth0 domains delete
425 auth0 domains rm
426 auth0 domains delete <domain-id>
427 auth0 domains delete <domain-id> --force
428 auth0 domains delete <domain-id> <domain-id2>
429 auth0 domains delete <domain-id> <domain-id2> --force`,
430 RunE: func(cmd *cobra.Command, args []string) error {
431 var ids []string
432 if len(args) == 0 {
433 if err := customDomainID.PickMany(cmd, &ids, cli.customDomainsPickerOptions); err != nil {
434 return err
435 }
436 } else {
437 ids = args
438 }
439
440 if !cli.force && canPrompt(cmd) {
441 if confirmed := prompt.Confirm("Are you sure you want to proceed?"); !confirmed {
442 return nil
443 }
444 }
445
446 return ansi.ProgressBar("Deleting custom domain", ids, func(_ int, id string) error {
447 if id != "" {
448 if _, err := cli.api.CustomDomain.Read(cmd.Context(), url.PathEscape(id)); err != nil {
449 return fmt.Errorf("failed to delete custom domain with ID %q: %w", id, err)
450 }
451
452 if err := cli.api.CustomDomain.Delete(cmd.Context(), url.PathEscape(id)); err != nil {
453 return fmt.Errorf("failed to delete custom domain with ID %q: %w", id, err)
454 }
455 }
456 return nil
457 })
458 },
459 }
460
461 cmd.Flags().BoolVar(&cli.force, "force", false, "Skip confirmation.")
462
463 return cmd
464}
465
466func verifyCustomDomainCmd(cli *cli) *cobra.Command {
467 var inputs struct {

Callers 1

customDomainsCmdFunction · 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