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

Function unblockIPCmd

internal/cli/ips.go:79–116  ·  view source on GitHub ↗
(cli *cli)

Source from the content-addressed store, hash-verified

77}
78
79func unblockIPCmd(cli *cli) *cobra.Command {
80 var inputs struct {
81 IP string
82 }
83
84 cmd := &cobra.Command{
85 Use: "unblock",
86 Args: cobra.MaximumNArgs(1),
87 Short: "Unblock IP address",
88 Long: "Unblock an IP address currently blocked by the Suspicious IP Throttling due to " +
89 "multiple suspicious attempts.",
90 Example: ` auth0 protection suspicious-ip-throttling ips unblock
91 auth0 ap sit ips unblock <ip>
92 auth0 ap sit ips unblock "178.178.178.178"`,
93 RunE: func(cmd *cobra.Command, args []string) error {
94 if len(args) == 0 {
95 if err := ipAddress.Ask(cmd, &inputs.IP); err != nil {
96 return err
97 }
98 } else {
99 inputs.IP = args[0]
100 }
101
102 if err := ansi.Waiting(func() error {
103 return cli.api.Anomaly.UnblockIP(cmd.Context(), inputs.IP)
104 }); err != nil {
105 return fmt.Errorf("failed to unblock IP %q: %w", inputs.IP, err)
106 }
107
108 cli.renderer.Heading("ip")
109 cli.renderer.Infof("The IP %s was unblocked.", inputs.IP)
110
111 return nil
112 },
113 }
114
115 return cmd
116}

Callers 1

ipsCmdFunction · 0.85

Calls 6

WaitingFunction · 0.92
UnblockIPMethod · 0.80
ErrorfMethod · 0.80
HeadingMethod · 0.80
InfofMethod · 0.80
AskMethod · 0.45

Tested by

no test coverage detected