github.com/hxx258456/ccgo@v0.0.5-0.20230213014102-48b35f46f66f/go-control-plane/envoy/extensions/key_value/file_based/v3/config.pb.validate.go (about) 1 // Code generated by protoc-gen-validate. DO NOT EDIT. 2 // source: envoy/extensions/key_value/file_based/v3/config.proto 3 4 package envoy_extensions_key_value_file_based_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 FileBasedKeyValueStoreConfig with the 37 // rules defined in the proto definition for this message. If any rules are 38 // violated, an error is returned. 39 func (m *FileBasedKeyValueStoreConfig) Validate() error { 40 if m == nil { 41 return nil 42 } 43 44 if utf8.RuneCountInString(m.GetFilename()) < 1 { 45 return FileBasedKeyValueStoreConfigValidationError{ 46 field: "Filename", 47 reason: "value length must be at least 1 runes", 48 } 49 } 50 51 if v, ok := interface{}(m.GetFlushInterval()).(interface{ Validate() error }); ok { 52 if err := v.Validate(); err != nil { 53 return FileBasedKeyValueStoreConfigValidationError{ 54 field: "FlushInterval", 55 reason: "embedded message failed validation", 56 cause: err, 57 } 58 } 59 } 60 61 return nil 62 } 63 64 // FileBasedKeyValueStoreConfigValidationError is the validation error returned 65 // by FileBasedKeyValueStoreConfig.Validate if the designated constraints 66 // aren't met. 67 type FileBasedKeyValueStoreConfigValidationError struct { 68 field string 69 reason string 70 cause error 71 key bool 72 } 73 74 // Field function returns field value. 75 func (e FileBasedKeyValueStoreConfigValidationError) Field() string { return e.field } 76 77 // Reason function returns reason value. 78 func (e FileBasedKeyValueStoreConfigValidationError) Reason() string { return e.reason } 79 80 // Cause function returns cause value. 81 func (e FileBasedKeyValueStoreConfigValidationError) Cause() error { return e.cause } 82 83 // Key function returns key value. 84 func (e FileBasedKeyValueStoreConfigValidationError) Key() bool { return e.key } 85 86 // ErrorName returns error name. 87 func (e FileBasedKeyValueStoreConfigValidationError) ErrorName() string { 88 return "FileBasedKeyValueStoreConfigValidationError" 89 } 90 91 // Error satisfies the builtin error interface 92 func (e FileBasedKeyValueStoreConfigValidationError) Error() string { 93 cause := "" 94 if e.cause != nil { 95 cause = fmt.Sprintf(" | caused by: %v", e.cause) 96 } 97 98 key := "" 99 if e.key { 100 key = "key for " 101 } 102 103 return fmt.Sprintf( 104 "invalid %sFileBasedKeyValueStoreConfig.%s: %s%s", 105 key, 106 e.field, 107 e.reason, 108 cause) 109 } 110 111 var _ error = FileBasedKeyValueStoreConfigValidationError{} 112 113 var _ interface { 114 Field() string 115 Reason() string 116 Key() bool 117 Cause() error 118 ErrorName() string 119 } = FileBasedKeyValueStoreConfigValidationError{}