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

Method customDomainNamePickerOptions

internal/cli/custom_domains.go:665–692  ·  view source on GitHub ↗
(ctx context.Context)

Source from the content-addressed store, hash-verified

663}
664
665func (c *cli) customDomainNamePickerOptions(ctx context.Context) (pickerOptions, error) {
666 var opts pickerOptions
667
668 domains, err := c.api.CustomDomain.List(ctx)
669 if err != nil {
670 var errStatus management.Error
671 errors.As(err, &errStatus)
672 // 403 is a valid response for free tenants that don't have
673 // custom domains enabled.
674 if errStatus != nil && errStatus.Status() == 403 {
675 return nil, errNoCustomDomains
676 }
677
678 return nil, fmt.Errorf("failed to list custom domains: %w", err)
679 }
680
681 for _, d := range domains {
682 domain := d.GetDomain()
683 label := fmt.Sprintf("%s %s", domain, ansi.Faint("("+d.GetID()+")"))
684 opts = append(opts, pickerOption{value: domain, label: label})
685 }
686
687 if len(opts) == 0 {
688 return nil, errNoCustomDomains
689 }
690
691 return opts, nil
692}

Callers

nothing calls this directly

Calls 4

FaintFunction · 0.92
ErrorfMethod · 0.80
ListMethod · 0.65
StatusMethod · 0.45

Tested by

no test coverage detected