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

     1  // Code generated by protoc-gen-validate. DO NOT EDIT.
     2  // source: envoy/admin/v3/certs.proto
     3  
     4  package envoy_admin_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 Certificates with the rules defined in
    37  // the proto definition for this message. If any rules are violated, an error
    38  // is returned.
    39  func (m *Certificates) Validate() error {
    40  	if m == nil {
    41  		return nil
    42  	}
    43  
    44  	for idx, item := range m.GetCertificates() {
    45  		_, _ = idx, item
    46  
    47  		if v, ok := interface{}(item).(interface{ Validate() error }); ok {
    48  			if err := v.Validate(); err != nil {
    49  				return CertificatesValidationError{
    50  					field:  fmt.Sprintf("Certificates[%v]", idx),
    51  					reason: "embedded message failed validation",
    52  					cause:  err,
    53  				}
    54  			}
    55  		}
    56  
    57  	}
    58  
    59  	return nil
    60  }
    61  
    62  // CertificatesValidationError is the validation error returned by
    63  // Certificates.Validate if the designated constraints aren't met.
    64  type CertificatesValidationError struct {
    65  	field  string
    66  	reason string
    67  	cause  error
    68  	key    bool
    69  }
    70  
    71  // Field function returns field value.
    72  func (e CertificatesValidationError) Field() string { return e.field }
    73  
    74  // Reason function returns reason value.
    75  func (e CertificatesValidationError) Reason() string { return e.reason }
    76  
    77  // Cause function returns cause value.
    78  func (e CertificatesValidationError) Cause() error { return e.cause }
    79  
    80  // Key function returns key value.
    81  func (e CertificatesValidationError) Key() bool { return e.key }
    82  
    83  // ErrorName returns error name.
    84  func (e CertificatesValidationError) ErrorName() string { return "CertificatesValidationError" }
    85  
    86  // Error satisfies the builtin error interface
    87  func (e CertificatesValidationError) Error() string {
    88  	cause := ""
    89  	if e.cause != nil {
    90  		cause = fmt.Sprintf(" | caused by: %v", e.cause)
    91  	}
    92  
    93  	key := ""
    94  	if e.key {
    95  		key = "key for "
    96  	}
    97  
    98  	return fmt.Sprintf(
    99  		"invalid %sCertificates.%s: %s%s",
   100  		key,
   101  		e.field,
   102  		e.reason,
   103  		cause)
   104  }
   105  
   106  var _ error = CertificatesValidationError{}
   107  
   108  var _ interface {
   109  	Field() string
   110  	Reason() string
   111  	Key() bool
   112  	Cause() error
   113  	ErrorName() string
   114  } = CertificatesValidationError{}
   115  
   116  // Validate checks the field values on Certificate with the rules defined in
   117  // the proto definition for this message. If any rules are violated, an error
   118  // is returned.
   119  func (m *Certificate) Validate() error {
   120  	if m == nil {
   121  		return nil
   122  	}
   123  
   124  	for idx, item := range m.GetCaCert() {
   125  		_, _ = idx, item
   126  
   127  		if v, ok := interface{}(item).(interface{ Validate() error }); ok {
   128  			if err := v.Validate(); err != nil {
   129  				return CertificateValidationError{
   130  					field:  fmt.Sprintf("CaCert[%v]", idx),
   131  					reason: "embedded message failed validation",
   132  					cause:  err,
   133  				}
   134  			}
   135  		}
   136  
   137  	}
   138  
   139  	for idx, item := range m.GetCertChain() {
   140  		_, _ = idx, item
   141  
   142  		if v, ok := interface{}(item).(interface{ Validate() error }); ok {
   143  			if err := v.Validate(); err != nil {
   144  				return CertificateValidationError{
   145  					field:  fmt.Sprintf("CertChain[%v]", idx),
   146  					reason: "embedded message failed validation",
   147  					cause:  err,
   148  				}
   149  			}
   150  		}
   151  
   152  	}
   153  
   154  	return nil
   155  }
   156  
   157  // CertificateValidationError is the validation error returned by
   158  // Certificate.Validate if the designated constraints aren't met.
   159  type CertificateValidationError struct {
   160  	field  string
   161  	reason string
   162  	cause  error
   163  	key    bool
   164  }
   165  
   166  // Field function returns field value.
   167  func (e CertificateValidationError) Field() string { return e.field }
   168  
   169  // Reason function returns reason value.
   170  func (e CertificateValidationError) Reason() string { return e.reason }
   171  
   172  // Cause function returns cause value.
   173  func (e CertificateValidationError) Cause() error { return e.cause }
   174  
   175  // Key function returns key value.
   176  func (e CertificateValidationError) Key() bool { return e.key }
   177  
   178  // ErrorName returns error name.
   179  func (e CertificateValidationError) ErrorName() string { return "CertificateValidationError" }
   180  
   181  // Error satisfies the builtin error interface
   182  func (e CertificateValidationError) Error() string {
   183  	cause := ""
   184  	if e.cause != nil {
   185  		cause = fmt.Sprintf(" | caused by: %v", e.cause)
   186  	}
   187  
   188  	key := ""
   189  	if e.key {
   190  		key = "key for "
   191  	}
   192  
   193  	return fmt.Sprintf(
   194  		"invalid %sCertificate.%s: %s%s",
   195  		key,
   196  		e.field,
   197  		e.reason,
   198  		cause)
   199  }
   200  
   201  var _ error = CertificateValidationError{}
   202  
   203  var _ interface {
   204  	Field() string
   205  	Reason() string
   206  	Key() bool
   207  	Cause() error
   208  	ErrorName() string
   209  } = CertificateValidationError{}
   210  
   211  // Validate checks the field values on CertificateDetails with the rules
   212  // defined in the proto definition for this message. If any rules are
   213  // violated, an error is returned.
   214  func (m *CertificateDetails) Validate() error {
   215  	if m == nil {
   216  		return nil
   217  	}
   218  
   219  	// no validation rules for Path
   220  
   221  	// no validation rules for SerialNumber
   222  
   223  	for idx, item := range m.GetSubjectAltNames() {
   224  		_, _ = idx, item
   225  
   226  		if v, ok := interface{}(item).(interface{ Validate() error }); ok {
   227  			if err := v.Validate(); err != nil {
   228  				return CertificateDetailsValidationError{
   229  					field:  fmt.Sprintf("SubjectAltNames[%v]", idx),
   230  					reason: "embedded message failed validation",
   231  					cause:  err,
   232  				}
   233  			}
   234  		}
   235  
   236  	}
   237  
   238  	// no validation rules for DaysUntilExpiration
   239  
   240  	if v, ok := interface{}(m.GetValidFrom()).(interface{ Validate() error }); ok {
   241  		if err := v.Validate(); err != nil {
   242  			return CertificateDetailsValidationError{
   243  				field:  "ValidFrom",
   244  				reason: "embedded message failed validation",
   245  				cause:  err,
   246  			}
   247  		}
   248  	}
   249  
   250  	if v, ok := interface{}(m.GetExpirationTime()).(interface{ Validate() error }); ok {
   251  		if err := v.Validate(); err != nil {
   252  			return CertificateDetailsValidationError{
   253  				field:  "ExpirationTime",
   254  				reason: "embedded message failed validation",
   255  				cause:  err,
   256  			}
   257  		}
   258  	}
   259  
   260  	if v, ok := interface{}(m.GetOcspDetails()).(interface{ Validate() error }); ok {
   261  		if err := v.Validate(); err != nil {
   262  			return CertificateDetailsValidationError{
   263  				field:  "OcspDetails",
   264  				reason: "embedded message failed validation",
   265  				cause:  err,
   266  			}
   267  		}
   268  	}
   269  
   270  	return nil
   271  }
   272  
   273  // CertificateDetailsValidationError is the validation error returned by
   274  // CertificateDetails.Validate if the designated constraints aren't met.
   275  type CertificateDetailsValidationError struct {
   276  	field  string
   277  	reason string
   278  	cause  error
   279  	key    bool
   280  }
   281  
   282  // Field function returns field value.
   283  func (e CertificateDetailsValidationError) Field() string { return e.field }
   284  
   285  // Reason function returns reason value.
   286  func (e CertificateDetailsValidationError) Reason() string { return e.reason }
   287  
   288  // Cause function returns cause value.
   289  func (e CertificateDetailsValidationError) Cause() error { return e.cause }
   290  
   291  // Key function returns key value.
   292  func (e CertificateDetailsValidationError) Key() bool { return e.key }
   293  
   294  // ErrorName returns error name.
   295  func (e CertificateDetailsValidationError) ErrorName() string {
   296  	return "CertificateDetailsValidationError"
   297  }
   298  
   299  // Error satisfies the builtin error interface
   300  func (e CertificateDetailsValidationError) Error() string {
   301  	cause := ""
   302  	if e.cause != nil {
   303  		cause = fmt.Sprintf(" | caused by: %v", e.cause)
   304  	}
   305  
   306  	key := ""
   307  	if e.key {
   308  		key = "key for "
   309  	}
   310  
   311  	return fmt.Sprintf(
   312  		"invalid %sCertificateDetails.%s: %s%s",
   313  		key,
   314  		e.field,
   315  		e.reason,
   316  		cause)
   317  }
   318  
   319  var _ error = CertificateDetailsValidationError{}
   320  
   321  var _ interface {
   322  	Field() string
   323  	Reason() string
   324  	Key() bool
   325  	Cause() error
   326  	ErrorName() string
   327  } = CertificateDetailsValidationError{}
   328  
   329  // Validate checks the field values on SubjectAlternateName with the rules
   330  // defined in the proto definition for this message. If any rules are
   331  // violated, an error is returned.
   332  func (m *SubjectAlternateName) Validate() error {
   333  	if m == nil {
   334  		return nil
   335  	}
   336  
   337  	switch m.Name.(type) {
   338  
   339  	case *SubjectAlternateName_Dns:
   340  		// no validation rules for Dns
   341  
   342  	case *SubjectAlternateName_Uri:
   343  		// no validation rules for Uri
   344  
   345  	case *SubjectAlternateName_IpAddress:
   346  		// no validation rules for IpAddress
   347  
   348  	}
   349  
   350  	return nil
   351  }
   352  
   353  // SubjectAlternateNameValidationError is the validation error returned by
   354  // SubjectAlternateName.Validate if the designated constraints aren't met.
   355  type SubjectAlternateNameValidationError struct {
   356  	field  string
   357  	reason string
   358  	cause  error
   359  	key    bool
   360  }
   361  
   362  // Field function returns field value.
   363  func (e SubjectAlternateNameValidationError) Field() string { return e.field }
   364  
   365  // Reason function returns reason value.
   366  func (e SubjectAlternateNameValidationError) Reason() string { return e.reason }
   367  
   368  // Cause function returns cause value.
   369  func (e SubjectAlternateNameValidationError) Cause() error { return e.cause }
   370  
   371  // Key function returns key value.
   372  func (e SubjectAlternateNameValidationError) Key() bool { return e.key }
   373  
   374  // ErrorName returns error name.
   375  func (e SubjectAlternateNameValidationError) ErrorName() string {
   376  	return "SubjectAlternateNameValidationError"
   377  }
   378  
   379  // Error satisfies the builtin error interface
   380  func (e SubjectAlternateNameValidationError) Error() string {
   381  	cause := ""
   382  	if e.cause != nil {
   383  		cause = fmt.Sprintf(" | caused by: %v", e.cause)
   384  	}
   385  
   386  	key := ""
   387  	if e.key {
   388  		key = "key for "
   389  	}
   390  
   391  	return fmt.Sprintf(
   392  		"invalid %sSubjectAlternateName.%s: %s%s",
   393  		key,
   394  		e.field,
   395  		e.reason,
   396  		cause)
   397  }
   398  
   399  var _ error = SubjectAlternateNameValidationError{}
   400  
   401  var _ interface {
   402  	Field() string
   403  	Reason() string
   404  	Key() bool
   405  	Cause() error
   406  	ErrorName() string
   407  } = SubjectAlternateNameValidationError{}
   408  
   409  // Validate checks the field values on CertificateDetails_OcspDetails with the
   410  // rules defined in the proto definition for this message. If any rules are
   411  // violated, an error is returned.
   412  func (m *CertificateDetails_OcspDetails) Validate() error {
   413  	if m == nil {
   414  		return nil
   415  	}
   416  
   417  	if v, ok := interface{}(m.GetValidFrom()).(interface{ Validate() error }); ok {
   418  		if err := v.Validate(); err != nil {
   419  			return CertificateDetails_OcspDetailsValidationError{
   420  				field:  "ValidFrom",
   421  				reason: "embedded message failed validation",
   422  				cause:  err,
   423  			}
   424  		}
   425  	}
   426  
   427  	if v, ok := interface{}(m.GetExpiration()).(interface{ Validate() error }); ok {
   428  		if err := v.Validate(); err != nil {
   429  			return CertificateDetails_OcspDetailsValidationError{
   430  				field:  "Expiration",
   431  				reason: "embedded message failed validation",
   432  				cause:  err,
   433  			}
   434  		}
   435  	}
   436  
   437  	return nil
   438  }
   439  
   440  // CertificateDetails_OcspDetailsValidationError is the validation error
   441  // returned by CertificateDetails_OcspDetails.Validate if the designated
   442  // constraints aren't met.
   443  type CertificateDetails_OcspDetailsValidationError struct {
   444  	field  string
   445  	reason string
   446  	cause  error
   447  	key    bool
   448  }
   449  
   450  // Field function returns field value.
   451  func (e CertificateDetails_OcspDetailsValidationError) Field() string { return e.field }
   452  
   453  // Reason function returns reason value.
   454  func (e CertificateDetails_OcspDetailsValidationError) Reason() string { return e.reason }
   455  
   456  // Cause function returns cause value.
   457  func (e CertificateDetails_OcspDetailsValidationError) Cause() error { return e.cause }
   458  
   459  // Key function returns key value.
   460  func (e CertificateDetails_OcspDetailsValidationError) Key() bool { return e.key }
   461  
   462  // ErrorName returns error name.
   463  func (e CertificateDetails_OcspDetailsValidationError) ErrorName() string {
   464  	return "CertificateDetails_OcspDetailsValidationError"
   465  }
   466  
   467  // Error satisfies the builtin error interface
   468  func (e CertificateDetails_OcspDetailsValidationError) Error() string {
   469  	cause := ""
   470  	if e.cause != nil {
   471  		cause = fmt.Sprintf(" | caused by: %v", e.cause)
   472  	}
   473  
   474  	key := ""
   475  	if e.key {
   476  		key = "key for "
   477  	}
   478  
   479  	return fmt.Sprintf(
   480  		"invalid %sCertificateDetails_OcspDetails.%s: %s%s",
   481  		key,
   482  		e.field,
   483  		e.reason,
   484  		cause)
   485  }
   486  
   487  var _ error = CertificateDetails_OcspDetailsValidationError{}
   488  
   489  var _ interface {
   490  	Field() string
   491  	Reason() string
   492  	Key() bool
   493  	Cause() error
   494  	ErrorName() string
   495  } = CertificateDetails_OcspDetailsValidationError{}