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

Method customDomainsPickerOptions

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

Source from the content-addressed store, hash-verified

634}
635
636func (c *cli) customDomainsPickerOptions(ctx context.Context) (pickerOptions, error) {
637 var opts pickerOptions
638
639 domains, err := c.api.CustomDomain.List(ctx)
640 if err != nil {
641 var errStatus management.Error
642 errors.As(err, &errStatus)
643 // 403 is a valid response for free tenants that don't have
644 // custom domains enabled.
645 if errStatus != nil && errStatus.Status() == 403 {
646 return nil, errNoCustomDomains
647 }
648
649 return nil, fmt.Errorf("failed to list custom domains: %w", err)
650 }
651
652 for _, d := range domains {
653 value := d.GetID()
654 label := fmt.Sprintf("%s %s", d.GetDomain(), ansi.Faint("("+value+")"))
655 opts = append(opts, pickerOption{value: value, label: label})
656 }
657
658 if len(opts) == 0 {
659 return nil, errNoCustomDomains
660 }
661
662 return opts, nil
663}
664
665func (c *cli) customDomainNamePickerOptions(ctx context.Context) (pickerOptions, error) {
666 var opts pickerOptions

Callers 1

Calls 4

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

Tested by 1