Documentation ¶
Index ¶
- func CheckFileExist(fileName string) bool
- func IntegerValidator(ans interface{}) error
- func NameValidator(name interface{}) error
- func NilValidator(interface{}) error
- func ValidateName(name string) error
- type EnumValue
- func (e EnumValue) Contains(ans interface{}) error
- func (e *EnumValue) Get() interface{}
- func (e *EnumValue) GetKnownValues() string
- func (e EnumValue) IsProvidedValid() bool
- func (e *EnumValue) MustSet(value interface{})
- func (e *EnumValue) Set(value interface{}) error
- func (e EnumValue) String() string
- type Validatable
- type Validator
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckFileExist ¶
CheckFileExist check if given file exists or not
func IntegerValidator ¶
func IntegerValidator(ans interface{}) error
IntegerValidator validates that the provided object can be properly converted to an int value
func NameValidator ¶
func NameValidator(name interface{}) error
NameValidator provides a Validator view of the ValidateName function.
func ValidateName ¶
ValidateName will do validation of application & component names according to DNS (RFC 1123) rules Criteria for valid name in kubernetes: https://github.com/kubernetes/community/blob/master/contributors/design-proposals/architecture/identifiers.md
Types ¶
type EnumValue ¶
type EnumValue struct { Provided string Value interface{} // contains filtered or unexported fields }
func NewEnumValue ¶
func (*EnumValue) GetKnownValues ¶
func (EnumValue) IsProvidedValid ¶
type Validatable ¶
type Validatable struct { // Required indicates whether this Validatable is a required value in the context it's supposed to be used Required bool `json:"required,omitempty"` // Type specifies the type of values this Validatable accepts so that some validation can be performed based on it Type string `json:"type"` // AdditionalValidators allows users to specify validators (in addition to default ones) to validate this Validatable's value AdditionalValidators []Validator `json:"-"` }
Validatable represents a common ancestor for validatable parameters
func (Validatable) AsValidatable ¶
func (v Validatable) AsValidatable() Validatable
AsValidatable allows avoiding type casts in client code
type Validator ¶
type Validator func(interface{}) error
Validator is a function that validates that the provided interface conforms to expectations or return an error
func GetValidatorFor ¶
func GetValidatorFor(prop Validatable) Validator
GetValidatorFor retrieves a validator for the specified validatable, first validating its required state, then its value based on type then any additional validators in the order specified by Validatable.AdditionalValidators