func (m *PassiveHealthCheckUnhealthy) Validate() error {
	if m == nil {
		return nil
	}
	if len(m.GetHttpStatuses()) < 1 {
		return PassiveHealthCheckUnhealthyValidationError{
			field:  "HttpStatuses",
			reason: "value must contain at least 1 item(s)",
		}
	}
	_PassiveHealthCheckUnhealthy_HttpStatuses_Unique := make(map[int32]struct{}, len(m.GetHttpStatuses()))
	for idx, item := range m.GetHttpStatuses() {
		_, _ = idx, item
		if _, exists := _PassiveHealthCheckUnhealthy_HttpStatuses_Unique[item]; exists {
			return PassiveHealthCheckUnhealthyValidationError{
				field:  fmt.Sprintf("HttpStatuses[%v]", idx),
				reason: "repeated value must contain unique items",
			}
		} else {
			_PassiveHealthCheckUnhealthy_HttpStatuses_Unique[item] = struct{}{}
		}
		if val := item; val < 200 || val > 599 {
			return PassiveHealthCheckUnhealthyValidationError{
				field:  fmt.Sprintf("HttpStatuses[%v]", idx),
				reason: "value must be inside range [200, 599]",
			}
		}
	}
	if val := m.GetHttpFailures(); val < 1 || val > 254 {
		return PassiveHealthCheckUnhealthyValidationError{
			field:  "HttpFailures",
			reason: "value must be inside range [1, 254]",
		}
	}
	if val := m.GetTcpFailures(); val < 1 || val > 254 {
		return PassiveHealthCheckUnhealthyValidationError{
			field:  "TcpFailures",
			reason: "value must be inside range [1, 254]",
		}
	}
	if val := m.GetTimeouts(); val < 1 || val > 254 {
		return PassiveHealthCheckUnhealthyValidationError{
			field:  "Timeouts",
			reason: "value must be inside range [1, 254]",
		}
	}
	return nil
}
Validate checks the field values on PassiveHealthCheckUnhealthy with the
rules defined in the proto definition for this message. If any rules are
violated, an error is returned.
package apisix
import (
	"bytes"
	"errors"
	"fmt"
	"net"
	"net/mail"
	"net/url"
	"regexp"
	"strings"
	"time"
	"unicode/utf8"
	"github.com/golang/protobuf/ptypes"
)
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)
	_ = ptypes.DynamicAny{}
)
var _upstream_uuidPattern = regexp.MustCompile("^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$")
func (m *Upstream) Validate() error {
	if m == nil {
		return nil
	}
	if m.GetRetries() < 0 {
		return UpstreamValidationError{
			field:  "Retries",
			reason: "value must be greater than or equal to 0",
		}
	}
	if v, ok := interface{}(m.GetTimeout()).(interface{ Validate() error }); ok {
		if err := v.Validate(); err != nil {
			return UpstreamValidationError{
				field:  "Timeout",
				reason: "embedded message failed validation",
				cause:  err,
			}
		}
	}
	if _, ok := _Upstream_Type_InLookup[m.GetType()]; !ok {
		return UpstreamValidationError{
			field:  "Type",
			reason: "value must be in list [chash roundrobin ewma lease_conn]",
		}
	}
	if _, ok := _Upstream_HashOn_InLookup[m.GetHashOn()]; !ok {
		return UpstreamValidationError{
			field:  "HashOn",
			reason: "value must be in list [vars header cookie consumer vars_combination]",
		}
	}
	if v, ok := interface{}(m.GetCheck()).(interface{ Validate() error }); ok {
		if err := v.Validate(); err != nil {
			return UpstreamValidationError{
				field:  "Check",
				reason: "embedded message failed validation",
				cause:  err,
			}
		}
	}
	if _, ok := _Upstream_Scheme_InLookup[m.GetScheme()]; !ok {
		return UpstreamValidationError{
			field:  "Scheme",
			reason: "value must be in list [grpc grpcs http https]",
		}
	}
	if _, ok := _Upstream_PassHost_InLookup[m.GetPassHost()]; !ok {
		return UpstreamValidationError{
			field:  "PassHost",
			reason: "value must be in list [pass node rewrite]",
		}
	}
	if !_Upstream_UpstreamHost_Pattern.MatchString(m.GetUpstreamHost()) {
		return UpstreamValidationError{
			field:  "UpstreamHost",
			reason: "value does not match regex pattern \"^\\\\*?[0-9a-zA-Z-._]+$\"",
		}
	}
	if l := utf8.RuneCountInString(m.GetName()); l < 1 || l > 100 {
		return UpstreamValidationError{
			field:  "Name",
			reason: "value length must be between 1 and 100 runes, inclusive",
		}
	}
	if utf8.RuneCountInString(m.GetDesc()) > 256 {
		return UpstreamValidationError{
			field:  "Desc",
			reason: "value length must be at most 256 runes",
		}
	}
	for idx, item := range m.GetNodes() {
		_, _ = idx, item
		if v, ok := interface{}(item).(interface{ Validate() error }); ok {
			if err := v.Validate(); err != nil {
				return UpstreamValidationError{
					field:  fmt.Sprintf("Nodes[%v]", idx),
					reason: "embedded message failed validation",
					cause:  err,
				}
			}
		}
	}
	return nil
}
type UpstreamValidationError struct {
	field  string
	reason string
	cause  error
	key    bool
}
func (e UpstreamValidationError) Field() string { return e.field }
func (e UpstreamValidationError) Reason() string { return e.reason }
func (e UpstreamValidationError) Cause() error { return e.cause }
func (e UpstreamValidationError) Key() bool { return e.key }
func (e UpstreamValidationError) ErrorName() string { return "UpstreamValidationError" }
func (e UpstreamValidationError) 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 %sUpstream.%s: %s%s",
		key,
		e.field,
		e.reason,
		cause)
}
var _ error = UpstreamValidationError{}
var _ interface {
	Field() string
	Reason() string
	Key() bool
	Cause() error
	ErrorName() string
} = UpstreamValidationError{}
var _Upstream_Type_InLookup = map[string]struct{}{
	"chash":      {},
	"roundrobin": {},
	"ewma":       {},
	"lease_conn": {},
}
var _Upstream_HashOn_InLookup = map[string]struct{}{
	"vars":             {},
	"header":           {},
	"cookie":           {},
	"consumer":         {},
	"vars_combination": {},
}
var _Upstream_Scheme_InLookup = map[string]struct{}{
	"grpc":  {},
	"grpcs": {},
	"http":  {},
	"https": {},
}
var _Upstream_PassHost_InLookup = map[string]struct{}{
	"pass":    {},
	"node":    {},
	"rewrite": {},
}
var _Upstream_UpstreamHost_Pattern = regexp.MustCompile("^\\*?[0-9a-zA-Z-._]+$")
func (m *HealthCheck) Validate() error {
	if m == nil {
		return nil
	}
	if m.GetActive() == nil {
		return HealthCheckValidationError{
			field:  "Active",
			reason: "value is required",
		}
	}
	if v, ok := interface{}(m.GetActive()).(interface{ Validate() error }); ok {
		if err := v.Validate(); err != nil {
			return HealthCheckValidationError{
				field:  "Active",
				reason: "embedded message failed validation",
				cause:  err,
			}
		}
	}
	if v, ok := interface{}(m.GetPassive()).(interface{ Validate() error }); ok {
		if err := v.Validate(); err != nil {
			return HealthCheckValidationError{
				field:  "Passive",
				reason: "embedded message failed validation",
				cause:  err,
			}
		}
	}
	return nil
}
type HealthCheckValidationError struct {
	field  string
	reason string
	cause  error
	key    bool
}
func (e HealthCheckValidationError) Field() string { return e.field }
func (e HealthCheckValidationError) Reason() string { return e.reason }
func (e HealthCheckValidationError) Cause() error { return e.cause }
func (e HealthCheckValidationError) Key() bool { return e.key }
func (e HealthCheckValidationError) ErrorName() string { return "HealthCheckValidationError" }
func (e HealthCheckValidationError) 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 %sHealthCheck.%s: %s%s",
		key,
		e.field,
		e.reason,
		cause)
}
var _ error = HealthCheckValidationError{}
var _ interface {
	Field() string
	Reason() string
	Key() bool
	Cause() error
	ErrorName() string
} = HealthCheckValidationError{}
func (m *ActiveHealthCheck) Validate() error {
	if m == nil {
		return nil
	}
	if _, ok := _ActiveHealthCheck_Type_InLookup[m.GetType()]; !ok {
		return ActiveHealthCheckValidationError{
			field:  "Type",
			reason: "value must be in list [http https tcp]",
		}
	}
	if m.GetTimeout() < 0 {
		return ActiveHealthCheckValidationError{
			field:  "Timeout",
			reason: "value must be greater than or equal to 0",
		}
	}
	if m.GetConcurrency() < 0 {
		return ActiveHealthCheckValidationError{
			field:  "Concurrency",
			reason: "value must be greater than or equal to 0",
		}
	}
	if !_ActiveHealthCheck_Host_Pattern.MatchString(m.GetHost()) {
		return ActiveHealthCheckValidationError{
			field:  "Host",
			reason: "value does not match regex pattern \"^\\\\*?[0-9a-zA-Z-._]+$\"",
		}
	}
	if val := m.GetPort(); val < 1 || val > 65535 {
		return ActiveHealthCheckValidationError{
			field:  "Port",
			reason: "value must be inside range [1, 65535]",
		}
	}
	if v, ok := interface{}(m.GetHealthy()).(interface{ Validate() error }); ok {
		if err := v.Validate(); err != nil {
			return ActiveHealthCheckValidationError{
				field:  "Healthy",
				reason: "embedded message failed validation",
				cause:  err,
			}
		}
	}
	if v, ok := interface{}(m.GetUnhealthy()).(interface{ Validate() error }); ok {
		if err := v.Validate(); err != nil {
			return ActiveHealthCheckValidationError{
				field:  "Unhealthy",
				reason: "embedded message failed validation",
				cause:  err,
			}
		}
	}
	if len(m.GetReqHeaders()) < 1 {
		return ActiveHealthCheckValidationError{
			field:  "ReqHeaders",
			reason: "value must contain at least 1 item(s)",
		}
	}
	_ActiveHealthCheck_ReqHeaders_Unique := make(map[string]struct{}, len(m.GetReqHeaders()))
	for idx, item := range m.GetReqHeaders() {
		_, _ = idx, item
		if _, exists := _ActiveHealthCheck_ReqHeaders_Unique[item]; exists {
			return ActiveHealthCheckValidationError{
				field:  fmt.Sprintf("ReqHeaders[%v]", idx),
				reason: "repeated value must contain unique items",
			}
		} else {
			_ActiveHealthCheck_ReqHeaders_Unique[item] = struct{}{}
		}
	}
	return nil
}
type ActiveHealthCheckValidationError struct {
	field  string
	reason string
	cause  error
	key    bool
}
func (e ActiveHealthCheckValidationError) Field() string { return e.field }
func (e ActiveHealthCheckValidationError) Reason() string { return e.reason }
func (e ActiveHealthCheckValidationError) Cause() error { return e.cause }
func (e ActiveHealthCheckValidationError) Key() bool { return e.key }
func (e ActiveHealthCheckValidationError) ErrorName() string {
	return "ActiveHealthCheckValidationError"
}
func (e ActiveHealthCheckValidationError) 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 %sActiveHealthCheck.%s: %s%s",
		key,
		e.field,
		e.reason,
		cause)
}
var _ error = ActiveHealthCheckValidationError{}
var _ interface {
	Field() string
	Reason() string
	Key() bool
	Cause() error
	ErrorName() string
} = ActiveHealthCheckValidationError{}
var _ActiveHealthCheck_Type_InLookup = map[string]struct{}{
	"http":  {},
	"https": {},
	"tcp":   {},
}
var _ActiveHealthCheck_Host_Pattern = regexp.MustCompile("^\\*?[0-9a-zA-Z-._]+$")
func (m *PassiveHealthCheck) Validate() error {
	if m == nil {
		return nil
	}
	if _, ok := _PassiveHealthCheck_Type_InLookup[m.GetType()]; !ok {
		return PassiveHealthCheckValidationError{
			field:  "Type",
			reason: "value must be in list [http https tcp]",
		}
	}
	if v, ok := interface{}(m.GetHealthy()).(interface{ Validate() error }); ok {
		if err := v.Validate(); err != nil {
			return PassiveHealthCheckValidationError{
				field:  "Healthy",
				reason: "embedded message failed validation",
				cause:  err,
			}
		}
	}
	if v, ok := interface{}(m.GetUnhealthy()).(interface{ Validate() error }); ok {
		if err := v.Validate(); err != nil {
			return PassiveHealthCheckValidationError{
				field:  "Unhealthy",
				reason: "embedded message failed validation",
				cause:  err,
			}
		}
	}
	return nil
}
type PassiveHealthCheckValidationError struct {
	field  string
	reason string
	cause  error
	key    bool
}
func (e PassiveHealthCheckValidationError) Field() string { return e.field }
func (e PassiveHealthCheckValidationError) Reason() string { return e.reason }
func (e PassiveHealthCheckValidationError) Cause() error { return e.cause }
func (e PassiveHealthCheckValidationError) Key() bool { return e.key }
func (e PassiveHealthCheckValidationError) ErrorName() string {
	return "PassiveHealthCheckValidationError"
}
func (e PassiveHealthCheckValidationError) 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 %sPassiveHealthCheck.%s: %s%s",
		key,
		e.field,
		e.reason,
		cause)
}
var _ error = PassiveHealthCheckValidationError{}
var _ interface {
	Field() string
	Reason() string
	Key() bool
	Cause() error
	ErrorName() string
} = PassiveHealthCheckValidationError{}
var _PassiveHealthCheck_Type_InLookup = map[string]struct{}{
	"http":  {},
	"https": {},
	"tcp":   {},
}
func (m *ActiveHealthCheckHealthy) Validate() error {
	if m == nil {
		return nil
	}
	if m.GetInterval() < 1 {
		return ActiveHealthCheckHealthyValidationError{
			field:  "Interval",
			reason: "value must be greater than or equal to 1",
		}
	}
	if len(m.GetHttpStatuses()) < 1 {
		return ActiveHealthCheckHealthyValidationError{
			field:  "HttpStatuses",
			reason: "value must contain at least 1 item(s)",
		}
	}
	_ActiveHealthCheckHealthy_HttpStatuses_Unique := make(map[int32]struct{}, len(m.GetHttpStatuses()))
	for idx, item := range m.GetHttpStatuses() {
		_, _ = idx, item
		if _, exists := _ActiveHealthCheckHealthy_HttpStatuses_Unique[item]; exists {
			return ActiveHealthCheckHealthyValidationError{
				field:  fmt.Sprintf("HttpStatuses[%v]", idx),
				reason: "repeated value must contain unique items",
			}
		} else {
			_ActiveHealthCheckHealthy_HttpStatuses_Unique[item] = struct{}{}
		}
		if val := item; val < 200 || val > 599 {
			return ActiveHealthCheckHealthyValidationError{
				field:  fmt.Sprintf("HttpStatuses[%v]", idx),
				reason: "value must be inside range [200, 599]",
			}
		}
	}
	if val := m.GetSuccesses(); val < 1 || val > 254 {
		return ActiveHealthCheckHealthyValidationError{
			field:  "Successes",
			reason: "value must be inside range [1, 254]",
		}
	}
	return nil
}
type ActiveHealthCheckHealthyValidationError struct {
	field  string
	reason string
	cause  error
	key    bool
}
func (e ActiveHealthCheckHealthyValidationError) Field() string { return e.field }
func (e ActiveHealthCheckHealthyValidationError) Reason() string { return e.reason }
func (e ActiveHealthCheckHealthyValidationError) Cause() error { return e.cause }
func (e ActiveHealthCheckHealthyValidationError) Key() bool { return e.key }
func (e ActiveHealthCheckHealthyValidationError) ErrorName() string {
	return "ActiveHealthCheckHealthyValidationError"
}
func (e ActiveHealthCheckHealthyValidationError) 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 %sActiveHealthCheckHealthy.%s: %s%s",
		key,
		e.field,
		e.reason,
		cause)
}
var _ error = ActiveHealthCheckHealthyValidationError{}
var _ interface {
	Field() string
	Reason() string
	Key() bool
	Cause() error
	ErrorName() string
} = ActiveHealthCheckHealthyValidationError{}
func (m *ActiveHealthCheckUnhealthy) Validate() error {
	if m == nil {
		return nil
	}
	if m.GetInterval() < 1 {
		return ActiveHealthCheckUnhealthyValidationError{
			field:  "Interval",
			reason: "value must be greater than or equal to 1",
		}
	}
	if len(m.GetHttpStatuses()) < 1 {
		return ActiveHealthCheckUnhealthyValidationError{
			field:  "HttpStatuses",
			reason: "value must contain at least 1 item(s)",
		}
	}
	_ActiveHealthCheckUnhealthy_HttpStatuses_Unique := make(map[int32]struct{}, len(m.GetHttpStatuses()))
	for idx, item := range m.GetHttpStatuses() {
		_, _ = idx, item
		if _, exists := _ActiveHealthCheckUnhealthy_HttpStatuses_Unique[item]; exists {
			return ActiveHealthCheckUnhealthyValidationError{
				field:  fmt.Sprintf("HttpStatuses[%v]", idx),
				reason: "repeated value must contain unique items",
			}
		} else {
			_ActiveHealthCheckUnhealthy_HttpStatuses_Unique[item] = struct{}{}
		}
		if val := item; val < 200 || val > 599 {
			return ActiveHealthCheckUnhealthyValidationError{
				field:  fmt.Sprintf("HttpStatuses[%v]", idx),
				reason: "value must be inside range [200, 599]",
			}
		}
	}
	if val := m.GetHttpFailures(); val < 1 || val > 254 {
		return ActiveHealthCheckUnhealthyValidationError{
			field:  "HttpFailures",
			reason: "value must be inside range [1, 254]",
		}
	}
	if val := m.GetTcpFailures(); val < 1 || val > 254 {
		return ActiveHealthCheckUnhealthyValidationError{
			field:  "TcpFailures",
			reason: "value must be inside range [1, 254]",
		}
	}
	if val := m.GetTimeouts(); val < 1 || val > 254 {
		return ActiveHealthCheckUnhealthyValidationError{
			field:  "Timeouts",
			reason: "value must be inside range [1, 254]",
		}
	}
	return nil
}
type ActiveHealthCheckUnhealthyValidationError struct {
	field  string
	reason string
	cause  error
	key    bool
}
func (e ActiveHealthCheckUnhealthyValidationError) Field() string { return e.field }
func (e ActiveHealthCheckUnhealthyValidationError) Reason() string { return e.reason }
func (e ActiveHealthCheckUnhealthyValidationError) Cause() error { return e.cause }
func (e ActiveHealthCheckUnhealthyValidationError) Key() bool { return e.key }
func (e ActiveHealthCheckUnhealthyValidationError) ErrorName() string {
	return "ActiveHealthCheckUnhealthyValidationError"
}
func (e ActiveHealthCheckUnhealthyValidationError) 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 %sActiveHealthCheckUnhealthy.%s: %s%s",
		key,
		e.field,
		e.reason,
		cause)
}
var _ error = ActiveHealthCheckUnhealthyValidationError{}
var _ interface {
	Field() string
	Reason() string
	Key() bool
	Cause() error
	ErrorName() string
} = ActiveHealthCheckUnhealthyValidationError{}
func (m *PassiveHealthCheckHealthy) Validate() error {
	if m == nil {
		return nil
	}
	if len(m.GetHttpStatuses()) < 1 {
		return PassiveHealthCheckHealthyValidationError{
			field:  "HttpStatuses",
			reason: "value must contain at least 1 item(s)",
		}
	}
	_PassiveHealthCheckHealthy_HttpStatuses_Unique := make(map[int32]struct{}, len(m.GetHttpStatuses()))
	for idx, item := range m.GetHttpStatuses() {
		_, _ = idx, item
		if _, exists := _PassiveHealthCheckHealthy_HttpStatuses_Unique[item]; exists {
			return PassiveHealthCheckHealthyValidationError{
				field:  fmt.Sprintf("HttpStatuses[%v]", idx),
				reason: "repeated value must contain unique items",
			}
		} else {
			_PassiveHealthCheckHealthy_HttpStatuses_Unique[item] = struct{}{}
		}
		if val := item; val < 200 || val > 599 {
			return PassiveHealthCheckHealthyValidationError{
				field:  fmt.Sprintf("HttpStatuses[%v]", idx),
				reason: "value must be inside range [200, 599]",
			}
		}
	}
	if val := m.GetSuccesses(); val < 1 || val > 254 {
		return PassiveHealthCheckHealthyValidationError{
			field:  "Successes",
			reason: "value must be inside range [1, 254]",
		}
	}
	return nil
}
type PassiveHealthCheckHealthyValidationError struct {
	field  string
	reason string
	cause  error
	key    bool
}
func (e PassiveHealthCheckHealthyValidationError) Field() string { return e.field }
func (e PassiveHealthCheckHealthyValidationError) Reason() string { return e.reason }
func (e PassiveHealthCheckHealthyValidationError) Cause() error { return e.cause }
func (e PassiveHealthCheckHealthyValidationError) Key() bool { return e.key }
func (e PassiveHealthCheckHealthyValidationError) ErrorName() string {
	return "PassiveHealthCheckHealthyValidationError"
}
func (e PassiveHealthCheckHealthyValidationError) 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 %sPassiveHealthCheckHealthy.%s: %s%s",
		key,
		e.field,
		e.reason,
		cause)
}
var _ error = PassiveHealthCheckHealthyValidationError{}
var _ interface {
	Field() string
	Reason() string
	Key() bool
	Cause() error
	ErrorName() string
} = PassiveHealthCheckHealthyValidationError{}