{"modulePath":"github.com/dockerstack/kubernetes","version":"v0.20.1-0.20150627061651-1c0b765df6da","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package validation\n\nPackage validation has functions for validating the correctness of api objects and explaining what is wrong with them when they aren't valid.\n\n## Constants\n\n```go\nconst SecretKeyFmt string = \"\\\\.?\" + util.DNS1123LabelFmt + \"(\\\\.\" + util.DNS1123LabelFmt + \")*\"\n```\n\n## Functions\n\n```go\nfunc AccumulateUniqueHostPorts(containers []api.Container, accumulator *util.StringSet) errs.ValidationErrorList\n```\nAccumulateUniqueHostPorts extracts each HostPort of each Container, accumulating the results and returning an error if any ports conflict.\n\n```go\nfunc IsSecretKey(value string) bool\n```\nIsSecretKey tests for a string that conforms to the definition of a subdomain in DNS (RFC 1123), except that a leading dot is allowed\n\n```go\nfunc NewInvalidTypeError(expected reflect.Kind, observed reflect.Kind, fieldName string) error\n```\n\n```go\nfunc ValidateAnnotations(annotations map[string]string, field string) errs.ValidationErrorList\n```\nValidateAnnotations validates that a set of annotations are correctly defined.\n\n```go\nfunc ValidateEndpoints(endpoints *api.Endpoints) errs.ValidationErrorList\n```\nValidateEndpoints tests if required fields are set.\n\n```go\nfunc ValidateEndpointsName(name string, prefix bool) (bool, string)\n```\nValidateEndpointsName can be used to check whether the given endpoints name is valid. Prefix indicates this name will be used as part of generation, in which case trailing dashes are allowed.\n\n```go\nfunc ValidateEndpointsUpdate(oldEndpoints, newEndpoints *api.Endpoints) errs.ValidationErrorList\n```\nValidateEndpointsUpdate tests to make sure an endpoints update can be applied.\n\n```go\nfunc ValidateEvent(event *api.Event) errs.ValidationErrorList\n```\nValidateEvent makes sure that the event makes sense.\n\n```go\nfunc ValidateLabels(labels map[string]string, field string) errs.ValidationErrorList\n```\nValidateLabels validates that a set of labels are correctly defined.\n\n```go\nfunc ValidateLimitRange(limitRange *api.LimitRange) errs.ValidationErrorList\n```\nValidateLimitRange tests if required fields in the LimitRange are set.\n\n```go\nfunc ValidateLimitRangeName(name string, prefix bool) (bool, string)\n```\nValidateLimitRangeName can be used to check whether the given limit range name is valid. Prefix indicates this name will be used as part of generation, in which case trailing dashes are allowed.\n\n```go\nfunc ValidateNamespace(namespace *api.Namespace) errs.ValidationErrorList\n```\nValidateNamespace tests if required fields are set.\n\n```go\nfunc ValidateNamespaceFinalizeUpdate(newNamespace, oldNamespace *api.Namespace) errs.ValidationErrorList\n```\nValidateNamespaceFinalizeUpdate tests to see if the update is legal for an end user to make. newNamespace is updated with fields that cannot be changed.\n\n```go\nfunc ValidateNamespaceName(name string, prefix bool) (bool, string)\n```\nValidateNamespaceName can be used to check whether the given namespace name is valid. Prefix indicates this name will be used as part of generation, in which case trailing dashes are allowed.\n\n```go\nfunc ValidateNamespaceStatusUpdate(newNamespace, oldNamespace *api.Namespace) errs.ValidationErrorList\n```\nValidateNamespaceStatusUpdate tests to see if the update is legal for an end user to make. newNamespace is updated with fields that cannot be changed.\n\n```go\nfunc ValidateNamespaceUpdate(newNamespace *api.Namespace, oldNamespace *api.Namespace) errs.ValidationErrorList\n```\nValidateNamespaceUpdate tests to make sure a namespace update can be applied. newNamespace is updated with fields that cannot be changed\n\n```go\nfunc ValidateNode(node *api.Node) errs.ValidationErrorList\n```\nValidateNode tests if required fields in the node are set.\n\n```go\nfunc ValidateNodeName(name string, prefix bool) (bool, string)\n```\nValidateNodeName can be used to check whether the given node name is valid. Prefix indicates this name will be used as part of generation, in which case trailing dashes are allowed.\n\n```go\nfunc ValidateNodeUpdate(oldNode *api.Node, node *api.Node) errs.ValidationErrorList\n```\nValidateNodeUpdate tests to make sure a node update can be applied.  Modifies oldNode.\n\n```go\nfunc ValidateObjectMeta(meta *api.ObjectMeta, requiresNamespace bool, nameFn ValidateNameFunc) errs.ValidationErrorList\n```\nValidateObjectMeta validates an object's metadata on creation. It expects that name generation has already been performed.\n\n```go\nfunc ValidateObjectMetaUpdate(new, old *api.ObjectMeta) errs.ValidationErrorList\n```\nValidateObjectMetaUpdate validates an object's metadata when updated\n\n```go\nfunc ValidatePersistentVolume(pv *api.PersistentVolume) errs.ValidationErrorList\n```\n\n```go\nfunc ValidatePersistentVolumeClaim(pvc *api.PersistentVolumeClaim) errs.ValidationErrorList\n```\n\n```go\nfunc ValidatePersistentVolumeClaimStatusUpdate(newPvc, oldPvc *api.PersistentVolumeClaim) errs.ValidationErrorList\n```\n\n```go\nfunc ValidatePersistentVolumeClaimUpdate(newPvc, oldPvc *api.PersistentVolumeClaim) errs.ValidationErrorList\n```\n\n```go\nfunc ValidatePersistentVolumeName(name string, prefix bool) (bool, string)\n```\n\n```go\nfunc ValidatePersistentVolumeStatusUpdate(newPv, oldPv *api.PersistentVolume) errs.ValidationErrorList\n```\nValidatePersistentVolumeStatusUpdate tests to see if the status update is legal for an end user to make. newPv is updated with fields that cannot be changed.\n\n```go\nfunc ValidatePersistentVolumeUpdate(newPv, oldPv *api.PersistentVolume) errs.ValidationErrorList\n```\nValidatePersistentVolumeUpdate tests to see if the update is legal for an end user to make. newPv is updated with fields that cannot be changed.\n\n```go\nfunc ValidatePod(pod *api.Pod) errs.ValidationErrorList\n```\nValidatePod tests if required fields in the pod are set.\n\n```go\nfunc ValidatePodName(name string, prefix bool) (bool, string)\n```\nValidatePodName can be used to check whether the given pod name is valid. Prefix indicates this name will be used as part of generation, in which case trailing dashes are allowed.\n\n```go\nfunc ValidatePodSpec(spec *api.PodSpec) errs.ValidationErrorList\n```\nValidatePodSpec tests that the specified PodSpec has valid data. This includes checking formatting and uniqueness.  It also canonicalizes the structure by setting default values and implementing any backwards-compatibility tricks.\n\n```go\nfunc ValidatePodStatusUpdate(newPod, oldPod *api.Pod) errs.ValidationErrorList\n```\nValidatePodStatusUpdate tests to see if the update is legal for an end user to make. newPod is updated with fields that cannot be changed.\n\n```go\nfunc ValidatePodTemplate(pod *api.PodTemplate) errs.ValidationErrorList\n```\nValidatePodTemplate tests if required fields in the pod template are set.\n\n```go\nfunc ValidatePodTemplateSpec(spec *api.PodTemplateSpec, replicas int) errs.ValidationErrorList\n```\nValidatePodTemplateSpec validates the spec of a pod template\n\n```go\nfunc ValidatePodTemplateUpdate(newPod, oldPod *api.PodTemplate) errs.ValidationErrorList\n```\nValidatePodTemplateUpdate tests to see if the update is legal for an end user to make. newPod is updated with fields that cannot be changed.\n\n```go\nfunc ValidatePodUpdate(newPod, oldPod *api.Pod) errs.ValidationErrorList\n```\nValidatePodUpdate tests to see if the update is legal for an end user to make. newPod is updated with fields that cannot be changed.\n\n```go\nfunc ValidateReadOnlyPersistentDisks(volumes []api.Volume) errs.ValidationErrorList\n```\n\n```go\nfunc ValidateReplicationController(controller *api.ReplicationController) errs.ValidationErrorList\n```\nValidateReplicationController tests if required fields in the replication controller are set.\n\n```go\nfunc ValidateReplicationControllerName(name string, prefix bool) (bool, string)\n```\nValidateReplicationControllerName can be used to check whether the given replication controller name is valid. Prefix indicates this name will be used as part of generation, in which case trailing dashes are allowed.\n\n```go\nfunc ValidateReplicationControllerSpec(spec *api.ReplicationControllerSpec) errs.ValidationErrorList\n```\nValidateReplicationControllerSpec tests if required fields in the replication controller spec are set.\n\n```go\nfunc ValidateReplicationControllerUpdate(oldController, controller *api.ReplicationController) errs.ValidationErrorList\n```\nValidateReplicationControllerUpdate tests if required fields in the replication controller are set.\n\n```go\nfunc ValidateResourceQuota(resourceQuota *api.ResourceQuota) errs.ValidationErrorList\n```\nValidateResourceQuota tests if required fields in the ResourceQuota are set.\n\n```go\nfunc ValidateResourceQuotaName(name string, prefix bool) (bool, string)\n```\nValidateResourceQuotaName can be used to check whether the given resource quota name is valid. Prefix indicates this name will be used as part of generation, in which case trailing dashes are allowed.\n\n```go\nfunc ValidateResourceQuotaStatusUpdate(newResourceQuota, oldResourceQuota *api.ResourceQuota) errs.ValidationErrorList\n```\nValidateResourceQuotaStatusUpdate tests to see if the status update is legal for an end user to make. newResourceQuota is updated with fields that cannot be changed.\n\n```go\nfunc ValidateResourceQuotaUpdate(newResourceQuota, oldResourceQuota *api.ResourceQuota) errs.ValidationErrorList\n```\nValidateResourceQuotaUpdate tests to see if the update is legal for an end user to make. newResourceQuota is updated with fields that cannot be changed.\n\n```go\nfunc ValidateResourceRequirements(requirements *api.ResourceRequirements) errs.ValidationErrorList\n```\nValidates resource requirement spec.\n\n```go\nfunc ValidateSecret(secret *api.Secret) errs.ValidationErrorList\n```\nValidateSecret tests if required fields in the Secret are set.\n\n```go\nfunc ValidateSecretName(name string, prefix bool) (bool, string)\n```\nValidateSecretName can be used to check whether the given secret name is valid. Prefix indicates this name will be used as part of generation, in which case trailing dashes are allowed.\n\n```go\nfunc ValidateSecretUpdate(oldSecret, newSecret *api.Secret) errs.ValidationErrorList\n```\nValidateSecretUpdate tests if required fields in the Secret are set.\n\n```go\nfunc ValidateSecurityContext(sc *api.SecurityContext) errs.ValidationErrorList\n```\nValidateSecurityContext ensure the security context contains valid settings\n\n```go\nfunc ValidateService(service *api.Service) errs.ValidationErrorList\n```\nValidateService tests if required fields in the service are set.\n\n```go\nfunc ValidateServiceAccount(serviceAccount *api.ServiceAccount) errs.ValidationErrorList\n```\nValidateServiceAccount tests if required fields in the ServiceAccount are set.\n\n```go\nfunc ValidateServiceAccountName(name string, prefix bool) (bool, string)\n```\nValidateServiceAccountName can be used to check whether the given service account name is valid. Prefix indicates this name will be used as part of generation, in which case trailing dashes are allowed.\n\n```go\nfunc ValidateServiceAccountUpdate(oldServiceAccount, newServiceAccount *api.ServiceAccount) errs.ValidationErrorList\n```\nValidateServiceAccountUpdate tests if required fields in the ServiceAccount are set.\n\n```go\nfunc ValidateServiceName(name string, prefix bool) (bool, string)\n```\nValidateServiceName can be used to check whether the given service name is valid. Prefix indicates this name will be used as part of generation, in which case trailing dashes are allowed.\n\n```go\nfunc ValidateServiceUpdate(oldService, service *api.Service) errs.ValidationErrorList\n```\nValidateServiceUpdate tests if required fields in the service are set during an update\n\n## Types\n\n```go\ntype InvalidTypeError struct {\n\tExpectedKind reflect.Kind\n\tObservedKind reflect.Kind\n\tFieldName    string\n}\n```\n\n```go\nfunc (i *InvalidTypeError) Error() string\n```\n\n```go\ntype NullSchema struct{}\n```\n\n```go\nfunc (NullSchema) ValidateBytes(data []byte) error\n```\n\n```go\ntype Schema interface {\n\tValidateBytes(data []byte) error\n}\n```\nSchema is an interface that knows how to validate an API object serialized to a byte array.\n\n```go\nfunc NewSwaggerSchemaFromBytes(data []byte) (Schema, error)\n```\n\n```go\ntype SwaggerSchema struct {\n\t// contains filtered or unexported fields\n}\n```\n\n```go\nfunc (s *SwaggerSchema) ValidateBytes(data []byte) error\n```\n\n```go\nfunc (s *SwaggerSchema) ValidateObject(obj interface{}, apiVersion, fieldName, typeName string) errs.ValidationErrorList\n```\n\n```go\ntype ValidateNameFunc func(name string, prefix bool) (bool, string)\n```\nValidateNameFunc validates that the provided name is valid for a given resource type. Not all resources have the same validation rules for names. Prefix is true if the name will have a value appended to it.\n\n","path":"github.com/dockerstack/kubernetes/pkg/api/validation","name":"validation","synopsis":"Package validation has functions for validating the correctness of api objects and explaining what is wrong with them when they aren't valid.","isRedistributable":true}
