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

     1  // Code generated by protoc-gen-validate. DO NOT EDIT.
     2  // source: envoy/config/grpc_credential/v2alpha/file_based_metadata.proto
     3  
     4  package envoy_config_grpc_credential_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 FileBasedMetadataConfig 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 *FileBasedMetadataConfig) Validate() error {
    40  	if m == nil {
    41  		return nil
    42  	}
    43  
    44  	if v, ok := interface{}(m.GetSecretData()).(interface{ Validate() error }); ok {
    45  		if err := v.Validate(); err != nil {
    46  			return FileBasedMetadataConfigValidationError{
    47  				field:  "SecretData",
    48  				reason: "embedded message failed validation",
    49  				cause:  err,
    50  			}
    51  		}
    52  	}
    53  
    54  	// no validation rules for HeaderKey
    55  
    56  	// no validation rules for HeaderPrefix
    57  
    58  	return nil
    59  }
    60  
    61  // FileBasedMetadataConfigValidationError is the validation error returned by
    62  // FileBasedMetadataConfig.Validate if the designated constraints aren't met.
    63  type FileBasedMetadataConfigValidationError struct {
    64  	field  string
    65  	reason string
    66  	cause  error
    67  	key    bool
    68  }
    69  
    70  // Field function returns field value.
    71  func (e FileBasedMetadataConfigValidationError) Field() string { return e.field }
    72  
    73  // Reason function returns reason value.
    74  func (e FileBasedMetadataConfigValidationError) Reason() string { return e.reason }
    75  
    76  // Cause function returns cause value.
    77  func (e FileBasedMetadataConfigValidationError) Cause() error { return e.cause }
    78  
    79  // Key function returns key value.
    80  func (e FileBasedMetadataConfigValidationError) Key() bool { return e.key }
    81  
    82  // ErrorName returns error name.
    83  func (e FileBasedMetadataConfigValidationError) ErrorName() string {
    84  	return "FileBasedMetadataConfigValidationError"
    85  }
    86  
    87  // Error satisfies the builtin error interface
    88  func (e FileBasedMetadataConfigValidationError) Error() string {
    89  	cause := ""
    90  	if e.cause != nil {
    91  		cause = fmt.Sprintf(" | caused by: %v", e.cause)
    92  	}
    93  
    94  	key := ""
    95  	if e.key {
    96  		key = "key for "
    97  	}
    98  
    99  	return fmt.Sprintf(
   100  		"invalid %sFileBasedMetadataConfig.%s: %s%s",
   101  		key,
   102  		e.field,
   103  		e.reason,
   104  		cause)
   105  }
   106  
   107  var _ error = FileBasedMetadataConfigValidationError{}
   108  
   109  var _ interface {
   110  	Field() string
   111  	Reason() string
   112  	Key() bool
   113  	Cause() error
   114  	ErrorName() string
   115  } = FileBasedMetadataConfigValidationError{}