validation

package
v0.0.0-...-94e1a67 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2026 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ManagedIdentitiesDataPlaneIdentityURLOptionalOperationOption is an operation option that indicates that the managed identities
	// data plane identity URL is optional during validation. This is used on ARM Preflight requests on the
	// Cluster resource.
	ManagedIdentitiesDataPlaneIdentityURLOptionalOperationOption = "ManagedIdentitiesDataPlaneIdentityURLOptional"
)

Variables

This section is empty.

Functions

func AFECsToValidationOptions

func AFECsToValidationOptions(features []arm.Feature) []string

AFECsToValidationOptions converts the API logic into validation compatible options. Feature names are normalized to lowercase for case-insensitive comparison.

func CIDRv4

func CIDRv4(_ context.Context, _ operation.Operation, fldPath *field.Path, value, _ *string) field.ErrorList

func DifferentResourceGroupName

func DifferentResourceGroupName(ctx context.Context, op operation.Operation, fldPath *field.Path, value, _ *string, resourceGroupName string) field.ErrorList

func DifferentResourceGroupNameFromResourceID

func DifferentResourceGroupNameFromResourceID(ctx context.Context, op operation.Operation, fldPath *field.Path, value, _ *azcorearm.ResourceID, resourceGroupName string) field.ErrorList

func EQ

func EQ[T comparable](_ context.Context, _ operation.Operation, fldPath *field.Path, value, _ *T, allowed T) field.ErrorList

EQ matches validate.NEQ

func EachMapKey

func EachMapKey[K ~string, T any](ctx context.Context, op operation.Operation, fldPath *field.Path, newMap, oldMap map[K]T, validator validate.ValidateFunc[*K]) field.ErrorList

EachMapKey validates each element of newMap with the specified validation function. This is a copy from validate.EachMapKey except that the field path includes the key because its more useful for us that way.

func EqualFold

func EqualFold(_ context.Context, _ operation.Operation, fldPath *field.Path, value, _ *string, requiredValue string) field.ErrorList

EqualFold verifies that the specified string is equal to the required value ignoring case.

func GenericResourceID

func GenericResourceID(ctx context.Context, op operation.Operation, fldPath *field.Path, value, oldValue *azcorearm.ResourceID) field.ErrorList

GenericResourceID 1. has subscription 2. has name 3. has any resource type 4. may or may not have a resource group name

func IPv4

func IPv4(_ context.Context, _ operation.Operation, fldPath *field.Path, value, _ *string) field.ErrorList

func ImageRegistry

func ImageRegistry(_ context.Context, _ operation.Operation, fldPath *field.Path, value, _ *string) field.ErrorList

func KubeLabelValue

func KubeLabelValue(_ context.Context, _ operation.Operation, fldPath *field.Path, value, _ *string) field.ErrorList

func KubeQualifiedName

func KubeQualifiedName(_ context.Context, _ operation.Operation, fldPath *field.Path, value, _ *string) field.ErrorList

func MatchesRegex

func MatchesRegex(_ context.Context, _ operation.Operation, fldPath *field.Path, value, _ *string, regex *regexp.Regexp, errorString string) field.ErrorList

func MaxItems

func MaxItems[T any](_ context.Context, _ operation.Operation, fldPath *field.Path, value, _ []T, maxLen int) field.ErrorList

func MaxLen

func MaxLen(_ context.Context, _ operation.Operation, fldPath *field.Path, value, _ *string, maxLen int) field.ErrorList

MaxLen verifies that the specified string is less than or equal to maxLen long

func Maximum

func Maximum[T constraints.Integer](_ context.Context, _ operation.Operation, fldPath *field.Path, value, _ *T, max T) field.ErrorList

Minimum verifies that the specified value is less than or equal to max.

func MaximumIfNoAZ

func MaximumIfNoAZ[T constraints.Integer](ctx context.Context, op operation.Operation, fldPath *field.Path, value, oldValue *T, max T, availabilityZone string) field.ErrorList

MaximumIfNoAZ validates that a value doesn't exceed max ONLY when availabilityZone is empty. When availabilityZone is set, no maximum limit is enforced.

func MinItems

func MinItems[T any](_ context.Context, _ operation.Operation, fldPath *field.Path, value, _ []T, minLen int) field.ErrorList

func MinLen

func MinLen(_ context.Context, _ operation.Operation, fldPath *field.Path, value, _ *string, minLen int) field.ErrorList

MinLen verifies that the specified string is greater than or equal to minLen long

