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

     1  // Code generated by protoc-gen-validate. DO NOT EDIT.
     2  // source: envoy/extensions/transport_sockets/tls/v3/secret.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 GenericSecret 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 *GenericSecret) Validate() error {
    40  	if m == nil {
    41  		return nil
    42  	}
    43  
    44  	if v, ok := interface{}(m.GetSecret()).(interface{ Validate() error }); ok {
    45  		if err := v.Validate(); err != nil {
    46  			return GenericSecretValidationError{
    47  				field:  "Secret",
    48  				reason: "embedded message failed validation",
    49  				cause:  err,
    50  			}
    51  		}
    52  	}
    53  
    54  	return nil
    55  }
    56  
    57  // GenericSecretValidationError is the validation error returned by
    58  // GenericSecret.Validate if the designated constraints aren't met.
    59  type GenericSecretValidationError struct {
    60  	field  string
    61  	reason string
    62  	cause  error
    63  	key    bool
    64  }
    65  
    66  // Field function returns field value.
    67  func (e GenericSecretValidationError) Field() string { return e.field }
    68  
    69  // Reason function returns reason value.
    70  func (e GenericSecretValidationError) Reason() string { return e.reason }
    71  
    72  // Cause function returns cause value.
    73  func (e GenericSecretValidationError) Cause() error { return e.cause }
    74  
    75  // Key function returns key value.
    76  func (e GenericSecretValidationError) Key() bool { return e.key }
    77  
    78  // ErrorName returns error name.
    79  func (e GenericSecretValidationError) ErrorName() string { return "GenericSecretValidationError" }
    80  
    81  // Error satisfies the builtin error interface
    82  func (e GenericSecretValidationError) Error() string {
    83  	cause := ""
    84  	if e.cause != nil {
    85  		cause = fmt.Sprintf(" | caused by: %v", e.cause)
    86  	}
    87  
    88  	key := ""
    89  	if e.key {
    90  		key = "key for "
    91  	}
    92  
    93  	return fmt.Sprintf(
    94  		"invalid %sGenericSecret.%s: %s%s",
    95  		key,
    96  		e.field,
    97  		e.reason,
    98  		cause)
    99  }
   100  
   101  var _ error = GenericSecretValidationError{}
   102  
   103  var _ interface {
   104  	Field() string
   105  	Reason() string
   106  	Key() bool
   107  	Cause() error
   108  	ErrorName() string
   109  } = GenericSecretValidationError{}
   110  
   111  // Validate checks the field values on SdsSecretConfig with the rules defined
   112  // in the proto definition for this message. If any rules are violated, an
   113  // error is returned.
   114  func (m *SdsSecretConfig) Validate() error {
   115  	if m == nil {
   116  		return nil
   117  	}
   118  
   119  	if utf8.RuneCountInString(m.GetName()) < 1 {
   120  		return SdsSecretConfigValidationError{
   121  			field:  "Name",
   122  			reason: "value length must be at least 1 runes",
   123  		}
   124  	}
   125  
   126  	if v, ok := interface{}(m.GetSdsConfig()).(interface{ Validate() error }); ok {
   127  		if err := v.Validate(); err != nil {
   128  			return SdsSecretConfigValidationError{
   129  				field:  "SdsConfig",
   130  				reason: "embedded message failed validation",
   131  				cause:  err,
   132  			}
   133  		}
   134  	}
   135  
   136  	return nil
   137  }
   138  
   139  // SdsSecretConfigValidationError is the validation error returned by
   140  // SdsSecretConfig.Validate if the designated constraints aren't met.
   141  type SdsSecretConfigValidationError struct {
   142  	field  string
   143  	reason string
   144  	cause  error
   145  	key    bool
   146  }
   147  
   148  // Field function returns field value.
   149  func (e SdsSecretConfigValidationError) Field() string { return e.field }
   150  
   151  // Reason function returns reason value.
   152  func (e SdsSecretConfigValidationError) Reason() string { return e.reason }
   153  
   154  // Cause function returns cause value.
   155  func (e SdsSecretConfigValidationError) Cause() error { return e.cause }
   156  
   157  // Key function returns key value.
   158  func (e SdsSecretConfigValidationError) Key() bool { return e.key }
   159  
   160  // ErrorName returns error name.
   161  func (e SdsSecretConfigValidationError) ErrorName() string { return "SdsSecretConfigValidationError" }
   162  
   163  // Error satisfies the builtin error interface
   164  func (e SdsSecretConfigValidationError) Error() string {
   165  	cause := ""
   166  	if e.cause != nil {
   167  		cause = fmt.Sprintf(" | caused by: %v", e.cause)
   168  	}
   169  
   170  	key := ""
   171  	if e.key {
   172  		key = "key for "
   173  	}
   174  
   175  	return fmt.Sprintf(
   176  		"invalid %sSdsSecretConfig.%s: %s%s",
   177  		key,
   178  		e.field,
   179  		e.reason,
   180  		cause)
   181  }
   182  
   183  var _ error = SdsSecretConfigValidationError{}
   184  
   185  var _ interface {
   186  	Field() string
   187  	Reason() string
   188  	Key() bool
   189  	Cause() error
   190  	ErrorName() string
   191  } = SdsSecretConfigValidationError{}
   192  
   193  // Validate checks the field values on Secret with the rules defined in the
   194  // proto definition for this message. If any rules are violated, an error is returned.
   195  func (m *Secret) Validate() error {
   196  	if m == nil {
   197  		return nil
   198  	}
   199  
   200  	// no validation rules for Name
   201  
   202  	switch m.Type.(type) {
   203  
   204  	case *Secret_TlsCertificate:
   205  
   206  		if v, ok := interface{}(m.GetTlsCertificate()).(interface{ Validate() error }); ok {
   207  			if err := v.Validate(); err != nil {
   208  				return SecretValidationError{
   209  					field:  "TlsCertificate",
   210  					reason: "embedded message failed validation",
   211  					cause:  err,
   212  				}
   213  			}
   214  		}
   215  
   216  	case *Secret_SessionTicketKeys:
   217  
   218  		if v, ok := interface{}(m.GetSessionTicketKeys()).(interface{ Validate() error }); ok {
   219  			if err := v.Validate(); err != nil {
   220  				return SecretValidationError{
   221  					field:  "SessionTicketKeys",
   222  					reason: "embedded message failed validation",
   223  					cause:  err,
   224  				}
   225  			}
   226  		}
   227  
   228  	case *Secret_ValidationContext:
   229  
   230  		if v, ok := interface{}(m.GetValidationContext()).(interface{ Validate() error }); ok {
   231  			if err := v.Validate(); err != nil {
   232  				return SecretValidationError{
   233  					field:  "ValidationContext",
   234  					reason: "embedded message failed validation",
   235  					cause:  err,
   236  				}
   237  			}
   238  		}
   239  
   240  	case *Secret_GenericSecret:
   241  
   242  		if v, ok := interface{}(m.GetGenericSecret()).(interface{ Validate() error }); ok {
   243  			if err := v.Validate(); err != nil {
   244  				return SecretValidationError{
   245  					field:  "GenericSecret",
   246  					reason: "embedded message failed validation",
   247  					cause:  err,
   248  				}
   249  			}
   250  		}
   251  
   252  	}
   253  
   254  	return nil
   255  }
   256  
   257  // SecretValidationError is the validation error returned by Secret.Validate if
   258  // the designated constraints aren't met.
   259  type SecretValidationError struct {
   260  	field  string
   261  	reason string
   262  	cause  error
   263  	key    bool
   264  }
   265  
   266  // Field function returns field value.
   267  func (e SecretValidationError) Field() string { return e.field }
   268  
   269  // Reason function returns reason value.
   270  func (e SecretValidationError) Reason() string { return e.reason }
   271  
   272  // Cause function returns cause value.
   273  func (e SecretValidationError) Cause() error { return e.cause }
   274  
   275  // Key function returns key value.
   276  func (e SecretValidationError) Key() bool { return e.key }
   277  
   278  // ErrorName returns error name.
   279  func (e SecretValidationError) ErrorName() string { return "SecretValidationError" }
   280  
   281  // Error satisfies the builtin error interface
   282  func (e SecretValidationError) Error() string {
   283  	cause := ""
   284  	if e.cause != nil {
   285  		cause = fmt.Sprintf(" | caused by: %v", e.cause)
   286  	}
   287  
   288  	key := ""
   289  	if e.key {
   290  		key = "key for "
   291  	}
   292  
   293  	return fmt.Sprintf(
   294  		"invalid %sSecret.%s: %s%s",
   295  		key,
   296  		e.field,
   297  		e.reason,
   298  		cause)
   299  }
   300  
   301  var _ error = SecretValidationError{}
   302  
   303  var _ interface {
   304  	Field() string
   305  	Reason() string
   306  	Key() bool
   307  	Cause() error
   308  	ErrorName() string
   309  } = SecretValidationError{}