github.com/hxx258456/ccgo@v0.0.5-0.20230213014102-48b35f46f66f/go-control-plane/envoy/service/discovery/v2/hds.pb.validate.go (about)

     1  // Code generated by protoc-gen-validate. DO NOT EDIT.
     2  // source: envoy/service/discovery/v2/hds.proto
     3  
     4  package envoy_service_discovery_v2
     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  	core "github.com/hxx258456/ccgo/go-control-plane/envoy/api/v2/core"
    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  	_ = core.HealthStatus(0)
    38  )
    39  
    40  // Validate checks the field values on Capability with the rules defined in the
    41  // proto definition for this message. If any rules are violated, an error is returned.
    42  func (m *Capability) Validate() error {
    43  	if m == nil {
    44  		return nil
    45  	}
    46  
    47  	return nil
    48  }
    49  
    50  // CapabilityValidationError is the validation error returned by
    51  // Capability.Validate if the designated constraints aren't met.
    52  type CapabilityValidationError struct {
    53  	field  string
    54  	reason string
    55  	cause  error
    56  	key    bool
    57  }
    58  
    59  // Field function returns field value.
    60  func (e CapabilityValidationError) Field() string { return e.field }
    61  
    62  // Reason function returns reason value.
    63  func (e CapabilityValidationError) Reason() string { return e.reason }
    64  
    65  // Cause function returns cause value.
    66  func (e CapabilityValidationError) Cause() error { return e.cause }
    67  
    68  // Key function returns key value.
    69  func (e CapabilityValidationError) Key() bool { return e.key }
    70  
    71  // ErrorName returns error name.
    72  func (e CapabilityValidationError) ErrorName() string { return "CapabilityValidationError" }
    73  
    74  // Error satisfies the builtin error interface
    75  func (e CapabilityValidationError) Error() string {
    76  	cause := ""
    77  	if e.cause != nil {
    78  		cause = fmt.Sprintf(" | caused by: %v", e.cause)
    79  	}
    80  
    81  	key := ""
    82  	if e.key {
    83  		key = "key for "
    84  	}
    85  
    86  	return fmt.Sprintf(
    87  		"invalid %sCapability.%s: %s%s",
    88  		key,
    89  		e.field,
    90  		e.reason,
    91  		cause)
    92  }
    93  
    94  var _ error = CapabilityValidationError{}
    95  
    96  var _ interface {
    97  	Field() string
    98  	Reason() string
    99  	Key() bool
   100  	Cause() error
   101  	ErrorName() string
   102  } = CapabilityValidationError{}
   103  
   104  // Validate checks the field values on HealthCheckRequest with the rules
   105  // defined in the proto definition for this message. If any rules are
   106  // violated, an error is returned.
   107  func (m *HealthCheckRequest) Validate() error {
   108  	if m == nil {
   109  		return nil
   110  	}
   111  
   112  	if v, ok := interface{}(m.GetNode()).(interface{ Validate() error }); ok {
   113  		if err := v.Validate(); err != nil {
   114  			return HealthCheckRequestValidationError{
   115  				field:  "Node",
   116  				reason: "embedded message failed validation",
   117  				cause:  err,
   118  			}
   119  		}
   120  	}
   121  
   122  	if v, ok := interface{}(m.GetCapability()).(interface{ Validate() error }); ok {
   123  		if err := v.Validate(); err != nil {
   124  			return HealthCheckRequestValidationError{
   125  				field:  "Capability",
   126  				reason: "embedded message failed validation",
   127  				cause:  err,
   128  			}
   129  		}
   130  	}
   131  
   132  	return nil
   133  }
   134  
   135  // HealthCheckRequestValidationError is the validation error returned by
   136  // HealthCheckRequest.Validate if the designated constraints aren't met.
   137  type HealthCheckRequestValidationError struct {
   138  	field  string
   139  	reason string
   140  	cause  error
   141  	key    bool
   142  }
   143  
   144  // Field function returns field value.
   145  func (e HealthCheckRequestValidationError) Field() string { return e.field }
   146  
   147  // Reason function returns reason value.
   148  func (e HealthCheckRequestValidationError) Reason() string { return e.reason }
   149  
   150  // Cause function returns cause value.
   151  func (e HealthCheckRequestValidationError) Cause() error { return e.cause }
   152  
   153  // Key function returns key value.
   154  func (e HealthCheckRequestValidationError) Key() bool { return e.key }
   155  
   156  // ErrorName returns error name.
   157  func (e HealthCheckRequestValidationError) ErrorName() string {
   158  	return "HealthCheckRequestValidationError"
   159  }
   160  
   161  // Error satisfies the builtin error interface
   162  func (e HealthCheckRequestValidationError) Error() string {
   163  	cause := ""
   164  	if e.cause != nil {
   165  		cause = fmt.Sprintf(" | caused by: %v", e.cause)
   166  	}
   167  
   168  	key := ""
   169  	if e.key {
   170  		key = "key for "
   171  	}
   172  
   173  	return fmt.Sprintf(
   174  		"invalid %sHealthCheckRequest.%s: %s%s",
   175  		key,
   176  		e.field,
   177  		e.reason,
   178  		cause)
   179  }
   180  
   181  var _ error = HealthCheckRequestValidationError{}
   182  
   183  var _ interface {
   184  	Field() string
   185  	Reason() string
   186  	Key() bool
   187  	Cause() error
   188  	ErrorName() string
   189  } = HealthCheckRequestValidationError{}
   190  
   191  // Validate checks the field values on EndpointHealth with the rules defined in
   192  // the proto definition for this message. If any rules are violated, an error
   193  // is returned.
   194  func (m *EndpointHealth) Validate() error {
   195  	if m == nil {
   196  		return nil
   197  	}
   198  
   199  	if v, ok := interface{}(m.GetEndpoint()).(interface{ Validate() error }); ok {
   200  		if err := v.Validate(); err != nil {
   201  			return EndpointHealthValidationError{
   202  				field:  "Endpoint",
   203  				reason: "embedded message failed validation",
   204  				cause:  err,
   205  			}
   206  		}
   207  	}
   208  
   209  	// no validation rules for HealthStatus
   210  
   211  	return nil
   212  }
   213  
   214  // EndpointHealthValidationError is the validation error returned by
   215  // EndpointHealth.Validate if the designated constraints aren't met.
   216  type EndpointHealthValidationError struct {
   217  	field  string
   218  	reason string
   219  	cause  error
   220  	key    bool
   221  }
   222  
   223  // Field function returns field value.
   224  func (e EndpointHealthValidationError) Field() string { return e.field }
   225  
   226  // Reason function returns reason value.
   227  func (e EndpointHealthValidationError) Reason() string { return e.reason }
   228  
   229  // Cause function returns cause value.
   230  func (e EndpointHealthValidationError) Cause() error { return e.cause }
   231  
   232  // Key function returns key value.
   233  func (e EndpointHealthValidationError) Key() bool { return e.key }
   234  
   235  // ErrorName returns error name.
   236  func (e EndpointHealthValidationError) ErrorName() string { return "EndpointHealthValidationError" }
   237  
   238  // Error satisfies the builtin error interface
   239  func (e EndpointHealthValidationError) Error() string {
   240  	cause := ""
   241  	if e.cause != nil {
   242  		cause = fmt.Sprintf(" | caused by: %v", e.cause)
   243  	}
   244  
   245  	key := ""
   246  	if e.key {
   247  		key = "key for "
   248  	}
   249  
   250  	return fmt.Sprintf(
   251  		"invalid %sEndpointHealth.%s: %s%s",
   252  		key,
   253  		e.field,
   254  		e.reason,
   255  		cause)
   256  }
   257  
   258  var _ error = EndpointHealthValidationError{}
   259  
   260  var _ interface {
   261  	Field() string
   262  	Reason() string
   263  	Key() bool
   264  	Cause() error
   265  	ErrorName() string
   266  } = EndpointHealthValidationError{}
   267  
   268  // Validate checks the field values on EndpointHealthResponse with the rules
   269  // defined in the proto definition for this message. If any rules are
   270  // violated, an error is returned.
   271  func (m *EndpointHealthResponse) Validate() error {
   272  	if m == nil {
   273  		return nil
   274  	}
   275  
   276  	for idx, item := range m.GetEndpointsHealth() {
   277  		_, _ = idx, item
   278  
   279  		if v, ok := interface{}(item).(interface{ Validate() error }); ok {
   280  			if err := v.Validate(); err != nil {
   281  				return EndpointHealthResponseValidationError{
   282  					field:  fmt.Sprintf("EndpointsHealth[%v]", idx),
   283  					reason: "embedded message failed validation",
   284  					cause:  err,
   285  				}
   286  			}
   287  		}
   288  
   289  	}
   290  
   291  	return nil
   292  }
   293  
   294  // EndpointHealthResponseValidationError is the validation error returned by
   295  // EndpointHealthResponse.Validate if the designated constraints aren't met.
   296  type EndpointHealthResponseValidationError struct {
   297  	field  string
   298  	reason string
   299  	cause  error
   300  	key    bool
   301  }
   302  
   303  // Field function returns field value.
   304  func (e EndpointHealthResponseValidationError) Field() string { return e.field }
   305  
   306  // Reason function returns reason value.
   307  func (e EndpointHealthResponseValidationError) Reason() string { return e.reason }
   308  
   309  // Cause function returns cause value.
   310  func (e EndpointHealthResponseValidationError) Cause() error { return e.cause }
   311  
   312  // Key function returns key value.
   313  func (e EndpointHealthResponseValidationError) Key() bool { return e.key }
   314  
   315  // ErrorName returns error name.
   316  func (e EndpointHealthResponseValidationError) ErrorName() string {
   317  	return "EndpointHealthResponseValidationError"
   318  }
   319  
   320  // Error satisfies the builtin error interface
   321  func (e EndpointHealthResponseValidationError) Error() string {
   322  	cause := ""
   323  	if e.cause != nil {
   324  		cause = fmt.Sprintf(" | caused by: %v", e.cause)
   325  	}
   326  
   327  	key := ""
   328  	if e.key {
   329  		key = "key for "
   330  	}
   331  
   332  	return fmt.Sprintf(
   333  		"invalid %sEndpointHealthResponse.%s: %s%s",
   334  		key,
   335  		e.field,
   336  		e.reason,
   337  		cause)
   338  }
   339  
   340  var _ error = EndpointHealthResponseValidationError{}
   341  
   342  var _ interface {
   343  	Field() string
   344  	Reason() string
   345  	Key() bool
   346  	Cause() error
   347  	ErrorName() string
   348  } = EndpointHealthResponseValidationError{}
   349  
   350  // Validate checks the field values on
   351  // HealthCheckRequestOrEndpointHealthResponse with the rules defined in the
   352  // proto definition for this message. If any rules are violated, an error is returned.
   353  func (m *HealthCheckRequestOrEndpointHealthResponse) Validate() error {
   354  	if m == nil {
   355  		return nil
   356  	}
   357  
   358  	switch m.RequestType.(type) {
   359  
   360  	case *HealthCheckRequestOrEndpointHealthResponse_HealthCheckRequest:
   361  
   362  		if v, ok := interface{}(m.GetHealthCheckRequest()).(interface{ Validate() error }); ok {
   363  			if err := v.Validate(); err != nil {
   364  				return HealthCheckRequestOrEndpointHealthResponseValidationError{
   365  					field:  "HealthCheckRequest",
   366  					reason: "embedded message failed validation",
   367  					cause:  err,
   368  				}
   369  			}
   370  		}
   371  
   372  	case *HealthCheckRequestOrEndpointHealthResponse_EndpointHealthResponse:
   373  
   374  		if v, ok := interface{}(m.GetEndpointHealthResponse()).(interface{ Validate() error }); ok {
   375  			if err := v.Validate(); err != nil {
   376  				return HealthCheckRequestOrEndpointHealthResponseValidationError{
   377  					field:  "EndpointHealthResponse",
   378  					reason: "embedded message failed validation",
   379  					cause:  err,
   380  				}
   381  			}
   382  		}
   383  
   384  	}
   385  
   386  	return nil
   387  }
   388  
   389  // HealthCheckRequestOrEndpointHealthResponseValidationError is the validation
   390  // error returned by HealthCheckRequestOrEndpointHealthResponse.Validate if
   391  // the designated constraints aren't met.
   392  type HealthCheckRequestOrEndpointHealthResponseValidationError struct {
   393  	field  string
   394  	reason string
   395  	cause  error
   396  	key    bool
   397  }
   398  
   399  // Field function returns field value.
   400  func (e HealthCheckRequestOrEndpointHealthResponseValidationError) Field() string { return e.field }
   401  
   402  // Reason function returns reason value.
   403  func (e HealthCheckRequestOrEndpointHealthResponseValidationError) Reason() string { return e.reason }
   404  
   405  // Cause function returns cause value.
   406  func (e HealthCheckRequestOrEndpointHealthResponseValidationError) Cause() error { return e.cause }
   407  
   408  // Key function returns key value.
   409  func (e HealthCheckRequestOrEndpointHealthResponseValidationError) Key() bool { return e.key }
   410  
   411  // ErrorName returns error name.
   412  func (e HealthCheckRequestOrEndpointHealthResponseValidationError) ErrorName() string {
   413  	return "HealthCheckRequestOrEndpointHealthResponseValidationError"
   414  }
   415  
   416  // Error satisfies the builtin error interface
   417  func (e HealthCheckRequestOrEndpointHealthResponseValidationError) Error() string {
   418  	cause := ""
   419  	if e.cause != nil {
   420  		cause = fmt.Sprintf(" | caused by: %v", e.cause)
   421  	}
   422  
   423  	key := ""
   424  	if e.key {
   425  		key = "key for "
   426  	}
   427  
   428  	return fmt.Sprintf(
   429  		"invalid %sHealthCheckRequestOrEndpointHealthResponse.%s: %s%s",
   430  		key,
   431  		e.field,
   432  		e.reason,
   433  		cause)
   434  }
   435  
   436  var _ error = HealthCheckRequestOrEndpointHealthResponseValidationError{}
   437  
   438  var _ interface {
   439  	Field() string
   440  	Reason() string
   441  	Key() bool
   442  	Cause() error
   443  	ErrorName() string
   444  } = HealthCheckRequestOrEndpointHealthResponseValidationError{}
   445  
   446  // Validate checks the field values on LocalityEndpoints with the rules defined
   447  // in the proto definition for this message. If any rules are violated, an
   448  // error is returned.
   449  func (m *LocalityEndpoints) Validate() error {
   450  	if m == nil {
   451  		return nil
   452  	}
   453  
   454  	if v, ok := interface{}(m.GetLocality()).(interface{ Validate() error }); ok {
   455  		if err := v.Validate(); err != nil {
   456  			return LocalityEndpointsValidationError{
   457  				field:  "Locality",
   458  				reason: "embedded message failed validation",
   459  				cause:  err,
   460  			}
   461  		}
   462  	}
   463  
   464  	for idx, item := range m.GetEndpoints() {
   465  		_, _ = idx, item
   466  
   467  		if v, ok := interface{}(item).(interface{ Validate() error }); ok {
   468  			if err := v.Validate(); err != nil {
   469  				return LocalityEndpointsValidationError{
   470  					field:  fmt.Sprintf("Endpoints[%v]", idx),
   471  					reason: "embedded message failed validation",
   472  					cause:  err,
   473  				}
   474  			}
   475  		}
   476  
   477  	}
   478  
   479  	return nil
   480  }
   481  
   482  // LocalityEndpointsValidationError is the validation error returned by
   483  // LocalityEndpoints.Validate if the designated constraints aren't met.
   484  type LocalityEndpointsValidationError struct {
   485  	field  string
   486  	reason string
   487  	cause  error
   488  	key    bool
   489  }
   490  
   491  // Field function returns field value.
   492  func (e LocalityEndpointsValidationError) Field() string { return e.field }
   493  
   494  // Reason function returns reason value.
   495  func (e LocalityEndpointsValidationError) Reason() string { return e.reason }
   496  
   497  // Cause function returns cause value.
   498  func (e LocalityEndpointsValidationError) Cause() error { return e.cause }
   499  
   500  // Key function returns key value.
   501  func (e LocalityEndpointsValidationError) Key() bool { return e.key }
   502  
   503  // ErrorName returns error name.
   504  func (e LocalityEndpointsValidationError) ErrorName() string {
   505  	return "LocalityEndpointsValidationError"
   506  }
   507  
   508  // Error satisfies the builtin error interface
   509  func (e LocalityEndpointsValidationError) Error() string {
   510  	cause := ""
   511  	if e.cause != nil {
   512  		cause = fmt.Sprintf(" | caused by: %v", e.cause)
   513  	}
   514  
   515  	key := ""
   516  	if e.key {
   517  		key = "key for "
   518  	}
   519  
   520  	return fmt.Sprintf(
   521  		"invalid %sLocalityEndpoints.%s: %s%s",
   522  		key,
   523  		e.field,
   524  		e.reason,
   525  		cause)
   526  }
   527  
   528  var _ error = LocalityEndpointsValidationError{}
   529  
   530  var _ interface {
   531  	Field() string
   532  	Reason() string
   533  	Key() bool
   534  	Cause() error
   535  	ErrorName() string
   536  } = LocalityEndpointsValidationError{}
   537  
   538  // Validate checks the field values on ClusterHealthCheck with the rules
   539  // defined in the proto definition for this message. If any rules are
   540  // violated, an error is returned.
   541  func (m *ClusterHealthCheck) Validate() error {
   542  	if m == nil {
   543  		return nil
   544  	}
   545  
   546  	// no validation rules for ClusterName
   547  
   548  	for idx, item := range m.GetHealthChecks() {
   549  		_, _ = idx, item
   550  
   551  		if v, ok := interface{}(item).(interface{ Validate() error }); ok {
   552  			if err := v.Validate(); err != nil {
   553  				return ClusterHealthCheckValidationError{
   554  					field:  fmt.Sprintf("HealthChecks[%v]", idx),
   555  					reason: "embedded message failed validation",
   556  					cause:  err,
   557  				}
   558  			}
   559  		}
   560  
   561  	}
   562  
   563  	for idx, item := range m.GetLocalityEndpoints() {
   564  		_, _ = idx, item
   565  
   566  		if v, ok := interface{}(item).(interface{ Validate() error }); ok {
   567  			if err := v.Validate(); err != nil {
   568  				return ClusterHealthCheckValidationError{
   569  					field:  fmt.Sprintf("LocalityEndpoints[%v]", idx),
   570  					reason: "embedded message failed validation",
   571  					cause:  err,
   572  				}
   573  			}
   574  		}
   575  
   576  	}
   577  
   578  	return nil
   579  }
   580  
   581  // ClusterHealthCheckValidationError is the validation error returned by
   582  // ClusterHealthCheck.Validate if the designated constraints aren't met.
   583  type ClusterHealthCheckValidationError struct {
   584  	field  string
   585  	reason string
   586  	cause  error
   587  	key    bool
   588  }
   589  
   590  // Field function returns field value.
   591  func (e ClusterHealthCheckValidationError) Field() string { return e.field }
   592  
   593  // Reason function returns reason value.
   594  func (e ClusterHealthCheckValidationError) Reason() string { return e.reason }
   595  
   596  // Cause function returns cause value.
   597  func (e ClusterHealthCheckValidationError) Cause() error { return e.cause }
   598  
   599  // Key function returns key value.
   600  func (e ClusterHealthCheckValidationError) Key() bool { return e.key }
   601  
   602  // ErrorName returns error name.
   603  func (e ClusterHealthCheckValidationError) ErrorName() string {
   604  	return "ClusterHealthCheckValidationError"
   605  }
   606  
   607  // Error satisfies the builtin error interface
   608  func (e ClusterHealthCheckValidationError) Error() string {
   609  	cause := ""
   610  	if e.cause != nil {
   611  		cause = fmt.Sprintf(" | caused by: %v", e.cause)
   612  	}
   613  
   614  	key := ""
   615  	if e.key {
   616  		key = "key for "
   617  	}
   618  
   619  	return fmt.Sprintf(
   620  		"invalid %sClusterHealthCheck.%s: %s%s",
   621  		key,
   622  		e.field,
   623  		e.reason,
   624  		cause)
   625  }
   626  
   627  var _ error = ClusterHealthCheckValidationError{}
   628  
   629  var _ interface {
   630  	Field() string
   631  	Reason() string
   632  	Key() bool
   633  	Cause() error
   634  	ErrorName() string
   635  } = ClusterHealthCheckValidationError{}
   636  
   637  // Validate checks the field values on HealthCheckSpecifier with the rules
   638  // defined in the proto definition for this message. If any rules are
   639  // violated, an error is returned.
   640  func (m *HealthCheckSpecifier) Validate() error {
   641  	if m == nil {
   642  		return nil
   643  	}
   644  
   645  	for idx, item := range m.GetClusterHealthChecks() {
   646  		_, _ = idx, item
   647  
   648  		if v, ok := interface{}(item).(interface{ Validate() error }); ok {
   649  			if err := v.Validate(); err != nil {
   650  				return HealthCheckSpecifierValidationError{
   651  					field:  fmt.Sprintf("ClusterHealthChecks[%v]", idx),
   652  					reason: "embedded message failed validation",
   653  					cause:  err,
   654  				}
   655  			}
   656  		}
   657  
   658  	}
   659  
   660  	if v, ok := interface{}(m.GetInterval()).(interface{ Validate() error }); ok {
   661  		if err := v.Validate(); err != nil {
   662  			return HealthCheckSpecifierValidationError{
   663  				field:  "Interval",
   664  				reason: "embedded message failed validation",
   665  				cause:  err,
   666  			}
   667  		}
   668  	}
   669  
   670  	return nil
   671  }
   672  
   673  // HealthCheckSpecifierValidationError is the validation error returned by
   674  // HealthCheckSpecifier.Validate if the designated constraints aren't met.
   675  type HealthCheckSpecifierValidationError struct {
   676  	field  string
   677  	reason string
   678  	cause  error
   679  	key    bool
   680  }
   681  
   682  // Field function returns field value.
   683  func (e HealthCheckSpecifierValidationError) Field() string { return e.field }
   684  
   685  // Reason function returns reason value.
   686  func (e HealthCheckSpecifierValidationError) Reason() string { return e.reason }
   687  
   688  // Cause function returns cause value.
   689  func (e HealthCheckSpecifierValidationError) Cause() error { return e.cause }
   690  
   691  // Key function returns key value.
   692  func (e HealthCheckSpecifierValidationError) Key() bool { return e.key }
   693  
   694  // ErrorName returns error name.
   695  func (e HealthCheckSpecifierValidationError) ErrorName() string {
   696  	return "HealthCheckSpecifierValidationError"
   697  }
   698  
   699  // Error satisfies the builtin error interface
   700  func (e HealthCheckSpecifierValidationError) Error() string {
   701  	cause := ""
   702  	if e.cause != nil {
   703  		cause = fmt.Sprintf(" | caused by: %v", e.cause)
   704  	}
   705  
   706  	key := ""
   707  	if e.key {
   708  		key = "key for "
   709  	}
   710  
   711  	return fmt.Sprintf(
   712  		"invalid %sHealthCheckSpecifier.%s: %s%s",
   713  		key,
   714  		e.field,
   715  		e.reason,
   716  		cause)
   717  }
   718  
   719  var _ error = HealthCheckSpecifierValidationError{}
   720  
   721  var _ interface {
   722  	Field() string
   723  	Reason() string
   724  	Key() bool
   725  	Cause() error
   726  	ErrorName() string
   727  } = HealthCheckSpecifierValidationError{}