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

     1  // Code generated by protoc-gen-validate. DO NOT EDIT.
     2  // source: envoy/config/endpoint/v3/load_report.proto
     3  
     4  package envoy_config_endpoint_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  
    21  // ensure the imports are used
    22  var (
    23  	_ = bytes.MinRead
    24  	_ = errors.New("")
    25  	_ = fmt.Print
    26  	_ = utf8.UTFMax
    27  	_ = (*regexp.Regexp)(nil)
    28  	_ = (*strings.Reader)(nil)
    29  	_ = net.IPv4len
    30  	_ = time.Duration(0)
    31  	_ = (*url.URL)(nil)
    32  	_ = (*mail.Address)(nil)
    33  	_ = anypb.Any{}
    34  )
    35  
    36  // Validate checks the field values on UpstreamLocalityStats with the rules
    37  // defined in the proto definition for this message. If any rules are
    38  // violated, an error is returned.
    39  func (m *UpstreamLocalityStats) Validate() error {
    40  	if m == nil {
    41  		return nil
    42  	}
    43  
    44  	if v, ok := interface{}(m.GetLocality()).(interface{ Validate() error }); ok {
    45  		if err := v.Validate(); err != nil {
    46  			return UpstreamLocalityStatsValidationError{
    47  				field:  "Locality",
    48  				reason: "embedded message failed validation",
    49  				cause:  err,
    50  			}
    51  		}
    52  	}
    53  
    54  	// no validation rules for TotalSuccessfulRequests
    55  
    56  	// no validation rules for TotalRequestsInProgress
    57  
    58  	// no validation rules for TotalErrorRequests
    59  
    60  	// no validation rules for TotalIssuedRequests
    61  
    62  	for idx, item := range m.GetLoadMetricStats() {
    63  		_, _ = idx, item
    64  
    65  		if v, ok := interface{}(item).(interface{ Validate() error }); ok {
    66  			if err := v.Validate(); err != nil {
    67  				return UpstreamLocalityStatsValidationError{
    68  					field:  fmt.Sprintf("LoadMetricStats[%v]", idx),
    69  					reason: "embedded message failed validation",
    70  					cause:  err,
    71  				}
    72  			}
    73  		}
    74  
    75  	}
    76  
    77  	for idx, item := range m.GetUpstreamEndpointStats() {
    78  		_, _ = idx, item
    79  
    80  		if v, ok := interface{}(item).(interface{ Validate() error }); ok {
    81  			if err := v.Validate(); err != nil {
    82  				return UpstreamLocalityStatsValidationError{
    83  					field:  fmt.Sprintf("UpstreamEndpointStats[%v]", idx),
    84  					reason: "embedded message failed validation",
    85  					cause:  err,
    86  				}
    87  			}
    88  		}
    89  
    90  	}
    91  
    92  	// no validation rules for Priority
    93  
    94  	return nil
    95  }
    96  
    97  // UpstreamLocalityStatsValidationError is the validation error returned by
    98  // UpstreamLocalityStats.Validate if the designated constraints aren't met.
    99  type UpstreamLocalityStatsValidationError struct {
   100  	field  string
   101  	reason string
   102  	cause  error
   103  	key    bool
   104  }
   105  
   106  // Field function returns field value.
   107  func (e UpstreamLocalityStatsValidationError) Field() string { return e.field }
   108  
   109  // Reason function returns reason value.
   110  func (e UpstreamLocalityStatsValidationError) Reason() string { return e.reason }
   111  
   112  // Cause function returns cause value.
   113  func (e UpstreamLocalityStatsValidationError) Cause() error { return e.cause }
   114  
   115  // Key function returns key value.
   116  func (e UpstreamLocalityStatsValidationError) Key() bool { return e.key }
   117  
   118  // ErrorName returns error name.
   119  func (e UpstreamLocalityStatsValidationError) ErrorName() string {
   120  	return "UpstreamLocalityStatsValidationError"
   121  }
   122  
   123  // Error satisfies the builtin error interface
   124  func (e UpstreamLocalityStatsValidationError) Error() string {
   125  	cause := ""
   126  	if e.cause != nil {
   127  		cause = fmt.Sprintf(" | caused by: %v", e.cause)
   128  	}
   129  
   130  	key := ""
   131  	if e.key {
   132  		key = "key for "
   133  	}
   134  
   135  	return fmt.Sprintf(
   136  		"invalid %sUpstreamLocalityStats.%s: %s%s",
   137  		key,
   138  		e.field,
   139  		e.reason,
   140  		cause)
   141  }
   142  
   143  var _ error = UpstreamLocalityStatsValidationError{}
   144  
   145  var _ interface {
   146  	Field() string
   147  	Reason() string
   148  	Key() bool
   149  	Cause() error
   150  	ErrorName() string
   151  } = UpstreamLocalityStatsValidationError{}
   152  
   153  // Validate checks the field values on UpstreamEndpointStats with the rules
   154  // defined in the proto definition for this message. If any rules are
   155  // violated, an error is returned.
   156  func (m *UpstreamEndpointStats) Validate() error {
   157  	if m == nil {
   158  		return nil
   159  	}
   160  
   161  	if v, ok := interface{}(m.GetAddress()).(interface{ Validate() error }); ok {
   162  		if err := v.Validate(); err != nil {
   163  			return UpstreamEndpointStatsValidationError{
   164  				field:  "Address",
   165  				reason: "embedded message failed validation",
   166  				cause:  err,
   167  			}
   168  		}
   169  	}
   170  
   171  	if v, ok := interface{}(m.GetMetadata()).(interface{ Validate() error }); ok {
   172  		if err := v.Validate(); err != nil {
   173  			return UpstreamEndpointStatsValidationError{
   174  				field:  "Metadata",
   175  				reason: "embedded message failed validation",
   176  				cause:  err,
   177  			}
   178  		}
   179  	}
   180  
   181  	// no validation rules for TotalSuccessfulRequests
   182  
   183  	// no validation rules for TotalRequestsInProgress
   184  
   185  	// no validation rules for TotalErrorRequests
   186  
   187  	// no validation rules for TotalIssuedRequests
   188  
   189  	for idx, item := range m.GetLoadMetricStats() {
   190  		_, _ = idx, item
   191  
   192  		if v, ok := interface{}(item).(interface{ Validate() error }); ok {
   193  			if err := v.Validate(); err != nil {
   194  				return UpstreamEndpointStatsValidationError{
   195  					field:  fmt.Sprintf("LoadMetricStats[%v]", idx),
   196  					reason: "embedded message failed validation",
   197  					cause:  err,
   198  				}
   199  			}
   200  		}
   201  
   202  	}
   203  
   204  	return nil
   205  }
   206  
   207  // UpstreamEndpointStatsValidationError is the validation error returned by
   208  // UpstreamEndpointStats.Validate if the designated constraints aren't met.
   209  type UpstreamEndpointStatsValidationError struct {
   210  	field  string
   211  	reason string
   212  	cause  error
   213  	key    bool
   214  }
   215  
   216  // Field function returns field value.
   217  func (e UpstreamEndpointStatsValidationError) Field() string { return e.field }
   218  
   219  // Reason function returns reason value.
   220  func (e UpstreamEndpointStatsValidationError) Reason() string { return e.reason }
   221  
   222  // Cause function returns cause value.
   223  func (e UpstreamEndpointStatsValidationError) Cause() error { return e.cause }
   224  
   225  // Key function returns key value.
   226  func (e UpstreamEndpointStatsValidationError) Key() bool { return e.key }
   227  
   228  // ErrorName returns error name.
   229  func (e UpstreamEndpointStatsValidationError) ErrorName() string {
   230  	return "UpstreamEndpointStatsValidationError"
   231  }
   232  
   233  // Error satisfies the builtin error interface
   234  func (e UpstreamEndpointStatsValidationError) Error() string {
   235  	cause := ""
   236  	if e.cause != nil {
   237  		cause = fmt.Sprintf(" | caused by: %v", e.cause)
   238  	}
   239  
   240  	key := ""
   241  	if e.key {
   242  		key = "key for "
   243  	}
   244  
   245  	return fmt.Sprintf(
   246  		"invalid %sUpstreamEndpointStats.%s: %s%s",
   247  		key,
   248  		e.field,
   249  		e.reason,
   250  		cause)
   251  }
   252  
   253  var _ error = UpstreamEndpointStatsValidationError{}
   254  
   255  var _ interface {
   256  	Field() string
   257  	Reason() string
   258  	Key() bool
   259  	Cause() error
   260  	ErrorName() string
   261  } = UpstreamEndpointStatsValidationError{}
   262  
   263  // Validate checks the field values on EndpointLoadMetricStats with the rules
   264  // defined in the proto definition for this message. If any rules are
   265  // violated, an error is returned.
   266  func (m *EndpointLoadMetricStats) Validate() error {
   267  	if m == nil {
   268  		return nil
   269  	}
   270  
   271  	// no validation rules for MetricName
   272  
   273  	// no validation rules for NumRequestsFinishedWithMetric
   274  
   275  	// no validation rules for TotalMetricValue
   276  
   277  	return nil
   278  }
   279  
   280  // EndpointLoadMetricStatsValidationError is the validation error returned by
   281  // EndpointLoadMetricStats.Validate if the designated constraints aren't met.
   282  type EndpointLoadMetricStatsValidationError struct {
   283  	field  string
   284  	reason string
   285  	cause  error
   286  	key    bool
   287  }
   288  
   289  // Field function returns field value.
   290  func (e EndpointLoadMetricStatsValidationError) Field() string { return e.field }
   291  
   292  // Reason function returns reason value.
   293  func (e EndpointLoadMetricStatsValidationError) Reason() string { return e.reason }
   294  
   295  // Cause function returns cause value.
   296  func (e EndpointLoadMetricStatsValidationError) Cause() error { return e.cause }
   297  
   298  // Key function returns key value.
   299  func (e EndpointLoadMetricStatsValidationError) Key() bool { return e.key }
   300  
   301  // ErrorName returns error name.
   302  func (e EndpointLoadMetricStatsValidationError) ErrorName() string {
   303  	return "EndpointLoadMetricStatsValidationError"
   304  }
   305  
   306  // Error satisfies the builtin error interface
   307  func (e EndpointLoadMetricStatsValidationError) Error() string {
   308  	cause := ""
   309  	if e.cause != nil {
   310  		cause = fmt.Sprintf(" | caused by: %v", e.cause)
   311  	}
   312  
   313  	key := ""
   314  	if e.key {
   315  		key = "key for "
   316  	}
   317  
   318  	return fmt.Sprintf(
   319  		"invalid %sEndpointLoadMetricStats.%s: %s%s",
   320  		key,
   321  		e.field,
   322  		e.reason,
   323  		cause)
   324  }
   325  
   326  var _ error = EndpointLoadMetricStatsValidationError{}
   327  
   328  var _ interface {
   329  	Field() string
   330  	Reason() string
   331  	Key() bool
   332  	Cause() error
   333  	ErrorName() string
   334  } = EndpointLoadMetricStatsValidationError{}
   335  
   336  // Validate checks the field values on ClusterStats with the rules defined in
   337  // the proto definition for this message. If any rules are violated, an error
   338  // is returned.
   339  func (m *ClusterStats) Validate() error {
   340  	if m == nil {
   341  		return nil
   342  	}
   343  
   344  	if utf8.RuneCountInString(m.GetClusterName()) < 1 {
   345  		return ClusterStatsValidationError{
   346  			field:  "ClusterName",
   347  			reason: "value length must be at least 1 runes",
   348  		}
   349  	}
   350  
   351  	// no validation rules for ClusterServiceName
   352  
   353  	if len(m.GetUpstreamLocalityStats()) < 1 {
   354  		return ClusterStatsValidationError{
   355  			field:  "UpstreamLocalityStats",
   356  			reason: "value must contain at least 1 item(s)",
   357  		}
   358  	}
   359  
   360  	for idx, item := range m.GetUpstreamLocalityStats() {
   361  		_, _ = idx, item
   362  
   363  		if v, ok := interface{}(item).(interface{ Validate() error }); ok {
   364  			if err := v.Validate(); err != nil {
   365  				return ClusterStatsValidationError{
   366  					field:  fmt.Sprintf("UpstreamLocalityStats[%v]", idx),
   367  					reason: "embedded message failed validation",
   368  					cause:  err,
   369  				}
   370  			}
   371  		}
   372  
   373  	}
   374  
   375  	// no validation rules for TotalDroppedRequests
   376  
   377  	for idx, item := range m.GetDroppedRequests() {
   378  		_, _ = idx, item
   379  
   380  		if v, ok := interface{}(item).(interface{ Validate() error }); ok {
   381  			if err := v.Validate(); err != nil {
   382  				return ClusterStatsValidationError{
   383  					field:  fmt.Sprintf("DroppedRequests[%v]", idx),
   384  					reason: "embedded message failed validation",
   385  					cause:  err,
   386  				}
   387  			}
   388  		}
   389  
   390  	}
   391  
   392  	if v, ok := interface{}(m.GetLoadReportInterval()).(interface{ Validate() error }); ok {
   393  		if err := v.Validate(); err != nil {
   394  			return ClusterStatsValidationError{
   395  				field:  "LoadReportInterval",
   396  				reason: "embedded message failed validation",
   397  				cause:  err,
   398  			}
   399  		}
   400  	}
   401  
   402  	return nil
   403  }
   404  
   405  // ClusterStatsValidationError is the validation error returned by
   406  // ClusterStats.Validate if the designated constraints aren't met.
   407  type ClusterStatsValidationError struct {
   408  	field  string
   409  	reason string
   410  	cause  error
   411  	key    bool
   412  }
   413  
   414  // Field function returns field value.
   415  func (e ClusterStatsValidationError) Field() string { return e.field }
   416  
   417  // Reason function returns reason value.
   418  func (e ClusterStatsValidationError) Reason() string { return e.reason }
   419  
   420  // Cause function returns cause value.
   421  func (e ClusterStatsValidationError) Cause() error { return e.cause }
   422  
   423  // Key function returns key value.
   424  func (e ClusterStatsValidationError) Key() bool { return e.key }
   425  
   426  // ErrorName returns error name.
   427  func (e ClusterStatsValidationError) ErrorName() string { return "ClusterStatsValidationError" }
   428  
   429  // Error satisfies the builtin error interface
   430  func (e ClusterStatsValidationError) Error() string {
   431  	cause := ""
   432  	if e.cause != nil {
   433  		cause = fmt.Sprintf(" | caused by: %v", e.cause)
   434  	}
   435  
   436  	key := ""
   437  	if e.key {
   438  		key = "key for "
   439  	}
   440  
   441  	return fmt.Sprintf(
   442  		"invalid %sClusterStats.%s: %s%s",
   443  		key,
   444  		e.field,
   445  		e.reason,
   446  		cause)
   447  }
   448  
   449  var _ error = ClusterStatsValidationError{}
   450  
   451  var _ interface {
   452  	Field() string
   453  	Reason() string
   454  	Key() bool
   455  	Cause() error
   456  	ErrorName() string
   457  } = ClusterStatsValidationError{}
   458  
   459  // Validate checks the field values on ClusterStats_DroppedRequests with the
   460  // rules defined in the proto definition for this message. If any rules are
   461  // violated, an error is returned.
   462  func (m *ClusterStats_DroppedRequests) Validate() error {
   463  	if m == nil {
   464  		return nil
   465  	}
   466  
   467  	if utf8.RuneCountInString(m.GetCategory()) < 1 {
   468  		return ClusterStats_DroppedRequestsValidationError{
   469  			field:  "Category",
   470  			reason: "value length must be at least 1 runes",
   471  		}
   472  	}
   473  
   474  	// no validation rules for DroppedCount
   475  
   476  	return nil
   477  }
   478  
   479  // ClusterStats_DroppedRequestsValidationError is the validation error returned
   480  // by ClusterStats_DroppedRequests.Validate if the designated constraints
   481  // aren't met.
   482  type ClusterStats_DroppedRequestsValidationError struct {
   483  	field  string
   484  	reason string
   485  	cause  error
   486  	key    bool
   487  }
   488  
   489  // Field function returns field value.
   490  func (e ClusterStats_DroppedRequestsValidationError) Field() string { return e.field }
   491  
   492  // Reason function returns reason value.
   493  func (e ClusterStats_DroppedRequestsValidationError) Reason() string { return e.reason }
   494  
   495  // Cause function returns cause value.
   496  func (e ClusterStats_DroppedRequestsValidationError) Cause() error { return e.cause }
   497  
   498  // Key function returns key value.
   499  func (e ClusterStats_DroppedRequestsValidationError) Key() bool { return e.key }
   500  
   501  // ErrorName returns error name.
   502  func (e ClusterStats_DroppedRequestsValidationError) ErrorName() string {
   503  	return "ClusterStats_DroppedRequestsValidationError"
   504  }
   505  
   506  // Error satisfies the builtin error interface
   507  func (e ClusterStats_DroppedRequestsValidationError) Error() string {
   508  	cause := ""
   509  	if e.cause != nil {
   510  		cause = fmt.Sprintf(" | caused by: %v", e.cause)
   511  	}
   512  
   513  	key := ""
   514  	if e.key {
   515  		key = "key for "
   516  	}
   517  
   518  	return fmt.Sprintf(
   519  		"invalid %sClusterStats_DroppedRequests.%s: %s%s",
   520  		key,
   521  		e.field,
   522  		e.reason,
   523  		cause)
   524  }
   525  
   526  var _ error = ClusterStats_DroppedRequestsValidationError{}
   527  
   528  var _ interface {
   529  	Field() string
   530  	Reason() string
   531  	Key() bool
   532  	Cause() error
   533  	ErrorName() string
   534  } = ClusterStats_DroppedRequestsValidationError{}