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