github.com/hxx258456/ccgo@v0.0.5-0.20230213014102-48b35f46f66f/go-control-plane/envoy/extensions/upstreams/http/v3/http_protocol_options.pb.validate.go (about) 1 // Code generated by protoc-gen-validate. DO NOT EDIT. 2 // source: envoy/extensions/upstreams/http/v3/http_protocol_options.proto 3 4 package envoy_extensions_upstreams_http_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 HttpProtocolOptions 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 *HttpProtocolOptions) Validate() error { 40 if m == nil { 41 return nil 42 } 43 44 if v, ok := interface{}(m.GetCommonHttpProtocolOptions()).(interface{ Validate() error }); ok { 45 if err := v.Validate(); err != nil { 46 return HttpProtocolOptionsValidationError{ 47 field: "CommonHttpProtocolOptions", 48 reason: "embedded message failed validation", 49 cause: err, 50 } 51 } 52 } 53 54 if v, ok := interface{}(m.GetUpstreamHttpProtocolOptions()).(interface{ Validate() error }); ok { 55 if err := v.Validate(); err != nil { 56 return HttpProtocolOptionsValidationError{ 57 field: "UpstreamHttpProtocolOptions", 58 reason: "embedded message failed validation", 59 cause: err, 60 } 61 } 62 } 63 64 switch m.UpstreamProtocolOptions.(type) { 65 66 case *HttpProtocolOptions_ExplicitHttpConfig_: 67 68 if v, ok := interface{}(m.GetExplicitHttpConfig()).(interface{ Validate() error }); ok { 69 if err := v.Validate(); err != nil { 70 return HttpProtocolOptionsValidationError{ 71 field: "ExplicitHttpConfig", 72 reason: "embedded message failed validation", 73 cause: err, 74 } 75 } 76 } 77 78 case *HttpProtocolOptions_UseDownstreamProtocolConfig: 79 80 if v, ok := interface{}(m.GetUseDownstreamProtocolConfig()).(interface{ Validate() error }); ok { 81 if err := v.Validate(); err != nil { 82 return HttpProtocolOptionsValidationError{ 83 field: "UseDownstreamProtocolConfig", 84 reason: "embedded message failed validation", 85 cause: err, 86 } 87 } 88 } 89 90 case *HttpProtocolOptions_AutoConfig: 91 92 if v, ok := interface{}(m.GetAutoConfig()).(interface{ Validate() error }); ok { 93 if err := v.Validate(); err != nil { 94 return HttpProtocolOptionsValidationError{ 95 field: "AutoConfig", 96 reason: "embedded message failed validation", 97 cause: err, 98 } 99 } 100 } 101 102 default: 103 return HttpProtocolOptionsValidationError{ 104 field: "UpstreamProtocolOptions", 105 reason: "value is required", 106 } 107 108 } 109 110 return nil 111 } 112 113 // HttpProtocolOptionsValidationError is the validation error returned by 114 // HttpProtocolOptions.Validate if the designated constraints aren't met. 115 type HttpProtocolOptionsValidationError struct { 116 field string 117 reason string 118 cause error 119 key bool 120 } 121 122 // Field function returns field value. 123 func (e HttpProtocolOptionsValidationError) Field() string { return e.field } 124 125 // Reason function returns reason value. 126 func (e HttpProtocolOptionsValidationError) Reason() string { return e.reason } 127 128 // Cause function returns cause value. 129 func (e HttpProtocolOptionsValidationError) Cause() error { return e.cause } 130 131 // Key function returns key value. 132 func (e HttpProtocolOptionsValidationError) Key() bool { return e.key } 133 134 // ErrorName returns error name. 135 func (e HttpProtocolOptionsValidationError) ErrorName() string { 136 return "HttpProtocolOptionsValidationError" 137 } 138 139 // Error satisfies the builtin error interface 140 func (e HttpProtocolOptionsValidationError) Error() string { 141 cause := "" 142 if e.cause != nil { 143 cause = fmt.Sprintf(" | caused by: %v", e.cause) 144 } 145 146 key := "" 147 if e.key { 148 key = "key for " 149 } 150 151 return fmt.Sprintf( 152 "invalid %sHttpProtocolOptions.%s: %s%s", 153 key, 154 e.field, 155 e.reason, 156 cause) 157 } 158 159 var _ error = HttpProtocolOptionsValidationError{} 160 161 var _ interface { 162 Field() string 163 Reason() string 164 Key() bool 165 Cause() error 166 ErrorName() string 167 } = HttpProtocolOptionsValidationError{} 168 169 // Validate checks the field values on HttpProtocolOptions_ExplicitHttpConfig 170 // with the rules defined in the proto definition for this message. If any 171 // rules are violated, an error is returned. 172 func (m *HttpProtocolOptions_ExplicitHttpConfig) Validate() error { 173 if m == nil { 174 return nil 175 } 176 177 switch m.ProtocolConfig.(type) { 178 179 case *HttpProtocolOptions_ExplicitHttpConfig_HttpProtocolOptions: 180 181 if v, ok := interface{}(m.GetHttpProtocolOptions()).(interface{ Validate() error }); ok { 182 if err := v.Validate(); err != nil { 183 return HttpProtocolOptions_ExplicitHttpConfigValidationError{ 184 field: "HttpProtocolOptions", 185 reason: "embedded message failed validation", 186 cause: err, 187 } 188 } 189 } 190 191 case *HttpProtocolOptions_ExplicitHttpConfig_Http2ProtocolOptions: 192 193 if v, ok := interface{}(m.GetHttp2ProtocolOptions()).(interface{ Validate() error }); ok { 194 if err := v.Validate(); err != nil { 195 return HttpProtocolOptions_ExplicitHttpConfigValidationError{ 196 field: "Http2ProtocolOptions", 197 reason: "embedded message failed validation", 198 cause: err, 199 } 200 } 201 } 202 203 case *HttpProtocolOptions_ExplicitHttpConfig_Http3ProtocolOptions: 204 205 if v, ok := interface{}(m.GetHttp3ProtocolOptions()).(interface{ Validate() error }); ok { 206 if err := v.Validate(); err != nil { 207 return HttpProtocolOptions_ExplicitHttpConfigValidationError{ 208 field: "Http3ProtocolOptions", 209 reason: "embedded message failed validation", 210 cause: err, 211 } 212 } 213 } 214 215 default: 216 return HttpProtocolOptions_ExplicitHttpConfigValidationError{ 217 field: "ProtocolConfig", 218 reason: "value is required", 219 } 220 221 } 222 223 return nil 224 } 225 226 // HttpProtocolOptions_ExplicitHttpConfigValidationError is the validation 227 // error returned by HttpProtocolOptions_ExplicitHttpConfig.Validate if the 228 // designated constraints aren't met. 229 type HttpProtocolOptions_ExplicitHttpConfigValidationError struct { 230 field string 231 reason string 232 cause error 233 key bool 234 } 235 236 // Field function returns field value. 237 func (e HttpProtocolOptions_ExplicitHttpConfigValidationError) Field() string { return e.field } 238 239 // Reason function returns reason value. 240 func (e HttpProtocolOptions_ExplicitHttpConfigValidationError) Reason() string { return e.reason } 241 242 // Cause function returns cause value. 243 func (e HttpProtocolOptions_ExplicitHttpConfigValidationError) Cause() error { return e.cause } 244 245 // Key function returns key value. 246 func (e HttpProtocolOptions_ExplicitHttpConfigValidationError) Key() bool { return e.key } 247 248 // ErrorName returns error name. 249 func (e HttpProtocolOptions_ExplicitHttpConfigValidationError) ErrorName() string { 250 return "HttpProtocolOptions_ExplicitHttpConfigValidationError" 251 } 252 253 // Error satisfies the builtin error interface 254 func (e HttpProtocolOptions_ExplicitHttpConfigValidationError) Error() string { 255 cause := "" 256 if e.cause != nil { 257 cause = fmt.Sprintf(" | caused by: %v", e.cause) 258 } 259 260 key := "" 261 if e.key { 262 key = "key for " 263 } 264 265 return fmt.Sprintf( 266 "invalid %sHttpProtocolOptions_ExplicitHttpConfig.%s: %s%s", 267 key, 268 e.field, 269 e.reason, 270 cause) 271 } 272 273 var _ error = HttpProtocolOptions_ExplicitHttpConfigValidationError{} 274 275 var _ interface { 276 Field() string 277 Reason() string 278 Key() bool 279 Cause() error 280 ErrorName() string 281 } = HttpProtocolOptions_ExplicitHttpConfigValidationError{} 282 283 // Validate checks the field values on 284 // HttpProtocolOptions_UseDownstreamHttpConfig with the rules defined in the 285 // proto definition for this message. If any rules are violated, an error is returned. 286 func (m *HttpProtocolOptions_UseDownstreamHttpConfig) Validate() error { 287 if m == nil { 288 return nil 289 } 290 291 if v, ok := interface{}(m.GetHttpProtocolOptions()).(interface{ Validate() error }); ok { 292 if err := v.Validate(); err != nil { 293 return HttpProtocolOptions_UseDownstreamHttpConfigValidationError{ 294 field: "HttpProtocolOptions", 295 reason: "embedded message failed validation", 296 cause: err, 297 } 298 } 299 } 300 301 if v, ok := interface{}(m.GetHttp2ProtocolOptions()).(interface{ Validate() error }); ok { 302 if err := v.Validate(); err != nil { 303 return HttpProtocolOptions_UseDownstreamHttpConfigValidationError{ 304 field: "Http2ProtocolOptions", 305 reason: "embedded message failed validation", 306 cause: err, 307 } 308 } 309 } 310 311 if v, ok := interface{}(m.GetHttp3ProtocolOptions()).(interface{ Validate() error }); ok { 312 if err := v.Validate(); err != nil { 313 return HttpProtocolOptions_UseDownstreamHttpConfigValidationError{ 314 field: "Http3ProtocolOptions", 315 reason: "embedded message failed validation", 316 cause: err, 317 } 318 } 319 } 320 321 return nil 322 } 323 324 // HttpProtocolOptions_UseDownstreamHttpConfigValidationError is the validation 325 // error returned by HttpProtocolOptions_UseDownstreamHttpConfig.Validate if 326 // the designated constraints aren't met. 327 type HttpProtocolOptions_UseDownstreamHttpConfigValidationError struct { 328 field string 329 reason string 330 cause error 331 key bool 332 } 333 334 // Field function returns field value. 335 func (e HttpProtocolOptions_UseDownstreamHttpConfigValidationError) Field() string { return e.field } 336 337 // Reason function returns reason value. 338 func (e HttpProtocolOptions_UseDownstreamHttpConfigValidationError) Reason() string { return e.reason } 339 340 // Cause function returns cause value. 341 func (e HttpProtocolOptions_UseDownstreamHttpConfigValidationError) Cause() error { return e.cause } 342 343 // Key function returns key value. 344 func (e HttpProtocolOptions_UseDownstreamHttpConfigValidationError) Key() bool { return e.key } 345 346 // ErrorName returns error name. 347 func (e HttpProtocolOptions_UseDownstreamHttpConfigValidationError) ErrorName() string { 348 return "HttpProtocolOptions_UseDownstreamHttpConfigValidationError" 349 } 350 351 // Error satisfies the builtin error interface 352 func (e HttpProtocolOptions_UseDownstreamHttpConfigValidationError) Error() string { 353 cause := "" 354 if e.cause != nil { 355 cause = fmt.Sprintf(" | caused by: %v", e.cause) 356 } 357 358 key := "" 359 if e.key { 360 key = "key for " 361 } 362 363 return fmt.Sprintf( 364 "invalid %sHttpProtocolOptions_UseDownstreamHttpConfig.%s: %s%s", 365 key, 366 e.field, 367 e.reason, 368 cause) 369 } 370 371 var _ error = HttpProtocolOptions_UseDownstreamHttpConfigValidationError{} 372 373 var _ interface { 374 Field() string 375 Reason() string 376 Key() bool 377 Cause() error 378 ErrorName() string 379 } = HttpProtocolOptions_UseDownstreamHttpConfigValidationError{} 380 381 // Validate checks the field values on HttpProtocolOptions_AutoHttpConfig with 382 // the rules defined in the proto definition for this message. If any rules 383 // are violated, an error is returned. 384 func (m *HttpProtocolOptions_AutoHttpConfig) Validate() error { 385 if m == nil { 386 return nil 387 } 388 389 if v, ok := interface{}(m.GetHttpProtocolOptions()).(interface{ Validate() error }); ok { 390 if err := v.Validate(); err != nil { 391 return HttpProtocolOptions_AutoHttpConfigValidationError{ 392 field: "HttpProtocolOptions", 393 reason: "embedded message failed validation", 394 cause: err, 395 } 396 } 397 } 398 399 if v, ok := interface{}(m.GetHttp2ProtocolOptions()).(interface{ Validate() error }); ok { 400 if err := v.Validate(); err != nil { 401 return HttpProtocolOptions_AutoHttpConfigValidationError{ 402 field: "Http2ProtocolOptions", 403 reason: "embedded message failed validation", 404 cause: err, 405 } 406 } 407 } 408 409 if v, ok := interface{}(m.GetHttp3ProtocolOptions()).(interface{ Validate() error }); ok { 410 if err := v.Validate(); err != nil { 411 return HttpProtocolOptions_AutoHttpConfigValidationError{ 412 field: "Http3ProtocolOptions", 413 reason: "embedded message failed validation", 414 cause: err, 415 } 416 } 417 } 418 419 if v, ok := interface{}(m.GetAlternateProtocolsCacheOptions()).(interface{ Validate() error }); ok { 420 if err := v.Validate(); err != nil { 421 return HttpProtocolOptions_AutoHttpConfigValidationError{ 422 field: "AlternateProtocolsCacheOptions", 423 reason: "embedded message failed validation", 424 cause: err, 425 } 426 } 427 } 428 429 return nil 430 } 431 432 // HttpProtocolOptions_AutoHttpConfigValidationError is the validation error 433 // returned by HttpProtocolOptions_AutoHttpConfig.Validate if the designated 434 // constraints aren't met. 435 type HttpProtocolOptions_AutoHttpConfigValidationError struct { 436 field string 437 reason string 438 cause error 439 key bool 440 } 441 442 // Field function returns field value. 443 func (e HttpProtocolOptions_AutoHttpConfigValidationError) Field() string { return e.field } 444 445 // Reason function returns reason value. 446 func (e HttpProtocolOptions_AutoHttpConfigValidationError) Reason() string { return e.reason } 447 448 // Cause function returns cause value. 449 func (e HttpProtocolOptions_AutoHttpConfigValidationError) Cause() error { return e.cause } 450 451 // Key function returns key value. 452 func (e HttpProtocolOptions_AutoHttpConfigValidationError) Key() bool { return e.key } 453 454 // ErrorName returns error name. 455 func (e HttpProtocolOptions_AutoHttpConfigValidationError) ErrorName() string { 456 return "HttpProtocolOptions_AutoHttpConfigValidationError" 457 } 458 459 // Error satisfies the builtin error interface 460 func (e HttpProtocolOptions_AutoHttpConfigValidationError) Error() string { 461 cause := "" 462 if e.cause != nil { 463 cause = fmt.Sprintf(" | caused by: %v", e.cause) 464 } 465 466 key := "" 467 if e.key { 468 key = "key for " 469 } 470 471 return fmt.Sprintf( 472 "invalid %sHttpProtocolOptions_AutoHttpConfig.%s: %s%s", 473 key, 474 e.field, 475 e.reason, 476 cause) 477 } 478 479 var _ error = HttpProtocolOptions_AutoHttpConfigValidationError{} 480 481 var _ interface { 482 Field() string 483 Reason() string 484 Key() bool 485 Cause() error 486 ErrorName() string 487 } = HttpProtocolOptions_AutoHttpConfigValidationError{}