...

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

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

     1  // Code generated by protoc-gen-validate. DO NOT EDIT.
     2  // source: envoy/service/tap/v2alpha/tap.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 StreamTapsRequest 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 *StreamTapsRequest) Validate() error {
    42  	return m.validate(false)
    43  }
    44  
    45  // ValidateAll checks the field values on StreamTapsRequest 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  // StreamTapsRequestMultiError, or nil if none found.
    49  func (m *StreamTapsRequest) ValidateAll() error {
    50  	return m.validate(true)
    51  }
    52  
    53  func (m *StreamTapsRequest) 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.GetIdentifier()).(type) {
    62  		case interface{ ValidateAll() error }:
    63  			if err := v.ValidateAll(); err != nil {
    64  				errors = append(errors, StreamTapsRequestValidationError{
    65  					field:  "Identifier",
    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, StreamTapsRequestValidationError{
    73  					field:  "Identifier",
    74  					reason: "embedded message failed validation",
    75  					cause:  err,
    76  				})
    77  			}
    78  		}
    79  	} else if v, ok := interface{}(m.GetIdentifier()).(interface{ Validate() error }); ok {
    80  		if err := v.Validate(); err != nil {
    81  			return StreamTapsRequestValidationError{
    82  				field:  "Identifier",
    83  				reason: "embedded message failed validation",
    84  				cause:  err,
    85  			}
    86  		}
    87  	}
    88  
    89  	// no validation rules for TraceId
    90  
    91  	if all {
    92  		switch v := interface{}(m.GetTrace()).(type) {
    93  		case interface{ ValidateAll() error }:
    94  			if err := v.ValidateAll(); err != nil {
    95  				errors = append(errors, StreamTapsRequestValidationError{
    96  					field:  "Trace",
    97  					reason: "embedded message failed validation",
    98  					cause:  err,
    99  				})
   100  			}
   101  		case interface{ Validate() error }:
   102  			if err := v.Validate(); err != nil {
   103  				errors = append(errors, StreamTapsRequestValidationError{
   104  					field:  "Trace",
   105  					reason: "embedded message failed validation",
   106  					cause:  err,
   107  				})
   108  			}
   109  		}
   110  	} else if v, ok := interface{}(m.GetTrace()).(interface{ Validate() error }); ok {
   111  		if err := v.Validate(); err != nil {
   112  			return StreamTapsRequestValidationError{
   113  				field:  "Trace",
   114  				reason: "embedded message failed validation",
   115  				cause:  err,
   116  			}
   117  		}
   118  	}
   119  
   120  	if len(errors) > 0 {
   121  		return StreamTapsRequestMultiError(errors)
   122  	}
   123  
   124  	return nil
   125  }
   126  
   127  // StreamTapsRequestMultiError is an error wrapping multiple validation errors
   128  // returned by StreamTapsRequest.ValidateAll() if the designated constraints
   129  // aren't met.
   130  type StreamTapsRequestMultiError []error
   131  
   132  // Error returns a concatenation of all the error messages it wraps.
   133  func (m StreamTapsRequestMultiError) Error() string {
   134  	var msgs []string
   135  	for _, err := range m {
   136  		msgs = append(msgs, err.Error())
   137  	}
   138  	return strings.Join(msgs, "; ")
   139  }
   140  
   141  // AllErrors returns a list of validation violation errors.
   142  func (m StreamTapsRequestMultiError) AllErrors() []error { return m }
   143  
   144  // StreamTapsRequestValidationError is the validation error returned by
   145  // StreamTapsRequest.Validate if the designated constraints aren't met.
   146  type StreamTapsRequestValidationError struct {
   147  	field  string
   148  	reason string
   149  	cause  error
   150  	key    bool
   151  }
   152  
   153  // Field function returns field value.
   154  func (e StreamTapsRequestValidationError) Field() string { return e.field }
   155  
   156  // Reason function returns reason value.
   157  func (e StreamTapsRequestValidationError) Reason() string { return e.reason }
   158  
   159  // Cause function returns cause value.
   160  func (e StreamTapsRequestValidationError) Cause() error { return e.cause }
   161  
   162  // Key function returns key value.
   163  func (e StreamTapsRequestValidationError) Key() bool { return e.key }
   164  
   165  // ErrorName returns error name.
   166  func (e StreamTapsRequestValidationError) ErrorName() string {
   167  	return "StreamTapsRequestValidationError"
   168  }
   169  
   170  // Error satisfies the builtin error interface
   171  func (e StreamTapsRequestValidationError) Error() string {
   172  	cause := ""
   173  	if e.cause != nil {
   174  		cause = fmt.Sprintf(" | caused by: %v", e.cause)
   175  	}
   176  
   177  	key := ""
   178  	if e.key {
   179  		key = "key for "
   180  	}
   181  
   182  	return fmt.Sprintf(
   183  		"invalid %sStreamTapsRequest.%s: %s%s",
   184  		key,
   185  		e.field,
   186  		e.reason,
   187  		cause)
   188  }
   189  
   190  var _ error = StreamTapsRequestValidationError{}
   191  
   192  var _ interface {
   193  	Field() string
   194  	Reason() string
   195  	Key() bool
   196  	Cause() error
   197  	ErrorName() string
   198  } = StreamTapsRequestValidationError{}
   199  
   200  // Validate checks the field values on StreamTapsResponse with the rules
   201  // defined in the proto definition for this message. If any rules are
   202  // violated, the first error encountered is returned, or nil if there are no violations.
   203  func (m *StreamTapsResponse) Validate() error {
   204  	return m.validate(false)
   205  }
   206  
   207  // ValidateAll checks the field values on StreamTapsResponse with the rules
   208  // defined in the proto definition for this message. If any rules are
   209  // violated, the result is a list of violation errors wrapped in
   210  // StreamTapsResponseMultiError, or nil if none found.
   211  func (m *StreamTapsResponse) ValidateAll() error {
   212  	return m.validate(true)
   213  }
   214  
   215  func (m *StreamTapsResponse) validate(all bool) error {
   216  	if m == nil {
   217  		return nil
   218  	}
   219  
   220  	var errors []error
   221  
   222  	if len(errors) > 0 {
   223  		return StreamTapsResponseMultiError(errors)
   224  	}
   225  
   226  	return nil
   227  }
   228  
   229  // StreamTapsResponseMultiError is an error wrapping multiple validation errors
   230  // returned by StreamTapsResponse.ValidateAll() if the designated constraints
   231  // aren't met.
   232  type StreamTapsResponseMultiError []error
   233  
   234  // Error returns a concatenation of all the error messages it wraps.
   235  func (m StreamTapsResponseMultiError) Error() string {
   236  	var msgs []string
   237  	for _, err := range m {
   238  		msgs = append(msgs, err.Error())
   239  	}
   240  	return strings.Join(msgs, "; ")
   241  }
   242  
   243  // AllErrors returns a list of validation violation errors.
   244  func (m StreamTapsResponseMultiError) AllErrors() []error { return m }
   245  
   246  // StreamTapsResponseValidationError is the validation error returned by
   247  // StreamTapsResponse.Validate if the designated constraints aren't met.
   248  type StreamTapsResponseValidationError struct {
   249  	field  string
   250  	reason string
   251  	cause  error
   252  	key    bool
   253  }
   254  
   255  // Field function returns field value.
   256  func (e StreamTapsResponseValidationError) Field() string { return e.field }
   257  
   258  // Reason function returns reason value.
   259  func (e StreamTapsResponseValidationError) Reason() string { return e.reason }
   260  
   261  // Cause function returns cause value.
   262  func (e StreamTapsResponseValidationError) Cause() error { return e.cause }
   263  
   264  // Key function returns key value.
   265  func (e StreamTapsResponseValidationError) Key() bool { return e.key }
   266  
   267  // ErrorName returns error name.
   268  func (e StreamTapsResponseValidationError) ErrorName() string {
   269  	return "StreamTapsResponseValidationError"
   270  }
   271  
   272  // Error satisfies the builtin error interface
   273  func (e StreamTapsResponseValidationError) Error() string {
   274  	cause := ""
   275  	if e.cause != nil {
   276  		cause = fmt.Sprintf(" | caused by: %v", e.cause)
   277  	}
   278  
   279  	key := ""
   280  	if e.key {
   281  		key = "key for "
   282  	}
   283  
   284  	return fmt.Sprintf(
   285  		"invalid %sStreamTapsResponse.%s: %s%s",
   286  		key,
   287  		e.field,
   288  		e.reason,
   289  		cause)
   290  }
   291  
   292  var _ error = StreamTapsResponseValidationError{}
   293  
   294  var _ interface {
   295  	Field() string
   296  	Reason() string
   297  	Key() bool
   298  	Cause() error
   299  	ErrorName() string
   300  } = StreamTapsResponseValidationError{}
   301  
   302  // Validate checks the field values on StreamTapsRequest_Identifier with the
   303  // rules defined in the proto definition for this message. If any rules are
   304  // violated, the first error encountered is returned, or nil if there are no violations.
   305  func (m *StreamTapsRequest_Identifier) Validate() error {
   306  	return m.validate(false)
   307  }
   308  
   309  // ValidateAll checks the field values on StreamTapsRequest_Identifier with the
   310  // rules defined in the proto definition for this message. If any rules are
   311  // violated, the result is a list of violation errors wrapped in
   312  // StreamTapsRequest_IdentifierMultiError, or nil if none found.
   313  func (m *StreamTapsRequest_Identifier) ValidateAll() error {
   314  	return m.validate(true)
   315  }
   316  
   317  func (m *StreamTapsRequest_Identifier) validate(all bool) error {
   318  	if m == nil {
   319  		return nil
   320  	}
   321  
   322  	var errors []error
   323  
   324  	if m.GetNode() == nil {
   325  		err := StreamTapsRequest_IdentifierValidationError{
   326  			field:  "Node",
   327  			reason: "value is required",
   328  		}
   329  		if !all {
   330  			return err
   331  		}
   332  		errors = append(errors, err)
   333  	}
   334  
   335  	if all {
   336  		switch v := interface{}(m.GetNode()).(type) {
   337  		case interface{ ValidateAll() error }:
   338  			if err := v.ValidateAll(); err != nil {
   339  				errors = append(errors, StreamTapsRequest_IdentifierValidationError{
   340  					field:  "Node",
   341  					reason: "embedded message failed validation",
   342  					cause:  err,
   343  				})
   344  			}
   345  		case interface{ Validate() error }:
   346  			if err := v.Validate(); err != nil {
   347  				errors = append(errors, StreamTapsRequest_IdentifierValidationError{
   348  					field:  "Node",
   349  					reason: "embedded message failed validation",
   350  					cause:  err,
   351  				})
   352  			}
   353  		}
   354  	} else if v, ok := interface{}(m.GetNode()).(interface{ Validate() error }); ok {
   355  		if err := v.Validate(); err != nil {
   356  			return StreamTapsRequest_IdentifierValidationError{
   357  				field:  "Node",
   358  				reason: "embedded message failed validation",
   359  				cause:  err,
   360  			}
   361  		}
   362  	}
   363  
   364  	// no validation rules for TapId
   365  
   366  	if len(errors) > 0 {
   367  		return StreamTapsRequest_IdentifierMultiError(errors)
   368  	}
   369  
   370  	return nil
   371  }
   372  
   373  // StreamTapsRequest_IdentifierMultiError is an error wrapping multiple
   374  // validation errors returned by StreamTapsRequest_Identifier.ValidateAll() if
   375  // the designated constraints aren't met.
   376  type StreamTapsRequest_IdentifierMultiError []error
   377  
   378  // Error returns a concatenation of all the error messages it wraps.
   379  func (m StreamTapsRequest_IdentifierMultiError) Error() string {
   380  	var msgs []string
   381  	for _, err := range m {
   382  		msgs = append(msgs, err.Error())
   383  	}
   384  	return strings.Join(msgs, "; ")
   385  }
   386  
   387  // AllErrors returns a list of validation violation errors.
   388  func (m StreamTapsRequest_IdentifierMultiError) AllErrors() []error { return m }
   389  
   390  // StreamTapsRequest_IdentifierValidationError is the validation error returned
   391  // by StreamTapsRequest_Identifier.Validate if the designated constraints
   392  // aren't met.
   393  type StreamTapsRequest_IdentifierValidationError struct {
   394  	field  string
   395  	reason string
   396  	cause  error
   397  	key    bool
   398  }
   399  
   400  // Field function returns field value.
   401  func (e StreamTapsRequest_IdentifierValidationError) Field() string { return e.field }
   402  
   403  // Reason function returns reason value.
   404  func (e StreamTapsRequest_IdentifierValidationError) Reason() string { return e.reason }
   405  
   406  // Cause function returns cause value.
   407  func (e StreamTapsRequest_IdentifierValidationError) Cause() error { return e.cause }
   408  
   409  // Key function returns key value.
   410  func (e StreamTapsRequest_IdentifierValidationError) Key() bool { return e.key }
   411  
   412  // ErrorName returns error name.
   413  func (e StreamTapsRequest_IdentifierValidationError) ErrorName() string {
   414  	return "StreamTapsRequest_IdentifierValidationError"
   415  }
   416  
   417  // Error satisfies the builtin error interface
   418  func (e StreamTapsRequest_IdentifierValidationError) Error() string {
   419  	cause := ""
   420  	if e.cause != nil {
   421  		cause = fmt.Sprintf(" | caused by: %v", e.cause)
   422  	}
   423  
   424  	key := ""
   425  	if e.key {
   426  		key = "key for "
   427  	}
   428  
   429  	return fmt.Sprintf(
   430  		"invalid %sStreamTapsRequest_Identifier.%s: %s%s",
   431  		key,
   432  		e.field,
   433  		e.reason,
   434  		cause)
   435  }
   436  
   437  var _ error = StreamTapsRequest_IdentifierValidationError{}
   438  
   439  var _ interface {
   440  	Field() string
   441  	Reason() string
   442  	Key() bool
   443  	Cause() error
   444  	ErrorName() string
   445  } = StreamTapsRequest_IdentifierValidationError{}
   446  

View as plain text