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