gitee.com/ks-custle/core-gm@v0.0.0-20230922171213-b83bdd97b62c/go-control-plane/envoy/config/metrics/v2/stats.pb.validate.go (about)

     1  // Code generated by protoc-gen-validate. DO NOT EDIT.
     2  // source: envoy/config/metrics/v2/stats.proto
     3  
     4  package envoy_config_metrics_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  
    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 StatsSink with the rules defined in the
    37  // proto definition for this message. If any rules are violated, an error is returned.
    38  func (m *StatsSink) Validate() error {
    39  	if m == nil {
    40  		return nil
    41  	}
    42  
    43  	// no validation rules for Name
    44  
    45  	switch m.ConfigType.(type) {
    46  
    47  	case *StatsSink_Config:
    48  
    49  		if v, ok := interface{}(m.GetConfig()).(interface{ Validate() error }); ok {
    50  			if err := v.Validate(); err != nil {
    51  				return StatsSinkValidationError{
    52  					field:  "Config",
    53  					reason: "embedded message failed validation",
    54  					cause:  err,
    55  				}
    56  			}
    57  		}
    58  
    59  	case *StatsSink_TypedConfig:
    60  
    61  		if v, ok := interface{}(m.GetTypedConfig()).(interface{ Validate() error }); ok {
    62  			if err := v.Validate(); err != nil {
    63  				return StatsSinkValidationError{
    64  					field:  "TypedConfig",
    65  					reason: "embedded message failed validation",
    66  					cause:  err,
    67  				}
    68  			}
    69  		}
    70  
    71  	}
    72  
    73  	return nil
    74  }
    75  
    76  // StatsSinkValidationError is the validation error returned by
    77  // StatsSink.Validate if the designated constraints aren't met.
    78  type StatsSinkValidationError struct {
    79  	field  string
    80  	reason string
    81  	cause  error
    82  	key    bool
    83  }
    84  
    85  // Field function returns field value.
    86  func (e StatsSinkValidationError) Field() string { return e.field }
    87  
    88  // Reason function returns reason value.
    89  func (e StatsSinkValidationError) Reason() string { return e.reason }
    90  
    91  // Cause function returns cause value.
    92  func (e StatsSinkValidationError) Cause() error { return e.cause }
    93  
    94  // Key function returns key value.
    95  func (e StatsSinkValidationError) Key() bool { return e.key }
    96  
    97  // ErrorName returns error name.
    98  func (e StatsSinkValidationError) ErrorName() string { return "StatsSinkValidationError" }
    99  
   100  // Error satisfies the builtin error interface
   101  func (e StatsSinkValidationError) Error() string {
   102  	cause := ""
   103  	if e.cause != nil {
   104  		cause = fmt.Sprintf(" | caused by: %v", e.cause)
   105  	}
   106  
   107  	key := ""
   108  	if e.key {
   109  		key = "key for "
   110  	}
   111  
   112  	return fmt.Sprintf(
   113  		"invalid %sStatsSink.%s: %s%s",
   114  		key,
   115  		e.field,
   116  		e.reason,
   117  		cause)
   118  }
   119  
   120  var _ error = StatsSinkValidationError{}
   121  
   122  var _ interface {
   123  	Field() string
   124  	Reason() string
   125  	Key() bool
   126  	Cause() error
   127  	ErrorName() string
   128  } = StatsSinkValidationError{}
   129  
   130  // Validate checks the field values on StatsConfig with the rules defined in
   131  // the proto definition for this message. If any rules are violated, an error
   132  // is returned.
   133  func (m *StatsConfig) Validate() error {
   134  	if m == nil {
   135  		return nil
   136  	}
   137  
   138  	for idx, item := range m.GetStatsTags() {
   139  		_, _ = idx, item
   140  
   141  		if v, ok := interface{}(item).(interface{ Validate() error }); ok {
   142  			if err := v.Validate(); err != nil {
   143  				return StatsConfigValidationError{
   144  					field:  fmt.Sprintf("StatsTags[%v]", idx),
   145  					reason: "embedded message failed validation",
   146  					cause:  err,
   147  				}
   148  			}
   149  		}
   150  
   151  	}
   152  
   153  	if v, ok := interface{}(m.GetUseAllDefaultTags()).(interface{ Validate() error }); ok {
   154  		if err := v.Validate(); err != nil {
   155  			return StatsConfigValidationError{
   156  				field:  "UseAllDefaultTags",
   157  				reason: "embedded message failed validation",
   158  				cause:  err,
   159  			}
   160  		}
   161  	}
   162  
   163  	if v, ok := interface{}(m.GetStatsMatcher()).(interface{ Validate() error }); ok {
   164  		if err := v.Validate(); err != nil {
   165  			return StatsConfigValidationError{
   166  				field:  "StatsMatcher",
   167  				reason: "embedded message failed validation",
   168  				cause:  err,
   169  			}
   170  		}
   171  	}
   172  
   173  	return nil
   174  }
   175  
   176  // StatsConfigValidationError is the validation error returned by
   177  // StatsConfig.Validate if the designated constraints aren't met.
   178  type StatsConfigValidationError struct {
   179  	field  string
   180  	reason string
   181  	cause  error
   182  	key    bool
   183  }
   184  
   185  // Field function returns field value.
   186  func (e StatsConfigValidationError) Field() string { return e.field }
   187  
   188  // Reason function returns reason value.
   189  func (e StatsConfigValidationError) Reason() string { return e.reason }
   190  
   191  // Cause function returns cause value.
   192  func (e StatsConfigValidationError) Cause() error { return e.cause }
   193  
   194  // Key function returns key value.
   195  func (e StatsConfigValidationError) Key() bool { return e.key }
   196  
   197  // ErrorName returns error name.
   198  func (e StatsConfigValidationError) ErrorName() string { return "StatsConfigValidationError" }
   199  
   200  // Error satisfies the builtin error interface
   201  func (e StatsConfigValidationError) Error() string {
   202  	cause := ""
   203  	if e.cause != nil {
   204  		cause = fmt.Sprintf(" | caused by: %v", e.cause)
   205  	}
   206  
   207  	key := ""
   208  	if e.key {
   209  		key = "key for "
   210  	}
   211  
   212  	return fmt.Sprintf(
   213  		"invalid %sStatsConfig.%s: %s%s",
   214  		key,
   215  		e.field,
   216  		e.reason,
   217  		cause)
   218  }
   219  
   220  var _ error = StatsConfigValidationError{}
   221  
   222  var _ interface {
   223  	Field() string
   224  	Reason() string
   225  	Key() bool
   226  	Cause() error
   227  	ErrorName() string
   228  } = StatsConfigValidationError{}
   229  
   230  // Validate checks the field values on StatsMatcher with the rules defined in
   231  // the proto definition for this message. If any rules are violated, an error
   232  // is returned.
   233  func (m *StatsMatcher) Validate() error {
   234  	if m == nil {
   235  		return nil
   236  	}
   237  
   238  	switch m.StatsMatcher.(type) {
   239  
   240  	case *StatsMatcher_RejectAll:
   241  		// no validation rules for RejectAll
   242  
   243  	case *StatsMatcher_ExclusionList:
   244  
   245  		if v, ok := interface{}(m.GetExclusionList()).(interface{ Validate() error }); ok {
   246  			if err := v.Validate(); err != nil {
   247  				return StatsMatcherValidationError{
   248  					field:  "ExclusionList",
   249  					reason: "embedded message failed validation",
   250  					cause:  err,
   251  				}
   252  			}
   253  		}
   254  
   255  	case *StatsMatcher_InclusionList:
   256  
   257  		if v, ok := interface{}(m.GetInclusionList()).(interface{ Validate() error }); ok {
   258  			if err := v.Validate(); err != nil {
   259  				return StatsMatcherValidationError{
   260  					field:  "InclusionList",
   261  					reason: "embedded message failed validation",
   262  					cause:  err,
   263  				}
   264  			}
   265  		}
   266  
   267  	default:
   268  		return StatsMatcherValidationError{
   269  			field:  "StatsMatcher",
   270  			reason: "value is required",
   271  		}
   272  
   273  	}
   274  
   275  	return nil
   276  }
   277  
   278  // StatsMatcherValidationError is the validation error returned by
   279  // StatsMatcher.Validate if the designated constraints aren't met.
   280  type StatsMatcherValidationError struct {
   281  	field  string
   282  	reason string
   283  	cause  error
   284  	key    bool
   285  }
   286  
   287  // Field function returns field value.
   288  func (e StatsMatcherValidationError) Field() string { return e.field }
   289  
   290  // Reason function returns reason value.
   291  func (e StatsMatcherValidationError) Reason() string { return e.reason }
   292  
   293  // Cause function returns cause value.
   294  func (e StatsMatcherValidationError) Cause() error { return e.cause }
   295  
   296  // Key function returns key value.
   297  func (e StatsMatcherValidationError) Key() bool { return e.key }
   298  
   299  // ErrorName returns error name.
   300  func (e StatsMatcherValidationError) ErrorName() string { return "StatsMatcherValidationError" }
   301  
   302  // Error satisfies the builtin error interface
   303  func (e StatsMatcherValidationError) Error() string {
   304  	cause := ""
   305  	if e.cause != nil {
   306  		cause = fmt.Sprintf(" | caused by: %v", e.cause)
   307  	}
   308  
   309  	key := ""
   310  	if e.key {
   311  		key = "key for "
   312  	}
   313  
   314  	return fmt.Sprintf(
   315  		"invalid %sStatsMatcher.%s: %s%s",
   316  		key,
   317  		e.field,
   318  		e.reason,
   319  		cause)
   320  }
   321  
   322  var _ error = StatsMatcherValidationError{}
   323  
   324  var _ interface {
   325  	Field() string
   326  	Reason() string
   327  	Key() bool
   328  	Cause() error
   329  	ErrorName() string
   330  } = StatsMatcherValidationError{}
   331  
   332  // Validate checks the field values on TagSpecifier with the rules defined in
   333  // the proto definition for this message. If any rules are violated, an error
   334  // is returned.
   335  func (m *TagSpecifier) Validate() error {
   336  	if m == nil {
   337  		return nil
   338  	}
   339  
   340  	// no validation rules for TagName
   341  
   342  	switch m.TagValue.(type) {
   343  
   344  	case *TagSpecifier_Regex:
   345  
   346  		if len(m.GetRegex()) > 1024 {
   347  			return TagSpecifierValidationError{
   348  				field:  "Regex",
   349  				reason: "value length must be at most 1024 bytes",
   350  			}
   351  		}
   352  
   353  	case *TagSpecifier_FixedValue:
   354  		// no validation rules for FixedValue
   355  
   356  	}
   357  
   358  	return nil
   359  }
   360  
   361  // TagSpecifierValidationError is the validation error returned by
   362  // TagSpecifier.Validate if the designated constraints aren't met.
   363  type TagSpecifierValidationError struct {
   364  	field  string
   365  	reason string
   366  	cause  error
   367  	key    bool
   368  }
   369  
   370  // Field function returns field value.
   371  func (e TagSpecifierValidationError) Field() string { return e.field }
   372  
   373  // Reason function returns reason value.
   374  func (e TagSpecifierValidationError) Reason() string { return e.reason }
   375  
   376  // Cause function returns cause value.
   377  func (e TagSpecifierValidationError) Cause() error { return e.cause }
   378  
   379  // Key function returns key value.
   380  func (e TagSpecifierValidationError) Key() bool { return e.key }
   381  
   382  // ErrorName returns error name.
   383  func (e TagSpecifierValidationError) ErrorName() string { return "TagSpecifierValidationError" }
   384  
   385  // Error satisfies the builtin error interface
   386  func (e TagSpecifierValidationError) Error() string {
   387  	cause := ""
   388  	if e.cause != nil {
   389  		cause = fmt.Sprintf(" | caused by: %v", e.cause)
   390  	}
   391  
   392  	key := ""
   393  	if e.key {
   394  		key = "key for "
   395  	}
   396  
   397  	return fmt.Sprintf(
   398  		"invalid %sTagSpecifier.%s: %s%s",
   399  		key,
   400  		e.field,
   401  		e.reason,
   402  		cause)
   403  }
   404  
   405  var _ error = TagSpecifierValidationError{}
   406  
   407  var _ interface {
   408  	Field() string
   409  	Reason() string
   410  	Key() bool
   411  	Cause() error
   412  	ErrorName() string
   413  } = TagSpecifierValidationError{}
   414  
   415  // Validate checks the field values on StatsdSink with the rules defined in the
   416  // proto definition for this message. If any rules are violated, an error is returned.
   417  func (m *StatsdSink) Validate() error {
   418  	if m == nil {
   419  		return nil
   420  	}
   421  
   422  	// no validation rules for Prefix
   423  
   424  	switch m.StatsdSpecifier.(type) {
   425  
   426  	case *StatsdSink_Address:
   427  
   428  		if v, ok := interface{}(m.GetAddress()).(interface{ Validate() error }); ok {
   429  			if err := v.Validate(); err != nil {
   430  				return StatsdSinkValidationError{
   431  					field:  "Address",
   432  					reason: "embedded message failed validation",
   433  					cause:  err,
   434  				}
   435  			}
   436  		}
   437  
   438  	case *StatsdSink_TcpClusterName:
   439  		// no validation rules for TcpClusterName
   440  
   441  	default:
   442  		return StatsdSinkValidationError{
   443  			field:  "StatsdSpecifier",
   444  			reason: "value is required",
   445  		}
   446  
   447  	}
   448  
   449  	return nil
   450  }
   451  
   452  // StatsdSinkValidationError is the validation error returned by
   453  // StatsdSink.Validate if the designated constraints aren't met.
   454  type StatsdSinkValidationError struct {
   455  	field  string
   456  	reason string
   457  	cause  error
   458  	key    bool
   459  }
   460  
   461  // Field function returns field value.
   462  func (e StatsdSinkValidationError) Field() string { return e.field }
   463  
   464  // Reason function returns reason value.
   465  func (e StatsdSinkValidationError) Reason() string { return e.reason }
   466  
   467  // Cause function returns cause value.
   468  func (e StatsdSinkValidationError) Cause() error { return e.cause }
   469  
   470  // Key function returns key value.
   471  func (e StatsdSinkValidationError) Key() bool { return e.key }
   472  
   473  // ErrorName returns error name.
   474  func (e StatsdSinkValidationError) ErrorName() string { return "StatsdSinkValidationError" }
   475  
   476  // Error satisfies the builtin error interface
   477  func (e StatsdSinkValidationError) Error() string {
   478  	cause := ""
   479  	if e.cause != nil {
   480  		cause = fmt.Sprintf(" | caused by: %v", e.cause)
   481  	}
   482  
   483  	key := ""
   484  	if e.key {
   485  		key = "key for "
   486  	}
   487  
   488  	return fmt.Sprintf(
   489  		"invalid %sStatsdSink.%s: %s%s",
   490  		key,
   491  		e.field,
   492  		e.reason,
   493  		cause)
   494  }
   495  
   496  var _ error = StatsdSinkValidationError{}
   497  
   498  var _ interface {
   499  	Field() string
   500  	Reason() string
   501  	Key() bool
   502  	Cause() error
   503  	ErrorName() string
   504  } = StatsdSinkValidationError{}
   505  
   506  // Validate checks the field values on DogStatsdSink with the rules defined in
   507  // the proto definition for this message. If any rules are violated, an error
   508  // is returned.
   509  func (m *DogStatsdSink) Validate() error {
   510  	if m == nil {
   511  		return nil
   512  	}
   513  
   514  	// no validation rules for Prefix
   515  
   516  	switch m.DogStatsdSpecifier.(type) {
   517  
   518  	case *DogStatsdSink_Address:
   519  
   520  		if v, ok := interface{}(m.GetAddress()).(interface{ Validate() error }); ok {
   521  			if err := v.Validate(); err != nil {
   522  				return DogStatsdSinkValidationError{
   523  					field:  "Address",
   524  					reason: "embedded message failed validation",
   525  					cause:  err,
   526  				}
   527  			}
   528  		}
   529  
   530  	default:
   531  		return DogStatsdSinkValidationError{
   532  			field:  "DogStatsdSpecifier",
   533  			reason: "value is required",
   534  		}
   535  
   536  	}
   537  
   538  	return nil
   539  }
   540  
   541  // DogStatsdSinkValidationError is the validation error returned by
   542  // DogStatsdSink.Validate if the designated constraints aren't met.
   543  type DogStatsdSinkValidationError struct {
   544  	field  string
   545  	reason string
   546  	cause  error
   547  	key    bool
   548  }
   549  
   550  // Field function returns field value.
   551  func (e DogStatsdSinkValidationError) Field() string { return e.field }
   552  
   553  // Reason function returns reason value.
   554  func (e DogStatsdSinkValidationError) Reason() string { return e.reason }
   555  
   556  // Cause function returns cause value.
   557  func (e DogStatsdSinkValidationError) Cause() error { return e.cause }
   558  
   559  // Key function returns key value.
   560  func (e DogStatsdSinkValidationError) Key() bool { return e.key }
   561  
   562  // ErrorName returns error name.
   563  func (e DogStatsdSinkValidationError) ErrorName() string { return "DogStatsdSinkValidationError" }
   564  
   565  // Error satisfies the builtin error interface
   566  func (e DogStatsdSinkValidationError) Error() string {
   567  	cause := ""
   568  	if e.cause != nil {
   569  		cause = fmt.Sprintf(" | caused by: %v", e.cause)
   570  	}
   571  
   572  	key := ""
   573  	if e.key {
   574  		key = "key for "
   575  	}
   576  
   577  	return fmt.Sprintf(
   578  		"invalid %sDogStatsdSink.%s: %s%s",
   579  		key,
   580  		e.field,
   581  		e.reason,
   582  		cause)
   583  }
   584  
   585  var _ error = DogStatsdSinkValidationError{}
   586  
   587  var _ interface {
   588  	Field() string
   589  	Reason() string
   590  	Key() bool
   591  	Cause() error
   592  	ErrorName() string
   593  } = DogStatsdSinkValidationError{}
   594  
   595  // Validate checks the field values on HystrixSink with the rules defined in
   596  // the proto definition for this message. If any rules are violated, an error
   597  // is returned.
   598  func (m *HystrixSink) Validate() error {
   599  	if m == nil {
   600  		return nil
   601  	}
   602  
   603  	// no validation rules for NumBuckets
   604  
   605  	return nil
   606  }
   607  
   608  // HystrixSinkValidationError is the validation error returned by
   609  // HystrixSink.Validate if the designated constraints aren't met.
   610  type HystrixSinkValidationError struct {
   611  	field  string
   612  	reason string
   613  	cause  error
   614  	key    bool
   615  }
   616  
   617  // Field function returns field value.
   618  func (e HystrixSinkValidationError) Field() string { return e.field }
   619  
   620  // Reason function returns reason value.
   621  func (e HystrixSinkValidationError) Reason() string { return e.reason }
   622  
   623  // Cause function returns cause value.
   624  func (e HystrixSinkValidationError) Cause() error { return e.cause }
   625  
   626  // Key function returns key value.
   627  func (e HystrixSinkValidationError) Key() bool { return e.key }
   628  
   629  // ErrorName returns error name.
   630  func (e HystrixSinkValidationError) ErrorName() string { return "HystrixSinkValidationError" }
   631  
   632  // Error satisfies the builtin error interface
   633  func (e HystrixSinkValidationError) Error() string {
   634  	cause := ""
   635  	if e.cause != nil {
   636  		cause = fmt.Sprintf(" | caused by: %v", e.cause)
   637  	}
   638  
   639  	key := ""
   640  	if e.key {
   641  		key = "key for "
   642  	}
   643  
   644  	return fmt.Sprintf(
   645  		"invalid %sHystrixSink.%s: %s%s",
   646  		key,
   647  		e.field,
   648  		e.reason,
   649  		cause)
   650  }
   651  
   652  var _ error = HystrixSinkValidationError{}
   653  
   654  var _ interface {
   655  	Field() string
   656  	Reason() string
   657  	Key() bool
   658  	Cause() error
   659  	ErrorName() string
   660  } = HystrixSinkValidationError{}