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

Function redeliverEventStreamCmd

internal/cli/event_streams.go:675–727  ·  view source on GitHub ↗
(cli *cli)

Source from the content-addressed store, hash-verified

673}
674
675func redeliverEventStreamCmd(cli *cli) *cobra.Command {
676 var inputs struct {
677 StreamID string
678 DeliveryIDs []string
679 }
680
681 cmd := &cobra.Command{
682 Use: "redeliver [stream-id] [comma-separated-delivery-ids]",
683 Args: cobra.MaximumNArgs(2),
684 Short: "Retry one or more event deliveries for a given stream",
685 Long: "Retry one or more failed event deliveries for a given event stream. \n" +
686 "If no delivery IDs are provided, you'll be prompted " +
687 "to select from recent failed deliveries.",
688 Example: ` auth0 event-streams redeliver
689 auth0 event-streams redeliver <stream-id>
690 auth0 event-streams redeliver <stream-id> evt_abc123,evt_def456`,
691 RunE: func(cmd *cobra.Command, args []string) error {
692 if len(args) >= 1 {
693 inputs.StreamID = args[0]
694 }
695 if len(args) == 2 {
696 inputs.DeliveryIDs = strings.Split(args[1], ",")
697 }
698
699 if inputs.StreamID == "" {
700 if err := eventStreamID.Pick(cmd, &inputs.StreamID, cli.eventStreamPickerOptions); err != nil {
701 return err
702 }
703 }
704
705 if len(inputs.DeliveryIDs) == 0 {
706 selectedIDs, err := promptForDeliveryIDs(cmd, cli, inputs.StreamID)
707 if err != nil {
708 return err
709 }
710 inputs.DeliveryIDs = selectedIDs
711 }
712
713 for _, id := range inputs.DeliveryIDs {
714 err := ansi.Spinner(fmt.Sprintf("Redelivering %s...", ansi.Faint(id)), func() error {
715 return cli.api.EventStream.Redeliver(cmd.Context(), inputs.StreamID, id)
716 })
717
718 if err != nil {
719 cli.renderer.Errorf("%s Failed to redeliver %s: %v\n", ansi.Red("✘"), ansi.Red(id), err)
720 }
721 }
722 return nil
723 },
724 }
725
726 return cmd
727}
728
729func redeliverManyEventStreamCmd(cli *cli) *cobra.Command {
730 var inputs struct {

Callers 1

eventStreamsCmdFunction · 0.85

Calls 7

SpinnerFunction · 0.92
FaintFunction · 0.92
RedFunction · 0.92
promptForDeliveryIDsFunction · 0.85
ErrorfMethod · 0.80
RedeliverMethod · 0.65
PickMethod · 0.45

Tested by

no test coverage detected