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