// Code generated by protoc-gen-validate. DO NOT EDIT. // source: conf/v1/middleware.proto package conf import ( "bytes" "errors" "fmt" "net" "net/mail" "net/url" "regexp" "sort" "strings" "time" "unicode/utf8" "google.golang.org/protobuf/types/known/anypb" ) // ensure the imports are used var ( _ = bytes.MinRead _ = errors.New("") _ = fmt.Print _ = utf8.UTFMax _ = (*regexp.Regexp)(nil) _ = (*strings.Reader)(nil) _ = net.IPv4len _ = time.Duration(0) _ = (*url.URL)(nil) _ = (*mail.Address)(nil) _ = anypb.Any{} _ = sort.Sort ) // Validate checks the field values on Middleware with the rules defined in the // proto definition for this message. If any rules are violated, the first // error encountered is returned, or nil if there are no violations. func (m *Middleware) Validate() error { return m.validate(false) } // ValidateAll checks the field values on Middleware with the rules defined in // the proto definition for this message. If any rules are violated, the // result is a list of violation errors wrapped in MiddlewareMultiError, or // nil if none found. func (m *Middleware) ValidateAll() error { return m.validate(true) } func (m *Middleware) validate(all bool) error { if m == nil { return nil } var errors []error // no validation rules for EnableLogging // no validation rules for EnableRecovery // no validation rules for EnableTracing // no validation rules for EnableValidate // no validation rules for EnableCircuitBreaker if all { switch v := interface{}(m.GetLimiter()).(type) { case interface{ ValidateAll() error }: if err := v.ValidateAll(); err != nil { errors = append(errors, MiddlewareValidationError{ field: "Limiter", reason: "embedded message failed validation", cause: err, }) } case interface{ Validate() error }: if err := v.Validate(); err != nil { errors = append(errors, MiddlewareValidationError{ field: "Limiter", reason: "embedded message failed validation", cause: err, }) } } } else if v, ok := interface{}(m.GetLimiter()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return MiddlewareValidationError{ field: "Limiter", reason: "embedded message failed validation", cause: err, } } } if all { switch v := interface{}(m.GetMetrics()).(type) { case interface{ ValidateAll() error }: if err := v.ValidateAll(); err != nil { errors = append(errors, MiddlewareValidationError{ field: "Metrics", reason: "embedded message failed validation", cause: err, }) } case interface{ Validate() error }: if err := v.Validate(); err != nil { errors = append(errors, MiddlewareValidationError{ field: "Metrics", reason: "embedded message failed validation", cause: err, }) } } } else if v, ok := interface{}(m.GetMetrics()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return MiddlewareValidationError{ field: "Metrics", reason: "embedded message failed validation", cause: err, } } } if all { switch v := interface{}(m.GetAuth()).(type) { case interface{ ValidateAll() error }: if err := v.ValidateAll(); err != nil { errors = append(errors, MiddlewareValidationError{ field: "Auth", reason: "embedded message failed validation", cause: err, }) } case interface{ Validate() error }: if err := v.Validate(); err != nil { errors = append(errors, MiddlewareValidationError{ field: "Auth", reason: "embedded message failed validation", cause: err, }) } } } else if v, ok := interface{}(m.GetAuth()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return MiddlewareValidationError{ field: "Auth", reason: "embedded message failed validation", cause: err, } } } if len(errors) > 0 { return MiddlewareMultiError(errors) } return nil } // MiddlewareMultiError is an error wrapping multiple validation errors // returned by Middleware.ValidateAll() if the designated constraints aren't met. type MiddlewareMultiError []error // Error returns a concatenation of all the error messages it wraps. func (m MiddlewareMultiError) Error() string { var msgs []string for _, err := range m { msgs = append(msgs, err.Error()) } return strings.Join(msgs, "; ") } // AllErrors returns a list of validation violation errors. func (m MiddlewareMultiError) AllErrors() []error { return m } // MiddlewareValidationError is the validation error returned by // Middleware.Validate if the designated constraints aren't met. type MiddlewareValidationError struct { field string reason string cause error key bool } // Field function returns field value. func (e MiddlewareValidationError) Field() string { return e.field } // Reason function returns reason value. func (e MiddlewareValidationError) Reason() string { return e.reason } // Cause function returns cause value. func (e MiddlewareValidationError) Cause() error { return e.cause } // Key function returns key value. func (e MiddlewareValidationError) Key() bool { return e.key } // ErrorName returns error name. func (e MiddlewareValidationError) ErrorName() string { return "MiddlewareValidationError" } // Error satisfies the builtin error interface func (e MiddlewareValidationError) Error() string { cause := "" if e.cause != nil { cause = fmt.Sprintf(" | caused by: %v", e.cause) } key := "" if e.key { key = "key for " } return fmt.Sprintf( "invalid %sMiddleware.%s: %s%s", key, e.field, e.reason, cause) } var _ error = MiddlewareValidationError{} var _ interface { Field() string Reason() string Key() bool Cause() error ErrorName() string } = MiddlewareValidationError{} // Validate checks the field values on Middleware_Auth with the rules defined // in the proto definition for this message. If any rules are violated, the // first error encountered is returned, or nil if there are no violations. func (m *Middleware_Auth) Validate() error { return m.validate(false) } // ValidateAll checks the field values on Middleware_Auth with the rules // defined in the proto definition for this message. If any rules are // violated, the result is a list of violation errors wrapped in // Middleware_AuthMultiError, or nil if none found. func (m *Middleware_Auth) ValidateAll() error { return m.validate(true) } func (m *Middleware_Auth) validate(all bool) error { if m == nil { return nil } var errors []error // no validation rules for Method // no validation rules for Key if len(errors) > 0 { return Middleware_AuthMultiError(errors) } return nil } // Middleware_AuthMultiError is an error wrapping multiple validation errors // returned by Middleware_Auth.ValidateAll() if the designated constraints // aren't met. type Middleware_AuthMultiError []error // Error returns a concatenation of all the error messages it wraps. func (m Middleware_AuthMultiError) Error() string { var msgs []string for _, err := range m { msgs = append(msgs, err.Error()) } return strings.Join(msgs, "; ") } // AllErrors returns a list of validation violation errors. func (m Middleware_AuthMultiError) AllErrors() []error { return m } // Middleware_AuthValidationError is the validation error returned by // Middleware_Auth.Validate if the designated constraints aren't met. type Middleware_AuthValidationError struct { field string reason string cause error key bool } // Field function returns field value. func (e Middleware_AuthValidationError) Field() string { return e.field } // Reason function returns reason value. func (e Middleware_AuthValidationError) Reason() string { return e.reason } // Cause function returns cause value. func (e Middleware_AuthValidationError) Cause() error { return e.cause } // Key function returns key value. func (e Middleware_AuthValidationError) Key() bool { return e.key } // ErrorName returns error name. func (e Middleware_AuthValidationError) ErrorName() string { return "Middleware_AuthValidationError" } // Error satisfies the builtin error interface func (e Middleware_AuthValidationError) Error() string { cause := "" if e.cause != nil { cause = fmt.Sprintf(" | caused by: %v", e.cause) } key := "" if e.key { key = "key for " } return fmt.Sprintf( "invalid %sMiddleware_Auth.%s: %s%s", key, e.field, e.reason, cause) } var _ error = Middleware_AuthValidationError{} var _ interface { Field() string Reason() string Key() bool Cause() error ErrorName() string } = Middleware_AuthValidationError{} // Validate checks the field values on Middleware_RateLimiter with the rules // defined in the proto definition for this message. If any rules are // violated, the first error encountered is returned, or nil if there are no violations. func (m *Middleware_RateLimiter) Validate() error { return m.validate(false) } // ValidateAll checks the field values on Middleware_RateLimiter with the rules // defined in the proto definition for this message. If any rules are // violated, the result is a list of violation errors wrapped in // Middleware_RateLimiterMultiError, or nil if none found. func (m *Middleware_RateLimiter) ValidateAll() error { return m.validate(true) } func (m *Middleware_RateLimiter) validate(all bool) error { if m == nil { return nil } var errors []error // no validation rules for Name if len(errors) > 0 { return Middleware_RateLimiterMultiError(errors) } return nil } // Middleware_RateLimiterMultiError is an error wrapping multiple validation // errors returned by Middleware_RateLimiter.ValidateAll() if the designated // constraints aren't met. type Middleware_RateLimiterMultiError []error // Error returns a concatenation of all the error messages it wraps. func (m Middleware_RateLimiterMultiError) Error() string { var msgs []string for _, err := range m { msgs = append(msgs, err.Error()) } return strings.Join(msgs, "; ") } // AllErrors returns a list of validation violation errors. func (m Middleware_RateLimiterMultiError) AllErrors() []error { return m } // Middleware_RateLimiterValidationError is the validation error returned by // Middleware_RateLimiter.Validate if the designated constraints aren't met. type Middleware_RateLimiterValidationError struct { field string reason string cause error key bool } // Field function returns field value. func (e Middleware_RateLimiterValidationError) Field() string { return e.field } // Reason function returns reason value. func (e Middleware_RateLimiterValidationError) Reason() string { return e.reason } // Cause function returns cause value. func (e Middleware_RateLimiterValidationError) Cause() error { return e.cause } // Key function returns key value. func (e Middleware_RateLimiterValidationError) Key() bool { return e.key } // ErrorName returns error name. func (e Middleware_RateLimiterValidationError) ErrorName() string { return "Middleware_RateLimiterValidationError" } // Error satisfies the builtin error interface func (e Middleware_RateLimiterValidationError) Error() string { cause := "" if e.cause != nil { cause = fmt.Sprintf(" | caused by: %v", e.cause) } key := "" if e.key { key = "key for " } return fmt.Sprintf( "invalid %sMiddleware_RateLimiter.%s: %s%s", key, e.field, e.reason, cause) } var _ error = Middleware_RateLimiterValidationError{} var _ interface { Field() string Reason() string Key() bool Cause() error ErrorName() string } = Middleware_RateLimiterValidationError{} // Validate checks the field values on Middleware_Metrics with the rules // defined in the proto definition for this message. If any rules are // violated, the first error encountered is returned, or nil if there are no violations. func (m *Middleware_Metrics) Validate() error { return m.validate(false) } // ValidateAll checks the field values on Middleware_Metrics with the rules // defined in the proto definition for this message. If any rules are // violated, the result is a list of violation errors wrapped in // Middleware_MetricsMultiError, or nil if none found. func (m *Middleware_Metrics) ValidateAll() error { return m.validate(true) } func (m *Middleware_Metrics) validate(all bool) error { if m == nil { return nil } var errors []error // no validation rules for Histogram // no validation rules for Counter // no validation rules for Gauge // no validation rules for Summary if len(errors) > 0 { return Middleware_MetricsMultiError(errors) } return nil } // Middleware_MetricsMultiError is an error wrapping multiple validation errors // returned by Middleware_Metrics.ValidateAll() if the designated constraints // aren't met. type Middleware_MetricsMultiError []error // Error returns a concatenation of all the error messages it wraps. func (m Middleware_MetricsMultiError) Error() string { var msgs []string for _, err := range m { msgs = append(msgs, err.Error()) } return strings.Join(msgs, "; ") } // AllErrors returns a list of validation violation errors. func (m Middleware_MetricsMultiError) AllErrors() []error { return m } // Middleware_MetricsValidationError is the validation error returned by // Middleware_Metrics.Validate if the designated constraints aren't met. type Middleware_MetricsValidationError struct { field string reason string cause error key bool } // Field function returns field value. func (e Middleware_MetricsValidationError) Field() string { return e.field } // Reason function returns reason value. func (e Middleware_MetricsValidationError) Reason() string { return e.reason } // Cause function returns cause value. func (e Middleware_MetricsValidationError) Cause() error { return e.cause } // Key function returns key value. func (e Middleware_MetricsValidationError) Key() bool { return e.key } // ErrorName returns error name. func (e Middleware_MetricsValidationError) ErrorName() string { return "Middleware_MetricsValidationError" } // Error satisfies the builtin error interface func (e Middleware_MetricsValidationError) Error() string { cause := "" if e.cause != nil { cause = fmt.Sprintf(" | caused by: %v", e.cause) } key := "" if e.key { key = "key for " } return fmt.Sprintf( "invalid %sMiddleware_Metrics.%s: %s%s", key, e.field, e.reason, cause) } var _ error = Middleware_MetricsValidationError{} var _ interface { Field() string Reason() string Key() bool Cause() error ErrorName() string } = Middleware_MetricsValidationError{}