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

Function deployActionCmd

internal/cli/actions.go:444–497  ·  view source on GitHub ↗
(cli *cli)

Source from the content-addressed store, hash-verified

442}
443
444func deployActionCmd(cli *cli) *cobra.Command {
445 var inputs struct {
446 ID string
447 }
448
449 cmd := &cobra.Command{
450 Use: "deploy",
451 Args: cobra.MaximumNArgs(1),
452 Short: "Deploy an action",
453 Long: "Before an action can be bound to a flow, the action must be deployed.\n\n" +
454 "The selected action will be deployed and added to the collection of available actions for flows. " +
455 "Additionally, a new draft version of the deployed action will be created for future editing. " +
456 "Because secrets and dependencies are tied to versions, any saved secrets or dependencies will " +
457 "be available to the new draft.",
458 Example: ` auth0 actions deploy
459 auth0 actions deploy <action-id>
460 auth0 actions deploy <action-id> --json
461 auth0 actions deploy <action-id> --json-compact`,
462 RunE: func(cmd *cobra.Command, args []string) error {
463 if len(args) == 0 {
464 if err := actionID.Pick(cmd, &inputs.ID, cli.unDeployedActionPickerOptions); err != nil {
465 return err
466 }
467 } else {
468 inputs.ID = args[0]
469 }
470
471 var action *management.Action
472
473 if err := ansi.Waiting(func() (err error) {
474 if _, err = cli.api.Action.Deploy(cmd.Context(), inputs.ID); err != nil {
475 return fmt.Errorf("failed to deploy action with ID %q: %w", inputs.ID, err)
476 }
477
478 if action, err = cli.api.Action.Read(cmd.Context(), inputs.ID); err != nil {
479 return fmt.Errorf("failed to read deployed action with ID %q: %w", inputs.ID, err)
480 }
481
482 return nil
483 }); err != nil {
484 return err
485 }
486
487 cli.renderer.ActionDeploy(action)
488
489 return nil
490 },
491 }
492
493 cmd.Flags().BoolVar(&cli.json, "json", false, "Output in json format.")
494 cmd.Flags().BoolVar(&cli.jsonCompact, "json-compact", false, "Output in compact json format.")
495
496 return cmd
497}
498
499func openActionCmd(cli *cli) *cobra.Command {
500 var inputs struct {

Callers 2

TestActionsDeployCmdFunction · 0.85
actionsCmdFunction · 0.85

Calls 6

WaitingFunction · 0.92
ErrorfMethod · 0.80
ActionDeployMethod · 0.80
DeployMethod · 0.65
ReadMethod · 0.65
PickMethod · 0.45

Tested by 1

TestActionsDeployCmdFunction · 0.68