github.com/hxx258456/ccgo@v0.0.5-0.20230213014102-48b35f46f66f/go-control-plane/envoy/config/core/v3/resolver.pb.validate.go (about) 1 // Code generated by protoc-gen-validate. DO NOT EDIT. 2 // source: envoy/config/core/v3/resolver.proto 3 4 package envoy_config_core_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 DnsResolverOptions with the rules 37 // defined in the proto definition for this message. If any rules are 38 // violated, an error is returned. 39 func (m *DnsResolverOptions) Validate() error { 40 if m == nil { 41 return nil 42 } 43 44 // no validation rules for UseTcpForDnsLookups 45 46 // no validation rules for NoDefaultSearchDomain 47 48 return nil 49 } 50 51 // DnsResolverOptionsValidationError is the validation error returned by 52 // DnsResolverOptions.Validate if the designated constraints aren't met. 53 type DnsResolverOptionsValidationError struct { 54 field string 55 reason string 56 cause error 57 key bool 58 } 59 60 // Field function returns field value. 61 func (e DnsResolverOptionsValidationError) Field() string { return e.field } 62 63 // Reason function returns reason value. 64 func (e DnsResolverOptionsValidationError) Reason() string { return e.reason } 65 66 // Cause function returns cause value. 67 func (e DnsResolverOptionsValidationError) Cause() error { return e.cause } 68 69 // Key function returns key value. 70 func (e DnsResolverOptionsValidationError) Key() bool { return e.key } 71 72 // ErrorName returns error name. 73 func (e DnsResolverOptionsValidationError) ErrorName() string { 74 return "DnsResolverOptionsValidationError" 75 } 76 77 // Error satisfies the builtin error interface 78 func (e DnsResolverOptionsValidationError) Error() string { 79 cause := "" 80 if e.cause != nil { 81 cause = fmt.Sprintf(" | caused by: %v", e.cause) 82 } 83 84 key := "" 85 if e.key { 86 key = "key for " 87 } 88 89 return fmt.Sprintf( 90 "invalid %sDnsResolverOptions.%s: %s%s", 91 key, 92 e.field, 93 e.reason, 94 cause) 95 } 96 97 var _ error = DnsResolverOptionsValidationError{} 98 99 var _ interface { 100 Field() string 101 Reason() string 102 Key() bool 103 Cause() error 104 ErrorName() string 105 } = DnsResolverOptionsValidationError{} 106 107 // Validate checks the field values on DnsResolutionConfig with the rules 108 // defined in the proto definition for this message. If any rules are 109 // violated, an error is returned. 110 func (m *DnsResolutionConfig) Validate() error { 111 if m == nil { 112 return nil 113 } 114 115 if len(m.GetResolvers()) < 1 { 116 return DnsResolutionConfigValidationError{ 117 field: "Resolvers", 118 reason: "value must contain at least 1 item(s)", 119 } 120 } 121 122 for idx, item := range m.GetResolvers() { 123 _, _ = idx, item 124 125 if v, ok := interface{}(item).(interface{ Validate() error }); ok { 126 if err := v.Validate(); err != nil { 127 return DnsResolutionConfigValidationError{ 128 field: fmt.Sprintf("Resolvers[%v]", idx), 129 reason: "embedded message failed validation", 130 cause: err, 131 } 132 } 133 } 134 135 } 136 137 if v, ok := interface{}(m.GetDnsResolverOptions()).(interface{ Validate() error }); ok { 138 if err := v.Validate(); err != nil { 139 return DnsResolutionConfigValidationError{ 140 field: "DnsResolverOptions", 141 reason: "embedded message failed validation", 142 cause: err, 143 } 144 } 145 } 146 147 return nil 148 } 149 150 // DnsResolutionConfigValidationError is the validation error returned by 151 // DnsResolutionConfig.Validate if the designated constraints aren't met. 152 type DnsResolutionConfigValidationError struct { 153 field string 154 reason string 155 cause error 156 key bool 157 } 158 159 // Field function returns field value. 160 func (e DnsResolutionConfigValidationError) Field() string { return e.field } 161 162 // Reason function returns reason value. 163 func (e DnsResolutionConfigValidationError) Reason() string { return e.reason } 164 165 // Cause function returns cause value. 166 func (e DnsResolutionConfigValidationError) Cause() error { return e.cause } 167 168 // Key function returns key value. 169 func (e DnsResolutionConfigValidationError) Key() bool { return e.key } 170 171 // ErrorName returns error name. 172 func (e DnsResolutionConfigValidationError) ErrorName() string { 173 return "DnsResolutionConfigValidationError" 174 } 175 176 // Error satisfies the builtin error interface 177 func (e DnsResolutionConfigValidationError) Error() string { 178 cause := "" 179 if e.cause != nil { 180 cause = fmt.Sprintf(" | caused by: %v", e.cause) 181 } 182 183 key := "" 184 if e.key { 185 key = "key for " 186 } 187 188 return fmt.Sprintf( 189 "invalid %sDnsResolutionConfig.%s: %s%s", 190 key, 191 e.field, 192 e.reason, 193 cause) 194 } 195 196 var _ error = DnsResolutionConfigValidationError{} 197 198 var _ interface { 199 Field() string 200 Reason() string 201 Key() bool 202 Cause() error 203 ErrorName() string 204 } = DnsResolutionConfigValidationError{}