...

Source file src/github.com/emissary-ingress/emissary/v3/pkg/api/envoy/data/tap/v2alpha/transport.pb.validate.go

Documentation: github.com/emissary-ingress/emissary/v3/pkg/api/envoy/data/tap/v2alpha

     1  // Code generated by protoc-gen-validate. DO NOT EDIT.
     2  // source: envoy/data/tap/v2alpha/transport.proto
     3  
     4  package v2alpha
     5  
     6  import (
     7  	"bytes"
     8  	"errors"
     9  	"fmt"
    10  	"net"
    11  	"net/mail"
    12  	"net/url"
    13  	"regexp"
    14  	"sort"
    15  	"strings"
    16  	"time"
    17  	"unicode/utf8"
    18  
    19  	"google.golang.org/protobuf/types/known/anypb"
    20  )
    21  
    22  // ensure the imports are used
    23  var (
    24  	_ = bytes.MinRead
    25  	_ = errors.New("")
    26  	_ = fmt.Print
    27  	_ = utf8.UTFMax
    28  	_ = (*regexp.Regexp)(nil)
    29  	_ = (*strings.Reader)(nil)
    30  	_ = net.IPv4len
    31  	_ = time.Duration(0)
    32  	_ = (*url.URL)(nil)
    33  	_ = (*mail.Address)(nil)
    34  	_ = anypb.Any{}
    35  	_ = sort.Sort
    36  )
    37  
    38  // Validate checks the field values on Connection with the rules defined in the
    39  // proto definition for this message. If any rules are violated, the first
    40  // error encountered is returned, or nil if there are no violations.
    41  func (m *Connection) Validate() error {
    42  	return m.validate(false)
    43  }
    44  
    45  // ValidateAll checks the field values on Connection with the rules defined in
    46  // the proto definition for this message. If any rules are violated, the
    47  // result is a list of violation errors wrapped in ConnectionMultiError, or
    48  // nil if none found.
    49  func (m *Connection) ValidateAll() error {
    50  	return m.validate(true)
    51  }
    52  
    53  func (m *Connection) validate(all bool) error {
    54  	if m == nil {
    55  		return nil
    56  	}
    57  
    58  	var errors []error
    59  
    60  	if all {
    61  		switch v := interface{}(m.GetLocalAddress()).(type) {
    62  		case interface{ ValidateAll() error }:
    63  			if err := v.ValidateAll(); err != nil {
    64  				errors = append(errors, ConnectionValidationError{
    65  					field:  "LocalAddress",
    66  					reason: "embedded message failed validation",
    67  					cause:  err,
    68  				})
    69  			}
    70  		case interface{ Validate() error }:
    71  			if err := v.Validate(); err != nil {
    72  				errors = append(errors, ConnectionValidationError{
    73  					field:  "LocalAddress",
    74  					reason: "embedded message failed validation",
    75  					cause:  err,
    76  				})
    77  			}
    78  		}
    79  	} else if v, ok := interface{}(m.GetLocalAddress()).(interface{ Validate() error }); ok {
    80  		if err := v.Validate(); err != nil {
    81  			return ConnectionValidationError{
    82  				field:  "LocalAddress",
    83  				reason: "embedded message failed validation",
    84  				cause:  err,
    85  			}
    86  		}
    87  	}
    88  
    89  	if all {
    90  		switch v := interface{}(m.GetRemoteAddress()).(type) {
    91  		case interface{ ValidateAll() error }:
    92  			if err := v.ValidateAll(); err != nil {
    93  				errors = append(errors, ConnectionValidationError{
    94  					field:  "RemoteAddress",
    95  					reason: "embedded message failed validation",
    96  					cause:  err,
    97  				})
    98  			}
    99  		case interface{ Validate() error }:
   100  			if err := v.Validate(); err != nil {
   101  				errors = append(errors, ConnectionValidationError{
   102  					field:  "RemoteAddress",
   103  					reason: "embedded message failed validation",
   104  					cause:  err,
   105  				})
   106  			}
   107  		}
   108  	} else if v, ok := interface{}(m.GetRemoteAddress()).(interface{ Validate() error }); ok {
   109  		if err := v.Validate(); err != nil {
   110  			return ConnectionValidationError{
   111  				field:  "RemoteAddress",
   112  				reason: "embedded message failed validation",
   113  				cause:  err,
   114  			}
   115  		}
   116  	}
   117  
   118  	if len(errors) > 0 {
   119  		return ConnectionMultiError(errors)
   120  	}
   121  
   122  	return nil
   123  }
   124  
   125  // ConnectionMultiError is an error wrapping multiple validation errors
   126  // returned by Connection.ValidateAll() if the designated constraints aren't met.
   127  type ConnectionMultiError []error
   128  
   129  // Error returns a concatenation of all the error messages it wraps.
   130  func (m ConnectionMultiError) Error() string {
   131  	var msgs []string
   132  	for _, err := range m {
   133  		msgs = append(msgs, err.Error())
   134  	}
   135  	return strings.Join(msgs, "; ")
   136  }
   137  
   138  // AllErrors returns a list of validation violation errors.
   139  func (m ConnectionMultiError) AllErrors() []error { return m }
   140  
   141  // ConnectionValidationError is the validation error returned by
   142  // Connection.Validate if the designated constraints aren't met.
   143  type ConnectionValidationError struct {
   144  	field  string
   145  	reason string
   146  	cause  error
   147  	key    bool
   148  }
   149  
   150  // Field function returns field value.
   151  func (e ConnectionValidationError) Field() string { return e.field }
   152  
   153  // Reason function returns reason value.
   154  func (e ConnectionValidationError) Reason() string { return e.reason }
   155  
   156  // Cause function returns cause value.
   157  func (e ConnectionValidationError) Cause() error { return e.cause }
   158  
   159  // Key function returns key value.
   160  func (e ConnectionValidationError) Key() bool { return e.key }
   161  
   162  // ErrorName returns error name.
   163  func (e ConnectionValidationError) ErrorName() string { return "ConnectionValidationError" }
   164  
   165  // Error satisfies the builtin error interface
   166  func (e ConnectionValidationError) Error() string {
   167  	cause := ""
   168  	if e.cause != nil {
   169  		cause = fmt.Sprintf(" | caused by: %v", e.cause)
   170  	}
   171  
   172  	key := ""
   173  	if e.key {
   174  		key = "key for "
   175  	}
   176  
   177  	return fmt.Sprintf(
   178  		"invalid %sConnection.%s: %s%s",
   179  		key,
   180  		e.field,
   181  		e.reason,
   182  		cause)
   183  }
   184  
   185  var _ error = ConnectionValidationError{}
   186  
   187  var _ interface {
   188  	Field() string
   189  	Reason() string
   190  	Key() bool
   191  	Cause() error
   192  	ErrorName() string
   193  } = ConnectionValidationError{}
   194  
   195  // Validate checks the field values on SocketEvent with the rules defined in
   196  // the proto definition for this message. If any rules are violated, the first
   197  // error encountered is returned, or nil if there are no violations.
   198  func (m *SocketEvent) Validate() error {
   199  	return m.validate(false)
   200  }
   201  
   202  // ValidateAll checks the field values on SocketEvent with the rules defined in
   203  // the proto definition for this message. If any rules are violated, the
   204  // result is a list of violation errors wrapped in SocketEventMultiError, or
   205  // nil if none found.
   206  func (m *SocketEvent) ValidateAll() error {
   207  	return m.validate(true)
   208  }
   209  
   210  func (m *SocketEvent) validate(all bool) error {
   211  	if m == nil {
   212  		return nil
   213  	}
   214  
   215  	var errors []error
   216  
   217  	if all {
   218  		switch v := interface{}(m.GetTimestamp()).(type) {
   219  		case interface{ ValidateAll() error }:
   220  			if err := v.ValidateAll(); err != nil {
   221  				errors = append(errors, SocketEventValidationError{
   222  					field:  "Timestamp",
   223  					reason: "embedded message failed validation",
   224  					cause:  err,
   225  				})
   226  			}
   227  		case interface{ Validate() error }:
   228  			if err := v.Validate(); err != nil {
   229  				errors = append(errors, SocketEventValidationError{
   230  					field:  "Timestamp",
   231  					reason: "embedded message failed validation",
   232  					cause:  err,
   233  				})
   234  			}
   235  		}
   236  	} else if v, ok := interface{}(m.GetTimestamp()).(interface{ Validate() error }); ok {
   237  		if err := v.Validate(); err != nil {
   238  			return SocketEventValidationError{
   239  				field:  "Timestamp",
   240  				reason: "embedded message failed validation",
   241  				cause:  err,
   242  			}
   243  		}
   244  	}
   245  
   246  	switch v := m.EventSelector.(type) {
   247  	case *SocketEvent_Read_:
   248  		if v == nil {
   249  			err := SocketEventValidationError{
   250  				field:  "EventSelector",
   251  				reason: "oneof value cannot be a typed-nil",
   252  			}
   253  			if !all {
   254  				return err
   255  			}
   256  			errors = append(errors, err)
   257  		}
   258  
   259  		if all {
   260  			switch v := interface{}(m.GetRead()).(type) {
   261  			case interface{ ValidateAll() error }:
   262  				if err := v.ValidateAll(); err != nil {
   263  					errors = append(errors, SocketEventValidationError{
   264  						field:  "Read",
   265  						reason: "embedded message failed validation",
   266  						cause:  err,
   267  					})
   268  				}
   269  			case interface{ Validate() error }:
   270  				if err := v.Validate(); err != nil {
   271  					errors = append(errors, SocketEventValidationError{
   272  						field:  "Read",
   273  						reason: "embedded message failed validation",
   274  						cause:  err,
   275  					})
   276  				}
   277  			}
   278  		} else if v, ok := interface{}(m.GetRead()).(interface{ Validate() error }); ok {
   279  			if err := v.Validate(); err != nil {
   280  				return SocketEventValidationError{
   281  					field:  "Read",
   282  					reason: "embedded message failed validation",
   283  					cause:  err,
   284  				}
   285  			}
   286  		}
   287  
   288  	case *SocketEvent_Write_:
   289  		if v == nil {
   290  			err := SocketEventValidationError{
   291  				field:  "EventSelector",
   292  				reason: "oneof value cannot be a typed-nil",
   293  			}
   294  			if !all {
   295  				return err
   296  			}
   297  			errors = append(errors, err)
   298  		}
   299  
   300  		if all {
   301  			switch v := interface{}(m.GetWrite()).(type) {
   302  			case interface{ ValidateAll() error }:
   303  				if err := v.ValidateAll(); err != nil {
   304  					errors = append(errors, SocketEventValidationError{
   305  						field:  "Write",
   306  						reason: "embedded message failed validation",
   307  						cause:  err,
   308  					})
   309  				}
   310  			case interface{ Validate() error }:
   311  				if err := v.Validate(); err != nil {
   312  					errors = append(errors, SocketEventValidationError{
   313  						field:  "Write",
   314  						reason: "embedded message failed validation",
   315  						cause:  err,
   316  					})
   317  				}
   318  			}
   319  		} else if v, ok := interface{}(m.GetWrite()).(interface{ Validate() error }); ok {
   320  			if err := v.Validate(); err != nil {
   321  				return SocketEventValidationError{
   322  					field:  "Write",
   323  					reason: "embedded message failed validation",
   324  					cause:  err,
   325  				}
   326  			}
   327  		}
   328  
   329  	case *SocketEvent_Closed_:
   330  		if v == nil {
   331  			err := SocketEventValidationError{
   332  				field:  "EventSelector",
   333  				reason: "oneof value cannot be a typed-nil",
   334  			}
   335  			if !all {
   336  				return err
   337  			}
   338  			errors = append(errors, err)
   339  		}
   340  
   341  		if all {
   342  			switch v := interface{}(m.GetClosed()).(type) {
   343  			case interface{ ValidateAll() error }:
   344  				if err := v.ValidateAll(); err != nil {
   345  					errors = append(errors, SocketEventValidationError{
   346  						field:  "Closed",
   347  						reason: "embedded message failed validation",
   348  						cause:  err,
   349  					})
   350  				}
   351  			case interface{ Validate() error }:
   352  				if err := v.Validate(); err != nil {
   353  					errors = append(errors, SocketEventValidationError{
   354  						field:  "Closed",
   355  						reason: "embedded message failed validation",
   356  						cause:  err,
   357  					})
   358  				}
   359  			}
   360  		} else if v, ok := interface{}(m.GetClosed()).(interface{ Validate() error }); ok {
   361  			if err := v.Validate(); err != nil {
   362  				return SocketEventValidationError{
   363  					field:  "Closed",
   364  					reason: "embedded message failed validation",
   365  					cause:  err,
   366  				}
   367  			}
   368  		}
   369  
   370  	default:
   371  		_ = v // ensures v is used
   372  	}
   373  
   374  	if len(errors) > 0 {
   375  		return SocketEventMultiError(errors)
   376  	}
   377  
   378  	return nil
   379  }
   380  
   381  // SocketEventMultiError is an error wrapping multiple validation errors
   382  // returned by SocketEvent.ValidateAll() if the designated constraints aren't met.
   383  type SocketEventMultiError []error
   384  
   385  // Error returns a concatenation of all the error messages it wraps.
   386  func (m SocketEventMultiError) Error() string {
   387  	var msgs []string
   388  	for _, err := range m {
   389  		msgs = append(msgs, err.Error())
   390  	}
   391  	return strings.Join(msgs, "; ")
   392  }
   393  
   394  // AllErrors returns a list of validation violation errors.
   395  func (m SocketEventMultiError) AllErrors() []error { return m }
   396  
   397  // SocketEventValidationError is the validation error returned by
   398  // SocketEvent.Validate if the designated constraints aren't met.
   399  type SocketEventValidationError struct {
   400  	field  string
   401  	reason string
   402  	cause  error
   403  	key    bool
   404  }
   405  
   406  // Field function returns field value.
   407  func (e SocketEventValidationError) Field() string { return e.field }
   408  
   409  // Reason function returns reason value.
   410  func (e SocketEventValidationError) Reason() string { return e.reason }
   411  
   412  // Cause function returns cause value.
   413  func (e SocketEventValidationError) Cause() error { return e.cause }
   414  
   415  // Key function returns key value.
   416  func (e SocketEventValidationError) Key() bool { return e.key }
   417  
   418  // ErrorName returns error name.
   419  func (e SocketEventValidationError) ErrorName() string { return "SocketEventValidationError" }
   420  
   421  // Error satisfies the builtin error interface
   422  func (e SocketEventValidationError) Error() string {
   423  	cause := ""
   424  	if e.cause != nil {
   425  		cause = fmt.Sprintf(" | caused by: %v", e.cause)
   426  	}
   427  
   428  	key := ""
   429  	if e.key {
   430  		key = "key for "
   431  	}
   432  
   433  	return fmt.Sprintf(
   434  		"invalid %sSocketEvent.%s: %s%s",
   435  		key,
   436  		e.field,
   437  		e.reason,
   438  		cause)
   439  }
   440  
   441  var _ error = SocketEventValidationError{}
   442  
   443  var _ interface {
   444  	Field() string
   445  	Reason() string
   446  	Key() bool
   447  	Cause() error
   448  	ErrorName() string
   449  } = SocketEventValidationError{}
   450  
   451  // Validate checks the field values on SocketBufferedTrace with the rules
   452  // defined in the proto definition for this message. If any rules are
   453  // violated, the first error encountered is returned, or nil if there are no violations.
   454  func (m *SocketBufferedTrace) Validate() error {
   455  	return m.validate(false)
   456  }
   457  
   458  // ValidateAll checks the field values on SocketBufferedTrace with the rules
   459  // defined in the proto definition for this message. If any rules are
   460  // violated, the result is a list of violation errors wrapped in
   461  // SocketBufferedTraceMultiError, or nil if none found.
   462  func (m *SocketBufferedTrace) ValidateAll() error {
   463  	return m.validate(true)
   464  }
   465  
   466  func (m *SocketBufferedTrace) validate(all bool) error {
   467  	if m == nil {
   468  		return nil
   469  	}
   470  
   471  	var errors []error
   472  
   473  	// no validation rules for TraceId
   474  
   475  	if all {
   476  		switch v := interface{}(m.GetConnection()).(type) {
   477  		case interface{ ValidateAll() error }:
   478  			if err := v.ValidateAll(); err != nil {
   479  				errors = append(errors, SocketBufferedTraceValidationError{
   480  					field:  "Connection",
   481  					reason: "embedded message failed validation",
   482  					cause:  err,
   483  				})
   484  			}
   485  		case interface{ Validate() error }:
   486  			if err := v.Validate(); err != nil {
   487  				errors = append(errors, SocketBufferedTraceValidationError{
   488  					field:  "Connection",
   489  					reason: "embedded message failed validation",
   490  					cause:  err,
   491  				})
   492  			}
   493  		}
   494  	} else if v, ok := interface{}(m.GetConnection()).(interface{ Validate() error }); ok {
   495  		if err := v.Validate(); err != nil {
   496  			return SocketBufferedTraceValidationError{
   497  				field:  "Connection",
   498  				reason: "embedded message failed validation",
   499  				cause:  err,
   500  			}
   501  		}
   502  	}
   503  
   504  	for idx, item := range m.GetEvents() {
   505  		_, _ = idx, item
   506  
   507  		if all {
   508  			switch v := interface{}(item).(type) {
   509  			case interface{ ValidateAll() error }:
   510  				if err := v.ValidateAll(); err != nil {
   511  					errors = append(errors, SocketBufferedTraceValidationError{
   512  						field:  fmt.Sprintf("Events[%v]", idx),
   513  						reason: "embedded message failed validation",
   514  						cause:  err,
   515  					})
   516  				}
   517  			case interface{ Validate() error }:
   518  				if err := v.Validate(); err != nil {
   519  					errors = append(errors, SocketBufferedTraceValidationError{
   520  						field:  fmt.Sprintf("Events[%v]", idx),
   521  						reason: "embedded message failed validation",
   522  						cause:  err,
   523  					})
   524  				}
   525  			}
   526  		} else if v, ok := interface{}(item).(interface{ Validate() error }); ok {
   527  			if err := v.Validate(); err != nil {
   528  				return SocketBufferedTraceValidationError{
   529  					field:  fmt.Sprintf("Events[%v]", idx),
   530  					reason: "embedded message failed validation",
   531  					cause:  err,
   532  				}
   533  			}
   534  		}
   535  
   536  	}
   537  
   538  	// no validation rules for ReadTruncated
   539  
   540  	// no validation rules for WriteTruncated
   541  
   542  	if len(errors) > 0 {
   543  		return SocketBufferedTraceMultiError(errors)
   544  	}
   545  
   546  	return nil
   547  }
   548  
   549  // SocketBufferedTraceMultiError is an error wrapping multiple validation
   550  // errors returned by SocketBufferedTrace.ValidateAll() if the designated
   551  // constraints aren't met.
   552  type SocketBufferedTraceMultiError []error
   553  
   554  // Error returns a concatenation of all the error messages it wraps.
   555  func (m SocketBufferedTraceMultiError) Error() string {
   556  	var msgs []string
   557  	for _, err := range m {
   558  		msgs = append(msgs, err.Error())
   559  	}
   560  	return strings.Join(msgs, "; ")
   561  }
   562  
   563  // AllErrors returns a list of validation violation errors.
   564  func (m SocketBufferedTraceMultiError) AllErrors() []error { return m }
   565  
   566  // SocketBufferedTraceValidationError is the validation error returned by
   567  // SocketBufferedTrace.Validate if the designated constraints aren't met.
   568  type SocketBufferedTraceValidationError struct {
   569  	field  string
   570  	reason string
   571  	cause  error
   572  	key    bool
   573  }
   574  
   575  // Field function returns field value.
   576  func (e SocketBufferedTraceValidationError) Field() string { return e.field }
   577  
   578  // Reason function returns reason value.
   579  func (e SocketBufferedTraceValidationError) Reason() string { return e.reason }
   580  
   581  // Cause function returns cause value.
   582  func (e SocketBufferedTraceValidationError) Cause() error { return e.cause }
   583  
   584  // Key function returns key value.
   585  func (e SocketBufferedTraceValidationError) Key() bool { return e.key }
   586  
   587  // ErrorName returns error name.
   588  func (e SocketBufferedTraceValidationError) ErrorName() string {
   589  	return "SocketBufferedTraceValidationError"
   590  }
   591  
   592  // Error satisfies the builtin error interface
   593  func (e SocketBufferedTraceValidationError) Error() string {
   594  	cause := ""
   595  	if e.cause != nil {
   596  		cause = fmt.Sprintf(" | caused by: %v", e.cause)
   597  	}
   598  
   599  	key := ""
   600  	if e.key {
   601  		key = "key for "
   602  	}
   603  
   604  	return fmt.Sprintf(
   605  		"invalid %sSocketBufferedTrace.%s: %s%s",
   606  		key,
   607  		e.field,
   608  		e.reason,
   609  		cause)
   610  }
   611  
   612  var _ error = SocketBufferedTraceValidationError{}
   613  
   614  var _ interface {
   615  	Field() string
   616  	Reason() string
   617  	Key() bool
   618  	Cause() error
   619  	ErrorName() string
   620  } = SocketBufferedTraceValidationError{}
   621  
   622  // Validate checks the field values on SocketStreamedTraceSegment with the
   623  // rules defined in the proto definition for this message. If any rules are
   624  // violated, the first error encountered is returned, or nil if there are no violations.
   625  func (m *SocketStreamedTraceSegment) Validate() error {
   626  	return m.validate(false)
   627  }
   628  
   629  // ValidateAll checks the field values on SocketStreamedTraceSegment with the
   630  // rules defined in the proto definition for this message. If any rules are
   631  // violated, the result is a list of violation errors wrapped in
   632  // SocketStreamedTraceSegmentMultiError, or nil if none found.
   633  func (m *SocketStreamedTraceSegment) ValidateAll() error {
   634  	return m.validate(true)
   635  }
   636  
   637  func (m *SocketStreamedTraceSegment) validate(all bool) error {
   638  	if m == nil {
   639  		return nil
   640  	}
   641  
   642  	var errors []error
   643  
   644  	// no validation rules for TraceId
   645  
   646  	switch v := m.MessagePiece.(type) {
   647  	case *SocketStreamedTraceSegment_Connection:
   648  		if v == nil {
   649  			err := SocketStreamedTraceSegmentValidationError{
   650  				field:  "MessagePiece",
   651  				reason: "oneof value cannot be a typed-nil",
   652  			}
   653  			if !all {
   654  				return err
   655  			}
   656  			errors = append(errors, err)
   657  		}
   658  
   659  		if all {
   660  			switch v := interface{}(m.GetConnection()).(type) {
   661  			case interface{ ValidateAll() error }:
   662  				if err := v.ValidateAll(); err != nil {
   663  					errors = append(errors, SocketStreamedTraceSegmentValidationError{
   664  						field:  "Connection",
   665  						reason: "embedded message failed validation",
   666  						cause:  err,
   667  					})
   668  				}
   669  			case interface{ Validate() error }:
   670  				if err := v.Validate(); err != nil {
   671  					errors = append(errors, SocketStreamedTraceSegmentValidationError{
   672  						field:  "Connection",
   673  						reason: "embedded message failed validation",
   674  						cause:  err,
   675  					})
   676  				}
   677  			}
   678  		} else if v, ok := interface{}(m.GetConnection()).(interface{ Validate() error }); ok {
   679  			if err := v.Validate(); err != nil {
   680  				return SocketStreamedTraceSegmentValidationError{
   681  					field:  "Connection",
   682  					reason: "embedded message failed validation",
   683  					cause:  err,
   684  				}
   685  			}
   686  		}
   687  
   688  	case *SocketStreamedTraceSegment_Event:
   689  		if v == nil {
   690  			err := SocketStreamedTraceSegmentValidationError{
   691  				field:  "MessagePiece",
   692  				reason: "oneof value cannot be a typed-nil",
   693  			}
   694  			if !all {
   695  				return err
   696  			}
   697  			errors = append(errors, err)
   698  		}
   699  
   700  		if all {
   701  			switch v := interface{}(m.GetEvent()).(type) {
   702  			case interface{ ValidateAll() error }:
   703  				if err := v.ValidateAll(); err != nil {
   704  					errors = append(errors, SocketStreamedTraceSegmentValidationError{
   705  						field:  "Event",
   706  						reason: "embedded message failed validation",
   707  						cause:  err,
   708  					})
   709  				}
   710  			case interface{ Validate() error }:
   711  				if err := v.Validate(); err != nil {
   712  					errors = append(errors, SocketStreamedTraceSegmentValidationError{
   713  						field:  "Event",
   714  						reason: "embedded message failed validation",
   715  						cause:  err,
   716  					})
   717  				}
   718  			}
   719  		} else if v, ok := interface{}(m.GetEvent()).(interface{ Validate() error }); ok {
   720  			if err := v.Validate(); err != nil {
   721  				return SocketStreamedTraceSegmentValidationError{
   722  					field:  "Event",
   723  					reason: "embedded message failed validation",
   724  					cause:  err,
   725  				}
   726  			}
   727  		}
   728  
   729  	default:
   730  		_ = v // ensures v is used
   731  	}
   732  
   733  	if len(errors) > 0 {
   734  		return SocketStreamedTraceSegmentMultiError(errors)
   735  	}
   736  
   737  	return nil
   738  }
   739  
   740  // SocketStreamedTraceSegmentMultiError is an error wrapping multiple
   741  // validation errors returned by SocketStreamedTraceSegment.ValidateAll() if
   742  // the designated constraints aren't met.
   743  type SocketStreamedTraceSegmentMultiError []error
   744  
   745  // Error returns a concatenation of all the error messages it wraps.
   746  func (m SocketStreamedTraceSegmentMultiError) Error() string {
   747  	var msgs []string
   748  	for _, err := range m {
   749  		msgs = append(msgs, err.Error())
   750  	}
   751  	return strings.Join(msgs, "; ")
   752  }
   753  
   754  // AllErrors returns a list of validation violation errors.
   755  func (m SocketStreamedTraceSegmentMultiError) AllErrors() []error { return m }
   756  
   757  // SocketStreamedTraceSegmentValidationError is the validation error returned
   758  // by SocketStreamedTraceSegment.Validate if the designated constraints aren't met.
   759  type SocketStreamedTraceSegmentValidationError struct {
   760  	field  string
   761  	reason string
   762  	cause  error
   763  	key    bool
   764  }
   765  
   766  // Field function returns field value.
   767  func (e SocketStreamedTraceSegmentValidationError) Field() string { return e.field }
   768  
   769  // Reason function returns reason value.
   770  func (e SocketStreamedTraceSegmentValidationError) Reason() string { return e.reason }
   771  
   772  // Cause function returns cause value.
   773  func (e SocketStreamedTraceSegmentValidationError) Cause() error { return e.cause }
   774  
   775  // Key function returns key value.
   776  func (e SocketStreamedTraceSegmentValidationError) Key() bool { return e.key }
   777  
   778  // ErrorName returns error name.
   779  func (e SocketStreamedTraceSegmentValidationError) ErrorName() string {
   780  	return "SocketStreamedTraceSegmentValidationError"
   781  }
   782  
   783  // Error satisfies the builtin error interface
   784  func (e SocketStreamedTraceSegmentValidationError) Error() string {
   785  	cause := ""
   786  	if e.cause != nil {
   787  		cause = fmt.Sprintf(" | caused by: %v", e.cause)
   788  	}
   789  
   790  	key := ""
   791  	if e.key {
   792  		key = "key for "
   793  	}
   794  
   795  	return fmt.Sprintf(
   796  		"invalid %sSocketStreamedTraceSegment.%s: %s%s",
   797  		key,
   798  		e.field,
   799  		e.reason,
   800  		cause)
   801  }
   802  
   803  var _ error = SocketStreamedTraceSegmentValidationError{}
   804  
   805  var _ interface {
   806  	Field() string
   807  	Reason() string
   808  	Key() bool
   809  	Cause() error
   810  	ErrorName() string
   811  } = SocketStreamedTraceSegmentValidationError{}
   812  
   813  // Validate checks the field values on SocketEvent_Read with the rules defined
   814  // in the proto definition for this message. If any rules are violated, the
   815  // first error encountered is returned, or nil if there are no violations.
   816  func (m *SocketEvent_Read) Validate() error {
   817  	return m.validate(false)
   818  }
   819  
   820  // ValidateAll checks the field values on SocketEvent_Read with the rules
   821  // defined in the proto definition for this message. If any rules are
   822  // violated, the result is a list of violation errors wrapped in
   823  // SocketEvent_ReadMultiError, or nil if none found.
   824  func (m *SocketEvent_Read) ValidateAll() error {
   825  	return m.validate(true)
   826  }
   827  
   828  func (m *SocketEvent_Read) validate(all bool) error {
   829  	if m == nil {
   830  		return nil
   831  	}
   832  
   833  	var errors []error
   834  
   835  	if all {
   836  		switch v := interface{}(m.GetData()).(type) {
   837  		case interface{ ValidateAll() error }:
   838  			if err := v.ValidateAll(); err != nil {
   839  				errors = append(errors, SocketEvent_ReadValidationError{
   840  					field:  "Data",
   841  					reason: "embedded message failed validation",
   842  					cause:  err,
   843  				})
   844  			}
   845  		case interface{ Validate() error }:
   846  			if err := v.Validate(); err != nil {
   847  				errors = append(errors, SocketEvent_ReadValidationError{
   848  					field:  "Data",
   849  					reason: "embedded message failed validation",
   850  					cause:  err,
   851  				})
   852  			}
   853  		}
   854  	} else if v, ok := interface{}(m.GetData()).(interface{ Validate() error }); ok {
   855  		if err := v.Validate(); err != nil {
   856  			return SocketEvent_ReadValidationError{
   857  				field:  "Data",
   858  				reason: "embedded message failed validation",
   859  				cause:  err,
   860  			}
   861  		}
   862  	}
   863  
   864  	if len(errors) > 0 {
   865  		return SocketEvent_ReadMultiError(errors)
   866  	}
   867  
   868  	return nil
   869  }
   870  
   871  // SocketEvent_ReadMultiError is an error wrapping multiple validation errors
   872  // returned by SocketEvent_Read.ValidateAll() if the designated constraints
   873  // aren't met.
   874  type SocketEvent_ReadMultiError []error
   875  
   876  // Error returns a concatenation of all the error messages it wraps.
   877  func (m SocketEvent_ReadMultiError) Error() string {
   878  	var msgs []string
   879  	for _, err := range m {
   880  		msgs = append(msgs, err.Error())
   881  	}
   882  	return strings.Join(msgs, "; ")
   883  }
   884  
   885  // AllErrors returns a list of validation violation errors.
   886  func (m SocketEvent_ReadMultiError) AllErrors() []error { return m }
   887  
   888  // SocketEvent_ReadValidationError is the validation error returned by
   889  // SocketEvent_Read.Validate if the designated constraints aren't met.
   890  type SocketEvent_ReadValidationError struct {
   891  	field  string
   892  	reason string
   893  	cause  error
   894  	key    bool
   895  }
   896  
   897  // Field function returns field value.
   898  func (e SocketEvent_ReadValidationError) Field() string { return e.field }
   899  
   900  // Reason function returns reason value.
   901  func (e SocketEvent_ReadValidationError) Reason() string { return e.reason }
   902  
   903  // Cause function returns cause value.
   904  func (e SocketEvent_ReadValidationError) Cause() error { return e.cause }
   905  
   906  // Key function returns key value.
   907  func (e SocketEvent_ReadValidationError) Key() bool { return e.key }
   908  
   909  // ErrorName returns error name.
   910  func (e SocketEvent_ReadValidationError) ErrorName() string { return "SocketEvent_ReadValidationError" }
   911  
   912  // Error satisfies the builtin error interface
   913  func (e SocketEvent_ReadValidationError) Error() string {
   914  	cause := ""
   915  	if e.cause != nil {
   916  		cause = fmt.Sprintf(" | caused by: %v", e.cause)
   917  	}
   918  
   919  	key := ""
   920  	if e.key {
   921  		key = "key for "
   922  	}
   923  
   924  	return fmt.Sprintf(
   925  		"invalid %sSocketEvent_Read.%s: %s%s",
   926  		key,
   927  		e.field,
   928  		e.reason,
   929  		cause)
   930  }
   931  
   932  var _ error = SocketEvent_ReadValidationError{}
   933  
   934  var _ interface {
   935  	Field() string
   936  	Reason() string
   937  	Key() bool
   938  	Cause() error
   939  	ErrorName() string
   940  } = SocketEvent_ReadValidationError{}
   941  
   942  // Validate checks the field values on SocketEvent_Write with the rules defined
   943  // in the proto definition for this message. If any rules are violated, the
   944  // first error encountered is returned, or nil if there are no violations.
   945  func (m *SocketEvent_Write) Validate() error {
   946  	return m.validate(false)
   947  }
   948  
   949  // ValidateAll checks the field values on SocketEvent_Write with the rules
   950  // defined in the proto definition for this message. If any rules are
   951  // violated, the result is a list of violation errors wrapped in
   952  // SocketEvent_WriteMultiError, or nil if none found.
   953  func (m *SocketEvent_Write) ValidateAll() error {
   954  	return m.validate(true)
   955  }
   956  
   957  func (m *SocketEvent_Write) validate(all bool) error {
   958  	if m == nil {
   959  		return nil
   960  	}
   961  
   962  	var errors []error
   963  
   964  	if all {
   965  		switch v := interface{}(m.GetData()).(type) {
   966  		case interface{ ValidateAll() error }:
   967  			if err := v.ValidateAll(); err != nil {
   968  				errors = append(errors, SocketEvent_WriteValidationError{
   969  					field:  "Data",
   970  					reason: "embedded message failed validation",
   971  					cause:  err,
   972  				})
   973  			}
   974  		case interface{ Validate() error }:
   975  			if err := v.Validate(); err != nil {
   976  				errors = append(errors, SocketEvent_WriteValidationError{
   977  					field:  "Data",
   978  					reason: "embedded message failed validation",
   979  					cause:  err,
   980  				})
   981  			}
   982  		}
   983  	} else if v, ok := interface{}(m.GetData()).(interface{ Validate() error }); ok {
   984  		if err := v.Validate(); err != nil {
   985  			return SocketEvent_WriteValidationError{
   986  				field:  "Data",
   987  				reason: "embedded message failed validation",
   988  				cause:  err,
   989  			}
   990  		}
   991  	}
   992  
   993  	// no validation rules for EndStream
   994  
   995  	if len(errors) > 0 {
   996  		return SocketEvent_WriteMultiError(errors)
   997  	}
   998  
   999  	return nil
  1000  }
  1001  
  1002  // SocketEvent_WriteMultiError is an error wrapping multiple validation errors
  1003  // returned by SocketEvent_Write.ValidateAll() if the designated constraints
  1004  // aren't met.
  1005  type SocketEvent_WriteMultiError []error
  1006  
  1007  // Error returns a concatenation of all the error messages it wraps.
  1008  func (m SocketEvent_WriteMultiError) Error() string {
  1009  	var msgs []string
  1010  	for _, err := range m {
  1011  		msgs = append(msgs, err.Error())
  1012  	}
  1013  	return strings.Join(msgs, "; ")
  1014  }
  1015  
  1016  // AllErrors returns a list of validation violation errors.
  1017  func (m SocketEvent_WriteMultiError) AllErrors() []error { return m }
  1018  
  1019  // SocketEvent_WriteValidationError is the validation error returned by
  1020  // SocketEvent_Write.Validate if the designated constraints aren't met.
  1021  type SocketEvent_WriteValidationError struct {
  1022  	field  string
  1023  	reason string
  1024  	cause  error
  1025  	key    bool
  1026  }
  1027  
  1028  // Field function returns field value.
  1029  func (e SocketEvent_WriteValidationError) Field() string { return e.field }
  1030  
  1031  // Reason function returns reason value.
  1032  func (e SocketEvent_WriteValidationError) Reason() string { return e.reason }
  1033  
  1034  // Cause function returns cause value.
  1035  func (e SocketEvent_WriteValidationError) Cause() error { return e.cause }
  1036  
  1037  // Key function returns key value.
  1038  func (e SocketEvent_WriteValidationError) Key() bool { return e.key }
  1039  
  1040  // ErrorName returns error name.
  1041  func (e SocketEvent_WriteValidationError) ErrorName() string {
  1042  	return "SocketEvent_WriteValidationError"
  1043  }
  1044  
  1045  // Error satisfies the builtin error interface
  1046  func (e SocketEvent_WriteValidationError) 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 %sSocketEvent_Write.%s: %s%s",
  1059  		key,
  1060  		e.field,
  1061  		e.reason,
  1062  		cause)
  1063  }
  1064  
  1065  var _ error = SocketEvent_WriteValidationError{}
  1066  
  1067  var _ interface {
  1068  	Field() string
  1069  	Reason() string
  1070  	Key() bool
  1071  	Cause() error
  1072  	ErrorName() string
  1073  } = SocketEvent_WriteValidationError{}
  1074  
  1075  // Validate checks the field values on SocketEvent_Closed with the rules
  1076  // defined in the proto definition for this message. If any rules are
  1077  // violated, the first error encountered is returned, or nil if there are no violations.
  1078  func (m *SocketEvent_Closed) Validate() error {
  1079  	return m.validate(false)
  1080  }
  1081  
  1082  // ValidateAll checks the field values on SocketEvent_Closed with the rules
  1083  // defined in the proto definition for this message. If any rules are
  1084  // violated, the result is a list of violation errors wrapped in
  1085  // SocketEvent_ClosedMultiError, or nil if none found.
  1086  func (m *SocketEvent_Closed) ValidateAll() error {
  1087  	return m.validate(true)
  1088  }
  1089  
  1090  func (m *SocketEvent_Closed) validate(all bool) error {
  1091  	if m == nil {
  1092  		return nil
  1093  	}
  1094  
  1095  	var errors []error
  1096  
  1097  	if len(errors) > 0 {
  1098  		return SocketEvent_ClosedMultiError(errors)
  1099  	}
  1100  
  1101  	return nil
  1102  }
  1103  
  1104  // SocketEvent_ClosedMultiError is an error wrapping multiple validation errors
  1105  // returned by SocketEvent_Closed.ValidateAll() if the designated constraints
  1106  // aren't met.
  1107  type SocketEvent_ClosedMultiError []error
  1108  
  1109  // Error returns a concatenation of all the error messages it wraps.
  1110  func (m SocketEvent_ClosedMultiError) Error() string {
  1111  	var msgs []string
  1112  	for _, err := range m {
  1113  		msgs = append(msgs, err.Error())
  1114  	}
  1115  	return strings.Join(msgs, "; ")
  1116  }
  1117  
  1118  // AllErrors returns a list of validation violation errors.
  1119  func (m SocketEvent_ClosedMultiError) AllErrors() []error { return m }
  1120  
  1121  // SocketEvent_ClosedValidationError is the validation error returned by
  1122  // SocketEvent_Closed.Validate if the designated constraints aren't met.
  1123  type SocketEvent_ClosedValidationError struct {
  1124  	field  string
  1125  	reason string
  1126  	cause  error
  1127  	key    bool
  1128  }
  1129  
  1130  // Field function returns field value.
  1131  func (e SocketEvent_ClosedValidationError) Field() string { return e.field }
  1132  
  1133  // Reason function returns reason value.
  1134  func (e SocketEvent_ClosedValidationError) Reason() string { return e.reason }
  1135  
  1136  // Cause function returns cause value.
  1137  func (e SocketEvent_ClosedValidationError) Cause() error { return e.cause }
  1138  
  1139  // Key function returns key value.
  1140  func (e SocketEvent_ClosedValidationError) Key() bool { return e.key }
  1141  
  1142  // ErrorName returns error name.
  1143  func (e SocketEvent_ClosedValidationError) ErrorName() string {
  1144  	return "SocketEvent_ClosedValidationError"
  1145  }
  1146  
  1147  // Error satisfies the builtin error interface
  1148  func (e SocketEvent_ClosedValidationError) Error() string {
  1149  	cause := ""
  1150  	if e.cause != nil {
  1151  		cause = fmt.Sprintf(" | caused by: %v", e.cause)
  1152  	}
  1153  
  1154  	key := ""
  1155  	if e.key {
  1156  		key = "key for "
  1157  	}
  1158  
  1159  	return fmt.Sprintf(
  1160  		"invalid %sSocketEvent_Closed.%s: %s%s",
  1161  		key,
  1162  		e.field,
  1163  		e.reason,
  1164  		cause)
  1165  }
  1166  
  1167  var _ error = SocketEvent_ClosedValidationError{}
  1168  
  1169  var _ interface {
  1170  	Field() string
  1171  	Reason() string
  1172  	Key() bool
  1173  	Cause() error
  1174  	ErrorName() string
  1175  } = SocketEvent_ClosedValidationError{}
  1176  

View as plain text