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

     1  // Code generated by protoc-gen-validate. DO NOT EDIT.
     2  // source: envoy/api/v2/listener.proto
     3  
     4  package envoy_api_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.TrafficDirection(0)
    38  )
    39  
    40  // Validate checks the field values on Listener with the rules defined in the
    41  // proto definition for this message. If any rules are violated, an error is returned.
    42  func (m *Listener) Validate() error {
    43  	if m == nil {
    44  		return nil
    45  	}
    46  
    47  	// no validation rules for Name
    48  
    49  	if m.GetAddress() == nil {
    50  		return ListenerValidationError{
    51  			field:  "Address",
    52  			reason: "value is required",
    53  		}
    54  	}
    55  
    56  	if v, ok := interface{}(m.GetAddress()).(interface{ Validate() error }); ok {
    57  		if err := v.Validate(); err != nil {
    58  			return ListenerValidationError{
    59  				field:  "Address",
    60  				reason: "embedded message failed validation",
    61  				cause:  err,
    62  			}
    63  		}
    64  	}
    65  
    66  	for idx, item := range m.GetFilterChains() {
    67  		_, _ = idx, item
    68  
    69  		if v, ok := interface{}(item).(interface{ Validate() error }); ok {
    70  			if err := v.Validate(); err != nil {
    71  				return ListenerValidationError{
    72  					field:  fmt.Sprintf("FilterChains[%v]", idx),
    73  					reason: "embedded message failed validation",
    74  					cause:  err,
    75  				}
    76  			}
    77  		}
    78  
    79  	}
    80  
    81  	if v, ok := interface{}(m.GetUseOriginalDst()).(interface{ Validate() error }); ok {
    82  		if err := v.Validate(); err != nil {
    83  			return ListenerValidationError{
    84  				field:  "UseOriginalDst",
    85  				reason: "embedded message failed validation",
    86  				cause:  err,
    87  			}
    88  		}
    89  	}
    90  
    91  	if v, ok := interface{}(m.GetPerConnectionBufferLimitBytes()).(interface{ Validate() error }); ok {
    92  		if err := v.Validate(); err != nil {
    93  			return ListenerValidationError{
    94  				field:  "PerConnectionBufferLimitBytes",
    95  				reason: "embedded message failed validation",
    96  				cause:  err,
    97  			}
    98  		}
    99  	}
   100  
   101  	if v, ok := interface{}(m.GetMetadata()).(interface{ Validate() error }); ok {
   102  		if err := v.Validate(); err != nil {
   103  			return ListenerValidationError{
   104  				field:  "Metadata",
   105  				reason: "embedded message failed validation",
   106  				cause:  err,
   107  			}
   108  		}
   109  	}
   110  
   111  	if v, ok := interface{}(m.GetDeprecatedV1()).(interface{ Validate() error }); ok {
   112  		if err := v.Validate(); err != nil {
   113  			return ListenerValidationError{
   114  				field:  "DeprecatedV1",
   115  				reason: "embedded message failed validation",
   116  				cause:  err,
   117  			}
   118  		}
   119  	}
   120  
   121  	// no validation rules for DrainType
   122  
   123  	for idx, item := range m.GetListenerFilters() {
   124  		_, _ = idx, item
   125  
   126  		if v, ok := interface{}(item).(interface{ Validate() error }); ok {
   127  			if err := v.Validate(); err != nil {
   128  				return ListenerValidationError{
   129  					field:  fmt.Sprintf("ListenerFilters[%v]", idx),
   130  					reason: "embedded message failed validation",
   131  					cause:  err,
   132  				}
   133  			}
   134  		}
   135  
   136  	}
   137  
   138  	if v, ok := interface{}(m.GetListenerFiltersTimeout()).(interface{ Validate() error }); ok {
   139  		if err := v.Validate(); err != nil {
   140  			return ListenerValidationError{
   141  				field:  "ListenerFiltersTimeout",
   142  				reason: "embedded message failed validation",
   143  				cause:  err,
   144  			}
   145  		}
   146  	}
   147  
   148  	// no validation rules for ContinueOnListenerFiltersTimeout
   149  
   150  	if v, ok := interface{}(m.GetTransparent()).(interface{ Validate() error }); ok {
   151  		if err := v.Validate(); err != nil {
   152  			return ListenerValidationError{
   153  				field:  "Transparent",
   154  				reason: "embedded message failed validation",
   155  				cause:  err,
   156  			}
   157  		}
   158  	}
   159  
   160  	if v, ok := interface{}(m.GetFreebind()).(interface{ Validate() error }); ok {
   161  		if err := v.Validate(); err != nil {
   162  			return ListenerValidationError{
   163  				field:  "Freebind",
   164  				reason: "embedded message failed validation",
   165  				cause:  err,
   166  			}
   167  		}
   168  	}
   169  
   170  	for idx, item := range m.GetSocketOptions() {
   171  		_, _ = idx, item
   172  
   173  		if v, ok := interface{}(item).(interface{ Validate() error }); ok {
   174  			if err := v.Validate(); err != nil {
   175  				return ListenerValidationError{
   176  					field:  fmt.Sprintf("SocketOptions[%v]", idx),
   177  					reason: "embedded message failed validation",
   178  					cause:  err,
   179  				}
   180  			}
   181  		}
   182  
   183  	}
   184  
   185  	if v, ok := interface{}(m.GetTcpFastOpenQueueLength()).(interface{ Validate() error }); ok {
   186  		if err := v.Validate(); err != nil {
   187  			return ListenerValidationError{
   188  				field:  "TcpFastOpenQueueLength",
   189  				reason: "embedded message failed validation",
   190  				cause:  err,
   191  			}
   192  		}
   193  	}
   194  
   195  	// no validation rules for TrafficDirection
   196  
   197  	if v, ok := interface{}(m.GetUdpListenerConfig()).(interface{ Validate() error }); ok {
   198  		if err := v.Validate(); err != nil {
   199  			return ListenerValidationError{
   200  				field:  "UdpListenerConfig",
   201  				reason: "embedded message failed validation",
   202  				cause:  err,
   203  			}
   204  		}
   205  	}
   206  
   207  	if v, ok := interface{}(m.GetApiListener()).(interface{ Validate() error }); ok {
   208  		if err := v.Validate(); err != nil {
   209  			return ListenerValidationError{
   210  				field:  "ApiListener",
   211  				reason: "embedded message failed validation",
   212  				cause:  err,
   213  			}
   214  		}
   215  	}
   216  
   217  	if v, ok := interface{}(m.GetConnectionBalanceConfig()).(interface{ Validate() error }); ok {
   218  		if err := v.Validate(); err != nil {
   219  			return ListenerValidationError{
   220  				field:  "ConnectionBalanceConfig",
   221  				reason: "embedded message failed validation",
   222  				cause:  err,
   223  			}
   224  		}
   225  	}
   226  
   227  	// no validation rules for ReusePort
   228  
   229  	for idx, item := range m.GetAccessLog() {
   230  		_, _ = idx, item
   231  
   232  		if v, ok := interface{}(item).(interface{ Validate() error }); ok {
   233  			if err := v.Validate(); err != nil {
   234  				return ListenerValidationError{
   235  					field:  fmt.Sprintf("AccessLog[%v]", idx),
   236  					reason: "embedded message failed validation",
   237  					cause:  err,
   238  				}
   239  			}
   240  		}
   241  
   242  	}
   243  
   244  	return nil
   245  }
   246  
   247  // ListenerValidationError is the validation error returned by
   248  // Listener.Validate if the designated constraints aren't met.
   249  type ListenerValidationError struct {
   250  	field  string
   251  	reason string
   252  	cause  error
   253  	key    bool
   254  }
   255  
   256  // Field function returns field value.
   257  func (e ListenerValidationError) Field() string { return e.field }
   258  
   259  // Reason function returns reason value.
   260  func (e ListenerValidationError) Reason() string { return e.reason }
   261  
   262  // Cause function returns cause value.
   263  func (e ListenerValidationError) Cause() error { return e.cause }
   264  
   265  // Key function returns key value.
   266  func (e ListenerValidationError) Key() bool { return e.key }
   267  
   268  // ErrorName returns error name.
   269  func (e ListenerValidationError) ErrorName() string { return "ListenerValidationError" }
   270  
   271  // Error satisfies the builtin error interface
   272  func (e ListenerValidationError) Error() string {
   273  	cause := ""
   274  	if e.cause != nil {
   275  		cause = fmt.Sprintf(" | caused by: %v", e.cause)
   276  	}
   277  
   278  	key := ""
   279  	if e.key {
   280  		key = "key for "
   281  	}
   282  
   283  	return fmt.Sprintf(
   284  		"invalid %sListener.%s: %s%s",
   285  		key,
   286  		e.field,
   287  		e.reason,
   288  		cause)
   289  }
   290  
   291  var _ error = ListenerValidationError{}
   292  
   293  var _ interface {
   294  	Field() string
   295  	Reason() string
   296  	Key() bool
   297  	Cause() error
   298  	ErrorName() string
   299  } = ListenerValidationError{}
   300  
   301  // Validate checks the field values on Listener_DeprecatedV1 with the rules
   302  // defined in the proto definition for this message. If any rules are
   303  // violated, an error is returned.
   304  func (m *Listener_DeprecatedV1) Validate() error {
   305  	if m == nil {
   306  		return nil
   307  	}
   308  
   309  	if v, ok := interface{}(m.GetBindToPort()).(interface{ Validate() error }); ok {
   310  		if err := v.Validate(); err != nil {
   311  			return Listener_DeprecatedV1ValidationError{
   312  				field:  "BindToPort",
   313  				reason: "embedded message failed validation",
   314  				cause:  err,
   315  			}
   316  		}
   317  	}
   318  
   319  	return nil
   320  }
   321  
   322  // Listener_DeprecatedV1ValidationError is the validation error returned by
   323  // Listener_DeprecatedV1.Validate if the designated constraints aren't met.
   324  type Listener_DeprecatedV1ValidationError struct {
   325  	field  string
   326  	reason string
   327  	cause  error
   328  	key    bool
   329  }
   330  
   331  // Field function returns field value.
   332  func (e Listener_DeprecatedV1ValidationError) Field() string { return e.field }
   333  
   334  // Reason function returns reason value.
   335  func (e Listener_DeprecatedV1ValidationError) Reason() string { return e.reason }
   336  
   337  // Cause function returns cause value.
   338  func (e Listener_DeprecatedV1ValidationError) Cause() error { return e.cause }
   339  
   340  // Key function returns key value.
   341  func (e Listener_DeprecatedV1ValidationError) Key() bool { return e.key }
   342  
   343  // ErrorName returns error name.
   344  func (e Listener_DeprecatedV1ValidationError) ErrorName() string {
   345  	return "Listener_DeprecatedV1ValidationError"
   346  }
   347  
   348  // Error satisfies the builtin error interface
   349  func (e Listener_DeprecatedV1ValidationError) Error() string {
   350  	cause := ""
   351  	if e.cause != nil {
   352  		cause = fmt.Sprintf(" | caused by: %v", e.cause)
   353  	}
   354  
   355  	key := ""
   356  	if e.key {
   357  		key = "key for "
   358  	}
   359  
   360  	return fmt.Sprintf(
   361  		"invalid %sListener_DeprecatedV1.%s: %s%s",
   362  		key,
   363  		e.field,
   364  		e.reason,
   365  		cause)
   366  }
   367  
   368  var _ error = Listener_DeprecatedV1ValidationError{}
   369  
   370  var _ interface {
   371  	Field() string
   372  	Reason() string
   373  	Key() bool
   374  	Cause() error
   375  	ErrorName() string
   376  } = Listener_DeprecatedV1ValidationError{}
   377  
   378  // Validate checks the field values on Listener_ConnectionBalanceConfig with
   379  // the rules defined in the proto definition for this message. If any rules
   380  // are violated, an error is returned.
   381  func (m *Listener_ConnectionBalanceConfig) Validate() error {
   382  	if m == nil {
   383  		return nil
   384  	}
   385  
   386  	switch m.BalanceType.(type) {
   387  
   388  	case *Listener_ConnectionBalanceConfig_ExactBalance_:
   389  
   390  		if v, ok := interface{}(m.GetExactBalance()).(interface{ Validate() error }); ok {
   391  			if err := v.Validate(); err != nil {
   392  				return Listener_ConnectionBalanceConfigValidationError{
   393  					field:  "ExactBalance",
   394  					reason: "embedded message failed validation",
   395  					cause:  err,
   396  				}
   397  			}
   398  		}
   399  
   400  	default:
   401  		return Listener_ConnectionBalanceConfigValidationError{
   402  			field:  "BalanceType",
   403  			reason: "value is required",
   404  		}
   405  
   406  	}
   407  
   408  	return nil
   409  }
   410  
   411  // Listener_ConnectionBalanceConfigValidationError is the validation error
   412  // returned by Listener_ConnectionBalanceConfig.Validate if the designated
   413  // constraints aren't met.
   414  type Listener_ConnectionBalanceConfigValidationError struct {
   415  	field  string
   416  	reason string
   417  	cause  error
   418  	key    bool
   419  }
   420  
   421  // Field function returns field value.
   422  func (e Listener_ConnectionBalanceConfigValidationError) Field() string { return e.field }
   423  
   424  // Reason function returns reason value.
   425  func (e Listener_ConnectionBalanceConfigValidationError) Reason() string { return e.reason }
   426  
   427  // Cause function returns cause value.
   428  func (e Listener_ConnectionBalanceConfigValidationError) Cause() error { return e.cause }
   429  
   430  // Key function returns key value.
   431  func (e Listener_ConnectionBalanceConfigValidationError) Key() bool { return e.key }
   432  
   433  // ErrorName returns error name.
   434  func (e Listener_ConnectionBalanceConfigValidationError) ErrorName() string {
   435  	return "Listener_ConnectionBalanceConfigValidationError"
   436  }
   437  
   438  // Error satisfies the builtin error interface
   439  func (e Listener_ConnectionBalanceConfigValidationError) Error() string {
   440  	cause := ""
   441  	if e.cause != nil {
   442  		cause = fmt.Sprintf(" | caused by: %v", e.cause)
   443  	}
   444  
   445  	key := ""
   446  	if e.key {
   447  		key = "key for "
   448  	}
   449  
   450  	return fmt.Sprintf(
   451  		"invalid %sListener_ConnectionBalanceConfig.%s: %s%s",
   452  		key,
   453  		e.field,
   454  		e.reason,
   455  		cause)
   456  }
   457  
   458  var _ error = Listener_ConnectionBalanceConfigValidationError{}
   459  
   460  var _ interface {
   461  	Field() string
   462  	Reason() string
   463  	Key() bool
   464  	Cause() error
   465  	ErrorName() string
   466  } = Listener_ConnectionBalanceConfigValidationError{}
   467  
   468  // Validate checks the field values on
   469  // Listener_ConnectionBalanceConfig_ExactBalance with the rules defined in the
   470  // proto definition for this message. If any rules are violated, an error is returned.
   471  func (m *Listener_ConnectionBalanceConfig_ExactBalance) Validate() error {
   472  	if m == nil {
   473  		return nil
   474  	}
   475  
   476  	return nil
   477  }
   478  
   479  // Listener_ConnectionBalanceConfig_ExactBalanceValidationError is the
   480  // validation error returned by
   481  // Listener_ConnectionBalanceConfig_ExactBalance.Validate if the designated
   482  // constraints aren't met.
   483  type Listener_ConnectionBalanceConfig_ExactBalanceValidationError struct {
   484  	field  string
   485  	reason string
   486  	cause  error
   487  	key    bool
   488  }
   489  
   490  // Field function returns field value.
   491  func (e Listener_ConnectionBalanceConfig_ExactBalanceValidationError) Field() string { return e.field }
   492  
   493  // Reason function returns reason value.
   494  func (e Listener_ConnectionBalanceConfig_ExactBalanceValidationError) Reason() string {
   495  	return e.reason
   496  }
   497  
   498  // Cause function returns cause value.
   499  func (e Listener_ConnectionBalanceConfig_ExactBalanceValidationError) Cause() error { return e.cause }
   500  
   501  // Key function returns key value.
   502  func (e Listener_ConnectionBalanceConfig_ExactBalanceValidationError) Key() bool { return e.key }
   503  
   504  // ErrorName returns error name.
   505  func (e Listener_ConnectionBalanceConfig_ExactBalanceValidationError) ErrorName() string {
   506  	return "Listener_ConnectionBalanceConfig_ExactBalanceValidationError"
   507  }
   508  
   509  // Error satisfies the builtin error interface
   510  func (e Listener_ConnectionBalanceConfig_ExactBalanceValidationError) Error() string {
   511  	cause := ""
   512  	if e.cause != nil {
   513  		cause = fmt.Sprintf(" | caused by: %v", e.cause)
   514  	}
   515  
   516  	key := ""
   517  	if e.key {
   518  		key = "key for "
   519  	}
   520  
   521  	return fmt.Sprintf(
   522  		"invalid %sListener_ConnectionBalanceConfig_ExactBalance.%s: %s%s",
   523  		key,
   524  		e.field,
   525  		e.reason,
   526  		cause)
   527  }
   528  
   529  var _ error = Listener_ConnectionBalanceConfig_ExactBalanceValidationError{}
   530  
   531  var _ interface {
   532  	Field() string
   533  	Reason() string
   534  	Key() bool
   535  	Cause() error
   536  	ErrorName() string
   537  } = Listener_ConnectionBalanceConfig_ExactBalanceValidationError{}