github.com/hxx258456/ccgo@v0.0.5-0.20230213014102-48b35f46f66f/go-control-plane/envoy/config/core/v3/health_check.pb.validate.go (about)

     1  // Code generated by protoc-gen-validate. DO NOT EDIT.
     2  // source: envoy/config/core/v3/health_check.proto
     3  
     4  package envoy_config_core_v3
     5  
     6  import (
     7  	"bytes"
     8  	"errors"
     9  	"fmt"
    10  	"net"
    11  	"net/mail"
    12  	"net/url"
    13  	"regexp"
    14  	"strings"
    15  	"time"
    16  	"unicode/utf8"
    17  
    18  	"google.golang.org/protobuf/types/known/anypb"
    19  
    20  	v3 "github.com/hxx258456/ccgo/go-control-plane/envoy/type/v3"
    21  )
    22  
    23  // ensure the imports are used
    24  var (
    25  	_ = bytes.MinRead
    26  	_ = errors.New("")
    27  	_ = fmt.Print
    28  	_ = utf8.UTFMax
    29  	_ = (*regexp.Regexp)(nil)
    30  	_ = (*strings.Reader)(nil)
    31  	_ = net.IPv4len
    32  	_ = time.Duration(0)
    33  	_ = (*url.URL)(nil)
    34  	_ = (*mail.Address)(nil)
    35  	_ = anypb.Any{}
    36  
    37  	_ = v3.CodecClientType(0)
    38  )
    39  
    40  // Validate checks the field values on HealthCheck with the rules defined in
    41  // the proto definition for this message. If any rules are violated, an error
    42  // is returned.
    43  func (m *HealthCheck) Validate() error {
    44  	if m == nil {
    45  		return nil
    46  	}
    47  
    48  	if m.GetTimeout() == nil {
    49  		return HealthCheckValidationError{
    50  			field:  "Timeout",
    51  			reason: "value is required",
    52  		}
    53  	}
    54  
    55  	if d := m.GetTimeout(); d != nil {
    56  		dur, err := d.AsDuration(), d.CheckValid()
    57  		if err != nil {
    58  			return HealthCheckValidationError{
    59  				field:  "Timeout",
    60  				reason: "value is not a valid duration",
    61  				cause:  err,
    62  			}
    63  		}
    64  
    65  		gt := time.Duration(0*time.Second + 0*time.Nanosecond)
    66  
    67  		if dur <= gt {
    68  			return HealthCheckValidationError{
    69  				field:  "Timeout",
    70  				reason: "value must be greater than 0s",
    71  			}
    72  		}
    73  
    74  	}
    75  
    76  	if m.GetInterval() == nil {
    77  		return HealthCheckValidationError{
    78  			field:  "Interval",
    79  			reason: "value is required",
    80  		}
    81  	}
    82  
    83  	if d := m.GetInterval(); d != nil {
    84  		dur, err := d.AsDuration(), d.CheckValid()
    85  		if err != nil {
    86  			return HealthCheckValidationError{
    87  				field:  "Interval",
    88  				reason: "value is not a valid duration",
    89  				cause:  err,
    90  			}
    91  		}
    92  
    93  		gt := time.Duration(0*time.Second + 0*time.Nanosecond)
    94  
    95  		if dur <= gt {
    96  			return HealthCheckValidationError{
    97  				field:  "Interval",
    98  				reason: "value must be greater than 0s",
    99  			}
   100  		}
   101  
   102  	}
   103  
   104  	if v, ok := interface{}(m.GetInitialJitter()).(interface{ Validate() error }); ok {
   105  		if err := v.Validate(); err != nil {
   106  			return HealthCheckValidationError{
   107  				field:  "InitialJitter",
   108  				reason: "embedded message failed validation",
   109  				cause:  err,
   110  			}
   111  		}
   112  	}
   113  
   114  	if v, ok := interface{}(m.GetIntervalJitter()).(interface{ Validate() error }); ok {
   115  		if err := v.Validate(); err != nil {
   116  			return HealthCheckValidationError{
   117  				field:  "IntervalJitter",
   118  				reason: "embedded message failed validation",
   119  				cause:  err,
   120  			}
   121  		}
   122  	}
   123  
   124  	// no validation rules for IntervalJitterPercent
   125  
   126  	if m.GetUnhealthyThreshold() == nil {
   127  		return HealthCheckValidationError{
   128  			field:  "UnhealthyThreshold",
   129  			reason: "value is required",
   130  		}
   131  	}
   132  
   133  	if v, ok := interface{}(m.GetUnhealthyThreshold()).(interface{ Validate() error }); ok {
   134  		if err := v.Validate(); err != nil {
   135  			return HealthCheckValidationError{
   136  				field:  "UnhealthyThreshold",
   137  				reason: "embedded message failed validation",
   138  				cause:  err,
   139  			}
   140  		}
   141  	}
   142  
   143  	if m.GetHealthyThreshold() == nil {
   144  		return HealthCheckValidationError{
   145  			field:  "HealthyThreshold",
   146  			reason: "value is required",
   147  		}
   148  	}
   149  
   150  	if v, ok := interface{}(m.GetHealthyThreshold()).(interface{ Validate() error }); ok {
   151  		if err := v.Validate(); err != nil {
   152  			return HealthCheckValidationError{
   153  				field:  "HealthyThreshold",
   154  				reason: "embedded message failed validation",
   155  				cause:  err,
   156  			}
   157  		}
   158  	}
   159  
   160  	if v, ok := interface{}(m.GetAltPort()).(interface{ Validate() error }); ok {
   161  		if err := v.Validate(); err != nil {
   162  			return HealthCheckValidationError{
   163  				field:  "AltPort",
   164  				reason: "embedded message failed validation",
   165  				cause:  err,
   166  			}
   167  		}
   168  	}
   169  
   170  	if v, ok := interface{}(m.GetReuseConnection()).(interface{ Validate() error }); ok {
   171  		if err := v.Validate(); err != nil {
   172  			return HealthCheckValidationError{
   173  				field:  "ReuseConnection",
   174  				reason: "embedded message failed validation",
   175  				cause:  err,
   176  			}
   177  		}
   178  	}
   179  
   180  	if d := m.GetNoTrafficInterval(); d != nil {
   181  		dur, err := d.AsDuration(), d.CheckValid()
   182  		if err != nil {
   183  			return HealthCheckValidationError{
   184  				field:  "NoTrafficInterval",
   185  				reason: "value is not a valid duration",
   186  				cause:  err,
   187  			}
   188  		}
   189  
   190  		gt := time.Duration(0*time.Second + 0*time.Nanosecond)
   191  
   192  		if dur <= gt {
   193  			return HealthCheckValidationError{
   194  				field:  "NoTrafficInterval",
   195  				reason: "value must be greater than 0s",
   196  			}
   197  		}
   198  
   199  	}
   200  
   201  	if d := m.GetNoTrafficHealthyInterval(); d != nil {
   202  		dur, err := d.AsDuration(), d.CheckValid()
   203  		if err != nil {
   204  			return HealthCheckValidationError{
   205  				field:  "NoTrafficHealthyInterval",
   206  				reason: "value is not a valid duration",
   207  				cause:  err,
   208  			}
   209  		}
   210  
   211  		gt := time.Duration(0*time.Second + 0*time.Nanosecond)
   212  
   213  		if dur <= gt {
   214  			return HealthCheckValidationError{
   215  				field:  "NoTrafficHealthyInterval",
   216  				reason: "value must be greater than 0s",
   217  			}
   218  		}
   219  
   220  	}
   221  
   222  	if d := m.GetUnhealthyInterval(); d != nil {
   223  		dur, err := d.AsDuration(), d.CheckValid()
   224  		if err != nil {
   225  			return HealthCheckValidationError{
   226  				field:  "UnhealthyInterval",
   227  				reason: "value is not a valid duration",
   228  				cause:  err,
   229  			}
   230  		}
   231  
   232  		gt := time.Duration(0*time.Second + 0*time.Nanosecond)
   233  
   234  		if dur <= gt {
   235  			return HealthCheckValidationError{
   236  				field:  "UnhealthyInterval",
   237  				reason: "value must be greater than 0s",
   238  			}
   239  		}
   240  
   241  	}
   242  
   243  	if d := m.GetUnhealthyEdgeInterval(); d != nil {
   244  		dur, err := d.AsDuration(), d.CheckValid()
   245  		if err != nil {
   246  			return HealthCheckValidationError{
   247  				field:  "UnhealthyEdgeInterval",
   248  				reason: "value is not a valid duration",
   249  				cause:  err,
   250  			}
   251  		}
   252  
   253  		gt := time.Duration(0*time.Second + 0*time.Nanosecond)
   254  
   255  		if dur <= gt {
   256  			return HealthCheckValidationError{
   257  				field:  "UnhealthyEdgeInterval",
   258  				reason: "value must be greater than 0s",
   259  			}
   260  		}
   261  
   262  	}
   263  
   264  	if d := m.GetHealthyEdgeInterval(); d != nil {
   265  		dur, err := d.AsDuration(), d.CheckValid()
   266  		if err != nil {
   267  			return HealthCheckValidationError{
   268  				field:  "HealthyEdgeInterval",
   269  				reason: "value is not a valid duration",
   270  				cause:  err,
   271  			}
   272  		}
   273  
   274  		gt := time.Duration(0*time.Second + 0*time.Nanosecond)
   275  
   276  		if dur <= gt {
   277  			return HealthCheckValidationError{
   278  				field:  "HealthyEdgeInterval",
   279  				reason: "value must be greater than 0s",
   280  			}
   281  		}
   282  
   283  	}
   284  
   285  	// no validation rules for EventLogPath
   286  
   287  	if v, ok := interface{}(m.GetEventService()).(interface{ Validate() error }); ok {
   288  		if err := v.Validate(); err != nil {
   289  			return HealthCheckValidationError{
   290  				field:  "EventService",
   291  				reason: "embedded message failed validation",
   292  				cause:  err,
   293  			}
   294  		}
   295  	}
   296  
   297  	// no validation rules for AlwaysLogHealthCheckFailures
   298  
   299  	if v, ok := interface{}(m.GetTlsOptions()).(interface{ Validate() error }); ok {
   300  		if err := v.Validate(); err != nil {
   301  			return HealthCheckValidationError{
   302  				field:  "TlsOptions",
   303  				reason: "embedded message failed validation",
   304  				cause:  err,
   305  			}
   306  		}
   307  	}
   308  
   309  	if v, ok := interface{}(m.GetTransportSocketMatchCriteria()).(interface{ Validate() error }); ok {
   310  		if err := v.Validate(); err != nil {
   311  			return HealthCheckValidationError{
   312  				field:  "TransportSocketMatchCriteria",
   313  				reason: "embedded message failed validation",
   314  				cause:  err,
   315  			}
   316  		}
   317  	}
   318  
   319  	switch m.HealthChecker.(type) {
   320  
   321  	case *HealthCheck_HttpHealthCheck_:
   322  
   323  		if v, ok := interface{}(m.GetHttpHealthCheck()).(interface{ Validate() error }); ok {
   324  			if err := v.Validate(); err != nil {
   325  				return HealthCheckValidationError{
   326  					field:  "HttpHealthCheck",
   327  					reason: "embedded message failed validation",
   328  					cause:  err,
   329  				}
   330  			}
   331  		}
   332  
   333  	case *HealthCheck_TcpHealthCheck_:
   334  
   335  		if v, ok := interface{}(m.GetTcpHealthCheck()).(interface{ Validate() error }); ok {
   336  			if err := v.Validate(); err != nil {
   337  				return HealthCheckValidationError{
   338  					field:  "TcpHealthCheck",
   339  					reason: "embedded message failed validation",
   340  					cause:  err,
   341  				}
   342  			}
   343  		}
   344  
   345  	case *HealthCheck_GrpcHealthCheck_:
   346  
   347  		if v, ok := interface{}(m.GetGrpcHealthCheck()).(interface{ Validate() error }); ok {
   348  			if err := v.Validate(); err != nil {
   349  				return HealthCheckValidationError{
   350  					field:  "GrpcHealthCheck",
   351  					reason: "embedded message failed validation",
   352  					cause:  err,
   353  				}
   354  			}
   355  		}
   356  
   357  	case *HealthCheck_CustomHealthCheck_:
   358  
   359  		if v, ok := interface{}(m.GetCustomHealthCheck()).(interface{ Validate() error }); ok {
   360  			if err := v.Validate(); err != nil {
   361  				return HealthCheckValidationError{
   362  					field:  "CustomHealthCheck",
   363  					reason: "embedded message failed validation",
   364  					cause:  err,
   365  				}
   366  			}
   367  		}
   368  
   369  	default:
   370  		return HealthCheckValidationError{
   371  			field:  "HealthChecker",
   372  			reason: "value is required",
   373  		}
   374  
   375  	}
   376  
   377  	return nil
   378  }
   379  
   380  // HealthCheckValidationError is the validation error returned by
   381  // HealthCheck.Validate if the designated constraints aren't met.
   382  type HealthCheckValidationError struct {
   383  	field  string
   384  	reason string
   385  	cause  error
   386  	key    bool
   387  }
   388  
   389  // Field function returns field value.
   390  func (e HealthCheckValidationError) Field() string { return e.field }
   391  
   392  // Reason function returns reason value.
   393  func (e HealthCheckValidationError) Reason() string { return e.reason }
   394  
   395  // Cause function returns cause value.
   396  func (e HealthCheckValidationError) Cause() error { return e.cause }
   397  
   398  // Key function returns key value.
   399  func (e HealthCheckValidationError) Key() bool { return e.key }
   400  
   401  // ErrorName returns error name.
   402  func (e HealthCheckValidationError) ErrorName() string { return "HealthCheckValidationError" }
   403  
   404  // Error satisfies the builtin error interface
   405  func (e HealthCheckValidationError) Error() string {
   406  	cause := ""
   407  	if e.cause != nil {
   408  		cause = fmt.Sprintf(" | caused by: %v", e.cause)
   409  	}
   410  
   411  	key := ""
   412  	if e.key {
   413  		key = "key for "
   414  	}
   415  
   416  	return fmt.Sprintf(
   417  		"invalid %sHealthCheck.%s: %s%s",
   418  		key,
   419  		e.field,
   420  		e.reason,
   421  		cause)
   422  }
   423  
   424  var _ error = HealthCheckValidationError{}
   425  
   426  var _ interface {
   427  	Field() string
   428  	Reason() string
   429  	Key() bool
   430  	Cause() error
   431  	ErrorName() string
   432  } = HealthCheckValidationError{}
   433  
   434  // Validate checks the field values on HealthCheck_Payload with the rules
   435  // defined in the proto definition for this message. If any rules are
   436  // violated, an error is returned.
   437  func (m *HealthCheck_Payload) Validate() error {
   438  	if m == nil {
   439  		return nil
   440  	}
   441  
   442  	switch m.Payload.(type) {
   443  
   444  	case *HealthCheck_Payload_Text:
   445  
   446  		if utf8.RuneCountInString(m.GetText()) < 1 {
   447  			return HealthCheck_PayloadValidationError{
   448  				field:  "Text",
   449  				reason: "value length must be at least 1 runes",
   450  			}
   451  		}
   452  
   453  	case *HealthCheck_Payload_Binary:
   454  		// no validation rules for Binary
   455  
   456  	default:
   457  		return HealthCheck_PayloadValidationError{
   458  			field:  "Payload",
   459  			reason: "value is required",
   460  		}
   461  
   462  	}
   463  
   464  	return nil
   465  }
   466  
   467  // HealthCheck_PayloadValidationError is the validation error returned by
   468  // HealthCheck_Payload.Validate if the designated constraints aren't met.
   469  type HealthCheck_PayloadValidationError struct {
   470  	field  string
   471  	reason string
   472  	cause  error
   473  	key    bool
   474  }
   475  
   476  // Field function returns field value.
   477  func (e HealthCheck_PayloadValidationError) Field() string { return e.field }
   478  
   479  // Reason function returns reason value.
   480  func (e HealthCheck_PayloadValidationError) Reason() string { return e.reason }
   481  
   482  // Cause function returns cause value.
   483  func (e HealthCheck_PayloadValidationError) Cause() error { return e.cause }
   484  
   485  // Key function returns key value.
   486  func (e HealthCheck_PayloadValidationError) Key() bool { return e.key }
   487  
   488  // ErrorName returns error name.
   489  func (e HealthCheck_PayloadValidationError) ErrorName() string {
   490  	return "HealthCheck_PayloadValidationError"
   491  }
   492  
   493  // Error satisfies the builtin error interface
   494  func (e HealthCheck_PayloadValidationError) Error() string {
   495  	cause := ""
   496  	if e.cause != nil {
   497  		cause = fmt.Sprintf(" | caused by: %v", e.cause)
   498  	}
   499  
   500  	key := ""
   501  	if e.key {
   502  		key = "key for "
   503  	}
   504  
   505  	return fmt.Sprintf(
   506  		"invalid %sHealthCheck_Payload.%s: %s%s",
   507  		key,
   508  		e.field,
   509  		e.reason,
   510  		cause)
   511  }
   512  
   513  var _ error = HealthCheck_PayloadValidationError{}
   514  
   515  var _ interface {
   516  	Field() string
   517  	Reason() string
   518  	Key() bool
   519  	Cause() error
   520  	ErrorName() string
   521  } = HealthCheck_PayloadValidationError{}
   522  
   523  // Validate checks the field values on HealthCheck_HttpHealthCheck with the
   524  // rules defined in the proto definition for this message. If any rules are
   525  // violated, an error is returned.
   526  func (m *HealthCheck_HttpHealthCheck) Validate() error {
   527  	if m == nil {
   528  		return nil
   529  	}
   530  
   531  	if !_HealthCheck_HttpHealthCheck_Host_Pattern.MatchString(m.GetHost()) {
   532  		return HealthCheck_HttpHealthCheckValidationError{
   533  			field:  "Host",
   534  			reason: "value does not match regex pattern \"^[^\\x00\\n\\r]*$\"",
   535  		}
   536  	}
   537  
   538  	if utf8.RuneCountInString(m.GetPath()) < 1 {
   539  		return HealthCheck_HttpHealthCheckValidationError{
   540  			field:  "Path",
   541  			reason: "value length must be at least 1 runes",
   542  		}
   543  	}
   544  
   545  	if !_HealthCheck_HttpHealthCheck_Path_Pattern.MatchString(m.GetPath()) {
   546  		return HealthCheck_HttpHealthCheckValidationError{
   547  			field:  "Path",
   548  			reason: "value does not match regex pattern \"^[^\\x00\\n\\r]*$\"",
   549  		}
   550  	}
   551  
   552  	if v, ok := interface{}(m.GetSend()).(interface{ Validate() error }); ok {
   553  		if err := v.Validate(); err != nil {
   554  			return HealthCheck_HttpHealthCheckValidationError{
   555  				field:  "Send",
   556  				reason: "embedded message failed validation",
   557  				cause:  err,
   558  			}
   559  		}
   560  	}
   561  
   562  	if v, ok := interface{}(m.GetReceive()).(interface{ Validate() error }); ok {
   563  		if err := v.Validate(); err != nil {
   564  			return HealthCheck_HttpHealthCheckValidationError{
   565  				field:  "Receive",
   566  				reason: "embedded message failed validation",
   567  				cause:  err,
   568  			}
   569  		}
   570  	}
   571  
   572  	if len(m.GetRequestHeadersToAdd()) > 1000 {
   573  		return HealthCheck_HttpHealthCheckValidationError{
   574  			field:  "RequestHeadersToAdd",
   575  			reason: "value must contain no more than 1000 item(s)",
   576  		}
   577  	}
   578  
   579  	for idx, item := range m.GetRequestHeadersToAdd() {
   580  		_, _ = idx, item
   581  
   582  		if v, ok := interface{}(item).(interface{ Validate() error }); ok {
   583  			if err := v.Validate(); err != nil {
   584  				return HealthCheck_HttpHealthCheckValidationError{
   585  					field:  fmt.Sprintf("RequestHeadersToAdd[%v]", idx),
   586  					reason: "embedded message failed validation",
   587  					cause:  err,
   588  				}
   589  			}
   590  		}
   591  
   592  	}
   593  
   594  	for idx, item := range m.GetRequestHeadersToRemove() {
   595  		_, _ = idx, item
   596  
   597  		if !_HealthCheck_HttpHealthCheck_RequestHeadersToRemove_Pattern.MatchString(item) {
   598  			return HealthCheck_HttpHealthCheckValidationError{
   599  				field:  fmt.Sprintf("RequestHeadersToRemove[%v]", idx),
   600  				reason: "value does not match regex pattern \"^[^\\x00\\n\\r]*$\"",
   601  			}
   602  		}
   603  
   604  	}
   605  
   606  	for idx, item := range m.GetExpectedStatuses() {
   607  		_, _ = idx, item
   608  
   609  		if v, ok := interface{}(item).(interface{ Validate() error }); ok {
   610  			if err := v.Validate(); err != nil {
   611  				return HealthCheck_HttpHealthCheckValidationError{
   612  					field:  fmt.Sprintf("ExpectedStatuses[%v]", idx),
   613  					reason: "embedded message failed validation",
   614  					cause:  err,
   615  				}
   616  			}
   617  		}
   618  
   619  	}
   620  
   621  	if _, ok := v3.CodecClientType_name[int32(m.GetCodecClientType())]; !ok {
   622  		return HealthCheck_HttpHealthCheckValidationError{
   623  			field:  "CodecClientType",
   624  			reason: "value must be one of the defined enum values",
   625  		}
   626  	}
   627  
   628  	if v, ok := interface{}(m.GetServiceNameMatcher()).(interface{ Validate() error }); ok {
   629  		if err := v.Validate(); err != nil {
   630  			return HealthCheck_HttpHealthCheckValidationError{
   631  				field:  "ServiceNameMatcher",
   632  				reason: "embedded message failed validation",
   633  				cause:  err,
   634  			}
   635  		}
   636  	}
   637  
   638  	// no validation rules for HiddenEnvoyDeprecatedServiceName
   639  
   640  	// no validation rules for HiddenEnvoyDeprecatedUseHttp2
   641  
   642  	return nil
   643  }
   644  
   645  // HealthCheck_HttpHealthCheckValidationError is the validation error returned
   646  // by HealthCheck_HttpHealthCheck.Validate if the designated constraints
   647  // aren't met.
   648  type HealthCheck_HttpHealthCheckValidationError struct {
   649  	field  string
   650  	reason string
   651  	cause  error
   652  	key    bool
   653  }
   654  
   655  // Field function returns field value.
   656  func (e HealthCheck_HttpHealthCheckValidationError) Field() string { return e.field }
   657  
   658  // Reason function returns reason value.
   659  func (e HealthCheck_HttpHealthCheckValidationError) Reason() string { return e.reason }
   660  
   661  // Cause function returns cause value.
   662  func (e HealthCheck_HttpHealthCheckValidationError) Cause() error { return e.cause }
   663  
   664  // Key function returns key value.
   665  func (e HealthCheck_HttpHealthCheckValidationError) Key() bool { return e.key }
   666  
   667  // ErrorName returns error name.
   668  func (e HealthCheck_HttpHealthCheckValidationError) ErrorName() string {
   669  	return "HealthCheck_HttpHealthCheckValidationError"
   670  }
   671  
   672  // Error satisfies the builtin error interface
   673  func (e HealthCheck_HttpHealthCheckValidationError) Error() string {
   674  	cause := ""
   675  	if e.cause != nil {
   676  		cause = fmt.Sprintf(" | caused by: %v", e.cause)
   677  	}
   678  
   679  	key := ""
   680  	if e.key {
   681  		key = "key for "
   682  	}
   683  
   684  	return fmt.Sprintf(
   685  		"invalid %sHealthCheck_HttpHealthCheck.%s: %s%s",
   686  		key,
   687  		e.field,
   688  		e.reason,
   689  		cause)
   690  }
   691  
   692  var _ error = HealthCheck_HttpHealthCheckValidationError{}
   693  
   694  var _ interface {
   695  	Field() string
   696  	Reason() string
   697  	Key() bool
   698  	Cause() error
   699  	ErrorName() string
   700  } = HealthCheck_HttpHealthCheckValidationError{}
   701  
   702  var _HealthCheck_HttpHealthCheck_Host_Pattern = regexp.MustCompile("^[^\x00\n\r]*$")
   703  
   704  var _HealthCheck_HttpHealthCheck_Path_Pattern = regexp.MustCompile("^[^\x00\n\r]*$")
   705  
   706  var _HealthCheck_HttpHealthCheck_RequestHeadersToRemove_Pattern = regexp.MustCompile("^[^\x00\n\r]*$")
   707  
   708  // Validate checks the field values on HealthCheck_TcpHealthCheck with the
   709  // rules defined in the proto definition for this message. If any rules are
   710  // violated, an error is returned.
   711  func (m *HealthCheck_TcpHealthCheck) Validate() error {
   712  	if m == nil {
   713  		return nil
   714  	}
   715  
   716  	if v, ok := interface{}(m.GetSend()).(interface{ Validate() error }); ok {
   717  		if err := v.Validate(); err != nil {
   718  			return HealthCheck_TcpHealthCheckValidationError{
   719  				field:  "Send",
   720  				reason: "embedded message failed validation",
   721  				cause:  err,
   722  			}
   723  		}
   724  	}
   725  
   726  	for idx, item := range m.GetReceive() {
   727  		_, _ = idx, item
   728  
   729  		if v, ok := interface{}(item).(interface{ Validate() error }); ok {
   730  			if err := v.Validate(); err != nil {
   731  				return HealthCheck_TcpHealthCheckValidationError{
   732  					field:  fmt.Sprintf("Receive[%v]", idx),
   733  					reason: "embedded message failed validation",
   734  					cause:  err,
   735  				}
   736  			}
   737  		}
   738  
   739  	}
   740  
   741  	return nil
   742  }
   743  
   744  // HealthCheck_TcpHealthCheckValidationError is the validation error returned
   745  // by HealthCheck_TcpHealthCheck.Validate if the designated constraints aren't met.
   746  type HealthCheck_TcpHealthCheckValidationError struct {
   747  	field  string
   748  	reason string
   749  	cause  error
   750  	key    bool
   751  }
   752  
   753  // Field function returns field value.
   754  func (e HealthCheck_TcpHealthCheckValidationError) Field() string { return e.field }
   755  
   756  // Reason function returns reason value.
   757  func (e HealthCheck_TcpHealthCheckValidationError) Reason() string { return e.reason }
   758  
   759  // Cause function returns cause value.
   760  func (e HealthCheck_TcpHealthCheckValidationError) Cause() error { return e.cause }
   761  
   762  // Key function returns key value.
   763  func (e HealthCheck_TcpHealthCheckValidationError) Key() bool { return e.key }
   764  
   765  // ErrorName returns error name.
   766  func (e HealthCheck_TcpHealthCheckValidationError) ErrorName() string {
   767  	return "HealthCheck_TcpHealthCheckValidationError"
   768  }
   769  
   770  // Error satisfies the builtin error interface
   771  func (e HealthCheck_TcpHealthCheckValidationError) Error() string {
   772  	cause := ""
   773  	if e.cause != nil {
   774  		cause = fmt.Sprintf(" | caused by: %v", e.cause)
   775  	}
   776  
   777  	key := ""
   778  	if e.key {
   779  		key = "key for "
   780  	}
   781  
   782  	return fmt.Sprintf(
   783  		"invalid %sHealthCheck_TcpHealthCheck.%s: %s%s",
   784  		key,
   785  		e.field,
   786  		e.reason,
   787  		cause)
   788  }
   789  
   790  var _ error = HealthCheck_TcpHealthCheckValidationError{}
   791  
   792  var _ interface {
   793  	Field() string
   794  	Reason() string
   795  	Key() bool
   796  	Cause() error
   797  	ErrorName() string
   798  } = HealthCheck_TcpHealthCheckValidationError{}
   799  
   800  // Validate checks the field values on HealthCheck_RedisHealthCheck with the
   801  // rules defined in the proto definition for this message. If any rules are
   802  // violated, an error is returned.
   803  func (m *HealthCheck_RedisHealthCheck) Validate() error {
   804  	if m == nil {
   805  		return nil
   806  	}
   807  
   808  	// no validation rules for Key
   809  
   810  	return nil
   811  }
   812  
   813  // HealthCheck_RedisHealthCheckValidationError is the validation error returned
   814  // by HealthCheck_RedisHealthCheck.Validate if the designated constraints
   815  // aren't met.
   816  type HealthCheck_RedisHealthCheckValidationError struct {
   817  	field  string
   818  	reason string
   819  	cause  error
   820  	key    bool
   821  }
   822  
   823  // Field function returns field value.
   824  func (e HealthCheck_RedisHealthCheckValidationError) Field() string { return e.field }
   825  
   826  // Reason function returns reason value.
   827  func (e HealthCheck_RedisHealthCheckValidationError) Reason() string { return e.reason }
   828  
   829  // Cause function returns cause value.
   830  func (e HealthCheck_RedisHealthCheckValidationError) Cause() error { return e.cause }
   831  
   832  // Key function returns key value.
   833  func (e HealthCheck_RedisHealthCheckValidationError) Key() bool { return e.key }
   834  
   835  // ErrorName returns error name.
   836  func (e HealthCheck_RedisHealthCheckValidationError) ErrorName() string {
   837  	return "HealthCheck_RedisHealthCheckValidationError"
   838  }
   839  
   840  // Error satisfies the builtin error interface
   841  func (e HealthCheck_RedisHealthCheckValidationError) Error() string {
   842  	cause := ""
   843  	if e.cause != nil {
   844  		cause = fmt.Sprintf(" | caused by: %v", e.cause)
   845  	}
   846  
   847  	key := ""
   848  	if e.key {
   849  		key = "key for "
   850  	}
   851  
   852  	return fmt.Sprintf(
   853  		"invalid %sHealthCheck_RedisHealthCheck.%s: %s%s",
   854  		key,
   855  		e.field,
   856  		e.reason,
   857  		cause)
   858  }
   859  
   860  var _ error = HealthCheck_RedisHealthCheckValidationError{}
   861  
   862  var _ interface {
   863  	Field() string
   864  	Reason() string
   865  	Key() bool
   866  	Cause() error
   867  	ErrorName() string
   868  } = HealthCheck_RedisHealthCheckValidationError{}
   869  
   870  // Validate checks the field values on HealthCheck_GrpcHealthCheck with the
   871  // rules defined in the proto definition for this message. If any rules are
   872  // violated, an error is returned.
   873  func (m *HealthCheck_GrpcHealthCheck) Validate() error {
   874  	if m == nil {
   875  		return nil
   876  	}
   877  
   878  	// no validation rules for ServiceName
   879  
   880  	if !_HealthCheck_GrpcHealthCheck_Authority_Pattern.MatchString(m.GetAuthority()) {
   881  		return HealthCheck_GrpcHealthCheckValidationError{
   882  			field:  "Authority",
   883  			reason: "value does not match regex pattern \"^[^\\x00\\n\\r]*$\"",
   884  		}
   885  	}
   886  
   887  	return nil
   888  }
   889  
   890  // HealthCheck_GrpcHealthCheckValidationError is the validation error returned
   891  // by HealthCheck_GrpcHealthCheck.Validate if the designated constraints
   892  // aren't met.
   893  type HealthCheck_GrpcHealthCheckValidationError struct {
   894  	field  string
   895  	reason string
   896  	cause  error
   897  	key    bool
   898  }
   899  
   900  // Field function returns field value.
   901  func (e HealthCheck_GrpcHealthCheckValidationError) Field() string { return e.field }
   902  
   903  // Reason function returns reason value.
   904  func (e HealthCheck_GrpcHealthCheckValidationError) Reason() string { return e.reason }
   905  
   906  // Cause function returns cause value.
   907  func (e HealthCheck_GrpcHealthCheckValidationError) Cause() error { return e.cause }
   908  
   909  // Key function returns key value.
   910  func (e HealthCheck_GrpcHealthCheckValidationError) Key() bool { return e.key }
   911  
   912  // ErrorName returns error name.
   913  func (e HealthCheck_GrpcHealthCheckValidationError) ErrorName() string {
   914  	return "HealthCheck_GrpcHealthCheckValidationError"
   915  }
   916  
   917  // Error satisfies the builtin error interface
   918  func (e HealthCheck_GrpcHealthCheckValidationError) Error() string {
   919  	cause := ""
   920  	if e.cause != nil {
   921  		cause = fmt.Sprintf(" | caused by: %v", e.cause)
   922  	}
   923  
   924  	key := ""
   925  	if e.key {
   926  		key = "key for "
   927  	}
   928  
   929  	return fmt.Sprintf(
   930  		"invalid %sHealthCheck_GrpcHealthCheck.%s: %s%s",
   931  		key,
   932  		e.field,
   933  		e.reason,
   934  		cause)
   935  }
   936  
   937  var _ error = HealthCheck_GrpcHealthCheckValidationError{}
   938  
   939  var _ interface {
   940  	Field() string
   941  	Reason() string
   942  	Key() bool
   943  	Cause() error
   944  	ErrorName() string
   945  } = HealthCheck_GrpcHealthCheckValidationError{}
   946  
   947  var _HealthCheck_GrpcHealthCheck_Authority_Pattern = regexp.MustCompile("^[^\x00\n\r]*$")
   948  
   949  // Validate checks the field values on HealthCheck_CustomHealthCheck with the
   950  // rules defined in the proto definition for this message. If any rules are
   951  // violated, an error is returned.
   952  func (m *HealthCheck_CustomHealthCheck) Validate() error {
   953  	if m == nil {
   954  		return nil
   955  	}
   956  
   957  	if utf8.RuneCountInString(m.GetName()) < 1 {
   958  		return HealthCheck_CustomHealthCheckValidationError{
   959  			field:  "Name",
   960  			reason: "value length must be at least 1 runes",
   961  		}
   962  	}
   963  
   964  	switch m.ConfigType.(type) {
   965  
   966  	case *HealthCheck_CustomHealthCheck_TypedConfig:
   967  
   968  		if v, ok := interface{}(m.GetTypedConfig()).(interface{ Validate() error }); ok {
   969  			if err := v.Validate(); err != nil {
   970  				return HealthCheck_CustomHealthCheckValidationError{
   971  					field:  "TypedConfig",
   972  					reason: "embedded message failed validation",
   973  					cause:  err,
   974  				}
   975  			}
   976  		}
   977  
   978  	case *HealthCheck_CustomHealthCheck_HiddenEnvoyDeprecatedConfig:
   979  
   980  		if v, ok := interface{}(m.GetHiddenEnvoyDeprecatedConfig()).(interface{ Validate() error }); ok {
   981  			if err := v.Validate(); err != nil {
   982  				return HealthCheck_CustomHealthCheckValidationError{
   983  					field:  "HiddenEnvoyDeprecatedConfig",
   984  					reason: "embedded message failed validation",
   985  					cause:  err,
   986  				}
   987  			}
   988  		}
   989  
   990  	}
   991  
   992  	return nil
   993  }
   994  
   995  // HealthCheck_CustomHealthCheckValidationError is the validation error
   996  // returned by HealthCheck_CustomHealthCheck.Validate if the designated
   997  // constraints aren't met.
   998  type HealthCheck_CustomHealthCheckValidationError struct {
   999  	field  string
  1000  	reason string
  1001  	cause  error
  1002  	key    bool
  1003  }
  1004  
  1005  // Field function returns field value.
  1006  func (e HealthCheck_CustomHealthCheckValidationError) Field() string { return e.field }
  1007  
  1008  // Reason function returns reason value.
  1009  func (e HealthCheck_CustomHealthCheckValidationError) Reason() string { return e.reason }
  1010  
  1011  // Cause function returns cause value.
  1012  func (e HealthCheck_CustomHealthCheckValidationError) Cause() error { return e.cause }
  1013  
  1014  // Key function returns key value.
  1015  func (e HealthCheck_CustomHealthCheckValidationError) Key() bool { return e.key }
  1016  
  1017  // ErrorName returns error name.
  1018  func (e HealthCheck_CustomHealthCheckValidationError) ErrorName() string {
  1019  	return "HealthCheck_CustomHealthCheckValidationError"
  1020  }
  1021  
  1022  // Error satisfies the builtin error interface
  1023  func (e HealthCheck_CustomHealthCheckValidationError) Error() string {
  1024  	cause := ""
  1025  	if e.cause != nil {
  1026  		cause = fmt.Sprintf(" | caused by: %v", e.cause)
  1027  	}
  1028  
  1029  	key := ""
  1030  	if e.key {
  1031  		key = "key for "
  1032  	}
  1033  
  1034  	return fmt.Sprintf(
  1035  		"invalid %sHealthCheck_CustomHealthCheck.%s: %s%s",
  1036  		key,
  1037  		e.field,
  1038  		e.reason,
  1039  		cause)
  1040  }
  1041  
  1042  var _ error = HealthCheck_CustomHealthCheckValidationError{}
  1043  
  1044  var _ interface {
  1045  	Field() string
  1046  	Reason() string
  1047  	Key() bool
  1048  	Cause() error
  1049  	ErrorName() string
  1050  } = HealthCheck_CustomHealthCheckValidationError{}
  1051  
  1052  // Validate checks the field values on HealthCheck_TlsOptions with the rules
  1053  // defined in the proto definition for this message. If any rules are
  1054  // violated, an error is returned.
  1055  func (m *HealthCheck_TlsOptions) Validate() error {
  1056  	if m == nil {
  1057  		return nil
  1058  	}
  1059  
  1060  	return nil
  1061  }
  1062  
  1063  // HealthCheck_TlsOptionsValidationError is the validation error returned by
  1064  // HealthCheck_TlsOptions.Validate if the designated constraints aren't met.
  1065  type HealthCheck_TlsOptionsValidationError struct {
  1066  	field  string
  1067  	reason string
  1068  	cause  error
  1069  	key    bool
  1070  }
  1071  
  1072  // Field function returns field value.
  1073  func (e HealthCheck_TlsOptionsValidationError) Field() string { return e.field }
  1074  
  1075  // Reason function returns reason value.
  1076  func (e HealthCheck_TlsOptionsValidationError) Reason() string { return e.reason }
  1077  
  1078  // Cause function returns cause value.
  1079  func (e HealthCheck_TlsOptionsValidationError) Cause() error { return e.cause }
  1080  
  1081  // Key function returns key value.
  1082  func (e HealthCheck_TlsOptionsValidationError) Key() bool { return e.key }
  1083  
  1084  // ErrorName returns error name.
  1085  func (e HealthCheck_TlsOptionsValidationError) ErrorName() string {
  1086  	return "HealthCheck_TlsOptionsValidationError"
  1087  }
  1088  
  1089  // Error satisfies the builtin error interface
  1090  func (e HealthCheck_TlsOptionsValidationError) Error() string {
  1091  	cause := ""
  1092  	if e.cause != nil {
  1093  		cause = fmt.Sprintf(" | caused by: %v", e.cause)
  1094  	}
  1095  
  1096  	key := ""
  1097  	if e.key {
  1098  		key = "key for "
  1099  	}
  1100  
  1101  	return fmt.Sprintf(
  1102  		"invalid %sHealthCheck_TlsOptions.%s: %s%s",
  1103  		key,
  1104  		e.field,
  1105  		e.reason,
  1106  		cause)
  1107  }
  1108  
  1109  var _ error = HealthCheck_TlsOptionsValidationError{}
  1110  
  1111  var _ interface {
  1112  	Field() string
  1113  	Reason() string
  1114  	Key() bool
  1115  	Cause() error
  1116  	ErrorName() string
  1117  } = HealthCheck_TlsOptionsValidationError{}