gitee.com/ks-custle/core-gm@v0.0.0-20230922171213-b83bdd97b62c/go-control-plane/envoy/config/trace/v2/lightstep.pb.validate.go (about) 1 // Code generated by protoc-gen-validate. DO NOT EDIT. 2 // source: envoy/config/trace/v2/lightstep.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 LightstepConfig 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 *LightstepConfig) Validate() error { 40 if m == nil { 41 return nil 42 } 43 44 if len(m.GetCollectorCluster()) < 1 { 45 return LightstepConfigValidationError{ 46 field: "CollectorCluster", 47 reason: "value length must be at least 1 bytes", 48 } 49 } 50 51 if len(m.GetAccessTokenFile()) < 1 { 52 return LightstepConfigValidationError{ 53 field: "AccessTokenFile", 54 reason: "value length must be at least 1 bytes", 55 } 56 } 57 58 for idx, item := range m.GetPropagationModes() { 59 _, _ = idx, item 60 61 if _, ok := LightstepConfig_PropagationMode_name[int32(item)]; !ok { 62 return LightstepConfigValidationError{ 63 field: fmt.Sprintf("PropagationModes[%v]", idx), 64 reason: "value must be one of the defined enum values", 65 } 66 } 67 68 } 69 70 return nil 71 } 72 73 // LightstepConfigValidationError is the validation error returned by 74 // LightstepConfig.Validate if the designated constraints aren't met. 75 type LightstepConfigValidationError struct { 76 field string 77 reason string 78 cause error 79 key bool 80 } 81 82 // Field function returns field value. 83 func (e LightstepConfigValidationError) Field() string { return e.field } 84 85 // Reason function returns reason value. 86 func (e LightstepConfigValidationError) Reason() string { return e.reason } 87 88 // Cause function returns cause value. 89 func (e LightstepConfigValidationError) Cause() error { return e.cause } 90 91 // Key function returns key value. 92 func (e LightstepConfigValidationError) Key() bool { return e.key } 93 94 // ErrorName returns error name. 95 func (e LightstepConfigValidationError) ErrorName() string { return "LightstepConfigValidationError" } 96 97 // Error satisfies the builtin error interface 98 func (e LightstepConfigValidationError) Error() string { 99 cause := "" 100 if e.cause != nil { 101 cause = fmt.Sprintf(" | caused by: %v", e.cause) 102 } 103 104 key := "" 105 if e.key { 106 key = "key for " 107 } 108 109 return fmt.Sprintf( 110 "invalid %sLightstepConfig.%s: %s%s", 111 key, 112 e.field, 113 e.reason, 114 cause) 115 } 116 117 var _ error = LightstepConfigValidationError{} 118 119 var _ interface { 120 Field() string 121 Reason() string 122 Key() bool 123 Cause() error 124 ErrorName() string 125 } = LightstepConfigValidationError{}