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

	{
		tmp := m.GetRouteConfig()

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

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

	{
		tmp := m.GetLastUpdated()

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

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

	return nil
}
229729
func (config Config) Validate() error {
	if config.ControllerUUID == "" {
		return errors.NotValidf("missing ControllerUUID")
	}
	if config.ModelUUID == "" {
		return errors.NotValidf("missing ModelUUID")
	}
	if config.ApplicationGetter == nil {
		return errors.NotValidf("missing ApplicationGetter")
	}
	if config.ServiceExposer == nil {
		return errors.NotValidf("missing ServiceExposer")
	}
	if config.LifeGetter == nil {
		return errors.NotValidf("missing LifeGetter")
	}
	return nil
}
1260675
func (m *GrpcJsonTranscoder) Validate() error {
	if m == nil {
		return nil
	}

	if len(m.GetServices()) < 1 {
		return GrpcJsonTranscoderValidationError{
			field:  "Services",
			reason: "value must contain at least 1 item(s)",
		}
	}

	{
		tmp := m.GetPrintOptions()

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

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

	// no validation rules for MatchIncomingRequestRoute

	switch m.DescriptorSet.(type) {

	case *GrpcJsonTranscoder_ProtoDescriptor:
		// no validation rules for ProtoDescriptor

	case *GrpcJsonTranscoder_ProtoDescriptorBin:
		// no validation rules for ProtoDescriptorBin

	default:
		return GrpcJsonTranscoderValidationError{
			field:  "DescriptorSet",
			reason: "value is required",
		}

	}

	return nil
}
221096
func (config Config) Validate() error {
	if config.Identity == nil {
		return errors.NotValidf("nil Identity")
	}
	if config.Start == nil {
		return errors.NotValidf("nil Start")
	}
	if config.Clock == nil {
		return errors.NotValidf("nil Clock")
	}
	if config.RetryDelay <= 0 {
		return errors.NotValidf("non-positive RetryDelay")
	}
	return nil
}
738554
func (r Route) Validate() error {
	// Make sure the CIDR is actually a CIDR not just an IP or hostname
	destinationIP, _, err := net.ParseCIDR(r.DestinationCIDR)
	if err != nil {
		return errors.Annotate(err, "DestinationCIDR not valid")
	}
	// Make sure the Gateway is just an IP, not a CIDR, etc.
	gatewayIP := net.ParseIP(r.GatewayIP)
	if gatewayIP == nil {
		return errors.Errorf("GatewayIP is not a valid IP address: %q", r.GatewayIP)
	}
	if r.Metric < 0 {
		return errors.Errorf("Metric is negative: %d", r.Metric)
	}
	// Make sure that either both are IPv4 or both are IPv6, not mixed.
	destIP4 := destinationIP.To4()
	gatewayIP4 := gatewayIP.To4()
	if destIP4 != nil {
		if gatewayIP4 == nil {
			return errors.Errorf("DestinationCIDR is IPv4 (%s) but GatewayIP is IPv6 (%s)", r.DestinationCIDR, r.GatewayIP)
		}
	} else {
		if gatewayIP4 != nil {
			return errors.Errorf("DestinationCIDR is IPv6 (%s) but GatewayIP is IPv4 (%s)", r.DestinationCIDR, r.GatewayIP)
		}
	}
	return nil
}
1137684
func (config Config) Validate() error {
	if config.Facade == nil {
		return errors.NotValidf("nil Facade")
	}
	if !utils.IsValidUUIDString(config.Model) {
		return errors.NotValidf("Model %q", config.Model)
	}
	if config.Check == nil {
		return errors.NotValidf("nil Check")
	}
	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
}
652643
func (m *RoutesConfigDump_DynamicRouteConfig) Validate() error {
	if m == nil {
		return nil
	}

	// no validation rules for VersionInfo

	{
		tmp := m.GetRouteConfig()

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

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

	{
		tmp := m.GetLastUpdated()

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

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

	return nil
}
211756
func (m *StringMatcher) Validate() error {
	if m == nil {
		return nil
	}

	switch m.MatchPattern.(type) {

	case *StringMatcher_Exact:
		// no validation rules for Exact

	case *StringMatcher_Prefix:

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

	case *StringMatcher_Suffix:

		if len(m.GetSuffix()) < 1 {
			return StringMatcherValidationError{
				field:  "Suffix",
				reason: "value length must be at least 1 bytes",
			}
		}

	case *StringMatcher_Regex:

		if len(m.GetRegex()) > 1024 {
			return StringMatcherValidationError{
				field:  "Regex",
				reason: "value length must be at most 1024 bytes",
			}
		}

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

	}

	return nil
}
754479
func (config Config) Validate() error {
	if config.APIInfo == nil {
		return errors.NotValidf("nil APIInfo")
	}
	if config.Authenticator == nil {
		return errors.NotValidf("nil Authenticator")
	}
	if config.DialConn == nil {
		return errors.NotValidf("nil DialConn")
	}
	if config.Hub == nil {
		return errors.NotValidf("nil Hub")
	}
	if config.Mux == nil {
		return errors.NotValidf("nil Mux")
	}
	if config.Path == "" {
		return errors.NotValidf("empty Path")
	}
	if config.LocalID == "" {
		return errors.NotValidf("empty LocalID")
	}
	if config.TLSConfig == nil {
		return errors.NotValidf("nil TLSConfig")
	}
	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
}
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
}
285128
func (r Route) Validate() error {
	if r.Domain.IsHTTP() {
		if r.Port.IsSet {
			return actionerror.InvalidHTTPRouteSettings{Domain: r.Domain.Name}
		}
		if r.Domain.IsShared() && r.Host == "" {
			return actionerror.NoHostnameAndSharedDomainError{}
		}
	} else { // Is TCP Domain
		if r.Host != "" || r.Path != "" {
			return actionerror.InvalidTCPRouteSettings{Domain: r.Domain.Name}
		}
	}
	return nil
}
100843
func (config Config) Validate() error {
	if config.Facade == nil {
		return errors.NotValidf("nil Facade")
	}
	if config.GateUnlocker == nil {
		return errors.NotValidf("nil GateUnlocker")
	}
	if config.ModelTag == (names.ModelTag{}) {
		return errors.NotValidf("empty ModelTag")
	}
	return nil
}
328527
func (c *Config) Validate() error {
	if c.API == nil {
		return errors.NotValidf("missing API")
	}
	if c.InProcessUpdate == nil {
		return errors.NotValidf("missing InProcessUpdate")
	}
	if c.Logger == nil {
		return errors.NotValidf("missing Logger")
	}
	return nil
}
225934
func (config Config) Validate() error {
	if config.ModelWatcher == nil {
		return errors.NotValidf("nil ModelWatcher")
	}
	if config.ModelGetter == nil {
		return errors.NotValidf("nil ModelGetter")
	}
	if config.NewModelWorker == nil {
		return errors.NotValidf("nil NewModelWorker")
	}
	if config.ErrorDelay <= 0 {
		return errors.NotValidf("non-positive ErrorDelay")
	}
	return nil
}
722192
func (config Config) Validate() error {
	if config.Raft == nil {
		return errors.NotValidf("nil Raft")
	}
	return nil
}