github.com/authzed/spicedb@v1.32.1-0.20240520085336-ebda56537386/pkg/proto/dispatch/v1/dispatch.pb.validate.go (about)

     1  // Code generated by protoc-gen-validate. DO NOT EDIT.
     2  // source: dispatch/v1/dispatch.proto
     3  
     4  package dispatchv1
     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 DispatchCheckRequest with the rules
    39  // defined in the proto definition for this message. If any rules are
    40  // violated, the first error encountered is returned, or nil if there are no violations.
    41  func (m *DispatchCheckRequest) Validate() error {
    42  	return m.validate(false)
    43  }
    44  
    45  // ValidateAll checks the field values on DispatchCheckRequest 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  // DispatchCheckRequestMultiError, or nil if none found.
    49  func (m *DispatchCheckRequest) ValidateAll() error {
    50  	return m.validate(true)
    51  }
    52  
    53  func (m *DispatchCheckRequest) validate(all bool) error {
    54  	if m == nil {
    55  		return nil
    56  	}
    57  
    58  	var errors []error
    59  
    60  	if m.GetMetadata() == nil {
    61  		err := DispatchCheckRequestValidationError{
    62  			field:  "Metadata",
    63  			reason: "value is required",
    64  		}
    65  		if !all {
    66  			return err
    67  		}
    68  		errors = append(errors, err)
    69  	}
    70  
    71  	if all {
    72  		switch v := interface{}(m.GetMetadata()).(type) {
    73  		case interface{ ValidateAll() error }:
    74  			if err := v.ValidateAll(); err != nil {
    75  				errors = append(errors, DispatchCheckRequestValidationError{
    76  					field:  "Metadata",
    77  					reason: "embedded message failed validation",
    78  					cause:  err,
    79  				})
    80  			}
    81  		case interface{ Validate() error }:
    82  			if err := v.Validate(); err != nil {
    83  				errors = append(errors, DispatchCheckRequestValidationError{
    84  					field:  "Metadata",
    85  					reason: "embedded message failed validation",
    86  					cause:  err,
    87  				})
    88  			}
    89  		}
    90  	} else if v, ok := interface{}(m.GetMetadata()).(interface{ Validate() error }); ok {
    91  		if err := v.Validate(); err != nil {
    92  			return DispatchCheckRequestValidationError{
    93  				field:  "Metadata",
    94  				reason: "embedded message failed validation",
    95  				cause:  err,
    96  			}
    97  		}
    98  	}
    99  
   100  	if m.GetResourceRelation() == nil {
   101  		err := DispatchCheckRequestValidationError{
   102  			field:  "ResourceRelation",
   103  			reason: "value is required",
   104  		}
   105  		if !all {
   106  			return err
   107  		}
   108  		errors = append(errors, err)
   109  	}
   110  
   111  	if all {
   112  		switch v := interface{}(m.GetResourceRelation()).(type) {
   113  		case interface{ ValidateAll() error }:
   114  			if err := v.ValidateAll(); err != nil {
   115  				errors = append(errors, DispatchCheckRequestValidationError{
   116  					field:  "ResourceRelation",
   117  					reason: "embedded message failed validation",
   118  					cause:  err,
   119  				})
   120  			}
   121  		case interface{ Validate() error }:
   122  			if err := v.Validate(); err != nil {
   123  				errors = append(errors, DispatchCheckRequestValidationError{
   124  					field:  "ResourceRelation",
   125  					reason: "embedded message failed validation",
   126  					cause:  err,
   127  				})
   128  			}
   129  		}
   130  	} else if v, ok := interface{}(m.GetResourceRelation()).(interface{ Validate() error }); ok {
   131  		if err := v.Validate(); err != nil {
   132  			return DispatchCheckRequestValidationError{
   133  				field:  "ResourceRelation",
   134  				reason: "embedded message failed validation",
   135  				cause:  err,
   136  			}
   137  		}
   138  	}
   139  
   140  	if m.GetSubject() == nil {
   141  		err := DispatchCheckRequestValidationError{
   142  			field:  "Subject",
   143  			reason: "value is required",
   144  		}
   145  		if !all {
   146  			return err
   147  		}
   148  		errors = append(errors, err)
   149  	}
   150  
   151  	if all {
   152  		switch v := interface{}(m.GetSubject()).(type) {
   153  		case interface{ ValidateAll() error }:
   154  			if err := v.ValidateAll(); err != nil {
   155  				errors = append(errors, DispatchCheckRequestValidationError{
   156  					field:  "Subject",
   157  					reason: "embedded message failed validation",
   158  					cause:  err,
   159  				})
   160  			}
   161  		case interface{ Validate() error }:
   162  			if err := v.Validate(); err != nil {
   163  				errors = append(errors, DispatchCheckRequestValidationError{
   164  					field:  "Subject",
   165  					reason: "embedded message failed validation",
   166  					cause:  err,
   167  				})
   168  			}
   169  		}
   170  	} else if v, ok := interface{}(m.GetSubject()).(interface{ Validate() error }); ok {
   171  		if err := v.Validate(); err != nil {
   172  			return DispatchCheckRequestValidationError{
   173  				field:  "Subject",
   174  				reason: "embedded message failed validation",
   175  				cause:  err,
   176  			}
   177  		}
   178  	}
   179  
   180  	// no validation rules for ResultsSetting
   181  
   182  	// no validation rules for Debug
   183  
   184  	if len(errors) > 0 {
   185  		return DispatchCheckRequestMultiError(errors)
   186  	}
   187  
   188  	return nil
   189  }
   190  
   191  // DispatchCheckRequestMultiError is an error wrapping multiple validation
   192  // errors returned by DispatchCheckRequest.ValidateAll() if the designated
   193  // constraints aren't met.
   194  type DispatchCheckRequestMultiError []error
   195  
   196  // Error returns a concatenation of all the error messages it wraps.
   197  func (m DispatchCheckRequestMultiError) Error() string {
   198  	var msgs []string
   199  	for _, err := range m {
   200  		msgs = append(msgs, err.Error())
   201  	}
   202  	return strings.Join(msgs, "; ")
   203  }
   204  
   205  // AllErrors returns a list of validation violation errors.
   206  func (m DispatchCheckRequestMultiError) AllErrors() []error { return m }
   207  
   208  // DispatchCheckRequestValidationError is the validation error returned by
   209  // DispatchCheckRequest.Validate if the designated constraints aren't met.
   210  type DispatchCheckRequestValidationError struct {
   211  	field  string
   212  	reason string
   213  	cause  error
   214  	key    bool
   215  }
   216  
   217  // Field function returns field value.
   218  func (e DispatchCheckRequestValidationError) Field() string { return e.field }
   219  
   220  // Reason function returns reason value.
   221  func (e DispatchCheckRequestValidationError) Reason() string { return e.reason }
   222  
   223  // Cause function returns cause value.
   224  func (e DispatchCheckRequestValidationError) Cause() error { return e.cause }
   225  
   226  // Key function returns key value.
   227  func (e DispatchCheckRequestValidationError) Key() bool { return e.key }
   228  
   229  // ErrorName returns error name.
   230  func (e DispatchCheckRequestValidationError) ErrorName() string {
   231  	return "DispatchCheckRequestValidationError"
   232  }
   233  
   234  // Error satisfies the builtin error interface
   235  func (e DispatchCheckRequestValidationError) Error() string {
   236  	cause := ""
   237  	if e.cause != nil {
   238  		cause = fmt.Sprintf(" | caused by: %v", e.cause)
   239  	}
   240  
   241  	key := ""
   242  	if e.key {
   243  		key = "key for "
   244  	}
   245  
   246  	return fmt.Sprintf(
   247  		"invalid %sDispatchCheckRequest.%s: %s%s",
   248  		key,
   249  		e.field,
   250  		e.reason,
   251  		cause)
   252  }
   253  
   254  var _ error = DispatchCheckRequestValidationError{}
   255  
   256  var _ interface {
   257  	Field() string
   258  	Reason() string
   259  	Key() bool
   260  	Cause() error
   261  	ErrorName() string
   262  } = DispatchCheckRequestValidationError{}
   263  
   264  // Validate checks the field values on DispatchCheckResponse with the rules
   265  // defined in the proto definition for this message. If any rules are
   266  // violated, the first error encountered is returned, or nil if there are no violations.
   267  func (m *DispatchCheckResponse) Validate() error {
   268  	return m.validate(false)
   269  }
   270  
   271  // ValidateAll checks the field values on DispatchCheckResponse with the rules
   272  // defined in the proto definition for this message. If any rules are
   273  // violated, the result is a list of violation errors wrapped in
   274  // DispatchCheckResponseMultiError, or nil if none found.
   275  func (m *DispatchCheckResponse) ValidateAll() error {
   276  	return m.validate(true)
   277  }
   278  
   279  func (m *DispatchCheckResponse) validate(all bool) error {
   280  	if m == nil {
   281  		return nil
   282  	}
   283  
   284  	var errors []error
   285  
   286  	if all {
   287  		switch v := interface{}(m.GetMetadata()).(type) {
   288  		case interface{ ValidateAll() error }:
   289  			if err := v.ValidateAll(); err != nil {
   290  				errors = append(errors, DispatchCheckResponseValidationError{
   291  					field:  "Metadata",
   292  					reason: "embedded message failed validation",
   293  					cause:  err,
   294  				})
   295  			}
   296  		case interface{ Validate() error }:
   297  			if err := v.Validate(); err != nil {
   298  				errors = append(errors, DispatchCheckResponseValidationError{
   299  					field:  "Metadata",
   300  					reason: "embedded message failed validation",
   301  					cause:  err,
   302  				})
   303  			}
   304  		}
   305  	} else if v, ok := interface{}(m.GetMetadata()).(interface{ Validate() error }); ok {
   306  		if err := v.Validate(); err != nil {
   307  			return DispatchCheckResponseValidationError{
   308  				field:  "Metadata",
   309  				reason: "embedded message failed validation",
   310  				cause:  err,
   311  			}
   312  		}
   313  	}
   314  
   315  	{
   316  		sorted_keys := make([]string, len(m.GetResultsByResourceId()))
   317  		i := 0
   318  		for key := range m.GetResultsByResourceId() {
   319  			sorted_keys[i] = key
   320  			i++
   321  		}
   322  		sort.Slice(sorted_keys, func(i, j int) bool { return sorted_keys[i] < sorted_keys[j] })
   323  		for _, key := range sorted_keys {
   324  			val := m.GetResultsByResourceId()[key]
   325  			_ = val
   326  
   327  			// no validation rules for ResultsByResourceId[key]
   328  
   329  			if all {
   330  				switch v := interface{}(val).(type) {
   331  				case interface{ ValidateAll() error }:
   332  					if err := v.ValidateAll(); err != nil {
   333  						errors = append(errors, DispatchCheckResponseValidationError{
   334  							field:  fmt.Sprintf("ResultsByResourceId[%v]", key),
   335  							reason: "embedded message failed validation",
   336  							cause:  err,
   337  						})
   338  					}
   339  				case interface{ Validate() error }:
   340  					if err := v.Validate(); err != nil {
   341  						errors = append(errors, DispatchCheckResponseValidationError{
   342  							field:  fmt.Sprintf("ResultsByResourceId[%v]", key),
   343  							reason: "embedded message failed validation",
   344  							cause:  err,
   345  						})
   346  					}
   347  				}
   348  			} else if v, ok := interface{}(val).(interface{ Validate() error }); ok {
   349  				if err := v.Validate(); err != nil {
   350  					return DispatchCheckResponseValidationError{
   351  						field:  fmt.Sprintf("ResultsByResourceId[%v]", key),
   352  						reason: "embedded message failed validation",
   353  						cause:  err,
   354  					}
   355  				}
   356  			}
   357  
   358  		}
   359  	}
   360  
   361  	if len(errors) > 0 {
   362  		return DispatchCheckResponseMultiError(errors)
   363  	}
   364  
   365  	return nil
   366  }
   367  
   368  // DispatchCheckResponseMultiError is an error wrapping multiple validation
   369  // errors returned by DispatchCheckResponse.ValidateAll() if the designated
   370  // constraints aren't met.
   371  type DispatchCheckResponseMultiError []error
   372  
   373  // Error returns a concatenation of all the error messages it wraps.
   374  func (m DispatchCheckResponseMultiError) Error() string {
   375  	var msgs []string
   376  	for _, err := range m {
   377  		msgs = append(msgs, err.Error())
   378  	}
   379  	return strings.Join(msgs, "; ")
   380  }
   381  
   382  // AllErrors returns a list of validation violation errors.
   383  func (m DispatchCheckResponseMultiError) AllErrors() []error { return m }
   384  
   385  // DispatchCheckResponseValidationError is the validation error returned by
   386  // DispatchCheckResponse.Validate if the designated constraints aren't met.
   387  type DispatchCheckResponseValidationError struct {
   388  	field  string
   389  	reason string
   390  	cause  error
   391  	key    bool
   392  }
   393  
   394  // Field function returns field value.
   395  func (e DispatchCheckResponseValidationError) Field() string { return e.field }
   396  
   397  // Reason function returns reason value.
   398  func (e DispatchCheckResponseValidationError) Reason() string { return e.reason }
   399  
   400  // Cause function returns cause value.
   401  func (e DispatchCheckResponseValidationError) Cause() error { return e.cause }
   402  
   403  // Key function returns key value.
   404  func (e DispatchCheckResponseValidationError) Key() bool { return e.key }
   405  
   406  // ErrorName returns error name.
   407  func (e DispatchCheckResponseValidationError) ErrorName() string {
   408  	return "DispatchCheckResponseValidationError"
   409  }
   410  
   411  // Error satisfies the builtin error interface
   412  func (e DispatchCheckResponseValidationError) Error() string {
   413  	cause := ""
   414  	if e.cause != nil {
   415  		cause = fmt.Sprintf(" | caused by: %v", e.cause)
   416  	}
   417  
   418  	key := ""
   419  	if e.key {
   420  		key = "key for "
   421  	}
   422  
   423  	return fmt.Sprintf(
   424  		"invalid %sDispatchCheckResponse.%s: %s%s",
   425  		key,
   426  		e.field,
   427  		e.reason,
   428  		cause)
   429  }
   430  
   431  var _ error = DispatchCheckResponseValidationError{}
   432  
   433  var _ interface {
   434  	Field() string
   435  	Reason() string
   436  	Key() bool
   437  	Cause() error
   438  	ErrorName() string
   439  } = DispatchCheckResponseValidationError{}
   440  
   441  // Validate checks the field values on ResourceCheckResult with the rules
   442  // defined in the proto definition for this message. If any rules are
   443  // violated, the first error encountered is returned, or nil if there are no violations.
   444  func (m *ResourceCheckResult) Validate() error {
   445  	return m.validate(false)
   446  }
   447  
   448  // ValidateAll checks the field values on ResourceCheckResult with the rules
   449  // defined in the proto definition for this message. If any rules are
   450  // violated, the result is a list of violation errors wrapped in
   451  // ResourceCheckResultMultiError, or nil if none found.
   452  func (m *ResourceCheckResult) ValidateAll() error {
   453  	return m.validate(true)
   454  }
   455  
   456  func (m *ResourceCheckResult) validate(all bool) error {
   457  	if m == nil {
   458  		return nil
   459  	}
   460  
   461  	var errors []error
   462  
   463  	// no validation rules for Membership
   464  
   465  	if all {
   466  		switch v := interface{}(m.GetExpression()).(type) {
   467  		case interface{ ValidateAll() error }:
   468  			if err := v.ValidateAll(); err != nil {
   469  				errors = append(errors, ResourceCheckResultValidationError{
   470  					field:  "Expression",
   471  					reason: "embedded message failed validation",
   472  					cause:  err,
   473  				})
   474  			}
   475  		case interface{ Validate() error }:
   476  			if err := v.Validate(); err != nil {
   477  				errors = append(errors, ResourceCheckResultValidationError{
   478  					field:  "Expression",
   479  					reason: "embedded message failed validation",
   480  					cause:  err,
   481  				})
   482  			}
   483  		}
   484  	} else if v, ok := interface{}(m.GetExpression()).(interface{ Validate() error }); ok {
   485  		if err := v.Validate(); err != nil {
   486  			return ResourceCheckResultValidationError{
   487  				field:  "Expression",
   488  				reason: "embedded message failed validation",
   489  				cause:  err,
   490  			}
   491  		}
   492  	}
   493  
   494  	if len(errors) > 0 {
   495  		return ResourceCheckResultMultiError(errors)
   496  	}
   497  
   498  	return nil
   499  }
   500  
   501  // ResourceCheckResultMultiError is an error wrapping multiple validation
   502  // errors returned by ResourceCheckResult.ValidateAll() if the designated
   503  // constraints aren't met.
   504  type ResourceCheckResultMultiError []error
   505  
   506  // Error returns a concatenation of all the error messages it wraps.
   507  func (m ResourceCheckResultMultiError) Error() string {
   508  	var msgs []string
   509  	for _, err := range m {
   510  		msgs = append(msgs, err.Error())
   511  	}
   512  	return strings.Join(msgs, "; ")
   513  }
   514  
   515  // AllErrors returns a list of validation violation errors.
   516  func (m ResourceCheckResultMultiError) AllErrors() []error { return m }
   517  
   518  // ResourceCheckResultValidationError is the validation error returned by
   519  // ResourceCheckResult.Validate if the designated constraints aren't met.
   520  type ResourceCheckResultValidationError struct {
   521  	field  string
   522  	reason string
   523  	cause  error
   524  	key    bool
   525  }
   526  
   527  // Field function returns field value.
   528  func (e ResourceCheckResultValidationError) Field() string { return e.field }
   529  
   530  // Reason function returns reason value.
   531  func (e ResourceCheckResultValidationError) Reason() string { return e.reason }
   532  
   533  // Cause function returns cause value.
   534  func (e ResourceCheckResultValidationError) Cause() error { return e.cause }
   535  
   536  // Key function returns key value.
   537  func (e ResourceCheckResultValidationError) Key() bool { return e.key }
   538  
   539  // ErrorName returns error name.
   540  func (e ResourceCheckResultValidationError) ErrorName() string {
   541  	return "ResourceCheckResultValidationError"
   542  }
   543  
   544  // Error satisfies the builtin error interface
   545  func (e ResourceCheckResultValidationError) Error() string {
   546  	cause := ""
   547  	if e.cause != nil {
   548  		cause = fmt.Sprintf(" | caused by: %v", e.cause)
   549  	}
   550  
   551  	key := ""
   552  	if e.key {
   553  		key = "key for "
   554  	}
   555  
   556  	return fmt.Sprintf(
   557  		"invalid %sResourceCheckResult.%s: %s%s",
   558  		key,
   559  		e.field,
   560  		e.reason,
   561  		cause)
   562  }
   563  
   564  var _ error = ResourceCheckResultValidationError{}
   565  
   566  var _ interface {
   567  	Field() string
   568  	Reason() string
   569  	Key() bool
   570  	Cause() error
   571  	ErrorName() string
   572  } = ResourceCheckResultValidationError{}
   573  
   574  // Validate checks the field values on DispatchExpandRequest with the rules
   575  // defined in the proto definition for this message. If any rules are
   576  // violated, the first error encountered is returned, or nil if there are no violations.
   577  func (m *DispatchExpandRequest) Validate() error {
   578  	return m.validate(false)
   579  }
   580  
   581  // ValidateAll checks the field values on DispatchExpandRequest with the rules
   582  // defined in the proto definition for this message. If any rules are
   583  // violated, the result is a list of violation errors wrapped in
   584  // DispatchExpandRequestMultiError, or nil if none found.
   585  func (m *DispatchExpandRequest) ValidateAll() error {
   586  	return m.validate(true)
   587  }
   588  
   589  func (m *DispatchExpandRequest) validate(all bool) error {
   590  	if m == nil {
   591  		return nil
   592  	}
   593  
   594  	var errors []error
   595  
   596  	if m.GetMetadata() == nil {
   597  		err := DispatchExpandRequestValidationError{
   598  			field:  "Metadata",
   599  			reason: "value is required",
   600  		}
   601  		if !all {
   602  			return err
   603  		}
   604  		errors = append(errors, err)
   605  	}
   606  
   607  	if all {
   608  		switch v := interface{}(m.GetMetadata()).(type) {
   609  		case interface{ ValidateAll() error }:
   610  			if err := v.ValidateAll(); err != nil {
   611  				errors = append(errors, DispatchExpandRequestValidationError{
   612  					field:  "Metadata",
   613  					reason: "embedded message failed validation",
   614  					cause:  err,
   615  				})
   616  			}
   617  		case interface{ Validate() error }:
   618  			if err := v.Validate(); err != nil {
   619  				errors = append(errors, DispatchExpandRequestValidationError{
   620  					field:  "Metadata",
   621  					reason: "embedded message failed validation",
   622  					cause:  err,
   623  				})
   624  			}
   625  		}
   626  	} else if v, ok := interface{}(m.GetMetadata()).(interface{ Validate() error }); ok {
   627  		if err := v.Validate(); err != nil {
   628  			return DispatchExpandRequestValidationError{
   629  				field:  "Metadata",
   630  				reason: "embedded message failed validation",
   631  				cause:  err,
   632  			}
   633  		}
   634  	}
   635  
   636  	if m.GetResourceAndRelation() == nil {
   637  		err := DispatchExpandRequestValidationError{
   638  			field:  "ResourceAndRelation",
   639  			reason: "value is required",
   640  		}
   641  		if !all {
   642  			return err
   643  		}
   644  		errors = append(errors, err)
   645  	}
   646  
   647  	if all {
   648  		switch v := interface{}(m.GetResourceAndRelation()).(type) {
   649  		case interface{ ValidateAll() error }:
   650  			if err := v.ValidateAll(); err != nil {
   651  				errors = append(errors, DispatchExpandRequestValidationError{
   652  					field:  "ResourceAndRelation",
   653  					reason: "embedded message failed validation",
   654  					cause:  err,
   655  				})
   656  			}
   657  		case interface{ Validate() error }:
   658  			if err := v.Validate(); err != nil {
   659  				errors = append(errors, DispatchExpandRequestValidationError{
   660  					field:  "ResourceAndRelation",
   661  					reason: "embedded message failed validation",
   662  					cause:  err,
   663  				})
   664  			}
   665  		}
   666  	} else if v, ok := interface{}(m.GetResourceAndRelation()).(interface{ Validate() error }); ok {
   667  		if err := v.Validate(); err != nil {
   668  			return DispatchExpandRequestValidationError{
   669  				field:  "ResourceAndRelation",
   670  				reason: "embedded message failed validation",
   671  				cause:  err,
   672  			}
   673  		}
   674  	}
   675  
   676  	// no validation rules for ExpansionMode
   677  
   678  	if len(errors) > 0 {
   679  		return DispatchExpandRequestMultiError(errors)
   680  	}
   681  
   682  	return nil
   683  }
   684  
   685  // DispatchExpandRequestMultiError is an error wrapping multiple validation
   686  // errors returned by DispatchExpandRequest.ValidateAll() if the designated
   687  // constraints aren't met.
   688  type DispatchExpandRequestMultiError []error
   689  
   690  // Error returns a concatenation of all the error messages it wraps.
   691  func (m DispatchExpandRequestMultiError) Error() string {
   692  	var msgs []string
   693  	for _, err := range m {
   694  		msgs = append(msgs, err.Error())
   695  	}
   696  	return strings.Join(msgs, "; ")
   697  }
   698  
   699  // AllErrors returns a list of validation violation errors.
   700  func (m DispatchExpandRequestMultiError) AllErrors() []error { return m }
   701  
   702  // DispatchExpandRequestValidationError is the validation error returned by
   703  // DispatchExpandRequest.Validate if the designated constraints aren't met.
   704  type DispatchExpandRequestValidationError struct {
   705  	field  string
   706  	reason string
   707  	cause  error
   708  	key    bool
   709  }
   710  
   711  // Field function returns field value.
   712  func (e DispatchExpandRequestValidationError) Field() string { return e.field }
   713  
   714  // Reason function returns reason value.
   715  func (e DispatchExpandRequestValidationError) Reason() string { return e.reason }
   716  
   717  // Cause function returns cause value.
   718  func (e DispatchExpandRequestValidationError) Cause() error { return e.cause }
   719  
   720  // Key function returns key value.
   721  func (e DispatchExpandRequestValidationError) Key() bool { return e.key }
   722  
   723  // ErrorName returns error name.
   724  func (e DispatchExpandRequestValidationError) ErrorName() string {
   725  	return "DispatchExpandRequestValidationError"
   726  }
   727  
   728  // Error satisfies the builtin error interface
   729  func (e DispatchExpandRequestValidationError) Error() string {
   730  	cause := ""
   731  	if e.cause != nil {
   732  		cause = fmt.Sprintf(" | caused by: %v", e.cause)
   733  	}
   734  
   735  	key := ""
   736  	if e.key {
   737  		key = "key for "
   738  	}
   739  
   740  	return fmt.Sprintf(
   741  		"invalid %sDispatchExpandRequest.%s: %s%s",
   742  		key,
   743  		e.field,
   744  		e.reason,
   745  		cause)
   746  }
   747  
   748  var _ error = DispatchExpandRequestValidationError{}
   749  
   750  var _ interface {
   751  	Field() string
   752  	Reason() string
   753  	Key() bool
   754  	Cause() error
   755  	ErrorName() string
   756  } = DispatchExpandRequestValidationError{}
   757  
   758  // Validate checks the field values on DispatchExpandResponse with the rules
   759  // defined in the proto definition for this message. If any rules are
   760  // violated, the first error encountered is returned, or nil if there are no violations.
   761  func (m *DispatchExpandResponse) Validate() error {
   762  	return m.validate(false)
   763  }
   764  
   765  // ValidateAll checks the field values on DispatchExpandResponse with the rules
   766  // defined in the proto definition for this message. If any rules are
   767  // violated, the result is a list of violation errors wrapped in
   768  // DispatchExpandResponseMultiError, or nil if none found.
   769  func (m *DispatchExpandResponse) ValidateAll() error {
   770  	return m.validate(true)
   771  }
   772  
   773  func (m *DispatchExpandResponse) validate(all bool) error {
   774  	if m == nil {
   775  		return nil
   776  	}
   777  
   778  	var errors []error
   779  
   780  	if all {
   781  		switch v := interface{}(m.GetMetadata()).(type) {
   782  		case interface{ ValidateAll() error }:
   783  			if err := v.ValidateAll(); err != nil {
   784  				errors = append(errors, DispatchExpandResponseValidationError{
   785  					field:  "Metadata",
   786  					reason: "embedded message failed validation",
   787  					cause:  err,
   788  				})
   789  			}
   790  		case interface{ Validate() error }:
   791  			if err := v.Validate(); err != nil {
   792  				errors = append(errors, DispatchExpandResponseValidationError{
   793  					field:  "Metadata",
   794  					reason: "embedded message failed validation",
   795  					cause:  err,
   796  				})
   797  			}
   798  		}
   799  	} else if v, ok := interface{}(m.GetMetadata()).(interface{ Validate() error }); ok {
   800  		if err := v.Validate(); err != nil {
   801  			return DispatchExpandResponseValidationError{
   802  				field:  "Metadata",
   803  				reason: "embedded message failed validation",
   804  				cause:  err,
   805  			}
   806  		}
   807  	}
   808  
   809  	if all {
   810  		switch v := interface{}(m.GetTreeNode()).(type) {
   811  		case interface{ ValidateAll() error }:
   812  			if err := v.ValidateAll(); err != nil {
   813  				errors = append(errors, DispatchExpandResponseValidationError{
   814  					field:  "TreeNode",
   815  					reason: "embedded message failed validation",
   816  					cause:  err,
   817  				})
   818  			}
   819  		case interface{ Validate() error }:
   820  			if err := v.Validate(); err != nil {
   821  				errors = append(errors, DispatchExpandResponseValidationError{
   822  					field:  "TreeNode",
   823  					reason: "embedded message failed validation",
   824  					cause:  err,
   825  				})
   826  			}
   827  		}
   828  	} else if v, ok := interface{}(m.GetTreeNode()).(interface{ Validate() error }); ok {
   829  		if err := v.Validate(); err != nil {
   830  			return DispatchExpandResponseValidationError{
   831  				field:  "TreeNode",
   832  				reason: "embedded message failed validation",
   833  				cause:  err,
   834  			}
   835  		}
   836  	}
   837  
   838  	if len(errors) > 0 {
   839  		return DispatchExpandResponseMultiError(errors)
   840  	}
   841  
   842  	return nil
   843  }
   844  
   845  // DispatchExpandResponseMultiError is an error wrapping multiple validation
   846  // errors returned by DispatchExpandResponse.ValidateAll() if the designated
   847  // constraints aren't met.
   848  type DispatchExpandResponseMultiError []error
   849  
   850  // Error returns a concatenation of all the error messages it wraps.
   851  func (m DispatchExpandResponseMultiError) Error() string {
   852  	var msgs []string
   853  	for _, err := range m {
   854  		msgs = append(msgs, err.Error())
   855  	}
   856  	return strings.Join(msgs, "; ")
   857  }
   858  
   859  // AllErrors returns a list of validation violation errors.
   860  func (m DispatchExpandResponseMultiError) AllErrors() []error { return m }
   861  
   862  // DispatchExpandResponseValidationError is the validation error returned by
   863  // DispatchExpandResponse.Validate if the designated constraints aren't met.
   864  type DispatchExpandResponseValidationError struct {
   865  	field  string
   866  	reason string
   867  	cause  error
   868  	key    bool
   869  }
   870  
   871  // Field function returns field value.
   872  func (e DispatchExpandResponseValidationError) Field() string { return e.field }
   873  
   874  // Reason function returns reason value.
   875  func (e DispatchExpandResponseValidationError) Reason() string { return e.reason }
   876  
   877  // Cause function returns cause value.
   878  func (e DispatchExpandResponseValidationError) Cause() error { return e.cause }
   879  
   880  // Key function returns key value.
   881  func (e DispatchExpandResponseValidationError) Key() bool { return e.key }
   882  
   883  // ErrorName returns error name.
   884  func (e DispatchExpandResponseValidationError) ErrorName() string {
   885  	return "DispatchExpandResponseValidationError"
   886  }
   887  
   888  // Error satisfies the builtin error interface
   889  func (e DispatchExpandResponseValidationError) Error() string {
   890  	cause := ""
   891  	if e.cause != nil {
   892  		cause = fmt.Sprintf(" | caused by: %v", e.cause)
   893  	}
   894  
   895  	key := ""
   896  	if e.key {
   897  		key = "key for "
   898  	}
   899  
   900  	return fmt.Sprintf(
   901  		"invalid %sDispatchExpandResponse.%s: %s%s",
   902  		key,
   903  		e.field,
   904  		e.reason,
   905  		cause)
   906  }
   907  
   908  var _ error = DispatchExpandResponseValidationError{}
   909  
   910  var _ interface {
   911  	Field() string
   912  	Reason() string
   913  	Key() bool
   914  	Cause() error
   915  	ErrorName() string
   916  } = DispatchExpandResponseValidationError{}
   917  
   918  // Validate checks the field values on Cursor with the rules defined in the
   919  // proto definition for this message. If any rules are violated, the first
   920  // error encountered is returned, or nil if there are no violations.
   921  func (m *Cursor) Validate() error {
   922  	return m.validate(false)
   923  }
   924  
   925  // ValidateAll checks the field values on Cursor with the rules defined in the
   926  // proto definition for this message. If any rules are violated, the result is
   927  // a list of violation errors wrapped in CursorMultiError, or nil if none found.
   928  func (m *Cursor) ValidateAll() error {
   929  	return m.validate(true)
   930  }
   931  
   932  func (m *Cursor) validate(all bool) error {
   933  	if m == nil {
   934  		return nil
   935  	}
   936  
   937  	var errors []error
   938  
   939  	// no validation rules for DispatchVersion
   940  
   941  	if len(errors) > 0 {
   942  		return CursorMultiError(errors)
   943  	}
   944  
   945  	return nil
   946  }
   947  
   948  // CursorMultiError is an error wrapping multiple validation errors returned by
   949  // Cursor.ValidateAll() if the designated constraints aren't met.
   950  type CursorMultiError []error
   951  
   952  // Error returns a concatenation of all the error messages it wraps.
   953  func (m CursorMultiError) Error() string {
   954  	var msgs []string
   955  	for _, err := range m {
   956  		msgs = append(msgs, err.Error())
   957  	}
   958  	return strings.Join(msgs, "; ")
   959  }
   960  
   961  // AllErrors returns a list of validation violation errors.
   962  func (m CursorMultiError) AllErrors() []error { return m }
   963  
   964  // CursorValidationError is the validation error returned by Cursor.Validate if
   965  // the designated constraints aren't met.
   966  type CursorValidationError struct {
   967  	field  string
   968  	reason string
   969  	cause  error
   970  	key    bool
   971  }
   972  
   973  // Field function returns field value.
   974  func (e CursorValidationError) Field() string { return e.field }
   975  
   976  // Reason function returns reason value.
   977  func (e CursorValidationError) Reason() string { return e.reason }
   978  
   979  // Cause function returns cause value.
   980  func (e CursorValidationError) Cause() error { return e.cause }
   981  
   982  // Key function returns key value.
   983  func (e CursorValidationError) Key() bool { return e.key }
   984  
   985  // ErrorName returns error name.
   986  func (e CursorValidationError) ErrorName() string { return "CursorValidationError" }
   987  
   988  // Error satisfies the builtin error interface
   989  func (e CursorValidationError) Error() string {
   990  	cause := ""
   991  	if e.cause != nil {
   992  		cause = fmt.Sprintf(" | caused by: %v", e.cause)
   993  	}
   994  
   995  	key := ""
   996  	if e.key {
   997  		key = "key for "
   998  	}
   999  
  1000  	return fmt.Sprintf(
  1001  		"invalid %sCursor.%s: %s%s",
  1002  		key,
  1003  		e.field,
  1004  		e.reason,
  1005  		cause)
  1006  }
  1007  
  1008  var _ error = CursorValidationError{}
  1009  
  1010  var _ interface {
  1011  	Field() string
  1012  	Reason() string
  1013  	Key() bool
  1014  	Cause() error
  1015  	ErrorName() string
  1016  } = CursorValidationError{}
  1017  
  1018  // Validate checks the field values on DispatchReachableResourcesRequest with
  1019  // the rules defined in the proto definition for this message. If any rules
  1020  // are violated, the first error encountered is returned, or nil if there are
  1021  // no violations.
  1022  func (m *DispatchReachableResourcesRequest) Validate() error {
  1023  	return m.validate(false)
  1024  }
  1025  
  1026  // ValidateAll checks the field values on DispatchReachableResourcesRequest
  1027  // with the rules defined in the proto definition for this message. If any
  1028  // rules are violated, the result is a list of violation errors wrapped in
  1029  // DispatchReachableResourcesRequestMultiError, or nil if none found.
  1030  func (m *DispatchReachableResourcesRequest) ValidateAll() error {
  1031  	return m.validate(true)
  1032  }
  1033  
  1034  func (m *DispatchReachableResourcesRequest) validate(all bool) error {
  1035  	if m == nil {
  1036  		return nil
  1037  	}
  1038  
  1039  	var errors []error
  1040  
  1041  	if m.GetMetadata() == nil {
  1042  		err := DispatchReachableResourcesRequestValidationError{
  1043  			field:  "Metadata",
  1044  			reason: "value is required",
  1045  		}
  1046  		if !all {
  1047  			return err
  1048  		}
  1049  		errors = append(errors, err)
  1050  	}
  1051  
  1052  	if all {
  1053  		switch v := interface{}(m.GetMetadata()).(type) {
  1054  		case interface{ ValidateAll() error }:
  1055  			if err := v.ValidateAll(); err != nil {
  1056  				errors = append(errors, DispatchReachableResourcesRequestValidationError{
  1057  					field:  "Metadata",
  1058  					reason: "embedded message failed validation",
  1059  					cause:  err,
  1060  				})
  1061  			}
  1062  		case interface{ Validate() error }:
  1063  			if err := v.Validate(); err != nil {
  1064  				errors = append(errors, DispatchReachableResourcesRequestValidationError{
  1065  					field:  "Metadata",
  1066  					reason: "embedded message failed validation",
  1067  					cause:  err,
  1068  				})
  1069  			}
  1070  		}
  1071  	} else if v, ok := interface{}(m.GetMetadata()).(interface{ Validate() error }); ok {
  1072  		if err := v.Validate(); err != nil {
  1073  			return DispatchReachableResourcesRequestValidationError{
  1074  				field:  "Metadata",
  1075  				reason: "embedded message failed validation",
  1076  				cause:  err,
  1077  			}
  1078  		}
  1079  	}
  1080  
  1081  	if m.GetResourceRelation() == nil {
  1082  		err := DispatchReachableResourcesRequestValidationError{
  1083  			field:  "ResourceRelation",
  1084  			reason: "value is required",
  1085  		}
  1086  		if !all {
  1087  			return err
  1088  		}
  1089  		errors = append(errors, err)
  1090  	}
  1091  
  1092  	if all {
  1093  		switch v := interface{}(m.GetResourceRelation()).(type) {
  1094  		case interface{ ValidateAll() error }:
  1095  			if err := v.ValidateAll(); err != nil {
  1096  				errors = append(errors, DispatchReachableResourcesRequestValidationError{
  1097  					field:  "ResourceRelation",
  1098  					reason: "embedded message failed validation",
  1099  					cause:  err,
  1100  				})
  1101  			}
  1102  		case interface{ Validate() error }:
  1103  			if err := v.Validate(); err != nil {
  1104  				errors = append(errors, DispatchReachableResourcesRequestValidationError{
  1105  					field:  "ResourceRelation",
  1106  					reason: "embedded message failed validation",
  1107  					cause:  err,
  1108  				})
  1109  			}
  1110  		}
  1111  	} else if v, ok := interface{}(m.GetResourceRelation()).(interface{ Validate() error }); ok {
  1112  		if err := v.Validate(); err != nil {
  1113  			return DispatchReachableResourcesRequestValidationError{
  1114  				field:  "ResourceRelation",
  1115  				reason: "embedded message failed validation",
  1116  				cause:  err,
  1117  			}
  1118  		}
  1119  	}
  1120  
  1121  	if m.GetSubjectRelation() == nil {
  1122  		err := DispatchReachableResourcesRequestValidationError{
  1123  			field:  "SubjectRelation",
  1124  			reason: "value is required",
  1125  		}
  1126  		if !all {
  1127  			return err
  1128  		}
  1129  		errors = append(errors, err)
  1130  	}
  1131  
  1132  	if all {
  1133  		switch v := interface{}(m.GetSubjectRelation()).(type) {
  1134  		case interface{ ValidateAll() error }:
  1135  			if err := v.ValidateAll(); err != nil {
  1136  				errors = append(errors, DispatchReachableResourcesRequestValidationError{
  1137  					field:  "SubjectRelation",
  1138  					reason: "embedded message failed validation",
  1139  					cause:  err,
  1140  				})
  1141  			}
  1142  		case interface{ Validate() error }:
  1143  			if err := v.Validate(); err != nil {
  1144  				errors = append(errors, DispatchReachableResourcesRequestValidationError{
  1145  					field:  "SubjectRelation",
  1146  					reason: "embedded message failed validation",
  1147  					cause:  err,
  1148  				})
  1149  			}
  1150  		}
  1151  	} else if v, ok := interface{}(m.GetSubjectRelation()).(interface{ Validate() error }); ok {
  1152  		if err := v.Validate(); err != nil {
  1153  			return DispatchReachableResourcesRequestValidationError{
  1154  				field:  "SubjectRelation",
  1155  				reason: "embedded message failed validation",
  1156  				cause:  err,
  1157  			}
  1158  		}
  1159  	}
  1160  
  1161  	if all {
  1162  		switch v := interface{}(m.GetOptionalCursor()).(type) {
  1163  		case interface{ ValidateAll() error }:
  1164  			if err := v.ValidateAll(); err != nil {
  1165  				errors = append(errors, DispatchReachableResourcesRequestValidationError{
  1166  					field:  "OptionalCursor",
  1167  					reason: "embedded message failed validation",
  1168  					cause:  err,
  1169  				})
  1170  			}
  1171  		case interface{ Validate() error }:
  1172  			if err := v.Validate(); err != nil {
  1173  				errors = append(errors, DispatchReachableResourcesRequestValidationError{
  1174  					field:  "OptionalCursor",
  1175  					reason: "embedded message failed validation",
  1176  					cause:  err,
  1177  				})
  1178  			}
  1179  		}
  1180  	} else if v, ok := interface{}(m.GetOptionalCursor()).(interface{ Validate() error }); ok {
  1181  		if err := v.Validate(); err != nil {
  1182  			return DispatchReachableResourcesRequestValidationError{
  1183  				field:  "OptionalCursor",
  1184  				reason: "embedded message failed validation",
  1185  				cause:  err,
  1186  			}
  1187  		}
  1188  	}
  1189  
  1190  	// no validation rules for OptionalLimit
  1191  
  1192  	if len(errors) > 0 {
  1193  		return DispatchReachableResourcesRequestMultiError(errors)
  1194  	}
  1195  
  1196  	return nil
  1197  }
  1198  
  1199  // DispatchReachableResourcesRequestMultiError is an error wrapping multiple
  1200  // validation errors returned by
  1201  // DispatchReachableResourcesRequest.ValidateAll() if the designated
  1202  // constraints aren't met.
  1203  type DispatchReachableResourcesRequestMultiError []error
  1204  
  1205  // Error returns a concatenation of all the error messages it wraps.
  1206  func (m DispatchReachableResourcesRequestMultiError) Error() string {
  1207  	var msgs []string
  1208  	for _, err := range m {
  1209  		msgs = append(msgs, err.Error())
  1210  	}
  1211  	return strings.Join(msgs, "; ")
  1212  }
  1213  
  1214  // AllErrors returns a list of validation violation errors.
  1215  func (m DispatchReachableResourcesRequestMultiError) AllErrors() []error { return m }
  1216  
  1217  // DispatchReachableResourcesRequestValidationError is the validation error
  1218  // returned by DispatchReachableResourcesRequest.Validate if the designated
  1219  // constraints aren't met.
  1220  type DispatchReachableResourcesRequestValidationError struct {
  1221  	field  string
  1222  	reason string
  1223  	cause  error
  1224  	key    bool
  1225  }
  1226  
  1227  // Field function returns field value.
  1228  func (e DispatchReachableResourcesRequestValidationError) Field() string { return e.field }
  1229  
  1230  // Reason function returns reason value.
  1231  func (e DispatchReachableResourcesRequestValidationError) Reason() string { return e.reason }
  1232  
  1233  // Cause function returns cause value.
  1234  func (e DispatchReachableResourcesRequestValidationError) Cause() error { return e.cause }
  1235  
  1236  // Key function returns key value.
  1237  func (e DispatchReachableResourcesRequestValidationError) Key() bool { return e.key }
  1238  
  1239  // ErrorName returns error name.
  1240  func (e DispatchReachableResourcesRequestValidationError) ErrorName() string {
  1241  	return "DispatchReachableResourcesRequestValidationError"
  1242  }
  1243  
  1244  // Error satisfies the builtin error interface
  1245  func (e DispatchReachableResourcesRequestValidationError) Error() string {
  1246  	cause := ""
  1247  	if e.cause != nil {
  1248  		cause = fmt.Sprintf(" | caused by: %v", e.cause)
  1249  	}
  1250  
  1251  	key := ""
  1252  	if e.key {
  1253  		key = "key for "
  1254  	}
  1255  
  1256  	return fmt.Sprintf(
  1257  		"invalid %sDispatchReachableResourcesRequest.%s: %s%s",
  1258  		key,
  1259  		e.field,
  1260  		e.reason,
  1261  		cause)
  1262  }
  1263  
  1264  var _ error = DispatchReachableResourcesRequestValidationError{}
  1265  
  1266  var _ interface {
  1267  	Field() string
  1268  	Reason() string
  1269  	Key() bool
  1270  	Cause() error
  1271  	ErrorName() string
  1272  } = DispatchReachableResourcesRequestValidationError{}
  1273  
  1274  // Validate checks the field values on ReachableResource with the rules defined
  1275  // in the proto definition for this message. If any rules are violated, the
  1276  // first error encountered is returned, or nil if there are no violations.
  1277  func (m *ReachableResource) Validate() error {
  1278  	return m.validate(false)
  1279  }
  1280  
  1281  // ValidateAll checks the field values on ReachableResource with the rules
  1282  // defined in the proto definition for this message. If any rules are
  1283  // violated, the result is a list of violation errors wrapped in
  1284  // ReachableResourceMultiError, or nil if none found.
  1285  func (m *ReachableResource) ValidateAll() error {
  1286  	return m.validate(true)
  1287  }
  1288  
  1289  func (m *ReachableResource) validate(all bool) error {
  1290  	if m == nil {
  1291  		return nil
  1292  	}
  1293  
  1294  	var errors []error
  1295  
  1296  	// no validation rules for ResourceId
  1297  
  1298  	// no validation rules for ResultStatus
  1299  
  1300  	if len(errors) > 0 {
  1301  		return ReachableResourceMultiError(errors)
  1302  	}
  1303  
  1304  	return nil
  1305  }
  1306  
  1307  // ReachableResourceMultiError is an error wrapping multiple validation errors
  1308  // returned by ReachableResource.ValidateAll() if the designated constraints
  1309  // aren't met.
  1310  type ReachableResourceMultiError []error
  1311  
  1312  // Error returns a concatenation of all the error messages it wraps.
  1313  func (m ReachableResourceMultiError) Error() string {
  1314  	var msgs []string
  1315  	for _, err := range m {
  1316  		msgs = append(msgs, err.Error())
  1317  	}
  1318  	return strings.Join(msgs, "; ")
  1319  }
  1320  
  1321  // AllErrors returns a list of validation violation errors.
  1322  func (m ReachableResourceMultiError) AllErrors() []error { return m }
  1323  
  1324  // ReachableResourceValidationError is the validation error returned by
  1325  // ReachableResource.Validate if the designated constraints aren't met.
  1326  type ReachableResourceValidationError struct {
  1327  	field  string
  1328  	reason string
  1329  	cause  error
  1330  	key    bool
  1331  }
  1332  
  1333  // Field function returns field value.
  1334  func (e ReachableResourceValidationError) Field() string { return e.field }
  1335  
  1336  // Reason function returns reason value.
  1337  func (e ReachableResourceValidationError) Reason() string { return e.reason }
  1338  
  1339  // Cause function returns cause value.
  1340  func (e ReachableResourceValidationError) Cause() error { return e.cause }
  1341  
  1342  // Key function returns key value.
  1343  func (e ReachableResourceValidationError) Key() bool { return e.key }
  1344  
  1345  // ErrorName returns error name.
  1346  func (e ReachableResourceValidationError) ErrorName() string {
  1347  	return "ReachableResourceValidationError"
  1348  }
  1349  
  1350  // Error satisfies the builtin error interface
  1351  func (e ReachableResourceValidationError) Error() string {
  1352  	cause := ""
  1353  	if e.cause != nil {
  1354  		cause = fmt.Sprintf(" | caused by: %v", e.cause)
  1355  	}
  1356  
  1357  	key := ""
  1358  	if e.key {
  1359  		key = "key for "
  1360  	}
  1361  
  1362  	return fmt.Sprintf(
  1363  		"invalid %sReachableResource.%s: %s%s",
  1364  		key,
  1365  		e.field,
  1366  		e.reason,
  1367  		cause)
  1368  }
  1369  
  1370  var _ error = ReachableResourceValidationError{}
  1371  
  1372  var _ interface {
  1373  	Field() string
  1374  	Reason() string
  1375  	Key() bool
  1376  	Cause() error
  1377  	ErrorName() string
  1378  } = ReachableResourceValidationError{}
  1379  
  1380  // Validate checks the field values on DispatchReachableResourcesResponse with
  1381  // the rules defined in the proto definition for this message. If any rules
  1382  // are violated, the first error encountered is returned, or nil if there are
  1383  // no violations.
  1384  func (m *DispatchReachableResourcesResponse) Validate() error {
  1385  	return m.validate(false)
  1386  }
  1387  
  1388  // ValidateAll checks the field values on DispatchReachableResourcesResponse
  1389  // with the rules defined in the proto definition for this message. If any
  1390  // rules are violated, the result is a list of violation errors wrapped in
  1391  // DispatchReachableResourcesResponseMultiError, or nil if none found.
  1392  func (m *DispatchReachableResourcesResponse) ValidateAll() error {
  1393  	return m.validate(true)
  1394  }
  1395  
  1396  func (m *DispatchReachableResourcesResponse) validate(all bool) error {
  1397  	if m == nil {
  1398  		return nil
  1399  	}
  1400  
  1401  	var errors []error
  1402  
  1403  	if all {
  1404  		switch v := interface{}(m.GetResource()).(type) {
  1405  		case interface{ ValidateAll() error }:
  1406  			if err := v.ValidateAll(); err != nil {
  1407  				errors = append(errors, DispatchReachableResourcesResponseValidationError{
  1408  					field:  "Resource",
  1409  					reason: "embedded message failed validation",
  1410  					cause:  err,
  1411  				})
  1412  			}
  1413  		case interface{ Validate() error }:
  1414  			if err := v.Validate(); err != nil {
  1415  				errors = append(errors, DispatchReachableResourcesResponseValidationError{
  1416  					field:  "Resource",
  1417  					reason: "embedded message failed validation",
  1418  					cause:  err,
  1419  				})
  1420  			}
  1421  		}
  1422  	} else if v, ok := interface{}(m.GetResource()).(interface{ Validate() error }); ok {
  1423  		if err := v.Validate(); err != nil {
  1424  			return DispatchReachableResourcesResponseValidationError{
  1425  				field:  "Resource",
  1426  				reason: "embedded message failed validation",
  1427  				cause:  err,
  1428  			}
  1429  		}
  1430  	}
  1431  
  1432  	if all {
  1433  		switch v := interface{}(m.GetMetadata()).(type) {
  1434  		case interface{ ValidateAll() error }:
  1435  			if err := v.ValidateAll(); err != nil {
  1436  				errors = append(errors, DispatchReachableResourcesResponseValidationError{
  1437  					field:  "Metadata",
  1438  					reason: "embedded message failed validation",
  1439  					cause:  err,
  1440  				})
  1441  			}
  1442  		case interface{ Validate() error }:
  1443  			if err := v.Validate(); err != nil {
  1444  				errors = append(errors, DispatchReachableResourcesResponseValidationError{
  1445  					field:  "Metadata",
  1446  					reason: "embedded message failed validation",
  1447  					cause:  err,
  1448  				})
  1449  			}
  1450  		}
  1451  	} else if v, ok := interface{}(m.GetMetadata()).(interface{ Validate() error }); ok {
  1452  		if err := v.Validate(); err != nil {
  1453  			return DispatchReachableResourcesResponseValidationError{
  1454  				field:  "Metadata",
  1455  				reason: "embedded message failed validation",
  1456  				cause:  err,
  1457  			}
  1458  		}
  1459  	}
  1460  
  1461  	if all {
  1462  		switch v := interface{}(m.GetAfterResponseCursor()).(type) {
  1463  		case interface{ ValidateAll() error }:
  1464  			if err := v.ValidateAll(); err != nil {
  1465  				errors = append(errors, DispatchReachableResourcesResponseValidationError{
  1466  					field:  "AfterResponseCursor",
  1467  					reason: "embedded message failed validation",
  1468  					cause:  err,
  1469  				})
  1470  			}
  1471  		case interface{ Validate() error }:
  1472  			if err := v.Validate(); err != nil {
  1473  				errors = append(errors, DispatchReachableResourcesResponseValidationError{
  1474  					field:  "AfterResponseCursor",
  1475  					reason: "embedded message failed validation",
  1476  					cause:  err,
  1477  				})
  1478  			}
  1479  		}
  1480  	} else if v, ok := interface{}(m.GetAfterResponseCursor()).(interface{ Validate() error }); ok {
  1481  		if err := v.Validate(); err != nil {
  1482  			return DispatchReachableResourcesResponseValidationError{
  1483  				field:  "AfterResponseCursor",
  1484  				reason: "embedded message failed validation",
  1485  				cause:  err,
  1486  			}
  1487  		}
  1488  	}
  1489  
  1490  	if len(errors) > 0 {
  1491  		return DispatchReachableResourcesResponseMultiError(errors)
  1492  	}
  1493  
  1494  	return nil
  1495  }
  1496  
  1497  // DispatchReachableResourcesResponseMultiError is an error wrapping multiple
  1498  // validation errors returned by
  1499  // DispatchReachableResourcesResponse.ValidateAll() if the designated
  1500  // constraints aren't met.
  1501  type DispatchReachableResourcesResponseMultiError []error
  1502  
  1503  // Error returns a concatenation of all the error messages it wraps.
  1504  func (m DispatchReachableResourcesResponseMultiError) Error() string {
  1505  	var msgs []string
  1506  	for _, err := range m {
  1507  		msgs = append(msgs, err.Error())
  1508  	}
  1509  	return strings.Join(msgs, "; ")
  1510  }
  1511  
  1512  // AllErrors returns a list of validation violation errors.
  1513  func (m DispatchReachableResourcesResponseMultiError) AllErrors() []error { return m }
  1514  
  1515  // DispatchReachableResourcesResponseValidationError is the validation error
  1516  // returned by DispatchReachableResourcesResponse.Validate if the designated
  1517  // constraints aren't met.
  1518  type DispatchReachableResourcesResponseValidationError struct {
  1519  	field  string
  1520  	reason string
  1521  	cause  error
  1522  	key    bool
  1523  }
  1524  
  1525  // Field function returns field value.
  1526  func (e DispatchReachableResourcesResponseValidationError) Field() string { return e.field }
  1527  
  1528  // Reason function returns reason value.
  1529  func (e DispatchReachableResourcesResponseValidationError) Reason() string { return e.reason }
  1530  
  1531  // Cause function returns cause value.
  1532  func (e DispatchReachableResourcesResponseValidationError) Cause() error { return e.cause }
  1533  
  1534  // Key function returns key value.
  1535  func (e DispatchReachableResourcesResponseValidationError) Key() bool { return e.key }
  1536  
  1537  // ErrorName returns error name.
  1538  func (e DispatchReachableResourcesResponseValidationError) ErrorName() string {
  1539  	return "DispatchReachableResourcesResponseValidationError"
  1540  }
  1541  
  1542  // Error satisfies the builtin error interface
  1543  func (e DispatchReachableResourcesResponseValidationError) Error() string {
  1544  	cause := ""
  1545  	if e.cause != nil {
  1546  		cause = fmt.Sprintf(" | caused by: %v", e.cause)
  1547  	}
  1548  
  1549  	key := ""
  1550  	if e.key {
  1551  		key = "key for "
  1552  	}
  1553  
  1554  	return fmt.Sprintf(
  1555  		"invalid %sDispatchReachableResourcesResponse.%s: %s%s",
  1556  		key,
  1557  		e.field,
  1558  		e.reason,
  1559  		cause)
  1560  }
  1561  
  1562  var _ error = DispatchReachableResourcesResponseValidationError{}
  1563  
  1564  var _ interface {
  1565  	Field() string
  1566  	Reason() string
  1567  	Key() bool
  1568  	Cause() error
  1569  	ErrorName() string
  1570  } = DispatchReachableResourcesResponseValidationError{}
  1571  
  1572  // Validate checks the field values on DispatchLookupResourcesRequest with the
  1573  // rules defined in the proto definition for this message. If any rules are
  1574  // violated, the first error encountered is returned, or nil if there are no violations.
  1575  func (m *DispatchLookupResourcesRequest) Validate() error {
  1576  	return m.validate(false)
  1577  }
  1578  
  1579  // ValidateAll checks the field values on DispatchLookupResourcesRequest with
  1580  // the rules defined in the proto definition for this message. If any rules
  1581  // are violated, the result is a list of violation errors wrapped in
  1582  // DispatchLookupResourcesRequestMultiError, or nil if none found.
  1583  func (m *DispatchLookupResourcesRequest) ValidateAll() error {
  1584  	return m.validate(true)
  1585  }
  1586  
  1587  func (m *DispatchLookupResourcesRequest) validate(all bool) error {
  1588  	if m == nil {
  1589  		return nil
  1590  	}
  1591  
  1592  	var errors []error
  1593  
  1594  	if m.GetMetadata() == nil {
  1595  		err := DispatchLookupResourcesRequestValidationError{
  1596  			field:  "Metadata",
  1597  			reason: "value is required",
  1598  		}
  1599  		if !all {
  1600  			return err
  1601  		}
  1602  		errors = append(errors, err)
  1603  	}
  1604  
  1605  	if all {
  1606  		switch v := interface{}(m.GetMetadata()).(type) {
  1607  		case interface{ ValidateAll() error }:
  1608  			if err := v.ValidateAll(); err != nil {
  1609  				errors = append(errors, DispatchLookupResourcesRequestValidationError{
  1610  					field:  "Metadata",
  1611  					reason: "embedded message failed validation",
  1612  					cause:  err,
  1613  				})
  1614  			}
  1615  		case interface{ Validate() error }:
  1616  			if err := v.Validate(); err != nil {
  1617  				errors = append(errors, DispatchLookupResourcesRequestValidationError{
  1618  					field:  "Metadata",
  1619  					reason: "embedded message failed validation",
  1620  					cause:  err,
  1621  				})
  1622  			}
  1623  		}
  1624  	} else if v, ok := interface{}(m.GetMetadata()).(interface{ Validate() error }); ok {
  1625  		if err := v.Validate(); err != nil {
  1626  			return DispatchLookupResourcesRequestValidationError{
  1627  				field:  "Metadata",
  1628  				reason: "embedded message failed validation",
  1629  				cause:  err,
  1630  			}
  1631  		}
  1632  	}
  1633  
  1634  	if m.GetObjectRelation() == nil {
  1635  		err := DispatchLookupResourcesRequestValidationError{
  1636  			field:  "ObjectRelation",
  1637  			reason: "value is required",
  1638  		}
  1639  		if !all {
  1640  			return err
  1641  		}
  1642  		errors = append(errors, err)
  1643  	}
  1644  
  1645  	if all {
  1646  		switch v := interface{}(m.GetObjectRelation()).(type) {
  1647  		case interface{ ValidateAll() error }:
  1648  			if err := v.ValidateAll(); err != nil {
  1649  				errors = append(errors, DispatchLookupResourcesRequestValidationError{
  1650  					field:  "ObjectRelation",
  1651  					reason: "embedded message failed validation",
  1652  					cause:  err,
  1653  				})
  1654  			}
  1655  		case interface{ Validate() error }:
  1656  			if err := v.Validate(); err != nil {
  1657  				errors = append(errors, DispatchLookupResourcesRequestValidationError{
  1658  					field:  "ObjectRelation",
  1659  					reason: "embedded message failed validation",
  1660  					cause:  err,
  1661  				})
  1662  			}
  1663  		}
  1664  	} else if v, ok := interface{}(m.GetObjectRelation()).(interface{ Validate() error }); ok {
  1665  		if err := v.Validate(); err != nil {
  1666  			return DispatchLookupResourcesRequestValidationError{
  1667  				field:  "ObjectRelation",
  1668  				reason: "embedded message failed validation",
  1669  				cause:  err,
  1670  			}
  1671  		}
  1672  	}
  1673  
  1674  	if m.GetSubject() == nil {
  1675  		err := DispatchLookupResourcesRequestValidationError{
  1676  			field:  "Subject",
  1677  			reason: "value is required",
  1678  		}
  1679  		if !all {
  1680  			return err
  1681  		}
  1682  		errors = append(errors, err)
  1683  	}
  1684  
  1685  	if all {
  1686  		switch v := interface{}(m.GetSubject()).(type) {
  1687  		case interface{ ValidateAll() error }:
  1688  			if err := v.ValidateAll(); err != nil {
  1689  				errors = append(errors, DispatchLookupResourcesRequestValidationError{
  1690  					field:  "Subject",
  1691  					reason: "embedded message failed validation",
  1692  					cause:  err,
  1693  				})
  1694  			}
  1695  		case interface{ Validate() error }:
  1696  			if err := v.Validate(); err != nil {
  1697  				errors = append(errors, DispatchLookupResourcesRequestValidationError{
  1698  					field:  "Subject",
  1699  					reason: "embedded message failed validation",
  1700  					cause:  err,
  1701  				})
  1702  			}
  1703  		}
  1704  	} else if v, ok := interface{}(m.GetSubject()).(interface{ Validate() error }); ok {
  1705  		if err := v.Validate(); err != nil {
  1706  			return DispatchLookupResourcesRequestValidationError{
  1707  				field:  "Subject",
  1708  				reason: "embedded message failed validation",
  1709  				cause:  err,
  1710  			}
  1711  		}
  1712  	}
  1713  
  1714  	if all {
  1715  		switch v := interface{}(m.GetContext()).(type) {
  1716  		case interface{ ValidateAll() error }:
  1717  			if err := v.ValidateAll(); err != nil {
  1718  				errors = append(errors, DispatchLookupResourcesRequestValidationError{
  1719  					field:  "Context",
  1720  					reason: "embedded message failed validation",
  1721  					cause:  err,
  1722  				})
  1723  			}
  1724  		case interface{ Validate() error }:
  1725  			if err := v.Validate(); err != nil {
  1726  				errors = append(errors, DispatchLookupResourcesRequestValidationError{
  1727  					field:  "Context",
  1728  					reason: "embedded message failed validation",
  1729  					cause:  err,
  1730  				})
  1731  			}
  1732  		}
  1733  	} else if v, ok := interface{}(m.GetContext()).(interface{ Validate() error }); ok {
  1734  		if err := v.Validate(); err != nil {
  1735  			return DispatchLookupResourcesRequestValidationError{
  1736  				field:  "Context",
  1737  				reason: "embedded message failed validation",
  1738  				cause:  err,
  1739  			}
  1740  		}
  1741  	}
  1742  
  1743  	// no validation rules for OptionalLimit
  1744  
  1745  	if all {
  1746  		switch v := interface{}(m.GetOptionalCursor()).(type) {
  1747  		case interface{ ValidateAll() error }:
  1748  			if err := v.ValidateAll(); err != nil {
  1749  				errors = append(errors, DispatchLookupResourcesRequestValidationError{
  1750  					field:  "OptionalCursor",
  1751  					reason: "embedded message failed validation",
  1752  					cause:  err,
  1753  				})
  1754  			}
  1755  		case interface{ Validate() error }:
  1756  			if err := v.Validate(); err != nil {
  1757  				errors = append(errors, DispatchLookupResourcesRequestValidationError{
  1758  					field:  "OptionalCursor",
  1759  					reason: "embedded message failed validation",
  1760  					cause:  err,
  1761  				})
  1762  			}
  1763  		}
  1764  	} else if v, ok := interface{}(m.GetOptionalCursor()).(interface{ Validate() error }); ok {
  1765  		if err := v.Validate(); err != nil {
  1766  			return DispatchLookupResourcesRequestValidationError{
  1767  				field:  "OptionalCursor",
  1768  				reason: "embedded message failed validation",
  1769  				cause:  err,
  1770  			}
  1771  		}
  1772  	}
  1773  
  1774  	if len(errors) > 0 {
  1775  		return DispatchLookupResourcesRequestMultiError(errors)
  1776  	}
  1777  
  1778  	return nil
  1779  }
  1780  
  1781  // DispatchLookupResourcesRequestMultiError is an error wrapping multiple
  1782  // validation errors returned by DispatchLookupResourcesRequest.ValidateAll()
  1783  // if the designated constraints aren't met.
  1784  type DispatchLookupResourcesRequestMultiError []error
  1785  
  1786  // Error returns a concatenation of all the error messages it wraps.
  1787  func (m DispatchLookupResourcesRequestMultiError) Error() string {
  1788  	var msgs []string
  1789  	for _, err := range m {
  1790  		msgs = append(msgs, err.Error())
  1791  	}
  1792  	return strings.Join(msgs, "; ")
  1793  }
  1794  
  1795  // AllErrors returns a list of validation violation errors.
  1796  func (m DispatchLookupResourcesRequestMultiError) AllErrors() []error { return m }
  1797  
  1798  // DispatchLookupResourcesRequestValidationError is the validation error
  1799  // returned by DispatchLookupResourcesRequest.Validate if the designated
  1800  // constraints aren't met.
  1801  type DispatchLookupResourcesRequestValidationError struct {
  1802  	field  string
  1803  	reason string
  1804  	cause  error
  1805  	key    bool
  1806  }
  1807  
  1808  // Field function returns field value.
  1809  func (e DispatchLookupResourcesRequestValidationError) Field() string { return e.field }
  1810  
  1811  // Reason function returns reason value.
  1812  func (e DispatchLookupResourcesRequestValidationError) Reason() string { return e.reason }
  1813  
  1814  // Cause function returns cause value.
  1815  func (e DispatchLookupResourcesRequestValidationError) Cause() error { return e.cause }
  1816  
  1817  // Key function returns key value.
  1818  func (e DispatchLookupResourcesRequestValidationError) Key() bool { return e.key }
  1819  
  1820  // ErrorName returns error name.
  1821  func (e DispatchLookupResourcesRequestValidationError) ErrorName() string {
  1822  	return "DispatchLookupResourcesRequestValidationError"
  1823  }
  1824  
  1825  // Error satisfies the builtin error interface
  1826  func (e DispatchLookupResourcesRequestValidationError) Error() string {
  1827  	cause := ""
  1828  	if e.cause != nil {
  1829  		cause = fmt.Sprintf(" | caused by: %v", e.cause)
  1830  	}
  1831  
  1832  	key := ""
  1833  	if e.key {
  1834  		key = "key for "
  1835  	}
  1836  
  1837  	return fmt.Sprintf(
  1838  		"invalid %sDispatchLookupResourcesRequest.%s: %s%s",
  1839  		key,
  1840  		e.field,
  1841  		e.reason,
  1842  		cause)
  1843  }
  1844  
  1845  var _ error = DispatchLookupResourcesRequestValidationError{}
  1846  
  1847  var _ interface {
  1848  	Field() string
  1849  	Reason() string
  1850  	Key() bool
  1851  	Cause() error
  1852  	ErrorName() string
  1853  } = DispatchLookupResourcesRequestValidationError{}
  1854  
  1855  // Validate checks the field values on ResolvedResource with the rules defined
  1856  // in the proto definition for this message. If any rules are violated, the
  1857  // first error encountered is returned, or nil if there are no violations.
  1858  func (m *ResolvedResource) Validate() error {
  1859  	return m.validate(false)
  1860  }
  1861  
  1862  // ValidateAll checks the field values on ResolvedResource with the rules
  1863  // defined in the proto definition for this message. If any rules are
  1864  // violated, the result is a list of violation errors wrapped in
  1865  // ResolvedResourceMultiError, or nil if none found.
  1866  func (m *ResolvedResource) ValidateAll() error {
  1867  	return m.validate(true)
  1868  }
  1869  
  1870  func (m *ResolvedResource) validate(all bool) error {
  1871  	if m == nil {
  1872  		return nil
  1873  	}
  1874  
  1875  	var errors []error
  1876  
  1877  	// no validation rules for ResourceId
  1878  
  1879  	// no validation rules for Permissionship
  1880  
  1881  	if len(errors) > 0 {
  1882  		return ResolvedResourceMultiError(errors)
  1883  	}
  1884  
  1885  	return nil
  1886  }
  1887  
  1888  // ResolvedResourceMultiError is an error wrapping multiple validation errors
  1889  // returned by ResolvedResource.ValidateAll() if the designated constraints
  1890  // aren't met.
  1891  type ResolvedResourceMultiError []error
  1892  
  1893  // Error returns a concatenation of all the error messages it wraps.
  1894  func (m ResolvedResourceMultiError) Error() string {
  1895  	var msgs []string
  1896  	for _, err := range m {
  1897  		msgs = append(msgs, err.Error())
  1898  	}
  1899  	return strings.Join(msgs, "; ")
  1900  }
  1901  
  1902  // AllErrors returns a list of validation violation errors.
  1903  func (m ResolvedResourceMultiError) AllErrors() []error { return m }
  1904  
  1905  // ResolvedResourceValidationError is the validation error returned by
  1906  // ResolvedResource.Validate if the designated constraints aren't met.
  1907  type ResolvedResourceValidationError struct {
  1908  	field  string
  1909  	reason string
  1910  	cause  error
  1911  	key    bool
  1912  }
  1913  
  1914  // Field function returns field value.
  1915  func (e ResolvedResourceValidationError) Field() string { return e.field }
  1916  
  1917  // Reason function returns reason value.
  1918  func (e ResolvedResourceValidationError) Reason() string { return e.reason }
  1919  
  1920  // Cause function returns cause value.
  1921  func (e ResolvedResourceValidationError) Cause() error { return e.cause }
  1922  
  1923  // Key function returns key value.
  1924  func (e ResolvedResourceValidationError) Key() bool { return e.key }
  1925  
  1926  // ErrorName returns error name.
  1927  func (e ResolvedResourceValidationError) ErrorName() string { return "ResolvedResourceValidationError" }
  1928  
  1929  // Error satisfies the builtin error interface
  1930  func (e ResolvedResourceValidationError) Error() string {
  1931  	cause := ""
  1932  	if e.cause != nil {
  1933  		cause = fmt.Sprintf(" | caused by: %v", e.cause)
  1934  	}
  1935  
  1936  	key := ""
  1937  	if e.key {
  1938  		key = "key for "
  1939  	}
  1940  
  1941  	return fmt.Sprintf(
  1942  		"invalid %sResolvedResource.%s: %s%s",
  1943  		key,
  1944  		e.field,
  1945  		e.reason,
  1946  		cause)
  1947  }
  1948  
  1949  var _ error = ResolvedResourceValidationError{}
  1950  
  1951  var _ interface {
  1952  	Field() string
  1953  	Reason() string
  1954  	Key() bool
  1955  	Cause() error
  1956  	ErrorName() string
  1957  } = ResolvedResourceValidationError{}
  1958  
  1959  // Validate checks the field values on DispatchLookupResourcesResponse with the
  1960  // rules defined in the proto definition for this message. If any rules are
  1961  // violated, the first error encountered is returned, or nil if there are no violations.
  1962  func (m *DispatchLookupResourcesResponse) Validate() error {
  1963  	return m.validate(false)
  1964  }
  1965  
  1966  // ValidateAll checks the field values on DispatchLookupResourcesResponse with
  1967  // the rules defined in the proto definition for this message. If any rules
  1968  // are violated, the result is a list of violation errors wrapped in
  1969  // DispatchLookupResourcesResponseMultiError, or nil if none found.
  1970  func (m *DispatchLookupResourcesResponse) ValidateAll() error {
  1971  	return m.validate(true)
  1972  }
  1973  
  1974  func (m *DispatchLookupResourcesResponse) validate(all bool) error {
  1975  	if m == nil {
  1976  		return nil
  1977  	}
  1978  
  1979  	var errors []error
  1980  
  1981  	if all {
  1982  		switch v := interface{}(m.GetMetadata()).(type) {
  1983  		case interface{ ValidateAll() error }:
  1984  			if err := v.ValidateAll(); err != nil {
  1985  				errors = append(errors, DispatchLookupResourcesResponseValidationError{
  1986  					field:  "Metadata",
  1987  					reason: "embedded message failed validation",
  1988  					cause:  err,
  1989  				})
  1990  			}
  1991  		case interface{ Validate() error }:
  1992  			if err := v.Validate(); err != nil {
  1993  				errors = append(errors, DispatchLookupResourcesResponseValidationError{
  1994  					field:  "Metadata",
  1995  					reason: "embedded message failed validation",
  1996  					cause:  err,
  1997  				})
  1998  			}
  1999  		}
  2000  	} else if v, ok := interface{}(m.GetMetadata()).(interface{ Validate() error }); ok {
  2001  		if err := v.Validate(); err != nil {
  2002  			return DispatchLookupResourcesResponseValidationError{
  2003  				field:  "Metadata",
  2004  				reason: "embedded message failed validation",
  2005  				cause:  err,
  2006  			}
  2007  		}
  2008  	}
  2009  
  2010  	if all {
  2011  		switch v := interface{}(m.GetResolvedResource()).(type) {
  2012  		case interface{ ValidateAll() error }:
  2013  			if err := v.ValidateAll(); err != nil {
  2014  				errors = append(errors, DispatchLookupResourcesResponseValidationError{
  2015  					field:  "ResolvedResource",
  2016  					reason: "embedded message failed validation",
  2017  					cause:  err,
  2018  				})
  2019  			}
  2020  		case interface{ Validate() error }:
  2021  			if err := v.Validate(); err != nil {
  2022  				errors = append(errors, DispatchLookupResourcesResponseValidationError{
  2023  					field:  "ResolvedResource",
  2024  					reason: "embedded message failed validation",
  2025  					cause:  err,
  2026  				})
  2027  			}
  2028  		}
  2029  	} else if v, ok := interface{}(m.GetResolvedResource()).(interface{ Validate() error }); ok {
  2030  		if err := v.Validate(); err != nil {
  2031  			return DispatchLookupResourcesResponseValidationError{
  2032  				field:  "ResolvedResource",
  2033  				reason: "embedded message failed validation",
  2034  				cause:  err,
  2035  			}
  2036  		}
  2037  	}
  2038  
  2039  	if all {
  2040  		switch v := interface{}(m.GetAfterResponseCursor()).(type) {
  2041  		case interface{ ValidateAll() error }:
  2042  			if err := v.ValidateAll(); err != nil {
  2043  				errors = append(errors, DispatchLookupResourcesResponseValidationError{
  2044  					field:  "AfterResponseCursor",
  2045  					reason: "embedded message failed validation",
  2046  					cause:  err,
  2047  				})
  2048  			}
  2049  		case interface{ Validate() error }:
  2050  			if err := v.Validate(); err != nil {
  2051  				errors = append(errors, DispatchLookupResourcesResponseValidationError{
  2052  					field:  "AfterResponseCursor",
  2053  					reason: "embedded message failed validation",
  2054  					cause:  err,
  2055  				})
  2056  			}
  2057  		}
  2058  	} else if v, ok := interface{}(m.GetAfterResponseCursor()).(interface{ Validate() error }); ok {
  2059  		if err := v.Validate(); err != nil {
  2060  			return DispatchLookupResourcesResponseValidationError{
  2061  				field:  "AfterResponseCursor",
  2062  				reason: "embedded message failed validation",
  2063  				cause:  err,
  2064  			}
  2065  		}
  2066  	}
  2067  
  2068  	if len(errors) > 0 {
  2069  		return DispatchLookupResourcesResponseMultiError(errors)
  2070  	}
  2071  
  2072  	return nil
  2073  }
  2074  
  2075  // DispatchLookupResourcesResponseMultiError is an error wrapping multiple
  2076  // validation errors returned by DispatchLookupResourcesResponse.ValidateAll()
  2077  // if the designated constraints aren't met.
  2078  type DispatchLookupResourcesResponseMultiError []error
  2079  
  2080  // Error returns a concatenation of all the error messages it wraps.
  2081  func (m DispatchLookupResourcesResponseMultiError) Error() string {
  2082  	var msgs []string
  2083  	for _, err := range m {
  2084  		msgs = append(msgs, err.Error())
  2085  	}
  2086  	return strings.Join(msgs, "; ")
  2087  }
  2088  
  2089  // AllErrors returns a list of validation violation errors.
  2090  func (m DispatchLookupResourcesResponseMultiError) AllErrors() []error { return m }
  2091  
  2092  // DispatchLookupResourcesResponseValidationError is the validation error
  2093  // returned by DispatchLookupResourcesResponse.Validate if the designated
  2094  // constraints aren't met.
  2095  type DispatchLookupResourcesResponseValidationError struct {
  2096  	field  string
  2097  	reason string
  2098  	cause  error
  2099  	key    bool
  2100  }
  2101  
  2102  // Field function returns field value.
  2103  func (e DispatchLookupResourcesResponseValidationError) Field() string { return e.field }
  2104  
  2105  // Reason function returns reason value.
  2106  func (e DispatchLookupResourcesResponseValidationError) Reason() string { return e.reason }
  2107  
  2108  // Cause function returns cause value.
  2109  func (e DispatchLookupResourcesResponseValidationError) Cause() error { return e.cause }
  2110  
  2111  // Key function returns key value.
  2112  func (e DispatchLookupResourcesResponseValidationError) Key() bool { return e.key }
  2113  
  2114  // ErrorName returns error name.
  2115  func (e DispatchLookupResourcesResponseValidationError) ErrorName() string {
  2116  	return "DispatchLookupResourcesResponseValidationError"
  2117  }
  2118  
  2119  // Error satisfies the builtin error interface
  2120  func (e DispatchLookupResourcesResponseValidationError) Error() string {
  2121  	cause := ""
  2122  	if e.cause != nil {
  2123  		cause = fmt.Sprintf(" | caused by: %v", e.cause)
  2124  	}
  2125  
  2126  	key := ""
  2127  	if e.key {
  2128  		key = "key for "
  2129  	}
  2130  
  2131  	return fmt.Sprintf(
  2132  		"invalid %sDispatchLookupResourcesResponse.%s: %s%s",
  2133  		key,
  2134  		e.field,
  2135  		e.reason,
  2136  		cause)
  2137  }
  2138  
  2139  var _ error = DispatchLookupResourcesResponseValidationError{}
  2140  
  2141  var _ interface {
  2142  	Field() string
  2143  	Reason() string
  2144  	Key() bool
  2145  	Cause() error
  2146  	ErrorName() string
  2147  } = DispatchLookupResourcesResponseValidationError{}
  2148  
  2149  // Validate checks the field values on DispatchLookupSubjectsRequest with the
  2150  // rules defined in the proto definition for this message. If any rules are
  2151  // violated, the first error encountered is returned, or nil if there are no violations.
  2152  func (m *DispatchLookupSubjectsRequest) Validate() error {
  2153  	return m.validate(false)
  2154  }
  2155  
  2156  // ValidateAll checks the field values on DispatchLookupSubjectsRequest with
  2157  // the rules defined in the proto definition for this message. If any rules
  2158  // are violated, the result is a list of violation errors wrapped in
  2159  // DispatchLookupSubjectsRequestMultiError, or nil if none found.
  2160  func (m *DispatchLookupSubjectsRequest) ValidateAll() error {
  2161  	return m.validate(true)
  2162  }
  2163  
  2164  func (m *DispatchLookupSubjectsRequest) validate(all bool) error {
  2165  	if m == nil {
  2166  		return nil
  2167  	}
  2168  
  2169  	var errors []error
  2170  
  2171  	if m.GetMetadata() == nil {
  2172  		err := DispatchLookupSubjectsRequestValidationError{
  2173  			field:  "Metadata",
  2174  			reason: "value is required",
  2175  		}
  2176  		if !all {
  2177  			return err
  2178  		}
  2179  		errors = append(errors, err)
  2180  	}
  2181  
  2182  	if all {
  2183  		switch v := interface{}(m.GetMetadata()).(type) {
  2184  		case interface{ ValidateAll() error }:
  2185  			if err := v.ValidateAll(); err != nil {
  2186  				errors = append(errors, DispatchLookupSubjectsRequestValidationError{
  2187  					field:  "Metadata",
  2188  					reason: "embedded message failed validation",
  2189  					cause:  err,
  2190  				})
  2191  			}
  2192  		case interface{ Validate() error }:
  2193  			if err := v.Validate(); err != nil {
  2194  				errors = append(errors, DispatchLookupSubjectsRequestValidationError{
  2195  					field:  "Metadata",
  2196  					reason: "embedded message failed validation",
  2197  					cause:  err,
  2198  				})
  2199  			}
  2200  		}
  2201  	} else if v, ok := interface{}(m.GetMetadata()).(interface{ Validate() error }); ok {
  2202  		if err := v.Validate(); err != nil {
  2203  			return DispatchLookupSubjectsRequestValidationError{
  2204  				field:  "Metadata",
  2205  				reason: "embedded message failed validation",
  2206  				cause:  err,
  2207  			}
  2208  		}
  2209  	}
  2210  
  2211  	if m.GetResourceRelation() == nil {
  2212  		err := DispatchLookupSubjectsRequestValidationError{
  2213  			field:  "ResourceRelation",
  2214  			reason: "value is required",
  2215  		}
  2216  		if !all {
  2217  			return err
  2218  		}
  2219  		errors = append(errors, err)
  2220  	}
  2221  
  2222  	if all {
  2223  		switch v := interface{}(m.GetResourceRelation()).(type) {
  2224  		case interface{ ValidateAll() error }:
  2225  			if err := v.ValidateAll(); err != nil {
  2226  				errors = append(errors, DispatchLookupSubjectsRequestValidationError{
  2227  					field:  "ResourceRelation",
  2228  					reason: "embedded message failed validation",
  2229  					cause:  err,
  2230  				})
  2231  			}
  2232  		case interface{ Validate() error }:
  2233  			if err := v.Validate(); err != nil {
  2234  				errors = append(errors, DispatchLookupSubjectsRequestValidationError{
  2235  					field:  "ResourceRelation",
  2236  					reason: "embedded message failed validation",
  2237  					cause:  err,
  2238  				})
  2239  			}
  2240  		}
  2241  	} else if v, ok := interface{}(m.GetResourceRelation()).(interface{ Validate() error }); ok {
  2242  		if err := v.Validate(); err != nil {
  2243  			return DispatchLookupSubjectsRequestValidationError{
  2244  				field:  "ResourceRelation",
  2245  				reason: "embedded message failed validation",
  2246  				cause:  err,
  2247  			}
  2248  		}
  2249  	}
  2250  
  2251  	if m.GetSubjectRelation() == nil {
  2252  		err := DispatchLookupSubjectsRequestValidationError{
  2253  			field:  "SubjectRelation",
  2254  			reason: "value is required",
  2255  		}
  2256  		if !all {
  2257  			return err
  2258  		}
  2259  		errors = append(errors, err)
  2260  	}
  2261  
  2262  	if all {
  2263  		switch v := interface{}(m.GetSubjectRelation()).(type) {
  2264  		case interface{ ValidateAll() error }:
  2265  			if err := v.ValidateAll(); err != nil {
  2266  				errors = append(errors, DispatchLookupSubjectsRequestValidationError{
  2267  					field:  "SubjectRelation",
  2268  					reason: "embedded message failed validation",
  2269  					cause:  err,
  2270  				})
  2271  			}
  2272  		case interface{ Validate() error }:
  2273  			if err := v.Validate(); err != nil {
  2274  				errors = append(errors, DispatchLookupSubjectsRequestValidationError{
  2275  					field:  "SubjectRelation",
  2276  					reason: "embedded message failed validation",
  2277  					cause:  err,
  2278  				})
  2279  			}
  2280  		}
  2281  	} else if v, ok := interface{}(m.GetSubjectRelation()).(interface{ Validate() error }); ok {
  2282  		if err := v.Validate(); err != nil {
  2283  			return DispatchLookupSubjectsRequestValidationError{
  2284  				field:  "SubjectRelation",
  2285  				reason: "embedded message failed validation",
  2286  				cause:  err,
  2287  			}
  2288  		}
  2289  	}
  2290  
  2291  	// no validation rules for OptionalLimit
  2292  
  2293  	if all {
  2294  		switch v := interface{}(m.GetOptionalCursor()).(type) {
  2295  		case interface{ ValidateAll() error }:
  2296  			if err := v.ValidateAll(); err != nil {
  2297  				errors = append(errors, DispatchLookupSubjectsRequestValidationError{
  2298  					field:  "OptionalCursor",
  2299  					reason: "embedded message failed validation",
  2300  					cause:  err,
  2301  				})
  2302  			}
  2303  		case interface{ Validate() error }:
  2304  			if err := v.Validate(); err != nil {
  2305  				errors = append(errors, DispatchLookupSubjectsRequestValidationError{
  2306  					field:  "OptionalCursor",
  2307  					reason: "embedded message failed validation",
  2308  					cause:  err,
  2309  				})
  2310  			}
  2311  		}
  2312  	} else if v, ok := interface{}(m.GetOptionalCursor()).(interface{ Validate() error }); ok {
  2313  		if err := v.Validate(); err != nil {
  2314  			return DispatchLookupSubjectsRequestValidationError{
  2315  				field:  "OptionalCursor",
  2316  				reason: "embedded message failed validation",
  2317  				cause:  err,
  2318  			}
  2319  		}
  2320  	}
  2321  
  2322  	if len(errors) > 0 {
  2323  		return DispatchLookupSubjectsRequestMultiError(errors)
  2324  	}
  2325  
  2326  	return nil
  2327  }
  2328  
  2329  // DispatchLookupSubjectsRequestMultiError is an error wrapping multiple
  2330  // validation errors returned by DispatchLookupSubjectsRequest.ValidateAll()
  2331  // if the designated constraints aren't met.
  2332  type DispatchLookupSubjectsRequestMultiError []error
  2333  
  2334  // Error returns a concatenation of all the error messages it wraps.
  2335  func (m DispatchLookupSubjectsRequestMultiError) Error() string {
  2336  	var msgs []string
  2337  	for _, err := range m {
  2338  		msgs = append(msgs, err.Error())
  2339  	}
  2340  	return strings.Join(msgs, "; ")
  2341  }
  2342  
  2343  // AllErrors returns a list of validation violation errors.
  2344  func (m DispatchLookupSubjectsRequestMultiError) AllErrors() []error { return m }
  2345  
  2346  // DispatchLookupSubjectsRequestValidationError is the validation error
  2347  // returned by DispatchLookupSubjectsRequest.Validate if the designated
  2348  // constraints aren't met.
  2349  type DispatchLookupSubjectsRequestValidationError struct {
  2350  	field  string
  2351  	reason string
  2352  	cause  error
  2353  	key    bool
  2354  }
  2355  
  2356  // Field function returns field value.
  2357  func (e DispatchLookupSubjectsRequestValidationError) Field() string { return e.field }
  2358  
  2359  // Reason function returns reason value.
  2360  func (e DispatchLookupSubjectsRequestValidationError) Reason() string { return e.reason }
  2361  
  2362  // Cause function returns cause value.
  2363  func (e DispatchLookupSubjectsRequestValidationError) Cause() error { return e.cause }
  2364  
  2365  // Key function returns key value.
  2366  func (e DispatchLookupSubjectsRequestValidationError) Key() bool { return e.key }
  2367  
  2368  // ErrorName returns error name.
  2369  func (e DispatchLookupSubjectsRequestValidationError) ErrorName() string {
  2370  	return "DispatchLookupSubjectsRequestValidationError"
  2371  }
  2372  
  2373  // Error satisfies the builtin error interface
  2374  func (e DispatchLookupSubjectsRequestValidationError) Error() string {
  2375  	cause := ""
  2376  	if e.cause != nil {
  2377  		cause = fmt.Sprintf(" | caused by: %v", e.cause)
  2378  	}
  2379  
  2380  	key := ""
  2381  	if e.key {
  2382  		key = "key for "
  2383  	}
  2384  
  2385  	return fmt.Sprintf(
  2386  		"invalid %sDispatchLookupSubjectsRequest.%s: %s%s",
  2387  		key,
  2388  		e.field,
  2389  		e.reason,
  2390  		cause)
  2391  }
  2392  
  2393  var _ error = DispatchLookupSubjectsRequestValidationError{}
  2394  
  2395  var _ interface {
  2396  	Field() string
  2397  	Reason() string
  2398  	Key() bool
  2399  	Cause() error
  2400  	ErrorName() string
  2401  } = DispatchLookupSubjectsRequestValidationError{}
  2402  
  2403  // Validate checks the field values on FoundSubject with the rules defined in
  2404  // the proto definition for this message. If any rules are violated, the first
  2405  // error encountered is returned, or nil if there are no violations.
  2406  func (m *FoundSubject) Validate() error {
  2407  	return m.validate(false)
  2408  }
  2409  
  2410  // ValidateAll checks the field values on FoundSubject with the rules defined
  2411  // in the proto definition for this message. If any rules are violated, the
  2412  // result is a list of violation errors wrapped in FoundSubjectMultiError, or
  2413  // nil if none found.
  2414  func (m *FoundSubject) ValidateAll() error {
  2415  	return m.validate(true)
  2416  }
  2417  
  2418  func (m *FoundSubject) validate(all bool) error {
  2419  	if m == nil {
  2420  		return nil
  2421  	}
  2422  
  2423  	var errors []error
  2424  
  2425  	// no validation rules for SubjectId
  2426  
  2427  	if all {
  2428  		switch v := interface{}(m.GetCaveatExpression()).(type) {
  2429  		case interface{ ValidateAll() error }:
  2430  			if err := v.ValidateAll(); err != nil {
  2431  				errors = append(errors, FoundSubjectValidationError{
  2432  					field:  "CaveatExpression",
  2433  					reason: "embedded message failed validation",
  2434  					cause:  err,
  2435  				})
  2436  			}
  2437  		case interface{ Validate() error }:
  2438  			if err := v.Validate(); err != nil {
  2439  				errors = append(errors, FoundSubjectValidationError{
  2440  					field:  "CaveatExpression",
  2441  					reason: "embedded message failed validation",
  2442  					cause:  err,
  2443  				})
  2444  			}
  2445  		}
  2446  	} else if v, ok := interface{}(m.GetCaveatExpression()).(interface{ Validate() error }); ok {
  2447  		if err := v.Validate(); err != nil {
  2448  			return FoundSubjectValidationError{
  2449  				field:  "CaveatExpression",
  2450  				reason: "embedded message failed validation",
  2451  				cause:  err,
  2452  			}
  2453  		}
  2454  	}
  2455  
  2456  	for idx, item := range m.GetExcludedSubjects() {
  2457  		_, _ = idx, item
  2458  
  2459  		if all {
  2460  			switch v := interface{}(item).(type) {
  2461  			case interface{ ValidateAll() error }:
  2462  				if err := v.ValidateAll(); err != nil {
  2463  					errors = append(errors, FoundSubjectValidationError{
  2464  						field:  fmt.Sprintf("ExcludedSubjects[%v]", idx),
  2465  						reason: "embedded message failed validation",
  2466  						cause:  err,
  2467  					})
  2468  				}
  2469  			case interface{ Validate() error }:
  2470  				if err := v.Validate(); err != nil {
  2471  					errors = append(errors, FoundSubjectValidationError{
  2472  						field:  fmt.Sprintf("ExcludedSubjects[%v]", idx),
  2473  						reason: "embedded message failed validation",
  2474  						cause:  err,
  2475  					})
  2476  				}
  2477  			}
  2478  		} else if v, ok := interface{}(item).(interface{ Validate() error }); ok {
  2479  			if err := v.Validate(); err != nil {
  2480  				return FoundSubjectValidationError{
  2481  					field:  fmt.Sprintf("ExcludedSubjects[%v]", idx),
  2482  					reason: "embedded message failed validation",
  2483  					cause:  err,
  2484  				}
  2485  			}
  2486  		}
  2487  
  2488  	}
  2489  
  2490  	if len(errors) > 0 {
  2491  		return FoundSubjectMultiError(errors)
  2492  	}
  2493  
  2494  	return nil
  2495  }
  2496  
  2497  // FoundSubjectMultiError is an error wrapping multiple validation errors
  2498  // returned by FoundSubject.ValidateAll() if the designated constraints aren't met.
  2499  type FoundSubjectMultiError []error
  2500  
  2501  // Error returns a concatenation of all the error messages it wraps.
  2502  func (m FoundSubjectMultiError) Error() string {
  2503  	var msgs []string
  2504  	for _, err := range m {
  2505  		msgs = append(msgs, err.Error())
  2506  	}
  2507  	return strings.Join(msgs, "; ")
  2508  }
  2509  
  2510  // AllErrors returns a list of validation violation errors.
  2511  func (m FoundSubjectMultiError) AllErrors() []error { return m }
  2512  
  2513  // FoundSubjectValidationError is the validation error returned by
  2514  // FoundSubject.Validate if the designated constraints aren't met.
  2515  type FoundSubjectValidationError struct {
  2516  	field  string
  2517  	reason string
  2518  	cause  error
  2519  	key    bool
  2520  }
  2521  
  2522  // Field function returns field value.
  2523  func (e FoundSubjectValidationError) Field() string { return e.field }
  2524  
  2525  // Reason function returns reason value.
  2526  func (e FoundSubjectValidationError) Reason() string { return e.reason }
  2527  
  2528  // Cause function returns cause value.
  2529  func (e FoundSubjectValidationError) Cause() error { return e.cause }
  2530  
  2531  // Key function returns key value.
  2532  func (e FoundSubjectValidationError) Key() bool { return e.key }
  2533  
  2534  // ErrorName returns error name.
  2535  func (e FoundSubjectValidationError) ErrorName() string { return "FoundSubjectValidationError" }
  2536  
  2537  // Error satisfies the builtin error interface
  2538  func (e FoundSubjectValidationError) Error() string {
  2539  	cause := ""
  2540  	if e.cause != nil {
  2541  		cause = fmt.Sprintf(" | caused by: %v", e.cause)
  2542  	}
  2543  
  2544  	key := ""
  2545  	if e.key {
  2546  		key = "key for "
  2547  	}
  2548  
  2549  	return fmt.Sprintf(
  2550  		"invalid %sFoundSubject.%s: %s%s",
  2551  		key,
  2552  		e.field,
  2553  		e.reason,
  2554  		cause)
  2555  }
  2556  
  2557  var _ error = FoundSubjectValidationError{}
  2558  
  2559  var _ interface {
  2560  	Field() string
  2561  	Reason() string
  2562  	Key() bool
  2563  	Cause() error
  2564  	ErrorName() string
  2565  } = FoundSubjectValidationError{}
  2566  
  2567  // Validate checks the field values on FoundSubjects with the rules defined in
  2568  // the proto definition for this message. If any rules are violated, the first
  2569  // error encountered is returned, or nil if there are no violations.
  2570  func (m *FoundSubjects) Validate() error {
  2571  	return m.validate(false)
  2572  }
  2573  
  2574  // ValidateAll checks the field values on FoundSubjects with the rules defined
  2575  // in the proto definition for this message. If any rules are violated, the
  2576  // result is a list of violation errors wrapped in FoundSubjectsMultiError, or
  2577  // nil if none found.
  2578  func (m *FoundSubjects) ValidateAll() error {
  2579  	return m.validate(true)
  2580  }
  2581  
  2582  func (m *FoundSubjects) validate(all bool) error {
  2583  	if m == nil {
  2584  		return nil
  2585  	}
  2586  
  2587  	var errors []error
  2588  
  2589  	for idx, item := range m.GetFoundSubjects() {
  2590  		_, _ = idx, item
  2591  
  2592  		if all {
  2593  			switch v := interface{}(item).(type) {
  2594  			case interface{ ValidateAll() error }:
  2595  				if err := v.ValidateAll(); err != nil {
  2596  					errors = append(errors, FoundSubjectsValidationError{
  2597  						field:  fmt.Sprintf("FoundSubjects[%v]", idx),
  2598  						reason: "embedded message failed validation",
  2599  						cause:  err,
  2600  					})
  2601  				}
  2602  			case interface{ Validate() error }:
  2603  				if err := v.Validate(); err != nil {
  2604  					errors = append(errors, FoundSubjectsValidationError{
  2605  						field:  fmt.Sprintf("FoundSubjects[%v]", idx),
  2606  						reason: "embedded message failed validation",
  2607  						cause:  err,
  2608  					})
  2609  				}
  2610  			}
  2611  		} else if v, ok := interface{}(item).(interface{ Validate() error }); ok {
  2612  			if err := v.Validate(); err != nil {
  2613  				return FoundSubjectsValidationError{
  2614  					field:  fmt.Sprintf("FoundSubjects[%v]", idx),
  2615  					reason: "embedded message failed validation",
  2616  					cause:  err,
  2617  				}
  2618  			}
  2619  		}
  2620  
  2621  	}
  2622  
  2623  	if len(errors) > 0 {
  2624  		return FoundSubjectsMultiError(errors)
  2625  	}
  2626  
  2627  	return nil
  2628  }
  2629  
  2630  // FoundSubjectsMultiError is an error wrapping multiple validation errors
  2631  // returned by FoundSubjects.ValidateAll() if the designated constraints
  2632  // aren't met.
  2633  type FoundSubjectsMultiError []error
  2634  
  2635  // Error returns a concatenation of all the error messages it wraps.
  2636  func (m FoundSubjectsMultiError) Error() string {
  2637  	var msgs []string
  2638  	for _, err := range m {
  2639  		msgs = append(msgs, err.Error())
  2640  	}
  2641  	return strings.Join(msgs, "; ")
  2642  }
  2643  
  2644  // AllErrors returns a list of validation violation errors.
  2645  func (m FoundSubjectsMultiError) AllErrors() []error { return m }
  2646  
  2647  // FoundSubjectsValidationError is the validation error returned by
  2648  // FoundSubjects.Validate if the designated constraints aren't met.
  2649  type FoundSubjectsValidationError struct {
  2650  	field  string
  2651  	reason string
  2652  	cause  error
  2653  	key    bool
  2654  }
  2655  
  2656  // Field function returns field value.
  2657  func (e FoundSubjectsValidationError) Field() string { return e.field }
  2658  
  2659  // Reason function returns reason value.
  2660  func (e FoundSubjectsValidationError) Reason() string { return e.reason }
  2661  
  2662  // Cause function returns cause value.
  2663  func (e FoundSubjectsValidationError) Cause() error { return e.cause }
  2664  
  2665  // Key function returns key value.
  2666  func (e FoundSubjectsValidationError) Key() bool { return e.key }
  2667  
  2668  // ErrorName returns error name.
  2669  func (e FoundSubjectsValidationError) ErrorName() string { return "FoundSubjectsValidationError" }
  2670  
  2671  // Error satisfies the builtin error interface
  2672  func (e FoundSubjectsValidationError) Error() string {
  2673  	cause := ""
  2674  	if e.cause != nil {
  2675  		cause = fmt.Sprintf(" | caused by: %v", e.cause)
  2676  	}
  2677  
  2678  	key := ""
  2679  	if e.key {
  2680  		key = "key for "
  2681  	}
  2682  
  2683  	return fmt.Sprintf(
  2684  		"invalid %sFoundSubjects.%s: %s%s",
  2685  		key,
  2686  		e.field,
  2687  		e.reason,
  2688  		cause)
  2689  }
  2690  
  2691  var _ error = FoundSubjectsValidationError{}
  2692  
  2693  var _ interface {
  2694  	Field() string
  2695  	Reason() string
  2696  	Key() bool
  2697  	Cause() error
  2698  	ErrorName() string
  2699  } = FoundSubjectsValidationError{}
  2700  
  2701  // Validate checks the field values on DispatchLookupSubjectsResponse with the
  2702  // rules defined in the proto definition for this message. If any rules are
  2703  // violated, the first error encountered is returned, or nil if there are no violations.
  2704  func (m *DispatchLookupSubjectsResponse) Validate() error {
  2705  	return m.validate(false)
  2706  }
  2707  
  2708  // ValidateAll checks the field values on DispatchLookupSubjectsResponse with
  2709  // the rules defined in the proto definition for this message. If any rules
  2710  // are violated, the result is a list of violation errors wrapped in
  2711  // DispatchLookupSubjectsResponseMultiError, or nil if none found.
  2712  func (m *DispatchLookupSubjectsResponse) ValidateAll() error {
  2713  	return m.validate(true)
  2714  }
  2715  
  2716  func (m *DispatchLookupSubjectsResponse) validate(all bool) error {
  2717  	if m == nil {
  2718  		return nil
  2719  	}
  2720  
  2721  	var errors []error
  2722  
  2723  	{
  2724  		sorted_keys := make([]string, len(m.GetFoundSubjectsByResourceId()))
  2725  		i := 0
  2726  		for key := range m.GetFoundSubjectsByResourceId() {
  2727  			sorted_keys[i] = key
  2728  			i++
  2729  		}
  2730  		sort.Slice(sorted_keys, func(i, j int) bool { return sorted_keys[i] < sorted_keys[j] })
  2731  		for _, key := range sorted_keys {
  2732  			val := m.GetFoundSubjectsByResourceId()[key]
  2733  			_ = val
  2734  
  2735  			// no validation rules for FoundSubjectsByResourceId[key]
  2736  
  2737  			if all {
  2738  				switch v := interface{}(val).(type) {
  2739  				case interface{ ValidateAll() error }:
  2740  					if err := v.ValidateAll(); err != nil {
  2741  						errors = append(errors, DispatchLookupSubjectsResponseValidationError{
  2742  							field:  fmt.Sprintf("FoundSubjectsByResourceId[%v]", key),
  2743  							reason: "embedded message failed validation",
  2744  							cause:  err,
  2745  						})
  2746  					}
  2747  				case interface{ Validate() error }:
  2748  					if err := v.Validate(); err != nil {
  2749  						errors = append(errors, DispatchLookupSubjectsResponseValidationError{
  2750  							field:  fmt.Sprintf("FoundSubjectsByResourceId[%v]", key),
  2751  							reason: "embedded message failed validation",
  2752  							cause:  err,
  2753  						})
  2754  					}
  2755  				}
  2756  			} else if v, ok := interface{}(val).(interface{ Validate() error }); ok {
  2757  				if err := v.Validate(); err != nil {
  2758  					return DispatchLookupSubjectsResponseValidationError{
  2759  						field:  fmt.Sprintf("FoundSubjectsByResourceId[%v]", key),
  2760  						reason: "embedded message failed validation",
  2761  						cause:  err,
  2762  					}
  2763  				}
  2764  			}
  2765  
  2766  		}
  2767  	}
  2768  
  2769  	if all {
  2770  		switch v := interface{}(m.GetMetadata()).(type) {
  2771  		case interface{ ValidateAll() error }:
  2772  			if err := v.ValidateAll(); err != nil {
  2773  				errors = append(errors, DispatchLookupSubjectsResponseValidationError{
  2774  					field:  "Metadata",
  2775  					reason: "embedded message failed validation",
  2776  					cause:  err,
  2777  				})
  2778  			}
  2779  		case interface{ Validate() error }:
  2780  			if err := v.Validate(); err != nil {
  2781  				errors = append(errors, DispatchLookupSubjectsResponseValidationError{
  2782  					field:  "Metadata",
  2783  					reason: "embedded message failed validation",
  2784  					cause:  err,
  2785  				})
  2786  			}
  2787  		}
  2788  	} else if v, ok := interface{}(m.GetMetadata()).(interface{ Validate() error }); ok {
  2789  		if err := v.Validate(); err != nil {
  2790  			return DispatchLookupSubjectsResponseValidationError{
  2791  				field:  "Metadata",
  2792  				reason: "embedded message failed validation",
  2793  				cause:  err,
  2794  			}
  2795  		}
  2796  	}
  2797  
  2798  	if all {
  2799  		switch v := interface{}(m.GetAfterResponseCursor()).(type) {
  2800  		case interface{ ValidateAll() error }:
  2801  			if err := v.ValidateAll(); err != nil {
  2802  				errors = append(errors, DispatchLookupSubjectsResponseValidationError{
  2803  					field:  "AfterResponseCursor",
  2804  					reason: "embedded message failed validation",
  2805  					cause:  err,
  2806  				})
  2807  			}
  2808  		case interface{ Validate() error }:
  2809  			if err := v.Validate(); err != nil {
  2810  				errors = append(errors, DispatchLookupSubjectsResponseValidationError{
  2811  					field:  "AfterResponseCursor",
  2812  					reason: "embedded message failed validation",
  2813  					cause:  err,
  2814  				})
  2815  			}
  2816  		}
  2817  	} else if v, ok := interface{}(m.GetAfterResponseCursor()).(interface{ Validate() error }); ok {
  2818  		if err := v.Validate(); err != nil {
  2819  			return DispatchLookupSubjectsResponseValidationError{
  2820  				field:  "AfterResponseCursor",
  2821  				reason: "embedded message failed validation",
  2822  				cause:  err,
  2823  			}
  2824  		}
  2825  	}
  2826  
  2827  	if len(errors) > 0 {
  2828  		return DispatchLookupSubjectsResponseMultiError(errors)
  2829  	}
  2830  
  2831  	return nil
  2832  }
  2833  
  2834  // DispatchLookupSubjectsResponseMultiError is an error wrapping multiple
  2835  // validation errors returned by DispatchLookupSubjectsResponse.ValidateAll()
  2836  // if the designated constraints aren't met.
  2837  type DispatchLookupSubjectsResponseMultiError []error
  2838  
  2839  // Error returns a concatenation of all the error messages it wraps.
  2840  func (m DispatchLookupSubjectsResponseMultiError) Error() string {
  2841  	var msgs []string
  2842  	for _, err := range m {
  2843  		msgs = append(msgs, err.Error())
  2844  	}
  2845  	return strings.Join(msgs, "; ")
  2846  }
  2847  
  2848  // AllErrors returns a list of validation violation errors.
  2849  func (m DispatchLookupSubjectsResponseMultiError) AllErrors() []error { return m }
  2850  
  2851  // DispatchLookupSubjectsResponseValidationError is the validation error
  2852  // returned by DispatchLookupSubjectsResponse.Validate if the designated
  2853  // constraints aren't met.
  2854  type DispatchLookupSubjectsResponseValidationError struct {
  2855  	field  string
  2856  	reason string
  2857  	cause  error
  2858  	key    bool
  2859  }
  2860  
  2861  // Field function returns field value.
  2862  func (e DispatchLookupSubjectsResponseValidationError) Field() string { return e.field }
  2863  
  2864  // Reason function returns reason value.
  2865  func (e DispatchLookupSubjectsResponseValidationError) Reason() string { return e.reason }
  2866  
  2867  // Cause function returns cause value.
  2868  func (e DispatchLookupSubjectsResponseValidationError) Cause() error { return e.cause }
  2869  
  2870  // Key function returns key value.
  2871  func (e DispatchLookupSubjectsResponseValidationError) Key() bool { return e.key }
  2872  
  2873  // ErrorName returns error name.
  2874  func (e DispatchLookupSubjectsResponseValidationError) ErrorName() string {
  2875  	return "DispatchLookupSubjectsResponseValidationError"
  2876  }
  2877  
  2878  // Error satisfies the builtin error interface
  2879  func (e DispatchLookupSubjectsResponseValidationError) Error() string {
  2880  	cause := ""
  2881  	if e.cause != nil {
  2882  		cause = fmt.Sprintf(" | caused by: %v", e.cause)
  2883  	}
  2884  
  2885  	key := ""
  2886  	if e.key {
  2887  		key = "key for "
  2888  	}
  2889  
  2890  	return fmt.Sprintf(
  2891  		"invalid %sDispatchLookupSubjectsResponse.%s: %s%s",
  2892  		key,
  2893  		e.field,
  2894  		e.reason,
  2895  		cause)
  2896  }
  2897  
  2898  var _ error = DispatchLookupSubjectsResponseValidationError{}
  2899  
  2900  var _ interface {
  2901  	Field() string
  2902  	Reason() string
  2903  	Key() bool
  2904  	Cause() error
  2905  	ErrorName() string
  2906  } = DispatchLookupSubjectsResponseValidationError{}
  2907  
  2908  // Validate checks the field values on ResolverMeta with the rules defined in
  2909  // the proto definition for this message. If any rules are violated, the first
  2910  // error encountered is returned, or nil if there are no violations.
  2911  func (m *ResolverMeta) Validate() error {
  2912  	return m.validate(false)
  2913  }
  2914  
  2915  // ValidateAll checks the field values on ResolverMeta with the rules defined
  2916  // in the proto definition for this message. If any rules are violated, the
  2917  // result is a list of violation errors wrapped in ResolverMetaMultiError, or
  2918  // nil if none found.
  2919  func (m *ResolverMeta) ValidateAll() error {
  2920  	return m.validate(true)
  2921  }
  2922  
  2923  func (m *ResolverMeta) validate(all bool) error {
  2924  	if m == nil {
  2925  		return nil
  2926  	}
  2927  
  2928  	var errors []error
  2929  
  2930  	if len(m.GetAtRevision()) > 1024 {
  2931  		err := ResolverMetaValidationError{
  2932  			field:  "AtRevision",
  2933  			reason: "value length must be at most 1024 bytes",
  2934  		}
  2935  		if !all {
  2936  			return err
  2937  		}
  2938  		errors = append(errors, err)
  2939  	}
  2940  
  2941  	if m.GetDepthRemaining() <= 0 {
  2942  		err := ResolverMetaValidationError{
  2943  			field:  "DepthRemaining",
  2944  			reason: "value must be greater than 0",
  2945  		}
  2946  		if !all {
  2947  			return err
  2948  		}
  2949  		errors = append(errors, err)
  2950  	}
  2951  
  2952  	// no validation rules for RequestId
  2953  
  2954  	if len(m.GetTraversalBloom()) > 1024 {
  2955  		err := ResolverMetaValidationError{
  2956  			field:  "TraversalBloom",
  2957  			reason: "value length must be at most 1024 bytes",
  2958  		}
  2959  		if !all {
  2960  			return err
  2961  		}
  2962  		errors = append(errors, err)
  2963  	}
  2964  
  2965  	if len(errors) > 0 {
  2966  		return ResolverMetaMultiError(errors)
  2967  	}
  2968  
  2969  	return nil
  2970  }
  2971  
  2972  // ResolverMetaMultiError is an error wrapping multiple validation errors
  2973  // returned by ResolverMeta.ValidateAll() if the designated constraints aren't met.
  2974  type ResolverMetaMultiError []error
  2975  
  2976  // Error returns a concatenation of all the error messages it wraps.
  2977  func (m ResolverMetaMultiError) Error() string {
  2978  	var msgs []string
  2979  	for _, err := range m {
  2980  		msgs = append(msgs, err.Error())
  2981  	}
  2982  	return strings.Join(msgs, "; ")
  2983  }
  2984  
  2985  // AllErrors returns a list of validation violation errors.
  2986  func (m ResolverMetaMultiError) AllErrors() []error { return m }
  2987  
  2988  // ResolverMetaValidationError is the validation error returned by
  2989  // ResolverMeta.Validate if the designated constraints aren't met.
  2990  type ResolverMetaValidationError struct {
  2991  	field  string
  2992  	reason string
  2993  	cause  error
  2994  	key    bool
  2995  }
  2996  
  2997  // Field function returns field value.
  2998  func (e ResolverMetaValidationError) Field() string { return e.field }
  2999  
  3000  // Reason function returns reason value.
  3001  func (e ResolverMetaValidationError) Reason() string { return e.reason }
  3002  
  3003  // Cause function returns cause value.
  3004  func (e ResolverMetaValidationError) Cause() error { return e.cause }
  3005  
  3006  // Key function returns key value.
  3007  func (e ResolverMetaValidationError) Key() bool { return e.key }
  3008  
  3009  // ErrorName returns error name.
  3010  func (e ResolverMetaValidationError) ErrorName() string { return "ResolverMetaValidationError" }
  3011  
  3012  // Error satisfies the builtin error interface
  3013  func (e ResolverMetaValidationError) Error() string {
  3014  	cause := ""
  3015  	if e.cause != nil {
  3016  		cause = fmt.Sprintf(" | caused by: %v", e.cause)
  3017  	}
  3018  
  3019  	key := ""
  3020  	if e.key {
  3021  		key = "key for "
  3022  	}
  3023  
  3024  	return fmt.Sprintf(
  3025  		"invalid %sResolverMeta.%s: %s%s",
  3026  		key,
  3027  		e.field,
  3028  		e.reason,
  3029  		cause)
  3030  }
  3031  
  3032  var _ error = ResolverMetaValidationError{}
  3033  
  3034  var _ interface {
  3035  	Field() string
  3036  	Reason() string
  3037  	Key() bool
  3038  	Cause() error
  3039  	ErrorName() string
  3040  } = ResolverMetaValidationError{}
  3041  
  3042  // Validate checks the field values on ResponseMeta with the rules defined in
  3043  // the proto definition for this message. If any rules are violated, the first
  3044  // error encountered is returned, or nil if there are no violations.
  3045  func (m *ResponseMeta) Validate() error {
  3046  	return m.validate(false)
  3047  }
  3048  
  3049  // ValidateAll checks the field values on ResponseMeta with the rules defined
  3050  // in the proto definition for this message. If any rules are violated, the
  3051  // result is a list of violation errors wrapped in ResponseMetaMultiError, or
  3052  // nil if none found.
  3053  func (m *ResponseMeta) ValidateAll() error {
  3054  	return m.validate(true)
  3055  }
  3056  
  3057  func (m *ResponseMeta) validate(all bool) error {
  3058  	if m == nil {
  3059  		return nil
  3060  	}
  3061  
  3062  	var errors []error
  3063  
  3064  	// no validation rules for DispatchCount
  3065  
  3066  	// no validation rules for DepthRequired
  3067  
  3068  	// no validation rules for CachedDispatchCount
  3069  
  3070  	if all {
  3071  		switch v := interface{}(m.GetDebugInfo()).(type) {
  3072  		case interface{ ValidateAll() error }:
  3073  			if err := v.ValidateAll(); err != nil {
  3074  				errors = append(errors, ResponseMetaValidationError{
  3075  					field:  "DebugInfo",
  3076  					reason: "embedded message failed validation",
  3077  					cause:  err,
  3078  				})
  3079  			}
  3080  		case interface{ Validate() error }:
  3081  			if err := v.Validate(); err != nil {
  3082  				errors = append(errors, ResponseMetaValidationError{
  3083  					field:  "DebugInfo",
  3084  					reason: "embedded message failed validation",
  3085  					cause:  err,
  3086  				})
  3087  			}
  3088  		}
  3089  	} else if v, ok := interface{}(m.GetDebugInfo()).(interface{ Validate() error }); ok {
  3090  		if err := v.Validate(); err != nil {
  3091  			return ResponseMetaValidationError{
  3092  				field:  "DebugInfo",
  3093  				reason: "embedded message failed validation",
  3094  				cause:  err,
  3095  			}
  3096  		}
  3097  	}
  3098  
  3099  	if len(errors) > 0 {
  3100  		return ResponseMetaMultiError(errors)
  3101  	}
  3102  
  3103  	return nil
  3104  }
  3105  
  3106  // ResponseMetaMultiError is an error wrapping multiple validation errors
  3107  // returned by ResponseMeta.ValidateAll() if the designated constraints aren't met.
  3108  type ResponseMetaMultiError []error
  3109  
  3110  // Error returns a concatenation of all the error messages it wraps.
  3111  func (m ResponseMetaMultiError) Error() string {
  3112  	var msgs []string
  3113  	for _, err := range m {
  3114  		msgs = append(msgs, err.Error())
  3115  	}
  3116  	return strings.Join(msgs, "; ")
  3117  }
  3118  
  3119  // AllErrors returns a list of validation violation errors.
  3120  func (m ResponseMetaMultiError) AllErrors() []error { return m }
  3121  
  3122  // ResponseMetaValidationError is the validation error returned by
  3123  // ResponseMeta.Validate if the designated constraints aren't met.
  3124  type ResponseMetaValidationError struct {
  3125  	field  string
  3126  	reason string
  3127  	cause  error
  3128  	key    bool
  3129  }
  3130  
  3131  // Field function returns field value.
  3132  func (e ResponseMetaValidationError) Field() string { return e.field }
  3133  
  3134  // Reason function returns reason value.
  3135  func (e ResponseMetaValidationError) Reason() string { return e.reason }
  3136  
  3137  // Cause function returns cause value.
  3138  func (e ResponseMetaValidationError) Cause() error { return e.cause }
  3139  
  3140  // Key function returns key value.
  3141  func (e ResponseMetaValidationError) Key() bool { return e.key }
  3142  
  3143  // ErrorName returns error name.
  3144  func (e ResponseMetaValidationError) ErrorName() string { return "ResponseMetaValidationError" }
  3145  
  3146  // Error satisfies the builtin error interface
  3147  func (e ResponseMetaValidationError) Error() string {
  3148  	cause := ""
  3149  	if e.cause != nil {
  3150  		cause = fmt.Sprintf(" | caused by: %v", e.cause)
  3151  	}
  3152  
  3153  	key := ""
  3154  	if e.key {
  3155  		key = "key for "
  3156  	}
  3157  
  3158  	return fmt.Sprintf(
  3159  		"invalid %sResponseMeta.%s: %s%s",
  3160  		key,
  3161  		e.field,
  3162  		e.reason,
  3163  		cause)
  3164  }
  3165  
  3166  var _ error = ResponseMetaValidationError{}
  3167  
  3168  var _ interface {
  3169  	Field() string
  3170  	Reason() string
  3171  	Key() bool
  3172  	Cause() error
  3173  	ErrorName() string
  3174  } = ResponseMetaValidationError{}
  3175  
  3176  // Validate checks the field values on DebugInformation with the rules defined
  3177  // in the proto definition for this message. If any rules are violated, the
  3178  // first error encountered is returned, or nil if there are no violations.
  3179  func (m *DebugInformation) Validate() error {
  3180  	return m.validate(false)
  3181  }
  3182  
  3183  // ValidateAll checks the field values on DebugInformation with the rules
  3184  // defined in the proto definition for this message. If any rules are
  3185  // violated, the result is a list of violation errors wrapped in
  3186  // DebugInformationMultiError, or nil if none found.
  3187  func (m *DebugInformation) ValidateAll() error {
  3188  	return m.validate(true)
  3189  }
  3190  
  3191  func (m *DebugInformation) validate(all bool) error {
  3192  	if m == nil {
  3193  		return nil
  3194  	}
  3195  
  3196  	var errors []error
  3197  
  3198  	if all {
  3199  		switch v := interface{}(m.GetCheck()).(type) {
  3200  		case interface{ ValidateAll() error }:
  3201  			if err := v.ValidateAll(); err != nil {
  3202  				errors = append(errors, DebugInformationValidationError{
  3203  					field:  "Check",
  3204  					reason: "embedded message failed validation",
  3205  					cause:  err,
  3206  				})
  3207  			}
  3208  		case interface{ Validate() error }:
  3209  			if err := v.Validate(); err != nil {
  3210  				errors = append(errors, DebugInformationValidationError{
  3211  					field:  "Check",
  3212  					reason: "embedded message failed validation",
  3213  					cause:  err,
  3214  				})
  3215  			}
  3216  		}
  3217  	} else if v, ok := interface{}(m.GetCheck()).(interface{ Validate() error }); ok {
  3218  		if err := v.Validate(); err != nil {
  3219  			return DebugInformationValidationError{
  3220  				field:  "Check",
  3221  				reason: "embedded message failed validation",
  3222  				cause:  err,
  3223  			}
  3224  		}
  3225  	}
  3226  
  3227  	if len(errors) > 0 {
  3228  		return DebugInformationMultiError(errors)
  3229  	}
  3230  
  3231  	return nil
  3232  }
  3233  
  3234  // DebugInformationMultiError is an error wrapping multiple validation errors
  3235  // returned by DebugInformation.ValidateAll() if the designated constraints
  3236  // aren't met.
  3237  type DebugInformationMultiError []error
  3238  
  3239  // Error returns a concatenation of all the error messages it wraps.
  3240  func (m DebugInformationMultiError) Error() string {
  3241  	var msgs []string
  3242  	for _, err := range m {
  3243  		msgs = append(msgs, err.Error())
  3244  	}
  3245  	return strings.Join(msgs, "; ")
  3246  }
  3247  
  3248  // AllErrors returns a list of validation violation errors.
  3249  func (m DebugInformationMultiError) AllErrors() []error { return m }
  3250  
  3251  // DebugInformationValidationError is the validation error returned by
  3252  // DebugInformation.Validate if the designated constraints aren't met.
  3253  type DebugInformationValidationError struct {
  3254  	field  string
  3255  	reason string
  3256  	cause  error
  3257  	key    bool
  3258  }
  3259  
  3260  // Field function returns field value.
  3261  func (e DebugInformationValidationError) Field() string { return e.field }
  3262  
  3263  // Reason function returns reason value.
  3264  func (e DebugInformationValidationError) Reason() string { return e.reason }
  3265  
  3266  // Cause function returns cause value.
  3267  func (e DebugInformationValidationError) Cause() error { return e.cause }
  3268  
  3269  // Key function returns key value.
  3270  func (e DebugInformationValidationError) Key() bool { return e.key }
  3271  
  3272  // ErrorName returns error name.
  3273  func (e DebugInformationValidationError) ErrorName() string { return "DebugInformationValidationError" }
  3274  
  3275  // Error satisfies the builtin error interface
  3276  func (e DebugInformationValidationError) Error() string {
  3277  	cause := ""
  3278  	if e.cause != nil {
  3279  		cause = fmt.Sprintf(" | caused by: %v", e.cause)
  3280  	}
  3281  
  3282  	key := ""
  3283  	if e.key {
  3284  		key = "key for "
  3285  	}
  3286  
  3287  	return fmt.Sprintf(
  3288  		"invalid %sDebugInformation.%s: %s%s",
  3289  		key,
  3290  		e.field,
  3291  		e.reason,
  3292  		cause)
  3293  }
  3294  
  3295  var _ error = DebugInformationValidationError{}
  3296  
  3297  var _ interface {
  3298  	Field() string
  3299  	Reason() string
  3300  	Key() bool
  3301  	Cause() error
  3302  	ErrorName() string
  3303  } = DebugInformationValidationError{}
  3304  
  3305  // Validate checks the field values on CheckDebugTrace with the rules defined
  3306  // in the proto definition for this message. If any rules are violated, the
  3307  // first error encountered is returned, or nil if there are no violations.
  3308  func (m *CheckDebugTrace) Validate() error {
  3309  	return m.validate(false)
  3310  }
  3311  
  3312  // ValidateAll checks the field values on CheckDebugTrace with the rules
  3313  // defined in the proto definition for this message. If any rules are
  3314  // violated, the result is a list of violation errors wrapped in
  3315  // CheckDebugTraceMultiError, or nil if none found.
  3316  func (m *CheckDebugTrace) ValidateAll() error {
  3317  	return m.validate(true)
  3318  }
  3319  
  3320  func (m *CheckDebugTrace) validate(all bool) error {
  3321  	if m == nil {
  3322  		return nil
  3323  	}
  3324  
  3325  	var errors []error
  3326  
  3327  	if all {
  3328  		switch v := interface{}(m.GetRequest()).(type) {
  3329  		case interface{ ValidateAll() error }:
  3330  			if err := v.ValidateAll(); err != nil {
  3331  				errors = append(errors, CheckDebugTraceValidationError{
  3332  					field:  "Request",
  3333  					reason: "embedded message failed validation",
  3334  					cause:  err,
  3335  				})
  3336  			}
  3337  		case interface{ Validate() error }:
  3338  			if err := v.Validate(); err != nil {
  3339  				errors = append(errors, CheckDebugTraceValidationError{
  3340  					field:  "Request",
  3341  					reason: "embedded message failed validation",
  3342  					cause:  err,
  3343  				})
  3344  			}
  3345  		}
  3346  	} else if v, ok := interface{}(m.GetRequest()).(interface{ Validate() error }); ok {
  3347  		if err := v.Validate(); err != nil {
  3348  			return CheckDebugTraceValidationError{
  3349  				field:  "Request",
  3350  				reason: "embedded message failed validation",
  3351  				cause:  err,
  3352  			}
  3353  		}
  3354  	}
  3355  
  3356  	// no validation rules for ResourceRelationType
  3357  
  3358  	{
  3359  		sorted_keys := make([]string, len(m.GetResults()))
  3360  		i := 0
  3361  		for key := range m.GetResults() {
  3362  			sorted_keys[i] = key
  3363  			i++
  3364  		}
  3365  		sort.Slice(sorted_keys, func(i, j int) bool { return sorted_keys[i] < sorted_keys[j] })
  3366  		for _, key := range sorted_keys {
  3367  			val := m.GetResults()[key]
  3368  			_ = val
  3369  
  3370  			// no validation rules for Results[key]
  3371  
  3372  			if all {
  3373  				switch v := interface{}(val).(type) {
  3374  				case interface{ ValidateAll() error }:
  3375  					if err := v.ValidateAll(); err != nil {
  3376  						errors = append(errors, CheckDebugTraceValidationError{
  3377  							field:  fmt.Sprintf("Results[%v]", key),
  3378  							reason: "embedded message failed validation",
  3379  							cause:  err,
  3380  						})
  3381  					}
  3382  				case interface{ Validate() error }:
  3383  					if err := v.Validate(); err != nil {
  3384  						errors = append(errors, CheckDebugTraceValidationError{
  3385  							field:  fmt.Sprintf("Results[%v]", key),
  3386  							reason: "embedded message failed validation",
  3387  							cause:  err,
  3388  						})
  3389  					}
  3390  				}
  3391  			} else if v, ok := interface{}(val).(interface{ Validate() error }); ok {
  3392  				if err := v.Validate(); err != nil {
  3393  					return CheckDebugTraceValidationError{
  3394  						field:  fmt.Sprintf("Results[%v]", key),
  3395  						reason: "embedded message failed validation",
  3396  						cause:  err,
  3397  					}
  3398  				}
  3399  			}
  3400  
  3401  		}
  3402  	}
  3403  
  3404  	// no validation rules for IsCachedResult
  3405  
  3406  	for idx, item := range m.GetSubProblems() {
  3407  		_, _ = idx, item
  3408  
  3409  		if all {
  3410  			switch v := interface{}(item).(type) {
  3411  			case interface{ ValidateAll() error }:
  3412  				if err := v.ValidateAll(); err != nil {
  3413  					errors = append(errors, CheckDebugTraceValidationError{
  3414  						field:  fmt.Sprintf("SubProblems[%v]", idx),
  3415  						reason: "embedded message failed validation",
  3416  						cause:  err,
  3417  					})
  3418  				}
  3419  			case interface{ Validate() error }:
  3420  				if err := v.Validate(); err != nil {
  3421  					errors = append(errors, CheckDebugTraceValidationError{
  3422  						field:  fmt.Sprintf("SubProblems[%v]", idx),
  3423  						reason: "embedded message failed validation",
  3424  						cause:  err,
  3425  					})
  3426  				}
  3427  			}
  3428  		} else if v, ok := interface{}(item).(interface{ Validate() error }); ok {
  3429  			if err := v.Validate(); err != nil {
  3430  				return CheckDebugTraceValidationError{
  3431  					field:  fmt.Sprintf("SubProblems[%v]", idx),
  3432  					reason: "embedded message failed validation",
  3433  					cause:  err,
  3434  				}
  3435  			}
  3436  		}
  3437  
  3438  	}
  3439  
  3440  	if all {
  3441  		switch v := interface{}(m.GetDuration()).(type) {
  3442  		case interface{ ValidateAll() error }:
  3443  			if err := v.ValidateAll(); err != nil {
  3444  				errors = append(errors, CheckDebugTraceValidationError{
  3445  					field:  "Duration",
  3446  					reason: "embedded message failed validation",
  3447  					cause:  err,
  3448  				})
  3449  			}
  3450  		case interface{ Validate() error }:
  3451  			if err := v.Validate(); err != nil {
  3452  				errors = append(errors, CheckDebugTraceValidationError{
  3453  					field:  "Duration",
  3454  					reason: "embedded message failed validation",
  3455  					cause:  err,
  3456  				})
  3457  			}
  3458  		}
  3459  	} else if v, ok := interface{}(m.GetDuration()).(interface{ Validate() error }); ok {
  3460  		if err := v.Validate(); err != nil {
  3461  			return CheckDebugTraceValidationError{
  3462  				field:  "Duration",
  3463  				reason: "embedded message failed validation",
  3464  				cause:  err,
  3465  			}
  3466  		}
  3467  	}
  3468  
  3469  	if len(errors) > 0 {
  3470  		return CheckDebugTraceMultiError(errors)
  3471  	}
  3472  
  3473  	return nil
  3474  }
  3475  
  3476  // CheckDebugTraceMultiError is an error wrapping multiple validation errors
  3477  // returned by CheckDebugTrace.ValidateAll() if the designated constraints
  3478  // aren't met.
  3479  type CheckDebugTraceMultiError []error
  3480  
  3481  // Error returns a concatenation of all the error messages it wraps.
  3482  func (m CheckDebugTraceMultiError) Error() string {
  3483  	var msgs []string
  3484  	for _, err := range m {
  3485  		msgs = append(msgs, err.Error())
  3486  	}
  3487  	return strings.Join(msgs, "; ")
  3488  }
  3489  
  3490  // AllErrors returns a list of validation violation errors.
  3491  func (m CheckDebugTraceMultiError) AllErrors() []error { return m }
  3492  
  3493  // CheckDebugTraceValidationError is the validation error returned by
  3494  // CheckDebugTrace.Validate if the designated constraints aren't met.
  3495  type CheckDebugTraceValidationError struct {
  3496  	field  string
  3497  	reason string
  3498  	cause  error
  3499  	key    bool
  3500  }
  3501  
  3502  // Field function returns field value.
  3503  func (e CheckDebugTraceValidationError) Field() string { return e.field }
  3504  
  3505  // Reason function returns reason value.
  3506  func (e CheckDebugTraceValidationError) Reason() string { return e.reason }
  3507  
  3508  // Cause function returns cause value.
  3509  func (e CheckDebugTraceValidationError) Cause() error { return e.cause }
  3510  
  3511  // Key function returns key value.
  3512  func (e CheckDebugTraceValidationError) Key() bool { return e.key }
  3513  
  3514  // ErrorName returns error name.
  3515  func (e CheckDebugTraceValidationError) ErrorName() string { return "CheckDebugTraceValidationError" }
  3516  
  3517  // Error satisfies the builtin error interface
  3518  func (e CheckDebugTraceValidationError) Error() string {
  3519  	cause := ""
  3520  	if e.cause != nil {
  3521  		cause = fmt.Sprintf(" | caused by: %v", e.cause)
  3522  	}
  3523  
  3524  	key := ""
  3525  	if e.key {
  3526  		key = "key for "
  3527  	}
  3528  
  3529  	return fmt.Sprintf(
  3530  		"invalid %sCheckDebugTrace.%s: %s%s",
  3531  		key,
  3532  		e.field,
  3533  		e.reason,
  3534  		cause)
  3535  }
  3536  
  3537  var _ error = CheckDebugTraceValidationError{}
  3538  
  3539  var _ interface {
  3540  	Field() string
  3541  	Reason() string
  3542  	Key() bool
  3543  	Cause() error
  3544  	ErrorName() string
  3545  } = CheckDebugTraceValidationError{}