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

	if m.GetLimitKbps() < 1 {
		return FaultRateLimit_FixedLimitValidationError{
			field:  "LimitKbps",
			reason: "value must be greater than or equal to 1",
		}
	}

	return nil
}
137511
func (m *Error) Validate(formats strfmt.Registry) error {
	var res []error

	if err := m.validateCode(formats); err != nil {
		res = append(res, err)
	}

	if err := m.validateHelpURL(formats); err != nil {
		res = append(res, err)
	}

	if err := m.validateMessage(formats); err != nil {
		res = append(res, err)
	}

	if len(res) > 0 {
		return errors.CompositeValidationError(res...)
	}
	return nil
}
6496
func (s HorizontalPodAutoscalerGeneratorV1) validate() error {
	if len(s.Name) == 0 {
		return fmt.Errorf("name must be specified")
	}
	if s.MaxReplicas < 1 {
		return fmt.Errorf("'max' is a required parameter and must be at least 1")
	}
	if s.MinReplicas > s.MaxReplicas {
		return fmt.Errorf("'max' must be greater than or equal to 'min'")
	}
	return nil
}
1205967
func Validate(pattern string) (matcher *regexp.Regexp, err error) {
	pattern = strings.TrimSpace(pattern)
	pattern = strings.ToLower(pattern)

	// error check
	if strings.ContainsAny(pattern, "[]+{},") {
		return nil, errors.New(`Only alphanumeric ASCII characters, the hyphen "-", "." and "*" are allowed in a matchPattern`)
	}

	return regexp.Compile(ToRegexp(pattern))
}
1059662
func (c *Config) Validate() error {
	for format := range c.Overrides {
		if _, err := Get(format); err != nil {
			return err
		}
	}
	return nil
}
996822
func (p PortRange) Validate() error {
	proto := strings.ToLower(p.Protocol)
	if proto != "tcp" && proto != "udp" && proto != "icmp" {
		return errors.Errorf(`invalid protocol %q, expected "tcp", "udp", or "icmp"`, proto)
	}
	if proto == "icmp" {
		if p.FromPort == p.ToPort && p.FromPort == -1 {
			return nil
		}
		return errors.Errorf(`protocol "icmp" doesn't support any ports; got "%v"`, p.FromPort)
	}
	err := errors.Errorf(
		"invalid port range %d-%d/%s",
		p.FromPort,
		p.ToPort,
		p.Protocol,
	)
	switch {
	case p.FromPort > p.ToPort:
		return err
	case p.FromPort < 1 || p.FromPort > 65535:
		return err
	case p.ToPort < 1 || p.ToPort > 65535:
		return err
	}
	return nil
}
21928
func (m *DoubleMatcher) Validate() error {
	if m == nil {
		return nil
	}

	switch m.MatchPattern.(type) {

	case *DoubleMatcher_Range:

		{
			tmp := m.GetRange()

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

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

	case *DoubleMatcher_Exact:
		// no validation rules for Exact

	default:
		return DoubleMatcherValidationError{
			field:  "MatchPattern",
			reason: "value is required",
		}

	}

	return nil
}
267036
func (m *TransportSocket) Validate() error {
	if m == nil {
		return nil
	}

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

	switch m.ConfigType.(type) {

	case *TransportSocket_Config:

		{
			tmp := m.GetConfig()

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

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

	case *TransportSocket_TypedConfig:

		{
			tmp := m.GetTypedConfig()

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

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

	}

	return nil
}
1194982
func (i Item) Validate() error {
	if err := i.Ident.Validate(); err != nil {
		return err
	}
	if len(i.Data) > MaxDataSize {
		return errors.New("data is greater than 1MB")
	}
	return nil
}
973335
func (m *RetryPolicy_RetryPriority) Validate() error {
	if m == nil {
		return nil
	}

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

	switch m.ConfigType.(type) {

	case *RetryPolicy_RetryPriority_Config:

		{
			tmp := m.GetConfig()

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

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

	case *RetryPolicy_RetryPriority_TypedConfig:

		{
			tmp := m.GetTypedConfig()

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

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

	}

	return nil
}
232583
func (m *QueryParameterMatcher) Validate() error {
	if m == nil {
		return nil
	}

	if l := len(m.GetName()); l < 1 || l > 1024 {
		return QueryParameterMatcherValidationError{
			field:  "Name",
			reason: "value length must be between 1 and 1024 bytes, inclusive",
		}
	}

	// no validation rules for Value

	{
		tmp := m.GetRegex()

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

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

	return nil
}
216127
func (m *RateLimit_Action_HeaderValueMatch) Validate() error {
	if m == nil {
		return nil
	}

	if len(m.GetDescriptorValue()) < 1 {
		return RateLimit_Action_HeaderValueMatchValidationError{
			field:  "DescriptorValue",
			reason: "value length must be at least 1 bytes",
		}
	}

	{
		tmp := m.GetExpectMatch()

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

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

	if len(m.GetHeaders()) < 1 {
		return RateLimit_Action_HeaderValueMatchValidationError{
			field:  "Headers",
			reason: "value must contain at least 1 item(s)",
		}
	}

	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 RateLimit_Action_HeaderValueMatchValidationError{
						field:  fmt.Sprintf("Headers[%v]", idx),
						reason: "embedded message failed validation",
						cause:  err,
					}
				}
			}
		}

	}

	return nil
}
1369155
func (s *X509Signer) Validate() error {
	s.init.Do(func() {
		s.err = s.initialize()
	})
	return s.err
}
94352
func (m *StatusCodeFilter) Validate() error {
	if m == nil {
		return nil
	}

	if m.GetComparison() == nil {
		return StatusCodeFilterValidationError{
			field:  "Comparison",
			reason: "value is required",
		}
	}

	{
		tmp := m.GetComparison()

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

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

	return nil
}
813126
func (v *Validation) Validate(i interface{}, args ...string) ValidateResult {
	e := NewValidateResult()
	var err error
	switch m := i.(type) {
	case string:
		field := m
		var value, rule string
		switch len(args) {
		case 2:
			rule = args[1]
			fallthrough
		case 1:
			value = args[0]
		}
		if len(rule) == 0 {
			return e
		}
		_, err = v.validator.ValidSimple(field, value, rule)
	default:
		_, err = v.validator.Valid(i, args...)
	}
	if err != nil {
		return e.SetError(err)
	}
	if v.validator.HasError() {
		vErr := v.validator.Errors[0]
		e.SetError(vErr)
		e.SetField(vErr.Field)
		e.SetRaw(v.validator.Errors)
		v.validator.Errors = nil
	}
	return e
}
186570
func (cc *Config) Validate() error {
	if len(cc.BrokerList) == 0 {
		return ErrConfigNoBrokers
	}

	if cc.ReadTimeout < time.Millisecond {
		return ErrConfigInvalidReadTimeout
	}

	if cc.WriteTimeout < time.Millisecond {
		return ErrConfigInvalidWriteTimeout
	}

	if cc.ConnectTimeout < time.Millisecond {
		return ErrConfigInvalidConnectTimeout
	}

	if cc.KeepAliveTimeout < time.Millisecond {
		return ErrConfigInvalidKeepAliveTimeout
	}

	if cc.FetchSize < 1 {
		return ErrConfigInvalidFetchSize
	}

	if cc.MetadataRetries < 0 {
		return ErrConfigInvalidMetadataRetries
	}

	if cc.MetadataBackoff < time.Millisecond {
		return ErrConfigInvalidMetadataBackoff
	}

	if cc.MetadataTTL < time.Millisecond {
		return ErrConfigInvalidMetadataTTL
	}

	if cc.CommitOffsetRetries < 0 {
		return ErrConfigInvalidCommitOffsetRetries
	}

	if cc.CommitOffsetBackoff < time.Millisecond {
		return ErrConfigInvalidCommitOffsetBackoff
	}

	if cc.ConsumerMetadataRetries < 0 {
		return ErrConfigInvalidConsumerMetadataRetries
	}

	if cc.ConsumerMetadataBackoff < time.Millisecond {
		return ErrConfigInvalidConsumerMetadataBackoff
	}

	if cc.ClientID == "" {
		return ErrConfigEmptyClientID
	}

	return nil
}
834990
func Validate(validators ...Validator) *Errors {
	errors := NewErrors()

	wait.Wait(len(validators), func(index int) {
		validator := validators[index]
		validator.IsValid(errors)
	})

	return errors
}