validators

package
v0.2.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 13, 2021 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

Functions

func APIKey

func APIKey(input string) error

APIKey validates that a string looks like an API key.

func APIKeyNotRestricted

func APIKeyNotRestricted(input string) error

APIKeyNotRestricted validates that a string looks like a secret API key and is not a restricted key.

func Account

func Account(account string) error

Account validates that a string is an acceptable account filter.

func CallNonEmpty

func CallNonEmpty(validator ArgValidator, value string) error

CallNonEmpty calls an argument validator on a string if the string is not empty.

func CallNonEmptyArray

func CallNonEmptyArray(validator ArgValidator, values []string) error

CallNonEmptyArray calls an argument validator on all non-empty elements of a string array.

func Dependencies

func Dependencies(deps []string) ([]management.Dependency, error)

Dependencies parses a slice of dependencies of the format <name>@<semver> and returns them in their management.Dependency form.

func ExactArgs

func ExactArgs(expected ...string) cobra.PositionalArgs

ExactArgs is a validator for commands to print an error when number of expected args are different from the number of passed args. The names passed in to `expected` are used for the help message.

func HTTPMethod

func HTTPMethod(method string) error

HTTPMethod validates that a string is an acceptable HTTP method.

func MaximumNArgs

func MaximumNArgs(num int) cobra.PositionalArgs

MaximumNArgs is a validator for commands to print an error when the provided args are greater than the maximum amount

func NoArgs

func NoArgs(cmd *cobra.Command, args []string) error

NoArgs is a validator for commands to print an error when an argument is provided

func OneDollar

func OneDollar(number string) error

OneDollar validates that a provided number is at least 100 (ie. 1 dollar)

func RequestSource

func RequestSource(source string) error

RequestSource validates that a string is an acceptable request source.

func RequestStatus

func RequestStatus(status string) error

RequestStatus validates that a string is an acceptable request status.

func StatusCode

func StatusCode(code string) error

StatusCode validates that a provided status code is within the range of those used in the Auth0 API.

func StatusCodeType

func StatusCodeType(code string) error

StatusCodeType validates that a provided status code type is one of those used in the Auth0 API.

func TriggerID

func TriggerID(trigger string) error

TriggerID checks that the provided trigger is valid.

Types

type ArgValidator

type ArgValidator func(string) error

ArgValidator is an argument validator. It accepts a string and returns an error if the string is invalid, or nil otherwise.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL