github.com/hxx258456/ccgo@v0.0.5-0.20230213014102-48b35f46f66f/go-control-plane/envoy/extensions/transport_sockets/tls/v3/tls.pb.validate.go (about)

     1  // Code generated by protoc-gen-validate. DO NOT EDIT.
     2  // source: envoy/extensions/transport_sockets/tls/v3/tls.proto
     3  
     4  package envoy_extensions_transport_sockets_tls_v3
     5  
     6  import (
     7  	"bytes"
     8  	"errors"
     9  	"fmt"
    10  	"net"
    11  	"net/mail"
    12  	"net/url"
    13  	"regexp"
    14  	"strings"
    15  	"time"
    16  	"unicode/utf8"
    17  
    18  	"google.golang.org/protobuf/types/known/anypb"
    19  )
    20  
    21  // ensure the imports are used
    22  var (
    23  	_ = bytes.MinRead
    24  	_ = errors.New("")
    25  	_ = fmt.Print
    26  	_ = utf8.UTFMax
    27  	_ = (*regexp.Regexp)(nil)
    28  	_ = (*strings.Reader)(nil)
    29  	_ = net.IPv4len
    30  	_ = time.Duration(0)
    31  	_ = (*url.URL)(nil)
    32  	_ = (*mail.Address)(nil)
    33  	_ = anypb.Any{}
    34  )
    35  
    36  // Validate checks the field values on UpstreamTlsContext with the rules
    37  // defined in the proto definition for this message. If any rules are
    38  // violated, an error is returned.
    39  func (m *UpstreamTlsContext) Validate() error {
    40  	if m == nil {
    41  		return nil
    42  	}
    43  
    44  	if v, ok := interface{}(m.GetCommonTlsContext()).(interface{ Validate() error }); ok {
    45  		if err := v.Validate(); err != nil {
    46  			return UpstreamTlsContextValidationError{
    47  				field:  "CommonTlsContext",
    48  				reason: "embedded message failed validation",
    49  				cause:  err,
    50  			}
    51  		}
    52  	}
    53  
    54  	if len(m.GetSni()) > 255 {
    55  		return UpstreamTlsContextValidationError{
    56  			field:  "Sni",
    57  			reason: "value length must be at most 255 bytes",
    58  		}
    59  	}
    60  
    61  	// no validation rules for AllowRenegotiation
    62  
    63  	if v, ok := interface{}(m.GetMaxSessionKeys()).(interface{ Validate() error }); ok {
    64  		if err := v.Validate(); err != nil {
    65  			return UpstreamTlsContextValidationError{
    66  				field:  "MaxSessionKeys",
    67  				reason: "embedded message failed validation",
    68  				cause:  err,
    69  			}
    70  		}
    71  	}
    72  
    73  	return nil
    74  }
    75  
    76  // UpstreamTlsContextValidationError is the validation error returned by
    77  // UpstreamTlsContext.Validate if the designated constraints aren't met.
    78  type UpstreamTlsContextValidationError struct {
    79  	field  string
    80  	reason string
    81  	cause  error
    82  	key    bool
    83  }
    84  
    85  // Field function returns field value.
    86  func (e UpstreamTlsContextValidationError) Field() string { return e.field }
    87  
    88  // Reason function returns reason value.
    89  func (e UpstreamTlsContextValidationError) Reason() string { return e.reason }
    90  
    91  // Cause function returns cause value.
    92  func (e UpstreamTlsContextValidationError) Cause() error { return e.cause }
    93  
    94  // Key function returns key value.
    95  func (e UpstreamTlsContextValidationError) Key() bool { return e.key }
    96  
    97  // ErrorName returns error name.
    98  func (e UpstreamTlsContextValidationError) ErrorName() string {
    99  	return "UpstreamTlsContextValidationError"
   100  }
   101  
   102  // Error satisfies the builtin error interface
   103  func (e UpstreamTlsContextValidationError) Error() string {
   104  	cause := ""
   105  	if e.cause != nil {
   106  		cause = fmt.Sprintf(" | caused by: %v", e.cause)
   107  	}
   108  
   109  	key := ""
   110  	if e.key {
   111  		key = "key for "
   112  	}
   113  
   114  	return fmt.Sprintf(
   115  		"invalid %sUpstreamTlsContext.%s: %s%s",
   116  		key,
   117  		e.field,
   118  		e.reason,
   119  		cause)
   120  }
   121  
   122  var _ error = UpstreamTlsContextValidationError{}
   123  
   124  var _ interface {
   125  	Field() string
   126  	Reason() string
   127  	Key() bool
   128  	Cause() error
   129  	ErrorName() string
   130  } = UpstreamTlsContextValidationError{}
   131  
   132  // Validate checks the field values on DownstreamTlsContext with the rules
   133  // defined in the proto definition for this message. If any rules are
   134  // violated, an error is returned.
   135  func (m *DownstreamTlsContext) Validate() error {
   136  	if m == nil {
   137  		return nil
   138  	}
   139  
   140  	if v, ok := interface{}(m.GetCommonTlsContext()).(interface{ Validate() error }); ok {
   141  		if err := v.Validate(); err != nil {
   142  			return DownstreamTlsContextValidationError{
   143  				field:  "CommonTlsContext",
   144  				reason: "embedded message failed validation",
   145  				cause:  err,
   146  			}
   147  		}
   148  	}
   149  
   150  	if v, ok := interface{}(m.GetRequireClientCertificate()).(interface{ Validate() error }); ok {
   151  		if err := v.Validate(); err != nil {
   152  			return DownstreamTlsContextValidationError{
   153  				field:  "RequireClientCertificate",
   154  				reason: "embedded message failed validation",
   155  				cause:  err,
   156  			}
   157  		}
   158  	}
   159  
   160  	if v, ok := interface{}(m.GetRequireSni()).(interface{ Validate() error }); ok {
   161  		if err := v.Validate(); err != nil {
   162  			return DownstreamTlsContextValidationError{
   163  				field:  "RequireSni",
   164  				reason: "embedded message failed validation",
   165  				cause:  err,
   166  			}
   167  		}
   168  	}
   169  
   170  	if d := m.GetSessionTimeout(); d != nil {
   171  		dur, err := d.AsDuration(), d.CheckValid()
   172  		if err != nil {
   173  			return DownstreamTlsContextValidationError{
   174  				field:  "SessionTimeout",
   175  				reason: "value is not a valid duration",
   176  				cause:  err,
   177  			}
   178  		}
   179  
   180  		lt := time.Duration(4294967296*time.Second + 0*time.Nanosecond)
   181  		gte := time.Duration(0*time.Second + 0*time.Nanosecond)
   182  
   183  		if dur < gte || dur >= lt {
   184  			return DownstreamTlsContextValidationError{
   185  				field:  "SessionTimeout",
   186  				reason: "value must be inside range [0s, 1193046h28m16s)",
   187  			}
   188  		}
   189  
   190  	}
   191  
   192  	if _, ok := DownstreamTlsContext_OcspStaplePolicy_name[int32(m.GetOcspStaplePolicy())]; !ok {
   193  		return DownstreamTlsContextValidationError{
   194  			field:  "OcspStaplePolicy",
   195  			reason: "value must be one of the defined enum values",
   196  		}
   197  	}
   198  
   199  	switch m.SessionTicketKeysType.(type) {
   200  
   201  	case *DownstreamTlsContext_SessionTicketKeys:
   202  
   203  		if v, ok := interface{}(m.GetSessionTicketKeys()).(interface{ Validate() error }); ok {
   204  			if err := v.Validate(); err != nil {
   205  				return DownstreamTlsContextValidationError{
   206  					field:  "SessionTicketKeys",
   207  					reason: "embedded message failed validation",
   208  					cause:  err,
   209  				}
   210  			}
   211  		}
   212  
   213  	case *DownstreamTlsContext_SessionTicketKeysSdsSecretConfig:
   214  
   215  		if v, ok := interface{}(m.GetSessionTicketKeysSdsSecretConfig()).(interface{ Validate() error }); ok {
   216  			if err := v.Validate(); err != nil {
   217  				return DownstreamTlsContextValidationError{
   218  					field:  "SessionTicketKeysSdsSecretConfig",
   219  					reason: "embedded message failed validation",
   220  					cause:  err,
   221  				}
   222  			}
   223  		}
   224  
   225  	case *DownstreamTlsContext_DisableStatelessSessionResumption:
   226  		// no validation rules for DisableStatelessSessionResumption
   227  
   228  	}
   229  
   230  	return nil
   231  }
   232  
   233  // DownstreamTlsContextValidationError is the validation error returned by
   234  // DownstreamTlsContext.Validate if the designated constraints aren't met.
   235  type DownstreamTlsContextValidationError struct {
   236  	field  string
   237  	reason string
   238  	cause  error
   239  	key    bool
   240  }
   241  
   242  // Field function returns field value.
   243  func (e DownstreamTlsContextValidationError) Field() string { return e.field }
   244  
   245  // Reason function returns reason value.
   246  func (e DownstreamTlsContextValidationError) Reason() string { return e.reason }
   247  
   248  // Cause function returns cause value.
   249  func (e DownstreamTlsContextValidationError) Cause() error { return e.cause }
   250  
   251  // Key function returns key value.
   252  func (e DownstreamTlsContextValidationError) Key() bool { return e.key }
   253  
   254  // ErrorName returns error name.
   255  func (e DownstreamTlsContextValidationError) ErrorName() string {
   256  	return "DownstreamTlsContextValidationError"
   257  }
   258  
   259  // Error satisfies the builtin error interface
   260  func (e DownstreamTlsContextValidationError) Error() string {
   261  	cause := ""
   262  	if e.cause != nil {
   263  		cause = fmt.Sprintf(" | caused by: %v", e.cause)
   264  	}
   265  
   266  	key := ""
   267  	if e.key {
   268  		key = "key for "
   269  	}
   270  
   271  	return fmt.Sprintf(
   272  		"invalid %sDownstreamTlsContext.%s: %s%s",
   273  		key,
   274  		e.field,
   275  		e.reason,
   276  		cause)
   277  }
   278  
   279  var _ error = DownstreamTlsContextValidationError{}
   280  
   281  var _ interface {
   282  	Field() string
   283  	Reason() string
   284  	Key() bool
   285  	Cause() error
   286  	ErrorName() string
   287  } = DownstreamTlsContextValidationError{}
   288  
   289  // Validate checks the field values on CommonTlsContext with the rules defined
   290  // in the proto definition for this message. If any rules are violated, an
   291  // error is returned.
   292  func (m *CommonTlsContext) Validate() error {
   293  	if m == nil {
   294  		return nil
   295  	}
   296  
   297  	if v, ok := interface{}(m.GetTlsParams()).(interface{ Validate() error }); ok {
   298  		if err := v.Validate(); err != nil {
   299  			return CommonTlsContextValidationError{
   300  				field:  "TlsParams",
   301  				reason: "embedded message failed validation",
   302  				cause:  err,
   303  			}
   304  		}
   305  	}
   306  
   307  	for idx, item := range m.GetTlsCertificates() {
   308  		_, _ = idx, item
   309  
   310  		if v, ok := interface{}(item).(interface{ Validate() error }); ok {
   311  			if err := v.Validate(); err != nil {
   312  				return CommonTlsContextValidationError{
   313  					field:  fmt.Sprintf("TlsCertificates[%v]", idx),
   314  					reason: "embedded message failed validation",
   315  					cause:  err,
   316  				}
   317  			}
   318  		}
   319  
   320  	}
   321  
   322  	if len(m.GetTlsCertificateSdsSecretConfigs()) > 2 {
   323  		return CommonTlsContextValidationError{
   324  			field:  "TlsCertificateSdsSecretConfigs",
   325  			reason: "value must contain no more than 2 item(s)",
   326  		}
   327  	}
   328  
   329  	for idx, item := range m.GetTlsCertificateSdsSecretConfigs() {
   330  		_, _ = idx, item
   331  
   332  		if v, ok := interface{}(item).(interface{ Validate() error }); ok {
   333  			if err := v.Validate(); err != nil {
   334  				return CommonTlsContextValidationError{
   335  					field:  fmt.Sprintf("TlsCertificateSdsSecretConfigs[%v]", idx),
   336  					reason: "embedded message failed validation",
   337  					cause:  err,
   338  				}
   339  			}
   340  		}
   341  
   342  	}
   343  
   344  	if v, ok := interface{}(m.GetTlsCertificateProviderInstance()).(interface{ Validate() error }); ok {
   345  		if err := v.Validate(); err != nil {
   346  			return CommonTlsContextValidationError{
   347  				field:  "TlsCertificateProviderInstance",
   348  				reason: "embedded message failed validation",
   349  				cause:  err,
   350  			}
   351  		}
   352  	}
   353  
   354  	if v, ok := interface{}(m.GetTlsCertificateCertificateProvider()).(interface{ Validate() error }); ok {
   355  		if err := v.Validate(); err != nil {
   356  			return CommonTlsContextValidationError{
   357  				field:  "TlsCertificateCertificateProvider",
   358  				reason: "embedded message failed validation",
   359  				cause:  err,
   360  			}
   361  		}
   362  	}
   363  
   364  	if v, ok := interface{}(m.GetTlsCertificateCertificateProviderInstance()).(interface{ Validate() error }); ok {
   365  		if err := v.Validate(); err != nil {
   366  			return CommonTlsContextValidationError{
   367  				field:  "TlsCertificateCertificateProviderInstance",
   368  				reason: "embedded message failed validation",
   369  				cause:  err,
   370  			}
   371  		}
   372  	}
   373  
   374  	if v, ok := interface{}(m.GetCustomHandshaker()).(interface{ Validate() error }); ok {
   375  		if err := v.Validate(); err != nil {
   376  			return CommonTlsContextValidationError{
   377  				field:  "CustomHandshaker",
   378  				reason: "embedded message failed validation",
   379  				cause:  err,
   380  			}
   381  		}
   382  	}
   383  
   384  	switch m.ValidationContextType.(type) {
   385  
   386  	case *CommonTlsContext_ValidationContext:
   387  
   388  		if v, ok := interface{}(m.GetValidationContext()).(interface{ Validate() error }); ok {
   389  			if err := v.Validate(); err != nil {
   390  				return CommonTlsContextValidationError{
   391  					field:  "ValidationContext",
   392  					reason: "embedded message failed validation",
   393  					cause:  err,
   394  				}
   395  			}
   396  		}
   397  
   398  	case *CommonTlsContext_ValidationContextSdsSecretConfig:
   399  
   400  		if v, ok := interface{}(m.GetValidationContextSdsSecretConfig()).(interface{ Validate() error }); ok {
   401  			if err := v.Validate(); err != nil {
   402  				return CommonTlsContextValidationError{
   403  					field:  "ValidationContextSdsSecretConfig",
   404  					reason: "embedded message failed validation",
   405  					cause:  err,
   406  				}
   407  			}
   408  		}
   409  
   410  	case *CommonTlsContext_CombinedValidationContext:
   411  
   412  		if v, ok := interface{}(m.GetCombinedValidationContext()).(interface{ Validate() error }); ok {
   413  			if err := v.Validate(); err != nil {
   414  				return CommonTlsContextValidationError{
   415  					field:  "CombinedValidationContext",
   416  					reason: "embedded message failed validation",
   417  					cause:  err,
   418  				}
   419  			}
   420  		}
   421  
   422  	case *CommonTlsContext_ValidationContextCertificateProvider:
   423  
   424  		if v, ok := interface{}(m.GetValidationContextCertificateProvider()).(interface{ Validate() error }); ok {
   425  			if err := v.Validate(); err != nil {
   426  				return CommonTlsContextValidationError{
   427  					field:  "ValidationContextCertificateProvider",
   428  					reason: "embedded message failed validation",
   429  					cause:  err,
   430  				}
   431  			}
   432  		}
   433  
   434  	case *CommonTlsContext_ValidationContextCertificateProviderInstance:
   435  
   436  		if v, ok := interface{}(m.GetValidationContextCertificateProviderInstance()).(interface{ Validate() error }); ok {
   437  			if err := v.Validate(); err != nil {
   438  				return CommonTlsContextValidationError{
   439  					field:  "ValidationContextCertificateProviderInstance",
   440  					reason: "embedded message failed validation",
   441  					cause:  err,
   442  				}
   443  			}
   444  		}
   445  
   446  	}
   447  
   448  	return nil
   449  }
   450  
   451  // CommonTlsContextValidationError is the validation error returned by
   452  // CommonTlsContext.Validate if the designated constraints aren't met.
   453  type CommonTlsContextValidationError struct {
   454  	field  string
   455  	reason string
   456  	cause  error
   457  	key    bool
   458  }
   459  
   460  // Field function returns field value.
   461  func (e CommonTlsContextValidationError) Field() string { return e.field }
   462  
   463  // Reason function returns reason value.
   464  func (e CommonTlsContextValidationError) Reason() string { return e.reason }
   465  
   466  // Cause function returns cause value.
   467  func (e CommonTlsContextValidationError) Cause() error { return e.cause }
   468  
   469  // Key function returns key value.
   470  func (e CommonTlsContextValidationError) Key() bool { return e.key }
   471  
   472  // ErrorName returns error name.
   473  func (e CommonTlsContextValidationError) ErrorName() string { return "CommonTlsContextValidationError" }
   474  
   475  // Error satisfies the builtin error interface
   476  func (e CommonTlsContextValidationError) Error() string {
   477  	cause := ""
   478  	if e.cause != nil {
   479  		cause = fmt.Sprintf(" | caused by: %v", e.cause)
   480  	}
   481  
   482  	key := ""
   483  	if e.key {
   484  		key = "key for "
   485  	}
   486  
   487  	return fmt.Sprintf(
   488  		"invalid %sCommonTlsContext.%s: %s%s",
   489  		key,
   490  		e.field,
   491  		e.reason,
   492  		cause)
   493  }
   494  
   495  var _ error = CommonTlsContextValidationError{}
   496  
   497  var _ interface {
   498  	Field() string
   499  	Reason() string
   500  	Key() bool
   501  	Cause() error
   502  	ErrorName() string
   503  } = CommonTlsContextValidationError{}
   504  
   505  // Validate checks the field values on CommonTlsContext_CertificateProvider
   506  // with the rules defined in the proto definition for this message. If any
   507  // rules are violated, an error is returned.
   508  func (m *CommonTlsContext_CertificateProvider) Validate() error {
   509  	if m == nil {
   510  		return nil
   511  	}
   512  
   513  	if utf8.RuneCountInString(m.GetName()) < 1 {
   514  		return CommonTlsContext_CertificateProviderValidationError{
   515  			field:  "Name",
   516  			reason: "value length must be at least 1 runes",
   517  		}
   518  	}
   519  
   520  	switch m.Config.(type) {
   521  
   522  	case *CommonTlsContext_CertificateProvider_TypedConfig:
   523  
   524  		if v, ok := interface{}(m.GetTypedConfig()).(interface{ Validate() error }); ok {
   525  			if err := v.Validate(); err != nil {
   526  				return CommonTlsContext_CertificateProviderValidationError{
   527  					field:  "TypedConfig",
   528  					reason: "embedded message failed validation",
   529  					cause:  err,
   530  				}
   531  			}
   532  		}
   533  
   534  	default:
   535  		return CommonTlsContext_CertificateProviderValidationError{
   536  			field:  "Config",
   537  			reason: "value is required",
   538  		}
   539  
   540  	}
   541  
   542  	return nil
   543  }
   544  
   545  // CommonTlsContext_CertificateProviderValidationError is the validation error
   546  // returned by CommonTlsContext_CertificateProvider.Validate if the designated
   547  // constraints aren't met.
   548  type CommonTlsContext_CertificateProviderValidationError struct {
   549  	field  string
   550  	reason string
   551  	cause  error
   552  	key    bool
   553  }
   554  
   555  // Field function returns field value.
   556  func (e CommonTlsContext_CertificateProviderValidationError) Field() string { return e.field }
   557  
   558  // Reason function returns reason value.
   559  func (e CommonTlsContext_CertificateProviderValidationError) Reason() string { return e.reason }
   560  
   561  // Cause function returns cause value.
   562  func (e CommonTlsContext_CertificateProviderValidationError) Cause() error { return e.cause }
   563  
   564  // Key function returns key value.
   565  func (e CommonTlsContext_CertificateProviderValidationError) Key() bool { return e.key }
   566  
   567  // ErrorName returns error name.
   568  func (e CommonTlsContext_CertificateProviderValidationError) ErrorName() string {
   569  	return "CommonTlsContext_CertificateProviderValidationError"
   570  }
   571  
   572  // Error satisfies the builtin error interface
   573  func (e CommonTlsContext_CertificateProviderValidationError) Error() string {
   574  	cause := ""
   575  	if e.cause != nil {
   576  		cause = fmt.Sprintf(" | caused by: %v", e.cause)
   577  	}
   578  
   579  	key := ""
   580  	if e.key {
   581  		key = "key for "
   582  	}
   583  
   584  	return fmt.Sprintf(
   585  		"invalid %sCommonTlsContext_CertificateProvider.%s: %s%s",
   586  		key,
   587  		e.field,
   588  		e.reason,
   589  		cause)
   590  }
   591  
   592  var _ error = CommonTlsContext_CertificateProviderValidationError{}
   593  
   594  var _ interface {
   595  	Field() string
   596  	Reason() string
   597  	Key() bool
   598  	Cause() error
   599  	ErrorName() string
   600  } = CommonTlsContext_CertificateProviderValidationError{}
   601  
   602  // Validate checks the field values on
   603  // CommonTlsContext_CertificateProviderInstance with the rules defined in the
   604  // proto definition for this message. If any rules are violated, an error is returned.
   605  func (m *CommonTlsContext_CertificateProviderInstance) Validate() error {
   606  	if m == nil {
   607  		return nil
   608  	}
   609  
   610  	// no validation rules for InstanceName
   611  
   612  	// no validation rules for CertificateName
   613  
   614  	return nil
   615  }
   616  
   617  // CommonTlsContext_CertificateProviderInstanceValidationError is the
   618  // validation error returned by
   619  // CommonTlsContext_CertificateProviderInstance.Validate if the designated
   620  // constraints aren't met.
   621  type CommonTlsContext_CertificateProviderInstanceValidationError struct {
   622  	field  string
   623  	reason string
   624  	cause  error
   625  	key    bool
   626  }
   627  
   628  // Field function returns field value.
   629  func (e CommonTlsContext_CertificateProviderInstanceValidationError) Field() string { return e.field }
   630  
   631  // Reason function returns reason value.
   632  func (e CommonTlsContext_CertificateProviderInstanceValidationError) Reason() string { return e.reason }
   633  
   634  // Cause function returns cause value.
   635  func (e CommonTlsContext_CertificateProviderInstanceValidationError) Cause() error { return e.cause }
   636  
   637  // Key function returns key value.
   638  func (e CommonTlsContext_CertificateProviderInstanceValidationError) Key() bool { return e.key }
   639  
   640  // ErrorName returns error name.
   641  func (e CommonTlsContext_CertificateProviderInstanceValidationError) ErrorName() string {
   642  	return "CommonTlsContext_CertificateProviderInstanceValidationError"
   643  }
   644  
   645  // Error satisfies the builtin error interface
   646  func (e CommonTlsContext_CertificateProviderInstanceValidationError) Error() string {
   647  	cause := ""
   648  	if e.cause != nil {
   649  		cause = fmt.Sprintf(" | caused by: %v", e.cause)
   650  	}
   651  
   652  	key := ""
   653  	if e.key {
   654  		key = "key for "
   655  	}
   656  
   657  	return fmt.Sprintf(
   658  		"invalid %sCommonTlsContext_CertificateProviderInstance.%s: %s%s",
   659  		key,
   660  		e.field,
   661  		e.reason,
   662  		cause)
   663  }
   664  
   665  var _ error = CommonTlsContext_CertificateProviderInstanceValidationError{}
   666  
   667  var _ interface {
   668  	Field() string
   669  	Reason() string
   670  	Key() bool
   671  	Cause() error
   672  	ErrorName() string
   673  } = CommonTlsContext_CertificateProviderInstanceValidationError{}
   674  
   675  // Validate checks the field values on
   676  // CommonTlsContext_CombinedCertificateValidationContext with the rules
   677  // defined in the proto definition for this message. If any rules are
   678  // violated, an error is returned.
   679  func (m *CommonTlsContext_CombinedCertificateValidationContext) Validate() error {
   680  	if m == nil {
   681  		return nil
   682  	}
   683  
   684  	if m.GetDefaultValidationContext() == nil {
   685  		return CommonTlsContext_CombinedCertificateValidationContextValidationError{
   686  			field:  "DefaultValidationContext",
   687  			reason: "value is required",
   688  		}
   689  	}
   690  
   691  	if v, ok := interface{}(m.GetDefaultValidationContext()).(interface{ Validate() error }); ok {
   692  		if err := v.Validate(); err != nil {
   693  			return CommonTlsContext_CombinedCertificateValidationContextValidationError{
   694  				field:  "DefaultValidationContext",
   695  				reason: "embedded message failed validation",
   696  				cause:  err,
   697  			}
   698  		}
   699  	}
   700  
   701  	if m.GetValidationContextSdsSecretConfig() == nil {
   702  		return CommonTlsContext_CombinedCertificateValidationContextValidationError{
   703  			field:  "ValidationContextSdsSecretConfig",
   704  			reason: "value is required",
   705  		}
   706  	}
   707  
   708  	if v, ok := interface{}(m.GetValidationContextSdsSecretConfig()).(interface{ Validate() error }); ok {
   709  		if err := v.Validate(); err != nil {
   710  			return CommonTlsContext_CombinedCertificateValidationContextValidationError{
   711  				field:  "ValidationContextSdsSecretConfig",
   712  				reason: "embedded message failed validation",
   713  				cause:  err,
   714  			}
   715  		}
   716  	}
   717  
   718  	if v, ok := interface{}(m.GetValidationContextCertificateProvider()).(interface{ Validate() error }); ok {
   719  		if err := v.Validate(); err != nil {
   720  			return CommonTlsContext_CombinedCertificateValidationContextValidationError{
   721  				field:  "ValidationContextCertificateProvider",
   722  				reason: "embedded message failed validation",
   723  				cause:  err,
   724  			}
   725  		}
   726  	}
   727  
   728  	if v, ok := interface{}(m.GetValidationContextCertificateProviderInstance()).(interface{ Validate() error }); ok {
   729  		if err := v.Validate(); err != nil {
   730  			return CommonTlsContext_CombinedCertificateValidationContextValidationError{
   731  				field:  "ValidationContextCertificateProviderInstance",
   732  				reason: "embedded message failed validation",
   733  				cause:  err,
   734  			}
   735  		}
   736  	}
   737  
   738  	return nil
   739  }
   740  
   741  // CommonTlsContext_CombinedCertificateValidationContextValidationError is the
   742  // validation error returned by
   743  // CommonTlsContext_CombinedCertificateValidationContext.Validate if the
   744  // designated constraints aren't met.
   745  type CommonTlsContext_CombinedCertificateValidationContextValidationError struct {
   746  	field  string
   747  	reason string
   748  	cause  error
   749  	key    bool
   750  }
   751  
   752  // Field function returns field value.
   753  func (e CommonTlsContext_CombinedCertificateValidationContextValidationError) Field() string {
   754  	return e.field
   755  }
   756  
   757  // Reason function returns reason value.
   758  func (e CommonTlsContext_CombinedCertificateValidationContextValidationError) Reason() string {
   759  	return e.reason
   760  }
   761  
   762  // Cause function returns cause value.
   763  func (e CommonTlsContext_CombinedCertificateValidationContextValidationError) Cause() error {
   764  	return e.cause
   765  }
   766  
   767  // Key function returns key value.
   768  func (e CommonTlsContext_CombinedCertificateValidationContextValidationError) Key() bool {
   769  	return e.key
   770  }
   771  
   772  // ErrorName returns error name.
   773  func (e CommonTlsContext_CombinedCertificateValidationContextValidationError) ErrorName() string {
   774  	return "CommonTlsContext_CombinedCertificateValidationContextValidationError"
   775  }
   776  
   777  // Error satisfies the builtin error interface
   778  func (e CommonTlsContext_CombinedCertificateValidationContextValidationError) Error() string {
   779  	cause := ""
   780  	if e.cause != nil {
   781  		cause = fmt.Sprintf(" | caused by: %v", e.cause)
   782  	}
   783  
   784  	key := ""
   785  	if e.key {
   786  		key = "key for "
   787  	}
   788  
   789  	return fmt.Sprintf(
   790  		"invalid %sCommonTlsContext_CombinedCertificateValidationContext.%s: %s%s",
   791  		key,
   792  		e.field,
   793  		e.reason,
   794  		cause)
   795  }
   796  
   797  var _ error = CommonTlsContext_CombinedCertificateValidationContextValidationError{}
   798  
   799  var _ interface {
   800  	Field() string
   801  	Reason() string
   802  	Key() bool
   803  	Cause() error
   804  	ErrorName() string
   805  } = CommonTlsContext_CombinedCertificateValidationContextValidationError{}