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