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

     1  // Code generated by protoc-gen-validate. DO NOT EDIT.
     2  // source: envoy/config/accesslog/v3/accesslog.proto
     3  
     4  package envoy_config_accesslog_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 AccessLog with the rules defined in the
    37  // proto definition for this message. If any rules are violated, an error is returned.
    38  func (m *AccessLog) Validate() error {
    39  	if m == nil {
    40  		return nil
    41  	}
    42  
    43  	// no validation rules for Name
    44  
    45  	if v, ok := interface{}(m.GetFilter()).(interface{ Validate() error }); ok {
    46  		if err := v.Validate(); err != nil {
    47  			return AccessLogValidationError{
    48  				field:  "Filter",
    49  				reason: "embedded message failed validation",
    50  				cause:  err,
    51  			}
    52  		}
    53  	}
    54  
    55  	switch m.ConfigType.(type) {
    56  
    57  	case *AccessLog_TypedConfig:
    58  
    59  		if v, ok := interface{}(m.GetTypedConfig()).(interface{ Validate() error }); ok {
    60  			if err := v.Validate(); err != nil {
    61  				return AccessLogValidationError{
    62  					field:  "TypedConfig",
    63  					reason: "embedded message failed validation",
    64  					cause:  err,
    65  				}
    66  			}
    67  		}
    68  
    69  	case *AccessLog_HiddenEnvoyDeprecatedConfig:
    70  
    71  		if v, ok := interface{}(m.GetHiddenEnvoyDeprecatedConfig()).(interface{ Validate() error }); ok {
    72  			if err := v.Validate(); err != nil {
    73  				return AccessLogValidationError{
    74  					field:  "HiddenEnvoyDeprecatedConfig",
    75  					reason: "embedded message failed validation",
    76  					cause:  err,
    77  				}
    78  			}
    79  		}
    80  
    81  	}
    82  
    83  	return nil
    84  }
    85  
    86  // AccessLogValidationError is the validation error returned by
    87  // AccessLog.Validate if the designated constraints aren't met.
    88  type AccessLogValidationError struct {
    89  	field  string
    90  	reason string
    91  	cause  error
    92  	key    bool
    93  }
    94  
    95  // Field function returns field value.
    96  func (e AccessLogValidationError) Field() string { return e.field }
    97  
    98  // Reason function returns reason value.
    99  func (e AccessLogValidationError) Reason() string { return e.reason }
   100  
   101  // Cause function returns cause value.
   102  func (e AccessLogValidationError) Cause() error { return e.cause }
   103  
   104  // Key function returns key value.
   105  func (e AccessLogValidationError) Key() bool { return e.key }
   106  
   107  // ErrorName returns error name.
   108  func (e AccessLogValidationError) ErrorName() string { return "AccessLogValidationError" }
   109  
   110  // Error satisfies the builtin error interface
   111  func (e AccessLogValidationError) Error() string {
   112  	cause := ""
   113  	if e.cause != nil {
   114  		cause = fmt.Sprintf(" | caused by: %v", e.cause)
   115  	}
   116  
   117  	key := ""
   118  	if e.key {
   119  		key = "key for "
   120  	}
   121  
   122  	return fmt.Sprintf(
   123  		"invalid %sAccessLog.%s: %s%s",
   124  		key,
   125  		e.field,
   126  		e.reason,
   127  		cause)
   128  }
   129  
   130  var _ error = AccessLogValidationError{}
   131  
   132  var _ interface {
   133  	Field() string
   134  	Reason() string
   135  	Key() bool
   136  	Cause() error
   137  	ErrorName() string
   138  } = AccessLogValidationError{}
   139  
   140  // Validate checks the field values on AccessLogFilter with the rules defined
   141  // in the proto definition for this message. If any rules are violated, an
   142  // error is returned.
   143  func (m *AccessLogFilter) Validate() error {
   144  	if m == nil {
   145  		return nil
   146  	}
   147  
   148  	switch m.FilterSpecifier.(type) {
   149  
   150  	case *AccessLogFilter_StatusCodeFilter:
   151  
   152  		if v, ok := interface{}(m.GetStatusCodeFilter()).(interface{ Validate() error }); ok {
   153  			if err := v.Validate(); err != nil {
   154  				return AccessLogFilterValidationError{
   155  					field:  "StatusCodeFilter",
   156  					reason: "embedded message failed validation",
   157  					cause:  err,
   158  				}
   159  			}
   160  		}
   161  
   162  	case *AccessLogFilter_DurationFilter:
   163  
   164  		if v, ok := interface{}(m.GetDurationFilter()).(interface{ Validate() error }); ok {
   165  			if err := v.Validate(); err != nil {
   166  				return AccessLogFilterValidationError{
   167  					field:  "DurationFilter",
   168  					reason: "embedded message failed validation",
   169  					cause:  err,
   170  				}
   171  			}
   172  		}
   173  
   174  	case *AccessLogFilter_NotHealthCheckFilter:
   175  
   176  		if v, ok := interface{}(m.GetNotHealthCheckFilter()).(interface{ Validate() error }); ok {
   177  			if err := v.Validate(); err != nil {
   178  				return AccessLogFilterValidationError{
   179  					field:  "NotHealthCheckFilter",
   180  					reason: "embedded message failed validation",
   181  					cause:  err,
   182  				}
   183  			}
   184  		}
   185  
   186  	case *AccessLogFilter_TraceableFilter:
   187  
   188  		if v, ok := interface{}(m.GetTraceableFilter()).(interface{ Validate() error }); ok {
   189  			if err := v.Validate(); err != nil {
   190  				return AccessLogFilterValidationError{
   191  					field:  "TraceableFilter",
   192  					reason: "embedded message failed validation",
   193  					cause:  err,
   194  				}
   195  			}
   196  		}
   197  
   198  	case *AccessLogFilter_RuntimeFilter:
   199  
   200  		if v, ok := interface{}(m.GetRuntimeFilter()).(interface{ Validate() error }); ok {
   201  			if err := v.Validate(); err != nil {
   202  				return AccessLogFilterValidationError{
   203  					field:  "RuntimeFilter",
   204  					reason: "embedded message failed validation",
   205  					cause:  err,
   206  				}
   207  			}
   208  		}
   209  
   210  	case *AccessLogFilter_AndFilter:
   211  
   212  		if v, ok := interface{}(m.GetAndFilter()).(interface{ Validate() error }); ok {
   213  			if err := v.Validate(); err != nil {
   214  				return AccessLogFilterValidationError{
   215  					field:  "AndFilter",
   216  					reason: "embedded message failed validation",
   217  					cause:  err,
   218  				}
   219  			}
   220  		}
   221  
   222  	case *AccessLogFilter_OrFilter:
   223  
   224  		if v, ok := interface{}(m.GetOrFilter()).(interface{ Validate() error }); ok {
   225  			if err := v.Validate(); err != nil {
   226  				return AccessLogFilterValidationError{
   227  					field:  "OrFilter",
   228  					reason: "embedded message failed validation",
   229  					cause:  err,
   230  				}
   231  			}
   232  		}
   233  
   234  	case *AccessLogFilter_HeaderFilter:
   235  
   236  		if v, ok := interface{}(m.GetHeaderFilter()).(interface{ Validate() error }); ok {
   237  			if err := v.Validate(); err != nil {
   238  				return AccessLogFilterValidationError{
   239  					field:  "HeaderFilter",
   240  					reason: "embedded message failed validation",
   241  					cause:  err,
   242  				}
   243  			}
   244  		}
   245  
   246  	case *AccessLogFilter_ResponseFlagFilter:
   247  
   248  		if v, ok := interface{}(m.GetResponseFlagFilter()).(interface{ Validate() error }); ok {
   249  			if err := v.Validate(); err != nil {
   250  				return AccessLogFilterValidationError{
   251  					field:  "ResponseFlagFilter",
   252  					reason: "embedded message failed validation",
   253  					cause:  err,
   254  				}
   255  			}
   256  		}
   257  
   258  	case *AccessLogFilter_GrpcStatusFilter:
   259  
   260  		if v, ok := interface{}(m.GetGrpcStatusFilter()).(interface{ Validate() error }); ok {
   261  			if err := v.Validate(); err != nil {
   262  				return AccessLogFilterValidationError{
   263  					field:  "GrpcStatusFilter",
   264  					reason: "embedded message failed validation",
   265  					cause:  err,
   266  				}
   267  			}
   268  		}
   269  
   270  	case *AccessLogFilter_ExtensionFilter:
   271  
   272  		if v, ok := interface{}(m.GetExtensionFilter()).(interface{ Validate() error }); ok {
   273  			if err := v.Validate(); err != nil {
   274  				return AccessLogFilterValidationError{
   275  					field:  "ExtensionFilter",
   276  					reason: "embedded message failed validation",
   277  					cause:  err,
   278  				}
   279  			}
   280  		}
   281  
   282  	case *AccessLogFilter_MetadataFilter:
   283  
   284  		if v, ok := interface{}(m.GetMetadataFilter()).(interface{ Validate() error }); ok {
   285  			if err := v.Validate(); err != nil {
   286  				return AccessLogFilterValidationError{
   287  					field:  "MetadataFilter",
   288  					reason: "embedded message failed validation",
   289  					cause:  err,
   290  				}
   291  			}
   292  		}
   293  
   294  	default:
   295  		return AccessLogFilterValidationError{
   296  			field:  "FilterSpecifier",
   297  			reason: "value is required",
   298  		}
   299  
   300  	}
   301  
   302  	return nil
   303  }
   304  
   305  // AccessLogFilterValidationError is the validation error returned by
   306  // AccessLogFilter.Validate if the designated constraints aren't met.
   307  type AccessLogFilterValidationError struct {
   308  	field  string
   309  	reason string
   310  	cause  error
   311  	key    bool
   312  }
   313  
   314  // Field function returns field value.
   315  func (e AccessLogFilterValidationError) Field() string { return e.field }
   316  
   317  // Reason function returns reason value.
   318  func (e AccessLogFilterValidationError) Reason() string { return e.reason }
   319  
   320  // Cause function returns cause value.
   321  func (e AccessLogFilterValidationError) Cause() error { return e.cause }
   322  
   323  // Key function returns key value.
   324  func (e AccessLogFilterValidationError) Key() bool { return e.key }
   325  
   326  // ErrorName returns error name.
   327  func (e AccessLogFilterValidationError) ErrorName() string { return "AccessLogFilterValidationError" }
   328  
   329  // Error satisfies the builtin error interface
   330  func (e AccessLogFilterValidationError) Error() string {
   331  	cause := ""
   332  	if e.cause != nil {
   333  		cause = fmt.Sprintf(" | caused by: %v", e.cause)
   334  	}
   335  
   336  	key := ""
   337  	if e.key {
   338  		key = "key for "
   339  	}
   340  
   341  	return fmt.Sprintf(
   342  		"invalid %sAccessLogFilter.%s: %s%s",
   343  		key,
   344  		e.field,
   345  		e.reason,
   346  		cause)
   347  }
   348  
   349  var _ error = AccessLogFilterValidationError{}
   350  
   351  var _ interface {
   352  	Field() string
   353  	Reason() string
   354  	Key() bool
   355  	Cause() error
   356  	ErrorName() string
   357  } = AccessLogFilterValidationError{}
   358  
   359  // Validate checks the field values on ComparisonFilter with the rules defined
   360  // in the proto definition for this message. If any rules are violated, an
   361  // error is returned.
   362  func (m *ComparisonFilter) Validate() error {
   363  	if m == nil {
   364  		return nil
   365  	}
   366  
   367  	if _, ok := ComparisonFilter_Op_name[int32(m.GetOp())]; !ok {
   368  		return ComparisonFilterValidationError{
   369  			field:  "Op",
   370  			reason: "value must be one of the defined enum values",
   371  		}
   372  	}
   373  
   374  	if v, ok := interface{}(m.GetValue()).(interface{ Validate() error }); ok {
   375  		if err := v.Validate(); err != nil {
   376  			return ComparisonFilterValidationError{
   377  				field:  "Value",
   378  				reason: "embedded message failed validation",
   379  				cause:  err,
   380  			}
   381  		}
   382  	}
   383  
   384  	return nil
   385  }
   386  
   387  // ComparisonFilterValidationError is the validation error returned by
   388  // ComparisonFilter.Validate if the designated constraints aren't met.
   389  type ComparisonFilterValidationError struct {
   390  	field  string
   391  	reason string
   392  	cause  error
   393  	key    bool
   394  }
   395  
   396  // Field function returns field value.
   397  func (e ComparisonFilterValidationError) Field() string { return e.field }
   398  
   399  // Reason function returns reason value.
   400  func (e ComparisonFilterValidationError) Reason() string { return e.reason }
   401  
   402  // Cause function returns cause value.
   403  func (e ComparisonFilterValidationError) Cause() error { return e.cause }
   404  
   405  // Key function returns key value.
   406  func (e ComparisonFilterValidationError) Key() bool { return e.key }
   407  
   408  // ErrorName returns error name.
   409  func (e ComparisonFilterValidationError) ErrorName() string { return "ComparisonFilterValidationError" }
   410  
   411  // Error satisfies the builtin error interface
   412  func (e ComparisonFilterValidationError) Error() string {
   413  	cause := ""
   414  	if e.cause != nil {
   415  		cause = fmt.Sprintf(" | caused by: %v", e.cause)
   416  	}
   417  
   418  	key := ""
   419  	if e.key {
   420  		key = "key for "
   421  	}
   422  
   423  	return fmt.Sprintf(
   424  		"invalid %sComparisonFilter.%s: %s%s",
   425  		key,
   426  		e.field,
   427  		e.reason,
   428  		cause)
   429  }
   430  
   431  var _ error = ComparisonFilterValidationError{}
   432  
   433  var _ interface {
   434  	Field() string
   435  	Reason() string
   436  	Key() bool
   437  	Cause() error
   438  	ErrorName() string
   439  } = ComparisonFilterValidationError{}
   440  
   441  // Validate checks the field values on StatusCodeFilter with the rules defined
   442  // in the proto definition for this message. If any rules are violated, an
   443  // error is returned.
   444  func (m *StatusCodeFilter) Validate() error {
   445  	if m == nil {
   446  		return nil
   447  	}
   448  
   449  	if m.GetComparison() == nil {
   450  		return StatusCodeFilterValidationError{
   451  			field:  "Comparison",
   452  			reason: "value is required",
   453  		}
   454  	}
   455  
   456  	if v, ok := interface{}(m.GetComparison()).(interface{ Validate() error }); ok {
   457  		if err := v.Validate(); err != nil {
   458  			return StatusCodeFilterValidationError{
   459  				field:  "Comparison",
   460  				reason: "embedded message failed validation",
   461  				cause:  err,
   462  			}
   463  		}
   464  	}
   465  
   466  	return nil
   467  }
   468  
   469  // StatusCodeFilterValidationError is the validation error returned by
   470  // StatusCodeFilter.Validate if the designated constraints aren't met.
   471  type StatusCodeFilterValidationError struct {
   472  	field  string
   473  	reason string
   474  	cause  error
   475  	key    bool
   476  }
   477  
   478  // Field function returns field value.
   479  func (e StatusCodeFilterValidationError) Field() string { return e.field }
   480  
   481  // Reason function returns reason value.
   482  func (e StatusCodeFilterValidationError) Reason() string { return e.reason }
   483  
   484  // Cause function returns cause value.
   485  func (e StatusCodeFilterValidationError) Cause() error { return e.cause }
   486  
   487  // Key function returns key value.
   488  func (e StatusCodeFilterValidationError) Key() bool { return e.key }
   489  
   490  // ErrorName returns error name.
   491  func (e StatusCodeFilterValidationError) ErrorName() string { return "StatusCodeFilterValidationError" }
   492  
   493  // Error satisfies the builtin error interface
   494  func (e StatusCodeFilterValidationError) 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 %sStatusCodeFilter.%s: %s%s",
   507  		key,
   508  		e.field,
   509  		e.reason,
   510  		cause)
   511  }
   512  
   513  var _ error = StatusCodeFilterValidationError{}
   514  
   515  var _ interface {
   516  	Field() string
   517  	Reason() string
   518  	Key() bool
   519  	Cause() error
   520  	ErrorName() string
   521  } = StatusCodeFilterValidationError{}
   522  
   523  // Validate checks the field values on DurationFilter with the rules defined in
   524  // the proto definition for this message. If any rules are violated, an error
   525  // is returned.
   526  func (m *DurationFilter) Validate() error {
   527  	if m == nil {
   528  		return nil
   529  	}
   530  
   531  	if m.GetComparison() == nil {
   532  		return DurationFilterValidationError{
   533  			field:  "Comparison",
   534  			reason: "value is required",
   535  		}
   536  	}
   537  
   538  	if v, ok := interface{}(m.GetComparison()).(interface{ Validate() error }); ok {
   539  		if err := v.Validate(); err != nil {
   540  			return DurationFilterValidationError{
   541  				field:  "Comparison",
   542  				reason: "embedded message failed validation",
   543  				cause:  err,
   544  			}
   545  		}
   546  	}
   547  
   548  	return nil
   549  }
   550  
   551  // DurationFilterValidationError is the validation error returned by
   552  // DurationFilter.Validate if the designated constraints aren't met.
   553  type DurationFilterValidationError struct {
   554  	field  string
   555  	reason string
   556  	cause  error
   557  	key    bool
   558  }
   559  
   560  // Field function returns field value.
   561  func (e DurationFilterValidationError) Field() string { return e.field }
   562  
   563  // Reason function returns reason value.
   564  func (e DurationFilterValidationError) Reason() string { return e.reason }
   565  
   566  // Cause function returns cause value.
   567  func (e DurationFilterValidationError) Cause() error { return e.cause }
   568  
   569  // Key function returns key value.
   570  func (e DurationFilterValidationError) Key() bool { return e.key }
   571  
   572  // ErrorName returns error name.
   573  func (e DurationFilterValidationError) ErrorName() string { return "DurationFilterValidationError" }
   574  
   575  // Error satisfies the builtin error interface
   576  func (e DurationFilterValidationError) Error() string {
   577  	cause := ""
   578  	if e.cause != nil {
   579  		cause = fmt.Sprintf(" | caused by: %v", e.cause)
   580  	}
   581  
   582  	key := ""
   583  	if e.key {
   584  		key = "key for "
   585  	}
   586  
   587  	return fmt.Sprintf(
   588  		"invalid %sDurationFilter.%s: %s%s",
   589  		key,
   590  		e.field,
   591  		e.reason,
   592  		cause)
   593  }
   594  
   595  var _ error = DurationFilterValidationError{}
   596  
   597  var _ interface {
   598  	Field() string
   599  	Reason() string
   600  	Key() bool
   601  	Cause() error
   602  	ErrorName() string
   603  } = DurationFilterValidationError{}
   604  
   605  // Validate checks the field values on NotHealthCheckFilter with the rules
   606  // defined in the proto definition for this message. If any rules are
   607  // violated, an error is returned.
   608  func (m *NotHealthCheckFilter) Validate() error {
   609  	if m == nil {
   610  		return nil
   611  	}
   612  
   613  	return nil
   614  }
   615  
   616  // NotHealthCheckFilterValidationError is the validation error returned by
   617  // NotHealthCheckFilter.Validate if the designated constraints aren't met.
   618  type NotHealthCheckFilterValidationError struct {
   619  	field  string
   620  	reason string
   621  	cause  error
   622  	key    bool
   623  }
   624  
   625  // Field function returns field value.
   626  func (e NotHealthCheckFilterValidationError) Field() string { return e.field }
   627  
   628  // Reason function returns reason value.
   629  func (e NotHealthCheckFilterValidationError) Reason() string { return e.reason }
   630  
   631  // Cause function returns cause value.
   632  func (e NotHealthCheckFilterValidationError) Cause() error { return e.cause }
   633  
   634  // Key function returns key value.
   635  func (e NotHealthCheckFilterValidationError) Key() bool { return e.key }
   636  
   637  // ErrorName returns error name.
   638  func (e NotHealthCheckFilterValidationError) ErrorName() string {
   639  	return "NotHealthCheckFilterValidationError"
   640  }
   641  
   642  // Error satisfies the builtin error interface
   643  func (e NotHealthCheckFilterValidationError) Error() string {
   644  	cause := ""
   645  	if e.cause != nil {
   646  		cause = fmt.Sprintf(" | caused by: %v", e.cause)
   647  	}
   648  
   649  	key := ""
   650  	if e.key {
   651  		key = "key for "
   652  	}
   653  
   654  	return fmt.Sprintf(
   655  		"invalid %sNotHealthCheckFilter.%s: %s%s",
   656  		key,
   657  		e.field,
   658  		e.reason,
   659  		cause)
   660  }
   661  
   662  var _ error = NotHealthCheckFilterValidationError{}
   663  
   664  var _ interface {
   665  	Field() string
   666  	Reason() string
   667  	Key() bool
   668  	Cause() error
   669  	ErrorName() string
   670  } = NotHealthCheckFilterValidationError{}
   671  
   672  // Validate checks the field values on TraceableFilter with the rules defined
   673  // in the proto definition for this message. If any rules are violated, an
   674  // error is returned.
   675  func (m *TraceableFilter) Validate() error {
   676  	if m == nil {
   677  		return nil
   678  	}
   679  
   680  	return nil
   681  }
   682  
   683  // TraceableFilterValidationError is the validation error returned by
   684  // TraceableFilter.Validate if the designated constraints aren't met.
   685  type TraceableFilterValidationError struct {
   686  	field  string
   687  	reason string
   688  	cause  error
   689  	key    bool
   690  }
   691  
   692  // Field function returns field value.
   693  func (e TraceableFilterValidationError) Field() string { return e.field }
   694  
   695  // Reason function returns reason value.
   696  func (e TraceableFilterValidationError) Reason() string { return e.reason }
   697  
   698  // Cause function returns cause value.
   699  func (e TraceableFilterValidationError) Cause() error { return e.cause }
   700  
   701  // Key function returns key value.
   702  func (e TraceableFilterValidationError) Key() bool { return e.key }
   703  
   704  // ErrorName returns error name.
   705  func (e TraceableFilterValidationError) ErrorName() string { return "TraceableFilterValidationError" }
   706  
   707  // Error satisfies the builtin error interface
   708  func (e TraceableFilterValidationError) Error() string {
   709  	cause := ""
   710  	if e.cause != nil {
   711  		cause = fmt.Sprintf(" | caused by: %v", e.cause)
   712  	}
   713  
   714  	key := ""
   715  	if e.key {
   716  		key = "key for "
   717  	}
   718  
   719  	return fmt.Sprintf(
   720  		"invalid %sTraceableFilter.%s: %s%s",
   721  		key,
   722  		e.field,
   723  		e.reason,
   724  		cause)
   725  }
   726  
   727  var _ error = TraceableFilterValidationError{}
   728  
   729  var _ interface {
   730  	Field() string
   731  	Reason() string
   732  	Key() bool
   733  	Cause() error
   734  	ErrorName() string
   735  } = TraceableFilterValidationError{}
   736  
   737  // Validate checks the field values on RuntimeFilter with the rules defined in
   738  // the proto definition for this message. If any rules are violated, an error
   739  // is returned.
   740  func (m *RuntimeFilter) Validate() error {
   741  	if m == nil {
   742  		return nil
   743  	}
   744  
   745  	if utf8.RuneCountInString(m.GetRuntimeKey()) < 1 {
   746  		return RuntimeFilterValidationError{
   747  			field:  "RuntimeKey",
   748  			reason: "value length must be at least 1 runes",
   749  		}
   750  	}
   751  
   752  	if v, ok := interface{}(m.GetPercentSampled()).(interface{ Validate() error }); ok {
   753  		if err := v.Validate(); err != nil {
   754  			return RuntimeFilterValidationError{
   755  				field:  "PercentSampled",
   756  				reason: "embedded message failed validation",
   757  				cause:  err,
   758  			}
   759  		}
   760  	}
   761  
   762  	// no validation rules for UseIndependentRandomness
   763  
   764  	return nil
   765  }
   766  
   767  // RuntimeFilterValidationError is the validation error returned by
   768  // RuntimeFilter.Validate if the designated constraints aren't met.
   769  type RuntimeFilterValidationError struct {
   770  	field  string
   771  	reason string
   772  	cause  error
   773  	key    bool
   774  }
   775  
   776  // Field function returns field value.
   777  func (e RuntimeFilterValidationError) Field() string { return e.field }
   778  
   779  // Reason function returns reason value.
   780  func (e RuntimeFilterValidationError) Reason() string { return e.reason }
   781  
   782  // Cause function returns cause value.
   783  func (e RuntimeFilterValidationError) Cause() error { return e.cause }
   784  
   785  // Key function returns key value.
   786  func (e RuntimeFilterValidationError) Key() bool { return e.key }
   787  
   788  // ErrorName returns error name.
   789  func (e RuntimeFilterValidationError) ErrorName() string { return "RuntimeFilterValidationError" }
   790  
   791  // Error satisfies the builtin error interface
   792  func (e RuntimeFilterValidationError) Error() string {
   793  	cause := ""
   794  	if e.cause != nil {
   795  		cause = fmt.Sprintf(" | caused by: %v", e.cause)
   796  	}
   797  
   798  	key := ""
   799  	if e.key {
   800  		key = "key for "
   801  	}
   802  
   803  	return fmt.Sprintf(
   804  		"invalid %sRuntimeFilter.%s: %s%s",
   805  		key,
   806  		e.field,
   807  		e.reason,
   808  		cause)
   809  }
   810  
   811  var _ error = RuntimeFilterValidationError{}
   812  
   813  var _ interface {
   814  	Field() string
   815  	Reason() string
   816  	Key() bool
   817  	Cause() error
   818  	ErrorName() string
   819  } = RuntimeFilterValidationError{}
   820  
   821  // Validate checks the field values on AndFilter with the rules defined in the
   822  // proto definition for this message. If any rules are violated, an error is returned.
   823  func (m *AndFilter) Validate() error {
   824  	if m == nil {
   825  		return nil
   826  	}
   827  
   828  	if len(m.GetFilters()) < 2 {
   829  		return AndFilterValidationError{
   830  			field:  "Filters",
   831  			reason: "value must contain at least 2 item(s)",
   832  		}
   833  	}
   834  
   835  	for idx, item := range m.GetFilters() {
   836  		_, _ = idx, item
   837  
   838  		if v, ok := interface{}(item).(interface{ Validate() error }); ok {
   839  			if err := v.Validate(); err != nil {
   840  				return AndFilterValidationError{
   841  					field:  fmt.Sprintf("Filters[%v]", idx),
   842  					reason: "embedded message failed validation",
   843  					cause:  err,
   844  				}
   845  			}
   846  		}
   847  
   848  	}
   849  
   850  	return nil
   851  }
   852  
   853  // AndFilterValidationError is the validation error returned by
   854  // AndFilter.Validate if the designated constraints aren't met.
   855  type AndFilterValidationError struct {
   856  	field  string
   857  	reason string
   858  	cause  error
   859  	key    bool
   860  }
   861  
   862  // Field function returns field value.
   863  func (e AndFilterValidationError) Field() string { return e.field }
   864  
   865  // Reason function returns reason value.
   866  func (e AndFilterValidationError) Reason() string { return e.reason }
   867  
   868  // Cause function returns cause value.
   869  func (e AndFilterValidationError) Cause() error { return e.cause }
   870  
   871  // Key function returns key value.
   872  func (e AndFilterValidationError) Key() bool { return e.key }
   873  
   874  // ErrorName returns error name.
   875  func (e AndFilterValidationError) ErrorName() string { return "AndFilterValidationError" }
   876  
   877  // Error satisfies the builtin error interface
   878  func (e AndFilterValidationError) Error() string {
   879  	cause := ""
   880  	if e.cause != nil {
   881  		cause = fmt.Sprintf(" | caused by: %v", e.cause)
   882  	}
   883  
   884  	key := ""
   885  	if e.key {
   886  		key = "key for "
   887  	}
   888  
   889  	return fmt.Sprintf(
   890  		"invalid %sAndFilter.%s: %s%s",
   891  		key,
   892  		e.field,
   893  		e.reason,
   894  		cause)
   895  }
   896  
   897  var _ error = AndFilterValidationError{}
   898  
   899  var _ interface {
   900  	Field() string
   901  	Reason() string
   902  	Key() bool
   903  	Cause() error
   904  	ErrorName() string
   905  } = AndFilterValidationError{}
   906  
   907  // Validate checks the field values on OrFilter with the rules defined in the
   908  // proto definition for this message. If any rules are violated, an error is returned.
   909  func (m *OrFilter) Validate() error {
   910  	if m == nil {
   911  		return nil
   912  	}
   913  
   914  	if len(m.GetFilters()) < 2 {
   915  		return OrFilterValidationError{
   916  			field:  "Filters",
   917  			reason: "value must contain at least 2 item(s)",
   918  		}
   919  	}
   920  
   921  	for idx, item := range m.GetFilters() {
   922  		_, _ = idx, item
   923  
   924  		if v, ok := interface{}(item).(interface{ Validate() error }); ok {
   925  			if err := v.Validate(); err != nil {
   926  				return OrFilterValidationError{
   927  					field:  fmt.Sprintf("Filters[%v]", idx),
   928  					reason: "embedded message failed validation",
   929  					cause:  err,
   930  				}
   931  			}
   932  		}
   933  
   934  	}
   935  
   936  	return nil
   937  }
   938  
   939  // OrFilterValidationError is the validation error returned by
   940  // OrFilter.Validate if the designated constraints aren't met.
   941  type OrFilterValidationError struct {
   942  	field  string
   943  	reason string
   944  	cause  error
   945  	key    bool
   946  }
   947  
   948  // Field function returns field value.
   949  func (e OrFilterValidationError) Field() string { return e.field }
   950  
   951  // Reason function returns reason value.
   952  func (e OrFilterValidationError) Reason() string { return e.reason }
   953  
   954  // Cause function returns cause value.
   955  func (e OrFilterValidationError) Cause() error { return e.cause }
   956  
   957  // Key function returns key value.
   958  func (e OrFilterValidationError) Key() bool { return e.key }
   959  
   960  // ErrorName returns error name.
   961  func (e OrFilterValidationError) ErrorName() string { return "OrFilterValidationError" }
   962  
   963  // Error satisfies the builtin error interface
   964  func (e OrFilterValidationError) Error() string {
   965  	cause := ""
   966  	if e.cause != nil {
   967  		cause = fmt.Sprintf(" | caused by: %v", e.cause)
   968  	}
   969  
   970  	key := ""
   971  	if e.key {
   972  		key = "key for "
   973  	}
   974  
   975  	return fmt.Sprintf(
   976  		"invalid %sOrFilter.%s: %s%s",
   977  		key,
   978  		e.field,
   979  		e.reason,
   980  		cause)
   981  }
   982  
   983  var _ error = OrFilterValidationError{}
   984  
   985  var _ interface {
   986  	Field() string
   987  	Reason() string
   988  	Key() bool
   989  	Cause() error
   990  	ErrorName() string
   991  } = OrFilterValidationError{}
   992  
   993  // Validate checks the field values on HeaderFilter with the rules defined in
   994  // the proto definition for this message. If any rules are violated, an error
   995  // is returned.
   996  func (m *HeaderFilter) Validate() error {
   997  	if m == nil {
   998  		return nil
   999  	}
  1000  
  1001  	if m.GetHeader() == nil {
  1002  		return HeaderFilterValidationError{
  1003  			field:  "Header",
  1004  			reason: "value is required",
  1005  		}
  1006  	}
  1007  
  1008  	if v, ok := interface{}(m.GetHeader()).(interface{ Validate() error }); ok {
  1009  		if err := v.Validate(); err != nil {
  1010  			return HeaderFilterValidationError{
  1011  				field:  "Header",
  1012  				reason: "embedded message failed validation",
  1013  				cause:  err,
  1014  			}
  1015  		}
  1016  	}
  1017  
  1018  	return nil
  1019  }
  1020  
  1021  // HeaderFilterValidationError is the validation error returned by
  1022  // HeaderFilter.Validate if the designated constraints aren't met.
  1023  type HeaderFilterValidationError struct {
  1024  	field  string
  1025  	reason string
  1026  	cause  error
  1027  	key    bool
  1028  }
  1029  
  1030  // Field function returns field value.
  1031  func (e HeaderFilterValidationError) Field() string { return e.field }
  1032  
  1033  // Reason function returns reason value.
  1034  func (e HeaderFilterValidationError) Reason() string { return e.reason }
  1035  
  1036  // Cause function returns cause value.
  1037  func (e HeaderFilterValidationError) Cause() error { return e.cause }
  1038  
  1039  // Key function returns key value.
  1040  func (e HeaderFilterValidationError) Key() bool { return e.key }
  1041  
  1042  // ErrorName returns error name.
  1043  func (e HeaderFilterValidationError) ErrorName() string { return "HeaderFilterValidationError" }
  1044  
  1045  // Error satisfies the builtin error interface
  1046  func (e HeaderFilterValidationError) Error() string {
  1047  	cause := ""
  1048  	if e.cause != nil {
  1049  		cause = fmt.Sprintf(" | caused by: %v", e.cause)
  1050  	}
  1051  
  1052  	key := ""
  1053  	if e.key {
  1054  		key = "key for "
  1055  	}
  1056  
  1057  	return fmt.Sprintf(
  1058  		"invalid %sHeaderFilter.%s: %s%s",
  1059  		key,
  1060  		e.field,
  1061  		e.reason,
  1062  		cause)
  1063  }
  1064  
  1065  var _ error = HeaderFilterValidationError{}
  1066  
  1067  var _ interface {
  1068  	Field() string
  1069  	Reason() string
  1070  	Key() bool
  1071  	Cause() error
  1072  	ErrorName() string
  1073  } = HeaderFilterValidationError{}
  1074  
  1075  // Validate checks the field values on ResponseFlagFilter with the rules
  1076  // defined in the proto definition for this message. If any rules are
  1077  // violated, an error is returned.
  1078  func (m *ResponseFlagFilter) Validate() error {
  1079  	if m == nil {
  1080  		return nil
  1081  	}
  1082  
  1083  	for idx, item := range m.GetFlags() {
  1084  		_, _ = idx, item
  1085  
  1086  		if _, ok := _ResponseFlagFilter_Flags_InLookup[item]; !ok {
  1087  			return ResponseFlagFilterValidationError{
  1088  				field:  fmt.Sprintf("Flags[%v]", idx),
  1089  				reason: "value must be in list [LH UH UT LR UR UF UC UO NR DI FI RL UAEX RLSE DC URX SI IH DPE UMSDR RFCF NFCF DT UPE NC OM]",
  1090  			}
  1091  		}
  1092  
  1093  	}
  1094  
  1095  	return nil
  1096  }
  1097  
  1098  // ResponseFlagFilterValidationError is the validation error returned by
  1099  // ResponseFlagFilter.Validate if the designated constraints aren't met.
  1100  type ResponseFlagFilterValidationError struct {
  1101  	field  string
  1102  	reason string
  1103  	cause  error
  1104  	key    bool
  1105  }
  1106  
  1107  // Field function returns field value.
  1108  func (e ResponseFlagFilterValidationError) Field() string { return e.field }
  1109  
  1110  // Reason function returns reason value.
  1111  func (e ResponseFlagFilterValidationError) Reason() string { return e.reason }
  1112  
  1113  // Cause function returns cause value.
  1114  func (e ResponseFlagFilterValidationError) Cause() error { return e.cause }
  1115  
  1116  // Key function returns key value.
  1117  func (e ResponseFlagFilterValidationError) Key() bool { return e.key }
  1118  
  1119  // ErrorName returns error name.
  1120  func (e ResponseFlagFilterValidationError) ErrorName() string {
  1121  	return "ResponseFlagFilterValidationError"
  1122  }
  1123  
  1124  // Error satisfies the builtin error interface
  1125  func (e ResponseFlagFilterValidationError) Error() string {
  1126  	cause := ""
  1127  	if e.cause != nil {
  1128  		cause = fmt.Sprintf(" | caused by: %v", e.cause)
  1129  	}
  1130  
  1131  	key := ""
  1132  	if e.key {
  1133  		key = "key for "
  1134  	}
  1135  
  1136  	return fmt.Sprintf(
  1137  		"invalid %sResponseFlagFilter.%s: %s%s",
  1138  		key,
  1139  		e.field,
  1140  		e.reason,
  1141  		cause)
  1142  }
  1143  
  1144  var _ error = ResponseFlagFilterValidationError{}
  1145  
  1146  var _ interface {
  1147  	Field() string
  1148  	Reason() string
  1149  	Key() bool
  1150  	Cause() error
  1151  	ErrorName() string
  1152  } = ResponseFlagFilterValidationError{}
  1153  
  1154  var _ResponseFlagFilter_Flags_InLookup = map[string]struct{}{
  1155  	"LH":    {},
  1156  	"UH":    {},
  1157  	"UT":    {},
  1158  	"LR":    {},
  1159  	"UR":    {},
  1160  	"UF":    {},
  1161  	"UC":    {},
  1162  	"UO":    {},
  1163  	"NR":    {},
  1164  	"DI":    {},
  1165  	"FI":    {},
  1166  	"RL":    {},
  1167  	"UAEX":  {},
  1168  	"RLSE":  {},
  1169  	"DC":    {},
  1170  	"URX":   {},
  1171  	"SI":    {},
  1172  	"IH":    {},
  1173  	"DPE":   {},
  1174  	"UMSDR": {},
  1175  	"RFCF":  {},
  1176  	"NFCF":  {},
  1177  	"DT":    {},
  1178  	"UPE":   {},
  1179  	"NC":    {},
  1180  	"OM":    {},
  1181  }
  1182  
  1183  // Validate checks the field values on GrpcStatusFilter with the rules defined
  1184  // in the proto definition for this message. If any rules are violated, an
  1185  // error is returned.
  1186  func (m *GrpcStatusFilter) Validate() error {
  1187  	if m == nil {
  1188  		return nil
  1189  	}
  1190  
  1191  	for idx, item := range m.GetStatuses() {
  1192  		_, _ = idx, item
  1193  
  1194  		if _, ok := GrpcStatusFilter_Status_name[int32(item)]; !ok {
  1195  			return GrpcStatusFilterValidationError{
  1196  				field:  fmt.Sprintf("Statuses[%v]", idx),
  1197  				reason: "value must be one of the defined enum values",
  1198  			}
  1199  		}
  1200  
  1201  	}
  1202  
  1203  	// no validation rules for Exclude
  1204  
  1205  	return nil
  1206  }
  1207  
  1208  // GrpcStatusFilterValidationError is the validation error returned by
  1209  // GrpcStatusFilter.Validate if the designated constraints aren't met.
  1210  type GrpcStatusFilterValidationError struct {
  1211  	field  string
  1212  	reason string
  1213  	cause  error
  1214  	key    bool
  1215  }
  1216  
  1217  // Field function returns field value.
  1218  func (e GrpcStatusFilterValidationError) Field() string { return e.field }
  1219  
  1220  // Reason function returns reason value.
  1221  func (e GrpcStatusFilterValidationError) Reason() string { return e.reason }
  1222  
  1223  // Cause function returns cause value.
  1224  func (e GrpcStatusFilterValidationError) Cause() error { return e.cause }
  1225  
  1226  // Key function returns key value.
  1227  func (e GrpcStatusFilterValidationError) Key() bool { return e.key }
  1228  
  1229  // ErrorName returns error name.
  1230  func (e GrpcStatusFilterValidationError) ErrorName() string { return "GrpcStatusFilterValidationError" }
  1231  
  1232  // Error satisfies the builtin error interface
  1233  func (e GrpcStatusFilterValidationError) Error() string {
  1234  	cause := ""
  1235  	if e.cause != nil {
  1236  		cause = fmt.Sprintf(" | caused by: %v", e.cause)
  1237  	}
  1238  
  1239  	key := ""
  1240  	if e.key {
  1241  		key = "key for "
  1242  	}
  1243  
  1244  	return fmt.Sprintf(
  1245  		"invalid %sGrpcStatusFilter.%s: %s%s",
  1246  		key,
  1247  		e.field,
  1248  		e.reason,
  1249  		cause)
  1250  }
  1251  
  1252  var _ error = GrpcStatusFilterValidationError{}
  1253  
  1254  var _ interface {
  1255  	Field() string
  1256  	Reason() string
  1257  	Key() bool
  1258  	Cause() error
  1259  	ErrorName() string
  1260  } = GrpcStatusFilterValidationError{}
  1261  
  1262  // Validate checks the field values on MetadataFilter with the rules defined in
  1263  // the proto definition for this message. If any rules are violated, an error
  1264  // is returned.
  1265  func (m *MetadataFilter) Validate() error {
  1266  	if m == nil {
  1267  		return nil
  1268  	}
  1269  
  1270  	if v, ok := interface{}(m.GetMatcher()).(interface{ Validate() error }); ok {
  1271  		if err := v.Validate(); err != nil {
  1272  			return MetadataFilterValidationError{
  1273  				field:  "Matcher",
  1274  				reason: "embedded message failed validation",
  1275  				cause:  err,
  1276  			}
  1277  		}
  1278  	}
  1279  
  1280  	if v, ok := interface{}(m.GetMatchIfKeyNotFound()).(interface{ Validate() error }); ok {
  1281  		if err := v.Validate(); err != nil {
  1282  			return MetadataFilterValidationError{
  1283  				field:  "MatchIfKeyNotFound",
  1284  				reason: "embedded message failed validation",
  1285  				cause:  err,
  1286  			}
  1287  		}
  1288  	}
  1289  
  1290  	return nil
  1291  }
  1292  
  1293  // MetadataFilterValidationError is the validation error returned by
  1294  // MetadataFilter.Validate if the designated constraints aren't met.
  1295  type MetadataFilterValidationError struct {
  1296  	field  string
  1297  	reason string
  1298  	cause  error
  1299  	key    bool
  1300  }
  1301  
  1302  // Field function returns field value.
  1303  func (e MetadataFilterValidationError) Field() string { return e.field }
  1304  
  1305  // Reason function returns reason value.
  1306  func (e MetadataFilterValidationError) Reason() string { return e.reason }
  1307  
  1308  // Cause function returns cause value.
  1309  func (e MetadataFilterValidationError) Cause() error { return e.cause }
  1310  
  1311  // Key function returns key value.
  1312  func (e MetadataFilterValidationError) Key() bool { return e.key }
  1313  
  1314  // ErrorName returns error name.
  1315  func (e MetadataFilterValidationError) ErrorName() string { return "MetadataFilterValidationError" }
  1316  
  1317  // Error satisfies the builtin error interface
  1318  func (e MetadataFilterValidationError) Error() string {
  1319  	cause := ""
  1320  	if e.cause != nil {
  1321  		cause = fmt.Sprintf(" | caused by: %v", e.cause)
  1322  	}
  1323  
  1324  	key := ""
  1325  	if e.key {
  1326  		key = "key for "
  1327  	}
  1328  
  1329  	return fmt.Sprintf(
  1330  		"invalid %sMetadataFilter.%s: %s%s",
  1331  		key,
  1332  		e.field,
  1333  		e.reason,
  1334  		cause)
  1335  }
  1336  
  1337  var _ error = MetadataFilterValidationError{}
  1338  
  1339  var _ interface {
  1340  	Field() string
  1341  	Reason() string
  1342  	Key() bool
  1343  	Cause() error
  1344  	ErrorName() string
  1345  } = MetadataFilterValidationError{}
  1346  
  1347  // Validate checks the field values on ExtensionFilter with the rules defined
  1348  // in the proto definition for this message. If any rules are violated, an
  1349  // error is returned.
  1350  func (m *ExtensionFilter) Validate() error {
  1351  	if m == nil {
  1352  		return nil
  1353  	}
  1354  
  1355  	// no validation rules for Name
  1356  
  1357  	switch m.ConfigType.(type) {
  1358  
  1359  	case *ExtensionFilter_TypedConfig:
  1360  
  1361  		if v, ok := interface{}(m.GetTypedConfig()).(interface{ Validate() error }); ok {
  1362  			if err := v.Validate(); err != nil {
  1363  				return ExtensionFilterValidationError{
  1364  					field:  "TypedConfig",
  1365  					reason: "embedded message failed validation",
  1366  					cause:  err,
  1367  				}
  1368  			}
  1369  		}
  1370  
  1371  	case *ExtensionFilter_HiddenEnvoyDeprecatedConfig:
  1372  
  1373  		if v, ok := interface{}(m.GetHiddenEnvoyDeprecatedConfig()).(interface{ Validate() error }); ok {
  1374  			if err := v.Validate(); err != nil {
  1375  				return ExtensionFilterValidationError{
  1376  					field:  "HiddenEnvoyDeprecatedConfig",
  1377  					reason: "embedded message failed validation",
  1378  					cause:  err,
  1379  				}
  1380  			}
  1381  		}
  1382  
  1383  	}
  1384  
  1385  	return nil
  1386  }
  1387  
  1388  // ExtensionFilterValidationError is the validation error returned by
  1389  // ExtensionFilter.Validate if the designated constraints aren't met.
  1390  type ExtensionFilterValidationError struct {
  1391  	field  string
  1392  	reason string
  1393  	cause  error
  1394  	key    bool
  1395  }
  1396  
  1397  // Field function returns field value.
  1398  func (e ExtensionFilterValidationError) Field() string { return e.field }
  1399  
  1400  // Reason function returns reason value.
  1401  func (e ExtensionFilterValidationError) Reason() string { return e.reason }
  1402  
  1403  // Cause function returns cause value.
  1404  func (e ExtensionFilterValidationError) Cause() error { return e.cause }
  1405  
  1406  // Key function returns key value.
  1407  func (e ExtensionFilterValidationError) Key() bool { return e.key }
  1408  
  1409  // ErrorName returns error name.
  1410  func (e ExtensionFilterValidationError) ErrorName() string { return "ExtensionFilterValidationError" }
  1411  
  1412  // Error satisfies the builtin error interface
  1413  func (e ExtensionFilterValidationError) Error() string {
  1414  	cause := ""
  1415  	if e.cause != nil {
  1416  		cause = fmt.Sprintf(" | caused by: %v", e.cause)
  1417  	}
  1418  
  1419  	key := ""
  1420  	if e.key {
  1421  		key = "key for "
  1422  	}
  1423  
  1424  	return fmt.Sprintf(
  1425  		"invalid %sExtensionFilter.%s: %s%s",
  1426  		key,
  1427  		e.field,
  1428  		e.reason,
  1429  		cause)
  1430  }
  1431  
  1432  var _ error = ExtensionFilterValidationError{}
  1433  
  1434  var _ interface {
  1435  	Field() string
  1436  	Reason() string
  1437  	Key() bool
  1438  	Cause() error
  1439  	ErrorName() string
  1440  } = ExtensionFilterValidationError{}