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

Function updateNetworkACLCmd

internal/cli/network_acl.go:781–929  ·  view source on GitHub ↗
(cli *cli)

Source from the content-addressed store, hash-verified

779}
780
781func updateNetworkACLCmd(cli *cli) *cobra.Command {
782 var inputs struct {
783 ID string
784 Description string
785 Active bool
786 ActiveStr string
787 Priority int
788 RuleJSON string
789 Action string
790 RedirectURI string
791 Scope string
792 ASNs []int
793 CountryCodes []string
794 SubdivCodes []string
795 IPv4CIDRs []string
796 IPv6CIDRs []string
797 JA3 []string
798 JA4 []string
799 UserAgents []string
800 MatchRule bool
801 NoMatchRule bool
802 }
803
804 cmd := &cobra.Command{
805 Use: "update",
806 Args: cobra.MaximumNArgs(1),
807 Short: "Update a network ACL",
808 Long: `Update a network ACL.
809To update interactively, use "auth0 network-acl update" with no arguments.
810To update non-interactively, supply the description, active, priority, and rule through flags.
811`,
812 Example: ` auth0 network-acl update <id>
813 auth0 network-acl update <id> --priority 5
814 auth0 network-acl update <id> --active true
815 auth0 network-acl update <id> --description "Updated description"
816 auth0 network-acl update <id> --rule '{"action":{"block":true},"scope":"tenant","match":{"ipv4_cidrs":["192.168.1.0/24"]}}'
817 auth0 network-acl update <id> --description "Complex Rule updated" --priority 1 --active true --rule '{"action":{"block":true},"scope":"tenant","match":{"ipv4_cidrs":["192.168.1.0/24"],"geo_country_codes":["US"]}}'`,
818 RunE: func(cmd *cobra.Command, args []string) error {
819 // Get the network ACL ID.
820 if len(args) > 0 {
821 inputs.ID = args[0]
822 } else {
823 if err := networkACLID.Pick(cmd, &inputs.ID, cli.networkACLPickerOptions); err != nil {
824 return err
825 }
826 }
827
828 // Check if we're in non-interactive mode (any flags provided).
829 flagsProvided := cmd.Flags().Changed("description") || cmd.Flags().Changed("active") ||
830 cmd.Flags().Changed("priority") || cmd.Flags().Changed("rule")
831
832 if !canPrompt(cmd) && !flagsProvided {
833 return fmt.Errorf("in non-interactive mode, at least one field must be specified to update")
834 }
835
836 // Build patch object with only the fields that should be updated.
837 patch := &management.NetworkACL{}
838

Callers 1

networkACLCmdFunction · 0.85

Calls 15

WaitingFunction · 0.92
canPromptFunction · 0.85
applyNetworkACLPatchFunction · 0.85
promptForRuleDetailsFunction · 0.85
buildNetworkACLRuleFunction · 0.85
ErrorfMethod · 0.80
AskBoolMethod · 0.80
AskIntMethod · 0.80
RegisterIntSliceMethod · 0.80
RegisterStringSliceMethod · 0.80

Tested by

no test coverage detected