gitee.com/zhaochuninhefei/gmgo@v0.0.31-0.20240209061119-069254a02979/go-control-plane/envoy/api/v2/auth/secret.pb.validate.go (about)

     1  // Code generated by protoc-gen-validate. DO NOT EDIT.
     2  // source: envoy/api/v2/auth/secret.proto
     3  
     4  package envoy_api_v2_auth
     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  	// no validation rules for Name
   120  
   121  	if v, ok := interface{}(m.GetSdsConfig()).(interface{ Validate() error }); ok {
   122  		if err := v.Validate(); err != nil {
   123  			return SdsSecretConfigValidationError{
   124  				field:  "SdsConfig",
   125  				reason: "embedded message failed validation",
   126  				cause:  err,
   127  			}
   128  		}
   129  	}
   130  
   131  	return nil
   132  }
   133  
   134  // SdsSecretConfigValidationError is the validation error returned by
   135  // SdsSecretConfig.Validate if the designated constraints aren't met.
   136  type SdsSecretConfigValidationError struct {
   137  	field  string
   138  	reason string
   139  	cause  error
   140  	key    bool
   141  }
   142  
   143  // Field function returns field value.
   144  func (e SdsSecretConfigValidationError) Field() string { return e.field }
   145  
   146  // Reason function returns reason value.
   147  func (e SdsSecretConfigValidationError) Reason() string { return e.reason }
   148  
   149  // Cause function returns cause value.
   150  func (e SdsSecretConfigValidationError) Cause() error { return e.cause }
   151  
   152  // Key function returns key value.
   153  func (e SdsSecretConfigValidationError) Key() bool { return e.key }
   154  
   155  // ErrorName returns error name.
   156  func (e SdsSecretConfigValidationError) ErrorName() string { return "SdsSecretConfigValidationError" }
   157  
   158  // Error satisfies the builtin error interface
   159  func (e SdsSecretConfigValidationError) Error() string {
   160  	cause := ""
   161  	if e.cause != nil {
   162  		cause = fmt.Sprintf(" | caused by: %v", e.cause)
   163  	}
   164  
   165  	key := ""
   166  	if e.key {
   167  		key = "key for "
   168  	}
   169  
   170  	return fmt.Sprintf(
   171  		"invalid %sSdsSecretConfig.%s: %s%s",
   172  		key,
   173  		e.field,
   174  		e.reason,
   175  		cause)
   176  }
   177  
   178  var _ error = SdsSecretConfigValidationError{}
   179  
   180  var _ interface {
   181  	Field() string
   182  	Reason() string
   183  	Key() bool
   184  	Cause() error
   185  	ErrorName() string
   186  } = SdsSecretConfigValidationError{}
   187  
   188  // Validate checks the field values on Secret with the rules defined in the
   189  // proto definition for this message. If any rules are violated, an error is returned.
   190  func (m *Secret) Validate() error {
   191  	if m == nil {
   192  		return nil
   193  	}
   194  
   195  	// no validation rules for Name
   196  
   197  	switch m.Type.(type) {
   198  
   199  	case *Secret_TlsCertificate:
   200  
   201  		if v, ok := interface{}(m.GetTlsCertificate()).(interface{ Validate() error }); ok {
   202  			if err := v.Validate(); err != nil {
   203  				return SecretValidationError{
   204  					field:  "TlsCertificate",
   205  					reason: "embedded message failed validation",
   206  					cause:  err,
   207  				}
   208  			}
   209  		}
   210  
   211  	case *Secret_SessionTicketKeys:
   212  
   213  		if v, ok := interface{}(m.GetSessionTicketKeys()).(interface{ Validate() error }); ok {
   214  			if err := v.Validate(); err != nil {
   215  				return SecretValidationError{
   216  					field:  "SessionTicketKeys",
   217  					reason: "embedded message failed validation",
   218  					cause:  err,
   219  				}
   220  			}
   221  		}
   222  
   223  	case *Secret_ValidationContext:
   224  
   225  		if v, ok := interface{}(m.GetValidationContext()).(interface{ Validate() error }); ok {
   226  			if err := v.Validate(); err != nil {
   227  				return SecretValidationError{
   228  					field:  "ValidationContext",
   229  					reason: "embedded message failed validation",
   230  					cause:  err,
   231  				}
   232  			}
   233  		}
   234  
   235  	case *Secret_GenericSecret:
   236  
   237  		if v, ok := interface{}(m.GetGenericSecret()).(interface{ Validate() error }); ok {
   238  			if err := v.Validate(); err != nil {
   239  				return SecretValidationError{
   240  					field:  "GenericSecret",
   241  					reason: "embedded message failed validation",
   242  					cause:  err,
   243  				}
   244  			}
   245  		}
   246  
   247  	}
   248  
   249  	return nil
   250  }
   251  
   252  // SecretValidationError is the validation error returned by Secret.Validate if
   253  // the designated constraints aren't met.
   254  type SecretValidationError struct {
   255  	field  string
   256  	reason string
   257  	cause  error
   258  	key    bool
   259  }
   260  
   261  // Field function returns field value.
   262  func (e SecretValidationError) Field() string { return e.field }
   263  
   264  // Reason function returns reason value.
   265  func (e SecretValidationError) Reason() string { return e.reason }
   266  
   267  // Cause function returns cause value.
   268  func (e SecretValidationError) Cause() error { return e.cause }
   269  
   270  // Key function returns key value.
   271  func (e SecretValidationError) Key() bool { return e.key }
   272  
   273  // ErrorName returns error name.
   274  func (e SecretValidationError) ErrorName() string { return "SecretValidationError" }
   275  
   276  // Error satisfies the builtin error interface
   277  func (e SecretValidationError) Error() string {
   278  	cause := ""
   279  	if e.cause != nil {
   280  		cause = fmt.Sprintf(" | caused by: %v", e.cause)
   281  	}
   282  
   283  	key := ""
   284  	if e.key {
   285  		key = "key for "
   286  	}
   287  
   288  	return fmt.Sprintf(
   289  		"invalid %sSecret.%s: %s%s",
   290  		key,
   291  		e.field,
   292  		e.reason,
   293  		cause)
   294  }
   295  
   296  var _ error = SecretValidationError{}
   297  
   298  var _ interface {
   299  	Field() string
   300  	Reason() string
   301  	Key() bool
   302  	Cause() error
   303  	ErrorName() string
   304  } = SecretValidationError{}