...

Source file src/github.com/emissary-ingress/emissary/v3/pkg/api/envoy/data/tap/v2alpha/http.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/http.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 HttpBufferedTrace with the rules defined
    39  // in the proto definition for this message. If any rules are violated, the
    40  // first error encountered is returned, or nil if there are no violations.
    41  func (m *HttpBufferedTrace) Validate() error {
    42  	return m.validate(false)
    43  }
    44  
    45  // ValidateAll checks the field values on HttpBufferedTrace with the rules
    46  // defined in the proto definition for this message. If any rules are
    47  // violated, the result is a list of violation errors wrapped in
    48  // HttpBufferedTraceMultiError, or nil if none found.
    49  func (m *HttpBufferedTrace) ValidateAll() error {
    50  	return m.validate(true)
    51  }
    52  
    53  func (m *HttpBufferedTrace) 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.GetRequest()).(type) {
    62  		case interface{ ValidateAll() error }:
    63  			if err := v.ValidateAll(); err != nil {
    64  				errors = append(errors, HttpBufferedTraceValidationError{
    65  					field:  "Request",
    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, HttpBufferedTraceValidationError{
    73  					field:  "Request",
    74  					reason: "embedded message failed validation",
    75  					cause:  err,
    76  				})
    77  			}
    78  		}
    79  	} else if v, ok := interface{}(m.GetRequest()).(interface{ Validate() error }); ok {
    80  		if err := v.Validate(); err != nil {
    81  			return HttpBufferedTraceValidationError{
    82  				field:  "Request",
    83  				reason: "embedded message failed validation",
    84  				cause:  err,
    85  			}
    86  		}
    87  	}
    88  
    89  	if all {
    90  		switch v := interface{}(m.GetResponse()).(type) {
    91  		case interface{ ValidateAll() error }:
    92  			if err := v.ValidateAll(); err != nil {
    93  				errors = append(errors, HttpBufferedTraceValidationError{
    94  					field:  "Response",
    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, HttpBufferedTraceValidationError{
   102  					field:  "Response",
   103  					reason: "embedded message failed validation",
   104  					cause:  err,
   105  				})
   106  			}
   107  		}
   108  	} else if v, ok := interface{}(m.GetResponse()).(interface{ Validate() error }); ok {
   109  		if err := v.Validate(); err != nil {
   110  			return HttpBufferedTraceValidationError{
   111  				field:  "Response",
   112  				reason: "embedded message failed validation",
   113  				cause:  err,
   114  			}
   115  		}
   116  	}
   117  
   118  	if len(errors) > 0 {
   119  		return HttpBufferedTraceMultiError(errors)
   120  	}
   121  
   122  	return nil
   123  }
   124  
   125  // HttpBufferedTraceMultiError is an error wrapping multiple validation errors
   126  // returned by HttpBufferedTrace.ValidateAll() if the designated constraints
   127  // aren't met.
   128  type HttpBufferedTraceMultiError []error
   129  
   130  // Error returns a concatenation of all the error messages it wraps.
   131  func (m HttpBufferedTraceMultiError) Error() string {
   132  	var msgs []string
   133  	for _, err := range m {
   134  		msgs = append(msgs, err.Error())
   135  	}
   136  	return strings.Join(msgs, "; ")
   137  }
   138  
   139  // AllErrors returns a list of validation violation errors.
   140  func (m HttpBufferedTraceMultiError) AllErrors() []error { return m }
   141  
   142  // HttpBufferedTraceValidationError is the validation error returned by
   143  // HttpBufferedTrace.Validate if the designated constraints aren't met.
   144  type HttpBufferedTraceValidationError struct {
   145  	field  string
   146  	reason string
   147  	cause  error
   148  	key    bool
   149  }
   150  
   151  // Field function returns field value.
   152  func (e HttpBufferedTraceValidationError) Field() string { return e.field }
   153  
   154  // Reason function returns reason value.
   155  func (e HttpBufferedTraceValidationError) Reason() string { return e.reason }
   156  
   157  // Cause function returns cause value.
   158  func (e HttpBufferedTraceValidationError) Cause() error { return e.cause }
   159  
   160  // Key function returns key value.
   161  func (e HttpBufferedTraceValidationError) Key() bool { return e.key }
   162  
   163  // ErrorName returns error name.
   164  func (e HttpBufferedTraceValidationError) ErrorName() string {
   165  	return "HttpBufferedTraceValidationError"
   166  }
   167  
   168  // Error satisfies the builtin error interface
   169  func (e HttpBufferedTraceValidationError) Error() string {
   170  	cause := ""
   171  	if e.cause != nil {
   172  		cause = fmt.Sprintf(" | caused by: %v", e.cause)
   173  	}
   174  
   175  	key := ""
   176  	if e.key {
   177  		key = "key for "
   178  	}
   179  
   180  	return fmt.Sprintf(
   181  		"invalid %sHttpBufferedTrace.%s: %s%s",
   182  		key,
   183  		e.field,
   184  		e.reason,
   185  		cause)
   186  }
   187  
   188  var _ error = HttpBufferedTraceValidationError{}
   189  
   190  var _ interface {
   191  	Field() string
   192  	Reason() string
   193  	Key() bool
   194  	Cause() error
   195  	ErrorName() string
   196  } = HttpBufferedTraceValidationError{}
   197  
   198  // Validate checks the field values on HttpStreamedTraceSegment with the rules
   199  // defined in the proto definition for this message. If any rules are
   200  // violated, the first error encountered is returned, or nil if there are no violations.
   201  func (m *HttpStreamedTraceSegment) Validate() error {
   202  	return m.validate(false)
   203  }
   204  
   205  // ValidateAll checks the field values on HttpStreamedTraceSegment with the
   206  // rules defined in the proto definition for this message. If any rules are
   207  // violated, the result is a list of violation errors wrapped in
   208  // HttpStreamedTraceSegmentMultiError, or nil if none found.
   209  func (m *HttpStreamedTraceSegment) ValidateAll() error {
   210  	return m.validate(true)
   211  }
   212  
   213  func (m *HttpStreamedTraceSegment) validate(all bool) error {
   214  	if m == nil {
   215  		return nil
   216  	}
   217  
   218  	var errors []error
   219  
   220  	// no validation rules for TraceId
   221  
   222  	switch v := m.MessagePiece.(type) {
   223  	case *HttpStreamedTraceSegment_RequestHeaders:
   224  		if v == nil {
   225  			err := HttpStreamedTraceSegmentValidationError{
   226  				field:  "MessagePiece",
   227  				reason: "oneof value cannot be a typed-nil",
   228  			}
   229  			if !all {
   230  				return err
   231  			}
   232  			errors = append(errors, err)
   233  		}
   234  
   235  		if all {
   236  			switch v := interface{}(m.GetRequestHeaders()).(type) {
   237  			case interface{ ValidateAll() error }:
   238  				if err := v.ValidateAll(); err != nil {
   239  					errors = append(errors, HttpStreamedTraceSegmentValidationError{
   240  						field:  "RequestHeaders",
   241  						reason: "embedded message failed validation",
   242  						cause:  err,
   243  					})
   244  				}
   245  			case interface{ Validate() error }:
   246  				if err := v.Validate(); err != nil {
   247  					errors = append(errors, HttpStreamedTraceSegmentValidationError{
   248  						field:  "RequestHeaders",
   249  						reason: "embedded message failed validation",
   250  						cause:  err,
   251  					})
   252  				}
   253  			}
   254  		} else if v, ok := interface{}(m.GetRequestHeaders()).(interface{ Validate() error }); ok {
   255  			if err := v.Validate(); err != nil {
   256  				return HttpStreamedTraceSegmentValidationError{
   257  					field:  "RequestHeaders",
   258  					reason: "embedded message failed validation",
   259  					cause:  err,
   260  				}
   261  			}
   262  		}
   263  
   264  	case *HttpStreamedTraceSegment_RequestBodyChunk:
   265  		if v == nil {
   266  			err := HttpStreamedTraceSegmentValidationError{
   267  				field:  "MessagePiece",
   268  				reason: "oneof value cannot be a typed-nil",
   269  			}
   270  			if !all {
   271  				return err
   272  			}
   273  			errors = append(errors, err)
   274  		}
   275  
   276  		if all {
   277  			switch v := interface{}(m.GetRequestBodyChunk()).(type) {
   278  			case interface{ ValidateAll() error }:
   279  				if err := v.ValidateAll(); err != nil {
   280  					errors = append(errors, HttpStreamedTraceSegmentValidationError{
   281  						field:  "RequestBodyChunk",
   282  						reason: "embedded message failed validation",
   283  						cause:  err,
   284  					})
   285  				}
   286  			case interface{ Validate() error }:
   287  				if err := v.Validate(); err != nil {
   288  					errors = append(errors, HttpStreamedTraceSegmentValidationError{
   289  						field:  "RequestBodyChunk",
   290  						reason: "embedded message failed validation",
   291  						cause:  err,
   292  					})
   293  				}
   294  			}
   295  		} else if v, ok := interface{}(m.GetRequestBodyChunk()).(interface{ Validate() error }); ok {
   296  			if err := v.Validate(); err != nil {
   297  				return HttpStreamedTraceSegmentValidationError{
   298  					field:  "RequestBodyChunk",
   299  					reason: "embedded message failed validation",
   300  					cause:  err,
   301  				}
   302  			}
   303  		}
   304  
   305  	case *HttpStreamedTraceSegment_RequestTrailers:
   306  		if v == nil {
   307  			err := HttpStreamedTraceSegmentValidationError{
   308  				field:  "MessagePiece",
   309  				reason: "oneof value cannot be a typed-nil",
   310  			}
   311  			if !all {
   312  				return err
   313  			}
   314  			errors = append(errors, err)
   315  		}
   316  
   317  		if all {
   318  			switch v := interface{}(m.GetRequestTrailers()).(type) {
   319  			case interface{ ValidateAll() error }:
   320  				if err := v.ValidateAll(); err != nil {
   321  					errors = append(errors, HttpStreamedTraceSegmentValidationError{
   322  						field:  "RequestTrailers",
   323  						reason: "embedded message failed validation",
   324  						cause:  err,
   325  					})
   326  				}
   327  			case interface{ Validate() error }:
   328  				if err := v.Validate(); err != nil {
   329  					errors = append(errors, HttpStreamedTraceSegmentValidationError{
   330  						field:  "RequestTrailers",
   331  						reason: "embedded message failed validation",
   332  						cause:  err,
   333  					})
   334  				}
   335  			}
   336  		} else if v, ok := interface{}(m.GetRequestTrailers()).(interface{ Validate() error }); ok {
   337  			if err := v.Validate(); err != nil {
   338  				return HttpStreamedTraceSegmentValidationError{
   339  					field:  "RequestTrailers",
   340  					reason: "embedded message failed validation",
   341  					cause:  err,
   342  				}
   343  			}
   344  		}
   345  
   346  	case *HttpStreamedTraceSegment_ResponseHeaders:
   347  		if v == nil {
   348  			err := HttpStreamedTraceSegmentValidationError{
   349  				field:  "MessagePiece",
   350  				reason: "oneof value cannot be a typed-nil",
   351  			}
   352  			if !all {
   353  				return err
   354  			}
   355  			errors = append(errors, err)
   356  		}
   357  
   358  		if all {
   359  			switch v := interface{}(m.GetResponseHeaders()).(type) {
   360  			case interface{ ValidateAll() error }:
   361  				if err := v.ValidateAll(); err != nil {
   362  					errors = append(errors, HttpStreamedTraceSegmentValidationError{
   363  						field:  "ResponseHeaders",
   364  						reason: "embedded message failed validation",
   365  						cause:  err,
   366  					})
   367  				}
   368  			case interface{ Validate() error }:
   369  				if err := v.Validate(); err != nil {
   370  					errors = append(errors, HttpStreamedTraceSegmentValidationError{
   371  						field:  "ResponseHeaders",
   372  						reason: "embedded message failed validation",
   373  						cause:  err,
   374  					})
   375  				}
   376  			}
   377  		} else if v, ok := interface{}(m.GetResponseHeaders()).(interface{ Validate() error }); ok {
   378  			if err := v.Validate(); err != nil {
   379  				return HttpStreamedTraceSegmentValidationError{
   380  					field:  "ResponseHeaders",
   381  					reason: "embedded message failed validation",
   382  					cause:  err,
   383  				}
   384  			}
   385  		}
   386  
   387  	case *HttpStreamedTraceSegment_ResponseBodyChunk:
   388  		if v == nil {
   389  			err := HttpStreamedTraceSegmentValidationError{
   390  				field:  "MessagePiece",
   391  				reason: "oneof value cannot be a typed-nil",
   392  			}
   393  			if !all {
   394  				return err
   395  			}
   396  			errors = append(errors, err)
   397  		}
   398  
   399  		if all {
   400  			switch v := interface{}(m.GetResponseBodyChunk()).(type) {
   401  			case interface{ ValidateAll() error }:
   402  				if err := v.ValidateAll(); err != nil {
   403  					errors = append(errors, HttpStreamedTraceSegmentValidationError{
   404  						field:  "ResponseBodyChunk",
   405  						reason: "embedded message failed validation",
   406  						cause:  err,
   407  					})
   408  				}
   409  			case interface{ Validate() error }:
   410  				if err := v.Validate(); err != nil {
   411  					errors = append(errors, HttpStreamedTraceSegmentValidationError{
   412  						field:  "ResponseBodyChunk",
   413  						reason: "embedded message failed validation",
   414  						cause:  err,
   415  					})
   416  				}
   417  			}
   418  		} else if v, ok := interface{}(m.GetResponseBodyChunk()).(interface{ Validate() error }); ok {
   419  			if err := v.Validate(); err != nil {
   420  				return HttpStreamedTraceSegmentValidationError{
   421  					field:  "ResponseBodyChunk",
   422  					reason: "embedded message failed validation",
   423  					cause:  err,
   424  				}
   425  			}
   426  		}
   427  
   428  	case *HttpStreamedTraceSegment_ResponseTrailers:
   429  		if v == nil {
   430  			err := HttpStreamedTraceSegmentValidationError{
   431  				field:  "MessagePiece",
   432  				reason: "oneof value cannot be a typed-nil",
   433  			}
   434  			if !all {
   435  				return err
   436  			}
   437  			errors = append(errors, err)
   438  		}
   439  
   440  		if all {
   441  			switch v := interface{}(m.GetResponseTrailers()).(type) {
   442  			case interface{ ValidateAll() error }:
   443  				if err := v.ValidateAll(); err != nil {
   444  					errors = append(errors, HttpStreamedTraceSegmentValidationError{
   445  						field:  "ResponseTrailers",
   446  						reason: "embedded message failed validation",
   447  						cause:  err,
   448  					})
   449  				}
   450  			case interface{ Validate() error }:
   451  				if err := v.Validate(); err != nil {
   452  					errors = append(errors, HttpStreamedTraceSegmentValidationError{
   453  						field:  "ResponseTrailers",
   454  						reason: "embedded message failed validation",
   455  						cause:  err,
   456  					})
   457  				}
   458  			}
   459  		} else if v, ok := interface{}(m.GetResponseTrailers()).(interface{ Validate() error }); ok {
   460  			if err := v.Validate(); err != nil {
   461  				return HttpStreamedTraceSegmentValidationError{
   462  					field:  "ResponseTrailers",
   463  					reason: "embedded message failed validation",
   464  					cause:  err,
   465  				}
   466  			}
   467  		}
   468  
   469  	default:
   470  		_ = v // ensures v is used
   471  	}
   472  
   473  	if len(errors) > 0 {
   474  		return HttpStreamedTraceSegmentMultiError(errors)
   475  	}
   476  
   477  	return nil
   478  }
   479  
   480  // HttpStreamedTraceSegmentMultiError is an error wrapping multiple validation
   481  // errors returned by HttpStreamedTraceSegment.ValidateAll() if the designated
   482  // constraints aren't met.
   483  type HttpStreamedTraceSegmentMultiError []error
   484  
   485  // Error returns a concatenation of all the error messages it wraps.
   486  func (m HttpStreamedTraceSegmentMultiError) Error() string {
   487  	var msgs []string
   488  	for _, err := range m {
   489  		msgs = append(msgs, err.Error())
   490  	}
   491  	return strings.Join(msgs, "; ")
   492  }
   493  
   494  // AllErrors returns a list of validation violation errors.
   495  func (m HttpStreamedTraceSegmentMultiError) AllErrors() []error { return m }
   496  
   497  // HttpStreamedTraceSegmentValidationError is the validation error returned by
   498  // HttpStreamedTraceSegment.Validate if the designated constraints aren't met.
   499  type HttpStreamedTraceSegmentValidationError struct {
   500  	field  string
   501  	reason string
   502  	cause  error
   503  	key    bool
   504  }
   505  
   506  // Field function returns field value.
   507  func (e HttpStreamedTraceSegmentValidationError) Field() string { return e.field }
   508  
   509  // Reason function returns reason value.
   510  func (e HttpStreamedTraceSegmentValidationError) Reason() string { return e.reason }
   511  
   512  // Cause function returns cause value.
   513  func (e HttpStreamedTraceSegmentValidationError) Cause() error { return e.cause }
   514  
   515  // Key function returns key value.
   516  func (e HttpStreamedTraceSegmentValidationError) Key() bool { return e.key }
   517  
   518  // ErrorName returns error name.
   519  func (e HttpStreamedTraceSegmentValidationError) ErrorName() string {
   520  	return "HttpStreamedTraceSegmentValidationError"
   521  }
   522  
   523  // Error satisfies the builtin error interface
   524  func (e HttpStreamedTraceSegmentValidationError) Error() string {
   525  	cause := ""
   526  	if e.cause != nil {
   527  		cause = fmt.Sprintf(" | caused by: %v", e.cause)
   528  	}
   529  
   530  	key := ""
   531  	if e.key {
   532  		key = "key for "
   533  	}
   534  
   535  	return fmt.Sprintf(
   536  		"invalid %sHttpStreamedTraceSegment.%s: %s%s",
   537  		key,
   538  		e.field,
   539  		e.reason,
   540  		cause)
   541  }
   542  
   543  var _ error = HttpStreamedTraceSegmentValidationError{}
   544  
   545  var _ interface {
   546  	Field() string
   547  	Reason() string
   548  	Key() bool
   549  	Cause() error
   550  	ErrorName() string
   551  } = HttpStreamedTraceSegmentValidationError{}
   552  
   553  // Validate checks the field values on HttpBufferedTrace_Message with the rules
   554  // defined in the proto definition for this message. If any rules are
   555  // violated, the first error encountered is returned, or nil if there are no violations.
   556  func (m *HttpBufferedTrace_Message) Validate() error {
   557  	return m.validate(false)
   558  }
   559  
   560  // ValidateAll checks the field values on HttpBufferedTrace_Message with the
   561  // rules defined in the proto definition for this message. If any rules are
   562  // violated, the result is a list of violation errors wrapped in
   563  // HttpBufferedTrace_MessageMultiError, or nil if none found.
   564  func (m *HttpBufferedTrace_Message) ValidateAll() error {
   565  	return m.validate(true)
   566  }
   567  
   568  func (m *HttpBufferedTrace_Message) validate(all bool) error {
   569  	if m == nil {
   570  		return nil
   571  	}
   572  
   573  	var errors []error
   574  
   575  	for idx, item := range m.GetHeaders() {
   576  		_, _ = idx, item
   577  
   578  		if all {
   579  			switch v := interface{}(item).(type) {
   580  			case interface{ ValidateAll() error }:
   581  				if err := v.ValidateAll(); err != nil {
   582  					errors = append(errors, HttpBufferedTrace_MessageValidationError{
   583  						field:  fmt.Sprintf("Headers[%v]", idx),
   584  						reason: "embedded message failed validation",
   585  						cause:  err,
   586  					})
   587  				}
   588  			case interface{ Validate() error }:
   589  				if err := v.Validate(); err != nil {
   590  					errors = append(errors, HttpBufferedTrace_MessageValidationError{
   591  						field:  fmt.Sprintf("Headers[%v]", idx),
   592  						reason: "embedded message failed validation",
   593  						cause:  err,
   594  					})
   595  				}
   596  			}
   597  		} else if v, ok := interface{}(item).(interface{ Validate() error }); ok {
   598  			if err := v.Validate(); err != nil {
   599  				return HttpBufferedTrace_MessageValidationError{
   600  					field:  fmt.Sprintf("Headers[%v]", idx),
   601  					reason: "embedded message failed validation",
   602  					cause:  err,
   603  				}
   604  			}
   605  		}
   606  
   607  	}
   608  
   609  	if all {
   610  		switch v := interface{}(m.GetBody()).(type) {
   611  		case interface{ ValidateAll() error }:
   612  			if err := v.ValidateAll(); err != nil {
   613  				errors = append(errors, HttpBufferedTrace_MessageValidationError{
   614  					field:  "Body",
   615  					reason: "embedded message failed validation",
   616  					cause:  err,
   617  				})
   618  			}
   619  		case interface{ Validate() error }:
   620  			if err := v.Validate(); err != nil {
   621  				errors = append(errors, HttpBufferedTrace_MessageValidationError{
   622  					field:  "Body",
   623  					reason: "embedded message failed validation",
   624  					cause:  err,
   625  				})
   626  			}
   627  		}
   628  	} else if v, ok := interface{}(m.GetBody()).(interface{ Validate() error }); ok {
   629  		if err := v.Validate(); err != nil {
   630  			return HttpBufferedTrace_MessageValidationError{
   631  				field:  "Body",
   632  				reason: "embedded message failed validation",
   633  				cause:  err,
   634  			}
   635  		}
   636  	}
   637  
   638  	for idx, item := range m.GetTrailers() {
   639  		_, _ = idx, item
   640  
   641  		if all {
   642  			switch v := interface{}(item).(type) {
   643  			case interface{ ValidateAll() error }:
   644  				if err := v.ValidateAll(); err != nil {
   645  					errors = append(errors, HttpBufferedTrace_MessageValidationError{
   646  						field:  fmt.Sprintf("Trailers[%v]", idx),
   647  						reason: "embedded message failed validation",
   648  						cause:  err,
   649  					})
   650  				}
   651  			case interface{ Validate() error }:
   652  				if err := v.Validate(); err != nil {
   653  					errors = append(errors, HttpBufferedTrace_MessageValidationError{
   654  						field:  fmt.Sprintf("Trailers[%v]", idx),
   655  						reason: "embedded message failed validation",
   656  						cause:  err,
   657  					})
   658  				}
   659  			}
   660  		} else if v, ok := interface{}(item).(interface{ Validate() error }); ok {
   661  			if err := v.Validate(); err != nil {
   662  				return HttpBufferedTrace_MessageValidationError{
   663  					field:  fmt.Sprintf("Trailers[%v]", idx),
   664  					reason: "embedded message failed validation",
   665  					cause:  err,
   666  				}
   667  			}
   668  		}
   669  
   670  	}
   671  
   672  	if len(errors) > 0 {
   673  		return HttpBufferedTrace_MessageMultiError(errors)
   674  	}
   675  
   676  	return nil
   677  }
   678  
   679  // HttpBufferedTrace_MessageMultiError is an error wrapping multiple validation
   680  // errors returned by HttpBufferedTrace_Message.ValidateAll() if the
   681  // designated constraints aren't met.
   682  type HttpBufferedTrace_MessageMultiError []error
   683  
   684  // Error returns a concatenation of all the error messages it wraps.
   685  func (m HttpBufferedTrace_MessageMultiError) Error() string {
   686  	var msgs []string
   687  	for _, err := range m {
   688  		msgs = append(msgs, err.Error())
   689  	}
   690  	return strings.Join(msgs, "; ")
   691  }
   692  
   693  // AllErrors returns a list of validation violation errors.
   694  func (m HttpBufferedTrace_MessageMultiError) AllErrors() []error { return m }
   695  
   696  // HttpBufferedTrace_MessageValidationError is the validation error returned by
   697  // HttpBufferedTrace_Message.Validate if the designated constraints aren't met.
   698  type HttpBufferedTrace_MessageValidationError struct {
   699  	field  string
   700  	reason string
   701  	cause  error
   702  	key    bool
   703  }
   704  
   705  // Field function returns field value.
   706  func (e HttpBufferedTrace_MessageValidationError) Field() string { return e.field }
   707  
   708  // Reason function returns reason value.
   709  func (e HttpBufferedTrace_MessageValidationError) Reason() string { return e.reason }
   710  
   711  // Cause function returns cause value.
   712  func (e HttpBufferedTrace_MessageValidationError) Cause() error { return e.cause }
   713  
   714  // Key function returns key value.
   715  func (e HttpBufferedTrace_MessageValidationError) Key() bool { return e.key }
   716  
   717  // ErrorName returns error name.
   718  func (e HttpBufferedTrace_MessageValidationError) ErrorName() string {
   719  	return "HttpBufferedTrace_MessageValidationError"
   720  }
   721  
   722  // Error satisfies the builtin error interface
   723  func (e HttpBufferedTrace_MessageValidationError) Error() string {
   724  	cause := ""
   725  	if e.cause != nil {
   726  		cause = fmt.Sprintf(" | caused by: %v", e.cause)
   727  	}
   728  
   729  	key := ""
   730  	if e.key {
   731  		key = "key for "
   732  	}
   733  
   734  	return fmt.Sprintf(
   735  		"invalid %sHttpBufferedTrace_Message.%s: %s%s",
   736  		key,
   737  		e.field,
   738  		e.reason,
   739  		cause)
   740  }
   741  
   742  var _ error = HttpBufferedTrace_MessageValidationError{}
   743  
   744  var _ interface {
   745  	Field() string
   746  	Reason() string
   747  	Key() bool
   748  	Cause() error
   749  	ErrorName() string
   750  } = HttpBufferedTrace_MessageValidationError{}
   751  

View as plain text