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

     1  // Code generated by protoc-gen-validate. DO NOT EDIT.
     2  // source: envoy/data/tap/v2alpha/http.proto
     3  
     4  package envoy_data_tap_v2alpha
     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 HttpBufferedTrace with the rules defined
    37  // in the proto definition for this message. If any rules are violated, an
    38  // error is returned.
    39  func (m *HttpBufferedTrace) Validate() error {
    40  	if m == nil {
    41  		return nil
    42  	}
    43  
    44  	if v, ok := interface{}(m.GetRequest()).(interface{ Validate() error }); ok {
    45  		if err := v.Validate(); err != nil {
    46  			return HttpBufferedTraceValidationError{
    47  				field:  "Request",
    48  				reason: "embedded message failed validation",
    49  				cause:  err,
    50  			}
    51  		}
    52  	}
    53  
    54  	if v, ok := interface{}(m.GetResponse()).(interface{ Validate() error }); ok {
    55  		if err := v.Validate(); err != nil {
    56  			return HttpBufferedTraceValidationError{
    57  				field:  "Response",
    58  				reason: "embedded message failed validation",
    59  				cause:  err,
    60  			}
    61  		}
    62  	}
    63  
    64  	return nil
    65  }
    66  
    67  // HttpBufferedTraceValidationError is the validation error returned by
    68  // HttpBufferedTrace.Validate if the designated constraints aren't met.
    69  type HttpBufferedTraceValidationError struct {
    70  	field  string
    71  	reason string
    72  	cause  error
    73  	key    bool
    74  }
    75  
    76  // Field function returns field value.
    77  func (e HttpBufferedTraceValidationError) Field() string { return e.field }
    78  
    79  // Reason function returns reason value.
    80  func (e HttpBufferedTraceValidationError) Reason() string { return e.reason }
    81  
    82  // Cause function returns cause value.
    83  func (e HttpBufferedTraceValidationError) Cause() error { return e.cause }
    84  
    85  // Key function returns key value.
    86  func (e HttpBufferedTraceValidationError) Key() bool { return e.key }
    87  
    88  // ErrorName returns error name.
    89  func (e HttpBufferedTraceValidationError) ErrorName() string {
    90  	return "HttpBufferedTraceValidationError"
    91  }
    92  
    93  // Error satisfies the builtin error interface
    94  func (e HttpBufferedTraceValidationError) Error() string {
    95  	cause := ""
    96  	if e.cause != nil {
    97  		cause = fmt.Sprintf(" | caused by: %v", e.cause)
    98  	}
    99  
   100  	key := ""
   101  	if e.key {
   102  		key = "key for "
   103  	}
   104  
   105  	return fmt.Sprintf(
   106  		"invalid %sHttpBufferedTrace.%s: %s%s",
   107  		key,
   108  		e.field,
   109  		e.reason,
   110  		cause)
   111  }
   112  
   113  var _ error = HttpBufferedTraceValidationError{}
   114  
   115  var _ interface {
   116  	Field() string
   117  	Reason() string
   118  	Key() bool
   119  	Cause() error
   120  	ErrorName() string
   121  } = HttpBufferedTraceValidationError{}
   122  
   123  // Validate checks the field values on HttpStreamedTraceSegment with the rules
   124  // defined in the proto definition for this message. If any rules are
   125  // violated, an error is returned.
   126  func (m *HttpStreamedTraceSegment) Validate() error {
   127  	if m == nil {
   128  		return nil
   129  	}
   130  
   131  	// no validation rules for TraceId
   132  
   133  	switch m.MessagePiece.(type) {
   134  
   135  	case *HttpStreamedTraceSegment_RequestHeaders:
   136  
   137  		if v, ok := interface{}(m.GetRequestHeaders()).(interface{ Validate() error }); ok {
   138  			if err := v.Validate(); err != nil {
   139  				return HttpStreamedTraceSegmentValidationError{
   140  					field:  "RequestHeaders",
   141  					reason: "embedded message failed validation",
   142  					cause:  err,
   143  				}
   144  			}
   145  		}
   146  
   147  	case *HttpStreamedTraceSegment_RequestBodyChunk:
   148  
   149  		if v, ok := interface{}(m.GetRequestBodyChunk()).(interface{ Validate() error }); ok {
   150  			if err := v.Validate(); err != nil {
   151  				return HttpStreamedTraceSegmentValidationError{
   152  					field:  "RequestBodyChunk",
   153  					reason: "embedded message failed validation",
   154  					cause:  err,
   155  				}
   156  			}
   157  		}
   158  
   159  	case *HttpStreamedTraceSegment_RequestTrailers:
   160  
   161  		if v, ok := interface{}(m.GetRequestTrailers()).(interface{ Validate() error }); ok {
   162  			if err := v.Validate(); err != nil {
   163  				return HttpStreamedTraceSegmentValidationError{
   164  					field:  "RequestTrailers",
   165  					reason: "embedded message failed validation",
   166  					cause:  err,
   167  				}
   168  			}
   169  		}
   170  
   171  	case *HttpStreamedTraceSegment_ResponseHeaders:
   172  
   173  		if v, ok := interface{}(m.GetResponseHeaders()).(interface{ Validate() error }); ok {
   174  			if err := v.Validate(); err != nil {
   175  				return HttpStreamedTraceSegmentValidationError{
   176  					field:  "ResponseHeaders",
   177  					reason: "embedded message failed validation",
   178  					cause:  err,
   179  				}
   180  			}
   181  		}
   182  
   183  	case *HttpStreamedTraceSegment_ResponseBodyChunk:
   184  
   185  		if v, ok := interface{}(m.GetResponseBodyChunk()).(interface{ Validate() error }); ok {
   186  			if err := v.Validate(); err != nil {
   187  				return HttpStreamedTraceSegmentValidationError{
   188  					field:  "ResponseBodyChunk",
   189  					reason: "embedded message failed validation",
   190  					cause:  err,
   191  				}
   192  			}
   193  		}
   194  
   195  	case *HttpStreamedTraceSegment_ResponseTrailers:
   196  
   197  		if v, ok := interface{}(m.GetResponseTrailers()).(interface{ Validate() error }); ok {
   198  			if err := v.Validate(); err != nil {
   199  				return HttpStreamedTraceSegmentValidationError{
   200  					field:  "ResponseTrailers",
   201  					reason: "embedded message failed validation",
   202  					cause:  err,
   203  				}
   204  			}
   205  		}
   206  
   207  	}
   208  
   209  	return nil
   210  }
   211  
   212  // HttpStreamedTraceSegmentValidationError is the validation error returned by
   213  // HttpStreamedTraceSegment.Validate if the designated constraints aren't met.
   214  type HttpStreamedTraceSegmentValidationError struct {
   215  	field  string
   216  	reason string
   217  	cause  error
   218  	key    bool
   219  }
   220  
   221  // Field function returns field value.
   222  func (e HttpStreamedTraceSegmentValidationError) Field() string { return e.field }
   223  
   224  // Reason function returns reason value.
   225  func (e HttpStreamedTraceSegmentValidationError) Reason() string { return e.reason }
   226  
   227  // Cause function returns cause value.
   228  func (e HttpStreamedTraceSegmentValidationError) Cause() error { return e.cause }
   229  
   230  // Key function returns key value.
   231  func (e HttpStreamedTraceSegmentValidationError) Key() bool { return e.key }
   232  
   233  // ErrorName returns error name.
   234  func (e HttpStreamedTraceSegmentValidationError) ErrorName() string {
   235  	return "HttpStreamedTraceSegmentValidationError"
   236  }
   237  
   238  // Error satisfies the builtin error interface
   239  func (e HttpStreamedTraceSegmentValidationError) Error() string {
   240  	cause := ""
   241  	if e.cause != nil {
   242  		cause = fmt.Sprintf(" | caused by: %v", e.cause)
   243  	}
   244  
   245  	key := ""
   246  	if e.key {
   247  		key = "key for "
   248  	}
   249  
   250  	return fmt.Sprintf(
   251  		"invalid %sHttpStreamedTraceSegment.%s: %s%s",
   252  		key,
   253  		e.field,
   254  		e.reason,
   255  		cause)
   256  }
   257  
   258  var _ error = HttpStreamedTraceSegmentValidationError{}
   259  
   260  var _ interface {
   261  	Field() string
   262  	Reason() string
   263  	Key() bool
   264  	Cause() error
   265  	ErrorName() string
   266  } = HttpStreamedTraceSegmentValidationError{}
   267  
   268  // Validate checks the field values on HttpBufferedTrace_Message with the rules
   269  // defined in the proto definition for this message. If any rules are
   270  // violated, an error is returned.
   271  func (m *HttpBufferedTrace_Message) Validate() error {
   272  	if m == nil {
   273  		return nil
   274  	}
   275  
   276  	for idx, item := range m.GetHeaders() {
   277  		_, _ = idx, item
   278  
   279  		if v, ok := interface{}(item).(interface{ Validate() error }); ok {
   280  			if err := v.Validate(); err != nil {
   281  				return HttpBufferedTrace_MessageValidationError{
   282  					field:  fmt.Sprintf("Headers[%v]", idx),
   283  					reason: "embedded message failed validation",
   284  					cause:  err,
   285  				}
   286  			}
   287  		}
   288  
   289  	}
   290  
   291  	if v, ok := interface{}(m.GetBody()).(interface{ Validate() error }); ok {
   292  		if err := v.Validate(); err != nil {
   293  			return HttpBufferedTrace_MessageValidationError{
   294  				field:  "Body",
   295  				reason: "embedded message failed validation",
   296  				cause:  err,
   297  			}
   298  		}
   299  	}
   300  
   301  	for idx, item := range m.GetTrailers() {
   302  		_, _ = idx, item
   303  
   304  		if v, ok := interface{}(item).(interface{ Validate() error }); ok {
   305  			if err := v.Validate(); err != nil {
   306  				return HttpBufferedTrace_MessageValidationError{
   307  					field:  fmt.Sprintf("Trailers[%v]", idx),
   308  					reason: "embedded message failed validation",
   309  					cause:  err,
   310  				}
   311  			}
   312  		}
   313  
   314  	}
   315  
   316  	return nil
   317  }
   318  
   319  // HttpBufferedTrace_MessageValidationError is the validation error returned by
   320  // HttpBufferedTrace_Message.Validate if the designated constraints aren't met.
   321  type HttpBufferedTrace_MessageValidationError struct {
   322  	field  string
   323  	reason string
   324  	cause  error
   325  	key    bool
   326  }
   327  
   328  // Field function returns field value.
   329  func (e HttpBufferedTrace_MessageValidationError) Field() string { return e.field }
   330  
   331  // Reason function returns reason value.
   332  func (e HttpBufferedTrace_MessageValidationError) Reason() string { return e.reason }
   333  
   334  // Cause function returns cause value.
   335  func (e HttpBufferedTrace_MessageValidationError) Cause() error { return e.cause }
   336  
   337  // Key function returns key value.
   338  func (e HttpBufferedTrace_MessageValidationError) Key() bool { return e.key }
   339  
   340  // ErrorName returns error name.
   341  func (e HttpBufferedTrace_MessageValidationError) ErrorName() string {
   342  	return "HttpBufferedTrace_MessageValidationError"
   343  }
   344  
   345  // Error satisfies the builtin error interface
   346  func (e HttpBufferedTrace_MessageValidationError) Error() string {
   347  	cause := ""
   348  	if e.cause != nil {
   349  		cause = fmt.Sprintf(" | caused by: %v", e.cause)
   350  	}
   351  
   352  	key := ""
   353  	if e.key {
   354  		key = "key for "
   355  	}
   356  
   357  	return fmt.Sprintf(
   358  		"invalid %sHttpBufferedTrace_Message.%s: %s%s",
   359  		key,
   360  		e.field,
   361  		e.reason,
   362  		cause)
   363  }
   364  
   365  var _ error = HttpBufferedTrace_MessageValidationError{}
   366  
   367  var _ interface {
   368  	Field() string
   369  	Reason() string
   370  	Key() bool
   371  	Cause() error
   372  	ErrorName() string
   373  } = HttpBufferedTrace_MessageValidationError{}