func NoExtraWhitespace

func NoExtraWhitespace(_ context.Context, _ operation.Operation, fldPath *field.Path, value, _ *string) field.ErrorList

func OpenShiftWithOptionalPrerelease

func OpenShiftWithOptionalPrerelease(_ context.Context, op operation.Operation, fldPath *field.Path, value, _ *string) field.ErrorList

func OpenshiftVersionWithOptionalMicro

func OpenshiftVersionWithOptionalMicro(_ context.Context, op operation.Operation, fldPath *field.Path, value, _ *string) field.ErrorList

func OpenshiftVersionWithoutMicro

func OpenshiftVersionWithoutMicro(_ context.Context, op operation.Operation, fldPath *field.Path, value, _ *string) field.ErrorList

func Or

func Or[T any](ctx context.Context, op operation.Operation, fldPath *field.Path, newValue, oldValue T, validateFns ...validate.ValidateFunc[T]) field.ErrorList

func ResourceID

func ResourceID(ctx context.Context, op operation.Operation, fldPath *field.Path, value, oldValue *azcorearm.ResourceID) field.ErrorList

ResourceID 1. has subscription 2. has name 3. has any resource type 4. has a resource group name

func RestrictedResourceIDWithResourceGroup

func RestrictedResourceIDWithResourceGroup(ctx context.Context, op operation.Operation, fldPath *field.Path, value, oldValue *azcorearm.ResourceID, resourceTypeRestriction string) field.ErrorList

RestrictedResourceIDWithResourceGroup 1. has subscription 2. has name 3. has a particular resource type 4. has a resource group name

func RestrictedResourceIDWithoutResourceGroup

func RestrictedResourceIDWithoutResourceGroup(ctx context.Context, op operation.Operation, fldPath *field.Path, value, oldValue *azcorearm.ResourceID, resourceTypeRestriction string) field.ErrorList

RestrictedResourceIDWithoutResourceGroup 1. has subscription 2. has name 3. has particular type 4. has no resource group name

func RewriteValidationFieldPaths

func RewriteValidationFieldPaths(internalValidationErrors field.ErrorList, validationPathMapperFn api.ValidationPathMapperFunc)

func SameSubscription

func SameSubscription(ctx context.Context, op operation.Operation, fldPath *field.Path, value, _ *azcorearm.ResourceID, subscriptionID string) field.ErrorList

func URL

func URL(_ context.Context, _ operation.Operation, fldPath *field.Path, value, _ *string) field.ErrorList

func ValidateCluster

func ValidateCluster(ctx context.Context, op operation.Operation, newCluster, oldCluster *api.HCPOpenShiftCluster, validationPathMapper api.ValidationPathMapperFunc) field.ErrorList

func ValidateExternalAuthCreate

func ValidateExternalAuthCreate(ctx context.Context, newObj *api.HCPOpenShiftClusterExternalAuth) field.ErrorList

func ValidateExternalAuthUpdate

func ValidateExternalAuthUpdate(ctx context.Context, newObj, oldObj *api.HCPOpenShiftClusterExternalAuth) field.ErrorList

func ValidateNodePool

func ValidateNodePool(ctx context.Context, op operation.Operation, newObj, oldObj *api.HCPOpenShiftClusterNodePool) field.ErrorList

func ValidatePEM

func ValidatePEM(ctx context.Context, op operation.Operation, fldPath *field.Path, value, _ *string) field.ErrorList

TODO this is compatible with what existed before, but still allows much invalid content

func ValidateSubscriptionCreate

func ValidateSubscriptionCreate(ctx context.Context, newObj *arm.Subscription) field.ErrorList

func ValidateUUID

func ValidateUUID(_ context.Context, _ operation.Operation, fldPath *field.Path, value, _ *string) field.ErrorList

func ValidateUserAssignedIdentityLocation

func ValidateUserAssignedIdentityLocation(ctx context.Context, op operation.Operation, fldPath *field.Path, value, _ *azcorearm.ResourceID, clusterSubscriptionID, managedResourceGroupName string) field.ErrorList

func VersionMayNotDecrease

func VersionMayNotDecrease(_ context.Context, op operation.Operation, fldPath *field.Path, value, oldValue *string) field.ErrorList

func VersionMustBeAtLeast

func VersionMustBeAtLeast(_ context.Context, op operation.Operation, fldPath *field.Path, value, _ *string, minimumVersion string) field.ErrorList

Types

This section is empty.

Jump to

Keyboard shortcuts

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