validation

package
v0.1.6 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HasAnyLane

func HasAnyLane(binding *transportv1alpha1.TransportBinding) bool

HasAnyLane returns true if the binding declares at least one media lane.

func ValidateCodecSupport

func ValidateCodecSupport(binding *transportv1alpha1.TransportBinding, transport *transportv1alpha1.Transport) error

ValidateCodecSupport ensures binding codecs exist in the transport capability list.

func ValidateCodecSupportFields

func ValidateCodecSupportFields(
	binding *transportv1alpha1.TransportBinding,
	transport *transportv1alpha1.Transport,
	basePath *field.Path,
) field.ErrorList

ValidateCodecSupportFields validates binding codecs against transport capabilities and returns field-level errors anchored under basePath (e.g. field.NewPath("spec")). Use this from admission webhooks where field path precision matters.

func ValidateTransport

func ValidateTransport(transport *transportv1alpha1.Transport) field.ErrorList

ValidateTransport runs spec-level validation and returns field errors that can be surfaced by reconcilers or admission webhooks.

func ValidateTransportSecuritySettings

func ValidateTransportSecuritySettings(path *field.Path, raw *runtime.RawExtension) field.ErrorList

ValidateTransportSecuritySettings rejects raw transport settings that configure an unsupported transport security mode.

Types

type ValidationResult

type ValidationResult struct {
	// Errors contains all validation errors as field.ErrorList.
	Errors field.ErrorList
	// PrimaryReason is the condition reason code for the first (most significant) error.
	// Empty when validation passes.
	PrimaryReason string
}

ValidationResult holds both the field errors and the primary reason code for status conditions.

func ValidateTransportWithReason

func ValidateTransportWithReason(transport *transportv1alpha1.Transport) *ValidationResult

ValidateTransportWithReason runs spec-level validation and returns both field errors and a structured reason code suitable for Kubernetes conditions.

Behavior:

  • Returns an empty result with no reason when validation passes.
  • Returns the first applicable reason code for condition status updates.

Arguments:

  • transport *transportv1alpha1.Transport: the Transport to validate.

Returns:

  • *ValidationResult: contains errors and primary reason code.

func (*ValidationResult) IsValid

func (r *ValidationResult) IsValid() bool

IsValid returns true if there are no validation errors.

Jump to

Keyboard shortcuts

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