github.com/hxx258456/ccgo@v0.0.5-0.20230213014102-48b35f46f66f/go-control-plane/envoy/data/tap/v3/transport.pb.validate.go (about)

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