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

Function updateCustomDomainCmd

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

Source from the content-addressed store, hash-verified

309}
310
311func updateCustomDomainCmd(cli *cli) *cobra.Command {
312 var inputs struct {
313 ID string
314 TLSPolicy string
315 CustomClientIPHeader string
316 DomainMetadata string
317 }
318
319 cmd := &cobra.Command{
320 Use: "update",
321 Args: cobra.MaximumNArgs(1),
322 Short: "Update a custom domain",
323 Long: "Update a custom domain.\n\n" +
324 "To update interactively, use `auth0 domains update` with no arguments.\n\n" +
325 "To update non-interactively, supply the domain name, type, policy and " +
326 "other information through the flags.",
327 Example: ` auth0 domains update
328 auth0 domains update <domain-id> --policy compatible
329 auth0 domains update <domain-id> --policy compatible --ip-header "cf-connecting-ip"
330 auth0 domains update <domain-id> --metadata '{"key1":"value1","key2":null}'
331 auth0 domains update <domain-id> -p compatible -i "cf-connecting-ip" --json
332 auth0 domains update <domain-id> -p compatible -i "cf-connecting-ip" --json-compact`,
333 RunE: func(cmd *cobra.Command, args []string) error {
334 var current *management.CustomDomain
335
336 if len(args) == 0 {
337 if err := customDomainID.Pick(cmd, &inputs.ID, cli.customDomainsPickerOptions); err != nil {
338 return err
339 }
340 } else {
341 inputs.ID = args[0]
342 }
343
344 if err := ansi.Waiting(func() (err error) {
345 current, err = cli.api.CustomDomain.Read(cmd.Context(), inputs.ID)
346 return err
347 }); err != nil {
348 return fmt.Errorf("failed to read custom domain: %w", err)
349 }
350
351 if err := customDomainPolicy.SelectU(cmd, &inputs.TLSPolicy, customDomainPolicyOptions, current.TLSPolicy); err != nil {
352 return err
353 }
354
355 if err := customDomainIPHeader.AskU(cmd, &inputs.CustomClientIPHeader, current.CustomClientIPHeader); err != nil {
356 return err
357 }
358
359 if err := customDomainMetadata.AskU(cmd, &inputs.DomainMetadata, nil); err != nil {
360 return err
361 }
362
363 // Start with an empty custom domain object. We'll conditionally
364 // hydrate it based on the provided parameters since
365 // we'll do PATCH semantics.
366 c := &management.CustomDomain{}
367
368 if inputs.TLSPolicy != "" {

Callers 1

customDomainsCmdFunction · 0.85

Calls 11

WaitingFunction · 0.92
apiTLSPolicyForFunction · 0.85
ErrorfMethod · 0.80
SelectUMethod · 0.80
AskUMethod · 0.80
CustomDomainUpdateMethod · 0.80
RegisterStringUMethod · 0.80
RegisterStringMethod · 0.80
ReadMethod · 0.65
UpdateMethod · 0.65
PickMethod · 0.45

Tested by

no test coverage detected