1// Code generated by protoc-gen-validate. DO NOT EDIT. 2// source: envoy/config/route/v3/route_components.proto 3 4package envoy_config_route_v3 5 6import ( 7 "bytes" 8 "errors" 9 "fmt" 10 "net" 11 "net/mail" 12 "net/url" 13 "regexp" 14 "sort" 15 "strings" 16 "time" 17 "unicode/utf8" 18 19 "google.golang.org/protobuf/types/known/anypb" 20 21 v3 "github.com/envoyproxy/go-control-plane/envoy/config/core/v3" 22) 23 24// ensure the imports are used 25var ( 26 _ = bytes.MinRead 27 _ = errors.New("") 28 _ = fmt.Print 29 _ = utf8.UTFMax 30 _ = (*regexp.Regexp)(nil) 31 _ = (*strings.Reader)(nil) 32 _ = net.IPv4len 33 _ = time.Duration(0) 34 _ = (*url.URL)(nil) 35 _ = (*mail.Address)(nil) 36 _ = anypb.Any{} 37 _ = sort.Sort 38 39 _ = v3.RoutingPriority(0) 40) 41 42// Validate checks the field values on VirtualHost with the rules defined in 43// the proto definition for this message. If any rules are violated, the first 44// error encountered is returned, or nil if there are no violations. 45func (m *VirtualHost) Validate() error { 46 return m.validate(false) 47} 48 49// ValidateAll checks the field values on VirtualHost with the rules defined in 50// the proto definition for this message. If any rules are violated, the 51// result is a list of violation errors wrapped in VirtualHostMultiError, or 52// nil if none found. 53func (m *VirtualHost) ValidateAll() error { 54 return m.validate(true) 55} 56 57func (m *VirtualHost) validate(all bool) error { 58 if m == nil { 59 return nil 60 } 61 62 var errors []error 63 64 if utf8.RuneCountInString(m.GetName()) < 1 { 65 err := VirtualHostValidationError{ 66 field: "Name", 67 reason: "value length must be at least 1 runes", 68 } 69 if !all { 70 return err 71 } 72 errors = append(errors, err) 73 } 74 75 if len(m.GetDomains()) < 1 { 76 err := VirtualHostValidationError{ 77 field: "Domains", 78 reason: "value must contain at least 1 item(s)", 79 } 80 if !all { 81 return err 82 } 83 errors = append(errors, err) 84 } 85 86 for idx, item := range m.GetDomains() { 87 _, _ = idx, item 88 89 if !_VirtualHost_Domains_Pattern.MatchString(item) { 90 err := VirtualHostValidationError{ 91 field: fmt.Sprintf("Domains[%v]", idx), 92 reason: "value does not match regex pattern \"^[^\\x00\\n\\r]*$\"", 93 } 94 if !all { 95 return err 96 } 97 errors = append(errors, err) 98 } 99 100 } 101 102 for idx, item := range m.GetRoutes() { 103 _, _ = idx, item 104 105 if all { 106 switch v := interface{}(item).(type) { 107 case interface{ ValidateAll() error }: 108 if err := v.ValidateAll(); err != nil { 109 errors = append(errors, VirtualHostValidationError{ 110 field: fmt.Sprintf("Routes[%v]", idx), 111 reason: "embedded message failed validation", 112 cause: err, 113 }) 114 } 115 case interface{ Validate() error }: 116 if err := v.Validate(); err != nil { 117 errors = append(errors, VirtualHostValidationError{ 118 field: fmt.Sprintf("Routes[%v]", idx), 119 reason: "embedded message failed validation", 120 cause: err, 121 }) 122 } 123 } 124 } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { 125 if err := v.Validate(); err != nil { 126 return VirtualHostValidationError{ 127 field: fmt.Sprintf("Routes[%v]", idx), 128 reason: "embedded message failed validation", 129 cause: err, 130 } 131 } 132 } 133 134 } 135 136 if all { 137 switch v := interface{}(m.GetMatcher()).(type) { 138 case interface{ ValidateAll() error }: 139 if err := v.ValidateAll(); err != nil { 140 errors = append(errors, VirtualHostValidationError{ 141 field: "Matcher", 142 reason: "embedded message failed validation", 143 cause: err, 144 }) 145 } 146 case interface{ Validate() error }: 147 if err := v.Validate(); err != nil { 148 errors = append(errors, VirtualHostValidationError{ 149 field: "Matcher", 150 reason: "embedded message failed validation", 151 cause: err, 152 }) 153 } 154 } 155 } else if v, ok := interface{}(m.GetMatcher()).(interface{ Validate() error }); ok { 156 if err := v.Validate(); err != nil { 157 return VirtualHostValidationError{ 158 field: "Matcher", 159 reason: "embedded message failed validation", 160 cause: err, 161 } 162 } 163 } 164 165 if _, ok := VirtualHost_TlsRequirementType_name[int32(m.GetRequireTls())]; !ok { 166 err := VirtualHostValidationError{ 167 field: "RequireTls", 168 reason: "value must be one of the defined enum values", 169 } 170 if !all { 171 return err 172 } 173 errors = append(errors, err) 174 } 175 176 for idx, item := range m.GetVirtualClusters() { 177 _, _ = idx, item 178 179 if all { 180 switch v := interface{}(item).(type) { 181 case interface{ ValidateAll() error }: 182 if err := v.ValidateAll(); err != nil { 183 errors = append(errors, VirtualHostValidationError{ 184 field: fmt.Sprintf("VirtualClusters[%v]", idx), 185 reason: "embedded message failed validation", 186 cause: err, 187 }) 188 } 189 case interface{ Validate() error }: 190 if err := v.Validate(); err != nil { 191 errors = append(errors, VirtualHostValidationError{ 192 field: fmt.Sprintf("VirtualClusters[%v]", idx), 193 reason: "embedded message failed validation", 194 cause: err, 195 }) 196 } 197 } 198 } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { 199 if err := v.Validate(); err != nil { 200 return VirtualHostValidationError{ 201 field: fmt.Sprintf("VirtualClusters[%v]", idx), 202 reason: "embedded message failed validation", 203 cause: err, 204 } 205 } 206 } 207 208 } 209 210 for idx, item := range m.GetRateLimits() { 211 _, _ = idx, item 212 213 if all { 214 switch v := interface{}(item).(type) { 215 case interface{ ValidateAll() error }: 216 if err := v.ValidateAll(); err != nil { 217 errors = append(errors, VirtualHostValidationError{ 218 field: fmt.Sprintf("RateLimits[%v]", idx), 219 reason: "embedded message failed validation", 220 cause: err, 221 }) 222 } 223 case interface{ Validate() error }: 224 if err := v.Validate(); err != nil { 225 errors = append(errors, VirtualHostValidationError{ 226 field: fmt.Sprintf("RateLimits[%v]", idx), 227 reason: "embedded message failed validation", 228 cause: err, 229 }) 230 } 231 } 232 } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { 233 if err := v.Validate(); err != nil { 234 return VirtualHostValidationError{ 235 field: fmt.Sprintf("RateLimits[%v]", idx), 236 reason: "embedded message failed validation", 237 cause: err, 238 } 239 } 240 } 241 242 } 243 244 if len(m.GetRequestHeadersToAdd()) > 1000 { 245 err := VirtualHostValidationError{ 246 field: "RequestHeadersToAdd", 247 reason: "value must contain no more than 1000 item(s)", 248 } 249 if !all { 250 return err 251 } 252 errors = append(errors, err) 253 } 254 255 for idx, item := range m.GetRequestHeadersToAdd() { 256 _, _ = idx, item 257 258 if all { 259 switch v := interface{}(item).(type) { 260 case interface{ ValidateAll() error }: 261 if err := v.ValidateAll(); err != nil { 262 errors = append(errors, VirtualHostValidationError{ 263 field: fmt.Sprintf("RequestHeadersToAdd[%v]", idx), 264 reason: "embedded message failed validation", 265 cause: err, 266 }) 267 } 268 case interface{ Validate() error }: 269 if err := v.Validate(); err != nil { 270 errors = append(errors, VirtualHostValidationError{ 271 field: fmt.Sprintf("RequestHeadersToAdd[%v]", idx), 272 reason: "embedded message failed validation", 273 cause: err, 274 }) 275 } 276 } 277 } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { 278 if err := v.Validate(); err != nil { 279 return VirtualHostValidationError{ 280 field: fmt.Sprintf("RequestHeadersToAdd[%v]", idx), 281 reason: "embedded message failed validation", 282 cause: err, 283 } 284 } 285 } 286 287 } 288 289 for idx, item := range m.GetRequestHeadersToRemove() { 290 _, _ = idx, item 291 292 if utf8.RuneCountInString(item) < 1 { 293 err := VirtualHostValidationError{ 294 field: fmt.Sprintf("RequestHeadersToRemove[%v]", idx), 295 reason: "value length must be at least 1 runes", 296 } 297 if !all { 298 return err 299 } 300 errors = append(errors, err) 301 } 302 303 if !_VirtualHost_RequestHeadersToRemove_Pattern.MatchString(item) { 304 err := VirtualHostValidationError{ 305 field: fmt.Sprintf("RequestHeadersToRemove[%v]", idx), 306 reason: "value does not match regex pattern \"^[^\\x00\\n\\r]*$\"", 307 } 308 if !all { 309 return err 310 } 311 errors = append(errors, err) 312 } 313 314 } 315 316 if len(m.GetResponseHeadersToAdd()) > 1000 { 317 err := VirtualHostValidationError{ 318 field: "ResponseHeadersToAdd", 319 reason: "value must contain no more than 1000 item(s)", 320 } 321 if !all { 322 return err 323 } 324 errors = append(errors, err) 325 } 326 327 for idx, item := range m.GetResponseHeadersToAdd() { 328 _, _ = idx, item 329 330 if all { 331 switch v := interface{}(item).(type) { 332 case interface{ ValidateAll() error }: 333 if err := v.ValidateAll(); err != nil { 334 errors = append(errors, VirtualHostValidationError{ 335 field: fmt.Sprintf("ResponseHeadersToAdd[%v]", idx), 336 reason: "embedded message failed validation", 337 cause: err, 338 }) 339 } 340 case interface{ Validate() error }: 341 if err := v.Validate(); err != nil { 342 errors = append(errors, VirtualHostValidationError{ 343 field: fmt.Sprintf("ResponseHeadersToAdd[%v]", idx), 344 reason: "embedded message failed validation", 345 cause: err, 346 }) 347 } 348 } 349 } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { 350 if err := v.Validate(); err != nil { 351 return VirtualHostValidationError{ 352 field: fmt.Sprintf("ResponseHeadersToAdd[%v]", idx), 353 reason: "embedded message failed validation", 354 cause: err, 355 } 356 } 357 } 358 359 } 360 361 for idx, item := range m.GetResponseHeadersToRemove() { 362 _, _ = idx, item 363 364 if utf8.RuneCountInString(item) < 1 { 365 err := VirtualHostValidationError{ 366 field: fmt.Sprintf("ResponseHeadersToRemove[%v]", idx), 367 reason: "value length must be at least 1 runes", 368 } 369 if !all { 370 return err 371 } 372 errors = append(errors, err) 373 } 374 375 if !_VirtualHost_ResponseHeadersToRemove_Pattern.MatchString(item) { 376 err := VirtualHostValidationError{ 377 field: fmt.Sprintf("ResponseHeadersToRemove[%v]", idx), 378 reason: "value does not match regex pattern \"^[^\\x00\\n\\r]*$\"", 379 } 380 if !all { 381 return err 382 } 383 errors = append(errors, err) 384 } 385 386 } 387 388 if all { 389 switch v := interface{}(m.GetCors()).(type) { 390 case interface{ ValidateAll() error }: 391 if err := v.ValidateAll(); err != nil { 392 errors = append(errors, VirtualHostValidationError{ 393 field: "Cors", 394 reason: "embedded message failed validation", 395 cause: err, 396 }) 397 } 398 case interface{ Validate() error }: 399 if err := v.Validate(); err != nil { 400 errors = append(errors, VirtualHostValidationError{ 401 field: "Cors", 402 reason: "embedded message failed validation", 403 cause: err, 404 }) 405 } 406 } 407 } else if v, ok := interface{}(m.GetCors()).(interface{ Validate() error }); ok { 408 if err := v.Validate(); err != nil { 409 return VirtualHostValidationError{ 410 field: "Cors", 411 reason: "embedded message failed validation", 412 cause: err, 413 } 414 } 415 } 416 417 { 418 sorted_keys := make([]string, len(m.GetTypedPerFilterConfig())) 419 i := 0 420 for key := range m.GetTypedPerFilterConfig() { 421 sorted_keys[i] = key 422 i++ 423 } 424 sort.Slice(sorted_keys, func(i, j int) bool { return sorted_keys[i] < sorted_keys[j] }) 425 for _, key := range sorted_keys { 426 val := m.GetTypedPerFilterConfig()[key] 427 _ = val 428 429 // no validation rules for TypedPerFilterConfig[key] 430 431 if all { 432 switch v := interface{}(val).(type) { 433 case interface{ ValidateAll() error }: 434 if err := v.ValidateAll(); err != nil { 435 errors = append(errors, VirtualHostValidationError{ 436 field: fmt.Sprintf("TypedPerFilterConfig[%v]", key), 437 reason: "embedded message failed validation", 438 cause: err, 439 }) 440 } 441 case interface{ Validate() error }: 442 if err := v.Validate(); err != nil { 443 errors = append(errors, VirtualHostValidationError{ 444 field: fmt.Sprintf("TypedPerFilterConfig[%v]", key), 445 reason: "embedded message failed validation", 446 cause: err, 447 }) 448 } 449 } 450 } else if v, ok := interface{}(val).(interface{ Validate() error }); ok { 451 if err := v.Validate(); err != nil { 452 return VirtualHostValidationError{ 453 field: fmt.Sprintf("TypedPerFilterConfig[%v]", key), 454 reason: "embedded message failed validation", 455 cause: err, 456 } 457 } 458 } 459 460 } 461 } 462 463 // no validation rules for IncludeRequestAttemptCount 464 465 // no validation rules for IncludeAttemptCountInResponse 466 467 if all { 468 switch v := interface{}(m.GetRetryPolicy()).(type) { 469 case interface{ ValidateAll() error }: 470 if err := v.ValidateAll(); err != nil { 471 errors = append(errors, VirtualHostValidationError{ 472 field: "RetryPolicy", 473 reason: "embedded message failed validation", 474 cause: err, 475 }) 476 } 477 case interface{ Validate() error }: 478 if err := v.Validate(); err != nil { 479 errors = append(errors, VirtualHostValidationError{ 480 field: "RetryPolicy", 481 reason: "embedded message failed validation", 482 cause: err, 483 }) 484 } 485 } 486 } else if v, ok := interface{}(m.GetRetryPolicy()).(interface{ Validate() error }); ok { 487 if err := v.Validate(); err != nil { 488 return VirtualHostValidationError{ 489 field: "RetryPolicy", 490 reason: "embedded message failed validation", 491 cause: err, 492 } 493 } 494 } 495 496 if all { 497 switch v := interface{}(m.GetRetryPolicyTypedConfig()).(type) { 498 case interface{ ValidateAll() error }: 499 if err := v.ValidateAll(); err != nil { 500 errors = append(errors, VirtualHostValidationError{ 501 field: "RetryPolicyTypedConfig", 502 reason: "embedded message failed validation", 503 cause: err, 504 }) 505 } 506 case interface{ Validate() error }: 507 if err := v.Validate(); err != nil { 508 errors = append(errors, VirtualHostValidationError{ 509 field: "RetryPolicyTypedConfig", 510 reason: "embedded message failed validation", 511 cause: err, 512 }) 513 } 514 } 515 } else if v, ok := interface{}(m.GetRetryPolicyTypedConfig()).(interface{ Validate() error }); ok { 516 if err := v.Validate(); err != nil { 517 return VirtualHostValidationError{ 518 field: "RetryPolicyTypedConfig", 519 reason: "embedded message failed validation", 520 cause: err, 521 } 522 } 523 } 524 525 if all { 526 switch v := interface{}(m.GetHedgePolicy()).(type) { 527 case interface{ ValidateAll() error }: 528 if err := v.ValidateAll(); err != nil { 529 errors = append(errors, VirtualHostValidationError{ 530 field: "HedgePolicy", 531 reason: "embedded message failed validation", 532 cause: err, 533 }) 534 } 535 case interface{ Validate() error }: 536 if err := v.Validate(); err != nil { 537 errors = append(errors, VirtualHostValidationError{ 538 field: "HedgePolicy", 539 reason: "embedded message failed validation", 540 cause: err, 541 }) 542 } 543 } 544 } else if v, ok := interface{}(m.GetHedgePolicy()).(interface{ Validate() error }); ok { 545 if err := v.Validate(); err != nil { 546 return VirtualHostValidationError{ 547 field: "HedgePolicy", 548 reason: "embedded message failed validation", 549 cause: err, 550 } 551 } 552 } 553 554 if all { 555 switch v := interface{}(m.GetPerRequestBufferLimitBytes()).(type) { 556 case interface{ ValidateAll() error }: 557 if err := v.ValidateAll(); err != nil { 558 errors = append(errors, VirtualHostValidationError{ 559 field: "PerRequestBufferLimitBytes", 560 reason: "embedded message failed validation", 561 cause: err, 562 }) 563 } 564 case interface{ Validate() error }: 565 if err := v.Validate(); err != nil { 566 errors = append(errors, VirtualHostValidationError{ 567 field: "PerRequestBufferLimitBytes", 568 reason: "embedded message failed validation", 569 cause: err, 570 }) 571 } 572 } 573 } else if v, ok := interface{}(m.GetPerRequestBufferLimitBytes()).(interface{ Validate() error }); ok { 574 if err := v.Validate(); err != nil { 575 return VirtualHostValidationError{ 576 field: "PerRequestBufferLimitBytes", 577 reason: "embedded message failed validation", 578 cause: err, 579 } 580 } 581 } 582 583 if len(errors) > 0 { 584 return VirtualHostMultiError(errors) 585 } 586 return nil 587} 588 589// VirtualHostMultiError is an error wrapping multiple validation errors 590// returned by VirtualHost.ValidateAll() if the designated constraints aren't met. 591type VirtualHostMultiError []error 592 593// Error returns a concatenation of all the error messages it wraps. 594func (m VirtualHostMultiError) Error() string { 595 var msgs []string 596 for _, err := range m { 597 msgs = append(msgs, err.Error()) 598 } 599 return strings.Join(msgs, "; ") 600} 601 602// AllErrors returns a list of validation violation errors. 603func (m VirtualHostMultiError) AllErrors() []error { return m } 604 605// VirtualHostValidationError is the validation error returned by 606// VirtualHost.Validate if the designated constraints aren't met. 607type VirtualHostValidationError struct { 608 field string 609 reason string 610 cause error 611 key bool 612} 613 614// Field function returns field value. 615func (e VirtualHostValidationError) Field() string { return e.field } 616 617// Reason function returns reason value. 618func (e VirtualHostValidationError) Reason() string { return e.reason } 619 620// Cause function returns cause value. 621func (e VirtualHostValidationError) Cause() error { return e.cause } 622 623// Key function returns key value. 624func (e VirtualHostValidationError) Key() bool { return e.key } 625 626// ErrorName returns error name. 627func (e VirtualHostValidationError) ErrorName() string { return "VirtualHostValidationError" } 628 629// Error satisfies the builtin error interface 630func (e VirtualHostValidationError) Error() string { 631 cause := "" 632 if e.cause != nil { 633 cause = fmt.Sprintf(" | caused by: %v", e.cause) 634 } 635 636 key := "" 637 if e.key { 638 key = "key for " 639 } 640 641 return fmt.Sprintf( 642 "invalid %sVirtualHost.%s: %s%s", 643 key, 644 e.field, 645 e.reason, 646 cause) 647} 648 649var _ error = VirtualHostValidationError{} 650 651var _ interface { 652 Field() string 653 Reason() string 654 Key() bool 655 Cause() error 656 ErrorName() string 657} = VirtualHostValidationError{} 658 659var _VirtualHost_Domains_Pattern = regexp.MustCompile("^[^\x00\n\r]*$") 660 661var _VirtualHost_RequestHeadersToRemove_Pattern = regexp.MustCompile("^[^\x00\n\r]*$") 662 663var _VirtualHost_ResponseHeadersToRemove_Pattern = regexp.MustCompile("^[^\x00\n\r]*$") 664 665// Validate checks the field values on FilterAction with the rules defined in 666// the proto definition for this message. If any rules are violated, the first 667// error encountered is returned, or nil if there are no violations. 668func (m *FilterAction) Validate() error { 669 return m.validate(false) 670} 671 672// ValidateAll checks the field values on FilterAction with the rules defined 673// in the proto definition for this message. If any rules are violated, the 674// result is a list of violation errors wrapped in FilterActionMultiError, or 675// nil if none found. 676func (m *FilterAction) ValidateAll() error { 677 return m.validate(true) 678} 679 680func (m *FilterAction) validate(all bool) error { 681 if m == nil { 682 return nil 683 } 684 685 var errors []error 686 687 if all { 688 switch v := interface{}(m.GetAction()).(type) { 689 case interface{ ValidateAll() error }: 690 if err := v.ValidateAll(); err != nil { 691 errors = append(errors, FilterActionValidationError{ 692 field: "Action", 693 reason: "embedded message failed validation", 694 cause: err, 695 }) 696 } 697 case interface{ Validate() error }: 698 if err := v.Validate(); err != nil { 699 errors = append(errors, FilterActionValidationError{ 700 field: "Action", 701 reason: "embedded message failed validation", 702 cause: err, 703 }) 704 } 705 } 706 } else if v, ok := interface{}(m.GetAction()).(interface{ Validate() error }); ok { 707 if err := v.Validate(); err != nil { 708 return FilterActionValidationError{ 709 field: "Action", 710 reason: "embedded message failed validation", 711 cause: err, 712 } 713 } 714 } 715 716 if len(errors) > 0 { 717 return FilterActionMultiError(errors) 718 } 719 return nil 720} 721 722// FilterActionMultiError is an error wrapping multiple validation errors 723// returned by FilterAction.ValidateAll() if the designated constraints aren't met. 724type FilterActionMultiError []error 725 726// Error returns a concatenation of all the error messages it wraps. 727func (m FilterActionMultiError) Error() string { 728 var msgs []string 729 for _, err := range m { 730 msgs = append(msgs, err.Error()) 731 } 732 return strings.Join(msgs, "; ") 733} 734 735// AllErrors returns a list of validation violation errors. 736func (m FilterActionMultiError) AllErrors() []error { return m } 737 738// FilterActionValidationError is the validation error returned by 739// FilterAction.Validate if the designated constraints aren't met. 740type FilterActionValidationError struct { 741 field string 742 reason string 743 cause error 744 key bool 745} 746 747// Field function returns field value. 748func (e FilterActionValidationError) Field() string { return e.field } 749 750// Reason function returns reason value. 751func (e FilterActionValidationError) Reason() string { return e.reason } 752 753// Cause function returns cause value. 754func (e FilterActionValidationError) Cause() error { return e.cause } 755 756// Key function returns key value. 757func (e FilterActionValidationError) Key() bool { return e.key } 758 759// ErrorName returns error name. 760func (e FilterActionValidationError) ErrorName() string { return "FilterActionValidationError" } 761 762// Error satisfies the builtin error interface 763func (e FilterActionValidationError) Error() string { 764 cause := "" 765 if e.cause != nil { 766 cause = fmt.Sprintf(" | caused by: %v", e.cause) 767 } 768 769 key := "" 770 if e.key { 771 key = "key for " 772 } 773 774 return fmt.Sprintf( 775 "invalid %sFilterAction.%s: %s%s", 776 key, 777 e.field, 778 e.reason, 779 cause) 780} 781 782var _ error = FilterActionValidationError{} 783 784var _ interface { 785 Field() string 786 Reason() string 787 Key() bool 788 Cause() error 789 ErrorName() string 790} = FilterActionValidationError{} 791 792// Validate checks the field values on Route with the rules defined in the 793// proto definition for this message. If any rules are violated, the first 794// error encountered is returned, or nil if there are no violations. 795func (m *Route) Validate() error { 796 return m.validate(false) 797} 798 799// ValidateAll checks the field values on Route with the rules defined in the 800// proto definition for this message. If any rules are violated, the result is 801// a list of violation errors wrapped in RouteMultiError, or nil if none found. 802func (m *Route) ValidateAll() error { 803 return m.validate(true) 804} 805 806func (m *Route) validate(all bool) error { 807 if m == nil { 808 return nil 809 } 810 811 var errors []error 812 813 // no validation rules for Name 814 815 if m.GetMatch() == nil { 816 err := RouteValidationError{ 817 field: "Match", 818 reason: "value is required", 819 } 820 if !all { 821 return err 822 } 823 errors = append(errors, err) 824 } 825 826 if all { 827 switch v := interface{}(m.GetMatch()).(type) { 828 case interface{ ValidateAll() error }: 829 if err := v.ValidateAll(); err != nil { 830 errors = append(errors, RouteValidationError{ 831 field: "Match", 832 reason: "embedded message failed validation", 833 cause: err, 834 }) 835 } 836 case interface{ Validate() error }: 837 if err := v.Validate(); err != nil { 838 errors = append(errors, RouteValidationError{ 839 field: "Match", 840 reason: "embedded message failed validation", 841 cause: err, 842 }) 843 } 844 } 845 } else if v, ok := interface{}(m.GetMatch()).(interface{ Validate() error }); ok { 846 if err := v.Validate(); err != nil { 847 return RouteValidationError{ 848 field: "Match", 849 reason: "embedded message failed validation", 850 cause: err, 851 } 852 } 853 } 854 855 if all { 856 switch v := interface{}(m.GetMetadata()).(type) { 857 case interface{ ValidateAll() error }: 858 if err := v.ValidateAll(); err != nil { 859 errors = append(errors, RouteValidationError{ 860 field: "Metadata", 861 reason: "embedded message failed validation", 862 cause: err, 863 }) 864 } 865 case interface{ Validate() error }: 866 if err := v.Validate(); err != nil { 867 errors = append(errors, RouteValidationError{ 868 field: "Metadata", 869 reason: "embedded message failed validation", 870 cause: err, 871 }) 872 } 873 } 874 } else if v, ok := interface{}(m.GetMetadata()).(interface{ Validate() error }); ok { 875 if err := v.Validate(); err != nil { 876 return RouteValidationError{ 877 field: "Metadata", 878 reason: "embedded message failed validation", 879 cause: err, 880 } 881 } 882 } 883 884 if all { 885 switch v := interface{}(m.GetDecorator()).(type) { 886 case interface{ ValidateAll() error }: 887 if err := v.ValidateAll(); err != nil { 888 errors = append(errors, RouteValidationError{ 889 field: "Decorator", 890 reason: "embedded message failed validation", 891 cause: err, 892 }) 893 } 894 case interface{ Validate() error }: 895 if err := v.Validate(); err != nil { 896 errors = append(errors, RouteValidationError{ 897 field: "Decorator", 898 reason: "embedded message failed validation", 899 cause: err, 900 }) 901 } 902 } 903 } else if v, ok := interface{}(m.GetDecorator()).(interface{ Validate() error }); ok { 904 if err := v.Validate(); err != nil { 905 return RouteValidationError{ 906 field: "Decorator", 907 reason: "embedded message failed validation", 908 cause: err, 909 } 910 } 911 } 912 913 { 914 sorted_keys := make([]string, len(m.GetTypedPerFilterConfig())) 915 i := 0 916 for key := range m.GetTypedPerFilterConfig() { 917 sorted_keys[i] = key 918 i++ 919 } 920 sort.Slice(sorted_keys, func(i, j int) bool { return sorted_keys[i] < sorted_keys[j] }) 921 for _, key := range sorted_keys { 922 val := m.GetTypedPerFilterConfig()[key] 923 _ = val 924 925 // no validation rules for TypedPerFilterConfig[key] 926 927 if all { 928 switch v := interface{}(val).(type) { 929 case interface{ ValidateAll() error }: 930 if err := v.ValidateAll(); err != nil { 931 errors = append(errors, RouteValidationError{ 932 field: fmt.Sprintf("TypedPerFilterConfig[%v]", key), 933 reason: "embedded message failed validation", 934 cause: err, 935 }) 936 } 937 case interface{ Validate() error }: 938 if err := v.Validate(); err != nil { 939 errors = append(errors, RouteValidationError{ 940 field: fmt.Sprintf("TypedPerFilterConfig[%v]", key), 941 reason: "embedded message failed validation", 942 cause: err, 943 }) 944 } 945 } 946 } else if v, ok := interface{}(val).(interface{ Validate() error }); ok { 947 if err := v.Validate(); err != nil { 948 return RouteValidationError{ 949 field: fmt.Sprintf("TypedPerFilterConfig[%v]", key), 950 reason: "embedded message failed validation", 951 cause: err, 952 } 953 } 954 } 955 956 } 957 } 958 959 if len(m.GetRequestHeadersToAdd()) > 1000 { 960 err := RouteValidationError{ 961 field: "RequestHeadersToAdd", 962 reason: "value must contain no more than 1000 item(s)", 963 } 964 if !all { 965 return err 966 } 967 errors = append(errors, err) 968 } 969 970 for idx, item := range m.GetRequestHeadersToAdd() { 971 _, _ = idx, item 972 973 if all { 974 switch v := interface{}(item).(type) { 975 case interface{ ValidateAll() error }: 976 if err := v.ValidateAll(); err != nil { 977 errors = append(errors, RouteValidationError{ 978 field: fmt.Sprintf("RequestHeadersToAdd[%v]", idx), 979 reason: "embedded message failed validation", 980 cause: err, 981 }) 982 } 983 case interface{ Validate() error }: 984 if err := v.Validate(); err != nil { 985 errors = append(errors, RouteValidationError{ 986 field: fmt.Sprintf("RequestHeadersToAdd[%v]", idx), 987 reason: "embedded message failed validation", 988 cause: err, 989 }) 990 } 991 } 992 } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { 993 if err := v.Validate(); err != nil { 994 return RouteValidationError{ 995 field: fmt.Sprintf("RequestHeadersToAdd[%v]", idx), 996 reason: "embedded message failed validation", 997 cause: err, 998 } 999 } 1000 } 1001 1002 } 1003 1004 for idx, item := range m.GetRequestHeadersToRemove() { 1005 _, _ = idx, item 1006 1007 if utf8.RuneCountInString(item) < 1 { 1008 err := RouteValidationError{ 1009 field: fmt.Sprintf("RequestHeadersToRemove[%v]", idx), 1010 reason: "value length must be at least 1 runes", 1011 } 1012 if !all { 1013 return err 1014 } 1015 errors = append(errors, err) 1016 } 1017 1018 if !_Route_RequestHeadersToRemove_Pattern.MatchString(item) { 1019 err := RouteValidationError{ 1020 field: fmt.Sprintf("RequestHeadersToRemove[%v]", idx), 1021 reason: "value does not match regex pattern \"^[^\\x00\\n\\r]*$\"", 1022 } 1023 if !all { 1024 return err 1025 } 1026 errors = append(errors, err) 1027 } 1028 1029 } 1030 1031 if len(m.GetResponseHeadersToAdd()) > 1000 { 1032 err := RouteValidationError{ 1033 field: "ResponseHeadersToAdd", 1034 reason: "value must contain no more than 1000 item(s)", 1035 } 1036 if !all { 1037 return err 1038 } 1039 errors = append(errors, err) 1040 } 1041 1042 for idx, item := range m.GetResponseHeadersToAdd() { 1043 _, _ = idx, item 1044 1045 if all { 1046 switch v := interface{}(item).(type) { 1047 case interface{ ValidateAll() error }: 1048 if err := v.ValidateAll(); err != nil { 1049 errors = append(errors, RouteValidationError{ 1050 field: fmt.Sprintf("ResponseHeadersToAdd[%v]", idx), 1051 reason: "embedded message failed validation", 1052 cause: err, 1053 }) 1054 } 1055 case interface{ Validate() error }: 1056 if err := v.Validate(); err != nil { 1057 errors = append(errors, RouteValidationError{ 1058 field: fmt.Sprintf("ResponseHeadersToAdd[%v]", idx), 1059 reason: "embedded message failed validation", 1060 cause: err, 1061 }) 1062 } 1063 } 1064 } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { 1065 if err := v.Validate(); err != nil { 1066 return RouteValidationError{ 1067 field: fmt.Sprintf("ResponseHeadersToAdd[%v]", idx), 1068 reason: "embedded message failed validation", 1069 cause: err, 1070 } 1071 } 1072 } 1073 1074 } 1075 1076 for idx, item := range m.GetResponseHeadersToRemove() { 1077 _, _ = idx, item 1078 1079 if utf8.RuneCountInString(item) < 1 { 1080 err := RouteValidationError{ 1081 field: fmt.Sprintf("ResponseHeadersToRemove[%v]", idx), 1082 reason: "value length must be at least 1 runes", 1083 } 1084 if !all { 1085 return err 1086 } 1087 errors = append(errors, err) 1088 } 1089 1090 if !_Route_ResponseHeadersToRemove_Pattern.MatchString(item) { 1091 err := RouteValidationError{ 1092 field: fmt.Sprintf("ResponseHeadersToRemove[%v]", idx), 1093 reason: "value does not match regex pattern \"^[^\\x00\\n\\r]*$\"", 1094 } 1095 if !all { 1096 return err 1097 } 1098 errors = append(errors, err) 1099 } 1100 1101 } 1102 1103 if all { 1104 switch v := interface{}(m.GetTracing()).(type) { 1105 case interface{ ValidateAll() error }: 1106 if err := v.ValidateAll(); err != nil { 1107 errors = append(errors, RouteValidationError{ 1108 field: "Tracing", 1109 reason: "embedded message failed validation", 1110 cause: err, 1111 }) 1112 } 1113 case interface{ Validate() error }: 1114 if err := v.Validate(); err != nil { 1115 errors = append(errors, RouteValidationError{ 1116 field: "Tracing", 1117 reason: "embedded message failed validation", 1118 cause: err, 1119 }) 1120 } 1121 } 1122 } else if v, ok := interface{}(m.GetTracing()).(interface{ Validate() error }); ok { 1123 if err := v.Validate(); err != nil { 1124 return RouteValidationError{ 1125 field: "Tracing", 1126 reason: "embedded message failed validation", 1127 cause: err, 1128 } 1129 } 1130 } 1131 1132 if all { 1133 switch v := interface{}(m.GetPerRequestBufferLimitBytes()).(type) { 1134 case interface{ ValidateAll() error }: 1135 if err := v.ValidateAll(); err != nil { 1136 errors = append(errors, RouteValidationError{ 1137 field: "PerRequestBufferLimitBytes", 1138 reason: "embedded message failed validation", 1139 cause: err, 1140 }) 1141 } 1142 case interface{ Validate() error }: 1143 if err := v.Validate(); err != nil { 1144 errors = append(errors, RouteValidationError{ 1145 field: "PerRequestBufferLimitBytes", 1146 reason: "embedded message failed validation", 1147 cause: err, 1148 }) 1149 } 1150 } 1151 } else if v, ok := interface{}(m.GetPerRequestBufferLimitBytes()).(interface{ Validate() error }); ok { 1152 if err := v.Validate(); err != nil { 1153 return RouteValidationError{ 1154 field: "PerRequestBufferLimitBytes", 1155 reason: "embedded message failed validation", 1156 cause: err, 1157 } 1158 } 1159 } 1160 1161 switch m.Action.(type) { 1162 1163 case *Route_Route: 1164 1165 if all { 1166 switch v := interface{}(m.GetRoute()).(type) { 1167 case interface{ ValidateAll() error }: 1168 if err := v.ValidateAll(); err != nil { 1169 errors = append(errors, RouteValidationError{ 1170 field: "Route", 1171 reason: "embedded message failed validation", 1172 cause: err, 1173 }) 1174 } 1175 case interface{ Validate() error }: 1176 if err := v.Validate(); err != nil { 1177 errors = append(errors, RouteValidationError{ 1178 field: "Route", 1179 reason: "embedded message failed validation", 1180 cause: err, 1181 }) 1182 } 1183 } 1184 } else if v, ok := interface{}(m.GetRoute()).(interface{ Validate() error }); ok { 1185 if err := v.Validate(); err != nil { 1186 return RouteValidationError{ 1187 field: "Route", 1188 reason: "embedded message failed validation", 1189 cause: err, 1190 } 1191 } 1192 } 1193 1194 case *Route_Redirect: 1195 1196 if all { 1197 switch v := interface{}(m.GetRedirect()).(type) { 1198 case interface{ ValidateAll() error }: 1199 if err := v.ValidateAll(); err != nil { 1200 errors = append(errors, RouteValidationError{ 1201 field: "Redirect", 1202 reason: "embedded message failed validation", 1203 cause: err, 1204 }) 1205 } 1206 case interface{ Validate() error }: 1207 if err := v.Validate(); err != nil { 1208 errors = append(errors, RouteValidationError{ 1209 field: "Redirect", 1210 reason: "embedded message failed validation", 1211 cause: err, 1212 }) 1213 } 1214 } 1215 } else if v, ok := interface{}(m.GetRedirect()).(interface{ Validate() error }); ok { 1216 if err := v.Validate(); err != nil { 1217 return RouteValidationError{ 1218 field: "Redirect", 1219 reason: "embedded message failed validation", 1220 cause: err, 1221 } 1222 } 1223 } 1224 1225 case *Route_DirectResponse: 1226 1227 if all { 1228 switch v := interface{}(m.GetDirectResponse()).(type) { 1229 case interface{ ValidateAll() error }: 1230 if err := v.ValidateAll(); err != nil { 1231 errors = append(errors, RouteValidationError{ 1232 field: "DirectResponse", 1233 reason: "embedded message failed validation", 1234 cause: err, 1235 }) 1236 } 1237 case interface{ Validate() error }: 1238 if err := v.Validate(); err != nil { 1239 errors = append(errors, RouteValidationError{ 1240 field: "DirectResponse", 1241 reason: "embedded message failed validation", 1242 cause: err, 1243 }) 1244 } 1245 } 1246 } else if v, ok := interface{}(m.GetDirectResponse()).(interface{ Validate() error }); ok { 1247 if err := v.Validate(); err != nil { 1248 return RouteValidationError{ 1249 field: "DirectResponse", 1250 reason: "embedded message failed validation", 1251 cause: err, 1252 } 1253 } 1254 } 1255 1256 case *Route_FilterAction: 1257 1258 if all { 1259 switch v := interface{}(m.GetFilterAction()).(type) { 1260 case interface{ ValidateAll() error }: 1261 if err := v.ValidateAll(); err != nil { 1262 errors = append(errors, RouteValidationError{ 1263 field: "FilterAction", 1264 reason: "embedded message failed validation", 1265 cause: err, 1266 }) 1267 } 1268 case interface{ Validate() error }: 1269 if err := v.Validate(); err != nil { 1270 errors = append(errors, RouteValidationError{ 1271 field: "FilterAction", 1272 reason: "embedded message failed validation", 1273 cause: err, 1274 }) 1275 } 1276 } 1277 } else if v, ok := interface{}(m.GetFilterAction()).(interface{ Validate() error }); ok { 1278 if err := v.Validate(); err != nil { 1279 return RouteValidationError{ 1280 field: "FilterAction", 1281 reason: "embedded message failed validation", 1282 cause: err, 1283 } 1284 } 1285 } 1286 1287 case *Route_NonForwardingAction: 1288 1289 if all { 1290 switch v := interface{}(m.GetNonForwardingAction()).(type) { 1291 case interface{ ValidateAll() error }: 1292 if err := v.ValidateAll(); err != nil { 1293 errors = append(errors, RouteValidationError{ 1294 field: "NonForwardingAction", 1295 reason: "embedded message failed validation", 1296 cause: err, 1297 }) 1298 } 1299 case interface{ Validate() error }: 1300 if err := v.Validate(); err != nil { 1301 errors = append(errors, RouteValidationError{ 1302 field: "NonForwardingAction", 1303 reason: "embedded message failed validation", 1304 cause: err, 1305 }) 1306 } 1307 } 1308 } else if v, ok := interface{}(m.GetNonForwardingAction()).(interface{ Validate() error }); ok { 1309 if err := v.Validate(); err != nil { 1310 return RouteValidationError{ 1311 field: "NonForwardingAction", 1312 reason: "embedded message failed validation", 1313 cause: err, 1314 } 1315 } 1316 } 1317 1318 default: 1319 err := RouteValidationError{ 1320 field: "Action", 1321 reason: "value is required", 1322 } 1323 if !all { 1324 return err 1325 } 1326 errors = append(errors, err) 1327 1328 } 1329 1330 if len(errors) > 0 { 1331 return RouteMultiError(errors) 1332 } 1333 return nil 1334} 1335 1336// RouteMultiError is an error wrapping multiple validation errors returned by 1337// Route.ValidateAll() if the designated constraints aren't met. 1338type RouteMultiError []error 1339 1340// Error returns a concatenation of all the error messages it wraps. 1341func (m RouteMultiError) Error() string { 1342 var msgs []string 1343 for _, err := range m { 1344 msgs = append(msgs, err.Error()) 1345 } 1346 return strings.Join(msgs, "; ") 1347} 1348 1349// AllErrors returns a list of validation violation errors. 1350func (m RouteMultiError) AllErrors() []error { return m } 1351 1352// RouteValidationError is the validation error returned by Route.Validate if 1353// the designated constraints aren't met. 1354type RouteValidationError struct { 1355 field string 1356 reason string 1357 cause error 1358 key bool 1359} 1360 1361// Field function returns field value. 1362func (e RouteValidationError) Field() string { return e.field } 1363 1364// Reason function returns reason value. 1365func (e RouteValidationError) Reason() string { return e.reason } 1366 1367// Cause function returns cause value. 1368func (e RouteValidationError) Cause() error { return e.cause } 1369 1370// Key function returns key value. 1371func (e RouteValidationError) Key() bool { return e.key } 1372 1373// ErrorName returns error name. 1374func (e RouteValidationError) ErrorName() string { return "RouteValidationError" } 1375 1376// Error satisfies the builtin error interface 1377func (e RouteValidationError) Error() string { 1378 cause := "" 1379 if e.cause != nil { 1380 cause = fmt.Sprintf(" | caused by: %v", e.cause) 1381 } 1382 1383 key := "" 1384 if e.key { 1385 key = "key for " 1386 } 1387 1388 return fmt.Sprintf( 1389 "invalid %sRoute.%s: %s%s", 1390 key, 1391 e.field, 1392 e.reason, 1393 cause) 1394} 1395 1396var _ error = RouteValidationError{} 1397 1398var _ interface { 1399 Field() string 1400 Reason() string 1401 Key() bool 1402 Cause() error 1403 ErrorName() string 1404} = RouteValidationError{} 1405 1406var _Route_RequestHeadersToRemove_Pattern = regexp.MustCompile("^[^\x00\n\r]*$") 1407 1408var _Route_ResponseHeadersToRemove_Pattern = regexp.MustCompile("^[^\x00\n\r]*$") 1409 1410// Validate checks the field values on WeightedCluster with the rules defined 1411// in the proto definition for this message. If any rules are violated, the 1412// first error encountered is returned, or nil if there are no violations. 1413func (m *WeightedCluster) Validate() error { 1414 return m.validate(false) 1415} 1416 1417// ValidateAll checks the field values on WeightedCluster with the rules 1418// defined in the proto definition for this message. If any rules are 1419// violated, the result is a list of violation errors wrapped in 1420// WeightedClusterMultiError, or nil if none found. 1421func (m *WeightedCluster) ValidateAll() error { 1422 return m.validate(true) 1423} 1424 1425func (m *WeightedCluster) validate(all bool) error { 1426 if m == nil { 1427 return nil 1428 } 1429 1430 var errors []error 1431 1432 if len(m.GetClusters()) < 1 { 1433 err := WeightedClusterValidationError{ 1434 field: "Clusters", 1435 reason: "value must contain at least 1 item(s)", 1436 } 1437 if !all { 1438 return err 1439 } 1440 errors = append(errors, err) 1441 } 1442 1443 for idx, item := range m.GetClusters() { 1444 _, _ = idx, item 1445 1446 if all { 1447 switch v := interface{}(item).(type) { 1448 case interface{ ValidateAll() error }: 1449 if err := v.ValidateAll(); err != nil { 1450 errors = append(errors, WeightedClusterValidationError{ 1451 field: fmt.Sprintf("Clusters[%v]", idx), 1452 reason: "embedded message failed validation", 1453 cause: err, 1454 }) 1455 } 1456 case interface{ Validate() error }: 1457 if err := v.Validate(); err != nil { 1458 errors = append(errors, WeightedClusterValidationError{ 1459 field: fmt.Sprintf("Clusters[%v]", idx), 1460 reason: "embedded message failed validation", 1461 cause: err, 1462 }) 1463 } 1464 } 1465 } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { 1466 if err := v.Validate(); err != nil { 1467 return WeightedClusterValidationError{ 1468 field: fmt.Sprintf("Clusters[%v]", idx), 1469 reason: "embedded message failed validation", 1470 cause: err, 1471 } 1472 } 1473 } 1474 1475 } 1476 1477 if wrapper := m.GetTotalWeight(); wrapper != nil { 1478 1479 if wrapper.GetValue() < 1 { 1480 err := WeightedClusterValidationError{ 1481 field: "TotalWeight", 1482 reason: "value must be greater than or equal to 1", 1483 } 1484 if !all { 1485 return err 1486 } 1487 errors = append(errors, err) 1488 } 1489 1490 } 1491 1492 // no validation rules for RuntimeKeyPrefix 1493 1494 if len(errors) > 0 { 1495 return WeightedClusterMultiError(errors) 1496 } 1497 return nil 1498} 1499 1500// WeightedClusterMultiError is an error wrapping multiple validation errors 1501// returned by WeightedCluster.ValidateAll() if the designated constraints 1502// aren't met. 1503type WeightedClusterMultiError []error 1504 1505// Error returns a concatenation of all the error messages it wraps. 1506func (m WeightedClusterMultiError) Error() string { 1507 var msgs []string 1508 for _, err := range m { 1509 msgs = append(msgs, err.Error()) 1510 } 1511 return strings.Join(msgs, "; ") 1512} 1513 1514// AllErrors returns a list of validation violation errors. 1515func (m WeightedClusterMultiError) AllErrors() []error { return m } 1516 1517// WeightedClusterValidationError is the validation error returned by 1518// WeightedCluster.Validate if the designated constraints aren't met. 1519type WeightedClusterValidationError struct { 1520 field string 1521 reason string 1522 cause error 1523 key bool 1524} 1525 1526// Field function returns field value. 1527func (e WeightedClusterValidationError) Field() string { return e.field } 1528 1529// Reason function returns reason value. 1530func (e WeightedClusterValidationError) Reason() string { return e.reason } 1531 1532// Cause function returns cause value. 1533func (e WeightedClusterValidationError) Cause() error { return e.cause } 1534 1535// Key function returns key value. 1536func (e WeightedClusterValidationError) Key() bool { return e.key } 1537 1538// ErrorName returns error name. 1539func (e WeightedClusterValidationError) ErrorName() string { return "WeightedClusterValidationError" } 1540 1541// Error satisfies the builtin error interface 1542func (e WeightedClusterValidationError) Error() string { 1543 cause := "" 1544 if e.cause != nil { 1545 cause = fmt.Sprintf(" | caused by: %v", e.cause) 1546 } 1547 1548 key := "" 1549 if e.key { 1550 key = "key for " 1551 } 1552 1553 return fmt.Sprintf( 1554 "invalid %sWeightedCluster.%s: %s%s", 1555 key, 1556 e.field, 1557 e.reason, 1558 cause) 1559} 1560 1561var _ error = WeightedClusterValidationError{} 1562 1563var _ interface { 1564 Field() string 1565 Reason() string 1566 Key() bool 1567 Cause() error 1568 ErrorName() string 1569} = WeightedClusterValidationError{} 1570 1571// Validate checks the field values on RouteMatch with the rules defined in the 1572// proto definition for this message. If any rules are violated, the first 1573// error encountered is returned, or nil if there are no violations. 1574func (m *RouteMatch) Validate() error { 1575 return m.validate(false) 1576} 1577 1578// ValidateAll checks the field values on RouteMatch with the rules defined in 1579// the proto definition for this message. If any rules are violated, the 1580// result is a list of violation errors wrapped in RouteMatchMultiError, or 1581// nil if none found. 1582func (m *RouteMatch) ValidateAll() error { 1583 return m.validate(true) 1584} 1585 1586func (m *RouteMatch) validate(all bool) error { 1587 if m == nil { 1588 return nil 1589 } 1590 1591 var errors []error 1592 1593 if all { 1594 switch v := interface{}(m.GetCaseSensitive()).(type) { 1595 case interface{ ValidateAll() error }: 1596 if err := v.ValidateAll(); err != nil { 1597 errors = append(errors, RouteMatchValidationError{ 1598 field: "CaseSensitive", 1599 reason: "embedded message failed validation", 1600 cause: err, 1601 }) 1602 } 1603 case interface{ Validate() error }: 1604 if err := v.Validate(); err != nil { 1605 errors = append(errors, RouteMatchValidationError{ 1606 field: "CaseSensitive", 1607 reason: "embedded message failed validation", 1608 cause: err, 1609 }) 1610 } 1611 } 1612 } else if v, ok := interface{}(m.GetCaseSensitive()).(interface{ Validate() error }); ok { 1613 if err := v.Validate(); err != nil { 1614 return RouteMatchValidationError{ 1615 field: "CaseSensitive", 1616 reason: "embedded message failed validation", 1617 cause: err, 1618 } 1619 } 1620 } 1621 1622 if all { 1623 switch v := interface{}(m.GetRuntimeFraction()).(type) { 1624 case interface{ ValidateAll() error }: 1625 if err := v.ValidateAll(); err != nil { 1626 errors = append(errors, RouteMatchValidationError{ 1627 field: "RuntimeFraction", 1628 reason: "embedded message failed validation", 1629 cause: err, 1630 }) 1631 } 1632 case interface{ Validate() error }: 1633 if err := v.Validate(); err != nil { 1634 errors = append(errors, RouteMatchValidationError{ 1635 field: "RuntimeFraction", 1636 reason: "embedded message failed validation", 1637 cause: err, 1638 }) 1639 } 1640 } 1641 } else if v, ok := interface{}(m.GetRuntimeFraction()).(interface{ Validate() error }); ok { 1642 if err := v.Validate(); err != nil { 1643 return RouteMatchValidationError{ 1644 field: "RuntimeFraction", 1645 reason: "embedded message failed validation", 1646 cause: err, 1647 } 1648 } 1649 } 1650 1651 for idx, item := range m.GetHeaders() { 1652 _, _ = idx, item 1653 1654 if all { 1655 switch v := interface{}(item).(type) { 1656 case interface{ ValidateAll() error }: 1657 if err := v.ValidateAll(); err != nil { 1658 errors = append(errors, RouteMatchValidationError{ 1659 field: fmt.Sprintf("Headers[%v]", idx), 1660 reason: "embedded message failed validation", 1661 cause: err, 1662 }) 1663 } 1664 case interface{ Validate() error }: 1665 if err := v.Validate(); err != nil { 1666 errors = append(errors, RouteMatchValidationError{ 1667 field: fmt.Sprintf("Headers[%v]", idx), 1668 reason: "embedded message failed validation", 1669 cause: err, 1670 }) 1671 } 1672 } 1673 } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { 1674 if err := v.Validate(); err != nil { 1675 return RouteMatchValidationError{ 1676 field: fmt.Sprintf("Headers[%v]", idx), 1677 reason: "embedded message failed validation", 1678 cause: err, 1679 } 1680 } 1681 } 1682 1683 } 1684 1685 for idx, item := range m.GetQueryParameters() { 1686 _, _ = idx, item 1687 1688 if all { 1689 switch v := interface{}(item).(type) { 1690 case interface{ ValidateAll() error }: 1691 if err := v.ValidateAll(); err != nil { 1692 errors = append(errors, RouteMatchValidationError{ 1693 field: fmt.Sprintf("QueryParameters[%v]", idx), 1694 reason: "embedded message failed validation", 1695 cause: err, 1696 }) 1697 } 1698 case interface{ Validate() error }: 1699 if err := v.Validate(); err != nil { 1700 errors = append(errors, RouteMatchValidationError{ 1701 field: fmt.Sprintf("QueryParameters[%v]", idx), 1702 reason: "embedded message failed validation", 1703 cause: err, 1704 }) 1705 } 1706 } 1707 } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { 1708 if err := v.Validate(); err != nil { 1709 return RouteMatchValidationError{ 1710 field: fmt.Sprintf("QueryParameters[%v]", idx), 1711 reason: "embedded message failed validation", 1712 cause: err, 1713 } 1714 } 1715 } 1716 1717 } 1718 1719 if all { 1720 switch v := interface{}(m.GetGrpc()).(type) { 1721 case interface{ ValidateAll() error }: 1722 if err := v.ValidateAll(); err != nil { 1723 errors = append(errors, RouteMatchValidationError{ 1724 field: "Grpc", 1725 reason: "embedded message failed validation", 1726 cause: err, 1727 }) 1728 } 1729 case interface{ Validate() error }: 1730 if err := v.Validate(); err != nil { 1731 errors = append(errors, RouteMatchValidationError{ 1732 field: "Grpc", 1733 reason: "embedded message failed validation", 1734 cause: err, 1735 }) 1736 } 1737 } 1738 } else if v, ok := interface{}(m.GetGrpc()).(interface{ Validate() error }); ok { 1739 if err := v.Validate(); err != nil { 1740 return RouteMatchValidationError{ 1741 field: "Grpc", 1742 reason: "embedded message failed validation", 1743 cause: err, 1744 } 1745 } 1746 } 1747 1748 if all { 1749 switch v := interface{}(m.GetTlsContext()).(type) { 1750 case interface{ ValidateAll() error }: 1751 if err := v.ValidateAll(); err != nil { 1752 errors = append(errors, RouteMatchValidationError{ 1753 field: "TlsContext", 1754 reason: "embedded message failed validation", 1755 cause: err, 1756 }) 1757 } 1758 case interface{ Validate() error }: 1759 if err := v.Validate(); err != nil { 1760 errors = append(errors, RouteMatchValidationError{ 1761 field: "TlsContext", 1762 reason: "embedded message failed validation", 1763 cause: err, 1764 }) 1765 } 1766 } 1767 } else if v, ok := interface{}(m.GetTlsContext()).(interface{ Validate() error }); ok { 1768 if err := v.Validate(); err != nil { 1769 return RouteMatchValidationError{ 1770 field: "TlsContext", 1771 reason: "embedded message failed validation", 1772 cause: err, 1773 } 1774 } 1775 } 1776 1777 for idx, item := range m.GetDynamicMetadata() { 1778 _, _ = idx, item 1779 1780 if all { 1781 switch v := interface{}(item).(type) { 1782 case interface{ ValidateAll() error }: 1783 if err := v.ValidateAll(); err != nil { 1784 errors = append(errors, RouteMatchValidationError{ 1785 field: fmt.Sprintf("DynamicMetadata[%v]", idx), 1786 reason: "embedded message failed validation", 1787 cause: err, 1788 }) 1789 } 1790 case interface{ Validate() error }: 1791 if err := v.Validate(); err != nil { 1792 errors = append(errors, RouteMatchValidationError{ 1793 field: fmt.Sprintf("DynamicMetadata[%v]", idx), 1794 reason: "embedded message failed validation", 1795 cause: err, 1796 }) 1797 } 1798 } 1799 } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { 1800 if err := v.Validate(); err != nil { 1801 return RouteMatchValidationError{ 1802 field: fmt.Sprintf("DynamicMetadata[%v]", idx), 1803 reason: "embedded message failed validation", 1804 cause: err, 1805 } 1806 } 1807 } 1808 1809 } 1810 1811 switch m.PathSpecifier.(type) { 1812 1813 case *RouteMatch_Prefix: 1814 // no validation rules for Prefix 1815 1816 case *RouteMatch_Path: 1817 // no validation rules for Path 1818 1819 case *RouteMatch_SafeRegex: 1820 1821 if m.GetSafeRegex() == nil { 1822 err := RouteMatchValidationError{ 1823 field: "SafeRegex", 1824 reason: "value is required", 1825 } 1826 if !all { 1827 return err 1828 } 1829 errors = append(errors, err) 1830 } 1831 1832 if all { 1833 switch v := interface{}(m.GetSafeRegex()).(type) { 1834 case interface{ ValidateAll() error }: 1835 if err := v.ValidateAll(); err != nil { 1836 errors = append(errors, RouteMatchValidationError{ 1837 field: "SafeRegex", 1838 reason: "embedded message failed validation", 1839 cause: err, 1840 }) 1841 } 1842 case interface{ Validate() error }: 1843 if err := v.Validate(); err != nil { 1844 errors = append(errors, RouteMatchValidationError{ 1845 field: "SafeRegex", 1846 reason: "embedded message failed validation", 1847 cause: err, 1848 }) 1849 } 1850 } 1851 } else if v, ok := interface{}(m.GetSafeRegex()).(interface{ Validate() error }); ok { 1852 if err := v.Validate(); err != nil { 1853 return RouteMatchValidationError{ 1854 field: "SafeRegex", 1855 reason: "embedded message failed validation", 1856 cause: err, 1857 } 1858 } 1859 } 1860 1861 case *RouteMatch_ConnectMatcher_: 1862 1863 if all { 1864 switch v := interface{}(m.GetConnectMatcher()).(type) { 1865 case interface{ ValidateAll() error }: 1866 if err := v.ValidateAll(); err != nil { 1867 errors = append(errors, RouteMatchValidationError{ 1868 field: "ConnectMatcher", 1869 reason: "embedded message failed validation", 1870 cause: err, 1871 }) 1872 } 1873 case interface{ Validate() error }: 1874 if err := v.Validate(); err != nil { 1875 errors = append(errors, RouteMatchValidationError{ 1876 field: "ConnectMatcher", 1877 reason: "embedded message failed validation", 1878 cause: err, 1879 }) 1880 } 1881 } 1882 } else if v, ok := interface{}(m.GetConnectMatcher()).(interface{ Validate() error }); ok { 1883 if err := v.Validate(); err != nil { 1884 return RouteMatchValidationError{ 1885 field: "ConnectMatcher", 1886 reason: "embedded message failed validation", 1887 cause: err, 1888 } 1889 } 1890 } 1891 1892 default: 1893 err := RouteMatchValidationError{ 1894 field: "PathSpecifier", 1895 reason: "value is required", 1896 } 1897 if !all { 1898 return err 1899 } 1900 errors = append(errors, err) 1901 1902 } 1903 1904 if len(errors) > 0 { 1905 return RouteMatchMultiError(errors) 1906 } 1907 return nil 1908} 1909 1910// RouteMatchMultiError is an error wrapping multiple validation errors 1911// returned by RouteMatch.ValidateAll() if the designated constraints aren't met. 1912type RouteMatchMultiError []error 1913 1914// Error returns a concatenation of all the error messages it wraps. 1915func (m RouteMatchMultiError) Error() string { 1916 var msgs []string 1917 for _, err := range m { 1918 msgs = append(msgs, err.Error()) 1919 } 1920 return strings.Join(msgs, "; ") 1921} 1922 1923// AllErrors returns a list of validation violation errors. 1924func (m RouteMatchMultiError) AllErrors() []error { return m } 1925 1926// RouteMatchValidationError is the validation error returned by 1927// RouteMatch.Validate if the designated constraints aren't met. 1928type RouteMatchValidationError struct { 1929 field string 1930 reason string 1931 cause error 1932 key bool 1933} 1934 1935// Field function returns field value. 1936func (e RouteMatchValidationError) Field() string { return e.field } 1937 1938// Reason function returns reason value. 1939func (e RouteMatchValidationError) Reason() string { return e.reason } 1940 1941// Cause function returns cause value. 1942func (e RouteMatchValidationError) Cause() error { return e.cause } 1943 1944// Key function returns key value. 1945func (e RouteMatchValidationError) Key() bool { return e.key } 1946 1947// ErrorName returns error name. 1948func (e RouteMatchValidationError) ErrorName() string { return "RouteMatchValidationError" } 1949 1950// Error satisfies the builtin error interface 1951func (e RouteMatchValidationError) Error() string { 1952 cause := "" 1953 if e.cause != nil { 1954 cause = fmt.Sprintf(" | caused by: %v", e.cause) 1955 } 1956 1957 key := "" 1958 if e.key { 1959 key = "key for " 1960 } 1961 1962 return fmt.Sprintf( 1963 "invalid %sRouteMatch.%s: %s%s", 1964 key, 1965 e.field, 1966 e.reason, 1967 cause) 1968} 1969 1970var _ error = RouteMatchValidationError{} 1971 1972var _ interface { 1973 Field() string 1974 Reason() string 1975 Key() bool 1976 Cause() error 1977 ErrorName() string 1978} = RouteMatchValidationError{} 1979 1980// Validate checks the field values on CorsPolicy with the rules defined in the 1981// proto definition for this message. If any rules are violated, the first 1982// error encountered is returned, or nil if there are no violations. 1983func (m *CorsPolicy) Validate() error { 1984 return m.validate(false) 1985} 1986 1987// ValidateAll checks the field values on CorsPolicy with the rules defined in 1988// the proto definition for this message. If any rules are violated, the 1989// result is a list of violation errors wrapped in CorsPolicyMultiError, or 1990// nil if none found. 1991func (m *CorsPolicy) ValidateAll() error { 1992 return m.validate(true) 1993} 1994 1995func (m *CorsPolicy) validate(all bool) error { 1996 if m == nil { 1997 return nil 1998 } 1999 2000 var errors []error 2001 2002 for idx, item := range m.GetAllowOriginStringMatch() { 2003 _, _ = idx, item 2004 2005 if all { 2006 switch v := interface{}(item).(type) { 2007 case interface{ ValidateAll() error }: 2008 if err := v.ValidateAll(); err != nil { 2009 errors = append(errors, CorsPolicyValidationError{ 2010 field: fmt.Sprintf("AllowOriginStringMatch[%v]", idx), 2011 reason: "embedded message failed validation", 2012 cause: err, 2013 }) 2014 } 2015 case interface{ Validate() error }: 2016 if err := v.Validate(); err != nil { 2017 errors = append(errors, CorsPolicyValidationError{ 2018 field: fmt.Sprintf("AllowOriginStringMatch[%v]", idx), 2019 reason: "embedded message failed validation", 2020 cause: err, 2021 }) 2022 } 2023 } 2024 } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { 2025 if err := v.Validate(); err != nil { 2026 return CorsPolicyValidationError{ 2027 field: fmt.Sprintf("AllowOriginStringMatch[%v]", idx), 2028 reason: "embedded message failed validation", 2029 cause: err, 2030 } 2031 } 2032 } 2033 2034 } 2035 2036 // no validation rules for AllowMethods 2037 2038 // no validation rules for AllowHeaders 2039 2040 // no validation rules for ExposeHeaders 2041 2042 // no validation rules for MaxAge 2043 2044 if all { 2045 switch v := interface{}(m.GetAllowCredentials()).(type) { 2046 case interface{ ValidateAll() error }: 2047 if err := v.ValidateAll(); err != nil { 2048 errors = append(errors, CorsPolicyValidationError{ 2049 field: "AllowCredentials", 2050 reason: "embedded message failed validation", 2051 cause: err, 2052 }) 2053 } 2054 case interface{ Validate() error }: 2055 if err := v.Validate(); err != nil { 2056 errors = append(errors, CorsPolicyValidationError{ 2057 field: "AllowCredentials", 2058 reason: "embedded message failed validation", 2059 cause: err, 2060 }) 2061 } 2062 } 2063 } else if v, ok := interface{}(m.GetAllowCredentials()).(interface{ Validate() error }); ok { 2064 if err := v.Validate(); err != nil { 2065 return CorsPolicyValidationError{ 2066 field: "AllowCredentials", 2067 reason: "embedded message failed validation", 2068 cause: err, 2069 } 2070 } 2071 } 2072 2073 if all { 2074 switch v := interface{}(m.GetShadowEnabled()).(type) { 2075 case interface{ ValidateAll() error }: 2076 if err := v.ValidateAll(); err != nil { 2077 errors = append(errors, CorsPolicyValidationError{ 2078 field: "ShadowEnabled", 2079 reason: "embedded message failed validation", 2080 cause: err, 2081 }) 2082 } 2083 case interface{ Validate() error }: 2084 if err := v.Validate(); err != nil { 2085 errors = append(errors, CorsPolicyValidationError{ 2086 field: "ShadowEnabled", 2087 reason: "embedded message failed validation", 2088 cause: err, 2089 }) 2090 } 2091 } 2092 } else if v, ok := interface{}(m.GetShadowEnabled()).(interface{ Validate() error }); ok { 2093 if err := v.Validate(); err != nil { 2094 return CorsPolicyValidationError{ 2095 field: "ShadowEnabled", 2096 reason: "embedded message failed validation", 2097 cause: err, 2098 } 2099 } 2100 } 2101 2102 switch m.EnabledSpecifier.(type) { 2103 2104 case *CorsPolicy_FilterEnabled: 2105 2106 if all { 2107 switch v := interface{}(m.GetFilterEnabled()).(type) { 2108 case interface{ ValidateAll() error }: 2109 if err := v.ValidateAll(); err != nil { 2110 errors = append(errors, CorsPolicyValidationError{ 2111 field: "FilterEnabled", 2112 reason: "embedded message failed validation", 2113 cause: err, 2114 }) 2115 } 2116 case interface{ Validate() error }: 2117 if err := v.Validate(); err != nil { 2118 errors = append(errors, CorsPolicyValidationError{ 2119 field: "FilterEnabled", 2120 reason: "embedded message failed validation", 2121 cause: err, 2122 }) 2123 } 2124 } 2125 } else if v, ok := interface{}(m.GetFilterEnabled()).(interface{ Validate() error }); ok { 2126 if err := v.Validate(); err != nil { 2127 return CorsPolicyValidationError{ 2128 field: "FilterEnabled", 2129 reason: "embedded message failed validation", 2130 cause: err, 2131 } 2132 } 2133 } 2134 2135 } 2136 2137 if len(errors) > 0 { 2138 return CorsPolicyMultiError(errors) 2139 } 2140 return nil 2141} 2142 2143// CorsPolicyMultiError is an error wrapping multiple validation errors 2144// returned by CorsPolicy.ValidateAll() if the designated constraints aren't met. 2145type CorsPolicyMultiError []error 2146 2147// Error returns a concatenation of all the error messages it wraps. 2148func (m CorsPolicyMultiError) Error() string { 2149 var msgs []string 2150 for _, err := range m { 2151 msgs = append(msgs, err.Error()) 2152 } 2153 return strings.Join(msgs, "; ") 2154} 2155 2156// AllErrors returns a list of validation violation errors. 2157func (m CorsPolicyMultiError) AllErrors() []error { return m } 2158 2159// CorsPolicyValidationError is the validation error returned by 2160// CorsPolicy.Validate if the designated constraints aren't met. 2161type CorsPolicyValidationError struct { 2162 field string 2163 reason string 2164 cause error 2165 key bool 2166} 2167 2168// Field function returns field value. 2169func (e CorsPolicyValidationError) Field() string { return e.field } 2170 2171// Reason function returns reason value. 2172func (e CorsPolicyValidationError) Reason() string { return e.reason } 2173 2174// Cause function returns cause value. 2175func (e CorsPolicyValidationError) Cause() error { return e.cause } 2176 2177// Key function returns key value. 2178func (e CorsPolicyValidationError) Key() bool { return e.key } 2179 2180// ErrorName returns error name. 2181func (e CorsPolicyValidationError) ErrorName() string { return "CorsPolicyValidationError" } 2182 2183// Error satisfies the builtin error interface 2184func (e CorsPolicyValidationError) Error() string { 2185 cause := "" 2186 if e.cause != nil { 2187 cause = fmt.Sprintf(" | caused by: %v", e.cause) 2188 } 2189 2190 key := "" 2191 if e.key { 2192 key = "key for " 2193 } 2194 2195 return fmt.Sprintf( 2196 "invalid %sCorsPolicy.%s: %s%s", 2197 key, 2198 e.field, 2199 e.reason, 2200 cause) 2201} 2202 2203var _ error = CorsPolicyValidationError{} 2204 2205var _ interface { 2206 Field() string 2207 Reason() string 2208 Key() bool 2209 Cause() error 2210 ErrorName() string 2211} = CorsPolicyValidationError{} 2212 2213// Validate checks the field values on RouteAction with the rules defined in 2214// the proto definition for this message. If any rules are violated, the first 2215// error encountered is returned, or nil if there are no violations. 2216func (m *RouteAction) Validate() error { 2217 return m.validate(false) 2218} 2219 2220// ValidateAll checks the field values on RouteAction with the rules defined in 2221// the proto definition for this message. If any rules are violated, the 2222// result is a list of violation errors wrapped in RouteActionMultiError, or 2223// nil if none found. 2224func (m *RouteAction) ValidateAll() error { 2225 return m.validate(true) 2226} 2227 2228func (m *RouteAction) validate(all bool) error { 2229 if m == nil { 2230 return nil 2231 } 2232 2233 var errors []error 2234 2235 if _, ok := RouteAction_ClusterNotFoundResponseCode_name[int32(m.GetClusterNotFoundResponseCode())]; !ok { 2236 err := RouteActionValidationError{ 2237 field: "ClusterNotFoundResponseCode", 2238 reason: "value must be one of the defined enum values", 2239 } 2240 if !all { 2241 return err 2242 } 2243 errors = append(errors, err) 2244 } 2245 2246 if all { 2247 switch v := interface{}(m.GetMetadataMatch()).(type) { 2248 case interface{ ValidateAll() error }: 2249 if err := v.ValidateAll(); err != nil { 2250 errors = append(errors, RouteActionValidationError{ 2251 field: "MetadataMatch", 2252 reason: "embedded message failed validation", 2253 cause: err, 2254 }) 2255 } 2256 case interface{ Validate() error }: 2257 if err := v.Validate(); err != nil { 2258 errors = append(errors, RouteActionValidationError{ 2259 field: "MetadataMatch", 2260 reason: "embedded message failed validation", 2261 cause: err, 2262 }) 2263 } 2264 } 2265 } else if v, ok := interface{}(m.GetMetadataMatch()).(interface{ Validate() error }); ok { 2266 if err := v.Validate(); err != nil { 2267 return RouteActionValidationError{ 2268 field: "MetadataMatch", 2269 reason: "embedded message failed validation", 2270 cause: err, 2271 } 2272 } 2273 } 2274 2275 if !_RouteAction_PrefixRewrite_Pattern.MatchString(m.GetPrefixRewrite()) { 2276 err := RouteActionValidationError{ 2277 field: "PrefixRewrite", 2278 reason: "value does not match regex pattern \"^[^\\x00\\n\\r]*$\"", 2279 } 2280 if !all { 2281 return err 2282 } 2283 errors = append(errors, err) 2284 } 2285 2286 if all { 2287 switch v := interface{}(m.GetRegexRewrite()).(type) { 2288 case interface{ ValidateAll() error }: 2289 if err := v.ValidateAll(); err != nil { 2290 errors = append(errors, RouteActionValidationError{ 2291 field: "RegexRewrite", 2292 reason: "embedded message failed validation", 2293 cause: err, 2294 }) 2295 } 2296 case interface{ Validate() error }: 2297 if err := v.Validate(); err != nil { 2298 errors = append(errors, RouteActionValidationError{ 2299 field: "RegexRewrite", 2300 reason: "embedded message failed validation", 2301 cause: err, 2302 }) 2303 } 2304 } 2305 } else if v, ok := interface{}(m.GetRegexRewrite()).(interface{ Validate() error }); ok { 2306 if err := v.Validate(); err != nil { 2307 return RouteActionValidationError{ 2308 field: "RegexRewrite", 2309 reason: "embedded message failed validation", 2310 cause: err, 2311 } 2312 } 2313 } 2314 2315 if all { 2316 switch v := interface{}(m.GetTimeout()).(type) { 2317 case interface{ ValidateAll() error }: 2318 if err := v.ValidateAll(); err != nil { 2319 errors = append(errors, RouteActionValidationError{ 2320 field: "Timeout", 2321 reason: "embedded message failed validation", 2322 cause: err, 2323 }) 2324 } 2325 case interface{ Validate() error }: 2326 if err := v.Validate(); err != nil { 2327 errors = append(errors, RouteActionValidationError{ 2328 field: "Timeout", 2329 reason: "embedded message failed validation", 2330 cause: err, 2331 }) 2332 } 2333 } 2334 } else if v, ok := interface{}(m.GetTimeout()).(interface{ Validate() error }); ok { 2335 if err := v.Validate(); err != nil { 2336 return RouteActionValidationError{ 2337 field: "Timeout", 2338 reason: "embedded message failed validation", 2339 cause: err, 2340 } 2341 } 2342 } 2343 2344 if all { 2345 switch v := interface{}(m.GetIdleTimeout()).(type) { 2346 case interface{ ValidateAll() error }: 2347 if err := v.ValidateAll(); err != nil { 2348 errors = append(errors, RouteActionValidationError{ 2349 field: "IdleTimeout", 2350 reason: "embedded message failed validation", 2351 cause: err, 2352 }) 2353 } 2354 case interface{ Validate() error }: 2355 if err := v.Validate(); err != nil { 2356 errors = append(errors, RouteActionValidationError{ 2357 field: "IdleTimeout", 2358 reason: "embedded message failed validation", 2359 cause: err, 2360 }) 2361 } 2362 } 2363 } else if v, ok := interface{}(m.GetIdleTimeout()).(interface{ Validate() error }); ok { 2364 if err := v.Validate(); err != nil { 2365 return RouteActionValidationError{ 2366 field: "IdleTimeout", 2367 reason: "embedded message failed validation", 2368 cause: err, 2369 } 2370 } 2371 } 2372 2373 if all { 2374 switch v := interface{}(m.GetRetryPolicy()).(type) { 2375 case interface{ ValidateAll() error }: 2376 if err := v.ValidateAll(); err != nil { 2377 errors = append(errors, RouteActionValidationError{ 2378 field: "RetryPolicy", 2379 reason: "embedded message failed validation", 2380 cause: err, 2381 }) 2382 } 2383 case interface{ Validate() error }: 2384 if err := v.Validate(); err != nil { 2385 errors = append(errors, RouteActionValidationError{ 2386 field: "RetryPolicy", 2387 reason: "embedded message failed validation", 2388 cause: err, 2389 }) 2390 } 2391 } 2392 } else if v, ok := interface{}(m.GetRetryPolicy()).(interface{ Validate() error }); ok { 2393 if err := v.Validate(); err != nil { 2394 return RouteActionValidationError{ 2395 field: "RetryPolicy", 2396 reason: "embedded message failed validation", 2397 cause: err, 2398 } 2399 } 2400 } 2401 2402 if all { 2403 switch v := interface{}(m.GetRetryPolicyTypedConfig()).(type) { 2404 case interface{ ValidateAll() error }: 2405 if err := v.ValidateAll(); err != nil { 2406 errors = append(errors, RouteActionValidationError{ 2407 field: "RetryPolicyTypedConfig", 2408 reason: "embedded message failed validation", 2409 cause: err, 2410 }) 2411 } 2412 case interface{ Validate() error }: 2413 if err := v.Validate(); err != nil { 2414 errors = append(errors, RouteActionValidationError{ 2415 field: "RetryPolicyTypedConfig", 2416 reason: "embedded message failed validation", 2417 cause: err, 2418 }) 2419 } 2420 } 2421 } else if v, ok := interface{}(m.GetRetryPolicyTypedConfig()).(interface{ Validate() error }); ok { 2422 if err := v.Validate(); err != nil { 2423 return RouteActionValidationError{ 2424 field: "RetryPolicyTypedConfig", 2425 reason: "embedded message failed validation", 2426 cause: err, 2427 } 2428 } 2429 } 2430 2431 for idx, item := range m.GetRequestMirrorPolicies() { 2432 _, _ = idx, item 2433 2434 if all { 2435 switch v := interface{}(item).(type) { 2436 case interface{ ValidateAll() error }: 2437 if err := v.ValidateAll(); err != nil { 2438 errors = append(errors, RouteActionValidationError{ 2439 field: fmt.Sprintf("RequestMirrorPolicies[%v]", idx), 2440 reason: "embedded message failed validation", 2441 cause: err, 2442 }) 2443 } 2444 case interface{ Validate() error }: 2445 if err := v.Validate(); err != nil { 2446 errors = append(errors, RouteActionValidationError{ 2447 field: fmt.Sprintf("RequestMirrorPolicies[%v]", idx), 2448 reason: "embedded message failed validation", 2449 cause: err, 2450 }) 2451 } 2452 } 2453 } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { 2454 if err := v.Validate(); err != nil { 2455 return RouteActionValidationError{ 2456 field: fmt.Sprintf("RequestMirrorPolicies[%v]", idx), 2457 reason: "embedded message failed validation", 2458 cause: err, 2459 } 2460 } 2461 } 2462 2463 } 2464 2465 if _, ok := v3.RoutingPriority_name[int32(m.GetPriority())]; !ok { 2466 err := RouteActionValidationError{ 2467 field: "Priority", 2468 reason: "value must be one of the defined enum values", 2469 } 2470 if !all { 2471 return err 2472 } 2473 errors = append(errors, err) 2474 } 2475 2476 for idx, item := range m.GetRateLimits() { 2477 _, _ = idx, item 2478 2479 if all { 2480 switch v := interface{}(item).(type) { 2481 case interface{ ValidateAll() error }: 2482 if err := v.ValidateAll(); err != nil { 2483 errors = append(errors, RouteActionValidationError{ 2484 field: fmt.Sprintf("RateLimits[%v]", idx), 2485 reason: "embedded message failed validation", 2486 cause: err, 2487 }) 2488 } 2489 case interface{ Validate() error }: 2490 if err := v.Validate(); err != nil { 2491 errors = append(errors, RouteActionValidationError{ 2492 field: fmt.Sprintf("RateLimits[%v]", idx), 2493 reason: "embedded message failed validation", 2494 cause: err, 2495 }) 2496 } 2497 } 2498 } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { 2499 if err := v.Validate(); err != nil { 2500 return RouteActionValidationError{ 2501 field: fmt.Sprintf("RateLimits[%v]", idx), 2502 reason: "embedded message failed validation", 2503 cause: err, 2504 } 2505 } 2506 } 2507 2508 } 2509 2510 if all { 2511 switch v := interface{}(m.GetIncludeVhRateLimits()).(type) { 2512 case interface{ ValidateAll() error }: 2513 if err := v.ValidateAll(); err != nil { 2514 errors = append(errors, RouteActionValidationError{ 2515 field: "IncludeVhRateLimits", 2516 reason: "embedded message failed validation", 2517 cause: err, 2518 }) 2519 } 2520 case interface{ Validate() error }: 2521 if err := v.Validate(); err != nil { 2522 errors = append(errors, RouteActionValidationError{ 2523 field: "IncludeVhRateLimits", 2524 reason: "embedded message failed validation", 2525 cause: err, 2526 }) 2527 } 2528 } 2529 } else if v, ok := interface{}(m.GetIncludeVhRateLimits()).(interface{ Validate() error }); ok { 2530 if err := v.Validate(); err != nil { 2531 return RouteActionValidationError{ 2532 field: "IncludeVhRateLimits", 2533 reason: "embedded message failed validation", 2534 cause: err, 2535 } 2536 } 2537 } 2538 2539 for idx, item := range m.GetHashPolicy() { 2540 _, _ = idx, item 2541 2542 if all { 2543 switch v := interface{}(item).(type) { 2544 case interface{ ValidateAll() error }: 2545 if err := v.ValidateAll(); err != nil { 2546 errors = append(errors, RouteActionValidationError{ 2547 field: fmt.Sprintf("HashPolicy[%v]", idx), 2548 reason: "embedded message failed validation", 2549 cause: err, 2550 }) 2551 } 2552 case interface{ Validate() error }: 2553 if err := v.Validate(); err != nil { 2554 errors = append(errors, RouteActionValidationError{ 2555 field: fmt.Sprintf("HashPolicy[%v]", idx), 2556 reason: "embedded message failed validation", 2557 cause: err, 2558 }) 2559 } 2560 } 2561 } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { 2562 if err := v.Validate(); err != nil { 2563 return RouteActionValidationError{ 2564 field: fmt.Sprintf("HashPolicy[%v]", idx), 2565 reason: "embedded message failed validation", 2566 cause: err, 2567 } 2568 } 2569 } 2570 2571 } 2572 2573 if all { 2574 switch v := interface{}(m.GetCors()).(type) { 2575 case interface{ ValidateAll() error }: 2576 if err := v.ValidateAll(); err != nil { 2577 errors = append(errors, RouteActionValidationError{ 2578 field: "Cors", 2579 reason: "embedded message failed validation", 2580 cause: err, 2581 }) 2582 } 2583 case interface{ Validate() error }: 2584 if err := v.Validate(); err != nil { 2585 errors = append(errors, RouteActionValidationError{ 2586 field: "Cors", 2587 reason: "embedded message failed validation", 2588 cause: err, 2589 }) 2590 } 2591 } 2592 } else if v, ok := interface{}(m.GetCors()).(interface{ Validate() error }); ok { 2593 if err := v.Validate(); err != nil { 2594 return RouteActionValidationError{ 2595 field: "Cors", 2596 reason: "embedded message failed validation", 2597 cause: err, 2598 } 2599 } 2600 } 2601 2602 if all { 2603 switch v := interface{}(m.GetMaxGrpcTimeout()).(type) { 2604 case interface{ ValidateAll() error }: 2605 if err := v.ValidateAll(); err != nil { 2606 errors = append(errors, RouteActionValidationError{ 2607 field: "MaxGrpcTimeout", 2608 reason: "embedded message failed validation", 2609 cause: err, 2610 }) 2611 } 2612 case interface{ Validate() error }: 2613 if err := v.Validate(); err != nil { 2614 errors = append(errors, RouteActionValidationError{ 2615 field: "MaxGrpcTimeout", 2616 reason: "embedded message failed validation", 2617 cause: err, 2618 }) 2619 } 2620 } 2621 } else if v, ok := interface{}(m.GetMaxGrpcTimeout()).(interface{ Validate() error }); ok { 2622 if err := v.Validate(); err != nil { 2623 return RouteActionValidationError{ 2624 field: "MaxGrpcTimeout", 2625 reason: "embedded message failed validation", 2626 cause: err, 2627 } 2628 } 2629 } 2630 2631 if all { 2632 switch v := interface{}(m.GetGrpcTimeoutOffset()).(type) { 2633 case interface{ ValidateAll() error }: 2634 if err := v.ValidateAll(); err != nil { 2635 errors = append(errors, RouteActionValidationError{ 2636 field: "GrpcTimeoutOffset", 2637 reason: "embedded message failed validation", 2638 cause: err, 2639 }) 2640 } 2641 case interface{ Validate() error }: 2642 if err := v.Validate(); err != nil { 2643 errors = append(errors, RouteActionValidationError{ 2644 field: "GrpcTimeoutOffset", 2645 reason: "embedded message failed validation", 2646 cause: err, 2647 }) 2648 } 2649 } 2650 } else if v, ok := interface{}(m.GetGrpcTimeoutOffset()).(interface{ Validate() error }); ok { 2651 if err := v.Validate(); err != nil { 2652 return RouteActionValidationError{ 2653 field: "GrpcTimeoutOffset", 2654 reason: "embedded message failed validation", 2655 cause: err, 2656 } 2657 } 2658 } 2659 2660 for idx, item := range m.GetUpgradeConfigs() { 2661 _, _ = idx, item 2662 2663 if all { 2664 switch v := interface{}(item).(type) { 2665 case interface{ ValidateAll() error }: 2666 if err := v.ValidateAll(); err != nil { 2667 errors = append(errors, RouteActionValidationError{ 2668 field: fmt.Sprintf("UpgradeConfigs[%v]", idx), 2669 reason: "embedded message failed validation", 2670 cause: err, 2671 }) 2672 } 2673 case interface{ Validate() error }: 2674 if err := v.Validate(); err != nil { 2675 errors = append(errors, RouteActionValidationError{ 2676 field: fmt.Sprintf("UpgradeConfigs[%v]", idx), 2677 reason: "embedded message failed validation", 2678 cause: err, 2679 }) 2680 } 2681 } 2682 } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { 2683 if err := v.Validate(); err != nil { 2684 return RouteActionValidationError{ 2685 field: fmt.Sprintf("UpgradeConfigs[%v]", idx), 2686 reason: "embedded message failed validation", 2687 cause: err, 2688 } 2689 } 2690 } 2691 2692 } 2693 2694 if all { 2695 switch v := interface{}(m.GetInternalRedirectPolicy()).(type) { 2696 case interface{ ValidateAll() error }: 2697 if err := v.ValidateAll(); err != nil { 2698 errors = append(errors, RouteActionValidationError{ 2699 field: "InternalRedirectPolicy", 2700 reason: "embedded message failed validation", 2701 cause: err, 2702 }) 2703 } 2704 case interface{ Validate() error }: 2705 if err := v.Validate(); err != nil { 2706 errors = append(errors, RouteActionValidationError{ 2707 field: "InternalRedirectPolicy", 2708 reason: "embedded message failed validation", 2709 cause: err, 2710 }) 2711 } 2712 } 2713 } else if v, ok := interface{}(m.GetInternalRedirectPolicy()).(interface{ Validate() error }); ok { 2714 if err := v.Validate(); err != nil { 2715 return RouteActionValidationError{ 2716 field: "InternalRedirectPolicy", 2717 reason: "embedded message failed validation", 2718 cause: err, 2719 } 2720 } 2721 } 2722 2723 // no validation rules for InternalRedirectAction 2724 2725 if all { 2726 switch v := interface{}(m.GetMaxInternalRedirects()).(type) { 2727 case interface{ ValidateAll() error }: 2728 if err := v.ValidateAll(); err != nil { 2729 errors = append(errors, RouteActionValidationError{ 2730 field: "MaxInternalRedirects", 2731 reason: "embedded message failed validation", 2732 cause: err, 2733 }) 2734 } 2735 case interface{ Validate() error }: 2736 if err := v.Validate(); err != nil { 2737 errors = append(errors, RouteActionValidationError{ 2738 field: "MaxInternalRedirects", 2739 reason: "embedded message failed validation", 2740 cause: err, 2741 }) 2742 } 2743 } 2744 } else if v, ok := interface{}(m.GetMaxInternalRedirects()).(interface{ Validate() error }); ok { 2745 if err := v.Validate(); err != nil { 2746 return RouteActionValidationError{ 2747 field: "MaxInternalRedirects", 2748 reason: "embedded message failed validation", 2749 cause: err, 2750 } 2751 } 2752 } 2753 2754 if all { 2755 switch v := interface{}(m.GetHedgePolicy()).(type) { 2756 case interface{ ValidateAll() error }: 2757 if err := v.ValidateAll(); err != nil { 2758 errors = append(errors, RouteActionValidationError{ 2759 field: "HedgePolicy", 2760 reason: "embedded message failed validation", 2761 cause: err, 2762 }) 2763 } 2764 case interface{ Validate() error }: 2765 if err := v.Validate(); err != nil { 2766 errors = append(errors, RouteActionValidationError{ 2767 field: "HedgePolicy", 2768 reason: "embedded message failed validation", 2769 cause: err, 2770 }) 2771 } 2772 } 2773 } else if v, ok := interface{}(m.GetHedgePolicy()).(interface{ Validate() error }); ok { 2774 if err := v.Validate(); err != nil { 2775 return RouteActionValidationError{ 2776 field: "HedgePolicy", 2777 reason: "embedded message failed validation", 2778 cause: err, 2779 } 2780 } 2781 } 2782 2783 if all { 2784 switch v := interface{}(m.GetMaxStreamDuration()).(type) { 2785 case interface{ ValidateAll() error }: 2786 if err := v.ValidateAll(); err != nil { 2787 errors = append(errors, RouteActionValidationError{ 2788 field: "MaxStreamDuration", 2789 reason: "embedded message failed validation", 2790 cause: err, 2791 }) 2792 } 2793 case interface{ Validate() error }: 2794 if err := v.Validate(); err != nil { 2795 errors = append(errors, RouteActionValidationError{ 2796 field: "MaxStreamDuration", 2797 reason: "embedded message failed validation", 2798 cause: err, 2799 }) 2800 } 2801 } 2802 } else if v, ok := interface{}(m.GetMaxStreamDuration()).(interface{ Validate() error }); ok { 2803 if err := v.Validate(); err != nil { 2804 return RouteActionValidationError{ 2805 field: "MaxStreamDuration", 2806 reason: "embedded message failed validation", 2807 cause: err, 2808 } 2809 } 2810 } 2811 2812 switch m.ClusterSpecifier.(type) { 2813 2814 case *RouteAction_Cluster: 2815 2816 if utf8.RuneCountInString(m.GetCluster()) < 1 { 2817 err := RouteActionValidationError{ 2818 field: "Cluster", 2819 reason: "value length must be at least 1 runes", 2820 } 2821 if !all { 2822 return err 2823 } 2824 errors = append(errors, err) 2825 } 2826 2827 case *RouteAction_ClusterHeader: 2828 2829 if utf8.RuneCountInString(m.GetClusterHeader()) < 1 { 2830 err := RouteActionValidationError{ 2831 field: "ClusterHeader", 2832 reason: "value length must be at least 1 runes", 2833 } 2834 if !all { 2835 return err 2836 } 2837 errors = append(errors, err) 2838 } 2839 2840 if !_RouteAction_ClusterHeader_Pattern.MatchString(m.GetClusterHeader()) { 2841 err := RouteActionValidationError{ 2842 field: "ClusterHeader", 2843 reason: "value does not match regex pattern \"^[^\\x00\\n\\r]*$\"", 2844 } 2845 if !all { 2846 return err 2847 } 2848 errors = append(errors, err) 2849 } 2850 2851 case *RouteAction_WeightedClusters: 2852 2853 if all { 2854 switch v := interface{}(m.GetWeightedClusters()).(type) { 2855 case interface{ ValidateAll() error }: 2856 if err := v.ValidateAll(); err != nil { 2857 errors = append(errors, RouteActionValidationError{ 2858 field: "WeightedClusters", 2859 reason: "embedded message failed validation", 2860 cause: err, 2861 }) 2862 } 2863 case interface{ Validate() error }: 2864 if err := v.Validate(); err != nil { 2865 errors = append(errors, RouteActionValidationError{ 2866 field: "WeightedClusters", 2867 reason: "embedded message failed validation", 2868 cause: err, 2869 }) 2870 } 2871 } 2872 } else if v, ok := interface{}(m.GetWeightedClusters()).(interface{ Validate() error }); ok { 2873 if err := v.Validate(); err != nil { 2874 return RouteActionValidationError{ 2875 field: "WeightedClusters", 2876 reason: "embedded message failed validation", 2877 cause: err, 2878 } 2879 } 2880 } 2881 2882 case *RouteAction_ClusterSpecifierPlugin: 2883 // no validation rules for ClusterSpecifierPlugin 2884 2885 default: 2886 err := RouteActionValidationError{ 2887 field: "ClusterSpecifier", 2888 reason: "value is required", 2889 } 2890 if !all { 2891 return err 2892 } 2893 errors = append(errors, err) 2894 2895 } 2896 2897 switch m.HostRewriteSpecifier.(type) { 2898 2899 case *RouteAction_HostRewriteLiteral: 2900 2901 if !_RouteAction_HostRewriteLiteral_Pattern.MatchString(m.GetHostRewriteLiteral()) { 2902 err := RouteActionValidationError{ 2903 field: "HostRewriteLiteral", 2904 reason: "value does not match regex pattern \"^[^\\x00\\n\\r]*$\"", 2905 } 2906 if !all { 2907 return err 2908 } 2909 errors = append(errors, err) 2910 } 2911 2912 case *RouteAction_AutoHostRewrite: 2913 2914 if all { 2915 switch v := interface{}(m.GetAutoHostRewrite()).(type) { 2916 case interface{ ValidateAll() error }: 2917 if err := v.ValidateAll(); err != nil { 2918 errors = append(errors, RouteActionValidationError{ 2919 field: "AutoHostRewrite", 2920 reason: "embedded message failed validation", 2921 cause: err, 2922 }) 2923 } 2924 case interface{ Validate() error }: 2925 if err := v.Validate(); err != nil { 2926 errors = append(errors, RouteActionValidationError{ 2927 field: "AutoHostRewrite", 2928 reason: "embedded message failed validation", 2929 cause: err, 2930 }) 2931 } 2932 } 2933 } else if v, ok := interface{}(m.GetAutoHostRewrite()).(interface{ Validate() error }); ok { 2934 if err := v.Validate(); err != nil { 2935 return RouteActionValidationError{ 2936 field: "AutoHostRewrite", 2937 reason: "embedded message failed validation", 2938 cause: err, 2939 } 2940 } 2941 } 2942 2943 case *RouteAction_HostRewriteHeader: 2944 2945 if !_RouteAction_HostRewriteHeader_Pattern.MatchString(m.GetHostRewriteHeader()) { 2946 err := RouteActionValidationError{ 2947 field: "HostRewriteHeader", 2948 reason: "value does not match regex pattern \"^[^\\x00\\n\\r]*$\"", 2949 } 2950 if !all { 2951 return err 2952 } 2953 errors = append(errors, err) 2954 } 2955 2956 case *RouteAction_HostRewritePathRegex: 2957 2958 if all { 2959 switch v := interface{}(m.GetHostRewritePathRegex()).(type) { 2960 case interface{ ValidateAll() error }: 2961 if err := v.ValidateAll(); err != nil { 2962 errors = append(errors, RouteActionValidationError{ 2963 field: "HostRewritePathRegex", 2964 reason: "embedded message failed validation", 2965 cause: err, 2966 }) 2967 } 2968 case interface{ Validate() error }: 2969 if err := v.Validate(); err != nil { 2970 errors = append(errors, RouteActionValidationError{ 2971 field: "HostRewritePathRegex", 2972 reason: "embedded message failed validation", 2973 cause: err, 2974 }) 2975 } 2976 } 2977 } else if v, ok := interface{}(m.GetHostRewritePathRegex()).(interface{ Validate() error }); ok { 2978 if err := v.Validate(); err != nil { 2979 return RouteActionValidationError{ 2980 field: "HostRewritePathRegex", 2981 reason: "embedded message failed validation", 2982 cause: err, 2983 } 2984 } 2985 } 2986 2987 } 2988 2989 if len(errors) > 0 { 2990 return RouteActionMultiError(errors) 2991 } 2992 return nil 2993} 2994 2995// RouteActionMultiError is an error wrapping multiple validation errors 2996// returned by RouteAction.ValidateAll() if the designated constraints aren't met. 2997type RouteActionMultiError []error 2998 2999// Error returns a concatenation of all the error messages it wraps. 3000func (m RouteActionMultiError) Error() string { 3001 var msgs []string 3002 for _, err := range m { 3003 msgs = append(msgs, err.Error()) 3004 } 3005 return strings.Join(msgs, "; ") 3006} 3007 3008// AllErrors returns a list of validation violation errors. 3009func (m RouteActionMultiError) AllErrors() []error { return m } 3010 3011// RouteActionValidationError is the validation error returned by 3012// RouteAction.Validate if the designated constraints aren't met. 3013type RouteActionValidationError struct { 3014 field string 3015 reason string 3016 cause error 3017 key bool 3018} 3019 3020// Field function returns field value. 3021func (e RouteActionValidationError) Field() string { return e.field } 3022 3023// Reason function returns reason value. 3024func (e RouteActionValidationError) Reason() string { return e.reason } 3025 3026// Cause function returns cause value. 3027func (e RouteActionValidationError) Cause() error { return e.cause } 3028 3029// Key function returns key value. 3030func (e RouteActionValidationError) Key() bool { return e.key } 3031 3032// ErrorName returns error name. 3033func (e RouteActionValidationError) ErrorName() string { return "RouteActionValidationError" } 3034 3035// Error satisfies the builtin error interface 3036func (e RouteActionValidationError) Error() string { 3037 cause := "" 3038 if e.cause != nil { 3039 cause = fmt.Sprintf(" | caused by: %v", e.cause) 3040 } 3041 3042 key := "" 3043 if e.key { 3044 key = "key for " 3045 } 3046 3047 return fmt.Sprintf( 3048 "invalid %sRouteAction.%s: %s%s", 3049 key, 3050 e.field, 3051 e.reason, 3052 cause) 3053} 3054 3055var _ error = RouteActionValidationError{} 3056 3057var _ interface { 3058 Field() string 3059 Reason() string 3060 Key() bool 3061 Cause() error 3062 ErrorName() string 3063} = RouteActionValidationError{} 3064 3065var _RouteAction_ClusterHeader_Pattern = regexp.MustCompile("^[^\x00\n\r]*$") 3066 3067var _RouteAction_PrefixRewrite_Pattern = regexp.MustCompile("^[^\x00\n\r]*$") 3068 3069var _RouteAction_HostRewriteLiteral_Pattern = regexp.MustCompile("^[^\x00\n\r]*$") 3070 3071var _RouteAction_HostRewriteHeader_Pattern = regexp.MustCompile("^[^\x00\n\r]*$") 3072 3073// Validate checks the field values on RetryPolicy with the rules defined in 3074// the proto definition for this message. If any rules are violated, the first 3075// error encountered is returned, or nil if there are no violations. 3076func (m *RetryPolicy) Validate() error { 3077 return m.validate(false) 3078} 3079 3080// ValidateAll checks the field values on RetryPolicy with the rules defined in 3081// the proto definition for this message. If any rules are violated, the 3082// result is a list of violation errors wrapped in RetryPolicyMultiError, or 3083// nil if none found. 3084func (m *RetryPolicy) ValidateAll() error { 3085 return m.validate(true) 3086} 3087 3088func (m *RetryPolicy) validate(all bool) error { 3089 if m == nil { 3090 return nil 3091 } 3092 3093 var errors []error 3094 3095 // no validation rules for RetryOn 3096 3097 if all { 3098 switch v := interface{}(m.GetNumRetries()).(type) { 3099 case interface{ ValidateAll() error }: 3100 if err := v.ValidateAll(); err != nil { 3101 errors = append(errors, RetryPolicyValidationError{ 3102 field: "NumRetries", 3103 reason: "embedded message failed validation", 3104 cause: err, 3105 }) 3106 } 3107 case interface{ Validate() error }: 3108 if err := v.Validate(); err != nil { 3109 errors = append(errors, RetryPolicyValidationError{ 3110 field: "NumRetries", 3111 reason: "embedded message failed validation", 3112 cause: err, 3113 }) 3114 } 3115 } 3116 } else if v, ok := interface{}(m.GetNumRetries()).(interface{ Validate() error }); ok { 3117 if err := v.Validate(); err != nil { 3118 return RetryPolicyValidationError{ 3119 field: "NumRetries", 3120 reason: "embedded message failed validation", 3121 cause: err, 3122 } 3123 } 3124 } 3125 3126 if all { 3127 switch v := interface{}(m.GetPerTryTimeout()).(type) { 3128 case interface{ ValidateAll() error }: 3129 if err := v.ValidateAll(); err != nil { 3130 errors = append(errors, RetryPolicyValidationError{ 3131 field: "PerTryTimeout", 3132 reason: "embedded message failed validation", 3133 cause: err, 3134 }) 3135 } 3136 case interface{ Validate() error }: 3137 if err := v.Validate(); err != nil { 3138 errors = append(errors, RetryPolicyValidationError{ 3139 field: "PerTryTimeout", 3140 reason: "embedded message failed validation", 3141 cause: err, 3142 }) 3143 } 3144 } 3145 } else if v, ok := interface{}(m.GetPerTryTimeout()).(interface{ Validate() error }); ok { 3146 if err := v.Validate(); err != nil { 3147 return RetryPolicyValidationError{ 3148 field: "PerTryTimeout", 3149 reason: "embedded message failed validation", 3150 cause: err, 3151 } 3152 } 3153 } 3154 3155 if all { 3156 switch v := interface{}(m.GetPerTryIdleTimeout()).(type) { 3157 case interface{ ValidateAll() error }: 3158 if err := v.ValidateAll(); err != nil { 3159 errors = append(errors, RetryPolicyValidationError{ 3160 field: "PerTryIdleTimeout", 3161 reason: "embedded message failed validation", 3162 cause: err, 3163 }) 3164 } 3165 case interface{ Validate() error }: 3166 if err := v.Validate(); err != nil { 3167 errors = append(errors, RetryPolicyValidationError{ 3168 field: "PerTryIdleTimeout", 3169 reason: "embedded message failed validation", 3170 cause: err, 3171 }) 3172 } 3173 } 3174 } else if v, ok := interface{}(m.GetPerTryIdleTimeout()).(interface{ Validate() error }); ok { 3175 if err := v.Validate(); err != nil { 3176 return RetryPolicyValidationError{ 3177 field: "PerTryIdleTimeout", 3178 reason: "embedded message failed validation", 3179 cause: err, 3180 } 3181 } 3182 } 3183 3184 if all { 3185 switch v := interface{}(m.GetRetryPriority()).(type) { 3186 case interface{ ValidateAll() error }: 3187 if err := v.ValidateAll(); err != nil { 3188 errors = append(errors, RetryPolicyValidationError{ 3189 field: "RetryPriority", 3190 reason: "embedded message failed validation", 3191 cause: err, 3192 }) 3193 } 3194 case interface{ Validate() error }: 3195 if err := v.Validate(); err != nil { 3196 errors = append(errors, RetryPolicyValidationError{ 3197 field: "RetryPriority", 3198 reason: "embedded message failed validation", 3199 cause: err, 3200 }) 3201 } 3202 } 3203 } else if v, ok := interface{}(m.GetRetryPriority()).(interface{ Validate() error }); ok { 3204 if err := v.Validate(); err != nil { 3205 return RetryPolicyValidationError{ 3206 field: "RetryPriority", 3207 reason: "embedded message failed validation", 3208 cause: err, 3209 } 3210 } 3211 } 3212 3213 for idx, item := range m.GetRetryHostPredicate() { 3214 _, _ = idx, item 3215 3216 if all { 3217 switch v := interface{}(item).(type) { 3218 case interface{ ValidateAll() error }: 3219 if err := v.ValidateAll(); err != nil { 3220 errors = append(errors, RetryPolicyValidationError{ 3221 field: fmt.Sprintf("RetryHostPredicate[%v]", idx), 3222 reason: "embedded message failed validation", 3223 cause: err, 3224 }) 3225 } 3226 case interface{ Validate() error }: 3227 if err := v.Validate(); err != nil { 3228 errors = append(errors, RetryPolicyValidationError{ 3229 field: fmt.Sprintf("RetryHostPredicate[%v]", idx), 3230 reason: "embedded message failed validation", 3231 cause: err, 3232 }) 3233 } 3234 } 3235 } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { 3236 if err := v.Validate(); err != nil { 3237 return RetryPolicyValidationError{ 3238 field: fmt.Sprintf("RetryHostPredicate[%v]", idx), 3239 reason: "embedded message failed validation", 3240 cause: err, 3241 } 3242 } 3243 } 3244 3245 } 3246 3247 for idx, item := range m.GetRetryOptionsPredicates() { 3248 _, _ = idx, item 3249 3250 if all { 3251 switch v := interface{}(item).(type) { 3252 case interface{ ValidateAll() error }: 3253 if err := v.ValidateAll(); err != nil { 3254 errors = append(errors, RetryPolicyValidationError{ 3255 field: fmt.Sprintf("RetryOptionsPredicates[%v]", idx), 3256 reason: "embedded message failed validation", 3257 cause: err, 3258 }) 3259 } 3260 case interface{ Validate() error }: 3261 if err := v.Validate(); err != nil { 3262 errors = append(errors, RetryPolicyValidationError{ 3263 field: fmt.Sprintf("RetryOptionsPredicates[%v]", idx), 3264 reason: "embedded message failed validation", 3265 cause: err, 3266 }) 3267 } 3268 } 3269 } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { 3270 if err := v.Validate(); err != nil { 3271 return RetryPolicyValidationError{ 3272 field: fmt.Sprintf("RetryOptionsPredicates[%v]", idx), 3273 reason: "embedded message failed validation", 3274 cause: err, 3275 } 3276 } 3277 } 3278 3279 } 3280 3281 // no validation rules for HostSelectionRetryMaxAttempts 3282 3283 if all { 3284 switch v := interface{}(m.GetRetryBackOff()).(type) { 3285 case interface{ ValidateAll() error }: 3286 if err := v.ValidateAll(); err != nil { 3287 errors = append(errors, RetryPolicyValidationError{ 3288 field: "RetryBackOff", 3289 reason: "embedded message failed validation", 3290 cause: err, 3291 }) 3292 } 3293 case interface{ Validate() error }: 3294 if err := v.Validate(); err != nil { 3295 errors = append(errors, RetryPolicyValidationError{ 3296 field: "RetryBackOff", 3297 reason: "embedded message failed validation", 3298 cause: err, 3299 }) 3300 } 3301 } 3302 } else if v, ok := interface{}(m.GetRetryBackOff()).(interface{ Validate() error }); ok { 3303 if err := v.Validate(); err != nil { 3304 return RetryPolicyValidationError{ 3305 field: "RetryBackOff", 3306 reason: "embedded message failed validation", 3307 cause: err, 3308 } 3309 } 3310 } 3311 3312 if all { 3313 switch v := interface{}(m.GetRateLimitedRetryBackOff()).(type) { 3314 case interface{ ValidateAll() error }: 3315 if err := v.ValidateAll(); err != nil { 3316 errors = append(errors, RetryPolicyValidationError{ 3317 field: "RateLimitedRetryBackOff", 3318 reason: "embedded message failed validation", 3319 cause: err, 3320 }) 3321 } 3322 case interface{ Validate() error }: 3323 if err := v.Validate(); err != nil { 3324 errors = append(errors, RetryPolicyValidationError{ 3325 field: "RateLimitedRetryBackOff", 3326 reason: "embedded message failed validation", 3327 cause: err, 3328 }) 3329 } 3330 } 3331 } else if v, ok := interface{}(m.GetRateLimitedRetryBackOff()).(interface{ Validate() error }); ok { 3332 if err := v.Validate(); err != nil { 3333 return RetryPolicyValidationError{ 3334 field: "RateLimitedRetryBackOff", 3335 reason: "embedded message failed validation", 3336 cause: err, 3337 } 3338 } 3339 } 3340 3341 for idx, item := range m.GetRetriableHeaders() { 3342 _, _ = idx, item 3343 3344 if all { 3345 switch v := interface{}(item).(type) { 3346 case interface{ ValidateAll() error }: 3347 if err := v.ValidateAll(); err != nil { 3348 errors = append(errors, RetryPolicyValidationError{ 3349 field: fmt.Sprintf("RetriableHeaders[%v]", idx), 3350 reason: "embedded message failed validation", 3351 cause: err, 3352 }) 3353 } 3354 case interface{ Validate() error }: 3355 if err := v.Validate(); err != nil { 3356 errors = append(errors, RetryPolicyValidationError{ 3357 field: fmt.Sprintf("RetriableHeaders[%v]", idx), 3358 reason: "embedded message failed validation", 3359 cause: err, 3360 }) 3361 } 3362 } 3363 } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { 3364 if err := v.Validate(); err != nil { 3365 return RetryPolicyValidationError{ 3366 field: fmt.Sprintf("RetriableHeaders[%v]", idx), 3367 reason: "embedded message failed validation", 3368 cause: err, 3369 } 3370 } 3371 } 3372 3373 } 3374 3375 for idx, item := range m.GetRetriableRequestHeaders() { 3376 _, _ = idx, item 3377 3378 if all { 3379 switch v := interface{}(item).(type) { 3380 case interface{ ValidateAll() error }: 3381 if err := v.ValidateAll(); err != nil { 3382 errors = append(errors, RetryPolicyValidationError{ 3383 field: fmt.Sprintf("RetriableRequestHeaders[%v]", idx), 3384 reason: "embedded message failed validation", 3385 cause: err, 3386 }) 3387 } 3388 case interface{ Validate() error }: 3389 if err := v.Validate(); err != nil { 3390 errors = append(errors, RetryPolicyValidationError{ 3391 field: fmt.Sprintf("RetriableRequestHeaders[%v]", idx), 3392 reason: "embedded message failed validation", 3393 cause: err, 3394 }) 3395 } 3396 } 3397 } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { 3398 if err := v.Validate(); err != nil { 3399 return RetryPolicyValidationError{ 3400 field: fmt.Sprintf("RetriableRequestHeaders[%v]", idx), 3401 reason: "embedded message failed validation", 3402 cause: err, 3403 } 3404 } 3405 } 3406 3407 } 3408 3409 if len(errors) > 0 { 3410 return RetryPolicyMultiError(errors) 3411 } 3412 return nil 3413} 3414 3415// RetryPolicyMultiError is an error wrapping multiple validation errors 3416// returned by RetryPolicy.ValidateAll() if the designated constraints aren't met. 3417type RetryPolicyMultiError []error 3418 3419// Error returns a concatenation of all the error messages it wraps. 3420func (m RetryPolicyMultiError) Error() string { 3421 var msgs []string 3422 for _, err := range m { 3423 msgs = append(msgs, err.Error()) 3424 } 3425 return strings.Join(msgs, "; ") 3426} 3427 3428// AllErrors returns a list of validation violation errors. 3429func (m RetryPolicyMultiError) AllErrors() []error { return m } 3430 3431// RetryPolicyValidationError is the validation error returned by 3432// RetryPolicy.Validate if the designated constraints aren't met. 3433type RetryPolicyValidationError struct { 3434 field string 3435 reason string 3436 cause error 3437 key bool 3438} 3439 3440// Field function returns field value. 3441func (e RetryPolicyValidationError) Field() string { return e.field } 3442 3443// Reason function returns reason value. 3444func (e RetryPolicyValidationError) Reason() string { return e.reason } 3445 3446// Cause function returns cause value. 3447func (e RetryPolicyValidationError) Cause() error { return e.cause } 3448 3449// Key function returns key value. 3450func (e RetryPolicyValidationError) Key() bool { return e.key } 3451 3452// ErrorName returns error name. 3453func (e RetryPolicyValidationError) ErrorName() string { return "RetryPolicyValidationError" } 3454 3455// Error satisfies the builtin error interface 3456func (e RetryPolicyValidationError) Error() string { 3457 cause := "" 3458 if e.cause != nil { 3459 cause = fmt.Sprintf(" | caused by: %v", e.cause) 3460 } 3461 3462 key := "" 3463 if e.key { 3464 key = "key for " 3465 } 3466 3467 return fmt.Sprintf( 3468 "invalid %sRetryPolicy.%s: %s%s", 3469 key, 3470 e.field, 3471 e.reason, 3472 cause) 3473} 3474 3475var _ error = RetryPolicyValidationError{} 3476 3477var _ interface { 3478 Field() string 3479 Reason() string 3480 Key() bool 3481 Cause() error 3482 ErrorName() string 3483} = RetryPolicyValidationError{} 3484 3485// Validate checks the field values on HedgePolicy with the rules defined in 3486// the proto definition for this message. If any rules are violated, the first 3487// error encountered is returned, or nil if there are no violations. 3488func (m *HedgePolicy) Validate() error { 3489 return m.validate(false) 3490} 3491 3492// ValidateAll checks the field values on HedgePolicy with the rules defined in 3493// the proto definition for this message. If any rules are violated, the 3494// result is a list of violation errors wrapped in HedgePolicyMultiError, or 3495// nil if none found. 3496func (m *HedgePolicy) ValidateAll() error { 3497 return m.validate(true) 3498} 3499 3500func (m *HedgePolicy) validate(all bool) error { 3501 if m == nil { 3502 return nil 3503 } 3504 3505 var errors []error 3506 3507 if wrapper := m.GetInitialRequests(); wrapper != nil { 3508 3509 if wrapper.GetValue() < 1 { 3510 err := HedgePolicyValidationError{ 3511 field: "InitialRequests", 3512 reason: "value must be greater than or equal to 1", 3513 } 3514 if !all { 3515 return err 3516 } 3517 errors = append(errors, err) 3518 } 3519 3520 } 3521 3522 if all { 3523 switch v := interface{}(m.GetAdditionalRequestChance()).(type) { 3524 case interface{ ValidateAll() error }: 3525 if err := v.ValidateAll(); err != nil { 3526 errors = append(errors, HedgePolicyValidationError{ 3527 field: "AdditionalRequestChance", 3528 reason: "embedded message failed validation", 3529 cause: err, 3530 }) 3531 } 3532 case interface{ Validate() error }: 3533 if err := v.Validate(); err != nil { 3534 errors = append(errors, HedgePolicyValidationError{ 3535 field: "AdditionalRequestChance", 3536 reason: "embedded message failed validation", 3537 cause: err, 3538 }) 3539 } 3540 } 3541 } else if v, ok := interface{}(m.GetAdditionalRequestChance()).(interface{ Validate() error }); ok { 3542 if err := v.Validate(); err != nil { 3543 return HedgePolicyValidationError{ 3544 field: "AdditionalRequestChance", 3545 reason: "embedded message failed validation", 3546 cause: err, 3547 } 3548 } 3549 } 3550 3551 // no validation rules for HedgeOnPerTryTimeout 3552 3553 if len(errors) > 0 { 3554 return HedgePolicyMultiError(errors) 3555 } 3556 return nil 3557} 3558 3559// HedgePolicyMultiError is an error wrapping multiple validation errors 3560// returned by HedgePolicy.ValidateAll() if the designated constraints aren't met. 3561type HedgePolicyMultiError []error 3562 3563// Error returns a concatenation of all the error messages it wraps. 3564func (m HedgePolicyMultiError) Error() string { 3565 var msgs []string 3566 for _, err := range m { 3567 msgs = append(msgs, err.Error()) 3568 } 3569 return strings.Join(msgs, "; ") 3570} 3571 3572// AllErrors returns a list of validation violation errors. 3573func (m HedgePolicyMultiError) AllErrors() []error { return m } 3574 3575// HedgePolicyValidationError is the validation error returned by 3576// HedgePolicy.Validate if the designated constraints aren't met. 3577type HedgePolicyValidationError struct { 3578 field string 3579 reason string 3580 cause error 3581 key bool 3582} 3583 3584// Field function returns field value. 3585func (e HedgePolicyValidationError) Field() string { return e.field } 3586 3587// Reason function returns reason value. 3588func (e HedgePolicyValidationError) Reason() string { return e.reason } 3589 3590// Cause function returns cause value. 3591func (e HedgePolicyValidationError) Cause() error { return e.cause } 3592 3593// Key function returns key value. 3594func (e HedgePolicyValidationError) Key() bool { return e.key } 3595 3596// ErrorName returns error name. 3597func (e HedgePolicyValidationError) ErrorName() string { return "HedgePolicyValidationError" } 3598 3599// Error satisfies the builtin error interface 3600func (e HedgePolicyValidationError) Error() string { 3601 cause := "" 3602 if e.cause != nil { 3603 cause = fmt.Sprintf(" | caused by: %v", e.cause) 3604 } 3605 3606 key := "" 3607 if e.key { 3608 key = "key for " 3609 } 3610 3611 return fmt.Sprintf( 3612 "invalid %sHedgePolicy.%s: %s%s", 3613 key, 3614 e.field, 3615 e.reason, 3616 cause) 3617} 3618 3619var _ error = HedgePolicyValidationError{} 3620 3621var _ interface { 3622 Field() string 3623 Reason() string 3624 Key() bool 3625 Cause() error 3626 ErrorName() string 3627} = HedgePolicyValidationError{} 3628 3629// Validate checks the field values on RedirectAction with the rules defined in 3630// the proto definition for this message. If any rules are violated, the first 3631// error encountered is returned, or nil if there are no violations. 3632func (m *RedirectAction) Validate() error { 3633 return m.validate(false) 3634} 3635 3636// ValidateAll checks the field values on RedirectAction with the rules defined 3637// in the proto definition for this message. If any rules are violated, the 3638// result is a list of violation errors wrapped in RedirectActionMultiError, 3639// or nil if none found. 3640func (m *RedirectAction) ValidateAll() error { 3641 return m.validate(true) 3642} 3643 3644func (m *RedirectAction) validate(all bool) error { 3645 if m == nil { 3646 return nil 3647 } 3648 3649 var errors []error 3650 3651 if !_RedirectAction_HostRedirect_Pattern.MatchString(m.GetHostRedirect()) { 3652 err := RedirectActionValidationError{ 3653 field: "HostRedirect", 3654 reason: "value does not match regex pattern \"^[^\\x00\\n\\r]*$\"", 3655 } 3656 if !all { 3657 return err 3658 } 3659 errors = append(errors, err) 3660 } 3661 3662 // no validation rules for PortRedirect 3663 3664 if _, ok := RedirectAction_RedirectResponseCode_name[int32(m.GetResponseCode())]; !ok { 3665 err := RedirectActionValidationError{ 3666 field: "ResponseCode", 3667 reason: "value must be one of the defined enum values", 3668 } 3669 if !all { 3670 return err 3671 } 3672 errors = append(errors, err) 3673 } 3674 3675 // no validation rules for StripQuery 3676 3677 switch m.SchemeRewriteSpecifier.(type) { 3678 3679 case *RedirectAction_HttpsRedirect: 3680 // no validation rules for HttpsRedirect 3681 3682 case *RedirectAction_SchemeRedirect: 3683 // no validation rules for SchemeRedirect 3684 3685 } 3686 3687 switch m.PathRewriteSpecifier.(type) { 3688 3689 case *RedirectAction_PathRedirect: 3690 3691 if !_RedirectAction_PathRedirect_Pattern.MatchString(m.GetPathRedirect()) { 3692 err := RedirectActionValidationError{ 3693 field: "PathRedirect", 3694 reason: "value does not match regex pattern \"^[^\\x00\\n\\r]*$\"", 3695 } 3696 if !all { 3697 return err 3698 } 3699 errors = append(errors, err) 3700 } 3701 3702 case *RedirectAction_PrefixRewrite: 3703 3704 if !_RedirectAction_PrefixRewrite_Pattern.MatchString(m.GetPrefixRewrite()) { 3705 err := RedirectActionValidationError{ 3706 field: "PrefixRewrite", 3707 reason: "value does not match regex pattern \"^[^\\x00\\n\\r]*$\"", 3708 } 3709 if !all { 3710 return err 3711 } 3712 errors = append(errors, err) 3713 } 3714 3715 case *RedirectAction_RegexRewrite: 3716 3717 if all { 3718 switch v := interface{}(m.GetRegexRewrite()).(type) { 3719 case interface{ ValidateAll() error }: 3720 if err := v.ValidateAll(); err != nil { 3721 errors = append(errors, RedirectActionValidationError{ 3722 field: "RegexRewrite", 3723 reason: "embedded message failed validation", 3724 cause: err, 3725 }) 3726 } 3727 case interface{ Validate() error }: 3728 if err := v.Validate(); err != nil { 3729 errors = append(errors, RedirectActionValidationError{ 3730 field: "RegexRewrite", 3731 reason: "embedded message failed validation", 3732 cause: err, 3733 }) 3734 } 3735 } 3736 } else if v, ok := interface{}(m.GetRegexRewrite()).(interface{ Validate() error }); ok { 3737 if err := v.Validate(); err != nil { 3738 return RedirectActionValidationError{ 3739 field: "RegexRewrite", 3740 reason: "embedded message failed validation", 3741 cause: err, 3742 } 3743 } 3744 } 3745 3746 } 3747 3748 if len(errors) > 0 { 3749 return RedirectActionMultiError(errors) 3750 } 3751 return nil 3752} 3753 3754// RedirectActionMultiError is an error wrapping multiple validation errors 3755// returned by RedirectAction.ValidateAll() if the designated constraints 3756// aren't met. 3757type RedirectActionMultiError []error 3758 3759// Error returns a concatenation of all the error messages it wraps. 3760func (m RedirectActionMultiError) Error() string { 3761 var msgs []string 3762 for _, err := range m { 3763 msgs = append(msgs, err.Error()) 3764 } 3765 return strings.Join(msgs, "; ") 3766} 3767 3768// AllErrors returns a list of validation violation errors. 3769func (m RedirectActionMultiError) AllErrors() []error { return m } 3770 3771// RedirectActionValidationError is the validation error returned by 3772// RedirectAction.Validate if the designated constraints aren't met. 3773type RedirectActionValidationError struct { 3774 field string 3775 reason string 3776 cause error 3777 key bool 3778} 3779 3780// Field function returns field value. 3781func (e RedirectActionValidationError) Field() string { return e.field } 3782 3783// Reason function returns reason value. 3784func (e RedirectActionValidationError) Reason() string { return e.reason } 3785 3786// Cause function returns cause value. 3787func (e RedirectActionValidationError) Cause() error { return e.cause } 3788 3789// Key function returns key value. 3790func (e RedirectActionValidationError) Key() bool { return e.key } 3791 3792// ErrorName returns error name. 3793func (e RedirectActionValidationError) ErrorName() string { return "RedirectActionValidationError" } 3794 3795// Error satisfies the builtin error interface 3796func (e RedirectActionValidationError) Error() string { 3797 cause := "" 3798 if e.cause != nil { 3799 cause = fmt.Sprintf(" | caused by: %v", e.cause) 3800 } 3801 3802 key := "" 3803 if e.key { 3804 key = "key for " 3805 } 3806 3807 return fmt.Sprintf( 3808 "invalid %sRedirectAction.%s: %s%s", 3809 key, 3810 e.field, 3811 e.reason, 3812 cause) 3813} 3814 3815var _ error = RedirectActionValidationError{} 3816 3817var _ interface { 3818 Field() string 3819 Reason() string 3820 Key() bool 3821 Cause() error 3822 ErrorName() string 3823} = RedirectActionValidationError{} 3824 3825var _RedirectAction_HostRedirect_Pattern = regexp.MustCompile("^[^\x00\n\r]*$") 3826 3827var _RedirectAction_PathRedirect_Pattern = regexp.MustCompile("^[^\x00\n\r]*$") 3828 3829var _RedirectAction_PrefixRewrite_Pattern = regexp.MustCompile("^[^\x00\n\r]*$") 3830 3831// Validate checks the field values on DirectResponseAction with the rules 3832// defined in the proto definition for this message. If any rules are 3833// violated, the first error encountered is returned, or nil if there are no violations. 3834func (m *DirectResponseAction) Validate() error { 3835 return m.validate(false) 3836} 3837 3838// ValidateAll checks the field values on DirectResponseAction with the rules 3839// defined in the proto definition for this message. If any rules are 3840// violated, the result is a list of violation errors wrapped in 3841// DirectResponseActionMultiError, or nil if none found. 3842func (m *DirectResponseAction) ValidateAll() error { 3843 return m.validate(true) 3844} 3845 3846func (m *DirectResponseAction) validate(all bool) error { 3847 if m == nil { 3848 return nil 3849 } 3850 3851 var errors []error 3852 3853 if val := m.GetStatus(); val < 100 || val >= 600 { 3854 err := DirectResponseActionValidationError{ 3855 field: "Status", 3856 reason: "value must be inside range [100, 600)", 3857 } 3858 if !all { 3859 return err 3860 } 3861 errors = append(errors, err) 3862 } 3863 3864 if all { 3865 switch v := interface{}(m.GetBody()).(type) { 3866 case interface{ ValidateAll() error }: 3867 if err := v.ValidateAll(); err != nil { 3868 errors = append(errors, DirectResponseActionValidationError{ 3869 field: "Body", 3870 reason: "embedded message failed validation", 3871 cause: err, 3872 }) 3873 } 3874 case interface{ Validate() error }: 3875 if err := v.Validate(); err != nil { 3876 errors = append(errors, DirectResponseActionValidationError{ 3877 field: "Body", 3878 reason: "embedded message failed validation", 3879 cause: err, 3880 }) 3881 } 3882 } 3883 } else if v, ok := interface{}(m.GetBody()).(interface{ Validate() error }); ok { 3884 if err := v.Validate(); err != nil { 3885 return DirectResponseActionValidationError{ 3886 field: "Body", 3887 reason: "embedded message failed validation", 3888 cause: err, 3889 } 3890 } 3891 } 3892 3893 if len(errors) > 0 { 3894 return DirectResponseActionMultiError(errors) 3895 } 3896 return nil 3897} 3898 3899// DirectResponseActionMultiError is an error wrapping multiple validation 3900// errors returned by DirectResponseAction.ValidateAll() if the designated 3901// constraints aren't met. 3902type DirectResponseActionMultiError []error 3903 3904// Error returns a concatenation of all the error messages it wraps. 3905func (m DirectResponseActionMultiError) Error() string { 3906 var msgs []string 3907 for _, err := range m { 3908 msgs = append(msgs, err.Error()) 3909 } 3910 return strings.Join(msgs, "; ") 3911} 3912 3913// AllErrors returns a list of validation violation errors. 3914func (m DirectResponseActionMultiError) AllErrors() []error { return m } 3915 3916// DirectResponseActionValidationError is the validation error returned by 3917// DirectResponseAction.Validate if the designated constraints aren't met. 3918type DirectResponseActionValidationError struct { 3919 field string 3920 reason string 3921 cause error 3922 key bool 3923} 3924 3925// Field function returns field value. 3926func (e DirectResponseActionValidationError) Field() string { return e.field } 3927 3928// Reason function returns reason value. 3929func (e DirectResponseActionValidationError) Reason() string { return e.reason } 3930 3931// Cause function returns cause value. 3932func (e DirectResponseActionValidationError) Cause() error { return e.cause } 3933 3934// Key function returns key value. 3935func (e DirectResponseActionValidationError) Key() bool { return e.key } 3936 3937// ErrorName returns error name. 3938func (e DirectResponseActionValidationError) ErrorName() string { 3939 return "DirectResponseActionValidationError" 3940} 3941 3942// Error satisfies the builtin error interface 3943func (e DirectResponseActionValidationError) Error() string { 3944 cause := "" 3945 if e.cause != nil { 3946 cause = fmt.Sprintf(" | caused by: %v", e.cause) 3947 } 3948 3949 key := "" 3950 if e.key { 3951 key = "key for " 3952 } 3953 3954 return fmt.Sprintf( 3955 "invalid %sDirectResponseAction.%s: %s%s", 3956 key, 3957 e.field, 3958 e.reason, 3959 cause) 3960} 3961 3962var _ error = DirectResponseActionValidationError{} 3963 3964var _ interface { 3965 Field() string 3966 Reason() string 3967 Key() bool 3968 Cause() error 3969 ErrorName() string 3970} = DirectResponseActionValidationError{} 3971 3972// Validate checks the field values on NonForwardingAction with the rules 3973// defined in the proto definition for this message. If any rules are 3974// violated, the first error encountered is returned, or nil if there are no violations. 3975func (m *NonForwardingAction) Validate() error { 3976 return m.validate(false) 3977} 3978 3979// ValidateAll checks the field values on NonForwardingAction with the rules 3980// defined in the proto definition for this message. If any rules are 3981// violated, the result is a list of violation errors wrapped in 3982// NonForwardingActionMultiError, or nil if none found. 3983func (m *NonForwardingAction) ValidateAll() error { 3984 return m.validate(true) 3985} 3986 3987func (m *NonForwardingAction) validate(all bool) error { 3988 if m == nil { 3989 return nil 3990 } 3991 3992 var errors []error 3993 3994 if len(errors) > 0 { 3995 return NonForwardingActionMultiError(errors) 3996 } 3997 return nil 3998} 3999 4000// NonForwardingActionMultiError is an error wrapping multiple validation 4001// errors returned by NonForwardingAction.ValidateAll() if the designated 4002// constraints aren't met. 4003type NonForwardingActionMultiError []error 4004 4005// Error returns a concatenation of all the error messages it wraps. 4006func (m NonForwardingActionMultiError) Error() string { 4007 var msgs []string 4008 for _, err := range m { 4009 msgs = append(msgs, err.Error()) 4010 } 4011 return strings.Join(msgs, "; ") 4012} 4013 4014// AllErrors returns a list of validation violation errors. 4015func (m NonForwardingActionMultiError) AllErrors() []error { return m } 4016 4017// NonForwardingActionValidationError is the validation error returned by 4018// NonForwardingAction.Validate if the designated constraints aren't met. 4019type NonForwardingActionValidationError struct { 4020 field string 4021 reason string 4022 cause error 4023 key bool 4024} 4025 4026// Field function returns field value. 4027func (e NonForwardingActionValidationError) Field() string { return e.field } 4028 4029// Reason function returns reason value. 4030func (e NonForwardingActionValidationError) Reason() string { return e.reason } 4031 4032// Cause function returns cause value. 4033func (e NonForwardingActionValidationError) Cause() error { return e.cause } 4034 4035// Key function returns key value. 4036func (e NonForwardingActionValidationError) Key() bool { return e.key } 4037 4038// ErrorName returns error name. 4039func (e NonForwardingActionValidationError) ErrorName() string { 4040 return "NonForwardingActionValidationError" 4041} 4042 4043// Error satisfies the builtin error interface 4044func (e NonForwardingActionValidationError) Error() string { 4045 cause := "" 4046 if e.cause != nil { 4047 cause = fmt.Sprintf(" | caused by: %v", e.cause) 4048 } 4049 4050 key := "" 4051 if e.key { 4052 key = "key for " 4053 } 4054 4055 return fmt.Sprintf( 4056 "invalid %sNonForwardingAction.%s: %s%s", 4057 key, 4058 e.field, 4059 e.reason, 4060 cause) 4061} 4062 4063var _ error = NonForwardingActionValidationError{} 4064 4065var _ interface { 4066 Field() string 4067 Reason() string 4068 Key() bool 4069 Cause() error 4070 ErrorName() string 4071} = NonForwardingActionValidationError{} 4072 4073// Validate checks the field values on Decorator with the rules defined in the 4074// proto definition for this message. If any rules are violated, the first 4075// error encountered is returned, or nil if there are no violations. 4076func (m *Decorator) Validate() error { 4077 return m.validate(false) 4078} 4079 4080// ValidateAll checks the field values on Decorator with the rules defined in 4081// the proto definition for this message. If any rules are violated, the 4082// result is a list of violation errors wrapped in DecoratorMultiError, or nil 4083// if none found. 4084func (m *Decorator) ValidateAll() error { 4085 return m.validate(true) 4086} 4087 4088func (m *Decorator) validate(all bool) error { 4089 if m == nil { 4090 return nil 4091 } 4092 4093 var errors []error 4094 4095 if utf8.RuneCountInString(m.GetOperation()) < 1 { 4096 err := DecoratorValidationError{ 4097 field: "Operation", 4098 reason: "value length must be at least 1 runes", 4099 } 4100 if !all { 4101 return err 4102 } 4103 errors = append(errors, err) 4104 } 4105 4106 if all { 4107 switch v := interface{}(m.GetPropagate()).(type) { 4108 case interface{ ValidateAll() error }: 4109 if err := v.ValidateAll(); err != nil { 4110 errors = append(errors, DecoratorValidationError{ 4111 field: "Propagate", 4112 reason: "embedded message failed validation", 4113 cause: err, 4114 }) 4115 } 4116 case interface{ Validate() error }: 4117 if err := v.Validate(); err != nil { 4118 errors = append(errors, DecoratorValidationError{ 4119 field: "Propagate", 4120 reason: "embedded message failed validation", 4121 cause: err, 4122 }) 4123 } 4124 } 4125 } else if v, ok := interface{}(m.GetPropagate()).(interface{ Validate() error }); ok { 4126 if err := v.Validate(); err != nil { 4127 return DecoratorValidationError{ 4128 field: "Propagate", 4129 reason: "embedded message failed validation", 4130 cause: err, 4131 } 4132 } 4133 } 4134 4135 if len(errors) > 0 { 4136 return DecoratorMultiError(errors) 4137 } 4138 return nil 4139} 4140 4141// DecoratorMultiError is an error wrapping multiple validation errors returned 4142// by Decorator.ValidateAll() if the designated constraints aren't met. 4143type DecoratorMultiError []error 4144 4145// Error returns a concatenation of all the error messages it wraps. 4146func (m DecoratorMultiError) Error() string { 4147 var msgs []string 4148 for _, err := range m { 4149 msgs = append(msgs, err.Error()) 4150 } 4151 return strings.Join(msgs, "; ") 4152} 4153 4154// AllErrors returns a list of validation violation errors. 4155func (m DecoratorMultiError) AllErrors() []error { return m } 4156 4157// DecoratorValidationError is the validation error returned by 4158// Decorator.Validate if the designated constraints aren't met. 4159type DecoratorValidationError struct { 4160 field string 4161 reason string 4162 cause error 4163 key bool 4164} 4165 4166// Field function returns field value. 4167func (e DecoratorValidationError) Field() string { return e.field } 4168 4169// Reason function returns reason value. 4170func (e DecoratorValidationError) Reason() string { return e.reason } 4171 4172// Cause function returns cause value. 4173func (e DecoratorValidationError) Cause() error { return e.cause } 4174 4175// Key function returns key value. 4176func (e DecoratorValidationError) Key() bool { return e.key } 4177 4178// ErrorName returns error name. 4179func (e DecoratorValidationError) ErrorName() string { return "DecoratorValidationError" } 4180 4181// Error satisfies the builtin error interface 4182func (e DecoratorValidationError) Error() string { 4183 cause := "" 4184 if e.cause != nil { 4185 cause = fmt.Sprintf(" | caused by: %v", e.cause) 4186 } 4187 4188 key := "" 4189 if e.key { 4190 key = "key for " 4191 } 4192 4193 return fmt.Sprintf( 4194 "invalid %sDecorator.%s: %s%s", 4195 key, 4196 e.field, 4197 e.reason, 4198 cause) 4199} 4200 4201var _ error = DecoratorValidationError{} 4202 4203var _ interface { 4204 Field() string 4205 Reason() string 4206 Key() bool 4207 Cause() error 4208 ErrorName() string 4209} = DecoratorValidationError{} 4210 4211// Validate checks the field values on Tracing with the rules defined in the 4212// proto definition for this message. If any rules are violated, the first 4213// error encountered is returned, or nil if there are no violations. 4214func (m *Tracing) Validate() error { 4215 return m.validate(false) 4216} 4217 4218// ValidateAll checks the field values on Tracing with the rules defined in the 4219// proto definition for this message. If any rules are violated, the result is 4220// a list of violation errors wrapped in TracingMultiError, or nil if none found. 4221func (m *Tracing) ValidateAll() error { 4222 return m.validate(true) 4223} 4224 4225func (m *Tracing) validate(all bool) error { 4226 if m == nil { 4227 return nil 4228 } 4229 4230 var errors []error 4231 4232 if all { 4233 switch v := interface{}(m.GetClientSampling()).(type) { 4234 case interface{ ValidateAll() error }: 4235 if err := v.ValidateAll(); err != nil { 4236 errors = append(errors, TracingValidationError{ 4237 field: "ClientSampling", 4238 reason: "embedded message failed validation", 4239 cause: err, 4240 }) 4241 } 4242 case interface{ Validate() error }: 4243 if err := v.Validate(); err != nil { 4244 errors = append(errors, TracingValidationError{ 4245 field: "ClientSampling", 4246 reason: "embedded message failed validation", 4247 cause: err, 4248 }) 4249 } 4250 } 4251 } else if v, ok := interface{}(m.GetClientSampling()).(interface{ Validate() error }); ok { 4252 if err := v.Validate(); err != nil { 4253 return TracingValidationError{ 4254 field: "ClientSampling", 4255 reason: "embedded message failed validation", 4256 cause: err, 4257 } 4258 } 4259 } 4260 4261 if all { 4262 switch v := interface{}(m.GetRandomSampling()).(type) { 4263 case interface{ ValidateAll() error }: 4264 if err := v.ValidateAll(); err != nil { 4265 errors = append(errors, TracingValidationError{ 4266 field: "RandomSampling", 4267 reason: "embedded message failed validation", 4268 cause: err, 4269 }) 4270 } 4271 case interface{ Validate() error }: 4272 if err := v.Validate(); err != nil { 4273 errors = append(errors, TracingValidationError{ 4274 field: "RandomSampling", 4275 reason: "embedded message failed validation", 4276 cause: err, 4277 }) 4278 } 4279 } 4280 } else if v, ok := interface{}(m.GetRandomSampling()).(interface{ Validate() error }); ok { 4281 if err := v.Validate(); err != nil { 4282 return TracingValidationError{ 4283 field: "RandomSampling", 4284 reason: "embedded message failed validation", 4285 cause: err, 4286 } 4287 } 4288 } 4289 4290 if all { 4291 switch v := interface{}(m.GetOverallSampling()).(type) { 4292 case interface{ ValidateAll() error }: 4293 if err := v.ValidateAll(); err != nil { 4294 errors = append(errors, TracingValidationError{ 4295 field: "OverallSampling", 4296 reason: "embedded message failed validation", 4297 cause: err, 4298 }) 4299 } 4300 case interface{ Validate() error }: 4301 if err := v.Validate(); err != nil { 4302 errors = append(errors, TracingValidationError{ 4303 field: "OverallSampling", 4304 reason: "embedded message failed validation", 4305 cause: err, 4306 }) 4307 } 4308 } 4309 } else if v, ok := interface{}(m.GetOverallSampling()).(interface{ Validate() error }); ok { 4310 if err := v.Validate(); err != nil { 4311 return TracingValidationError{ 4312 field: "OverallSampling", 4313 reason: "embedded message failed validation", 4314 cause: err, 4315 } 4316 } 4317 } 4318 4319 for idx, item := range m.GetCustomTags() { 4320 _, _ = idx, item 4321 4322 if all { 4323 switch v := interface{}(item).(type) { 4324 case interface{ ValidateAll() error }: 4325 if err := v.ValidateAll(); err != nil { 4326 errors = append(errors, TracingValidationError{ 4327 field: fmt.Sprintf("CustomTags[%v]", idx), 4328 reason: "embedded message failed validation", 4329 cause: err, 4330 }) 4331 } 4332 case interface{ Validate() error }: 4333 if err := v.Validate(); err != nil { 4334 errors = append(errors, TracingValidationError{ 4335 field: fmt.Sprintf("CustomTags[%v]", idx), 4336 reason: "embedded message failed validation", 4337 cause: err, 4338 }) 4339 } 4340 } 4341 } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { 4342 if err := v.Validate(); err != nil { 4343 return TracingValidationError{ 4344 field: fmt.Sprintf("CustomTags[%v]", idx), 4345 reason: "embedded message failed validation", 4346 cause: err, 4347 } 4348 } 4349 } 4350 4351 } 4352 4353 if len(errors) > 0 { 4354 return TracingMultiError(errors) 4355 } 4356 return nil 4357} 4358 4359// TracingMultiError is an error wrapping multiple validation errors returned 4360// by Tracing.ValidateAll() if the designated constraints aren't met. 4361type TracingMultiError []error 4362 4363// Error returns a concatenation of all the error messages it wraps. 4364func (m TracingMultiError) Error() string { 4365 var msgs []string 4366 for _, err := range m { 4367 msgs = append(msgs, err.Error()) 4368 } 4369 return strings.Join(msgs, "; ") 4370} 4371 4372// AllErrors returns a list of validation violation errors. 4373func (m TracingMultiError) AllErrors() []error { return m } 4374 4375// TracingValidationError is the validation error returned by Tracing.Validate 4376// if the designated constraints aren't met. 4377type TracingValidationError struct { 4378 field string 4379 reason string 4380 cause error 4381 key bool 4382} 4383 4384// Field function returns field value. 4385func (e TracingValidationError) Field() string { return e.field } 4386 4387// Reason function returns reason value. 4388func (e TracingValidationError) Reason() string { return e.reason } 4389 4390// Cause function returns cause value. 4391func (e TracingValidationError) Cause() error { return e.cause } 4392 4393// Key function returns key value. 4394func (e TracingValidationError) Key() bool { return e.key } 4395 4396// ErrorName returns error name. 4397func (e TracingValidationError) ErrorName() string { return "TracingValidationError" } 4398 4399// Error satisfies the builtin error interface 4400func (e TracingValidationError) Error() string { 4401 cause := "" 4402 if e.cause != nil { 4403 cause = fmt.Sprintf(" | caused by: %v", e.cause) 4404 } 4405 4406 key := "" 4407 if e.key { 4408 key = "key for " 4409 } 4410 4411 return fmt.Sprintf( 4412 "invalid %sTracing.%s: %s%s", 4413 key, 4414 e.field, 4415 e.reason, 4416 cause) 4417} 4418 4419var _ error = TracingValidationError{} 4420 4421var _ interface { 4422 Field() string 4423 Reason() string 4424 Key() bool 4425 Cause() error 4426 ErrorName() string 4427} = TracingValidationError{} 4428 4429// Validate checks the field values on VirtualCluster with the rules defined in 4430// the proto definition for this message. If any rules are violated, the first 4431// error encountered is returned, or nil if there are no violations. 4432func (m *VirtualCluster) Validate() error { 4433 return m.validate(false) 4434} 4435 4436// ValidateAll checks the field values on VirtualCluster with the rules defined 4437// in the proto definition for this message. If any rules are violated, the 4438// result is a list of violation errors wrapped in VirtualClusterMultiError, 4439// or nil if none found. 4440func (m *VirtualCluster) ValidateAll() error { 4441 return m.validate(true) 4442} 4443 4444func (m *VirtualCluster) validate(all bool) error { 4445 if m == nil { 4446 return nil 4447 } 4448 4449 var errors []error 4450 4451 for idx, item := range m.GetHeaders() { 4452 _, _ = idx, item 4453 4454 if all { 4455 switch v := interface{}(item).(type) { 4456 case interface{ ValidateAll() error }: 4457 if err := v.ValidateAll(); err != nil { 4458 errors = append(errors, VirtualClusterValidationError{ 4459 field: fmt.Sprintf("Headers[%v]", idx), 4460 reason: "embedded message failed validation", 4461 cause: err, 4462 }) 4463 } 4464 case interface{ Validate() error }: 4465 if err := v.Validate(); err != nil { 4466 errors = append(errors, VirtualClusterValidationError{ 4467 field: fmt.Sprintf("Headers[%v]", idx), 4468 reason: "embedded message failed validation", 4469 cause: err, 4470 }) 4471 } 4472 } 4473 } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { 4474 if err := v.Validate(); err != nil { 4475 return VirtualClusterValidationError{ 4476 field: fmt.Sprintf("Headers[%v]", idx), 4477 reason: "embedded message failed validation", 4478 cause: err, 4479 } 4480 } 4481 } 4482 4483 } 4484 4485 if utf8.RuneCountInString(m.GetName()) < 1 { 4486 err := VirtualClusterValidationError{ 4487 field: "Name", 4488 reason: "value length must be at least 1 runes", 4489 } 4490 if !all { 4491 return err 4492 } 4493 errors = append(errors, err) 4494 } 4495 4496 if len(errors) > 0 { 4497 return VirtualClusterMultiError(errors) 4498 } 4499 return nil 4500} 4501 4502// VirtualClusterMultiError is an error wrapping multiple validation errors 4503// returned by VirtualCluster.ValidateAll() if the designated constraints 4504// aren't met. 4505type VirtualClusterMultiError []error 4506 4507// Error returns a concatenation of all the error messages it wraps. 4508func (m VirtualClusterMultiError) Error() string { 4509 var msgs []string 4510 for _, err := range m { 4511 msgs = append(msgs, err.Error()) 4512 } 4513 return strings.Join(msgs, "; ") 4514} 4515 4516// AllErrors returns a list of validation violation errors. 4517func (m VirtualClusterMultiError) AllErrors() []error { return m } 4518 4519// VirtualClusterValidationError is the validation error returned by 4520// VirtualCluster.Validate if the designated constraints aren't met. 4521type VirtualClusterValidationError struct { 4522 field string 4523 reason string 4524 cause error 4525 key bool 4526} 4527 4528// Field function returns field value. 4529func (e VirtualClusterValidationError) Field() string { return e.field } 4530 4531// Reason function returns reason value. 4532func (e VirtualClusterValidationError) Reason() string { return e.reason } 4533 4534// Cause function returns cause value. 4535func (e VirtualClusterValidationError) Cause() error { return e.cause } 4536 4537// Key function returns key value. 4538func (e VirtualClusterValidationError) Key() bool { return e.key } 4539 4540// ErrorName returns error name. 4541func (e VirtualClusterValidationError) ErrorName() string { return "VirtualClusterValidationError" } 4542 4543// Error satisfies the builtin error interface 4544func (e VirtualClusterValidationError) Error() string { 4545 cause := "" 4546 if e.cause != nil { 4547 cause = fmt.Sprintf(" | caused by: %v", e.cause) 4548 } 4549 4550 key := "" 4551 if e.key { 4552 key = "key for " 4553 } 4554 4555 return fmt.Sprintf( 4556 "invalid %sVirtualCluster.%s: %s%s", 4557 key, 4558 e.field, 4559 e.reason, 4560 cause) 4561} 4562 4563var _ error = VirtualClusterValidationError{} 4564 4565var _ interface { 4566 Field() string 4567 Reason() string 4568 Key() bool 4569 Cause() error 4570 ErrorName() string 4571} = VirtualClusterValidationError{} 4572 4573// Validate checks the field values on RateLimit with the rules defined in the 4574// proto definition for this message. If any rules are violated, the first 4575// error encountered is returned, or nil if there are no violations. 4576func (m *RateLimit) Validate() error { 4577 return m.validate(false) 4578} 4579 4580// ValidateAll checks the field values on RateLimit with the rules defined in 4581// the proto definition for this message. If any rules are violated, the 4582// result is a list of violation errors wrapped in RateLimitMultiError, or nil 4583// if none found. 4584func (m *RateLimit) ValidateAll() error { 4585 return m.validate(true) 4586} 4587 4588func (m *RateLimit) validate(all bool) error { 4589 if m == nil { 4590 return nil 4591 } 4592 4593 var errors []error 4594 4595 if wrapper := m.GetStage(); wrapper != nil { 4596 4597 if wrapper.GetValue() > 10 { 4598 err := RateLimitValidationError{ 4599 field: "Stage", 4600 reason: "value must be less than or equal to 10", 4601 } 4602 if !all { 4603 return err 4604 } 4605 errors = append(errors, err) 4606 } 4607 4608 } 4609 4610 // no validation rules for DisableKey 4611 4612 if len(m.GetActions()) < 1 { 4613 err := RateLimitValidationError{ 4614 field: "Actions", 4615 reason: "value must contain at least 1 item(s)", 4616 } 4617 if !all { 4618 return err 4619 } 4620 errors = append(errors, err) 4621 } 4622 4623 for idx, item := range m.GetActions() { 4624 _, _ = idx, item 4625 4626 if all { 4627 switch v := interface{}(item).(type) { 4628 case interface{ ValidateAll() error }: 4629 if err := v.ValidateAll(); err != nil { 4630 errors = append(errors, RateLimitValidationError{ 4631 field: fmt.Sprintf("Actions[%v]", idx), 4632 reason: "embedded message failed validation", 4633 cause: err, 4634 }) 4635 } 4636 case interface{ Validate() error }: 4637 if err := v.Validate(); err != nil { 4638 errors = append(errors, RateLimitValidationError{ 4639 field: fmt.Sprintf("Actions[%v]", idx), 4640 reason: "embedded message failed validation", 4641 cause: err, 4642 }) 4643 } 4644 } 4645 } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { 4646 if err := v.Validate(); err != nil { 4647 return RateLimitValidationError{ 4648 field: fmt.Sprintf("Actions[%v]", idx), 4649 reason: "embedded message failed validation", 4650 cause: err, 4651 } 4652 } 4653 } 4654 4655 } 4656 4657 if all { 4658 switch v := interface{}(m.GetLimit()).(type) { 4659 case interface{ ValidateAll() error }: 4660 if err := v.ValidateAll(); err != nil { 4661 errors = append(errors, RateLimitValidationError{ 4662 field: "Limit", 4663 reason: "embedded message failed validation", 4664 cause: err, 4665 }) 4666 } 4667 case interface{ Validate() error }: 4668 if err := v.Validate(); err != nil { 4669 errors = append(errors, RateLimitValidationError{ 4670 field: "Limit", 4671 reason: "embedded message failed validation", 4672 cause: err, 4673 }) 4674 } 4675 } 4676 } else if v, ok := interface{}(m.GetLimit()).(interface{ Validate() error }); ok { 4677 if err := v.Validate(); err != nil { 4678 return RateLimitValidationError{ 4679 field: "Limit", 4680 reason: "embedded message failed validation", 4681 cause: err, 4682 } 4683 } 4684 } 4685 4686 if len(errors) > 0 { 4687 return RateLimitMultiError(errors) 4688 } 4689 return nil 4690} 4691 4692// RateLimitMultiError is an error wrapping multiple validation errors returned 4693// by RateLimit.ValidateAll() if the designated constraints aren't met. 4694type RateLimitMultiError []error 4695 4696// Error returns a concatenation of all the error messages it wraps. 4697func (m RateLimitMultiError) Error() string { 4698 var msgs []string 4699 for _, err := range m { 4700 msgs = append(msgs, err.Error()) 4701 } 4702 return strings.Join(msgs, "; ") 4703} 4704 4705// AllErrors returns a list of validation violation errors. 4706func (m RateLimitMultiError) AllErrors() []error { return m } 4707 4708// RateLimitValidationError is the validation error returned by 4709// RateLimit.Validate if the designated constraints aren't met. 4710type RateLimitValidationError struct { 4711 field string 4712 reason string 4713 cause error 4714 key bool 4715} 4716 4717// Field function returns field value. 4718func (e RateLimitValidationError) Field() string { return e.field } 4719 4720// Reason function returns reason value. 4721func (e RateLimitValidationError) Reason() string { return e.reason } 4722 4723// Cause function returns cause value. 4724func (e RateLimitValidationError) Cause() error { return e.cause } 4725 4726// Key function returns key value. 4727func (e RateLimitValidationError) Key() bool { return e.key } 4728 4729// ErrorName returns error name. 4730func (e RateLimitValidationError) ErrorName() string { return "RateLimitValidationError" } 4731 4732// Error satisfies the builtin error interface 4733func (e RateLimitValidationError) Error() string { 4734 cause := "" 4735 if e.cause != nil { 4736 cause = fmt.Sprintf(" | caused by: %v", e.cause) 4737 } 4738 4739 key := "" 4740 if e.key { 4741 key = "key for " 4742 } 4743 4744 return fmt.Sprintf( 4745 "invalid %sRateLimit.%s: %s%s", 4746 key, 4747 e.field, 4748 e.reason, 4749 cause) 4750} 4751 4752var _ error = RateLimitValidationError{} 4753 4754var _ interface { 4755 Field() string 4756 Reason() string 4757 Key() bool 4758 Cause() error 4759 ErrorName() string 4760} = RateLimitValidationError{} 4761 4762// Validate checks the field values on HeaderMatcher with the rules defined in 4763// the proto definition for this message. If any rules are violated, the first 4764// error encountered is returned, or nil if there are no violations. 4765func (m *HeaderMatcher) Validate() error { 4766 return m.validate(false) 4767} 4768 4769// ValidateAll checks the field values on HeaderMatcher with the rules defined 4770// in the proto definition for this message. If any rules are violated, the 4771// result is a list of violation errors wrapped in HeaderMatcherMultiError, or 4772// nil if none found. 4773func (m *HeaderMatcher) ValidateAll() error { 4774 return m.validate(true) 4775} 4776 4777func (m *HeaderMatcher) validate(all bool) error { 4778 if m == nil { 4779 return nil 4780 } 4781 4782 var errors []error 4783 4784 if utf8.RuneCountInString(m.GetName()) < 1 { 4785 err := HeaderMatcherValidationError{ 4786 field: "Name", 4787 reason: "value length must be at least 1 runes", 4788 } 4789 if !all { 4790 return err 4791 } 4792 errors = append(errors, err) 4793 } 4794 4795 if !_HeaderMatcher_Name_Pattern.MatchString(m.GetName()) { 4796 err := HeaderMatcherValidationError{ 4797 field: "Name", 4798 reason: "value does not match regex pattern \"^[^\\x00\\n\\r]*$\"", 4799 } 4800 if !all { 4801 return err 4802 } 4803 errors = append(errors, err) 4804 } 4805 4806 // no validation rules for InvertMatch 4807 4808 switch m.HeaderMatchSpecifier.(type) { 4809 4810 case *HeaderMatcher_ExactMatch: 4811 // no validation rules for ExactMatch 4812 4813 case *HeaderMatcher_SafeRegexMatch: 4814 4815 if all { 4816 switch v := interface{}(m.GetSafeRegexMatch()).(type) { 4817 case interface{ ValidateAll() error }: 4818 if err := v.ValidateAll(); err != nil { 4819 errors = append(errors, HeaderMatcherValidationError{ 4820 field: "SafeRegexMatch", 4821 reason: "embedded message failed validation", 4822 cause: err, 4823 }) 4824 } 4825 case interface{ Validate() error }: 4826 if err := v.Validate(); err != nil { 4827 errors = append(errors, HeaderMatcherValidationError{ 4828 field: "SafeRegexMatch", 4829 reason: "embedded message failed validation", 4830 cause: err, 4831 }) 4832 } 4833 } 4834 } else if v, ok := interface{}(m.GetSafeRegexMatch()).(interface{ Validate() error }); ok { 4835 if err := v.Validate(); err != nil { 4836 return HeaderMatcherValidationError{ 4837 field: "SafeRegexMatch", 4838 reason: "embedded message failed validation", 4839 cause: err, 4840 } 4841 } 4842 } 4843 4844 case *HeaderMatcher_RangeMatch: 4845 4846 if all { 4847 switch v := interface{}(m.GetRangeMatch()).(type) { 4848 case interface{ ValidateAll() error }: 4849 if err := v.ValidateAll(); err != nil { 4850 errors = append(errors, HeaderMatcherValidationError{ 4851 field: "RangeMatch", 4852 reason: "embedded message failed validation", 4853 cause: err, 4854 }) 4855 } 4856 case interface{ Validate() error }: 4857 if err := v.Validate(); err != nil { 4858 errors = append(errors, HeaderMatcherValidationError{ 4859 field: "RangeMatch", 4860 reason: "embedded message failed validation", 4861 cause: err, 4862 }) 4863 } 4864 } 4865 } else if v, ok := interface{}(m.GetRangeMatch()).(interface{ Validate() error }); ok { 4866 if err := v.Validate(); err != nil { 4867 return HeaderMatcherValidationError{ 4868 field: "RangeMatch", 4869 reason: "embedded message failed validation", 4870 cause: err, 4871 } 4872 } 4873 } 4874 4875 case *HeaderMatcher_PresentMatch: 4876 // no validation rules for PresentMatch 4877 4878 case *HeaderMatcher_PrefixMatch: 4879 4880 if utf8.RuneCountInString(m.GetPrefixMatch()) < 1 { 4881 err := HeaderMatcherValidationError{ 4882 field: "PrefixMatch", 4883 reason: "value length must be at least 1 runes", 4884 } 4885 if !all { 4886 return err 4887 } 4888 errors = append(errors, err) 4889 } 4890 4891 case *HeaderMatcher_SuffixMatch: 4892 4893 if utf8.RuneCountInString(m.GetSuffixMatch()) < 1 { 4894 err := HeaderMatcherValidationError{ 4895 field: "SuffixMatch", 4896 reason: "value length must be at least 1 runes", 4897 } 4898 if !all { 4899 return err 4900 } 4901 errors = append(errors, err) 4902 } 4903 4904 case *HeaderMatcher_ContainsMatch: 4905 4906 if utf8.RuneCountInString(m.GetContainsMatch()) < 1 { 4907 err := HeaderMatcherValidationError{ 4908 field: "ContainsMatch", 4909 reason: "value length must be at least 1 runes", 4910 } 4911 if !all { 4912 return err 4913 } 4914 errors = append(errors, err) 4915 } 4916 4917 case *HeaderMatcher_StringMatch: 4918 4919 if all { 4920 switch v := interface{}(m.GetStringMatch()).(type) { 4921 case interface{ ValidateAll() error }: 4922 if err := v.ValidateAll(); err != nil { 4923 errors = append(errors, HeaderMatcherValidationError{ 4924 field: "StringMatch", 4925 reason: "embedded message failed validation", 4926 cause: err, 4927 }) 4928 } 4929 case interface{ Validate() error }: 4930 if err := v.Validate(); err != nil { 4931 errors = append(errors, HeaderMatcherValidationError{ 4932 field: "StringMatch", 4933 reason: "embedded message failed validation", 4934 cause: err, 4935 }) 4936 } 4937 } 4938 } else if v, ok := interface{}(m.GetStringMatch()).(interface{ Validate() error }); ok { 4939 if err := v.Validate(); err != nil { 4940 return HeaderMatcherValidationError{ 4941 field: "StringMatch", 4942 reason: "embedded message failed validation", 4943 cause: err, 4944 } 4945 } 4946 } 4947 4948 } 4949 4950 if len(errors) > 0 { 4951 return HeaderMatcherMultiError(errors) 4952 } 4953 return nil 4954} 4955 4956// HeaderMatcherMultiError is an error wrapping multiple validation errors 4957// returned by HeaderMatcher.ValidateAll() if the designated constraints 4958// aren't met. 4959type HeaderMatcherMultiError []error 4960 4961// Error returns a concatenation of all the error messages it wraps. 4962func (m HeaderMatcherMultiError) Error() string { 4963 var msgs []string 4964 for _, err := range m { 4965 msgs = append(msgs, err.Error()) 4966 } 4967 return strings.Join(msgs, "; ") 4968} 4969 4970// AllErrors returns a list of validation violation errors. 4971func (m HeaderMatcherMultiError) AllErrors() []error { return m } 4972 4973// HeaderMatcherValidationError is the validation error returned by 4974// HeaderMatcher.Validate if the designated constraints aren't met. 4975type HeaderMatcherValidationError struct { 4976 field string 4977 reason string 4978 cause error 4979 key bool 4980} 4981 4982// Field function returns field value. 4983func (e HeaderMatcherValidationError) Field() string { return e.field } 4984 4985// Reason function returns reason value. 4986func (e HeaderMatcherValidationError) Reason() string { return e.reason } 4987 4988// Cause function returns cause value. 4989func (e HeaderMatcherValidationError) Cause() error { return e.cause } 4990 4991// Key function returns key value. 4992func (e HeaderMatcherValidationError) Key() bool { return e.key } 4993 4994// ErrorName returns error name. 4995func (e HeaderMatcherValidationError) ErrorName() string { return "HeaderMatcherValidationError" } 4996 4997// Error satisfies the builtin error interface 4998func (e HeaderMatcherValidationError) Error() string { 4999 cause := "" 5000 if e.cause != nil { 5001 cause = fmt.Sprintf(" | caused by: %v", e.cause) 5002 } 5003 5004 key := "" 5005 if e.key { 5006 key = "key for " 5007 } 5008 5009 return fmt.Sprintf( 5010 "invalid %sHeaderMatcher.%s: %s%s", 5011 key, 5012 e.field, 5013 e.reason, 5014 cause) 5015} 5016 5017var _ error = HeaderMatcherValidationError{} 5018 5019var _ interface { 5020 Field() string 5021 Reason() string 5022 Key() bool 5023 Cause() error 5024 ErrorName() string 5025} = HeaderMatcherValidationError{} 5026 5027var _HeaderMatcher_Name_Pattern = regexp.MustCompile("^[^\x00\n\r]*$") 5028 5029// Validate checks the field values on QueryParameterMatcher with the rules 5030// defined in the proto definition for this message. If any rules are 5031// violated, the first error encountered is returned, or nil if there are no violations. 5032func (m *QueryParameterMatcher) Validate() error { 5033 return m.validate(false) 5034} 5035 5036// ValidateAll checks the field values on QueryParameterMatcher with the rules 5037// defined in the proto definition for this message. If any rules are 5038// violated, the result is a list of violation errors wrapped in 5039// QueryParameterMatcherMultiError, or nil if none found. 5040func (m *QueryParameterMatcher) ValidateAll() error { 5041 return m.validate(true) 5042} 5043 5044func (m *QueryParameterMatcher) validate(all bool) error { 5045 if m == nil { 5046 return nil 5047 } 5048 5049 var errors []error 5050 5051 if utf8.RuneCountInString(m.GetName()) < 1 { 5052 err := QueryParameterMatcherValidationError{ 5053 field: "Name", 5054 reason: "value length must be at least 1 runes", 5055 } 5056 if !all { 5057 return err 5058 } 5059 errors = append(errors, err) 5060 } 5061 5062 if len(m.GetName()) > 1024 { 5063 err := QueryParameterMatcherValidationError{ 5064 field: "Name", 5065 reason: "value length must be at most 1024 bytes", 5066 } 5067 if !all { 5068 return err 5069 } 5070 errors = append(errors, err) 5071 } 5072 5073 switch m.QueryParameterMatchSpecifier.(type) { 5074 5075 case *QueryParameterMatcher_StringMatch: 5076 5077 if m.GetStringMatch() == nil { 5078 err := QueryParameterMatcherValidationError{ 5079 field: "StringMatch", 5080 reason: "value is required", 5081 } 5082 if !all { 5083 return err 5084 } 5085 errors = append(errors, err) 5086 } 5087 5088 if all { 5089 switch v := interface{}(m.GetStringMatch()).(type) { 5090 case interface{ ValidateAll() error }: 5091 if err := v.ValidateAll(); err != nil { 5092 errors = append(errors, QueryParameterMatcherValidationError{ 5093 field: "StringMatch", 5094 reason: "embedded message failed validation", 5095 cause: err, 5096 }) 5097 } 5098 case interface{ Validate() error }: 5099 if err := v.Validate(); err != nil { 5100 errors = append(errors, QueryParameterMatcherValidationError{ 5101 field: "StringMatch", 5102 reason: "embedded message failed validation", 5103 cause: err, 5104 }) 5105 } 5106 } 5107 } else if v, ok := interface{}(m.GetStringMatch()).(interface{ Validate() error }); ok { 5108 if err := v.Validate(); err != nil { 5109 return QueryParameterMatcherValidationError{ 5110 field: "StringMatch", 5111 reason: "embedded message failed validation", 5112 cause: err, 5113 } 5114 } 5115 } 5116 5117 case *QueryParameterMatcher_PresentMatch: 5118 // no validation rules for PresentMatch 5119 5120 } 5121 5122 if len(errors) > 0 { 5123 return QueryParameterMatcherMultiError(errors) 5124 } 5125 return nil 5126} 5127 5128// QueryParameterMatcherMultiError is an error wrapping multiple validation 5129// errors returned by QueryParameterMatcher.ValidateAll() if the designated 5130// constraints aren't met. 5131type QueryParameterMatcherMultiError []error 5132 5133// Error returns a concatenation of all the error messages it wraps. 5134func (m QueryParameterMatcherMultiError) Error() string { 5135 var msgs []string 5136 for _, err := range m { 5137 msgs = append(msgs, err.Error()) 5138 } 5139 return strings.Join(msgs, "; ") 5140} 5141 5142// AllErrors returns a list of validation violation errors. 5143func (m QueryParameterMatcherMultiError) AllErrors() []error { return m } 5144 5145// QueryParameterMatcherValidationError is the validation error returned by 5146// QueryParameterMatcher.Validate if the designated constraints aren't met. 5147type QueryParameterMatcherValidationError struct { 5148 field string 5149 reason string 5150 cause error 5151 key bool 5152} 5153 5154// Field function returns field value. 5155func (e QueryParameterMatcherValidationError) Field() string { return e.field } 5156 5157// Reason function returns reason value. 5158func (e QueryParameterMatcherValidationError) Reason() string { return e.reason } 5159 5160// Cause function returns cause value. 5161func (e QueryParameterMatcherValidationError) Cause() error { return e.cause } 5162 5163// Key function returns key value. 5164func (e QueryParameterMatcherValidationError) Key() bool { return e.key } 5165 5166// ErrorName returns error name. 5167func (e QueryParameterMatcherValidationError) ErrorName() string { 5168 return "QueryParameterMatcherValidationError" 5169} 5170 5171// Error satisfies the builtin error interface 5172func (e QueryParameterMatcherValidationError) Error() string { 5173 cause := "" 5174 if e.cause != nil { 5175 cause = fmt.Sprintf(" | caused by: %v", e.cause) 5176 } 5177 5178 key := "" 5179 if e.key { 5180 key = "key for " 5181 } 5182 5183 return fmt.Sprintf( 5184 "invalid %sQueryParameterMatcher.%s: %s%s", 5185 key, 5186 e.field, 5187 e.reason, 5188 cause) 5189} 5190 5191var _ error = QueryParameterMatcherValidationError{} 5192 5193var _ interface { 5194 Field() string 5195 Reason() string 5196 Key() bool 5197 Cause() error 5198 ErrorName() string 5199} = QueryParameterMatcherValidationError{} 5200 5201// Validate checks the field values on InternalRedirectPolicy with the rules 5202// defined in the proto definition for this message. If any rules are 5203// violated, the first error encountered is returned, or nil if there are no violations. 5204func (m *InternalRedirectPolicy) Validate() error { 5205 return m.validate(false) 5206} 5207 5208// ValidateAll checks the field values on InternalRedirectPolicy with the rules 5209// defined in the proto definition for this message. If any rules are 5210// violated, the result is a list of violation errors wrapped in 5211// InternalRedirectPolicyMultiError, or nil if none found. 5212func (m *InternalRedirectPolicy) ValidateAll() error { 5213 return m.validate(true) 5214} 5215 5216func (m *InternalRedirectPolicy) validate(all bool) error { 5217 if m == nil { 5218 return nil 5219 } 5220 5221 var errors []error 5222 5223 if all { 5224 switch v := interface{}(m.GetMaxInternalRedirects()).(type) { 5225 case interface{ ValidateAll() error }: 5226 if err := v.ValidateAll(); err != nil { 5227 errors = append(errors, InternalRedirectPolicyValidationError{ 5228 field: "MaxInternalRedirects", 5229 reason: "embedded message failed validation", 5230 cause: err, 5231 }) 5232 } 5233 case interface{ Validate() error }: 5234 if err := v.Validate(); err != nil { 5235 errors = append(errors, InternalRedirectPolicyValidationError{ 5236 field: "MaxInternalRedirects", 5237 reason: "embedded message failed validation", 5238 cause: err, 5239 }) 5240 } 5241 } 5242 } else if v, ok := interface{}(m.GetMaxInternalRedirects()).(interface{ Validate() error }); ok { 5243 if err := v.Validate(); err != nil { 5244 return InternalRedirectPolicyValidationError{ 5245 field: "MaxInternalRedirects", 5246 reason: "embedded message failed validation", 5247 cause: err, 5248 } 5249 } 5250 } 5251 5252 if len(m.GetRedirectResponseCodes()) > 5 { 5253 err := InternalRedirectPolicyValidationError{ 5254 field: "RedirectResponseCodes", 5255 reason: "value must contain no more than 5 item(s)", 5256 } 5257 if !all { 5258 return err 5259 } 5260 errors = append(errors, err) 5261 } 5262 5263 for idx, item := range m.GetPredicates() { 5264 _, _ = idx, item 5265 5266 if all { 5267 switch v := interface{}(item).(type) { 5268 case interface{ ValidateAll() error }: 5269 if err := v.ValidateAll(); err != nil { 5270 errors = append(errors, InternalRedirectPolicyValidationError{ 5271 field: fmt.Sprintf("Predicates[%v]", idx), 5272 reason: "embedded message failed validation", 5273 cause: err, 5274 }) 5275 } 5276 case interface{ Validate() error }: 5277 if err := v.Validate(); err != nil { 5278 errors = append(errors, InternalRedirectPolicyValidationError{ 5279 field: fmt.Sprintf("Predicates[%v]", idx), 5280 reason: "embedded message failed validation", 5281 cause: err, 5282 }) 5283 } 5284 } 5285 } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { 5286 if err := v.Validate(); err != nil { 5287 return InternalRedirectPolicyValidationError{ 5288 field: fmt.Sprintf("Predicates[%v]", idx), 5289 reason: "embedded message failed validation", 5290 cause: err, 5291 } 5292 } 5293 } 5294 5295 } 5296 5297 // no validation rules for AllowCrossSchemeRedirect 5298 5299 if len(errors) > 0 { 5300 return InternalRedirectPolicyMultiError(errors) 5301 } 5302 return nil 5303} 5304 5305// InternalRedirectPolicyMultiError is an error wrapping multiple validation 5306// errors returned by InternalRedirectPolicy.ValidateAll() if the designated 5307// constraints aren't met. 5308type InternalRedirectPolicyMultiError []error 5309 5310// Error returns a concatenation of all the error messages it wraps. 5311func (m InternalRedirectPolicyMultiError) Error() string { 5312 var msgs []string 5313 for _, err := range m { 5314 msgs = append(msgs, err.Error()) 5315 } 5316 return strings.Join(msgs, "; ") 5317} 5318 5319// AllErrors returns a list of validation violation errors. 5320func (m InternalRedirectPolicyMultiError) AllErrors() []error { return m } 5321 5322// InternalRedirectPolicyValidationError is the validation error returned by 5323// InternalRedirectPolicy.Validate if the designated constraints aren't met. 5324type InternalRedirectPolicyValidationError struct { 5325 field string 5326 reason string 5327 cause error 5328 key bool 5329} 5330 5331// Field function returns field value. 5332func (e InternalRedirectPolicyValidationError) Field() string { return e.field } 5333 5334// Reason function returns reason value. 5335func (e InternalRedirectPolicyValidationError) Reason() string { return e.reason } 5336 5337// Cause function returns cause value. 5338func (e InternalRedirectPolicyValidationError) Cause() error { return e.cause } 5339 5340// Key function returns key value. 5341func (e InternalRedirectPolicyValidationError) Key() bool { return e.key } 5342 5343// ErrorName returns error name. 5344func (e InternalRedirectPolicyValidationError) ErrorName() string { 5345 return "InternalRedirectPolicyValidationError" 5346} 5347 5348// Error satisfies the builtin error interface 5349func (e InternalRedirectPolicyValidationError) Error() string { 5350 cause := "" 5351 if e.cause != nil { 5352 cause = fmt.Sprintf(" | caused by: %v", e.cause) 5353 } 5354 5355 key := "" 5356 if e.key { 5357 key = "key for " 5358 } 5359 5360 return fmt.Sprintf( 5361 "invalid %sInternalRedirectPolicy.%s: %s%s", 5362 key, 5363 e.field, 5364 e.reason, 5365 cause) 5366} 5367 5368var _ error = InternalRedirectPolicyValidationError{} 5369 5370var _ interface { 5371 Field() string 5372 Reason() string 5373 Key() bool 5374 Cause() error 5375 ErrorName() string 5376} = InternalRedirectPolicyValidationError{} 5377 5378// Validate checks the field values on FilterConfig with the rules defined in 5379// the proto definition for this message. If any rules are violated, the first 5380// error encountered is returned, or nil if there are no violations. 5381func (m *FilterConfig) Validate() error { 5382 return m.validate(false) 5383} 5384 5385// ValidateAll checks the field values on FilterConfig with the rules defined 5386// in the proto definition for this message. If any rules are violated, the 5387// result is a list of violation errors wrapped in FilterConfigMultiError, or 5388// nil if none found. 5389func (m *FilterConfig) ValidateAll() error { 5390 return m.validate(true) 5391} 5392 5393func (m *FilterConfig) validate(all bool) error { 5394 if m == nil { 5395 return nil 5396 } 5397 5398 var errors []error 5399 5400 if all { 5401 switch v := interface{}(m.GetConfig()).(type) { 5402 case interface{ ValidateAll() error }: 5403 if err := v.ValidateAll(); err != nil { 5404 errors = append(errors, FilterConfigValidationError{ 5405 field: "Config", 5406 reason: "embedded message failed validation", 5407 cause: err, 5408 }) 5409 } 5410 case interface{ Validate() error }: 5411 if err := v.Validate(); err != nil { 5412 errors = append(errors, FilterConfigValidationError{ 5413 field: "Config", 5414 reason: "embedded message failed validation", 5415 cause: err, 5416 }) 5417 } 5418 } 5419 } else if v, ok := interface{}(m.GetConfig()).(interface{ Validate() error }); ok { 5420 if err := v.Validate(); err != nil { 5421 return FilterConfigValidationError{ 5422 field: "Config", 5423 reason: "embedded message failed validation", 5424 cause: err, 5425 } 5426 } 5427 } 5428 5429 // no validation rules for IsOptional 5430 5431 if len(errors) > 0 { 5432 return FilterConfigMultiError(errors) 5433 } 5434 return nil 5435} 5436 5437// FilterConfigMultiError is an error wrapping multiple validation errors 5438// returned by FilterConfig.ValidateAll() if the designated constraints aren't met. 5439type FilterConfigMultiError []error 5440 5441// Error returns a concatenation of all the error messages it wraps. 5442func (m FilterConfigMultiError) Error() string { 5443 var msgs []string 5444 for _, err := range m { 5445 msgs = append(msgs, err.Error()) 5446 } 5447 return strings.Join(msgs, "; ") 5448} 5449 5450// AllErrors returns a list of validation violation errors. 5451func (m FilterConfigMultiError) AllErrors() []error { return m } 5452 5453// FilterConfigValidationError is the validation error returned by 5454// FilterConfig.Validate if the designated constraints aren't met. 5455type FilterConfigValidationError struct { 5456 field string 5457 reason string 5458 cause error 5459 key bool 5460} 5461 5462// Field function returns field value. 5463func (e FilterConfigValidationError) Field() string { return e.field } 5464 5465// Reason function returns reason value. 5466func (e FilterConfigValidationError) Reason() string { return e.reason } 5467 5468// Cause function returns cause value. 5469func (e FilterConfigValidationError) Cause() error { return e.cause } 5470 5471// Key function returns key value. 5472func (e FilterConfigValidationError) Key() bool { return e.key } 5473 5474// ErrorName returns error name. 5475func (e FilterConfigValidationError) ErrorName() string { return "FilterConfigValidationError" } 5476 5477// Error satisfies the builtin error interface 5478func (e FilterConfigValidationError) Error() string { 5479 cause := "" 5480 if e.cause != nil { 5481 cause = fmt.Sprintf(" | caused by: %v", e.cause) 5482 } 5483 5484 key := "" 5485 if e.key { 5486 key = "key for " 5487 } 5488 5489 return fmt.Sprintf( 5490 "invalid %sFilterConfig.%s: %s%s", 5491 key, 5492 e.field, 5493 e.reason, 5494 cause) 5495} 5496 5497var _ error = FilterConfigValidationError{} 5498 5499var _ interface { 5500 Field() string 5501 Reason() string 5502 Key() bool 5503 Cause() error 5504 ErrorName() string 5505} = FilterConfigValidationError{} 5506 5507// Validate checks the field values on WeightedCluster_ClusterWeight with the 5508// rules defined in the proto definition for this message. If any rules are 5509// violated, the first error encountered is returned, or nil if there are no violations. 5510func (m *WeightedCluster_ClusterWeight) Validate() error { 5511 return m.validate(false) 5512} 5513 5514// ValidateAll checks the field values on WeightedCluster_ClusterWeight with 5515// the rules defined in the proto definition for this message. If any rules 5516// are violated, the result is a list of violation errors wrapped in 5517// WeightedCluster_ClusterWeightMultiError, or nil if none found. 5518func (m *WeightedCluster_ClusterWeight) ValidateAll() error { 5519 return m.validate(true) 5520} 5521 5522func (m *WeightedCluster_ClusterWeight) validate(all bool) error { 5523 if m == nil { 5524 return nil 5525 } 5526 5527 var errors []error 5528 5529 // no validation rules for Name 5530 5531 if !_WeightedCluster_ClusterWeight_ClusterHeader_Pattern.MatchString(m.GetClusterHeader()) { 5532 err := WeightedCluster_ClusterWeightValidationError{ 5533 field: "ClusterHeader", 5534 reason: "value does not match regex pattern \"^[^\\x00\\n\\r]*$\"", 5535 } 5536 if !all { 5537 return err 5538 } 5539 errors = append(errors, err) 5540 } 5541 5542 if all { 5543 switch v := interface{}(m.GetWeight()).(type) { 5544 case interface{ ValidateAll() error }: 5545 if err := v.ValidateAll(); err != nil { 5546 errors = append(errors, WeightedCluster_ClusterWeightValidationError{ 5547 field: "Weight", 5548 reason: "embedded message failed validation", 5549 cause: err, 5550 }) 5551 } 5552 case interface{ Validate() error }: 5553 if err := v.Validate(); err != nil { 5554 errors = append(errors, WeightedCluster_ClusterWeightValidationError{ 5555 field: "Weight", 5556 reason: "embedded message failed validation", 5557 cause: err, 5558 }) 5559 } 5560 } 5561 } else if v, ok := interface{}(m.GetWeight()).(interface{ Validate() error }); ok { 5562 if err := v.Validate(); err != nil { 5563 return WeightedCluster_ClusterWeightValidationError{ 5564 field: "Weight", 5565 reason: "embedded message failed validation", 5566 cause: err, 5567 } 5568 } 5569 } 5570 5571 if all { 5572 switch v := interface{}(m.GetMetadataMatch()).(type) { 5573 case interface{ ValidateAll() error }: 5574 if err := v.ValidateAll(); err != nil { 5575 errors = append(errors, WeightedCluster_ClusterWeightValidationError{ 5576 field: "MetadataMatch", 5577 reason: "embedded message failed validation", 5578 cause: err, 5579 }) 5580 } 5581 case interface{ Validate() error }: 5582 if err := v.Validate(); err != nil { 5583 errors = append(errors, WeightedCluster_ClusterWeightValidationError{ 5584 field: "MetadataMatch", 5585 reason: "embedded message failed validation", 5586 cause: err, 5587 }) 5588 } 5589 } 5590 } else if v, ok := interface{}(m.GetMetadataMatch()).(interface{ Validate() error }); ok { 5591 if err := v.Validate(); err != nil { 5592 return WeightedCluster_ClusterWeightValidationError{ 5593 field: "MetadataMatch", 5594 reason: "embedded message failed validation", 5595 cause: err, 5596 } 5597 } 5598 } 5599 5600 if len(m.GetRequestHeadersToAdd()) > 1000 { 5601 err := WeightedCluster_ClusterWeightValidationError{ 5602 field: "RequestHeadersToAdd", 5603 reason: "value must contain no more than 1000 item(s)", 5604 } 5605 if !all { 5606 return err 5607 } 5608 errors = append(errors, err) 5609 } 5610 5611 for idx, item := range m.GetRequestHeadersToAdd() { 5612 _, _ = idx, item 5613 5614 if all { 5615 switch v := interface{}(item).(type) { 5616 case interface{ ValidateAll() error }: 5617 if err := v.ValidateAll(); err != nil { 5618 errors = append(errors, WeightedCluster_ClusterWeightValidationError{ 5619 field: fmt.Sprintf("RequestHeadersToAdd[%v]", idx), 5620 reason: "embedded message failed validation", 5621 cause: err, 5622 }) 5623 } 5624 case interface{ Validate() error }: 5625 if err := v.Validate(); err != nil { 5626 errors = append(errors, WeightedCluster_ClusterWeightValidationError{ 5627 field: fmt.Sprintf("RequestHeadersToAdd[%v]", idx), 5628 reason: "embedded message failed validation", 5629 cause: err, 5630 }) 5631 } 5632 } 5633 } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { 5634 if err := v.Validate(); err != nil { 5635 return WeightedCluster_ClusterWeightValidationError{ 5636 field: fmt.Sprintf("RequestHeadersToAdd[%v]", idx), 5637 reason: "embedded message failed validation", 5638 cause: err, 5639 } 5640 } 5641 } 5642 5643 } 5644 5645 for idx, item := range m.GetRequestHeadersToRemove() { 5646 _, _ = idx, item 5647 5648 if !_WeightedCluster_ClusterWeight_RequestHeadersToRemove_Pattern.MatchString(item) { 5649 err := WeightedCluster_ClusterWeightValidationError{ 5650 field: fmt.Sprintf("RequestHeadersToRemove[%v]", idx), 5651 reason: "value does not match regex pattern \"^[^\\x00\\n\\r]*$\"", 5652 } 5653 if !all { 5654 return err 5655 } 5656 errors = append(errors, err) 5657 } 5658 5659 } 5660 5661 if len(m.GetResponseHeadersToAdd()) > 1000 { 5662 err := WeightedCluster_ClusterWeightValidationError{ 5663 field: "ResponseHeadersToAdd", 5664 reason: "value must contain no more than 1000 item(s)", 5665 } 5666 if !all { 5667 return err 5668 } 5669 errors = append(errors, err) 5670 } 5671 5672 for idx, item := range m.GetResponseHeadersToAdd() { 5673 _, _ = idx, item 5674 5675 if all { 5676 switch v := interface{}(item).(type) { 5677 case interface{ ValidateAll() error }: 5678 if err := v.ValidateAll(); err != nil { 5679 errors = append(errors, WeightedCluster_ClusterWeightValidationError{ 5680 field: fmt.Sprintf("ResponseHeadersToAdd[%v]", idx), 5681 reason: "embedded message failed validation", 5682 cause: err, 5683 }) 5684 } 5685 case interface{ Validate() error }: 5686 if err := v.Validate(); err != nil { 5687 errors = append(errors, WeightedCluster_ClusterWeightValidationError{ 5688 field: fmt.Sprintf("ResponseHeadersToAdd[%v]", idx), 5689 reason: "embedded message failed validation", 5690 cause: err, 5691 }) 5692 } 5693 } 5694 } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { 5695 if err := v.Validate(); err != nil { 5696 return WeightedCluster_ClusterWeightValidationError{ 5697 field: fmt.Sprintf("ResponseHeadersToAdd[%v]", idx), 5698 reason: "embedded message failed validation", 5699 cause: err, 5700 } 5701 } 5702 } 5703 5704 } 5705 5706 for idx, item := range m.GetResponseHeadersToRemove() { 5707 _, _ = idx, item 5708 5709 if !_WeightedCluster_ClusterWeight_ResponseHeadersToRemove_Pattern.MatchString(item) { 5710 err := WeightedCluster_ClusterWeightValidationError{ 5711 field: fmt.Sprintf("ResponseHeadersToRemove[%v]", idx), 5712 reason: "value does not match regex pattern \"^[^\\x00\\n\\r]*$\"", 5713 } 5714 if !all { 5715 return err 5716 } 5717 errors = append(errors, err) 5718 } 5719 5720 } 5721 5722 { 5723 sorted_keys := make([]string, len(m.GetTypedPerFilterConfig())) 5724 i := 0 5725 for key := range m.GetTypedPerFilterConfig() { 5726 sorted_keys[i] = key 5727 i++ 5728 } 5729 sort.Slice(sorted_keys, func(i, j int) bool { return sorted_keys[i] < sorted_keys[j] }) 5730 for _, key := range sorted_keys { 5731 val := m.GetTypedPerFilterConfig()[key] 5732 _ = val 5733 5734 // no validation rules for TypedPerFilterConfig[key] 5735 5736 if all { 5737 switch v := interface{}(val).(type) { 5738 case interface{ ValidateAll() error }: 5739 if err := v.ValidateAll(); err != nil { 5740 errors = append(errors, WeightedCluster_ClusterWeightValidationError{ 5741 field: fmt.Sprintf("TypedPerFilterConfig[%v]", key), 5742 reason: "embedded message failed validation", 5743 cause: err, 5744 }) 5745 } 5746 case interface{ Validate() error }: 5747 if err := v.Validate(); err != nil { 5748 errors = append(errors, WeightedCluster_ClusterWeightValidationError{ 5749 field: fmt.Sprintf("TypedPerFilterConfig[%v]", key), 5750 reason: "embedded message failed validation", 5751 cause: err, 5752 }) 5753 } 5754 } 5755 } else if v, ok := interface{}(val).(interface{ Validate() error }); ok { 5756 if err := v.Validate(); err != nil { 5757 return WeightedCluster_ClusterWeightValidationError{ 5758 field: fmt.Sprintf("TypedPerFilterConfig[%v]", key), 5759 reason: "embedded message failed validation", 5760 cause: err, 5761 } 5762 } 5763 } 5764 5765 } 5766 } 5767 5768 switch m.HostRewriteSpecifier.(type) { 5769 5770 case *WeightedCluster_ClusterWeight_HostRewriteLiteral: 5771 5772 if !_WeightedCluster_ClusterWeight_HostRewriteLiteral_Pattern.MatchString(m.GetHostRewriteLiteral()) { 5773 err := WeightedCluster_ClusterWeightValidationError{ 5774 field: "HostRewriteLiteral", 5775 reason: "value does not match regex pattern \"^[^\\x00\\n\\r]*$\"", 5776 } 5777 if !all { 5778 return err 5779 } 5780 errors = append(errors, err) 5781 } 5782 5783 } 5784 5785 if len(errors) > 0 { 5786 return WeightedCluster_ClusterWeightMultiError(errors) 5787 } 5788 return nil 5789} 5790 5791// WeightedCluster_ClusterWeightMultiError is an error wrapping multiple 5792// validation errors returned by WeightedCluster_ClusterWeight.ValidateAll() 5793// if the designated constraints aren't met. 5794type WeightedCluster_ClusterWeightMultiError []error 5795 5796// Error returns a concatenation of all the error messages it wraps. 5797func (m WeightedCluster_ClusterWeightMultiError) Error() string { 5798 var msgs []string 5799 for _, err := range m { 5800 msgs = append(msgs, err.Error()) 5801 } 5802 return strings.Join(msgs, "; ") 5803} 5804 5805// AllErrors returns a list of validation violation errors. 5806func (m WeightedCluster_ClusterWeightMultiError) AllErrors() []error { return m } 5807 5808// WeightedCluster_ClusterWeightValidationError is the validation error 5809// returned by WeightedCluster_ClusterWeight.Validate if the designated 5810// constraints aren't met. 5811type WeightedCluster_ClusterWeightValidationError struct { 5812 field string 5813 reason string 5814 cause error 5815 key bool 5816} 5817 5818// Field function returns field value. 5819func (e WeightedCluster_ClusterWeightValidationError) Field() string { return e.field } 5820 5821// Reason function returns reason value. 5822func (e WeightedCluster_ClusterWeightValidationError) Reason() string { return e.reason } 5823 5824// Cause function returns cause value. 5825func (e WeightedCluster_ClusterWeightValidationError) Cause() error { return e.cause } 5826 5827// Key function returns key value. 5828func (e WeightedCluster_ClusterWeightValidationError) Key() bool { return e.key } 5829 5830// ErrorName returns error name. 5831func (e WeightedCluster_ClusterWeightValidationError) ErrorName() string { 5832 return "WeightedCluster_ClusterWeightValidationError" 5833} 5834 5835// Error satisfies the builtin error interface 5836func (e WeightedCluster_ClusterWeightValidationError) Error() string { 5837 cause := "" 5838 if e.cause != nil { 5839 cause = fmt.Sprintf(" | caused by: %v", e.cause) 5840 } 5841 5842 key := "" 5843 if e.key { 5844 key = "key for " 5845 } 5846 5847 return fmt.Sprintf( 5848 "invalid %sWeightedCluster_ClusterWeight.%s: %s%s", 5849 key, 5850 e.field, 5851 e.reason, 5852 cause) 5853} 5854 5855var _ error = WeightedCluster_ClusterWeightValidationError{} 5856 5857var _ interface { 5858 Field() string 5859 Reason() string 5860 Key() bool 5861 Cause() error 5862 ErrorName() string 5863} = WeightedCluster_ClusterWeightValidationError{} 5864 5865var _WeightedCluster_ClusterWeight_ClusterHeader_Pattern = regexp.MustCompile("^[^\x00\n\r]*$") 5866 5867var _WeightedCluster_ClusterWeight_RequestHeadersToRemove_Pattern = regexp.MustCompile("^[^\x00\n\r]*$") 5868 5869var _WeightedCluster_ClusterWeight_ResponseHeadersToRemove_Pattern = regexp.MustCompile("^[^\x00\n\r]*$") 5870 5871var _WeightedCluster_ClusterWeight_HostRewriteLiteral_Pattern = regexp.MustCompile("^[^\x00\n\r]*$") 5872 5873// Validate checks the field values on RouteMatch_GrpcRouteMatchOptions with 5874// the rules defined in the proto definition for this message. If any rules 5875// are violated, the first error encountered is returned, or nil if there are 5876// no violations. 5877func (m *RouteMatch_GrpcRouteMatchOptions) Validate() error { 5878 return m.validate(false) 5879} 5880 5881// ValidateAll checks the field values on RouteMatch_GrpcRouteMatchOptions with 5882// the rules defined in the proto definition for this message. If any rules 5883// are violated, the result is a list of violation errors wrapped in 5884// RouteMatch_GrpcRouteMatchOptionsMultiError, or nil if none found. 5885func (m *RouteMatch_GrpcRouteMatchOptions) ValidateAll() error { 5886 return m.validate(true) 5887} 5888 5889func (m *RouteMatch_GrpcRouteMatchOptions) validate(all bool) error { 5890 if m == nil { 5891 return nil 5892 } 5893 5894 var errors []error 5895 5896 if len(errors) > 0 { 5897 return RouteMatch_GrpcRouteMatchOptionsMultiError(errors) 5898 } 5899 return nil 5900} 5901 5902// RouteMatch_GrpcRouteMatchOptionsMultiError is an error wrapping multiple 5903// validation errors returned by 5904// RouteMatch_GrpcRouteMatchOptions.ValidateAll() if the designated 5905// constraints aren't met. 5906type RouteMatch_GrpcRouteMatchOptionsMultiError []error 5907 5908// Error returns a concatenation of all the error messages it wraps. 5909func (m RouteMatch_GrpcRouteMatchOptionsMultiError) Error() string { 5910 var msgs []string 5911 for _, err := range m { 5912 msgs = append(msgs, err.Error()) 5913 } 5914 return strings.Join(msgs, "; ") 5915} 5916 5917// AllErrors returns a list of validation violation errors. 5918func (m RouteMatch_GrpcRouteMatchOptionsMultiError) AllErrors() []error { return m } 5919 5920// RouteMatch_GrpcRouteMatchOptionsValidationError is the validation error 5921// returned by RouteMatch_GrpcRouteMatchOptions.Validate if the designated 5922// constraints aren't met. 5923type RouteMatch_GrpcRouteMatchOptionsValidationError struct { 5924 field string 5925 reason string 5926 cause error 5927 key bool 5928} 5929 5930// Field function returns field value. 5931func (e RouteMatch_GrpcRouteMatchOptionsValidationError) Field() string { return e.field } 5932 5933// Reason function returns reason value. 5934func (e RouteMatch_GrpcRouteMatchOptionsValidationError) Reason() string { return e.reason } 5935 5936// Cause function returns cause value. 5937func (e RouteMatch_GrpcRouteMatchOptionsValidationError) Cause() error { return e.cause } 5938 5939// Key function returns key value. 5940func (e RouteMatch_GrpcRouteMatchOptionsValidationError) Key() bool { return e.key } 5941 5942// ErrorName returns error name. 5943func (e RouteMatch_GrpcRouteMatchOptionsValidationError) ErrorName() string { 5944 return "RouteMatch_GrpcRouteMatchOptionsValidationError" 5945} 5946 5947// Error satisfies the builtin error interface 5948func (e RouteMatch_GrpcRouteMatchOptionsValidationError) Error() string { 5949 cause := "" 5950 if e.cause != nil { 5951 cause = fmt.Sprintf(" | caused by: %v", e.cause) 5952 } 5953 5954 key := "" 5955 if e.key { 5956 key = "key for " 5957 } 5958 5959 return fmt.Sprintf( 5960 "invalid %sRouteMatch_GrpcRouteMatchOptions.%s: %s%s", 5961 key, 5962 e.field, 5963 e.reason, 5964 cause) 5965} 5966 5967var _ error = RouteMatch_GrpcRouteMatchOptionsValidationError{} 5968 5969var _ interface { 5970 Field() string 5971 Reason() string 5972 Key() bool 5973 Cause() error 5974 ErrorName() string 5975} = RouteMatch_GrpcRouteMatchOptionsValidationError{} 5976 5977// Validate checks the field values on RouteMatch_TlsContextMatchOptions with 5978// the rules defined in the proto definition for this message. If any rules 5979// are violated, the first error encountered is returned, or nil if there are 5980// no violations. 5981func (m *RouteMatch_TlsContextMatchOptions) Validate() error { 5982 return m.validate(false) 5983} 5984 5985// ValidateAll checks the field values on RouteMatch_TlsContextMatchOptions 5986// with the rules defined in the proto definition for this message. If any 5987// rules are violated, the result is a list of violation errors wrapped in 5988// RouteMatch_TlsContextMatchOptionsMultiError, or nil if none found. 5989func (m *RouteMatch_TlsContextMatchOptions) ValidateAll() error { 5990 return m.validate(true) 5991} 5992 5993func (m *RouteMatch_TlsContextMatchOptions) validate(all bool) error { 5994 if m == nil { 5995 return nil 5996 } 5997 5998 var errors []error 5999 6000 if all { 6001 switch v := interface{}(m.GetPresented()).(type) { 6002 case interface{ ValidateAll() error }: 6003 if err := v.ValidateAll(); err != nil { 6004 errors = append(errors, RouteMatch_TlsContextMatchOptionsValidationError{ 6005 field: "Presented", 6006 reason: "embedded message failed validation", 6007 cause: err, 6008 }) 6009 } 6010 case interface{ Validate() error }: 6011 if err := v.Validate(); err != nil { 6012 errors = append(errors, RouteMatch_TlsContextMatchOptionsValidationError{ 6013 field: "Presented", 6014 reason: "embedded message failed validation", 6015 cause: err, 6016 }) 6017 } 6018 } 6019 } else if v, ok := interface{}(m.GetPresented()).(interface{ Validate() error }); ok { 6020 if err := v.Validate(); err != nil { 6021 return RouteMatch_TlsContextMatchOptionsValidationError{ 6022 field: "Presented", 6023 reason: "embedded message failed validation", 6024 cause: err, 6025 } 6026 } 6027 } 6028 6029 if all { 6030 switch v := interface{}(m.GetValidated()).(type) { 6031 case interface{ ValidateAll() error }: 6032 if err := v.ValidateAll(); err != nil { 6033 errors = append(errors, RouteMatch_TlsContextMatchOptionsValidationError{ 6034 field: "Validated", 6035 reason: "embedded message failed validation", 6036 cause: err, 6037 }) 6038 } 6039 case interface{ Validate() error }: 6040 if err := v.Validate(); err != nil { 6041 errors = append(errors, RouteMatch_TlsContextMatchOptionsValidationError{ 6042 field: "Validated", 6043 reason: "embedded message failed validation", 6044 cause: err, 6045 }) 6046 } 6047 } 6048 } else if v, ok := interface{}(m.GetValidated()).(interface{ Validate() error }); ok { 6049 if err := v.Validate(); err != nil { 6050 return RouteMatch_TlsContextMatchOptionsValidationError{ 6051 field: "Validated", 6052 reason: "embedded message failed validation", 6053 cause: err, 6054 } 6055 } 6056 } 6057 6058 if len(errors) > 0 { 6059 return RouteMatch_TlsContextMatchOptionsMultiError(errors) 6060 } 6061 return nil 6062} 6063 6064// RouteMatch_TlsContextMatchOptionsMultiError is an error wrapping multiple 6065// validation errors returned by 6066// RouteMatch_TlsContextMatchOptions.ValidateAll() if the designated 6067// constraints aren't met. 6068type RouteMatch_TlsContextMatchOptionsMultiError []error 6069 6070// Error returns a concatenation of all the error messages it wraps. 6071func (m RouteMatch_TlsContextMatchOptionsMultiError) Error() string { 6072 var msgs []string 6073 for _, err := range m { 6074 msgs = append(msgs, err.Error()) 6075 } 6076 return strings.Join(msgs, "; ") 6077} 6078 6079// AllErrors returns a list of validation violation errors. 6080func (m RouteMatch_TlsContextMatchOptionsMultiError) AllErrors() []error { return m } 6081 6082// RouteMatch_TlsContextMatchOptionsValidationError is the validation error 6083// returned by RouteMatch_TlsContextMatchOptions.Validate if the designated 6084// constraints aren't met. 6085type RouteMatch_TlsContextMatchOptionsValidationError struct { 6086 field string 6087 reason string 6088 cause error 6089 key bool 6090} 6091 6092// Field function returns field value. 6093func (e RouteMatch_TlsContextMatchOptionsValidationError) Field() string { return e.field } 6094 6095// Reason function returns reason value. 6096func (e RouteMatch_TlsContextMatchOptionsValidationError) Reason() string { return e.reason } 6097 6098// Cause function returns cause value. 6099func (e RouteMatch_TlsContextMatchOptionsValidationError) Cause() error { return e.cause } 6100 6101// Key function returns key value. 6102func (e RouteMatch_TlsContextMatchOptionsValidationError) Key() bool { return e.key } 6103 6104// ErrorName returns error name. 6105func (e RouteMatch_TlsContextMatchOptionsValidationError) ErrorName() string { 6106 return "RouteMatch_TlsContextMatchOptionsValidationError" 6107} 6108 6109// Error satisfies the builtin error interface 6110func (e RouteMatch_TlsContextMatchOptionsValidationError) Error() string { 6111 cause := "" 6112 if e.cause != nil { 6113 cause = fmt.Sprintf(" | caused by: %v", e.cause) 6114 } 6115 6116 key := "" 6117 if e.key { 6118 key = "key for " 6119 } 6120 6121 return fmt.Sprintf( 6122 "invalid %sRouteMatch_TlsContextMatchOptions.%s: %s%s", 6123 key, 6124 e.field, 6125 e.reason, 6126 cause) 6127} 6128 6129var _ error = RouteMatch_TlsContextMatchOptionsValidationError{} 6130 6131var _ interface { 6132 Field() string 6133 Reason() string 6134 Key() bool 6135 Cause() error 6136 ErrorName() string 6137} = RouteMatch_TlsContextMatchOptionsValidationError{} 6138 6139// Validate checks the field values on RouteMatch_ConnectMatcher with the rules 6140// defined in the proto definition for this message. If any rules are 6141// violated, the first error encountered is returned, or nil if there are no violations. 6142func (m *RouteMatch_ConnectMatcher) Validate() error { 6143 return m.validate(false) 6144} 6145 6146// ValidateAll checks the field values on RouteMatch_ConnectMatcher with the 6147// rules defined in the proto definition for this message. If any rules are 6148// violated, the result is a list of violation errors wrapped in 6149// RouteMatch_ConnectMatcherMultiError, or nil if none found. 6150func (m *RouteMatch_ConnectMatcher) ValidateAll() error { 6151 return m.validate(true) 6152} 6153 6154func (m *RouteMatch_ConnectMatcher) validate(all bool) error { 6155 if m == nil { 6156 return nil 6157 } 6158 6159 var errors []error 6160 6161 if len(errors) > 0 { 6162 return RouteMatch_ConnectMatcherMultiError(errors) 6163 } 6164 return nil 6165} 6166 6167// RouteMatch_ConnectMatcherMultiError is an error wrapping multiple validation 6168// errors returned by RouteMatch_ConnectMatcher.ValidateAll() if the 6169// designated constraints aren't met. 6170type RouteMatch_ConnectMatcherMultiError []error 6171 6172// Error returns a concatenation of all the error messages it wraps. 6173func (m RouteMatch_ConnectMatcherMultiError) Error() string { 6174 var msgs []string 6175 for _, err := range m { 6176 msgs = append(msgs, err.Error()) 6177 } 6178 return strings.Join(msgs, "; ") 6179} 6180 6181// AllErrors returns a list of validation violation errors. 6182func (m RouteMatch_ConnectMatcherMultiError) AllErrors() []error { return m } 6183 6184// RouteMatch_ConnectMatcherValidationError is the validation error returned by 6185// RouteMatch_ConnectMatcher.Validate if the designated constraints aren't met. 6186type RouteMatch_ConnectMatcherValidationError struct { 6187 field string 6188 reason string 6189 cause error 6190 key bool 6191} 6192 6193// Field function returns field value. 6194func (e RouteMatch_ConnectMatcherValidationError) Field() string { return e.field } 6195 6196// Reason function returns reason value. 6197func (e RouteMatch_ConnectMatcherValidationError) Reason() string { return e.reason } 6198 6199// Cause function returns cause value. 6200func (e RouteMatch_ConnectMatcherValidationError) Cause() error { return e.cause } 6201 6202// Key function returns key value. 6203func (e RouteMatch_ConnectMatcherValidationError) Key() bool { return e.key } 6204 6205// ErrorName returns error name. 6206func (e RouteMatch_ConnectMatcherValidationError) ErrorName() string { 6207 return "RouteMatch_ConnectMatcherValidationError" 6208} 6209 6210// Error satisfies the builtin error interface 6211func (e RouteMatch_ConnectMatcherValidationError) Error() string { 6212 cause := "" 6213 if e.cause != nil { 6214 cause = fmt.Sprintf(" | caused by: %v", e.cause) 6215 } 6216 6217 key := "" 6218 if e.key { 6219 key = "key for " 6220 } 6221 6222 return fmt.Sprintf( 6223 "invalid %sRouteMatch_ConnectMatcher.%s: %s%s", 6224 key, 6225 e.field, 6226 e.reason, 6227 cause) 6228} 6229 6230var _ error = RouteMatch_ConnectMatcherValidationError{} 6231 6232var _ interface { 6233 Field() string 6234 Reason() string 6235 Key() bool 6236 Cause() error 6237 ErrorName() string 6238} = RouteMatch_ConnectMatcherValidationError{} 6239 6240// Validate checks the field values on RouteAction_RequestMirrorPolicy with the 6241// rules defined in the proto definition for this message. If any rules are 6242// violated, the first error encountered is returned, or nil if there are no violations. 6243func (m *RouteAction_RequestMirrorPolicy) Validate() error { 6244 return m.validate(false) 6245} 6246 6247// ValidateAll checks the field values on RouteAction_RequestMirrorPolicy with 6248// the rules defined in the proto definition for this message. If any rules 6249// are violated, the result is a list of violation errors wrapped in 6250// RouteAction_RequestMirrorPolicyMultiError, or nil if none found. 6251func (m *RouteAction_RequestMirrorPolicy) ValidateAll() error { 6252 return m.validate(true) 6253} 6254 6255func (m *RouteAction_RequestMirrorPolicy) validate(all bool) error { 6256 if m == nil { 6257 return nil 6258 } 6259 6260 var errors []error 6261 6262 if utf8.RuneCountInString(m.GetCluster()) < 1 { 6263 err := RouteAction_RequestMirrorPolicyValidationError{ 6264 field: "Cluster", 6265 reason: "value length must be at least 1 runes", 6266 } 6267 if !all { 6268 return err 6269 } 6270 errors = append(errors, err) 6271 } 6272 6273 if all { 6274 switch v := interface{}(m.GetRuntimeFraction()).(type) { 6275 case interface{ ValidateAll() error }: 6276 if err := v.ValidateAll(); err != nil { 6277 errors = append(errors, RouteAction_RequestMirrorPolicyValidationError{ 6278 field: "RuntimeFraction", 6279 reason: "embedded message failed validation", 6280 cause: err, 6281 }) 6282 } 6283 case interface{ Validate() error }: 6284 if err := v.Validate(); err != nil { 6285 errors = append(errors, RouteAction_RequestMirrorPolicyValidationError{ 6286 field: "RuntimeFraction", 6287 reason: "embedded message failed validation", 6288 cause: err, 6289 }) 6290 } 6291 } 6292 } else if v, ok := interface{}(m.GetRuntimeFraction()).(interface{ Validate() error }); ok { 6293 if err := v.Validate(); err != nil { 6294 return RouteAction_RequestMirrorPolicyValidationError{ 6295 field: "RuntimeFraction", 6296 reason: "embedded message failed validation", 6297 cause: err, 6298 } 6299 } 6300 } 6301 6302 if all { 6303 switch v := interface{}(m.GetTraceSampled()).(type) { 6304 case interface{ ValidateAll() error }: 6305 if err := v.ValidateAll(); err != nil { 6306 errors = append(errors, RouteAction_RequestMirrorPolicyValidationError{ 6307 field: "TraceSampled", 6308 reason: "embedded message failed validation", 6309 cause: err, 6310 }) 6311 } 6312 case interface{ Validate() error }: 6313 if err := v.Validate(); err != nil { 6314 errors = append(errors, RouteAction_RequestMirrorPolicyValidationError{ 6315 field: "TraceSampled", 6316 reason: "embedded message failed validation", 6317 cause: err, 6318 }) 6319 } 6320 } 6321 } else if v, ok := interface{}(m.GetTraceSampled()).(interface{ Validate() error }); ok { 6322 if err := v.Validate(); err != nil { 6323 return RouteAction_RequestMirrorPolicyValidationError{ 6324 field: "TraceSampled", 6325 reason: "embedded message failed validation", 6326 cause: err, 6327 } 6328 } 6329 } 6330 6331 if len(errors) > 0 { 6332 return RouteAction_RequestMirrorPolicyMultiError(errors) 6333 } 6334 return nil 6335} 6336 6337// RouteAction_RequestMirrorPolicyMultiError is an error wrapping multiple 6338// validation errors returned by RouteAction_RequestMirrorPolicy.ValidateAll() 6339// if the designated constraints aren't met. 6340type RouteAction_RequestMirrorPolicyMultiError []error 6341 6342// Error returns a concatenation of all the error messages it wraps. 6343func (m RouteAction_RequestMirrorPolicyMultiError) Error() string { 6344 var msgs []string 6345 for _, err := range m { 6346 msgs = append(msgs, err.Error()) 6347 } 6348 return strings.Join(msgs, "; ") 6349} 6350 6351// AllErrors returns a list of validation violation errors. 6352func (m RouteAction_RequestMirrorPolicyMultiError) AllErrors() []error { return m } 6353 6354// RouteAction_RequestMirrorPolicyValidationError is the validation error 6355// returned by RouteAction_RequestMirrorPolicy.Validate if the designated 6356// constraints aren't met. 6357type RouteAction_RequestMirrorPolicyValidationError struct { 6358 field string 6359 reason string 6360 cause error 6361 key bool 6362} 6363 6364// Field function returns field value. 6365func (e RouteAction_RequestMirrorPolicyValidationError) Field() string { return e.field } 6366 6367// Reason function returns reason value. 6368func (e RouteAction_RequestMirrorPolicyValidationError) Reason() string { return e.reason } 6369 6370// Cause function returns cause value. 6371func (e RouteAction_RequestMirrorPolicyValidationError) Cause() error { return e.cause } 6372 6373// Key function returns key value. 6374func (e RouteAction_RequestMirrorPolicyValidationError) Key() bool { return e.key } 6375 6376// ErrorName returns error name. 6377func (e RouteAction_RequestMirrorPolicyValidationError) ErrorName() string { 6378 return "RouteAction_RequestMirrorPolicyValidationError" 6379} 6380 6381// Error satisfies the builtin error interface 6382func (e RouteAction_RequestMirrorPolicyValidationError) Error() string { 6383 cause := "" 6384 if e.cause != nil { 6385 cause = fmt.Sprintf(" | caused by: %v", e.cause) 6386 } 6387 6388 key := "" 6389 if e.key { 6390 key = "key for " 6391 } 6392 6393 return fmt.Sprintf( 6394 "invalid %sRouteAction_RequestMirrorPolicy.%s: %s%s", 6395 key, 6396 e.field, 6397 e.reason, 6398 cause) 6399} 6400 6401var _ error = RouteAction_RequestMirrorPolicyValidationError{} 6402 6403var _ interface { 6404 Field() string 6405 Reason() string 6406 Key() bool 6407 Cause() error 6408 ErrorName() string 6409} = RouteAction_RequestMirrorPolicyValidationError{} 6410 6411// Validate checks the field values on RouteAction_HashPolicy with the rules 6412// defined in the proto definition for this message. If any rules are 6413// violated, the first error encountered is returned, or nil if there are no violations. 6414func (m *RouteAction_HashPolicy) Validate() error { 6415 return m.validate(false) 6416} 6417 6418// ValidateAll checks the field values on RouteAction_HashPolicy with the rules 6419// defined in the proto definition for this message. If any rules are 6420// violated, the result is a list of violation errors wrapped in 6421// RouteAction_HashPolicyMultiError, or nil if none found. 6422func (m *RouteAction_HashPolicy) ValidateAll() error { 6423 return m.validate(true) 6424} 6425 6426func (m *RouteAction_HashPolicy) validate(all bool) error { 6427 if m == nil { 6428 return nil 6429 } 6430 6431 var errors []error 6432 6433 // no validation rules for Terminal 6434 6435 switch m.PolicySpecifier.(type) { 6436 6437 case *RouteAction_HashPolicy_Header_: 6438 6439 if all { 6440 switch v := interface{}(m.GetHeader()).(type) { 6441 case interface{ ValidateAll() error }: 6442 if err := v.ValidateAll(); err != nil { 6443 errors = append(errors, RouteAction_HashPolicyValidationError{ 6444 field: "Header", 6445 reason: "embedded message failed validation", 6446 cause: err, 6447 }) 6448 } 6449 case interface{ Validate() error }: 6450 if err := v.Validate(); err != nil { 6451 errors = append(errors, RouteAction_HashPolicyValidationError{ 6452 field: "Header", 6453 reason: "embedded message failed validation", 6454 cause: err, 6455 }) 6456 } 6457 } 6458 } else if v, ok := interface{}(m.GetHeader()).(interface{ Validate() error }); ok { 6459 if err := v.Validate(); err != nil { 6460 return RouteAction_HashPolicyValidationError{ 6461 field: "Header", 6462 reason: "embedded message failed validation", 6463 cause: err, 6464 } 6465 } 6466 } 6467 6468 case *RouteAction_HashPolicy_Cookie_: 6469 6470 if all { 6471 switch v := interface{}(m.GetCookie()).(type) { 6472 case interface{ ValidateAll() error }: 6473 if err := v.ValidateAll(); err != nil { 6474 errors = append(errors, RouteAction_HashPolicyValidationError{ 6475 field: "Cookie", 6476 reason: "embedded message failed validation", 6477 cause: err, 6478 }) 6479 } 6480 case interface{ Validate() error }: 6481 if err := v.Validate(); err != nil { 6482 errors = append(errors, RouteAction_HashPolicyValidationError{ 6483 field: "Cookie", 6484 reason: "embedded message failed validation", 6485 cause: err, 6486 }) 6487 } 6488 } 6489 } else if v, ok := interface{}(m.GetCookie()).(interface{ Validate() error }); ok { 6490 if err := v.Validate(); err != nil { 6491 return RouteAction_HashPolicyValidationError{ 6492 field: "Cookie", 6493 reason: "embedded message failed validation", 6494 cause: err, 6495 } 6496 } 6497 } 6498 6499 case *RouteAction_HashPolicy_ConnectionProperties_: 6500 6501 if all { 6502 switch v := interface{}(m.GetConnectionProperties()).(type) { 6503 case interface{ ValidateAll() error }: 6504 if err := v.ValidateAll(); err != nil { 6505 errors = append(errors, RouteAction_HashPolicyValidationError{ 6506 field: "ConnectionProperties", 6507 reason: "embedded message failed validation", 6508 cause: err, 6509 }) 6510 } 6511 case interface{ Validate() error }: 6512 if err := v.Validate(); err != nil { 6513 errors = append(errors, RouteAction_HashPolicyValidationError{ 6514 field: "ConnectionProperties", 6515 reason: "embedded message failed validation", 6516 cause: err, 6517 }) 6518 } 6519 } 6520 } else if v, ok := interface{}(m.GetConnectionProperties()).(interface{ Validate() error }); ok { 6521 if err := v.Validate(); err != nil { 6522 return RouteAction_HashPolicyValidationError{ 6523 field: "ConnectionProperties", 6524 reason: "embedded message failed validation", 6525 cause: err, 6526 } 6527 } 6528 } 6529 6530 case *RouteAction_HashPolicy_QueryParameter_: 6531 6532 if all { 6533 switch v := interface{}(m.GetQueryParameter()).(type) { 6534 case interface{ ValidateAll() error }: 6535 if err := v.ValidateAll(); err != nil { 6536 errors = append(errors, RouteAction_HashPolicyValidationError{ 6537 field: "QueryParameter", 6538 reason: "embedded message failed validation", 6539 cause: err, 6540 }) 6541 } 6542 case interface{ Validate() error }: 6543 if err := v.Validate(); err != nil { 6544 errors = append(errors, RouteAction_HashPolicyValidationError{ 6545 field: "QueryParameter", 6546 reason: "embedded message failed validation", 6547 cause: err, 6548 }) 6549 } 6550 } 6551 } else if v, ok := interface{}(m.GetQueryParameter()).(interface{ Validate() error }); ok { 6552 if err := v.Validate(); err != nil { 6553 return RouteAction_HashPolicyValidationError{ 6554 field: "QueryParameter", 6555 reason: "embedded message failed validation", 6556 cause: err, 6557 } 6558 } 6559 } 6560 6561 case *RouteAction_HashPolicy_FilterState_: 6562 6563 if all { 6564 switch v := interface{}(m.GetFilterState()).(type) { 6565 case interface{ ValidateAll() error }: 6566 if err := v.ValidateAll(); err != nil { 6567 errors = append(errors, RouteAction_HashPolicyValidationError{ 6568 field: "FilterState", 6569 reason: "embedded message failed validation", 6570 cause: err, 6571 }) 6572 } 6573 case interface{ Validate() error }: 6574 if err := v.Validate(); err != nil { 6575 errors = append(errors, RouteAction_HashPolicyValidationError{ 6576 field: "FilterState", 6577 reason: "embedded message failed validation", 6578 cause: err, 6579 }) 6580 } 6581 } 6582 } else if v, ok := interface{}(m.GetFilterState()).(interface{ Validate() error }); ok { 6583 if err := v.Validate(); err != nil { 6584 return RouteAction_HashPolicyValidationError{ 6585 field: "FilterState", 6586 reason: "embedded message failed validation", 6587 cause: err, 6588 } 6589 } 6590 } 6591 6592 default: 6593 err := RouteAction_HashPolicyValidationError{ 6594 field: "PolicySpecifier", 6595 reason: "value is required", 6596 } 6597 if !all { 6598 return err 6599 } 6600 errors = append(errors, err) 6601 6602 } 6603 6604 if len(errors) > 0 { 6605 return RouteAction_HashPolicyMultiError(errors) 6606 } 6607 return nil 6608} 6609 6610// RouteAction_HashPolicyMultiError is an error wrapping multiple validation 6611// errors returned by RouteAction_HashPolicy.ValidateAll() if the designated 6612// constraints aren't met. 6613type RouteAction_HashPolicyMultiError []error 6614 6615// Error returns a concatenation of all the error messages it wraps. 6616func (m RouteAction_HashPolicyMultiError) Error() string { 6617 var msgs []string 6618 for _, err := range m { 6619 msgs = append(msgs, err.Error()) 6620 } 6621 return strings.Join(msgs, "; ") 6622} 6623 6624// AllErrors returns a list of validation violation errors. 6625func (m RouteAction_HashPolicyMultiError) AllErrors() []error { return m } 6626 6627// RouteAction_HashPolicyValidationError is the validation error returned by 6628// RouteAction_HashPolicy.Validate if the designated constraints aren't met. 6629type RouteAction_HashPolicyValidationError struct { 6630 field string 6631 reason string 6632 cause error 6633 key bool 6634} 6635 6636// Field function returns field value. 6637func (e RouteAction_HashPolicyValidationError) Field() string { return e.field } 6638 6639// Reason function returns reason value. 6640func (e RouteAction_HashPolicyValidationError) Reason() string { return e.reason } 6641 6642// Cause function returns cause value. 6643func (e RouteAction_HashPolicyValidationError) Cause() error { return e.cause } 6644 6645// Key function returns key value. 6646func (e RouteAction_HashPolicyValidationError) Key() bool { return e.key } 6647 6648// ErrorName returns error name. 6649func (e RouteAction_HashPolicyValidationError) ErrorName() string { 6650 return "RouteAction_HashPolicyValidationError" 6651} 6652 6653// Error satisfies the builtin error interface 6654func (e RouteAction_HashPolicyValidationError) Error() string { 6655 cause := "" 6656 if e.cause != nil { 6657 cause = fmt.Sprintf(" | caused by: %v", e.cause) 6658 } 6659 6660 key := "" 6661 if e.key { 6662 key = "key for " 6663 } 6664 6665 return fmt.Sprintf( 6666 "invalid %sRouteAction_HashPolicy.%s: %s%s", 6667 key, 6668 e.field, 6669 e.reason, 6670 cause) 6671} 6672 6673var _ error = RouteAction_HashPolicyValidationError{} 6674 6675var _ interface { 6676 Field() string 6677 Reason() string 6678 Key() bool 6679 Cause() error 6680 ErrorName() string 6681} = RouteAction_HashPolicyValidationError{} 6682 6683// Validate checks the field values on RouteAction_UpgradeConfig with the rules 6684// defined in the proto definition for this message. If any rules are 6685// violated, the first error encountered is returned, or nil if there are no violations. 6686func (m *RouteAction_UpgradeConfig) Validate() error { 6687 return m.validate(false) 6688} 6689 6690// ValidateAll checks the field values on RouteAction_UpgradeConfig with the 6691// rules defined in the proto definition for this message. If any rules are 6692// violated, the result is a list of violation errors wrapped in 6693// RouteAction_UpgradeConfigMultiError, or nil if none found. 6694func (m *RouteAction_UpgradeConfig) ValidateAll() error { 6695 return m.validate(true) 6696} 6697 6698func (m *RouteAction_UpgradeConfig) validate(all bool) error { 6699 if m == nil { 6700 return nil 6701 } 6702 6703 var errors []error 6704 6705 if utf8.RuneCountInString(m.GetUpgradeType()) < 1 { 6706 err := RouteAction_UpgradeConfigValidationError{ 6707 field: "UpgradeType", 6708 reason: "value length must be at least 1 runes", 6709 } 6710 if !all { 6711 return err 6712 } 6713 errors = append(errors, err) 6714 } 6715 6716 if !_RouteAction_UpgradeConfig_UpgradeType_Pattern.MatchString(m.GetUpgradeType()) { 6717 err := RouteAction_UpgradeConfigValidationError{ 6718 field: "UpgradeType", 6719 reason: "value does not match regex pattern \"^[^\\x00\\n\\r]*$\"", 6720 } 6721 if !all { 6722 return err 6723 } 6724 errors = append(errors, err) 6725 } 6726 6727 if all { 6728 switch v := interface{}(m.GetEnabled()).(type) { 6729 case interface{ ValidateAll() error }: 6730 if err := v.ValidateAll(); err != nil { 6731 errors = append(errors, RouteAction_UpgradeConfigValidationError{ 6732 field: "Enabled", 6733 reason: "embedded message failed validation", 6734 cause: err, 6735 }) 6736 } 6737 case interface{ Validate() error }: 6738 if err := v.Validate(); err != nil { 6739 errors = append(errors, RouteAction_UpgradeConfigValidationError{ 6740 field: "Enabled", 6741 reason: "embedded message failed validation", 6742 cause: err, 6743 }) 6744 } 6745 } 6746 } else if v, ok := interface{}(m.GetEnabled()).(interface{ Validate() error }); ok { 6747 if err := v.Validate(); err != nil { 6748 return RouteAction_UpgradeConfigValidationError{ 6749 field: "Enabled", 6750 reason: "embedded message failed validation", 6751 cause: err, 6752 } 6753 } 6754 } 6755 6756 if all { 6757 switch v := interface{}(m.GetConnectConfig()).(type) { 6758 case interface{ ValidateAll() error }: 6759 if err := v.ValidateAll(); err != nil { 6760 errors = append(errors, RouteAction_UpgradeConfigValidationError{ 6761 field: "ConnectConfig", 6762 reason: "embedded message failed validation", 6763 cause: err, 6764 }) 6765 } 6766 case interface{ Validate() error }: 6767 if err := v.Validate(); err != nil { 6768 errors = append(errors, RouteAction_UpgradeConfigValidationError{ 6769 field: "ConnectConfig", 6770 reason: "embedded message failed validation", 6771 cause: err, 6772 }) 6773 } 6774 } 6775 } else if v, ok := interface{}(m.GetConnectConfig()).(interface{ Validate() error }); ok { 6776 if err := v.Validate(); err != nil { 6777 return RouteAction_UpgradeConfigValidationError{ 6778 field: "ConnectConfig", 6779 reason: "embedded message failed validation", 6780 cause: err, 6781 } 6782 } 6783 } 6784 6785 if len(errors) > 0 { 6786 return RouteAction_UpgradeConfigMultiError(errors) 6787 } 6788 return nil 6789} 6790 6791// RouteAction_UpgradeConfigMultiError is an error wrapping multiple validation 6792// errors returned by RouteAction_UpgradeConfig.ValidateAll() if the 6793// designated constraints aren't met. 6794type RouteAction_UpgradeConfigMultiError []error 6795 6796// Error returns a concatenation of all the error messages it wraps. 6797func (m RouteAction_UpgradeConfigMultiError) Error() string { 6798 var msgs []string 6799 for _, err := range m { 6800 msgs = append(msgs, err.Error()) 6801 } 6802 return strings.Join(msgs, "; ") 6803} 6804 6805// AllErrors returns a list of validation violation errors. 6806func (m RouteAction_UpgradeConfigMultiError) AllErrors() []error { return m } 6807 6808// RouteAction_UpgradeConfigValidationError is the validation error returned by 6809// RouteAction_UpgradeConfig.Validate if the designated constraints aren't met. 6810type RouteAction_UpgradeConfigValidationError struct { 6811 field string 6812 reason string 6813 cause error 6814 key bool 6815} 6816 6817// Field function returns field value. 6818func (e RouteAction_UpgradeConfigValidationError) Field() string { return e.field } 6819 6820// Reason function returns reason value. 6821func (e RouteAction_UpgradeConfigValidationError) Reason() string { return e.reason } 6822 6823// Cause function returns cause value. 6824func (e RouteAction_UpgradeConfigValidationError) Cause() error { return e.cause } 6825 6826// Key function returns key value. 6827func (e RouteAction_UpgradeConfigValidationError) Key() bool { return e.key } 6828 6829// ErrorName returns error name. 6830func (e RouteAction_UpgradeConfigValidationError) ErrorName() string { 6831 return "RouteAction_UpgradeConfigValidationError" 6832} 6833 6834// Error satisfies the builtin error interface 6835func (e RouteAction_UpgradeConfigValidationError) Error() string { 6836 cause := "" 6837 if e.cause != nil { 6838 cause = fmt.Sprintf(" | caused by: %v", e.cause) 6839 } 6840 6841 key := "" 6842 if e.key { 6843 key = "key for " 6844 } 6845 6846 return fmt.Sprintf( 6847 "invalid %sRouteAction_UpgradeConfig.%s: %s%s", 6848 key, 6849 e.field, 6850 e.reason, 6851 cause) 6852} 6853 6854var _ error = RouteAction_UpgradeConfigValidationError{} 6855 6856var _ interface { 6857 Field() string 6858 Reason() string 6859 Key() bool 6860 Cause() error 6861 ErrorName() string 6862} = RouteAction_UpgradeConfigValidationError{} 6863 6864var _RouteAction_UpgradeConfig_UpgradeType_Pattern = regexp.MustCompile("^[^\x00\n\r]*$") 6865 6866// Validate checks the field values on RouteAction_MaxStreamDuration with the 6867// rules defined in the proto definition for this message. If any rules are 6868// violated, the first error encountered is returned, or nil if there are no violations. 6869func (m *RouteAction_MaxStreamDuration) Validate() error { 6870 return m.validate(false) 6871} 6872 6873// ValidateAll checks the field values on RouteAction_MaxStreamDuration with 6874// the rules defined in the proto definition for this message. If any rules 6875// are violated, the result is a list of violation errors wrapped in 6876// RouteAction_MaxStreamDurationMultiError, or nil if none found. 6877func (m *RouteAction_MaxStreamDuration) ValidateAll() error { 6878 return m.validate(true) 6879} 6880 6881func (m *RouteAction_MaxStreamDuration) validate(all bool) error { 6882 if m == nil { 6883 return nil 6884 } 6885 6886 var errors []error 6887 6888 if all { 6889 switch v := interface{}(m.GetMaxStreamDuration()).(type) { 6890 case interface{ ValidateAll() error }: 6891 if err := v.ValidateAll(); err != nil { 6892 errors = append(errors, RouteAction_MaxStreamDurationValidationError{ 6893 field: "MaxStreamDuration", 6894 reason: "embedded message failed validation", 6895 cause: err, 6896 }) 6897 } 6898 case interface{ Validate() error }: 6899 if err := v.Validate(); err != nil { 6900 errors = append(errors, RouteAction_MaxStreamDurationValidationError{ 6901 field: "MaxStreamDuration", 6902 reason: "embedded message failed validation", 6903 cause: err, 6904 }) 6905 } 6906 } 6907 } else if v, ok := interface{}(m.GetMaxStreamDuration()).(interface{ Validate() error }); ok { 6908 if err := v.Validate(); err != nil { 6909 return RouteAction_MaxStreamDurationValidationError{ 6910 field: "MaxStreamDuration", 6911 reason: "embedded message failed validation", 6912 cause: err, 6913 } 6914 } 6915 } 6916 6917 if all { 6918 switch v := interface{}(m.GetGrpcTimeoutHeaderMax()).(type) { 6919 case interface{ ValidateAll() error }: 6920 if err := v.ValidateAll(); err != nil { 6921 errors = append(errors, RouteAction_MaxStreamDurationValidationError{ 6922 field: "GrpcTimeoutHeaderMax", 6923 reason: "embedded message failed validation", 6924 cause: err, 6925 }) 6926 } 6927 case interface{ Validate() error }: 6928 if err := v.Validate(); err != nil { 6929 errors = append(errors, RouteAction_MaxStreamDurationValidationError{ 6930 field: "GrpcTimeoutHeaderMax", 6931 reason: "embedded message failed validation", 6932 cause: err, 6933 }) 6934 } 6935 } 6936 } else if v, ok := interface{}(m.GetGrpcTimeoutHeaderMax()).(interface{ Validate() error }); ok { 6937 if err := v.Validate(); err != nil { 6938 return RouteAction_MaxStreamDurationValidationError{ 6939 field: "GrpcTimeoutHeaderMax", 6940 reason: "embedded message failed validation", 6941 cause: err, 6942 } 6943 } 6944 } 6945 6946 if all { 6947 switch v := interface{}(m.GetGrpcTimeoutHeaderOffset()).(type) { 6948 case interface{ ValidateAll() error }: 6949 if err := v.ValidateAll(); err != nil { 6950 errors = append(errors, RouteAction_MaxStreamDurationValidationError{ 6951 field: "GrpcTimeoutHeaderOffset", 6952 reason: "embedded message failed validation", 6953 cause: err, 6954 }) 6955 } 6956 case interface{ Validate() error }: 6957 if err := v.Validate(); err != nil { 6958 errors = append(errors, RouteAction_MaxStreamDurationValidationError{ 6959 field: "GrpcTimeoutHeaderOffset", 6960 reason: "embedded message failed validation", 6961 cause: err, 6962 }) 6963 } 6964 } 6965 } else if v, ok := interface{}(m.GetGrpcTimeoutHeaderOffset()).(interface{ Validate() error }); ok { 6966 if err := v.Validate(); err != nil { 6967 return RouteAction_MaxStreamDurationValidationError{ 6968 field: "GrpcTimeoutHeaderOffset", 6969 reason: "embedded message failed validation", 6970 cause: err, 6971 } 6972 } 6973 } 6974 6975 if len(errors) > 0 { 6976 return RouteAction_MaxStreamDurationMultiError(errors) 6977 } 6978 return nil 6979} 6980 6981// RouteAction_MaxStreamDurationMultiError is an error wrapping multiple 6982// validation errors returned by RouteAction_MaxStreamDuration.ValidateAll() 6983// if the designated constraints aren't met. 6984type RouteAction_MaxStreamDurationMultiError []error 6985 6986// Error returns a concatenation of all the error messages it wraps. 6987func (m RouteAction_MaxStreamDurationMultiError) Error() string { 6988 var msgs []string 6989 for _, err := range m { 6990 msgs = append(msgs, err.Error()) 6991 } 6992 return strings.Join(msgs, "; ") 6993} 6994 6995// AllErrors returns a list of validation violation errors. 6996func (m RouteAction_MaxStreamDurationMultiError) AllErrors() []error { return m } 6997 6998// RouteAction_MaxStreamDurationValidationError is the validation error 6999// returned by RouteAction_MaxStreamDuration.Validate if the designated 7000// constraints aren't met. 7001type RouteAction_MaxStreamDurationValidationError struct { 7002 field string 7003 reason string 7004 cause error 7005 key bool 7006} 7007 7008// Field function returns field value. 7009func (e RouteAction_MaxStreamDurationValidationError) Field() string { return e.field } 7010 7011// Reason function returns reason value. 7012func (e RouteAction_MaxStreamDurationValidationError) Reason() string { return e.reason } 7013 7014// Cause function returns cause value. 7015func (e RouteAction_MaxStreamDurationValidationError) Cause() error { return e.cause } 7016 7017// Key function returns key value. 7018func (e RouteAction_MaxStreamDurationValidationError) Key() bool { return e.key } 7019 7020// ErrorName returns error name. 7021func (e RouteAction_MaxStreamDurationValidationError) ErrorName() string { 7022 return "RouteAction_MaxStreamDurationValidationError" 7023} 7024 7025// Error satisfies the builtin error interface 7026func (e RouteAction_MaxStreamDurationValidationError) Error() string { 7027 cause := "" 7028 if e.cause != nil { 7029 cause = fmt.Sprintf(" | caused by: %v", e.cause) 7030 } 7031 7032 key := "" 7033 if e.key { 7034 key = "key for " 7035 } 7036 7037 return fmt.Sprintf( 7038 "invalid %sRouteAction_MaxStreamDuration.%s: %s%s", 7039 key, 7040 e.field, 7041 e.reason, 7042 cause) 7043} 7044 7045var _ error = RouteAction_MaxStreamDurationValidationError{} 7046 7047var _ interface { 7048 Field() string 7049 Reason() string 7050 Key() bool 7051 Cause() error 7052 ErrorName() string 7053} = RouteAction_MaxStreamDurationValidationError{} 7054 7055// Validate checks the field values on RouteAction_HashPolicy_Header with the 7056// rules defined in the proto definition for this message. If any rules are 7057// violated, the first error encountered is returned, or nil if there are no violations. 7058func (m *RouteAction_HashPolicy_Header) Validate() error { 7059 return m.validate(false) 7060} 7061 7062// ValidateAll checks the field values on RouteAction_HashPolicy_Header with 7063// the rules defined in the proto definition for this message. If any rules 7064// are violated, the result is a list of violation errors wrapped in 7065// RouteAction_HashPolicy_HeaderMultiError, or nil if none found. 7066func (m *RouteAction_HashPolicy_Header) ValidateAll() error { 7067 return m.validate(true) 7068} 7069 7070func (m *RouteAction_HashPolicy_Header) validate(all bool) error { 7071 if m == nil { 7072 return nil 7073 } 7074 7075 var errors []error 7076 7077 if utf8.RuneCountInString(m.GetHeaderName()) < 1 { 7078 err := RouteAction_HashPolicy_HeaderValidationError{ 7079 field: "HeaderName", 7080 reason: "value length must be at least 1 runes", 7081 } 7082 if !all { 7083 return err 7084 } 7085 errors = append(errors, err) 7086 } 7087 7088 if !_RouteAction_HashPolicy_Header_HeaderName_Pattern.MatchString(m.GetHeaderName()) { 7089 err := RouteAction_HashPolicy_HeaderValidationError{ 7090 field: "HeaderName", 7091 reason: "value does not match regex pattern \"^[^\\x00\\n\\r]*$\"", 7092 } 7093 if !all { 7094 return err 7095 } 7096 errors = append(errors, err) 7097 } 7098 7099 if all { 7100 switch v := interface{}(m.GetRegexRewrite()).(type) { 7101 case interface{ ValidateAll() error }: 7102 if err := v.ValidateAll(); err != nil { 7103 errors = append(errors, RouteAction_HashPolicy_HeaderValidationError{ 7104 field: "RegexRewrite", 7105 reason: "embedded message failed validation", 7106 cause: err, 7107 }) 7108 } 7109 case interface{ Validate() error }: 7110 if err := v.Validate(); err != nil { 7111 errors = append(errors, RouteAction_HashPolicy_HeaderValidationError{ 7112 field: "RegexRewrite", 7113 reason: "embedded message failed validation", 7114 cause: err, 7115 }) 7116 } 7117 } 7118 } else if v, ok := interface{}(m.GetRegexRewrite()).(interface{ Validate() error }); ok { 7119 if err := v.Validate(); err != nil { 7120 return RouteAction_HashPolicy_HeaderValidationError{ 7121 field: "RegexRewrite", 7122 reason: "embedded message failed validation", 7123 cause: err, 7124 } 7125 } 7126 } 7127 7128 if len(errors) > 0 { 7129 return RouteAction_HashPolicy_HeaderMultiError(errors) 7130 } 7131 return nil 7132} 7133 7134// RouteAction_HashPolicy_HeaderMultiError is an error wrapping multiple 7135// validation errors returned by RouteAction_HashPolicy_Header.ValidateAll() 7136// if the designated constraints aren't met. 7137type RouteAction_HashPolicy_HeaderMultiError []error 7138 7139// Error returns a concatenation of all the error messages it wraps. 7140func (m RouteAction_HashPolicy_HeaderMultiError) Error() string { 7141 var msgs []string 7142 for _, err := range m { 7143 msgs = append(msgs, err.Error()) 7144 } 7145 return strings.Join(msgs, "; ") 7146} 7147 7148// AllErrors returns a list of validation violation errors. 7149func (m RouteAction_HashPolicy_HeaderMultiError) AllErrors() []error { return m } 7150 7151// RouteAction_HashPolicy_HeaderValidationError is the validation error 7152// returned by RouteAction_HashPolicy_Header.Validate if the designated 7153// constraints aren't met. 7154type RouteAction_HashPolicy_HeaderValidationError struct { 7155 field string 7156 reason string 7157 cause error 7158 key bool 7159} 7160 7161// Field function returns field value. 7162func (e RouteAction_HashPolicy_HeaderValidationError) Field() string { return e.field } 7163 7164// Reason function returns reason value. 7165func (e RouteAction_HashPolicy_HeaderValidationError) Reason() string { return e.reason } 7166 7167// Cause function returns cause value. 7168func (e RouteAction_HashPolicy_HeaderValidationError) Cause() error { return e.cause } 7169 7170// Key function returns key value. 7171func (e RouteAction_HashPolicy_HeaderValidationError) Key() bool { return e.key } 7172 7173// ErrorName returns error name. 7174func (e RouteAction_HashPolicy_HeaderValidationError) ErrorName() string { 7175 return "RouteAction_HashPolicy_HeaderValidationError" 7176} 7177 7178// Error satisfies the builtin error interface 7179func (e RouteAction_HashPolicy_HeaderValidationError) Error() string { 7180 cause := "" 7181 if e.cause != nil { 7182 cause = fmt.Sprintf(" | caused by: %v", e.cause) 7183 } 7184 7185 key := "" 7186 if e.key { 7187 key = "key for " 7188 } 7189 7190 return fmt.Sprintf( 7191 "invalid %sRouteAction_HashPolicy_Header.%s: %s%s", 7192 key, 7193 e.field, 7194 e.reason, 7195 cause) 7196} 7197 7198var _ error = RouteAction_HashPolicy_HeaderValidationError{} 7199 7200var _ interface { 7201 Field() string 7202 Reason() string 7203 Key() bool 7204 Cause() error 7205 ErrorName() string 7206} = RouteAction_HashPolicy_HeaderValidationError{} 7207 7208var _RouteAction_HashPolicy_Header_HeaderName_Pattern = regexp.MustCompile("^[^\x00\n\r]*$") 7209 7210// Validate checks the field values on RouteAction_HashPolicy_Cookie with the 7211// rules defined in the proto definition for this message. If any rules are 7212// violated, the first error encountered is returned, or nil if there are no violations. 7213func (m *RouteAction_HashPolicy_Cookie) Validate() error { 7214 return m.validate(false) 7215} 7216 7217// ValidateAll checks the field values on RouteAction_HashPolicy_Cookie with 7218// the rules defined in the proto definition for this message. If any rules 7219// are violated, the result is a list of violation errors wrapped in 7220// RouteAction_HashPolicy_CookieMultiError, or nil if none found. 7221func (m *RouteAction_HashPolicy_Cookie) ValidateAll() error { 7222 return m.validate(true) 7223} 7224 7225func (m *RouteAction_HashPolicy_Cookie) validate(all bool) error { 7226 if m == nil { 7227 return nil 7228 } 7229 7230 var errors []error 7231 7232 if utf8.RuneCountInString(m.GetName()) < 1 { 7233 err := RouteAction_HashPolicy_CookieValidationError{ 7234 field: "Name", 7235 reason: "value length must be at least 1 runes", 7236 } 7237 if !all { 7238 return err 7239 } 7240 errors = append(errors, err) 7241 } 7242 7243 if all { 7244 switch v := interface{}(m.GetTtl()).(type) { 7245 case interface{ ValidateAll() error }: 7246 if err := v.ValidateAll(); err != nil { 7247 errors = append(errors, RouteAction_HashPolicy_CookieValidationError{ 7248 field: "Ttl", 7249 reason: "embedded message failed validation", 7250 cause: err, 7251 }) 7252 } 7253 case interface{ Validate() error }: 7254 if err := v.Validate(); err != nil { 7255 errors = append(errors, RouteAction_HashPolicy_CookieValidationError{ 7256 field: "Ttl", 7257 reason: "embedded message failed validation", 7258 cause: err, 7259 }) 7260 } 7261 } 7262 } else if v, ok := interface{}(m.GetTtl()).(interface{ Validate() error }); ok { 7263 if err := v.Validate(); err != nil { 7264 return RouteAction_HashPolicy_CookieValidationError{ 7265 field: "Ttl", 7266 reason: "embedded message failed validation", 7267 cause: err, 7268 } 7269 } 7270 } 7271 7272 // no validation rules for Path 7273 7274 if len(errors) > 0 { 7275 return RouteAction_HashPolicy_CookieMultiError(errors) 7276 } 7277 return nil 7278} 7279 7280// RouteAction_HashPolicy_CookieMultiError is an error wrapping multiple 7281// validation errors returned by RouteAction_HashPolicy_Cookie.ValidateAll() 7282// if the designated constraints aren't met. 7283type RouteAction_HashPolicy_CookieMultiError []error 7284 7285// Error returns a concatenation of all the error messages it wraps. 7286func (m RouteAction_HashPolicy_CookieMultiError) Error() string { 7287 var msgs []string 7288 for _, err := range m { 7289 msgs = append(msgs, err.Error()) 7290 } 7291 return strings.Join(msgs, "; ") 7292} 7293 7294// AllErrors returns a list of validation violation errors. 7295func (m RouteAction_HashPolicy_CookieMultiError) AllErrors() []error { return m } 7296 7297// RouteAction_HashPolicy_CookieValidationError is the validation error 7298// returned by RouteAction_HashPolicy_Cookie.Validate if the designated 7299// constraints aren't met. 7300type RouteAction_HashPolicy_CookieValidationError struct { 7301 field string 7302 reason string 7303 cause error 7304 key bool 7305} 7306 7307// Field function returns field value. 7308func (e RouteAction_HashPolicy_CookieValidationError) Field() string { return e.field } 7309 7310// Reason function returns reason value. 7311func (e RouteAction_HashPolicy_CookieValidationError) Reason() string { return e.reason } 7312 7313// Cause function returns cause value. 7314func (e RouteAction_HashPolicy_CookieValidationError) Cause() error { return e.cause } 7315 7316// Key function returns key value. 7317func (e RouteAction_HashPolicy_CookieValidationError) Key() bool { return e.key } 7318 7319// ErrorName returns error name. 7320func (e RouteAction_HashPolicy_CookieValidationError) ErrorName() string { 7321 return "RouteAction_HashPolicy_CookieValidationError" 7322} 7323 7324// Error satisfies the builtin error interface 7325func (e RouteAction_HashPolicy_CookieValidationError) Error() string { 7326 cause := "" 7327 if e.cause != nil { 7328 cause = fmt.Sprintf(" | caused by: %v", e.cause) 7329 } 7330 7331 key := "" 7332 if e.key { 7333 key = "key for " 7334 } 7335 7336 return fmt.Sprintf( 7337 "invalid %sRouteAction_HashPolicy_Cookie.%s: %s%s", 7338 key, 7339 e.field, 7340 e.reason, 7341 cause) 7342} 7343 7344var _ error = RouteAction_HashPolicy_CookieValidationError{} 7345 7346var _ interface { 7347 Field() string 7348 Reason() string 7349 Key() bool 7350 Cause() error 7351 ErrorName() string 7352} = RouteAction_HashPolicy_CookieValidationError{} 7353 7354// Validate checks the field values on 7355// RouteAction_HashPolicy_ConnectionProperties with the rules defined in the 7356// proto definition for this message. If any rules are violated, the first 7357// error encountered is returned, or nil if there are no violations. 7358func (m *RouteAction_HashPolicy_ConnectionProperties) Validate() error { 7359 return m.validate(false) 7360} 7361 7362// ValidateAll checks the field values on 7363// RouteAction_HashPolicy_ConnectionProperties with the rules defined in the 7364// proto definition for this message. If any rules are violated, the result is 7365// a list of violation errors wrapped in 7366// RouteAction_HashPolicy_ConnectionPropertiesMultiError, or nil if none found. 7367func (m *RouteAction_HashPolicy_ConnectionProperties) ValidateAll() error { 7368 return m.validate(true) 7369} 7370 7371func (m *RouteAction_HashPolicy_ConnectionProperties) validate(all bool) error { 7372 if m == nil { 7373 return nil 7374 } 7375 7376 var errors []error 7377 7378 // no validation rules for SourceIp 7379 7380 if len(errors) > 0 { 7381 return RouteAction_HashPolicy_ConnectionPropertiesMultiError(errors) 7382 } 7383 return nil 7384} 7385 7386// RouteAction_HashPolicy_ConnectionPropertiesMultiError is an error wrapping 7387// multiple validation errors returned by 7388// RouteAction_HashPolicy_ConnectionProperties.ValidateAll() if the designated 7389// constraints aren't met. 7390type RouteAction_HashPolicy_ConnectionPropertiesMultiError []error 7391 7392// Error returns a concatenation of all the error messages it wraps. 7393func (m RouteAction_HashPolicy_ConnectionPropertiesMultiError) Error() string { 7394 var msgs []string 7395 for _, err := range m { 7396 msgs = append(msgs, err.Error()) 7397 } 7398 return strings.Join(msgs, "; ") 7399} 7400 7401// AllErrors returns a list of validation violation errors. 7402func (m RouteAction_HashPolicy_ConnectionPropertiesMultiError) AllErrors() []error { return m } 7403 7404// RouteAction_HashPolicy_ConnectionPropertiesValidationError is the validation 7405// error returned by RouteAction_HashPolicy_ConnectionProperties.Validate if 7406// the designated constraints aren't met. 7407type RouteAction_HashPolicy_ConnectionPropertiesValidationError struct { 7408 field string 7409 reason string 7410 cause error 7411 key bool 7412} 7413 7414// Field function returns field value. 7415func (e RouteAction_HashPolicy_ConnectionPropertiesValidationError) Field() string { return e.field } 7416 7417// Reason function returns reason value. 7418func (e RouteAction_HashPolicy_ConnectionPropertiesValidationError) Reason() string { return e.reason } 7419 7420// Cause function returns cause value. 7421func (e RouteAction_HashPolicy_ConnectionPropertiesValidationError) Cause() error { return e.cause } 7422 7423// Key function returns key value. 7424func (e RouteAction_HashPolicy_ConnectionPropertiesValidationError) Key() bool { return e.key } 7425 7426// ErrorName returns error name. 7427func (e RouteAction_HashPolicy_ConnectionPropertiesValidationError) ErrorName() string { 7428 return "RouteAction_HashPolicy_ConnectionPropertiesValidationError" 7429} 7430 7431// Error satisfies the builtin error interface 7432func (e RouteAction_HashPolicy_ConnectionPropertiesValidationError) Error() string { 7433 cause := "" 7434 if e.cause != nil { 7435 cause = fmt.Sprintf(" | caused by: %v", e.cause) 7436 } 7437 7438 key := "" 7439 if e.key { 7440 key = "key for " 7441 } 7442 7443 return fmt.Sprintf( 7444 "invalid %sRouteAction_HashPolicy_ConnectionProperties.%s: %s%s", 7445 key, 7446 e.field, 7447 e.reason, 7448 cause) 7449} 7450 7451var _ error = RouteAction_HashPolicy_ConnectionPropertiesValidationError{} 7452 7453var _ interface { 7454 Field() string 7455 Reason() string 7456 Key() bool 7457 Cause() error 7458 ErrorName() string 7459} = RouteAction_HashPolicy_ConnectionPropertiesValidationError{} 7460 7461// Validate checks the field values on RouteAction_HashPolicy_QueryParameter 7462// with the rules defined in the proto definition for this message. If any 7463// rules are violated, the first error encountered is returned, or nil if 7464// there are no violations. 7465func (m *RouteAction_HashPolicy_QueryParameter) Validate() error { 7466 return m.validate(false) 7467} 7468 7469// ValidateAll checks the field values on RouteAction_HashPolicy_QueryParameter 7470// with the rules defined in the proto definition for this message. If any 7471// rules are violated, the result is a list of violation errors wrapped in 7472// RouteAction_HashPolicy_QueryParameterMultiError, or nil if none found. 7473func (m *RouteAction_HashPolicy_QueryParameter) ValidateAll() error { 7474 return m.validate(true) 7475} 7476 7477func (m *RouteAction_HashPolicy_QueryParameter) validate(all bool) error { 7478 if m == nil { 7479 return nil 7480 } 7481 7482 var errors []error 7483 7484 if utf8.RuneCountInString(m.GetName()) < 1 { 7485 err := RouteAction_HashPolicy_QueryParameterValidationError{ 7486 field: "Name", 7487 reason: "value length must be at least 1 runes", 7488 } 7489 if !all { 7490 return err 7491 } 7492 errors = append(errors, err) 7493 } 7494 7495 if len(errors) > 0 { 7496 return RouteAction_HashPolicy_QueryParameterMultiError(errors) 7497 } 7498 return nil 7499} 7500 7501// RouteAction_HashPolicy_QueryParameterMultiError is an error wrapping 7502// multiple validation errors returned by 7503// RouteAction_HashPolicy_QueryParameter.ValidateAll() if the designated 7504// constraints aren't met. 7505type RouteAction_HashPolicy_QueryParameterMultiError []error 7506 7507// Error returns a concatenation of all the error messages it wraps. 7508func (m RouteAction_HashPolicy_QueryParameterMultiError) Error() string { 7509 var msgs []string 7510 for _, err := range m { 7511 msgs = append(msgs, err.Error()) 7512 } 7513 return strings.Join(msgs, "; ") 7514} 7515 7516// AllErrors returns a list of validation violation errors. 7517func (m RouteAction_HashPolicy_QueryParameterMultiError) AllErrors() []error { return m } 7518 7519// RouteAction_HashPolicy_QueryParameterValidationError is the validation error 7520// returned by RouteAction_HashPolicy_QueryParameter.Validate if the 7521// designated constraints aren't met. 7522type RouteAction_HashPolicy_QueryParameterValidationError struct { 7523 field string 7524 reason string 7525 cause error 7526 key bool 7527} 7528 7529// Field function returns field value. 7530func (e RouteAction_HashPolicy_QueryParameterValidationError) Field() string { return e.field } 7531 7532// Reason function returns reason value. 7533func (e RouteAction_HashPolicy_QueryParameterValidationError) Reason() string { return e.reason } 7534 7535// Cause function returns cause value. 7536func (e RouteAction_HashPolicy_QueryParameterValidationError) Cause() error { return e.cause } 7537 7538// Key function returns key value. 7539func (e RouteAction_HashPolicy_QueryParameterValidationError) Key() bool { return e.key } 7540 7541// ErrorName returns error name. 7542func (e RouteAction_HashPolicy_QueryParameterValidationError) ErrorName() string { 7543 return "RouteAction_HashPolicy_QueryParameterValidationError" 7544} 7545 7546// Error satisfies the builtin error interface 7547func (e RouteAction_HashPolicy_QueryParameterValidationError) Error() string { 7548 cause := "" 7549 if e.cause != nil { 7550 cause = fmt.Sprintf(" | caused by: %v", e.cause) 7551 } 7552 7553 key := "" 7554 if e.key { 7555 key = "key for " 7556 } 7557 7558 return fmt.Sprintf( 7559 "invalid %sRouteAction_HashPolicy_QueryParameter.%s: %s%s", 7560 key, 7561 e.field, 7562 e.reason, 7563 cause) 7564} 7565 7566var _ error = RouteAction_HashPolicy_QueryParameterValidationError{} 7567 7568var _ interface { 7569 Field() string 7570 Reason() string 7571 Key() bool 7572 Cause() error 7573 ErrorName() string 7574} = RouteAction_HashPolicy_QueryParameterValidationError{} 7575 7576// Validate checks the field values on RouteAction_HashPolicy_FilterState with 7577// the rules defined in the proto definition for this message. If any rules 7578// are violated, the first error encountered is returned, or nil if there are 7579// no violations. 7580func (m *RouteAction_HashPolicy_FilterState) Validate() error { 7581 return m.validate(false) 7582} 7583 7584// ValidateAll checks the field values on RouteAction_HashPolicy_FilterState 7585// with the rules defined in the proto definition for this message. If any 7586// rules are violated, the result is a list of violation errors wrapped in 7587// RouteAction_HashPolicy_FilterStateMultiError, or nil if none found. 7588func (m *RouteAction_HashPolicy_FilterState) ValidateAll() error { 7589 return m.validate(true) 7590} 7591 7592func (m *RouteAction_HashPolicy_FilterState) validate(all bool) error { 7593 if m == nil { 7594 return nil 7595 } 7596 7597 var errors []error 7598 7599 if utf8.RuneCountInString(m.GetKey()) < 1 { 7600 err := RouteAction_HashPolicy_FilterStateValidationError{ 7601 field: "Key", 7602 reason: "value length must be at least 1 runes", 7603 } 7604 if !all { 7605 return err 7606 } 7607 errors = append(errors, err) 7608 } 7609 7610 if len(errors) > 0 { 7611 return RouteAction_HashPolicy_FilterStateMultiError(errors) 7612 } 7613 return nil 7614} 7615 7616// RouteAction_HashPolicy_FilterStateMultiError is an error wrapping multiple 7617// validation errors returned by 7618// RouteAction_HashPolicy_FilterState.ValidateAll() if the designated 7619// constraints aren't met. 7620type RouteAction_HashPolicy_FilterStateMultiError []error 7621 7622// Error returns a concatenation of all the error messages it wraps. 7623func (m RouteAction_HashPolicy_FilterStateMultiError) Error() string { 7624 var msgs []string 7625 for _, err := range m { 7626 msgs = append(msgs, err.Error()) 7627 } 7628 return strings.Join(msgs, "; ") 7629} 7630 7631// AllErrors returns a list of validation violation errors. 7632func (m RouteAction_HashPolicy_FilterStateMultiError) AllErrors() []error { return m } 7633 7634// RouteAction_HashPolicy_FilterStateValidationError is the validation error 7635// returned by RouteAction_HashPolicy_FilterState.Validate if the designated 7636// constraints aren't met. 7637type RouteAction_HashPolicy_FilterStateValidationError struct { 7638 field string 7639 reason string 7640 cause error 7641 key bool 7642} 7643 7644// Field function returns field value. 7645func (e RouteAction_HashPolicy_FilterStateValidationError) Field() string { return e.field } 7646 7647// Reason function returns reason value. 7648func (e RouteAction_HashPolicy_FilterStateValidationError) Reason() string { return e.reason } 7649 7650// Cause function returns cause value. 7651func (e RouteAction_HashPolicy_FilterStateValidationError) Cause() error { return e.cause } 7652 7653// Key function returns key value. 7654func (e RouteAction_HashPolicy_FilterStateValidationError) Key() bool { return e.key } 7655 7656// ErrorName returns error name. 7657func (e RouteAction_HashPolicy_FilterStateValidationError) ErrorName() string { 7658 return "RouteAction_HashPolicy_FilterStateValidationError" 7659} 7660 7661// Error satisfies the builtin error interface 7662func (e RouteAction_HashPolicy_FilterStateValidationError) Error() string { 7663 cause := "" 7664 if e.cause != nil { 7665 cause = fmt.Sprintf(" | caused by: %v", e.cause) 7666 } 7667 7668 key := "" 7669 if e.key { 7670 key = "key for " 7671 } 7672 7673 return fmt.Sprintf( 7674 "invalid %sRouteAction_HashPolicy_FilterState.%s: %s%s", 7675 key, 7676 e.field, 7677 e.reason, 7678 cause) 7679} 7680 7681var _ error = RouteAction_HashPolicy_FilterStateValidationError{} 7682 7683var _ interface { 7684 Field() string 7685 Reason() string 7686 Key() bool 7687 Cause() error 7688 ErrorName() string 7689} = RouteAction_HashPolicy_FilterStateValidationError{} 7690 7691// Validate checks the field values on RouteAction_UpgradeConfig_ConnectConfig 7692// with the rules defined in the proto definition for this message. If any 7693// rules are violated, the first error encountered is returned, or nil if 7694// there are no violations. 7695func (m *RouteAction_UpgradeConfig_ConnectConfig) Validate() error { 7696 return m.validate(false) 7697} 7698 7699// ValidateAll checks the field values on 7700// RouteAction_UpgradeConfig_ConnectConfig with the rules defined in the proto 7701// definition for this message. If any rules are violated, the result is a 7702// list of violation errors wrapped in 7703// RouteAction_UpgradeConfig_ConnectConfigMultiError, or nil if none found. 7704func (m *RouteAction_UpgradeConfig_ConnectConfig) ValidateAll() error { 7705 return m.validate(true) 7706} 7707 7708func (m *RouteAction_UpgradeConfig_ConnectConfig) validate(all bool) error { 7709 if m == nil { 7710 return nil 7711 } 7712 7713 var errors []error 7714 7715 if all { 7716 switch v := interface{}(m.GetProxyProtocolConfig()).(type) { 7717 case interface{ ValidateAll() error }: 7718 if err := v.ValidateAll(); err != nil { 7719 errors = append(errors, RouteAction_UpgradeConfig_ConnectConfigValidationError{ 7720 field: "ProxyProtocolConfig", 7721 reason: "embedded message failed validation", 7722 cause: err, 7723 }) 7724 } 7725 case interface{ Validate() error }: 7726 if err := v.Validate(); err != nil { 7727 errors = append(errors, RouteAction_UpgradeConfig_ConnectConfigValidationError{ 7728 field: "ProxyProtocolConfig", 7729 reason: "embedded message failed validation", 7730 cause: err, 7731 }) 7732 } 7733 } 7734 } else if v, ok := interface{}(m.GetProxyProtocolConfig()).(interface{ Validate() error }); ok { 7735 if err := v.Validate(); err != nil { 7736 return RouteAction_UpgradeConfig_ConnectConfigValidationError{ 7737 field: "ProxyProtocolConfig", 7738 reason: "embedded message failed validation", 7739 cause: err, 7740 } 7741 } 7742 } 7743 7744 // no validation rules for AllowPost 7745 7746 if len(errors) > 0 { 7747 return RouteAction_UpgradeConfig_ConnectConfigMultiError(errors) 7748 } 7749 return nil 7750} 7751 7752// RouteAction_UpgradeConfig_ConnectConfigMultiError is an error wrapping 7753// multiple validation errors returned by 7754// RouteAction_UpgradeConfig_ConnectConfig.ValidateAll() if the designated 7755// constraints aren't met. 7756type RouteAction_UpgradeConfig_ConnectConfigMultiError []error 7757 7758// Error returns a concatenation of all the error messages it wraps. 7759func (m RouteAction_UpgradeConfig_ConnectConfigMultiError) Error() string { 7760 var msgs []string 7761 for _, err := range m { 7762 msgs = append(msgs, err.Error()) 7763 } 7764 return strings.Join(msgs, "; ") 7765} 7766 7767// AllErrors returns a list of validation violation errors. 7768func (m RouteAction_UpgradeConfig_ConnectConfigMultiError) AllErrors() []error { return m } 7769 7770// RouteAction_UpgradeConfig_ConnectConfigValidationError is the validation 7771// error returned by RouteAction_UpgradeConfig_ConnectConfig.Validate if the 7772// designated constraints aren't met. 7773type RouteAction_UpgradeConfig_ConnectConfigValidationError struct { 7774 field string 7775 reason string 7776 cause error 7777 key bool 7778} 7779 7780// Field function returns field value. 7781func (e RouteAction_UpgradeConfig_ConnectConfigValidationError) Field() string { return e.field } 7782 7783// Reason function returns reason value. 7784func (e RouteAction_UpgradeConfig_ConnectConfigValidationError) Reason() string { return e.reason } 7785 7786// Cause function returns cause value. 7787func (e RouteAction_UpgradeConfig_ConnectConfigValidationError) Cause() error { return e.cause } 7788 7789// Key function returns key value. 7790func (e RouteAction_UpgradeConfig_ConnectConfigValidationError) Key() bool { return e.key } 7791 7792// ErrorName returns error name. 7793func (e RouteAction_UpgradeConfig_ConnectConfigValidationError) ErrorName() string { 7794 return "RouteAction_UpgradeConfig_ConnectConfigValidationError" 7795} 7796 7797// Error satisfies the builtin error interface 7798func (e RouteAction_UpgradeConfig_ConnectConfigValidationError) Error() string { 7799 cause := "" 7800 if e.cause != nil { 7801 cause = fmt.Sprintf(" | caused by: %v", e.cause) 7802 } 7803 7804 key := "" 7805 if e.key { 7806 key = "key for " 7807 } 7808 7809 return fmt.Sprintf( 7810 "invalid %sRouteAction_UpgradeConfig_ConnectConfig.%s: %s%s", 7811 key, 7812 e.field, 7813 e.reason, 7814 cause) 7815} 7816 7817var _ error = RouteAction_UpgradeConfig_ConnectConfigValidationError{} 7818 7819var _ interface { 7820 Field() string 7821 Reason() string 7822 Key() bool 7823 Cause() error 7824 ErrorName() string 7825} = RouteAction_UpgradeConfig_ConnectConfigValidationError{} 7826 7827// Validate checks the field values on RetryPolicy_RetryPriority with the rules 7828// defined in the proto definition for this message. If any rules are 7829// violated, the first error encountered is returned, or nil if there are no violations. 7830func (m *RetryPolicy_RetryPriority) Validate() error { 7831 return m.validate(false) 7832} 7833 7834// ValidateAll checks the field values on RetryPolicy_RetryPriority with the 7835// rules defined in the proto definition for this message. If any rules are 7836// violated, the result is a list of violation errors wrapped in 7837// RetryPolicy_RetryPriorityMultiError, or nil if none found. 7838func (m *RetryPolicy_RetryPriority) ValidateAll() error { 7839 return m.validate(true) 7840} 7841 7842func (m *RetryPolicy_RetryPriority) validate(all bool) error { 7843 if m == nil { 7844 return nil 7845 } 7846 7847 var errors []error 7848 7849 if utf8.RuneCountInString(m.GetName()) < 1 { 7850 err := RetryPolicy_RetryPriorityValidationError{ 7851 field: "Name", 7852 reason: "value length must be at least 1 runes", 7853 } 7854 if !all { 7855 return err 7856 } 7857 errors = append(errors, err) 7858 } 7859 7860 switch m.ConfigType.(type) { 7861 7862 case *RetryPolicy_RetryPriority_TypedConfig: 7863 7864 if all { 7865 switch v := interface{}(m.GetTypedConfig()).(type) { 7866 case interface{ ValidateAll() error }: 7867 if err := v.ValidateAll(); err != nil { 7868 errors = append(errors, RetryPolicy_RetryPriorityValidationError{ 7869 field: "TypedConfig", 7870 reason: "embedded message failed validation", 7871 cause: err, 7872 }) 7873 } 7874 case interface{ Validate() error }: 7875 if err := v.Validate(); err != nil { 7876 errors = append(errors, RetryPolicy_RetryPriorityValidationError{ 7877 field: "TypedConfig", 7878 reason: "embedded message failed validation", 7879 cause: err, 7880 }) 7881 } 7882 } 7883 } else if v, ok := interface{}(m.GetTypedConfig()).(interface{ Validate() error }); ok { 7884 if err := v.Validate(); err != nil { 7885 return RetryPolicy_RetryPriorityValidationError{ 7886 field: "TypedConfig", 7887 reason: "embedded message failed validation", 7888 cause: err, 7889 } 7890 } 7891 } 7892 7893 } 7894 7895 if len(errors) > 0 { 7896 return RetryPolicy_RetryPriorityMultiError(errors) 7897 } 7898 return nil 7899} 7900 7901// RetryPolicy_RetryPriorityMultiError is an error wrapping multiple validation 7902// errors returned by RetryPolicy_RetryPriority.ValidateAll() if the 7903// designated constraints aren't met. 7904type RetryPolicy_RetryPriorityMultiError []error 7905 7906// Error returns a concatenation of all the error messages it wraps. 7907func (m RetryPolicy_RetryPriorityMultiError) Error() string { 7908 var msgs []string 7909 for _, err := range m { 7910 msgs = append(msgs, err.Error()) 7911 } 7912 return strings.Join(msgs, "; ") 7913} 7914 7915// AllErrors returns a list of validation violation errors. 7916func (m RetryPolicy_RetryPriorityMultiError) AllErrors() []error { return m } 7917 7918// RetryPolicy_RetryPriorityValidationError is the validation error returned by 7919// RetryPolicy_RetryPriority.Validate if the designated constraints aren't met. 7920type RetryPolicy_RetryPriorityValidationError struct { 7921 field string 7922 reason string 7923 cause error 7924 key bool 7925} 7926 7927// Field function returns field value. 7928func (e RetryPolicy_RetryPriorityValidationError) Field() string { return e.field } 7929 7930// Reason function returns reason value. 7931func (e RetryPolicy_RetryPriorityValidationError) Reason() string { return e.reason } 7932 7933// Cause function returns cause value. 7934func (e RetryPolicy_RetryPriorityValidationError) Cause() error { return e.cause } 7935 7936// Key function returns key value. 7937func (e RetryPolicy_RetryPriorityValidationError) Key() bool { return e.key } 7938 7939// ErrorName returns error name. 7940func (e RetryPolicy_RetryPriorityValidationError) ErrorName() string { 7941 return "RetryPolicy_RetryPriorityValidationError" 7942} 7943 7944// Error satisfies the builtin error interface 7945func (e RetryPolicy_RetryPriorityValidationError) Error() string { 7946 cause := "" 7947 if e.cause != nil { 7948 cause = fmt.Sprintf(" | caused by: %v", e.cause) 7949 } 7950 7951 key := "" 7952 if e.key { 7953 key = "key for " 7954 } 7955 7956 return fmt.Sprintf( 7957 "invalid %sRetryPolicy_RetryPriority.%s: %s%s", 7958 key, 7959 e.field, 7960 e.reason, 7961 cause) 7962} 7963 7964var _ error = RetryPolicy_RetryPriorityValidationError{} 7965 7966var _ interface { 7967 Field() string 7968 Reason() string 7969 Key() bool 7970 Cause() error 7971 ErrorName() string 7972} = RetryPolicy_RetryPriorityValidationError{} 7973 7974// Validate checks the field values on RetryPolicy_RetryHostPredicate with the 7975// rules defined in the proto definition for this message. If any rules are 7976// violated, the first error encountered is returned, or nil if there are no violations. 7977func (m *RetryPolicy_RetryHostPredicate) Validate() error { 7978 return m.validate(false) 7979} 7980 7981// ValidateAll checks the field values on RetryPolicy_RetryHostPredicate with 7982// the rules defined in the proto definition for this message. If any rules 7983// are violated, the result is a list of violation errors wrapped in 7984// RetryPolicy_RetryHostPredicateMultiError, or nil if none found. 7985func (m *RetryPolicy_RetryHostPredicate) ValidateAll() error { 7986 return m.validate(true) 7987} 7988 7989func (m *RetryPolicy_RetryHostPredicate) validate(all bool) error { 7990 if m == nil { 7991 return nil 7992 } 7993 7994 var errors []error 7995 7996 if utf8.RuneCountInString(m.GetName()) < 1 { 7997 err := RetryPolicy_RetryHostPredicateValidationError{ 7998 field: "Name", 7999 reason: "value length must be at least 1 runes", 8000 } 8001 if !all { 8002 return err 8003 } 8004 errors = append(errors, err) 8005 } 8006 8007 switch m.ConfigType.(type) { 8008 8009 case *RetryPolicy_RetryHostPredicate_TypedConfig: 8010 8011 if all { 8012 switch v := interface{}(m.GetTypedConfig()).(type) { 8013 case interface{ ValidateAll() error }: 8014 if err := v.ValidateAll(); err != nil { 8015 errors = append(errors, RetryPolicy_RetryHostPredicateValidationError{ 8016 field: "TypedConfig", 8017 reason: "embedded message failed validation", 8018 cause: err, 8019 }) 8020 } 8021 case interface{ Validate() error }: 8022 if err := v.Validate(); err != nil { 8023 errors = append(errors, RetryPolicy_RetryHostPredicateValidationError{ 8024 field: "TypedConfig", 8025 reason: "embedded message failed validation", 8026 cause: err, 8027 }) 8028 } 8029 } 8030 } else if v, ok := interface{}(m.GetTypedConfig()).(interface{ Validate() error }); ok { 8031 if err := v.Validate(); err != nil { 8032 return RetryPolicy_RetryHostPredicateValidationError{ 8033 field: "TypedConfig", 8034 reason: "embedded message failed validation", 8035 cause: err, 8036 } 8037 } 8038 } 8039 8040 } 8041 8042 if len(errors) > 0 { 8043 return RetryPolicy_RetryHostPredicateMultiError(errors) 8044 } 8045 return nil 8046} 8047 8048// RetryPolicy_RetryHostPredicateMultiError is an error wrapping multiple 8049// validation errors returned by RetryPolicy_RetryHostPredicate.ValidateAll() 8050// if the designated constraints aren't met. 8051type RetryPolicy_RetryHostPredicateMultiError []error 8052 8053// Error returns a concatenation of all the error messages it wraps. 8054func (m RetryPolicy_RetryHostPredicateMultiError) Error() string { 8055 var msgs []string 8056 for _, err := range m { 8057 msgs = append(msgs, err.Error()) 8058 } 8059 return strings.Join(msgs, "; ") 8060} 8061 8062// AllErrors returns a list of validation violation errors. 8063func (m RetryPolicy_RetryHostPredicateMultiError) AllErrors() []error { return m } 8064 8065// RetryPolicy_RetryHostPredicateValidationError is the validation error 8066// returned by RetryPolicy_RetryHostPredicate.Validate if the designated 8067// constraints aren't met. 8068type RetryPolicy_RetryHostPredicateValidationError struct { 8069 field string 8070 reason string 8071 cause error 8072 key bool 8073} 8074 8075// Field function returns field value. 8076func (e RetryPolicy_RetryHostPredicateValidationError) Field() string { return e.field } 8077 8078// Reason function returns reason value. 8079func (e RetryPolicy_RetryHostPredicateValidationError) Reason() string { return e.reason } 8080 8081// Cause function returns cause value. 8082func (e RetryPolicy_RetryHostPredicateValidationError) Cause() error { return e.cause } 8083 8084// Key function returns key value. 8085func (e RetryPolicy_RetryHostPredicateValidationError) Key() bool { return e.key } 8086 8087// ErrorName returns error name. 8088func (e RetryPolicy_RetryHostPredicateValidationError) ErrorName() string { 8089 return "RetryPolicy_RetryHostPredicateValidationError" 8090} 8091 8092// Error satisfies the builtin error interface 8093func (e RetryPolicy_RetryHostPredicateValidationError) Error() string { 8094 cause := "" 8095 if e.cause != nil { 8096 cause = fmt.Sprintf(" | caused by: %v", e.cause) 8097 } 8098 8099 key := "" 8100 if e.key { 8101 key = "key for " 8102 } 8103 8104 return fmt.Sprintf( 8105 "invalid %sRetryPolicy_RetryHostPredicate.%s: %s%s", 8106 key, 8107 e.field, 8108 e.reason, 8109 cause) 8110} 8111 8112var _ error = RetryPolicy_RetryHostPredicateValidationError{} 8113 8114var _ interface { 8115 Field() string 8116 Reason() string 8117 Key() bool 8118 Cause() error 8119 ErrorName() string 8120} = RetryPolicy_RetryHostPredicateValidationError{} 8121 8122// Validate checks the field values on RetryPolicy_RetryBackOff with the rules 8123// defined in the proto definition for this message. If any rules are 8124// violated, the first error encountered is returned, or nil if there are no violations. 8125func (m *RetryPolicy_RetryBackOff) Validate() error { 8126 return m.validate(false) 8127} 8128 8129// ValidateAll checks the field values on RetryPolicy_RetryBackOff with the 8130// rules defined in the proto definition for this message. If any rules are 8131// violated, the result is a list of violation errors wrapped in 8132// RetryPolicy_RetryBackOffMultiError, or nil if none found. 8133func (m *RetryPolicy_RetryBackOff) ValidateAll() error { 8134 return m.validate(true) 8135} 8136 8137func (m *RetryPolicy_RetryBackOff) validate(all bool) error { 8138 if m == nil { 8139 return nil 8140 } 8141 8142 var errors []error 8143 8144 if m.GetBaseInterval() == nil { 8145 err := RetryPolicy_RetryBackOffValidationError{ 8146 field: "BaseInterval", 8147 reason: "value is required", 8148 } 8149 if !all { 8150 return err 8151 } 8152 errors = append(errors, err) 8153 } 8154 8155 if d := m.GetBaseInterval(); d != nil { 8156 dur, err := d.AsDuration(), d.CheckValid() 8157 if err != nil { 8158 err = RetryPolicy_RetryBackOffValidationError{ 8159 field: "BaseInterval", 8160 reason: "value is not a valid duration", 8161 cause: err, 8162 } 8163 if !all { 8164 return err 8165 } 8166 errors = append(errors, err) 8167 } else { 8168 8169 gt := time.Duration(0*time.Second + 0*time.Nanosecond) 8170 8171 if dur <= gt { 8172 err := RetryPolicy_RetryBackOffValidationError{ 8173 field: "BaseInterval", 8174 reason: "value must be greater than 0s", 8175 } 8176 if !all { 8177 return err 8178 } 8179 errors = append(errors, err) 8180 } 8181 8182 } 8183 } 8184 8185 if d := m.GetMaxInterval(); d != nil { 8186 dur, err := d.AsDuration(), d.CheckValid() 8187 if err != nil { 8188 err = RetryPolicy_RetryBackOffValidationError{ 8189 field: "MaxInterval", 8190 reason: "value is not a valid duration", 8191 cause: err, 8192 } 8193 if !all { 8194 return err 8195 } 8196 errors = append(errors, err) 8197 } else { 8198 8199 gt := time.Duration(0*time.Second + 0*time.Nanosecond) 8200 8201 if dur <= gt { 8202 err := RetryPolicy_RetryBackOffValidationError{ 8203 field: "MaxInterval", 8204 reason: "value must be greater than 0s", 8205 } 8206 if !all { 8207 return err 8208 } 8209 errors = append(errors, err) 8210 } 8211 8212 } 8213 } 8214 8215 if len(errors) > 0 { 8216 return RetryPolicy_RetryBackOffMultiError(errors) 8217 } 8218 return nil 8219} 8220 8221// RetryPolicy_RetryBackOffMultiError is an error wrapping multiple validation 8222// errors returned by RetryPolicy_RetryBackOff.ValidateAll() if the designated 8223// constraints aren't met. 8224type RetryPolicy_RetryBackOffMultiError []error 8225 8226// Error returns a concatenation of all the error messages it wraps. 8227func (m RetryPolicy_RetryBackOffMultiError) Error() string { 8228 var msgs []string 8229 for _, err := range m { 8230 msgs = append(msgs, err.Error()) 8231 } 8232 return strings.Join(msgs, "; ") 8233} 8234 8235// AllErrors returns a list of validation violation errors. 8236func (m RetryPolicy_RetryBackOffMultiError) AllErrors() []error { return m } 8237 8238// RetryPolicy_RetryBackOffValidationError is the validation error returned by 8239// RetryPolicy_RetryBackOff.Validate if the designated constraints aren't met. 8240type RetryPolicy_RetryBackOffValidationError struct { 8241 field string 8242 reason string 8243 cause error 8244 key bool 8245} 8246 8247// Field function returns field value. 8248func (e RetryPolicy_RetryBackOffValidationError) Field() string { return e.field } 8249 8250// Reason function returns reason value. 8251func (e RetryPolicy_RetryBackOffValidationError) Reason() string { return e.reason } 8252 8253// Cause function returns cause value. 8254func (e RetryPolicy_RetryBackOffValidationError) Cause() error { return e.cause } 8255 8256// Key function returns key value. 8257func (e RetryPolicy_RetryBackOffValidationError) Key() bool { return e.key } 8258 8259// ErrorName returns error name. 8260func (e RetryPolicy_RetryBackOffValidationError) ErrorName() string { 8261 return "RetryPolicy_RetryBackOffValidationError" 8262} 8263 8264// Error satisfies the builtin error interface 8265func (e RetryPolicy_RetryBackOffValidationError) Error() string { 8266 cause := "" 8267 if e.cause != nil { 8268 cause = fmt.Sprintf(" | caused by: %v", e.cause) 8269 } 8270 8271 key := "" 8272 if e.key { 8273 key = "key for " 8274 } 8275 8276 return fmt.Sprintf( 8277 "invalid %sRetryPolicy_RetryBackOff.%s: %s%s", 8278 key, 8279 e.field, 8280 e.reason, 8281 cause) 8282} 8283 8284var _ error = RetryPolicy_RetryBackOffValidationError{} 8285 8286var _ interface { 8287 Field() string 8288 Reason() string 8289 Key() bool 8290 Cause() error 8291 ErrorName() string 8292} = RetryPolicy_RetryBackOffValidationError{} 8293 8294// Validate checks the field values on RetryPolicy_ResetHeader with the rules 8295// defined in the proto definition for this message. If any rules are 8296// violated, the first error encountered is returned, or nil if there are no violations. 8297func (m *RetryPolicy_ResetHeader) Validate() error { 8298 return m.validate(false) 8299} 8300 8301// ValidateAll checks the field values on RetryPolicy_ResetHeader with the 8302// rules defined in the proto definition for this message. If any rules are 8303// violated, the result is a list of violation errors wrapped in 8304// RetryPolicy_ResetHeaderMultiError, or nil if none found. 8305func (m *RetryPolicy_ResetHeader) ValidateAll() error { 8306 return m.validate(true) 8307} 8308 8309func (m *RetryPolicy_ResetHeader) validate(all bool) error { 8310 if m == nil { 8311 return nil 8312 } 8313 8314 var errors []error 8315 8316 if utf8.RuneCountInString(m.GetName()) < 1 { 8317 err := RetryPolicy_ResetHeaderValidationError{ 8318 field: "Name", 8319 reason: "value length must be at least 1 runes", 8320 } 8321 if !all { 8322 return err 8323 } 8324 errors = append(errors, err) 8325 } 8326 8327 if !_RetryPolicy_ResetHeader_Name_Pattern.MatchString(m.GetName()) { 8328 err := RetryPolicy_ResetHeaderValidationError{ 8329 field: "Name", 8330 reason: "value does not match regex pattern \"^[^\\x00\\n\\r]*$\"", 8331 } 8332 if !all { 8333 return err 8334 } 8335 errors = append(errors, err) 8336 } 8337 8338 if _, ok := RetryPolicy_ResetHeaderFormat_name[int32(m.GetFormat())]; !ok { 8339 err := RetryPolicy_ResetHeaderValidationError{ 8340 field: "Format", 8341 reason: "value must be one of the defined enum values", 8342 } 8343 if !all { 8344 return err 8345 } 8346 errors = append(errors, err) 8347 } 8348 8349 if len(errors) > 0 { 8350 return RetryPolicy_ResetHeaderMultiError(errors) 8351 } 8352 return nil 8353} 8354 8355// RetryPolicy_ResetHeaderMultiError is an error wrapping multiple validation 8356// errors returned by RetryPolicy_ResetHeader.ValidateAll() if the designated 8357// constraints aren't met. 8358type RetryPolicy_ResetHeaderMultiError []error 8359 8360// Error returns a concatenation of all the error messages it wraps. 8361func (m RetryPolicy_ResetHeaderMultiError) Error() string { 8362 var msgs []string 8363 for _, err := range m { 8364 msgs = append(msgs, err.Error()) 8365 } 8366 return strings.Join(msgs, "; ") 8367} 8368 8369// AllErrors returns a list of validation violation errors. 8370func (m RetryPolicy_ResetHeaderMultiError) AllErrors() []error { return m } 8371 8372// RetryPolicy_ResetHeaderValidationError is the validation error returned by 8373// RetryPolicy_ResetHeader.Validate if the designated constraints aren't met. 8374type RetryPolicy_ResetHeaderValidationError struct { 8375 field string 8376 reason string 8377 cause error 8378 key bool 8379} 8380 8381// Field function returns field value. 8382func (e RetryPolicy_ResetHeaderValidationError) Field() string { return e.field } 8383 8384// Reason function returns reason value. 8385func (e RetryPolicy_ResetHeaderValidationError) Reason() string { return e.reason } 8386 8387// Cause function returns cause value. 8388func (e RetryPolicy_ResetHeaderValidationError) Cause() error { return e.cause } 8389 8390// Key function returns key value. 8391func (e RetryPolicy_ResetHeaderValidationError) Key() bool { return e.key } 8392 8393// ErrorName returns error name. 8394func (e RetryPolicy_ResetHeaderValidationError) ErrorName() string { 8395 return "RetryPolicy_ResetHeaderValidationError" 8396} 8397 8398// Error satisfies the builtin error interface 8399func (e RetryPolicy_ResetHeaderValidationError) Error() string { 8400 cause := "" 8401 if e.cause != nil { 8402 cause = fmt.Sprintf(" | caused by: %v", e.cause) 8403 } 8404 8405 key := "" 8406 if e.key { 8407 key = "key for " 8408 } 8409 8410 return fmt.Sprintf( 8411 "invalid %sRetryPolicy_ResetHeader.%s: %s%s", 8412 key, 8413 e.field, 8414 e.reason, 8415 cause) 8416} 8417 8418var _ error = RetryPolicy_ResetHeaderValidationError{} 8419 8420var _ interface { 8421 Field() string 8422 Reason() string 8423 Key() bool 8424 Cause() error 8425 ErrorName() string 8426} = RetryPolicy_ResetHeaderValidationError{} 8427 8428var _RetryPolicy_ResetHeader_Name_Pattern = regexp.MustCompile("^[^\x00\n\r]*$") 8429 8430// Validate checks the field values on RetryPolicy_RateLimitedRetryBackOff with 8431// the rules defined in the proto definition for this message. If any rules 8432// are violated, the first error encountered is returned, or nil if there are 8433// no violations. 8434func (m *RetryPolicy_RateLimitedRetryBackOff) Validate() error { 8435 return m.validate(false) 8436} 8437 8438// ValidateAll checks the field values on RetryPolicy_RateLimitedRetryBackOff 8439// with the rules defined in the proto definition for this message. If any 8440// rules are violated, the result is a list of violation errors wrapped in 8441// RetryPolicy_RateLimitedRetryBackOffMultiError, or nil if none found. 8442func (m *RetryPolicy_RateLimitedRetryBackOff) ValidateAll() error { 8443 return m.validate(true) 8444} 8445 8446func (m *RetryPolicy_RateLimitedRetryBackOff) validate(all bool) error { 8447 if m == nil { 8448 return nil 8449 } 8450 8451 var errors []error 8452 8453 if len(m.GetResetHeaders()) < 1 { 8454 err := RetryPolicy_RateLimitedRetryBackOffValidationError{ 8455 field: "ResetHeaders", 8456 reason: "value must contain at least 1 item(s)", 8457 } 8458 if !all { 8459 return err 8460 } 8461 errors = append(errors, err) 8462 } 8463 8464 for idx, item := range m.GetResetHeaders() { 8465 _, _ = idx, item 8466 8467 if all { 8468 switch v := interface{}(item).(type) { 8469 case interface{ ValidateAll() error }: 8470 if err := v.ValidateAll(); err != nil { 8471 errors = append(errors, RetryPolicy_RateLimitedRetryBackOffValidationError{ 8472 field: fmt.Sprintf("ResetHeaders[%v]", idx), 8473 reason: "embedded message failed validation", 8474 cause: err, 8475 }) 8476 } 8477 case interface{ Validate() error }: 8478 if err := v.Validate(); err != nil { 8479 errors = append(errors, RetryPolicy_RateLimitedRetryBackOffValidationError{ 8480 field: fmt.Sprintf("ResetHeaders[%v]", idx), 8481 reason: "embedded message failed validation", 8482 cause: err, 8483 }) 8484 } 8485 } 8486 } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { 8487 if err := v.Validate(); err != nil { 8488 return RetryPolicy_RateLimitedRetryBackOffValidationError{ 8489 field: fmt.Sprintf("ResetHeaders[%v]", idx), 8490 reason: "embedded message failed validation", 8491 cause: err, 8492 } 8493 } 8494 } 8495 8496 } 8497 8498 if d := m.GetMaxInterval(); d != nil { 8499 dur, err := d.AsDuration(), d.CheckValid() 8500 if err != nil { 8501 err = RetryPolicy_RateLimitedRetryBackOffValidationError{ 8502 field: "MaxInterval", 8503 reason: "value is not a valid duration", 8504 cause: err, 8505 } 8506 if !all { 8507 return err 8508 } 8509 errors = append(errors, err) 8510 } else { 8511 8512 gt := time.Duration(0*time.Second + 0*time.Nanosecond) 8513 8514 if dur <= gt { 8515 err := RetryPolicy_RateLimitedRetryBackOffValidationError{ 8516 field: "MaxInterval", 8517 reason: "value must be greater than 0s", 8518 } 8519 if !all { 8520 return err 8521 } 8522 errors = append(errors, err) 8523 } 8524 8525 } 8526 } 8527 8528 if len(errors) > 0 { 8529 return RetryPolicy_RateLimitedRetryBackOffMultiError(errors) 8530 } 8531 return nil 8532} 8533 8534// RetryPolicy_RateLimitedRetryBackOffMultiError is an error wrapping multiple 8535// validation errors returned by 8536// RetryPolicy_RateLimitedRetryBackOff.ValidateAll() if the designated 8537// constraints aren't met. 8538type RetryPolicy_RateLimitedRetryBackOffMultiError []error 8539 8540// Error returns a concatenation of all the error messages it wraps. 8541func (m RetryPolicy_RateLimitedRetryBackOffMultiError) Error() string { 8542 var msgs []string 8543 for _, err := range m { 8544 msgs = append(msgs, err.Error()) 8545 } 8546 return strings.Join(msgs, "; ") 8547} 8548 8549// AllErrors returns a list of validation violation errors. 8550func (m RetryPolicy_RateLimitedRetryBackOffMultiError) AllErrors() []error { return m } 8551 8552// RetryPolicy_RateLimitedRetryBackOffValidationError is the validation error 8553// returned by RetryPolicy_RateLimitedRetryBackOff.Validate if the designated 8554// constraints aren't met. 8555type RetryPolicy_RateLimitedRetryBackOffValidationError struct { 8556 field string 8557 reason string 8558 cause error 8559 key bool 8560} 8561 8562// Field function returns field value. 8563func (e RetryPolicy_RateLimitedRetryBackOffValidationError) Field() string { return e.field } 8564 8565// Reason function returns reason value. 8566func (e RetryPolicy_RateLimitedRetryBackOffValidationError) Reason() string { return e.reason } 8567 8568// Cause function returns cause value. 8569func (e RetryPolicy_RateLimitedRetryBackOffValidationError) Cause() error { return e.cause } 8570 8571// Key function returns key value. 8572func (e RetryPolicy_RateLimitedRetryBackOffValidationError) Key() bool { return e.key } 8573 8574// ErrorName returns error name. 8575func (e RetryPolicy_RateLimitedRetryBackOffValidationError) ErrorName() string { 8576 return "RetryPolicy_RateLimitedRetryBackOffValidationError" 8577} 8578 8579// Error satisfies the builtin error interface 8580func (e RetryPolicy_RateLimitedRetryBackOffValidationError) Error() string { 8581 cause := "" 8582 if e.cause != nil { 8583 cause = fmt.Sprintf(" | caused by: %v", e.cause) 8584 } 8585 8586 key := "" 8587 if e.key { 8588 key = "key for " 8589 } 8590 8591 return fmt.Sprintf( 8592 "invalid %sRetryPolicy_RateLimitedRetryBackOff.%s: %s%s", 8593 key, 8594 e.field, 8595 e.reason, 8596 cause) 8597} 8598 8599var _ error = RetryPolicy_RateLimitedRetryBackOffValidationError{} 8600 8601var _ interface { 8602 Field() string 8603 Reason() string 8604 Key() bool 8605 Cause() error 8606 ErrorName() string 8607} = RetryPolicy_RateLimitedRetryBackOffValidationError{} 8608 8609// Validate checks the field values on RateLimit_Action with the rules defined 8610// in the proto definition for this message. If any rules are violated, the 8611// first error encountered is returned, or nil if there are no violations. 8612func (m *RateLimit_Action) Validate() error { 8613 return m.validate(false) 8614} 8615 8616// ValidateAll checks the field values on RateLimit_Action with the rules 8617// defined in the proto definition for this message. If any rules are 8618// violated, the result is a list of violation errors wrapped in 8619// RateLimit_ActionMultiError, or nil if none found. 8620func (m *RateLimit_Action) ValidateAll() error { 8621 return m.validate(true) 8622} 8623 8624func (m *RateLimit_Action) validate(all bool) error { 8625 if m == nil { 8626 return nil 8627 } 8628 8629 var errors []error 8630 8631 switch m.ActionSpecifier.(type) { 8632 8633 case *RateLimit_Action_SourceCluster_: 8634 8635 if all { 8636 switch v := interface{}(m.GetSourceCluster()).(type) { 8637 case interface{ ValidateAll() error }: 8638 if err := v.ValidateAll(); err != nil { 8639 errors = append(errors, RateLimit_ActionValidationError{ 8640 field: "SourceCluster", 8641 reason: "embedded message failed validation", 8642 cause: err, 8643 }) 8644 } 8645 case interface{ Validate() error }: 8646 if err := v.Validate(); err != nil { 8647 errors = append(errors, RateLimit_ActionValidationError{ 8648 field: "SourceCluster", 8649 reason: "embedded message failed validation", 8650 cause: err, 8651 }) 8652 } 8653 } 8654 } else if v, ok := interface{}(m.GetSourceCluster()).(interface{ Validate() error }); ok { 8655 if err := v.Validate(); err != nil { 8656 return RateLimit_ActionValidationError{ 8657 field: "SourceCluster", 8658 reason: "embedded message failed validation", 8659 cause: err, 8660 } 8661 } 8662 } 8663 8664 case *RateLimit_Action_DestinationCluster_: 8665 8666 if all { 8667 switch v := interface{}(m.GetDestinationCluster()).(type) { 8668 case interface{ ValidateAll() error }: 8669 if err := v.ValidateAll(); err != nil { 8670 errors = append(errors, RateLimit_ActionValidationError{ 8671 field: "DestinationCluster", 8672 reason: "embedded message failed validation", 8673 cause: err, 8674 }) 8675 } 8676 case interface{ Validate() error }: 8677 if err := v.Validate(); err != nil { 8678 errors = append(errors, RateLimit_ActionValidationError{ 8679 field: "DestinationCluster", 8680 reason: "embedded message failed validation", 8681 cause: err, 8682 }) 8683 } 8684 } 8685 } else if v, ok := interface{}(m.GetDestinationCluster()).(interface{ Validate() error }); ok { 8686 if err := v.Validate(); err != nil { 8687 return RateLimit_ActionValidationError{ 8688 field: "DestinationCluster", 8689 reason: "embedded message failed validation", 8690 cause: err, 8691 } 8692 } 8693 } 8694 8695 case *RateLimit_Action_RequestHeaders_: 8696 8697 if all { 8698 switch v := interface{}(m.GetRequestHeaders()).(type) { 8699 case interface{ ValidateAll() error }: 8700 if err := v.ValidateAll(); err != nil { 8701 errors = append(errors, RateLimit_ActionValidationError{ 8702 field: "RequestHeaders", 8703 reason: "embedded message failed validation", 8704 cause: err, 8705 }) 8706 } 8707 case interface{ Validate() error }: 8708 if err := v.Validate(); err != nil { 8709 errors = append(errors, RateLimit_ActionValidationError{ 8710 field: "RequestHeaders", 8711 reason: "embedded message failed validation", 8712 cause: err, 8713 }) 8714 } 8715 } 8716 } else if v, ok := interface{}(m.GetRequestHeaders()).(interface{ Validate() error }); ok { 8717 if err := v.Validate(); err != nil { 8718 return RateLimit_ActionValidationError{ 8719 field: "RequestHeaders", 8720 reason: "embedded message failed validation", 8721 cause: err, 8722 } 8723 } 8724 } 8725 8726 case *RateLimit_Action_RemoteAddress_: 8727 8728 if all { 8729 switch v := interface{}(m.GetRemoteAddress()).(type) { 8730 case interface{ ValidateAll() error }: 8731 if err := v.ValidateAll(); err != nil { 8732 errors = append(errors, RateLimit_ActionValidationError{ 8733 field: "RemoteAddress", 8734 reason: "embedded message failed validation", 8735 cause: err, 8736 }) 8737 } 8738 case interface{ Validate() error }: 8739 if err := v.Validate(); err != nil { 8740 errors = append(errors, RateLimit_ActionValidationError{ 8741 field: "RemoteAddress", 8742 reason: "embedded message failed validation", 8743 cause: err, 8744 }) 8745 } 8746 } 8747 } else if v, ok := interface{}(m.GetRemoteAddress()).(interface{ Validate() error }); ok { 8748 if err := v.Validate(); err != nil { 8749 return RateLimit_ActionValidationError{ 8750 field: "RemoteAddress", 8751 reason: "embedded message failed validation", 8752 cause: err, 8753 } 8754 } 8755 } 8756 8757 case *RateLimit_Action_GenericKey_: 8758 8759 if all { 8760 switch v := interface{}(m.GetGenericKey()).(type) { 8761 case interface{ ValidateAll() error }: 8762 if err := v.ValidateAll(); err != nil { 8763 errors = append(errors, RateLimit_ActionValidationError{ 8764 field: "GenericKey", 8765 reason: "embedded message failed validation", 8766 cause: err, 8767 }) 8768 } 8769 case interface{ Validate() error }: 8770 if err := v.Validate(); err != nil { 8771 errors = append(errors, RateLimit_ActionValidationError{ 8772 field: "GenericKey", 8773 reason: "embedded message failed validation", 8774 cause: err, 8775 }) 8776 } 8777 } 8778 } else if v, ok := interface{}(m.GetGenericKey()).(interface{ Validate() error }); ok { 8779 if err := v.Validate(); err != nil { 8780 return RateLimit_ActionValidationError{ 8781 field: "GenericKey", 8782 reason: "embedded message failed validation", 8783 cause: err, 8784 } 8785 } 8786 } 8787 8788 case *RateLimit_Action_HeaderValueMatch_: 8789 8790 if all { 8791 switch v := interface{}(m.GetHeaderValueMatch()).(type) { 8792 case interface{ ValidateAll() error }: 8793 if err := v.ValidateAll(); err != nil { 8794 errors = append(errors, RateLimit_ActionValidationError{ 8795 field: "HeaderValueMatch", 8796 reason: "embedded message failed validation", 8797 cause: err, 8798 }) 8799 } 8800 case interface{ Validate() error }: 8801 if err := v.Validate(); err != nil { 8802 errors = append(errors, RateLimit_ActionValidationError{ 8803 field: "HeaderValueMatch", 8804 reason: "embedded message failed validation", 8805 cause: err, 8806 }) 8807 } 8808 } 8809 } else if v, ok := interface{}(m.GetHeaderValueMatch()).(interface{ Validate() error }); ok { 8810 if err := v.Validate(); err != nil { 8811 return RateLimit_ActionValidationError{ 8812 field: "HeaderValueMatch", 8813 reason: "embedded message failed validation", 8814 cause: err, 8815 } 8816 } 8817 } 8818 8819 case *RateLimit_Action_DynamicMetadata: 8820 8821 if all { 8822 switch v := interface{}(m.GetDynamicMetadata()).(type) { 8823 case interface{ ValidateAll() error }: 8824 if err := v.ValidateAll(); err != nil { 8825 errors = append(errors, RateLimit_ActionValidationError{ 8826 field: "DynamicMetadata", 8827 reason: "embedded message failed validation", 8828 cause: err, 8829 }) 8830 } 8831 case interface{ Validate() error }: 8832 if err := v.Validate(); err != nil { 8833 errors = append(errors, RateLimit_ActionValidationError{ 8834 field: "DynamicMetadata", 8835 reason: "embedded message failed validation", 8836 cause: err, 8837 }) 8838 } 8839 } 8840 } else if v, ok := interface{}(m.GetDynamicMetadata()).(interface{ Validate() error }); ok { 8841 if err := v.Validate(); err != nil { 8842 return RateLimit_ActionValidationError{ 8843 field: "DynamicMetadata", 8844 reason: "embedded message failed validation", 8845 cause: err, 8846 } 8847 } 8848 } 8849 8850 case *RateLimit_Action_Metadata: 8851 8852 if all { 8853 switch v := interface{}(m.GetMetadata()).(type) { 8854 case interface{ ValidateAll() error }: 8855 if err := v.ValidateAll(); err != nil { 8856 errors = append(errors, RateLimit_ActionValidationError{ 8857 field: "Metadata", 8858 reason: "embedded message failed validation", 8859 cause: err, 8860 }) 8861 } 8862 case interface{ Validate() error }: 8863 if err := v.Validate(); err != nil { 8864 errors = append(errors, RateLimit_ActionValidationError{ 8865 field: "Metadata", 8866 reason: "embedded message failed validation", 8867 cause: err, 8868 }) 8869 } 8870 } 8871 } else if v, ok := interface{}(m.GetMetadata()).(interface{ Validate() error }); ok { 8872 if err := v.Validate(); err != nil { 8873 return RateLimit_ActionValidationError{ 8874 field: "Metadata", 8875 reason: "embedded message failed validation", 8876 cause: err, 8877 } 8878 } 8879 } 8880 8881 case *RateLimit_Action_Extension: 8882 8883 if all { 8884 switch v := interface{}(m.GetExtension()).(type) { 8885 case interface{ ValidateAll() error }: 8886 if err := v.ValidateAll(); err != nil { 8887 errors = append(errors, RateLimit_ActionValidationError{ 8888 field: "Extension", 8889 reason: "embedded message failed validation", 8890 cause: err, 8891 }) 8892 } 8893 case interface{ Validate() error }: 8894 if err := v.Validate(); err != nil { 8895 errors = append(errors, RateLimit_ActionValidationError{ 8896 field: "Extension", 8897 reason: "embedded message failed validation", 8898 cause: err, 8899 }) 8900 } 8901 } 8902 } else if v, ok := interface{}(m.GetExtension()).(interface{ Validate() error }); ok { 8903 if err := v.Validate(); err != nil { 8904 return RateLimit_ActionValidationError{ 8905 field: "Extension", 8906 reason: "embedded message failed validation", 8907 cause: err, 8908 } 8909 } 8910 } 8911 8912 default: 8913 err := RateLimit_ActionValidationError{ 8914 field: "ActionSpecifier", 8915 reason: "value is required", 8916 } 8917 if !all { 8918 return err 8919 } 8920 errors = append(errors, err) 8921 8922 } 8923 8924 if len(errors) > 0 { 8925 return RateLimit_ActionMultiError(errors) 8926 } 8927 return nil 8928} 8929 8930// RateLimit_ActionMultiError is an error wrapping multiple validation errors 8931// returned by RateLimit_Action.ValidateAll() if the designated constraints 8932// aren't met. 8933type RateLimit_ActionMultiError []error 8934 8935// Error returns a concatenation of all the error messages it wraps. 8936func (m RateLimit_ActionMultiError) Error() string { 8937 var msgs []string 8938 for _, err := range m { 8939 msgs = append(msgs, err.Error()) 8940 } 8941 return strings.Join(msgs, "; ") 8942} 8943 8944// AllErrors returns a list of validation violation errors. 8945func (m RateLimit_ActionMultiError) AllErrors() []error { return m } 8946 8947// RateLimit_ActionValidationError is the validation error returned by 8948// RateLimit_Action.Validate if the designated constraints aren't met. 8949type RateLimit_ActionValidationError struct { 8950 field string 8951 reason string 8952 cause error 8953 key bool 8954} 8955 8956// Field function returns field value. 8957func (e RateLimit_ActionValidationError) Field() string { return e.field } 8958 8959// Reason function returns reason value. 8960func (e RateLimit_ActionValidationError) Reason() string { return e.reason } 8961 8962// Cause function returns cause value. 8963func (e RateLimit_ActionValidationError) Cause() error { return e.cause } 8964 8965// Key function returns key value. 8966func (e RateLimit_ActionValidationError) Key() bool { return e.key } 8967 8968// ErrorName returns error name. 8969func (e RateLimit_ActionValidationError) ErrorName() string { return "RateLimit_ActionValidationError" } 8970 8971// Error satisfies the builtin error interface 8972func (e RateLimit_ActionValidationError) Error() string { 8973 cause := "" 8974 if e.cause != nil { 8975 cause = fmt.Sprintf(" | caused by: %v", e.cause) 8976 } 8977 8978 key := "" 8979 if e.key { 8980 key = "key for " 8981 } 8982 8983 return fmt.Sprintf( 8984 "invalid %sRateLimit_Action.%s: %s%s", 8985 key, 8986 e.field, 8987 e.reason, 8988 cause) 8989} 8990 8991var _ error = RateLimit_ActionValidationError{} 8992 8993var _ interface { 8994 Field() string 8995 Reason() string 8996 Key() bool 8997 Cause() error 8998 ErrorName() string 8999} = RateLimit_ActionValidationError{} 9000 9001// Validate checks the field values on RateLimit_Override with the rules 9002// defined in the proto definition for this message. If any rules are 9003// violated, the first error encountered is returned, or nil if there are no violations. 9004func (m *RateLimit_Override) Validate() error { 9005 return m.validate(false) 9006} 9007 9008// ValidateAll checks the field values on RateLimit_Override with the rules 9009// defined in the proto definition for this message. If any rules are 9010// violated, the result is a list of violation errors wrapped in 9011// RateLimit_OverrideMultiError, or nil if none found. 9012func (m *RateLimit_Override) ValidateAll() error { 9013 return m.validate(true) 9014} 9015 9016func (m *RateLimit_Override) validate(all bool) error { 9017 if m == nil { 9018 return nil 9019 } 9020 9021 var errors []error 9022 9023 switch m.OverrideSpecifier.(type) { 9024 9025 case *RateLimit_Override_DynamicMetadata_: 9026 9027 if all { 9028 switch v := interface{}(m.GetDynamicMetadata()).(type) { 9029 case interface{ ValidateAll() error }: 9030 if err := v.ValidateAll(); err != nil { 9031 errors = append(errors, RateLimit_OverrideValidationError{ 9032 field: "DynamicMetadata", 9033 reason: "embedded message failed validation", 9034 cause: err, 9035 }) 9036 } 9037 case interface{ Validate() error }: 9038 if err := v.Validate(); err != nil { 9039 errors = append(errors, RateLimit_OverrideValidationError{ 9040 field: "DynamicMetadata", 9041 reason: "embedded message failed validation", 9042 cause: err, 9043 }) 9044 } 9045 } 9046 } else if v, ok := interface{}(m.GetDynamicMetadata()).(interface{ Validate() error }); ok { 9047 if err := v.Validate(); err != nil { 9048 return RateLimit_OverrideValidationError{ 9049 field: "DynamicMetadata", 9050 reason: "embedded message failed validation", 9051 cause: err, 9052 } 9053 } 9054 } 9055 9056 default: 9057 err := RateLimit_OverrideValidationError{ 9058 field: "OverrideSpecifier", 9059 reason: "value is required", 9060 } 9061 if !all { 9062 return err 9063 } 9064 errors = append(errors, err) 9065 9066 } 9067 9068 if len(errors) > 0 { 9069 return RateLimit_OverrideMultiError(errors) 9070 } 9071 return nil 9072} 9073 9074// RateLimit_OverrideMultiError is an error wrapping multiple validation errors 9075// returned by RateLimit_Override.ValidateAll() if the designated constraints 9076// aren't met. 9077type RateLimit_OverrideMultiError []error 9078 9079// Error returns a concatenation of all the error messages it wraps. 9080func (m RateLimit_OverrideMultiError) Error() string { 9081 var msgs []string 9082 for _, err := range m { 9083 msgs = append(msgs, err.Error()) 9084 } 9085 return strings.Join(msgs, "; ") 9086} 9087 9088// AllErrors returns a list of validation violation errors. 9089func (m RateLimit_OverrideMultiError) AllErrors() []error { return m } 9090 9091// RateLimit_OverrideValidationError is the validation error returned by 9092// RateLimit_Override.Validate if the designated constraints aren't met. 9093type RateLimit_OverrideValidationError struct { 9094 field string 9095 reason string 9096 cause error 9097 key bool 9098} 9099 9100// Field function returns field value. 9101func (e RateLimit_OverrideValidationError) Field() string { return e.field } 9102 9103// Reason function returns reason value. 9104func (e RateLimit_OverrideValidationError) Reason() string { return e.reason } 9105 9106// Cause function returns cause value. 9107func (e RateLimit_OverrideValidationError) Cause() error { return e.cause } 9108 9109// Key function returns key value. 9110func (e RateLimit_OverrideValidationError) Key() bool { return e.key } 9111 9112// ErrorName returns error name. 9113func (e RateLimit_OverrideValidationError) ErrorName() string { 9114 return "RateLimit_OverrideValidationError" 9115} 9116 9117// Error satisfies the builtin error interface 9118func (e RateLimit_OverrideValidationError) Error() string { 9119 cause := "" 9120 if e.cause != nil { 9121 cause = fmt.Sprintf(" | caused by: %v", e.cause) 9122 } 9123 9124 key := "" 9125 if e.key { 9126 key = "key for " 9127 } 9128 9129 return fmt.Sprintf( 9130 "invalid %sRateLimit_Override.%s: %s%s", 9131 key, 9132 e.field, 9133 e.reason, 9134 cause) 9135} 9136 9137var _ error = RateLimit_OverrideValidationError{} 9138 9139var _ interface { 9140 Field() string 9141 Reason() string 9142 Key() bool 9143 Cause() error 9144 ErrorName() string 9145} = RateLimit_OverrideValidationError{} 9146 9147// Validate checks the field values on RateLimit_Action_SourceCluster with the 9148// rules defined in the proto definition for this message. If any rules are 9149// violated, the first error encountered is returned, or nil if there are no violations. 9150func (m *RateLimit_Action_SourceCluster) Validate() error { 9151 return m.validate(false) 9152} 9153 9154// ValidateAll checks the field values on RateLimit_Action_SourceCluster with 9155// the rules defined in the proto definition for this message. If any rules 9156// are violated, the result is a list of violation errors wrapped in 9157// RateLimit_Action_SourceClusterMultiError, or nil if none found. 9158func (m *RateLimit_Action_SourceCluster) ValidateAll() error { 9159 return m.validate(true) 9160} 9161 9162func (m *RateLimit_Action_SourceCluster) validate(all bool) error { 9163 if m == nil { 9164 return nil 9165 } 9166 9167 var errors []error 9168 9169 if len(errors) > 0 { 9170 return RateLimit_Action_SourceClusterMultiError(errors) 9171 } 9172 return nil 9173} 9174 9175// RateLimit_Action_SourceClusterMultiError is an error wrapping multiple 9176// validation errors returned by RateLimit_Action_SourceCluster.ValidateAll() 9177// if the designated constraints aren't met. 9178type RateLimit_Action_SourceClusterMultiError []error 9179 9180// Error returns a concatenation of all the error messages it wraps. 9181func (m RateLimit_Action_SourceClusterMultiError) Error() string { 9182 var msgs []string 9183 for _, err := range m { 9184 msgs = append(msgs, err.Error()) 9185 } 9186 return strings.Join(msgs, "; ") 9187} 9188 9189// AllErrors returns a list of validation violation errors. 9190func (m RateLimit_Action_SourceClusterMultiError) AllErrors() []error { return m } 9191 9192// RateLimit_Action_SourceClusterValidationError is the validation error 9193// returned by RateLimit_Action_SourceCluster.Validate if the designated 9194// constraints aren't met. 9195type RateLimit_Action_SourceClusterValidationError struct { 9196 field string 9197 reason string 9198 cause error 9199 key bool 9200} 9201 9202// Field function returns field value. 9203func (e RateLimit_Action_SourceClusterValidationError) Field() string { return e.field } 9204 9205// Reason function returns reason value. 9206func (e RateLimit_Action_SourceClusterValidationError) Reason() string { return e.reason } 9207 9208// Cause function returns cause value. 9209func (e RateLimit_Action_SourceClusterValidationError) Cause() error { return e.cause } 9210 9211// Key function returns key value. 9212func (e RateLimit_Action_SourceClusterValidationError) Key() bool { return e.key } 9213 9214// ErrorName returns error name. 9215func (e RateLimit_Action_SourceClusterValidationError) ErrorName() string { 9216 return "RateLimit_Action_SourceClusterValidationError" 9217} 9218 9219// Error satisfies the builtin error interface 9220func (e RateLimit_Action_SourceClusterValidationError) Error() string { 9221 cause := "" 9222 if e.cause != nil { 9223 cause = fmt.Sprintf(" | caused by: %v", e.cause) 9224 } 9225 9226 key := "" 9227 if e.key { 9228 key = "key for " 9229 } 9230 9231 return fmt.Sprintf( 9232 "invalid %sRateLimit_Action_SourceCluster.%s: %s%s", 9233 key, 9234 e.field, 9235 e.reason, 9236 cause) 9237} 9238 9239var _ error = RateLimit_Action_SourceClusterValidationError{} 9240 9241var _ interface { 9242 Field() string 9243 Reason() string 9244 Key() bool 9245 Cause() error 9246 ErrorName() string 9247} = RateLimit_Action_SourceClusterValidationError{} 9248 9249// Validate checks the field values on RateLimit_Action_DestinationCluster with 9250// the rules defined in the proto definition for this message. If any rules 9251// are violated, the first error encountered is returned, or nil if there are 9252// no violations. 9253func (m *RateLimit_Action_DestinationCluster) Validate() error { 9254 return m.validate(false) 9255} 9256 9257// ValidateAll checks the field values on RateLimit_Action_DestinationCluster 9258// with the rules defined in the proto definition for this message. If any 9259// rules are violated, the result is a list of violation errors wrapped in 9260// RateLimit_Action_DestinationClusterMultiError, or nil if none found. 9261func (m *RateLimit_Action_DestinationCluster) ValidateAll() error { 9262 return m.validate(true) 9263} 9264 9265func (m *RateLimit_Action_DestinationCluster) validate(all bool) error { 9266 if m == nil { 9267 return nil 9268 } 9269 9270 var errors []error 9271 9272 if len(errors) > 0 { 9273 return RateLimit_Action_DestinationClusterMultiError(errors) 9274 } 9275 return nil 9276} 9277 9278// RateLimit_Action_DestinationClusterMultiError is an error wrapping multiple 9279// validation errors returned by 9280// RateLimit_Action_DestinationCluster.ValidateAll() if the designated 9281// constraints aren't met. 9282type RateLimit_Action_DestinationClusterMultiError []error 9283 9284// Error returns a concatenation of all the error messages it wraps. 9285func (m RateLimit_Action_DestinationClusterMultiError) Error() string { 9286 var msgs []string 9287 for _, err := range m { 9288 msgs = append(msgs, err.Error()) 9289 } 9290 return strings.Join(msgs, "; ") 9291} 9292 9293// AllErrors returns a list of validation violation errors. 9294func (m RateLimit_Action_DestinationClusterMultiError) AllErrors() []error { return m } 9295 9296// RateLimit_Action_DestinationClusterValidationError is the validation error 9297// returned by RateLimit_Action_DestinationCluster.Validate if the designated 9298// constraints aren't met. 9299type RateLimit_Action_DestinationClusterValidationError struct { 9300 field string 9301 reason string 9302 cause error 9303 key bool 9304} 9305 9306// Field function returns field value. 9307func (e RateLimit_Action_DestinationClusterValidationError) Field() string { return e.field } 9308 9309// Reason function returns reason value. 9310func (e RateLimit_Action_DestinationClusterValidationError) Reason() string { return e.reason } 9311 9312// Cause function returns cause value. 9313func (e RateLimit_Action_DestinationClusterValidationError) Cause() error { return e.cause } 9314 9315// Key function returns key value. 9316func (e RateLimit_Action_DestinationClusterValidationError) Key() bool { return e.key } 9317 9318// ErrorName returns error name. 9319func (e RateLimit_Action_DestinationClusterValidationError) ErrorName() string { 9320 return "RateLimit_Action_DestinationClusterValidationError" 9321} 9322 9323// Error satisfies the builtin error interface 9324func (e RateLimit_Action_DestinationClusterValidationError) Error() string { 9325 cause := "" 9326 if e.cause != nil { 9327 cause = fmt.Sprintf(" | caused by: %v", e.cause) 9328 } 9329 9330 key := "" 9331 if e.key { 9332 key = "key for " 9333 } 9334 9335 return fmt.Sprintf( 9336 "invalid %sRateLimit_Action_DestinationCluster.%s: %s%s", 9337 key, 9338 e.field, 9339 e.reason, 9340 cause) 9341} 9342 9343var _ error = RateLimit_Action_DestinationClusterValidationError{} 9344 9345var _ interface { 9346 Field() string 9347 Reason() string 9348 Key() bool 9349 Cause() error 9350 ErrorName() string 9351} = RateLimit_Action_DestinationClusterValidationError{} 9352 9353// Validate checks the field values on RateLimit_Action_RequestHeaders with the 9354// rules defined in the proto definition for this message. If any rules are 9355// violated, the first error encountered is returned, or nil if there are no violations. 9356func (m *RateLimit_Action_RequestHeaders) Validate() error { 9357 return m.validate(false) 9358} 9359 9360// ValidateAll checks the field values on RateLimit_Action_RequestHeaders with 9361// the rules defined in the proto definition for this message. If any rules 9362// are violated, the result is a list of violation errors wrapped in 9363// RateLimit_Action_RequestHeadersMultiError, or nil if none found. 9364func (m *RateLimit_Action_RequestHeaders) ValidateAll() error { 9365 return m.validate(true) 9366} 9367 9368func (m *RateLimit_Action_RequestHeaders) validate(all bool) error { 9369 if m == nil { 9370 return nil 9371 } 9372 9373 var errors []error 9374 9375 if utf8.RuneCountInString(m.GetHeaderName()) < 1 { 9376 err := RateLimit_Action_RequestHeadersValidationError{ 9377 field: "HeaderName", 9378 reason: "value length must be at least 1 runes", 9379 } 9380 if !all { 9381 return err 9382 } 9383 errors = append(errors, err) 9384 } 9385 9386 if !_RateLimit_Action_RequestHeaders_HeaderName_Pattern.MatchString(m.GetHeaderName()) { 9387 err := RateLimit_Action_RequestHeadersValidationError{ 9388 field: "HeaderName", 9389 reason: "value does not match regex pattern \"^[^\\x00\\n\\r]*$\"", 9390 } 9391 if !all { 9392 return err 9393 } 9394 errors = append(errors, err) 9395 } 9396 9397 if utf8.RuneCountInString(m.GetDescriptorKey()) < 1 { 9398 err := RateLimit_Action_RequestHeadersValidationError{ 9399 field: "DescriptorKey", 9400 reason: "value length must be at least 1 runes", 9401 } 9402 if !all { 9403 return err 9404 } 9405 errors = append(errors, err) 9406 } 9407 9408 // no validation rules for SkipIfAbsent 9409 9410 if len(errors) > 0 { 9411 return RateLimit_Action_RequestHeadersMultiError(errors) 9412 } 9413 return nil 9414} 9415 9416// RateLimit_Action_RequestHeadersMultiError is an error wrapping multiple 9417// validation errors returned by RateLimit_Action_RequestHeaders.ValidateAll() 9418// if the designated constraints aren't met. 9419type RateLimit_Action_RequestHeadersMultiError []error 9420 9421// Error returns a concatenation of all the error messages it wraps. 9422func (m RateLimit_Action_RequestHeadersMultiError) Error() string { 9423 var msgs []string 9424 for _, err := range m { 9425 msgs = append(msgs, err.Error()) 9426 } 9427 return strings.Join(msgs, "; ") 9428} 9429 9430// AllErrors returns a list of validation violation errors. 9431func (m RateLimit_Action_RequestHeadersMultiError) AllErrors() []error { return m } 9432 9433// RateLimit_Action_RequestHeadersValidationError is the validation error 9434// returned by RateLimit_Action_RequestHeaders.Validate if the designated 9435// constraints aren't met. 9436type RateLimit_Action_RequestHeadersValidationError struct { 9437 field string 9438 reason string 9439 cause error 9440 key bool 9441} 9442 9443// Field function returns field value. 9444func (e RateLimit_Action_RequestHeadersValidationError) Field() string { return e.field } 9445 9446// Reason function returns reason value. 9447func (e RateLimit_Action_RequestHeadersValidationError) Reason() string { return e.reason } 9448 9449// Cause function returns cause value. 9450func (e RateLimit_Action_RequestHeadersValidationError) Cause() error { return e.cause } 9451 9452// Key function returns key value. 9453func (e RateLimit_Action_RequestHeadersValidationError) Key() bool { return e.key } 9454 9455// ErrorName returns error name. 9456func (e RateLimit_Action_RequestHeadersValidationError) ErrorName() string { 9457 return "RateLimit_Action_RequestHeadersValidationError" 9458} 9459 9460// Error satisfies the builtin error interface 9461func (e RateLimit_Action_RequestHeadersValidationError) Error() string { 9462 cause := "" 9463 if e.cause != nil { 9464 cause = fmt.Sprintf(" | caused by: %v", e.cause) 9465 } 9466 9467 key := "" 9468 if e.key { 9469 key = "key for " 9470 } 9471 9472 return fmt.Sprintf( 9473 "invalid %sRateLimit_Action_RequestHeaders.%s: %s%s", 9474 key, 9475 e.field, 9476 e.reason, 9477 cause) 9478} 9479 9480var _ error = RateLimit_Action_RequestHeadersValidationError{} 9481 9482var _ interface { 9483 Field() string 9484 Reason() string 9485 Key() bool 9486 Cause() error 9487 ErrorName() string 9488} = RateLimit_Action_RequestHeadersValidationError{} 9489 9490var _RateLimit_Action_RequestHeaders_HeaderName_Pattern = regexp.MustCompile("^[^\x00\n\r]*$") 9491 9492// Validate checks the field values on RateLimit_Action_RemoteAddress with the 9493// rules defined in the proto definition for this message. If any rules are 9494// violated, the first error encountered is returned, or nil if there are no violations. 9495func (m *RateLimit_Action_RemoteAddress) Validate() error { 9496 return m.validate(false) 9497} 9498 9499// ValidateAll checks the field values on RateLimit_Action_RemoteAddress with 9500// the rules defined in the proto definition for this message. If any rules 9501// are violated, the result is a list of violation errors wrapped in 9502// RateLimit_Action_RemoteAddressMultiError, or nil if none found. 9503func (m *RateLimit_Action_RemoteAddress) ValidateAll() error { 9504 return m.validate(true) 9505} 9506 9507func (m *RateLimit_Action_RemoteAddress) validate(all bool) error { 9508 if m == nil { 9509 return nil 9510 } 9511 9512 var errors []error 9513 9514 if len(errors) > 0 { 9515 return RateLimit_Action_RemoteAddressMultiError(errors) 9516 } 9517 return nil 9518} 9519 9520// RateLimit_Action_RemoteAddressMultiError is an error wrapping multiple 9521// validation errors returned by RateLimit_Action_RemoteAddress.ValidateAll() 9522// if the designated constraints aren't met. 9523type RateLimit_Action_RemoteAddressMultiError []error 9524 9525// Error returns a concatenation of all the error messages it wraps. 9526func (m RateLimit_Action_RemoteAddressMultiError) Error() string { 9527 var msgs []string 9528 for _, err := range m { 9529 msgs = append(msgs, err.Error()) 9530 } 9531 return strings.Join(msgs, "; ") 9532} 9533 9534// AllErrors returns a list of validation violation errors. 9535func (m RateLimit_Action_RemoteAddressMultiError) AllErrors() []error { return m } 9536 9537// RateLimit_Action_RemoteAddressValidationError is the validation error 9538// returned by RateLimit_Action_RemoteAddress.Validate if the designated 9539// constraints aren't met. 9540type RateLimit_Action_RemoteAddressValidationError struct { 9541 field string 9542 reason string 9543 cause error 9544 key bool 9545} 9546 9547// Field function returns field value. 9548func (e RateLimit_Action_RemoteAddressValidationError) Field() string { return e.field } 9549 9550// Reason function returns reason value. 9551func (e RateLimit_Action_RemoteAddressValidationError) Reason() string { return e.reason } 9552 9553// Cause function returns cause value. 9554func (e RateLimit_Action_RemoteAddressValidationError) Cause() error { return e.cause } 9555 9556// Key function returns key value. 9557func (e RateLimit_Action_RemoteAddressValidationError) Key() bool { return e.key } 9558 9559// ErrorName returns error name. 9560func (e RateLimit_Action_RemoteAddressValidationError) ErrorName() string { 9561 return "RateLimit_Action_RemoteAddressValidationError" 9562} 9563 9564// Error satisfies the builtin error interface 9565func (e RateLimit_Action_RemoteAddressValidationError) Error() string { 9566 cause := "" 9567 if e.cause != nil { 9568 cause = fmt.Sprintf(" | caused by: %v", e.cause) 9569 } 9570 9571 key := "" 9572 if e.key { 9573 key = "key for " 9574 } 9575 9576 return fmt.Sprintf( 9577 "invalid %sRateLimit_Action_RemoteAddress.%s: %s%s", 9578 key, 9579 e.field, 9580 e.reason, 9581 cause) 9582} 9583 9584var _ error = RateLimit_Action_RemoteAddressValidationError{} 9585 9586var _ interface { 9587 Field() string 9588 Reason() string 9589 Key() bool 9590 Cause() error 9591 ErrorName() string 9592} = RateLimit_Action_RemoteAddressValidationError{} 9593 9594// Validate checks the field values on RateLimit_Action_GenericKey with the 9595// rules defined in the proto definition for this message. If any rules are 9596// violated, the first error encountered is returned, or nil if there are no violations. 9597func (m *RateLimit_Action_GenericKey) Validate() error { 9598 return m.validate(false) 9599} 9600 9601// ValidateAll checks the field values on RateLimit_Action_GenericKey with the 9602// rules defined in the proto definition for this message. If any rules are 9603// violated, the result is a list of violation errors wrapped in 9604// RateLimit_Action_GenericKeyMultiError, or nil if none found. 9605func (m *RateLimit_Action_GenericKey) ValidateAll() error { 9606 return m.validate(true) 9607} 9608 9609func (m *RateLimit_Action_GenericKey) validate(all bool) error { 9610 if m == nil { 9611 return nil 9612 } 9613 9614 var errors []error 9615 9616 if utf8.RuneCountInString(m.GetDescriptorValue()) < 1 { 9617 err := RateLimit_Action_GenericKeyValidationError{ 9618 field: "DescriptorValue", 9619 reason: "value length must be at least 1 runes", 9620 } 9621 if !all { 9622 return err 9623 } 9624 errors = append(errors, err) 9625 } 9626 9627 // no validation rules for DescriptorKey 9628 9629 if len(errors) > 0 { 9630 return RateLimit_Action_GenericKeyMultiError(errors) 9631 } 9632 return nil 9633} 9634 9635// RateLimit_Action_GenericKeyMultiError is an error wrapping multiple 9636// validation errors returned by RateLimit_Action_GenericKey.ValidateAll() if 9637// the designated constraints aren't met. 9638type RateLimit_Action_GenericKeyMultiError []error 9639 9640// Error returns a concatenation of all the error messages it wraps. 9641func (m RateLimit_Action_GenericKeyMultiError) Error() string { 9642 var msgs []string 9643 for _, err := range m { 9644 msgs = append(msgs, err.Error()) 9645 } 9646 return strings.Join(msgs, "; ") 9647} 9648 9649// AllErrors returns a list of validation violation errors. 9650func (m RateLimit_Action_GenericKeyMultiError) AllErrors() []error { return m } 9651 9652// RateLimit_Action_GenericKeyValidationError is the validation error returned 9653// by RateLimit_Action_GenericKey.Validate if the designated constraints 9654// aren't met. 9655type RateLimit_Action_GenericKeyValidationError struct { 9656 field string 9657 reason string 9658 cause error 9659 key bool 9660} 9661 9662// Field function returns field value. 9663func (e RateLimit_Action_GenericKeyValidationError) Field() string { return e.field } 9664 9665// Reason function returns reason value. 9666func (e RateLimit_Action_GenericKeyValidationError) Reason() string { return e.reason } 9667 9668// Cause function returns cause value. 9669func (e RateLimit_Action_GenericKeyValidationError) Cause() error { return e.cause } 9670 9671// Key function returns key value. 9672func (e RateLimit_Action_GenericKeyValidationError) Key() bool { return e.key } 9673 9674// ErrorName returns error name. 9675func (e RateLimit_Action_GenericKeyValidationError) ErrorName() string { 9676 return "RateLimit_Action_GenericKeyValidationError" 9677} 9678 9679// Error satisfies the builtin error interface 9680func (e RateLimit_Action_GenericKeyValidationError) Error() string { 9681 cause := "" 9682 if e.cause != nil { 9683 cause = fmt.Sprintf(" | caused by: %v", e.cause) 9684 } 9685 9686 key := "" 9687 if e.key { 9688 key = "key for " 9689 } 9690 9691 return fmt.Sprintf( 9692 "invalid %sRateLimit_Action_GenericKey.%s: %s%s", 9693 key, 9694 e.field, 9695 e.reason, 9696 cause) 9697} 9698 9699var _ error = RateLimit_Action_GenericKeyValidationError{} 9700 9701var _ interface { 9702 Field() string 9703 Reason() string 9704 Key() bool 9705 Cause() error 9706 ErrorName() string 9707} = RateLimit_Action_GenericKeyValidationError{} 9708 9709// Validate checks the field values on RateLimit_Action_HeaderValueMatch with 9710// the rules defined in the proto definition for this message. If any rules 9711// are violated, the first error encountered is returned, or nil if there are 9712// no violations. 9713func (m *RateLimit_Action_HeaderValueMatch) Validate() error { 9714 return m.validate(false) 9715} 9716 9717// ValidateAll checks the field values on RateLimit_Action_HeaderValueMatch 9718// with the rules defined in the proto definition for this message. If any 9719// rules are violated, the result is a list of violation errors wrapped in 9720// RateLimit_Action_HeaderValueMatchMultiError, or nil if none found. 9721func (m *RateLimit_Action_HeaderValueMatch) ValidateAll() error { 9722 return m.validate(true) 9723} 9724 9725func (m *RateLimit_Action_HeaderValueMatch) validate(all bool) error { 9726 if m == nil { 9727 return nil 9728 } 9729 9730 var errors []error 9731 9732 if utf8.RuneCountInString(m.GetDescriptorValue()) < 1 { 9733 err := RateLimit_Action_HeaderValueMatchValidationError{ 9734 field: "DescriptorValue", 9735 reason: "value length must be at least 1 runes", 9736 } 9737 if !all { 9738 return err 9739 } 9740 errors = append(errors, err) 9741 } 9742 9743 if all { 9744 switch v := interface{}(m.GetExpectMatch()).(type) { 9745 case interface{ ValidateAll() error }: 9746 if err := v.ValidateAll(); err != nil { 9747 errors = append(errors, RateLimit_Action_HeaderValueMatchValidationError{ 9748 field: "ExpectMatch", 9749 reason: "embedded message failed validation", 9750 cause: err, 9751 }) 9752 } 9753 case interface{ Validate() error }: 9754 if err := v.Validate(); err != nil { 9755 errors = append(errors, RateLimit_Action_HeaderValueMatchValidationError{ 9756 field: "ExpectMatch", 9757 reason: "embedded message failed validation", 9758 cause: err, 9759 }) 9760 } 9761 } 9762 } else if v, ok := interface{}(m.GetExpectMatch()).(interface{ Validate() error }); ok { 9763 if err := v.Validate(); err != nil { 9764 return RateLimit_Action_HeaderValueMatchValidationError{ 9765 field: "ExpectMatch", 9766 reason: "embedded message failed validation", 9767 cause: err, 9768 } 9769 } 9770 } 9771 9772 if len(m.GetHeaders()) < 1 { 9773 err := RateLimit_Action_HeaderValueMatchValidationError{ 9774 field: "Headers", 9775 reason: "value must contain at least 1 item(s)", 9776 } 9777 if !all { 9778 return err 9779 } 9780 errors = append(errors, err) 9781 } 9782 9783 for idx, item := range m.GetHeaders() { 9784 _, _ = idx, item 9785 9786 if all { 9787 switch v := interface{}(item).(type) { 9788 case interface{ ValidateAll() error }: 9789 if err := v.ValidateAll(); err != nil { 9790 errors = append(errors, RateLimit_Action_HeaderValueMatchValidationError{ 9791 field: fmt.Sprintf("Headers[%v]", idx), 9792 reason: "embedded message failed validation", 9793 cause: err, 9794 }) 9795 } 9796 case interface{ Validate() error }: 9797 if err := v.Validate(); err != nil { 9798 errors = append(errors, RateLimit_Action_HeaderValueMatchValidationError{ 9799 field: fmt.Sprintf("Headers[%v]", idx), 9800 reason: "embedded message failed validation", 9801 cause: err, 9802 }) 9803 } 9804 } 9805 } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { 9806 if err := v.Validate(); err != nil { 9807 return RateLimit_Action_HeaderValueMatchValidationError{ 9808 field: fmt.Sprintf("Headers[%v]", idx), 9809 reason: "embedded message failed validation", 9810 cause: err, 9811 } 9812 } 9813 } 9814 9815 } 9816 9817 if len(errors) > 0 { 9818 return RateLimit_Action_HeaderValueMatchMultiError(errors) 9819 } 9820 return nil 9821} 9822 9823// RateLimit_Action_HeaderValueMatchMultiError is an error wrapping multiple 9824// validation errors returned by 9825// RateLimit_Action_HeaderValueMatch.ValidateAll() if the designated 9826// constraints aren't met. 9827type RateLimit_Action_HeaderValueMatchMultiError []error 9828 9829// Error returns a concatenation of all the error messages it wraps. 9830func (m RateLimit_Action_HeaderValueMatchMultiError) Error() string { 9831 var msgs []string 9832 for _, err := range m { 9833 msgs = append(msgs, err.Error()) 9834 } 9835 return strings.Join(msgs, "; ") 9836} 9837 9838// AllErrors returns a list of validation violation errors. 9839func (m RateLimit_Action_HeaderValueMatchMultiError) AllErrors() []error { return m } 9840 9841// RateLimit_Action_HeaderValueMatchValidationError is the validation error 9842// returned by RateLimit_Action_HeaderValueMatch.Validate if the designated 9843// constraints aren't met. 9844type RateLimit_Action_HeaderValueMatchValidationError struct { 9845 field string 9846 reason string 9847 cause error 9848 key bool 9849} 9850 9851// Field function returns field value. 9852func (e RateLimit_Action_HeaderValueMatchValidationError) Field() string { return e.field } 9853 9854// Reason function returns reason value. 9855func (e RateLimit_Action_HeaderValueMatchValidationError) Reason() string { return e.reason } 9856 9857// Cause function returns cause value. 9858func (e RateLimit_Action_HeaderValueMatchValidationError) Cause() error { return e.cause } 9859 9860// Key function returns key value. 9861func (e RateLimit_Action_HeaderValueMatchValidationError) Key() bool { return e.key } 9862 9863// ErrorName returns error name. 9864func (e RateLimit_Action_HeaderValueMatchValidationError) ErrorName() string { 9865 return "RateLimit_Action_HeaderValueMatchValidationError" 9866} 9867 9868// Error satisfies the builtin error interface 9869func (e RateLimit_Action_HeaderValueMatchValidationError) Error() string { 9870 cause := "" 9871 if e.cause != nil { 9872 cause = fmt.Sprintf(" | caused by: %v", e.cause) 9873 } 9874 9875 key := "" 9876 if e.key { 9877 key = "key for " 9878 } 9879 9880 return fmt.Sprintf( 9881 "invalid %sRateLimit_Action_HeaderValueMatch.%s: %s%s", 9882 key, 9883 e.field, 9884 e.reason, 9885 cause) 9886} 9887 9888var _ error = RateLimit_Action_HeaderValueMatchValidationError{} 9889 9890var _ interface { 9891 Field() string 9892 Reason() string 9893 Key() bool 9894 Cause() error 9895 ErrorName() string 9896} = RateLimit_Action_HeaderValueMatchValidationError{} 9897 9898// Validate checks the field values on RateLimit_Action_DynamicMetaData with 9899// the rules defined in the proto definition for this message. If any rules 9900// are violated, the first error encountered is returned, or nil if there are 9901// no violations. 9902func (m *RateLimit_Action_DynamicMetaData) Validate() error { 9903 return m.validate(false) 9904} 9905 9906// ValidateAll checks the field values on RateLimit_Action_DynamicMetaData with 9907// the rules defined in the proto definition for this message. If any rules 9908// are violated, the result is a list of violation errors wrapped in 9909// RateLimit_Action_DynamicMetaDataMultiError, or nil if none found. 9910func (m *RateLimit_Action_DynamicMetaData) ValidateAll() error { 9911 return m.validate(true) 9912} 9913 9914func (m *RateLimit_Action_DynamicMetaData) validate(all bool) error { 9915 if m == nil { 9916 return nil 9917 } 9918 9919 var errors []error 9920 9921 if utf8.RuneCountInString(m.GetDescriptorKey()) < 1 { 9922 err := RateLimit_Action_DynamicMetaDataValidationError{ 9923 field: "DescriptorKey", 9924 reason: "value length must be at least 1 runes", 9925 } 9926 if !all { 9927 return err 9928 } 9929 errors = append(errors, err) 9930 } 9931 9932 if m.GetMetadataKey() == nil { 9933 err := RateLimit_Action_DynamicMetaDataValidationError{ 9934 field: "MetadataKey", 9935 reason: "value is required", 9936 } 9937 if !all { 9938 return err 9939 } 9940 errors = append(errors, err) 9941 } 9942 9943 if all { 9944 switch v := interface{}(m.GetMetadataKey()).(type) { 9945 case interface{ ValidateAll() error }: 9946 if err := v.ValidateAll(); err != nil { 9947 errors = append(errors, RateLimit_Action_DynamicMetaDataValidationError{ 9948 field: "MetadataKey", 9949 reason: "embedded message failed validation", 9950 cause: err, 9951 }) 9952 } 9953 case interface{ Validate() error }: 9954 if err := v.Validate(); err != nil { 9955 errors = append(errors, RateLimit_Action_DynamicMetaDataValidationError{ 9956 field: "MetadataKey", 9957 reason: "embedded message failed validation", 9958 cause: err, 9959 }) 9960 } 9961 } 9962 } else if v, ok := interface{}(m.GetMetadataKey()).(interface{ Validate() error }); ok { 9963 if err := v.Validate(); err != nil { 9964 return RateLimit_Action_DynamicMetaDataValidationError{ 9965 field: "MetadataKey", 9966 reason: "embedded message failed validation", 9967 cause: err, 9968 } 9969 } 9970 } 9971 9972 // no validation rules for DefaultValue 9973 9974 if len(errors) > 0 { 9975 return RateLimit_Action_DynamicMetaDataMultiError(errors) 9976 } 9977 return nil 9978} 9979 9980// RateLimit_Action_DynamicMetaDataMultiError is an error wrapping multiple 9981// validation errors returned by 9982// RateLimit_Action_DynamicMetaData.ValidateAll() if the designated 9983// constraints aren't met. 9984type RateLimit_Action_DynamicMetaDataMultiError []error 9985 9986// Error returns a concatenation of all the error messages it wraps. 9987func (m RateLimit_Action_DynamicMetaDataMultiError) Error() string { 9988 var msgs []string 9989 for _, err := range m { 9990 msgs = append(msgs, err.Error()) 9991 } 9992 return strings.Join(msgs, "; ") 9993} 9994 9995// AllErrors returns a list of validation violation errors. 9996func (m RateLimit_Action_DynamicMetaDataMultiError) AllErrors() []error { return m } 9997 9998// RateLimit_Action_DynamicMetaDataValidationError is the validation error 9999// returned by RateLimit_Action_DynamicMetaData.Validate if the designated 10000// constraints aren't met. 10001type RateLimit_Action_DynamicMetaDataValidationError struct { 10002 field string 10003 reason string 10004 cause error 10005 key bool 10006} 10007 10008// Field function returns field value. 10009func (e RateLimit_Action_DynamicMetaDataValidationError) Field() string { return e.field } 10010 10011// Reason function returns reason value. 10012func (e RateLimit_Action_DynamicMetaDataValidationError) Reason() string { return e.reason } 10013 10014// Cause function returns cause value. 10015func (e RateLimit_Action_DynamicMetaDataValidationError) Cause() error { return e.cause } 10016 10017// Key function returns key value. 10018func (e RateLimit_Action_DynamicMetaDataValidationError) Key() bool { return e.key } 10019 10020// ErrorName returns error name. 10021func (e RateLimit_Action_DynamicMetaDataValidationError) ErrorName() string { 10022 return "RateLimit_Action_DynamicMetaDataValidationError" 10023} 10024 10025// Error satisfies the builtin error interface 10026func (e RateLimit_Action_DynamicMetaDataValidationError) Error() string { 10027 cause := "" 10028 if e.cause != nil { 10029 cause = fmt.Sprintf(" | caused by: %v", e.cause) 10030 } 10031 10032 key := "" 10033 if e.key { 10034 key = "key for " 10035 } 10036 10037 return fmt.Sprintf( 10038 "invalid %sRateLimit_Action_DynamicMetaData.%s: %s%s", 10039 key, 10040 e.field, 10041 e.reason, 10042 cause) 10043} 10044 10045var _ error = RateLimit_Action_DynamicMetaDataValidationError{} 10046 10047var _ interface { 10048 Field() string 10049 Reason() string 10050 Key() bool 10051 Cause() error 10052 ErrorName() string 10053} = RateLimit_Action_DynamicMetaDataValidationError{} 10054 10055// Validate checks the field values on RateLimit_Action_MetaData with the rules 10056// defined in the proto definition for this message. If any rules are 10057// violated, the first error encountered is returned, or nil if there are no violations. 10058func (m *RateLimit_Action_MetaData) Validate() error { 10059 return m.validate(false) 10060} 10061 10062// ValidateAll checks the field values on RateLimit_Action_MetaData with the 10063// rules defined in the proto definition for this message. If any rules are 10064// violated, the result is a list of violation errors wrapped in 10065// RateLimit_Action_MetaDataMultiError, or nil if none found. 10066func (m *RateLimit_Action_MetaData) ValidateAll() error { 10067 return m.validate(true) 10068} 10069 10070func (m *RateLimit_Action_MetaData) validate(all bool) error { 10071 if m == nil { 10072 return nil 10073 } 10074 10075 var errors []error 10076 10077 if utf8.RuneCountInString(m.GetDescriptorKey()) < 1 { 10078 err := RateLimit_Action_MetaDataValidationError{ 10079 field: "DescriptorKey", 10080 reason: "value length must be at least 1 runes", 10081 } 10082 if !all { 10083 return err 10084 } 10085 errors = append(errors, err) 10086 } 10087 10088 if m.GetMetadataKey() == nil { 10089 err := RateLimit_Action_MetaDataValidationError{ 10090 field: "MetadataKey", 10091 reason: "value is required", 10092 } 10093 if !all { 10094 return err 10095 } 10096 errors = append(errors, err) 10097 } 10098 10099 if all { 10100 switch v := interface{}(m.GetMetadataKey()).(type) { 10101 case interface{ ValidateAll() error }: 10102 if err := v.ValidateAll(); err != nil { 10103 errors = append(errors, RateLimit_Action_MetaDataValidationError{ 10104 field: "MetadataKey", 10105 reason: "embedded message failed validation", 10106 cause: err, 10107 }) 10108 } 10109 case interface{ Validate() error }: 10110 if err := v.Validate(); err != nil { 10111 errors = append(errors, RateLimit_Action_MetaDataValidationError{ 10112 field: "MetadataKey", 10113 reason: "embedded message failed validation", 10114 cause: err, 10115 }) 10116 } 10117 } 10118 } else if v, ok := interface{}(m.GetMetadataKey()).(interface{ Validate() error }); ok { 10119 if err := v.Validate(); err != nil { 10120 return RateLimit_Action_MetaDataValidationError{ 10121 field: "MetadataKey", 10122 reason: "embedded message failed validation", 10123 cause: err, 10124 } 10125 } 10126 } 10127 10128 // no validation rules for DefaultValue 10129 10130 if _, ok := RateLimit_Action_MetaData_Source_name[int32(m.GetSource())]; !ok { 10131 err := RateLimit_Action_MetaDataValidationError{ 10132 field: "Source", 10133 reason: "value must be one of the defined enum values", 10134 } 10135 if !all { 10136 return err 10137 } 10138 errors = append(errors, err) 10139 } 10140 10141 if len(errors) > 0 { 10142 return RateLimit_Action_MetaDataMultiError(errors) 10143 } 10144 return nil 10145} 10146 10147// RateLimit_Action_MetaDataMultiError is an error wrapping multiple validation 10148// errors returned by RateLimit_Action_MetaData.ValidateAll() if the 10149// designated constraints aren't met. 10150type RateLimit_Action_MetaDataMultiError []error 10151 10152// Error returns a concatenation of all the error messages it wraps. 10153func (m RateLimit_Action_MetaDataMultiError) Error() string { 10154 var msgs []string 10155 for _, err := range m { 10156 msgs = append(msgs, err.Error()) 10157 } 10158 return strings.Join(msgs, "; ") 10159} 10160 10161// AllErrors returns a list of validation violation errors. 10162func (m RateLimit_Action_MetaDataMultiError) AllErrors() []error { return m } 10163 10164// RateLimit_Action_MetaDataValidationError is the validation error returned by 10165// RateLimit_Action_MetaData.Validate if the designated constraints aren't met. 10166type RateLimit_Action_MetaDataValidationError struct { 10167 field string 10168 reason string 10169 cause error 10170 key bool 10171} 10172 10173// Field function returns field value. 10174func (e RateLimit_Action_MetaDataValidationError) Field() string { return e.field } 10175 10176// Reason function returns reason value. 10177func (e RateLimit_Action_MetaDataValidationError) Reason() string { return e.reason } 10178 10179// Cause function returns cause value. 10180func (e RateLimit_Action_MetaDataValidationError) Cause() error { return e.cause } 10181 10182// Key function returns key value. 10183func (e RateLimit_Action_MetaDataValidationError) Key() bool { return e.key } 10184 10185// ErrorName returns error name. 10186func (e RateLimit_Action_MetaDataValidationError) ErrorName() string { 10187 return "RateLimit_Action_MetaDataValidationError" 10188} 10189 10190// Error satisfies the builtin error interface 10191func (e RateLimit_Action_MetaDataValidationError) Error() string { 10192 cause := "" 10193 if e.cause != nil { 10194 cause = fmt.Sprintf(" | caused by: %v", e.cause) 10195 } 10196 10197 key := "" 10198 if e.key { 10199 key = "key for " 10200 } 10201 10202 return fmt.Sprintf( 10203 "invalid %sRateLimit_Action_MetaData.%s: %s%s", 10204 key, 10205 e.field, 10206 e.reason, 10207 cause) 10208} 10209 10210var _ error = RateLimit_Action_MetaDataValidationError{} 10211 10212var _ interface { 10213 Field() string 10214 Reason() string 10215 Key() bool 10216 Cause() error 10217 ErrorName() string 10218} = RateLimit_Action_MetaDataValidationError{} 10219 10220// Validate checks the field values on RateLimit_Override_DynamicMetadata with 10221// the rules defined in the proto definition for this message. If any rules 10222// are violated, the first error encountered is returned, or nil if there are 10223// no violations. 10224func (m *RateLimit_Override_DynamicMetadata) Validate() error { 10225 return m.validate(false) 10226} 10227 10228// ValidateAll checks the field values on RateLimit_Override_DynamicMetadata 10229// with the rules defined in the proto definition for this message. If any 10230// rules are violated, the result is a list of violation errors wrapped in 10231// RateLimit_Override_DynamicMetadataMultiError, or nil if none found. 10232func (m *RateLimit_Override_DynamicMetadata) ValidateAll() error { 10233 return m.validate(true) 10234} 10235 10236func (m *RateLimit_Override_DynamicMetadata) validate(all bool) error { 10237 if m == nil { 10238 return nil 10239 } 10240 10241 var errors []error 10242 10243 if m.GetMetadataKey() == nil { 10244 err := RateLimit_Override_DynamicMetadataValidationError{ 10245 field: "MetadataKey", 10246 reason: "value is required", 10247 } 10248 if !all { 10249 return err 10250 } 10251 errors = append(errors, err) 10252 } 10253 10254 if all { 10255 switch v := interface{}(m.GetMetadataKey()).(type) { 10256 case interface{ ValidateAll() error }: 10257 if err := v.ValidateAll(); err != nil { 10258 errors = append(errors, RateLimit_Override_DynamicMetadataValidationError{ 10259 field: "MetadataKey", 10260 reason: "embedded message failed validation", 10261 cause: err, 10262 }) 10263 } 10264 case interface{ Validate() error }: 10265 if err := v.Validate(); err != nil { 10266 errors = append(errors, RateLimit_Override_DynamicMetadataValidationError{ 10267 field: "MetadataKey", 10268 reason: "embedded message failed validation", 10269 cause: err, 10270 }) 10271 } 10272 } 10273 } else if v, ok := interface{}(m.GetMetadataKey()).(interface{ Validate() error }); ok { 10274 if err := v.Validate(); err != nil { 10275 return RateLimit_Override_DynamicMetadataValidationError{ 10276 field: "MetadataKey", 10277 reason: "embedded message failed validation", 10278 cause: err, 10279 } 10280 } 10281 } 10282 10283 if len(errors) > 0 { 10284 return RateLimit_Override_DynamicMetadataMultiError(errors) 10285 } 10286 return nil 10287} 10288 10289// RateLimit_Override_DynamicMetadataMultiError is an error wrapping multiple 10290// validation errors returned by 10291// RateLimit_Override_DynamicMetadata.ValidateAll() if the designated 10292// constraints aren't met. 10293type RateLimit_Override_DynamicMetadataMultiError []error 10294 10295// Error returns a concatenation of all the error messages it wraps. 10296func (m RateLimit_Override_DynamicMetadataMultiError) Error() string { 10297 var msgs []string 10298 for _, err := range m { 10299 msgs = append(msgs, err.Error()) 10300 } 10301 return strings.Join(msgs, "; ") 10302} 10303 10304// AllErrors returns a list of validation violation errors. 10305func (m RateLimit_Override_DynamicMetadataMultiError) AllErrors() []error { return m } 10306 10307// RateLimit_Override_DynamicMetadataValidationError is the validation error 10308// returned by RateLimit_Override_DynamicMetadata.Validate if the designated 10309// constraints aren't met. 10310type RateLimit_Override_DynamicMetadataValidationError struct { 10311 field string 10312 reason string 10313 cause error 10314 key bool 10315} 10316 10317// Field function returns field value. 10318func (e RateLimit_Override_DynamicMetadataValidationError) Field() string { return e.field } 10319 10320// Reason function returns reason value. 10321func (e RateLimit_Override_DynamicMetadataValidationError) Reason() string { return e.reason } 10322 10323// Cause function returns cause value. 10324func (e RateLimit_Override_DynamicMetadataValidationError) Cause() error { return e.cause } 10325 10326// Key function returns key value. 10327func (e RateLimit_Override_DynamicMetadataValidationError) Key() bool { return e.key } 10328 10329// ErrorName returns error name. 10330func (e RateLimit_Override_DynamicMetadataValidationError) ErrorName() string { 10331 return "RateLimit_Override_DynamicMetadataValidationError" 10332} 10333 10334// Error satisfies the builtin error interface 10335func (e RateLimit_Override_DynamicMetadataValidationError) Error() string { 10336 cause := "" 10337 if e.cause != nil { 10338 cause = fmt.Sprintf(" | caused by: %v", e.cause) 10339 } 10340 10341 key := "" 10342 if e.key { 10343 key = "key for " 10344 } 10345 10346 return fmt.Sprintf( 10347 "invalid %sRateLimit_Override_DynamicMetadata.%s: %s%s", 10348 key, 10349 e.field, 10350 e.reason, 10351 cause) 10352} 10353 10354var _ error = RateLimit_Override_DynamicMetadataValidationError{} 10355 10356var _ interface { 10357 Field() string 10358 Reason() string 10359 Key() bool 10360 Cause() error 10361 ErrorName() string 10362} = RateLimit_Override_DynamicMetadataValidationError{} 10363