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

     1  // Code generated by protoc-gen-validate. DO NOT EDIT.
     2  // source: envoy/admin/v2alpha/certs.proto
     3  
     4  package envoy_admin_v2alpha
     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  	return nil
   261  }
   262  
   263  // CertificateDetailsValidationError is the validation error returned by
   264  // CertificateDetails.Validate if the designated constraints aren't met.
   265  type CertificateDetailsValidationError struct {
   266  	field  string
   267  	reason string
   268  	cause  error
   269  	key    bool
   270  }
   271  
   272  // Field function returns field value.
   273  func (e CertificateDetailsValidationError) Field() string { return e.field }
   274  
   275  // Reason function returns reason value.
   276  func (e CertificateDetailsValidationError) Reason() string { return e.reason }
   277  
   278  // Cause function returns cause value.
   279  func (e CertificateDetailsValidationError) Cause() error { return e.cause }
   280  
   281  // Key function returns key value.
   282  func (e CertificateDetailsValidationError) Key() bool { return e.key }
   283  
   284  // ErrorName returns error name.
   285  func (e CertificateDetailsValidationError) ErrorName() string {
   286  	return "CertificateDetailsValidationError"
   287  }
   288  
   289  // Error satisfies the builtin error interface
   290  func (e CertificateDetailsValidationError) Error() string {
   291  	cause := ""
   292  	if e.cause != nil {
   293  		cause = fmt.Sprintf(" | caused by: %v", e.cause)
   294  	}
   295  
   296  	key := ""
   297  	if e.key {
   298  		key = "key for "
   299  	}
   300  
   301  	return fmt.Sprintf(
   302  		"invalid %sCertificateDetails.%s: %s%s",
   303  		key,
   304  		e.field,
   305  		e.reason,
   306  		cause)
   307  }
   308  
   309  var _ error = CertificateDetailsValidationError{}
   310  
   311  var _ interface {
   312  	Field() string
   313  	Reason() string
   314  	Key() bool
   315  	Cause() error
   316  	ErrorName() string
   317  } = CertificateDetailsValidationError{}
   318  
   319  // Validate checks the field values on SubjectAlternateName with the rules
   320  // defined in the proto definition for this message. If any rules are
   321  // violated, an error is returned.
   322  func (m *SubjectAlternateName) Validate() error {
   323  	if m == nil {
   324  		return nil
   325  	}
   326  
   327  	switch m.Name.(type) {
   328  
   329  	case *SubjectAlternateName_Dns:
   330  		// no validation rules for Dns
   331  
   332  	case *SubjectAlternateName_Uri:
   333  		// no validation rules for Uri
   334  
   335  	case *SubjectAlternateName_IpAddress:
   336  		// no validation rules for IpAddress
   337  
   338  	}
   339  
   340  	return nil
   341  }
   342  
   343  // SubjectAlternateNameValidationError is the validation error returned by
   344  // SubjectAlternateName.Validate if the designated constraints aren't met.
   345  type SubjectAlternateNameValidationError struct {
   346  	field  string
   347  	reason string
   348  	cause  error
   349  	key    bool
   350  }
   351  
   352  // Field function returns field value.
   353  func (e SubjectAlternateNameValidationError) Field() string { return e.field }
   354  
   355  // Reason function returns reason value.
   356  func (e SubjectAlternateNameValidationError) Reason() string { return e.reason }
   357  
   358  // Cause function returns cause value.
   359  func (e SubjectAlternateNameValidationError) Cause() error { return e.cause }
   360  
   361  // Key function returns key value.
   362  func (e SubjectAlternateNameValidationError) Key() bool { return e.key }
   363  
   364  // ErrorName returns error name.
   365  func (e SubjectAlternateNameValidationError) ErrorName() string {
   366  	return "SubjectAlternateNameValidationError"
   367  }
   368  
   369  // Error satisfies the builtin error interface
   370  func (e SubjectAlternateNameValidationError) Error() string {
   371  	cause := ""
   372  	if e.cause != nil {
   373  		cause = fmt.Sprintf(" | caused by: %v", e.cause)
   374  	}
   375  
   376  	key := ""
   377  	if e.key {
   378  		key = "key for "
   379  	}
   380  
   381  	return fmt.Sprintf(
   382  		"invalid %sSubjectAlternateName.%s: %s%s",
   383  		key,
   384  		e.field,
   385  		e.reason,
   386  		cause)
   387  }
   388  
   389  var _ error = SubjectAlternateNameValidationError{}
   390  
   391  var _ interface {
   392  	Field() string
   393  	Reason() string
   394  	Key() bool
   395  	Cause() error
   396  	ErrorName() string
   397  } = SubjectAlternateNameValidationError{}