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