...

Source file src/github.com/emissary-ingress/emissary/v3/pkg/api/envoy/service/auth/v2/attribute_context.pb.validate.go

Documentation: github.com/emissary-ingress/emissary/v3/pkg/api/envoy/service/auth/v2

     1  // Code generated by protoc-gen-validate. DO NOT EDIT.
     2  // source: envoy/service/auth/v2/attribute_context.proto
     3  
     4  package authv2
     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 AttributeContext 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 *AttributeContext) Validate() error {
    42  	return m.validate(false)
    43  }
    44  
    45  // ValidateAll checks the field values on AttributeContext 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  // AttributeContextMultiError, or nil if none found.
    49  func (m *AttributeContext) ValidateAll() error {
    50  	return m.validate(true)
    51  }
    52  
    53  func (m *AttributeContext) 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.GetSource()).(type) {
    62  		case interface{ ValidateAll() error }:
    63  			if err := v.ValidateAll(); err != nil {
    64  				errors = append(errors, AttributeContextValidationError{
    65  					field:  "Source",
    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, AttributeContextValidationError{
    73  					field:  "Source",
    74  					reason: "embedded message failed validation",
    75  					cause:  err,
    76  				})
    77  			}
    78  		}
    79  	} else if v, ok := interface{}(m.GetSource()).(interface{ Validate() error }); ok {
    80  		if err := v.Validate(); err != nil {
    81  			return AttributeContextValidationError{
    82  				field:  "Source",
    83  				reason: "embedded message failed validation",
    84  				cause:  err,
    85  			}
    86  		}
    87  	}
    88  
    89  	if all {
    90  		switch v := interface{}(m.GetDestination()).(type) {
    91  		case interface{ ValidateAll() error }:
    92  			if err := v.ValidateAll(); err != nil {
    93  				errors = append(errors, AttributeContextValidationError{
    94  					field:  "Destination",
    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, AttributeContextValidationError{
   102  					field:  "Destination",
   103  					reason: "embedded message failed validation",
   104  					cause:  err,
   105  				})
   106  			}
   107  		}
   108  	} else if v, ok := interface{}(m.GetDestination()).(interface{ Validate() error }); ok {
   109  		if err := v.Validate(); err != nil {
   110  			return AttributeContextValidationError{
   111  				field:  "Destination",
   112  				reason: "embedded message failed validation",
   113  				cause:  err,
   114  			}
   115  		}
   116  	}
   117  
   118  	if all {
   119  		switch v := interface{}(m.GetRequest()).(type) {
   120  		case interface{ ValidateAll() error }:
   121  			if err := v.ValidateAll(); err != nil {
   122  				errors = append(errors, AttributeContextValidationError{
   123  					field:  "Request",
   124  					reason: "embedded message failed validation",
   125  					cause:  err,
   126  				})
   127  			}
   128  		case interface{ Validate() error }:
   129  			if err := v.Validate(); err != nil {
   130  				errors = append(errors, AttributeContextValidationError{
   131  					field:  "Request",
   132  					reason: "embedded message failed validation",
   133  					cause:  err,
   134  				})
   135  			}
   136  		}
   137  	} else if v, ok := interface{}(m.GetRequest()).(interface{ Validate() error }); ok {
   138  		if err := v.Validate(); err != nil {
   139  			return AttributeContextValidationError{
   140  				field:  "Request",
   141  				reason: "embedded message failed validation",
   142  				cause:  err,
   143  			}
   144  		}
   145  	}
   146  
   147  	// no validation rules for ContextExtensions
   148  
   149  	if all {
   150  		switch v := interface{}(m.GetMetadataContext()).(type) {
   151  		case interface{ ValidateAll() error }:
   152  			if err := v.ValidateAll(); err != nil {
   153  				errors = append(errors, AttributeContextValidationError{
   154  					field:  "MetadataContext",
   155  					reason: "embedded message failed validation",
   156  					cause:  err,
   157  				})
   158  			}
   159  		case interface{ Validate() error }:
   160  			if err := v.Validate(); err != nil {
   161  				errors = append(errors, AttributeContextValidationError{
   162  					field:  "MetadataContext",
   163  					reason: "embedded message failed validation",
   164  					cause:  err,
   165  				})
   166  			}
   167  		}
   168  	} else if v, ok := interface{}(m.GetMetadataContext()).(interface{ Validate() error }); ok {
   169  		if err := v.Validate(); err != nil {
   170  			return AttributeContextValidationError{
   171  				field:  "MetadataContext",
   172  				reason: "embedded message failed validation",
   173  				cause:  err,
   174  			}
   175  		}
   176  	}
   177  
   178  	if len(errors) > 0 {
   179  		return AttributeContextMultiError(errors)
   180  	}
   181  
   182  	return nil
   183  }
   184  
   185  // AttributeContextMultiError is an error wrapping multiple validation errors
   186  // returned by AttributeContext.ValidateAll() if the designated constraints
   187  // aren't met.
   188  type AttributeContextMultiError []error
   189  
   190  // Error returns a concatenation of all the error messages it wraps.
   191  func (m AttributeContextMultiError) Error() string {
   192  	var msgs []string
   193  	for _, err := range m {
   194  		msgs = append(msgs, err.Error())
   195  	}
   196  	return strings.Join(msgs, "; ")
   197  }
   198  
   199  // AllErrors returns a list of validation violation errors.
   200  func (m AttributeContextMultiError) AllErrors() []error { return m }
   201  
   202  // AttributeContextValidationError is the validation error returned by
   203  // AttributeContext.Validate if the designated constraints aren't met.
   204  type AttributeContextValidationError struct {
   205  	field  string
   206  	reason string
   207  	cause  error
   208  	key    bool
   209  }
   210  
   211  // Field function returns field value.
   212  func (e AttributeContextValidationError) Field() string { return e.field }
   213  
   214  // Reason function returns reason value.
   215  func (e AttributeContextValidationError) Reason() string { return e.reason }
   216  
   217  // Cause function returns cause value.
   218  func (e AttributeContextValidationError) Cause() error { return e.cause }
   219  
   220  // Key function returns key value.
   221  func (e AttributeContextValidationError) Key() bool { return e.key }
   222  
   223  // ErrorName returns error name.
   224  func (e AttributeContextValidationError) ErrorName() string { return "AttributeContextValidationError" }
   225  
   226  // Error satisfies the builtin error interface
   227  func (e AttributeContextValidationError) Error() string {
   228  	cause := ""
   229  	if e.cause != nil {
   230  		cause = fmt.Sprintf(" | caused by: %v", e.cause)
   231  	}
   232  
   233  	key := ""
   234  	if e.key {
   235  		key = "key for "
   236  	}
   237  
   238  	return fmt.Sprintf(
   239  		"invalid %sAttributeContext.%s: %s%s",
   240  		key,
   241  		e.field,
   242  		e.reason,
   243  		cause)
   244  }
   245  
   246  var _ error = AttributeContextValidationError{}
   247  
   248  var _ interface {
   249  	Field() string
   250  	Reason() string
   251  	Key() bool
   252  	Cause() error
   253  	ErrorName() string
   254  } = AttributeContextValidationError{}
   255  
   256  // Validate checks the field values on AttributeContext_Peer with the rules
   257  // defined in the proto definition for this message. If any rules are
   258  // violated, the first error encountered is returned, or nil if there are no violations.
   259  func (m *AttributeContext_Peer) Validate() error {
   260  	return m.validate(false)
   261  }
   262  
   263  // ValidateAll checks the field values on AttributeContext_Peer with the rules
   264  // defined in the proto definition for this message. If any rules are
   265  // violated, the result is a list of violation errors wrapped in
   266  // AttributeContext_PeerMultiError, or nil if none found.
   267  func (m *AttributeContext_Peer) ValidateAll() error {
   268  	return m.validate(true)
   269  }
   270  
   271  func (m *AttributeContext_Peer) validate(all bool) error {
   272  	if m == nil {
   273  		return nil
   274  	}
   275  
   276  	var errors []error
   277  
   278  	if all {
   279  		switch v := interface{}(m.GetAddress()).(type) {
   280  		case interface{ ValidateAll() error }:
   281  			if err := v.ValidateAll(); err != nil {
   282  				errors = append(errors, AttributeContext_PeerValidationError{
   283  					field:  "Address",
   284  					reason: "embedded message failed validation",
   285  					cause:  err,
   286  				})
   287  			}
   288  		case interface{ Validate() error }:
   289  			if err := v.Validate(); err != nil {
   290  				errors = append(errors, AttributeContext_PeerValidationError{
   291  					field:  "Address",
   292  					reason: "embedded message failed validation",
   293  					cause:  err,
   294  				})
   295  			}
   296  		}
   297  	} else if v, ok := interface{}(m.GetAddress()).(interface{ Validate() error }); ok {
   298  		if err := v.Validate(); err != nil {
   299  			return AttributeContext_PeerValidationError{
   300  				field:  "Address",
   301  				reason: "embedded message failed validation",
   302  				cause:  err,
   303  			}
   304  		}
   305  	}
   306  
   307  	// no validation rules for Service
   308  
   309  	// no validation rules for Labels
   310  
   311  	// no validation rules for Principal
   312  
   313  	// no validation rules for Certificate
   314  
   315  	if len(errors) > 0 {
   316  		return AttributeContext_PeerMultiError(errors)
   317  	}
   318  
   319  	return nil
   320  }
   321  
   322  // AttributeContext_PeerMultiError is an error wrapping multiple validation
   323  // errors returned by AttributeContext_Peer.ValidateAll() if the designated
   324  // constraints aren't met.
   325  type AttributeContext_PeerMultiError []error
   326  
   327  // Error returns a concatenation of all the error messages it wraps.
   328  func (m AttributeContext_PeerMultiError) Error() string {
   329  	var msgs []string
   330  	for _, err := range m {
   331  		msgs = append(msgs, err.Error())
   332  	}
   333  	return strings.Join(msgs, "; ")
   334  }
   335  
   336  // AllErrors returns a list of validation violation errors.
   337  func (m AttributeContext_PeerMultiError) AllErrors() []error { return m }
   338  
   339  // AttributeContext_PeerValidationError is the validation error returned by
   340  // AttributeContext_Peer.Validate if the designated constraints aren't met.
   341  type AttributeContext_PeerValidationError struct {
   342  	field  string
   343  	reason string
   344  	cause  error
   345  	key    bool
   346  }
   347  
   348  // Field function returns field value.
   349  func (e AttributeContext_PeerValidationError) Field() string { return e.field }
   350  
   351  // Reason function returns reason value.
   352  func (e AttributeContext_PeerValidationError) Reason() string { return e.reason }
   353  
   354  // Cause function returns cause value.
   355  func (e AttributeContext_PeerValidationError) Cause() error { return e.cause }
   356  
   357  // Key function returns key value.
   358  func (e AttributeContext_PeerValidationError) Key() bool { return e.key }
   359  
   360  // ErrorName returns error name.
   361  func (e AttributeContext_PeerValidationError) ErrorName() string {
   362  	return "AttributeContext_PeerValidationError"
   363  }
   364  
   365  // Error satisfies the builtin error interface
   366  func (e AttributeContext_PeerValidationError) Error() string {
   367  	cause := ""
   368  	if e.cause != nil {
   369  		cause = fmt.Sprintf(" | caused by: %v", e.cause)
   370  	}
   371  
   372  	key := ""
   373  	if e.key {
   374  		key = "key for "
   375  	}
   376  
   377  	return fmt.Sprintf(
   378  		"invalid %sAttributeContext_Peer.%s: %s%s",
   379  		key,
   380  		e.field,
   381  		e.reason,
   382  		cause)
   383  }
   384  
   385  var _ error = AttributeContext_PeerValidationError{}
   386  
   387  var _ interface {
   388  	Field() string
   389  	Reason() string
   390  	Key() bool
   391  	Cause() error
   392  	ErrorName() string
   393  } = AttributeContext_PeerValidationError{}
   394  
   395  // Validate checks the field values on AttributeContext_Request with the rules
   396  // defined in the proto definition for this message. If any rules are
   397  // violated, the first error encountered is returned, or nil if there are no violations.
   398  func (m *AttributeContext_Request) Validate() error {
   399  	return m.validate(false)
   400  }
   401  
   402  // ValidateAll checks the field values on AttributeContext_Request with the
   403  // rules defined in the proto definition for this message. If any rules are
   404  // violated, the result is a list of violation errors wrapped in
   405  // AttributeContext_RequestMultiError, or nil if none found.
   406  func (m *AttributeContext_Request) ValidateAll() error {
   407  	return m.validate(true)
   408  }
   409  
   410  func (m *AttributeContext_Request) validate(all bool) error {
   411  	if m == nil {
   412  		return nil
   413  	}
   414  
   415  	var errors []error
   416  
   417  	if all {
   418  		switch v := interface{}(m.GetTime()).(type) {
   419  		case interface{ ValidateAll() error }:
   420  			if err := v.ValidateAll(); err != nil {
   421  				errors = append(errors, AttributeContext_RequestValidationError{
   422  					field:  "Time",
   423  					reason: "embedded message failed validation",
   424  					cause:  err,
   425  				})
   426  			}
   427  		case interface{ Validate() error }:
   428  			if err := v.Validate(); err != nil {
   429  				errors = append(errors, AttributeContext_RequestValidationError{
   430  					field:  "Time",
   431  					reason: "embedded message failed validation",
   432  					cause:  err,
   433  				})
   434  			}
   435  		}
   436  	} else if v, ok := interface{}(m.GetTime()).(interface{ Validate() error }); ok {
   437  		if err := v.Validate(); err != nil {
   438  			return AttributeContext_RequestValidationError{
   439  				field:  "Time",
   440  				reason: "embedded message failed validation",
   441  				cause:  err,
   442  			}
   443  		}
   444  	}
   445  
   446  	if all {
   447  		switch v := interface{}(m.GetHttp()).(type) {
   448  		case interface{ ValidateAll() error }:
   449  			if err := v.ValidateAll(); err != nil {
   450  				errors = append(errors, AttributeContext_RequestValidationError{
   451  					field:  "Http",
   452  					reason: "embedded message failed validation",
   453  					cause:  err,
   454  				})
   455  			}
   456  		case interface{ Validate() error }:
   457  			if err := v.Validate(); err != nil {
   458  				errors = append(errors, AttributeContext_RequestValidationError{
   459  					field:  "Http",
   460  					reason: "embedded message failed validation",
   461  					cause:  err,
   462  				})
   463  			}
   464  		}
   465  	} else if v, ok := interface{}(m.GetHttp()).(interface{ Validate() error }); ok {
   466  		if err := v.Validate(); err != nil {
   467  			return AttributeContext_RequestValidationError{
   468  				field:  "Http",
   469  				reason: "embedded message failed validation",
   470  				cause:  err,
   471  			}
   472  		}
   473  	}
   474  
   475  	if len(errors) > 0 {
   476  		return AttributeContext_RequestMultiError(errors)
   477  	}
   478  
   479  	return nil
   480  }
   481  
   482  // AttributeContext_RequestMultiError is an error wrapping multiple validation
   483  // errors returned by AttributeContext_Request.ValidateAll() if the designated
   484  // constraints aren't met.
   485  type AttributeContext_RequestMultiError []error
   486  
   487  // Error returns a concatenation of all the error messages it wraps.
   488  func (m AttributeContext_RequestMultiError) Error() string {
   489  	var msgs []string
   490  	for _, err := range m {
   491  		msgs = append(msgs, err.Error())
   492  	}
   493  	return strings.Join(msgs, "; ")
   494  }
   495  
   496  // AllErrors returns a list of validation violation errors.
   497  func (m AttributeContext_RequestMultiError) AllErrors() []error { return m }
   498  
   499  // AttributeContext_RequestValidationError is the validation error returned by
   500  // AttributeContext_Request.Validate if the designated constraints aren't met.
   501  type AttributeContext_RequestValidationError struct {
   502  	field  string
   503  	reason string
   504  	cause  error
   505  	key    bool
   506  }
   507  
   508  // Field function returns field value.
   509  func (e AttributeContext_RequestValidationError) Field() string { return e.field }
   510  
   511  // Reason function returns reason value.
   512  func (e AttributeContext_RequestValidationError) Reason() string { return e.reason }
   513  
   514  // Cause function returns cause value.
   515  func (e AttributeContext_RequestValidationError) Cause() error { return e.cause }
   516  
   517  // Key function returns key value.
   518  func (e AttributeContext_RequestValidationError) Key() bool { return e.key }
   519  
   520  // ErrorName returns error name.
   521  func (e AttributeContext_RequestValidationError) ErrorName() string {
   522  	return "AttributeContext_RequestValidationError"
   523  }
   524  
   525  // Error satisfies the builtin error interface
   526  func (e AttributeContext_RequestValidationError) Error() string {
   527  	cause := ""
   528  	if e.cause != nil {
   529  		cause = fmt.Sprintf(" | caused by: %v", e.cause)
   530  	}
   531  
   532  	key := ""
   533  	if e.key {
   534  		key = "key for "
   535  	}
   536  
   537  	return fmt.Sprintf(
   538  		"invalid %sAttributeContext_Request.%s: %s%s",
   539  		key,
   540  		e.field,
   541  		e.reason,
   542  		cause)
   543  }
   544  
   545  var _ error = AttributeContext_RequestValidationError{}
   546  
   547  var _ interface {
   548  	Field() string
   549  	Reason() string
   550  	Key() bool
   551  	Cause() error
   552  	ErrorName() string
   553  } = AttributeContext_RequestValidationError{}
   554  
   555  // Validate checks the field values on AttributeContext_HttpRequest with the
   556  // rules defined in the proto definition for this message. If any rules are
   557  // violated, the first error encountered is returned, or nil if there are no violations.
   558  func (m *AttributeContext_HttpRequest) Validate() error {
   559  	return m.validate(false)
   560  }
   561  
   562  // ValidateAll checks the field values on AttributeContext_HttpRequest with the
   563  // rules defined in the proto definition for this message. If any rules are
   564  // violated, the result is a list of violation errors wrapped in
   565  // AttributeContext_HttpRequestMultiError, or nil if none found.
   566  func (m *AttributeContext_HttpRequest) ValidateAll() error {
   567  	return m.validate(true)
   568  }
   569  
   570  func (m *AttributeContext_HttpRequest) validate(all bool) error {
   571  	if m == nil {
   572  		return nil
   573  	}
   574  
   575  	var errors []error
   576  
   577  	// no validation rules for Id
   578  
   579  	// no validation rules for Method
   580  
   581  	// no validation rules for Headers
   582  
   583  	// no validation rules for Path
   584  
   585  	// no validation rules for Host
   586  
   587  	// no validation rules for Scheme
   588  
   589  	// no validation rules for Query
   590  
   591  	// no validation rules for Fragment
   592  
   593  	// no validation rules for Size
   594  
   595  	// no validation rules for Protocol
   596  
   597  	// no validation rules for Body
   598  
   599  	if len(errors) > 0 {
   600  		return AttributeContext_HttpRequestMultiError(errors)
   601  	}
   602  
   603  	return nil
   604  }
   605  
   606  // AttributeContext_HttpRequestMultiError is an error wrapping multiple
   607  // validation errors returned by AttributeContext_HttpRequest.ValidateAll() if
   608  // the designated constraints aren't met.
   609  type AttributeContext_HttpRequestMultiError []error
   610  
   611  // Error returns a concatenation of all the error messages it wraps.
   612  func (m AttributeContext_HttpRequestMultiError) Error() string {
   613  	var msgs []string
   614  	for _, err := range m {
   615  		msgs = append(msgs, err.Error())
   616  	}
   617  	return strings.Join(msgs, "; ")
   618  }
   619  
   620  // AllErrors returns a list of validation violation errors.
   621  func (m AttributeContext_HttpRequestMultiError) AllErrors() []error { return m }
   622  
   623  // AttributeContext_HttpRequestValidationError is the validation error returned
   624  // by AttributeContext_HttpRequest.Validate if the designated constraints
   625  // aren't met.
   626  type AttributeContext_HttpRequestValidationError struct {
   627  	field  string
   628  	reason string
   629  	cause  error
   630  	key    bool
   631  }
   632  
   633  // Field function returns field value.
   634  func (e AttributeContext_HttpRequestValidationError) Field() string { return e.field }
   635  
   636  // Reason function returns reason value.
   637  func (e AttributeContext_HttpRequestValidationError) Reason() string { return e.reason }
   638  
   639  // Cause function returns cause value.
   640  func (e AttributeContext_HttpRequestValidationError) Cause() error { return e.cause }
   641  
   642  // Key function returns key value.
   643  func (e AttributeContext_HttpRequestValidationError) Key() bool { return e.key }
   644  
   645  // ErrorName returns error name.
   646  func (e AttributeContext_HttpRequestValidationError) ErrorName() string {
   647  	return "AttributeContext_HttpRequestValidationError"
   648  }
   649  
   650  // Error satisfies the builtin error interface
   651  func (e AttributeContext_HttpRequestValidationError) Error() string {
   652  	cause := ""
   653  	if e.cause != nil {
   654  		cause = fmt.Sprintf(" | caused by: %v", e.cause)
   655  	}
   656  
   657  	key := ""
   658  	if e.key {
   659  		key = "key for "
   660  	}
   661  
   662  	return fmt.Sprintf(
   663  		"invalid %sAttributeContext_HttpRequest.%s: %s%s",
   664  		key,
   665  		e.field,
   666  		e.reason,
   667  		cause)
   668  }
   669  
   670  var _ error = AttributeContext_HttpRequestValidationError{}
   671  
   672  var _ interface {
   673  	Field() string
   674  	Reason() string
   675  	Key() bool
   676  	Cause() error
   677  	ErrorName() string
   678  } = AttributeContext_HttpRequestValidationError{}
   679  

View as plain text