gitee.com/zhaochuninhefei/gmgo@v0.0.31-0.20240209061119-069254a02979/go-control-plane/envoy/extensions/transport_sockets/s2a/v3alpha/s2a.pb.validate.go (about) 1 // Code generated by protoc-gen-validate. DO NOT EDIT. 2 // source: envoy/extensions/transport_sockets/s2a/v3alpha/s2a.proto 3 4 package envoy_extensions_transport_sockets_s2a_v3alpha 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 S2AConfiguration 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 *S2AConfiguration) Validate() error { 40 if m == nil { 41 return nil 42 } 43 44 if utf8.RuneCountInString(m.GetS2AAddress()) < 1 { 45 return S2AConfigurationValidationError{ 46 field: "S2AAddress", 47 reason: "value length must be at least 1 runes", 48 } 49 } 50 51 return nil 52 } 53 54 // S2AConfigurationValidationError is the validation error returned by 55 // S2AConfiguration.Validate if the designated constraints aren't met. 56 type S2AConfigurationValidationError struct { 57 field string 58 reason string 59 cause error 60 key bool 61 } 62 63 // Field function returns field value. 64 func (e S2AConfigurationValidationError) Field() string { return e.field } 65 66 // Reason function returns reason value. 67 func (e S2AConfigurationValidationError) Reason() string { return e.reason } 68 69 // Cause function returns cause value. 70 func (e S2AConfigurationValidationError) Cause() error { return e.cause } 71 72 // Key function returns key value. 73 func (e S2AConfigurationValidationError) Key() bool { return e.key } 74 75 // ErrorName returns error name. 76 func (e S2AConfigurationValidationError) ErrorName() string { return "S2AConfigurationValidationError" } 77 78 // Error satisfies the builtin error interface 79 func (e S2AConfigurationValidationError) Error() string { 80 cause := "" 81 if e.cause != nil { 82 cause = fmt.Sprintf(" | caused by: %v", e.cause) 83 } 84 85 key := "" 86 if e.key { 87 key = "key for " 88 } 89 90 return fmt.Sprintf( 91 "invalid %sS2AConfiguration.%s: %s%s", 92 key, 93 e.field, 94 e.reason, 95 cause) 96 } 97 98 var _ error = S2AConfigurationValidationError{} 99 100 var _ interface { 101 Field() string 102 Reason() string 103 Key() bool 104 Cause() error 105 ErrorName() string 106 } = S2AConfigurationValidationError{}