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

	if len(m.GetCluster()) < 1 {
		return RouteAction_RequestMirrorPolicyValidationError{
			field:  "Cluster",
			reason: "value length must be at least 1 bytes",
		}
	}

	// no validation rules for RuntimeKey

	{
		tmp := m.GetRuntimeFraction()

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

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

	return nil
}
14229
func (m Reason) Validate(formats strfmt.Registry) error {
	var res []error

	// value enum
	if err := m.validateReasonEnum("", "body", m); err != nil {
		return err
	}

	if len(res) > 0 {
		return errors.CompositeValidationError(res...)
	}
	return nil
}
218706
func (r *ResponseDefinition) Validate() *dslengine.ValidationErrors {
	verr := new(dslengine.ValidationErrors)
	if r.Headers != nil {
		verr.Merge(r.Headers.Validate("response headers", r))
	}
	if r.Status == 0 {
		verr.Add(r, "response status not defined")
	}
	return verr.AsError()
}
804418
func (a *AliasRemoveAction) Validate() error {
	var invalid []string
	if len(a.alias) == 0 {
		invalid = append(invalid, "Alias")
	}
	if len(a.index) == 0 {
		invalid = append(invalid, "Index")
	}
	if len(invalid) > 0 {
		return fmt.Errorf("missing required fields: %v", invalid)
	}
	return nil
}
996320
func (m *Rds) Validate() error {
	if m == nil {
		return nil
	}

	{
		tmp := m.GetConfigSource()

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

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

	if len(m.GetRouteConfigName()) < 1 {
		return RdsValidationError{
			field:  "RouteConfigName",
			reason: "value length must be at least 1 bytes",
		}
	}

	return nil
}
206215
func (cm *ClientManager) Validate() error {
	var errs []error
	if cm.negotiatedSerializer == nil {
		errs = append(errs, fmt.Errorf("the clientManager requires a negotiatedSerializer"))
	}
	if cm.serviceResolver == nil {
		errs = append(errs, fmt.Errorf("the clientManager requires a serviceResolver"))
	}
	if cm.authInfoResolver == nil {
		errs = append(errs, fmt.Errorf("the clientManager requires an authInfoResolver"))
	}
	return utilerrors.NewAggregate(errs)
}
1131919
func (m *RedisProxy_PrefixRoutes_Route) Validate() error {
	if m == nil {
		return nil
	}

	if len(m.GetPrefix()) < 1 {
		return RedisProxy_PrefixRoutes_RouteValidationError{
			field:  "Prefix",
			reason: "value length must be at least 1 bytes",
		}
	}

	// no validation rules for RemovePrefix

	if len(m.GetCluster()) < 1 {
		return RedisProxy_PrefixRoutes_RouteValidationError{
			field:  "Cluster",
			reason: "value length must be at least 1 bytes",
		}
	}

	return nil
}
986165
func (m *HttpBufferedTrace_Message) Validate() error {
	if m == nil {
		return nil
	}

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

	}

	{
		tmp := m.GetBody()

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

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

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

		{
			tmp := item

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

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

	}

	return nil
}
441447
func (m *HTTPAccessLogEntry) Validate() error {
	if m == nil {
		return nil
	}

	{
		tmp := m.GetCommonProperties()

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

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

	// no validation rules for ProtocolVersion

	{
		tmp := m.GetRequest()

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

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

	{
		tmp := m.GetResponse()

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

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

	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
}
160985
func (r *ArchiveRequest) Validate() error {
	switch {
	case r.Format == ArchiveRequest_Invalid:
		return errors.New("format must be valid")
	case r.Project == "":
		return errors.New("project is required")
	case r.Ref == "":
		return errors.New("ref is required")
	default:
		return nil
	}
}
611304
func Validate(req interface{}) error {
	// validate req message
	if err := v.Struct(req); err != nil {
		if v, ok := err.(validator.ValidationErrors); ok {
			err = v
		}
		return status.Errorf(codes.InvalidArgument, "Request validation failed: %s", err)
	}
	return nil
}
504199
func (m *ConsentRequest) Validate(formats strfmt.Registry) error {
	var res []error

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

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

	if len(res) > 0 {
		return errors.CompositeValidationError(res...)
	}
	return nil
}
862040
func (o *TTLAfterFinishedControllerOptions) Validate() []error {
	if o == nil {
		return nil
	}

	errs := []error{}
	return errs
}
1003767
func (r *Route) Validate(skipZero bool) error {
	var res []error

	if !skipZero {
		if r.AppName == "" {
			res = append(res, ErrRoutesValidationMissingAppName)
		}

		if r.Image == "" {
			res = append(res, ErrRoutesValidationMissingImage)
		}

		if r.Path == "" {
			res = append(res, ErrRoutesValidationMissingPath)
		}
	}

	if !skipZero || r.Path != "" {
		u, err := url.Parse(r.Path)
		if err != nil {
			res = append(res, ErrRoutesValidationPathMalformed)
		}

		if strings.Contains(u.Path, ":") {
			res = append(res, ErrRoutesValidationFoundDynamicURL)
		}

		if !path.IsAbs(u.Path) {
			res = append(res, ErrRoutesValidationInvalidPath)
		}
	}

	if !skipZero || r.Type != "" {
		if r.Type != TypeAsync && r.Type != TypeSync {
			res = append(res, ErrRoutesValidationInvalidType)
		}
	}

	if !skipZero || r.Format != "" {
		if r.Format != FormatDefault && r.Format != FormatHTTP {
			res = append(res, ErrRoutesValidationInvalidFormat)
		}
	}

	if r.MaxConcurrency < 0 {
		res = append(res, ErrRoutesValidationNegativeMaxConcurrency)
	}

	if r.Timeout < 0 {
		res = append(res, ErrRoutesValidationNegativeTimeout)
	}

	if r.IdleTimeout < 0 {
		res = append(res, ErrRoutesValidationNegativeIdleTimeout)
	}

	if len(res) > 0 {
		return apiErrors.CompositeValidationError(res...)
	}

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

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

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

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

	if len(res) > 0 {
		return errors.CompositeValidationError(res...)
	}
	return nil
}
573403
func (m *Mux) validate(rw http.ResponseWriter, req *http.Request) bool {
	plen := len(req.URL.Path)
	if plen > 1 && req.URL.Path[plen-1:] == "/" {
		cleanURL(&req.URL.Path)
		rw.Header().Set("Location", req.URL.String())
		rw.WriteHeader(http.StatusFound)
		return true
	}
	// Retry to find a route that match
	return m.parse(rw, req)
}