Documentation
¶
Index ¶
- func ConfigToType[T any](in map[string]interface{}, out *T) error
- func MaxVerification[T cmp.Ordered](older, newer *T) error
- func MinVerification[T cmp.Ordered](older, newer *T) error
- func RegisterDefault(registry validations.Registry)
- func RegisterEnum(registry validations.Registry)
- func RegisterMaxItems(registry validations.Registry)
- func RegisterMaxLength(registry validations.Registry)
- func RegisterMaxProperties(registry validations.Registry)
- func RegisterMaximum(registry validations.Registry)
- func RegisterMinItems(registry validations.Registry)
- func RegisterMinLength(registry validations.Registry)
- func RegisterMinProperties(registry validations.Registry)
- func RegisterMinimum(registry validations.Registry)
- func RegisterRequired(registry validations.Registry)
- func RegisterType(registry validations.Registry)
- func ValidateEnumConfig(in *EnumConfig) error
- type AdditionPolicy
- type Default
- type Enum
- type EnumConfig
- type MaxItems
- type MaxLength
- type MaxOptions
- type MaxProperties
- type Maximum
- type MinItems
- type MinLength
- type MinOptions
- type MinProperties
- type Minimum
- type Required
- type Type
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConfigToType ¶ added in v0.3.0
func MaxVerification ¶
MaxVerification is a generic helper function for comparing two cmp.Ordered values. It returns an error if: - older value is nil and newer value is not nil - older and newer values are not nil, newer is less than older
func MinVerification ¶
MinVerification is a generic helper function for comparing two cmp.Ordered values. It returns an error if: - older value is nil and newer value is not nil - older and newer values are not nil, newer is greater than older
func RegisterDefault ¶ added in v0.3.0
func RegisterDefault(registry validations.Registry)
RegisterDefault registers the Default validation with the provided validation registry
func RegisterEnum ¶ added in v0.3.0
func RegisterEnum(registry validations.Registry)
RegisterEnum registers the Enum validation with the provided validation registry
func RegisterMaxItems ¶ added in v0.3.0
func RegisterMaxItems(registry validations.Registry)
RegisterMaxItems registers the MaxItems validation with the provided validation registry
func RegisterMaxLength ¶ added in v0.3.0
func RegisterMaxLength(registry validations.Registry)
RegisterMaxLength registers the MaxLength validation with the provided validation registry
func RegisterMaxProperties ¶ added in v0.3.0
func RegisterMaxProperties(registry validations.Registry)
RegisterMaxProperties registers the MaxProperties validation with the provided validation registry
func RegisterMaximum ¶ added in v0.3.0
func RegisterMaximum(registry validations.Registry)
RegisterMaximum registers the Maximum validation with the provided validation registry
func RegisterMinItems ¶ added in v0.3.0
func RegisterMinItems(registry validations.Registry)
RegisterMinItems registers the MinItems validation with the provided validation registry
func RegisterMinLength ¶ added in v0.3.0
func RegisterMinLength(registry validations.Registry)
RegisterMinLength registers the MinLength validation with the provided validation registry
func RegisterMinProperties ¶ added in v0.3.0
func RegisterMinProperties(registry validations.Registry)
RegisterMinProperties registers the MinProperties validation with the provided validation registry
func RegisterMinimum ¶ added in v0.3.0
func RegisterMinimum(registry validations.Registry)
RegisterMinimum registers the Minimum validation with the provided validation registry
func RegisterRequired ¶ added in v0.3.0
func RegisterRequired(registry validations.Registry)
RegisterRequired registers the Required validation with the provided validation registry
func RegisterType ¶ added in v0.3.0
func RegisterType(registry validations.Registry)
RegisterType registers the Type validation with the provided validation registry
func ValidateEnumConfig ¶ added in v0.3.0
func ValidateEnumConfig(in *EnumConfig) error
ValidateEnumConfig validates the provided EnumConfig setting default values where appropriate. Currently the defaulting behavior defaults the EnumConfig.AdditionPolicy to AdditionPolicyDisallow if it is set to the empty string ("")
Types ¶
type AdditionPolicy ¶ added in v0.3.0
type AdditionPolicy string
AdditionPolicy is used to represent how the Enum validation should determine compatibility of adding new enum values to an existing enum constraint
const ( // AdditionPolicyAllow signals that adding new enum values to // an existing enum constraint should be considered a compatible change AdditionPolicyAllow AdditionPolicy = "Allow" // AdditionPolicyDisallow signals that adding new enum values to // an existing enum constraint should be considered an incompatible change AdditionPolicyDisallow AdditionPolicy = "Disallow" )
type Default ¶
type Default struct {
// contains filtered or unexported fields
}
Default is a Validation that can be used to identify incompatible changes to the default value of CRD properties
func (*Default) Compare ¶ added in v0.3.0
func (d *Default) Compare(a, b *apiextensionsv1.JSONSchemaProps) validations.ComparisonResult
Compare compares an old and a new JSONSchemaProps, checking for changes to the default value of a property. In order for callers to determine if diffs to a JSONSchemaProps have been handled by this validation the JSONSchemaProps.Default field will be reset to 'nil' as part of this method. It is highly recommended that only copies of the JSONSchemaProps to compare are provided to this method to prevent unintentional modifications.
func (*Default) SetEnforcement ¶ added in v0.3.0
func (d *Default) SetEnforcement(policy config.EnforcementPolicy)
SetEnforcement sets the EnforcementPolicy for the Default validation
type Enum ¶
type Enum struct { // EnumConfig is the set of additional configuration options EnumConfig // contains filtered or unexported fields }
Enum is a Validation that can be used to identify incompatible changes to the enum values of CRD properties
func (*Enum) Compare ¶ added in v0.3.0
func (e *Enum) Compare(a, b *apiextensionsv1.JSONSchemaProps) validations.ComparisonResult
Compare compares an old and a new JSONSchemaProps, checking for incompatible changes to the enum constraints of a property. In order for callers to determine if diffs to a JSONSchemaProps have been handled by this validation the JSONSchemaProps.Enum field will be reset to 'nil' as part of this method. It is highly recommended that only copies of the JSONSchemaProps to compare are provided to this method to prevent unintentional modifications.
func (*Enum) SetEnforcement ¶ added in v0.3.0
func (e *Enum) SetEnforcement(policy config.EnforcementPolicy)
SetEnforcement sets the EnforcementPolicy for the Enum validation
type EnumConfig ¶ added in v0.3.0
type EnumConfig struct { // additionPolicy is how adding enums to an existing set of // enums should be treated. // Allowed values are Allow and Disallow. // When set to Allow, adding new values to an existing set // of enums will not be flagged. // When set to Disallow, adding new values to an existing // set of enums will be flagged. // Defaults to Disallow. AdditionPolicy AdditionPolicy `json:"additionPolicy,omitempty"` }
EnumConfig contains additional configurations for the Enum validation
type MaxItems ¶
type MaxItems struct {
MaxOptions
}
MaxItems is a Validation that can be used to identify incompatible changes to the maxItems constraints of CRD properties
func (*MaxItems) Compare ¶ added in v0.3.0
func (m *MaxItems) Compare(a, b *apiextensionsv1.JSONSchemaProps) validations.ComparisonResult
Compare compares an old and a new JSONSchemaProps, checking for incompatible changes to the maxItems constraints of a property. In order for callers to determine if diffs to a JSONSchemaProps have been handled by this validation the JSONSchemaProps.MaxItems field will be reset to 'nil' as part of this method. It is highly recommended that only copies of the JSONSchemaProps to compare are provided to this method to prevent unintentional modifications.
func (*MaxItems) SetEnforcement ¶ added in v0.3.0
func (m *MaxItems) SetEnforcement(policy config.EnforcementPolicy)
SetEnforcement sets the EnforcementPolicy for the MaxItems validation
type MaxLength ¶
type MaxLength struct {
MaxOptions
}
MaxLength is a Validation that can be used to identify incompatible changes to the maxLength constraints of CRD properties
func (*MaxLength) Compare ¶ added in v0.3.0
func (m *MaxLength) Compare(a, b *apiextensionsv1.JSONSchemaProps) validations.ComparisonResult
Compare compares an old and a new JSONSchemaProps, checking for incompatible changes to the maxLength constraints of a property. In order for callers to determine if diffs to a JSONSchemaProps have been handled by this validation the JSONSchemaProps.MaxLength field will be reset to 'nil' as part of this method. It is highly recommended that only copies of the JSONSchemaProps to compare are provided to this method to prevent unintentional modifications.
func (*MaxLength) SetEnforcement ¶ added in v0.3.0
func (m *MaxLength) SetEnforcement(policy config.EnforcementPolicy)
SetEnforcement sets the EnforcementPolicy for the MaxLength validation
type MaxOptions ¶
type MaxOptions struct {
// contains filtered or unexported fields
}
MaxOptions is an abstraction for the common options for all the "Maximum" related constraints on CRD properties.
type MaxProperties ¶
type MaxProperties struct {
MaxOptions
}
MaxProperties is a Validation that can be used to identify incompatible changes to the maxProperties constraints of CRD properties
func (*MaxProperties) Compare ¶ added in v0.3.0
func (m *MaxProperties) Compare(a, b *apiextensionsv1.JSONSchemaProps) validations.ComparisonResult
Compare compares an old and a new JSONSchemaProps, checking for incompatible changes to the maxProperties constraints of a property. In order for callers to determine if diffs to a JSONSchemaProps have been handled by this validation the JSONSchemaProps.MaxProperties field will be reset to 'nil' as part of this method. It is highly recommended that only copies of the JSONSchemaProps to compare are provided to this method to prevent unintentional modifications.
func (*MaxProperties) Name ¶
func (m *MaxProperties) Name() string
Name returns the name of the MaxProperties validation
func (*MaxProperties) SetEnforcement ¶ added in v0.3.0
func (m *MaxProperties) SetEnforcement(policy config.EnforcementPolicy)
SetEnforcement sets the EnforcementPolicy for the MaxProperties validation
type Maximum ¶
type Maximum struct {
MaxOptions
}
Maximum is a Validation that can be used to identify incompatible changes to the maximum constraints of CRD properties
func (*Maximum) Compare ¶ added in v0.3.0
func (m *Maximum) Compare(a, b *apiextensionsv1.JSONSchemaProps) validations.ComparisonResult
Compare compares an old and a new JSONSchemaProps, checking for incompatible changes to the maximum constraints of a property. In order for callers to determine if diffs to a JSONSchemaProps have been handled by this validation the JSONSchemaProps.Maximum field will be reset to 'nil' as part of this method. It is highly recommended that only copies of the JSONSchemaProps to compare are provided to this method to prevent unintentional modifications.
func (*Maximum) SetEnforcement ¶ added in v0.3.0
func (m *Maximum) SetEnforcement(policy config.EnforcementPolicy)
SetEnforcement sets the EnforcementPolicy for the Maximum validation
type MinItems ¶
type MinItems struct {
MinOptions
}
MinItems is a Validation that can be used to identify incompatible changes to the minItems constraints of CRD properties
func (*MinItems) Compare ¶ added in v0.3.0
func (m *MinItems) Compare(a, b *apiextensionsv1.JSONSchemaProps) validations.ComparisonResult
Compare compares an old and a new JSONSchemaProps, checking for incompatible changes to the minItems constraints of a property. In order for callers to determine if diffs to a JSONSchemaProps have been handled by this validation the JSONSchemaProps.MinItems field will be reset to 'nil' as part of this method. It is highly recommended that only copies of the JSONSchemaProps to compare are provided to this method to prevent unintentional modifications.
func (*MinItems) SetEnforcement ¶ added in v0.3.0
func (m *MinItems) SetEnforcement(policy config.EnforcementPolicy)
SetEnforcement sets the EnforcementPolicy for the MinItems validation
type MinLength ¶
type MinLength struct {
MinOptions
}
MinLength is a Validation that can be used to identify incompatible changes to the minLength constraints of CRD properties
func (*MinLength) Compare ¶ added in v0.3.0
func (m *MinLength) Compare(a, b *apiextensionsv1.JSONSchemaProps) validations.ComparisonResult
Compare compares an old and a new JSONSchemaProps, checking for incompatible changes to the minLength constraints of a property. In order for callers to determine if diffs to a JSONSchemaProps have been handled by this validation the JSONSchemaProps.MinLength field will be reset to 'nil' as part of this method. It is highly recommended that only copies of the JSONSchemaProps to compare are provided to this method to prevent unintentional modifications.
func (*MinLength) SetEnforcement ¶ added in v0.3.0
func (m *MinLength) SetEnforcement(policy config.EnforcementPolicy)
SetEnforcement sets the EnforcementPolicy for the MinLength validation
type MinOptions ¶
type MinOptions struct {
// contains filtered or unexported fields
}
MinOptions is an abstraction for the common options for all the "Minimum" related constraints on CRD properties.
type MinProperties ¶
type MinProperties struct {
MinOptions
}
MinProperties is a Validation that can be used to identify incompatible changes to the minProperties constraints of CRD properties
func (*MinProperties) Compare ¶ added in v0.3.0
func (m *MinProperties) Compare(a, b *apiextensionsv1.JSONSchemaProps) validations.ComparisonResult
Compare compares an old and a new JSONSchemaProps, checking for incompatible changes to the minProperties constraints of a property. In order for callers to determine if diffs to a JSONSchemaProps have been handled by this validation the JSONSchemaProps.MinProperties field will be reset to 'nil' as part of this method. It is highly recommended that only copies of the JSONSchemaProps to compare are provided to this method to prevent unintentional modifications.
func (*MinProperties) Name ¶
func (m *MinProperties) Name() string
Name returns the name of the MinProperties validation
func (*MinProperties) SetEnforcement ¶ added in v0.3.0
func (m *MinProperties) SetEnforcement(policy config.EnforcementPolicy)
SetEnforcement sets the EnforcementPolicy for the MinProperties validation
type Minimum ¶
type Minimum struct {
MinOptions
}
Minimum is a Validation that can be used to identify incompatible changes to the minimum constraints of CRD properties
func (*Minimum) Compare ¶ added in v0.3.0
func (m *Minimum) Compare(a, b *apiextensionsv1.JSONSchemaProps) validations.ComparisonResult
Compare compares an old and a new JSONSchemaProps, checking for incompatible changes to the minimum constraints of a property. In order for callers to determine if diffs to a JSONSchemaProps have been handled by this validation the JSONSchemaProps.Minimum field will be reset to 'nil' as part of this method. It is highly recommended that only copies of the JSONSchemaProps to compare are provided to this method to prevent unintentional modifications.
func (*Minimum) SetEnforcement ¶ added in v0.3.0
func (m *Minimum) SetEnforcement(policy config.EnforcementPolicy)
SetEnforcement sets the EnforcementPolicy for the Minimum validation
type Required ¶
type Required struct {
// contains filtered or unexported fields
}
Required is a Validation that can be used to identify incompatible changes to the required constraints of CRD properties
func (*Required) Compare ¶ added in v0.3.0
func (r *Required) Compare(a, b *apiextensionsv1.JSONSchemaProps) validations.ComparisonResult
Compare compares an old and a new JSONSchemaProps, checking for incompatible changes to the required constraints of a property. In order for callers to determine if diffs to a JSONSchemaProps have been handled by this validation the JSONSchemaProps.Required field will be reset to 'nil' as part of this method. It is highly recommended that only copies of the JSONSchemaProps to compare are provided to this method to prevent unintentional modifications.
func (*Required) SetEnforcement ¶ added in v0.3.0
func (r *Required) SetEnforcement(policy config.EnforcementPolicy)
SetEnforcement sets the EnforcementPolicy for the Required validation
type Type ¶
type Type struct {
// contains filtered or unexported fields
}
Type is a Validation that can be used to identify incompatible changes to the type constraints of CRD properties
func (*Type) Compare ¶ added in v0.3.0
func (t *Type) Compare(a, b *apiextensionsv1.JSONSchemaProps) validations.ComparisonResult
Compare compares an old and a new JSONSchemaProps, checking for incompatible changes to the type constraints of a property. In order for callers to determine if diffs to a JSONSchemaProps have been handled by this validation the JSONSchemaProps.Type field will be reset to '""' as part of this method. It is highly recommended that only copies of the JSONSchemaProps to compare are provided to this method to prevent unintentional modifications.
func (*Type) SetEnforcement ¶ added in v0.3.0
func (t *Type) SetEnforcement(policy config.EnforcementPolicy)
SetEnforcement sets the EnforcementPolicy for the Type validation