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