// Validate checks the field values on Http1ProtocolOptions with the rules
// defined in the proto definition for this message. If any rules are
// violated, an error is returned.
429873
func (m *Http1ProtocolOptions) Validate() error {
	if m == nil {
		return nil
	}

	{
		tmp := m.GetAllowAbsoluteUrl()

		if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {

			if err := v.Validate(); err != nil {
				return Http1ProtocolOptionsValidationError{
					field:  "AllowAbsoluteUrl",
					reason: "embedded message failed validation",
					cause:  err,
				}
			}
		}
	}

	// no validation rules for AcceptHttp_10

	// no validation rules for DefaultHostForHttp_10

	return nil
}
418870
func (opts *PUBLISHOptions) validate() error {
	// Check the QoS.
	if !mqtt.ValidQoS(opts.QoS) {
		return ErrInvalidQoS
	}

	// Check the length of the Topic Name.
	if len(opts.TopicName) > maxStringsLen {
		return ErrTopicNameExceedsMaxStringsLen
	}

	// Check if the Topic Name contains the wildcard characters.
	if bytes.IndexAny(opts.TopicName, wildcards) != -1 {
		return ErrTopicNameContainsWildcards
	}

	// Check the length of the Application Message.
	if len(opts.Message) > maxStringsLen {
		return ErrMessageExceedsMaxStringsLen
	}

	// End the validation if the QoS equals to QoS 0.
	if opts.QoS == mqtt.QoS0 {
		return nil
	}

	// Check the Packet Identifier.
	if opts.PacketID == 0 {
		return ErrInvalidPacketID
	}

	return nil
}
352648
func (m *MethodMatch_ParameterMatchSpecifier) Validate() error {
	if m == nil {
		return nil
	}

	switch m.ParameterMatchSpecifier.(type) {

	case *MethodMatch_ParameterMatchSpecifier_ExactMatch:
		// no validation rules for ExactMatch

	case *MethodMatch_ParameterMatchSpecifier_RangeMatch:

		{
			tmp := m.GetRangeMatch()

			if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {

				if err := v.Validate(); err != nil {
					return MethodMatch_ParameterMatchSpecifierValidationError{
						field:  "RangeMatch",
						reason: "embedded message failed validation",
						cause:  err,
					}
				}
			}
		}

	}

	return nil
}
1353004
func (m *Tracing_Http) Validate() error {
	if m == nil {
		return nil
	}

	if len(m.GetName()) < 1 {
		return Tracing_HttpValidationError{
			field:  "Name",
			reason: "value length must be at least 1 bytes",
		}
	}

	switch m.ConfigType.(type) {

	case *Tracing_Http_Config:

		{
			tmp := m.GetConfig()

			if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {

				if err := v.Validate(); err != nil {
					return Tracing_HttpValidationError{
						field:  "Config",
						reason: "embedded message failed validation",
						cause:  err,
					}
				}
			}
		}

	case *Tracing_Http_TypedConfig:

		{
			tmp := m.GetTypedConfig()

			if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {

				if err := v.Validate(); err != nil {
					return Tracing_HttpValidationError{
						field:  "TypedConfig",
						reason: "embedded message failed validation",
						cause:  err,
					}
				}
			}
		}

	}

	return nil
}
121098
func (o *ResourceQuotaControllerOptions) Validate() []error {
	if o == nil {
		return nil
	}

	errs := []error{}
	return errs
}
679484
func (m *HeaderValueOption) Validate() error {
	if m == nil {
		return nil
	}

	if m.GetHeader() == nil {
		return HeaderValueOptionValidationError{
			field:  "Header",
			reason: "value is required",
		}
	}

	{
		tmp := m.GetHeader()

		if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {

			if err := v.Validate(); err != nil {
				return HeaderValueOptionValidationError{
					field:  "Header",
					reason: "embedded message failed validation",
					cause:  err,
				}
			}
		}
	}

	{
		tmp := m.GetAppend()

		if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {

			if err := v.Validate(); err != nil {
				return HeaderValueOptionValidationError{
					field:  "Append",
					reason: "embedded message failed validation",
					cause:  err,
				}
			}
		}
	}

	return nil
}
117089
func (o *NodeIPAMControllerOptions) Validate() []error {
	if o == nil {
		return nil
	}

	errs := []error{}
	return errs
}
193847
func (m *HTTPResponseProperties) Validate() error {
	if m == nil {
		return nil
	}

	{
		tmp := m.GetResponseCode()

		if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {

			if err := v.Validate(); err != nil {
				return HTTPResponsePropertiesValidationError{
					field:  "ResponseCode",
					reason: "embedded message failed validation",
					cause:  err,
				}
			}
		}
	}

	// no validation rules for ResponseHeadersBytes

	// no validation rules for ResponseBodyBytes

	// no validation rules for ResponseHeaders

	// no validation rules for ResponseTrailers

	// no validation rules for ResponseCodeDetails

	return nil
}
1310424
func (o *CopyOptions) Validate(cmd *cobra.Command, args []string) error {
	if len(args) != 2 {
		return cmdutil.UsageErrorf(cmd, cpUsageStr)
	}
	return nil
}
533545
func (o *JobControllerOptions) Validate() []error {
	if o == nil {
		return nil
	}

	errs := []error{}
	return errs
}
1079006
func (m *HTTPFault) Validate() error {
	if m == nil {
		return nil
	}

	{
		tmp := m.GetDelay()

		if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {

			if err := v.Validate(); err != nil {
				return HTTPFaultValidationError{
					field:  "Delay",
					reason: "embedded message failed validation",
					cause:  err,
				}
			}
		}
	}

	{
		tmp := m.GetAbort()

		if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {

			if err := v.Validate(); err != nil {
				return HTTPFaultValidationError{
					field:  "Abort",
					reason: "embedded message failed validation",
					cause:  err,
				}
			}
		}
	}

	// no validation rules for UpstreamCluster

	for idx, item := range m.GetHeaders() {
		_, _ = idx, item

		{
			tmp := item

			if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {

				if err := v.Validate(); err != nil {
					return HTTPFaultValidationError{
						field:  fmt.Sprintf("Headers[%v]", idx),
						reason: "embedded message failed validation",
						cause:  err,
					}
				}
			}
		}

	}

	{
		tmp := m.GetMaxActiveFaults()

		if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {

			if err := v.Validate(); err != nil {
				return HTTPFaultValidationError{
					field:  "MaxActiveFaults",
					reason: "embedded message failed validation",
					cause:  err,
				}
			}
		}
	}

	{
		tmp := m.GetResponseRateLimit()

		if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {

			if err := v.Validate(); err != nil {
				return HTTPFaultValidationError{
					field:  "ResponseRateLimit",
					reason: "embedded message failed validation",
					cause:  err,
				}
			}
		}
	}

	return nil
}
554114
func (m *CommandLineOptions) Validate() error {
	if m == nil {
		return nil
	}

	// no validation rules for BaseId

	// no validation rules for Concurrency

	// no validation rules for ConfigPath

	// no validation rules for ConfigYaml

	// no validation rules for AllowUnknownFields

	// no validation rules for AdminAddressPath

	// no validation rules for LocalAddressIpVersion

	// no validation rules for LogLevel

	// no validation rules for ComponentLogLevel

	// no validation rules for LogFormat

	// no validation rules for LogPath

	// no validation rules for HotRestartVersion

	// no validation rules for ServiceCluster

	// no validation rules for ServiceNode

	// no validation rules for ServiceZone

	{
		tmp := m.GetFileFlushInterval()

		if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {

			if err := v.Validate(); err != nil {
				return CommandLineOptionsValidationError{
					field:  "FileFlushInterval",
					reason: "embedded message failed validation",
					cause:  err,
				}
			}
		}
	}

	{
		tmp := m.GetDrainTime()

		if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {

			if err := v.Validate(); err != nil {
				return CommandLineOptionsValidationError{
					field:  "DrainTime",
					reason: "embedded message failed validation",
					cause:  err,
				}
			}
		}
	}

	{
		tmp := m.GetParentShutdownTime()

		if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {

			if err := v.Validate(); err != nil {
				return CommandLineOptionsValidationError{
					field:  "ParentShutdownTime",
					reason: "embedded message failed validation",
					cause:  err,
				}
			}
		}
	}

	// no validation rules for Mode

	// no validation rules for MaxStats

	// no validation rules for MaxObjNameLen

	// no validation rules for DisableHotRestart

	// no validation rules for EnableMutexTracing

	// no validation rules for RestartEpoch

	// no validation rules for CpusetThreads

	return nil
}
825452
func (o *LabelOptions) Validate() error {
	if o.all && len(o.selector) > 0 {
		return fmt.Errorf("cannot set --all and --selector at the same time")
	}
	if o.all && len(o.fieldSelector) > 0 {
		return fmt.Errorf("cannot set --all and --field-selector at the same time")
	}
	if len(o.resources) < 1 && cmdutil.IsFilenameSliceEmpty(o.FilenameOptions.Filenames, o.FilenameOptions.Kustomize) {
		return fmt.Errorf("one or more resources must be specified as <resource> <name> or <resource>/<name>")
	}
	if len(o.newLabels) < 1 && len(o.removeLabels) < 1 && !o.list {
		return fmt.Errorf("at least one label update is required")
	}
	return nil
}
721311
func (fv FormValidator) Validate(req *http.Request, s interface{}) error {
	fieldErrs := make(map[string][]error)

	if err := decodeRequest(req, s); err != nil {
		return err
	}

	v := getValue(s)

	for i := 0; i < v.NumField(); i++ {
		tag := string(v.Type().Field(i).Tag.Get("schema"))
		fieldVal := getValue(v.Field(i).Interface())

		if tag == "" {
			log.Debug("field missing schema tag", log.Data{"field": v.Type().Field(i).Name})
			continue
		}

		for _, fld := range fv.flds {
			if fld.ID == tag {
				for _, rule := range fld.Rules {
					fn, ok := RulesList[rule.Name]
					if !ok {
						return fmt.Errorf("rule name: %s, missing corresponding validation function", rule.Name)
					}

					if err := fn(fieldVal.Interface(), rule.Value); err != nil {
						if _, ok := err.(FieldValidationErr); !ok {
							return err
						}
						fieldErrs[tag] = append(fieldErrs[tag], err)
					}
				}
			}
		}
	}

	if len(fieldErrs) > 0 {
		return ErrFormValidationFailed{fieldErrs}
	}

	return nil
}
877010
func (c *Certificate) Validate() error {
	if len(c.CertPEM) == 0 {
		return errors.NotValidf("missing cert PEM")
	}
	if len(c.KeyPEM) == 0 {
		return errors.NotValidf("missing key PEM")
	}
	return nil
}
1162897
func (o *CombinedInsecureServingOptions) Validate() []error {
	if o == nil {
		return nil
	}

	errors := []error{}

	if o.BindPort < 0 || o.BindPort > 65335 {
		errors = append(errors, fmt.Errorf("--port %v must be between 0 and 65335, inclusive. 0 for turning off insecure (HTTP) port", o.BindPort))
	}

	if len(o.BindAddress) > 0 && net.ParseIP(o.BindAddress) == nil {
		errors = append(errors, fmt.Errorf("--address %v is an invalid IP address", o.BindAddress))
	}

	return errors
}
283049
func (o *SetImageOptions) Validate() error {
	errors := []error{}
	if o.All && len(o.Selector) > 0 {
		errors = append(errors, fmt.Errorf("cannot set --all and --selector at the same time"))
	}
	if len(o.Resources) < 1 && cmdutil.IsFilenameSliceEmpty(o.Filenames, o.Kustomize) {
		errors = append(errors, fmt.Errorf("one or more resources must be specified as <resource> <name> or <resource>/<name>"))
	}
	if len(o.ContainerImages) < 1 {
		errors = append(errors, fmt.Errorf("at least one image update is required"))
	} else if len(o.ContainerImages) > 1 && hasWildcardKey(o.ContainerImages) {
		errors = append(errors, fmt.Errorf("all containers are already specified by *, but saw more than one container_name=container_image pairs"))
	}
	return utilerrors.NewAggregate(errors)
}