1// Code generated by protoc-gen-validate. DO NOT EDIT. 2// source: envoy/config/endpoint/v3/endpoint_components.proto 3 4package envoy_config_endpoint_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.HealthStatus(0) 40) 41 42// Validate checks the field values on Endpoint with the rules defined in the 43// 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 *Endpoint) Validate() error { 46 return m.validate(false) 47} 48 49// ValidateAll checks the field values on Endpoint 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 EndpointMultiError, or nil 52// if none found. 53func (m *Endpoint) ValidateAll() error { 54 return m.validate(true) 55} 56 57func (m *Endpoint) validate(all bool) error { 58 if m == nil { 59 return nil 60 } 61 62 var errors []error 63 64 if all { 65 switch v := interface{}(m.GetAddress()).(type) { 66 case interface{ ValidateAll() error }: 67 if err := v.ValidateAll(); err != nil { 68 errors = append(errors, EndpointValidationError{ 69 field: "Address", 70 reason: "embedded message failed validation", 71 cause: err, 72 }) 73 } 74 case interface{ Validate() error }: 75 if err := v.Validate(); err != nil { 76 errors = append(errors, EndpointValidationError{ 77 field: "Address", 78 reason: "embedded message failed validation", 79 cause: err, 80 }) 81 } 82 } 83 } else if v, ok := interface{}(m.GetAddress()).(interface{ Validate() error }); ok { 84 if err := v.Validate(); err != nil { 85 return EndpointValidationError{ 86 field: "Address", 87 reason: "embedded message failed validation", 88 cause: err, 89 } 90 } 91 } 92 93 if all { 94 switch v := interface{}(m.GetHealthCheckConfig()).(type) { 95 case interface{ ValidateAll() error }: 96 if err := v.ValidateAll(); err != nil { 97 errors = append(errors, EndpointValidationError{ 98 field: "HealthCheckConfig", 99 reason: "embedded message failed validation", 100 cause: err, 101 }) 102 } 103 case interface{ Validate() error }: 104 if err := v.Validate(); err != nil { 105 errors = append(errors, EndpointValidationError{ 106 field: "HealthCheckConfig", 107 reason: "embedded message failed validation", 108 cause: err, 109 }) 110 } 111 } 112 } else if v, ok := interface{}(m.GetHealthCheckConfig()).(interface{ Validate() error }); ok { 113 if err := v.Validate(); err != nil { 114 return EndpointValidationError{ 115 field: "HealthCheckConfig", 116 reason: "embedded message failed validation", 117 cause: err, 118 } 119 } 120 } 121 122 // no validation rules for Hostname 123 124 if len(errors) > 0 { 125 return EndpointMultiError(errors) 126 } 127 return nil 128} 129 130// EndpointMultiError is an error wrapping multiple validation errors returned 131// by Endpoint.ValidateAll() if the designated constraints aren't met. 132type EndpointMultiError []error 133 134// Error returns a concatenation of all the error messages it wraps. 135func (m EndpointMultiError) Error() string { 136 var msgs []string 137 for _, err := range m { 138 msgs = append(msgs, err.Error()) 139 } 140 return strings.Join(msgs, "; ") 141} 142 143// AllErrors returns a list of validation violation errors. 144func (m EndpointMultiError) AllErrors() []error { return m } 145 146// EndpointValidationError is the validation error returned by 147// Endpoint.Validate if the designated constraints aren't met. 148type EndpointValidationError struct { 149 field string 150 reason string 151 cause error 152 key bool 153} 154 155// Field function returns field value. 156func (e EndpointValidationError) Field() string { return e.field } 157 158// Reason function returns reason value. 159func (e EndpointValidationError) Reason() string { return e.reason } 160 161// Cause function returns cause value. 162func (e EndpointValidationError) Cause() error { return e.cause } 163 164// Key function returns key value. 165func (e EndpointValidationError) Key() bool { return e.key } 166 167// ErrorName returns error name. 168func (e EndpointValidationError) ErrorName() string { return "EndpointValidationError" } 169 170// Error satisfies the builtin error interface 171func (e EndpointValidationError) Error() string { 172 cause := "" 173 if e.cause != nil { 174 cause = fmt.Sprintf(" | caused by: %v", e.cause) 175 } 176 177 key := "" 178 if e.key { 179 key = "key for " 180 } 181 182 return fmt.Sprintf( 183 "invalid %sEndpoint.%s: %s%s", 184 key, 185 e.field, 186 e.reason, 187 cause) 188} 189 190var _ error = EndpointValidationError{} 191 192var _ interface { 193 Field() string 194 Reason() string 195 Key() bool 196 Cause() error 197 ErrorName() string 198} = EndpointValidationError{} 199 200// Validate checks the field values on LbEndpoint with the rules defined in the 201// proto definition for this message. If any rules are violated, the first 202// error encountered is returned, or nil if there are no violations. 203func (m *LbEndpoint) Validate() error { 204 return m.validate(false) 205} 206 207// ValidateAll checks the field values on LbEndpoint with the rules defined in 208// the proto definition for this message. If any rules are violated, the 209// result is a list of violation errors wrapped in LbEndpointMultiError, or 210// nil if none found. 211func (m *LbEndpoint) ValidateAll() error { 212 return m.validate(true) 213} 214 215func (m *LbEndpoint) validate(all bool) error { 216 if m == nil { 217 return nil 218 } 219 220 var errors []error 221 222 // no validation rules for HealthStatus 223 224 if all { 225 switch v := interface{}(m.GetMetadata()).(type) { 226 case interface{ ValidateAll() error }: 227 if err := v.ValidateAll(); err != nil { 228 errors = append(errors, LbEndpointValidationError{ 229 field: "Metadata", 230 reason: "embedded message failed validation", 231 cause: err, 232 }) 233 } 234 case interface{ Validate() error }: 235 if err := v.Validate(); err != nil { 236 errors = append(errors, LbEndpointValidationError{ 237 field: "Metadata", 238 reason: "embedded message failed validation", 239 cause: err, 240 }) 241 } 242 } 243 } else if v, ok := interface{}(m.GetMetadata()).(interface{ Validate() error }); ok { 244 if err := v.Validate(); err != nil { 245 return LbEndpointValidationError{ 246 field: "Metadata", 247 reason: "embedded message failed validation", 248 cause: err, 249 } 250 } 251 } 252 253 if wrapper := m.GetLoadBalancingWeight(); wrapper != nil { 254 255 if wrapper.GetValue() < 1 { 256 err := LbEndpointValidationError{ 257 field: "LoadBalancingWeight", 258 reason: "value must be greater than or equal to 1", 259 } 260 if !all { 261 return err 262 } 263 errors = append(errors, err) 264 } 265 266 } 267 268 switch m.HostIdentifier.(type) { 269 270 case *LbEndpoint_Endpoint: 271 272 if all { 273 switch v := interface{}(m.GetEndpoint()).(type) { 274 case interface{ ValidateAll() error }: 275 if err := v.ValidateAll(); err != nil { 276 errors = append(errors, LbEndpointValidationError{ 277 field: "Endpoint", 278 reason: "embedded message failed validation", 279 cause: err, 280 }) 281 } 282 case interface{ Validate() error }: 283 if err := v.Validate(); err != nil { 284 errors = append(errors, LbEndpointValidationError{ 285 field: "Endpoint", 286 reason: "embedded message failed validation", 287 cause: err, 288 }) 289 } 290 } 291 } else if v, ok := interface{}(m.GetEndpoint()).(interface{ Validate() error }); ok { 292 if err := v.Validate(); err != nil { 293 return LbEndpointValidationError{ 294 field: "Endpoint", 295 reason: "embedded message failed validation", 296 cause: err, 297 } 298 } 299 } 300 301 case *LbEndpoint_EndpointName: 302 // no validation rules for EndpointName 303 304 } 305 306 if len(errors) > 0 { 307 return LbEndpointMultiError(errors) 308 } 309 return nil 310} 311 312// LbEndpointMultiError is an error wrapping multiple validation errors 313// returned by LbEndpoint.ValidateAll() if the designated constraints aren't met. 314type LbEndpointMultiError []error 315 316// Error returns a concatenation of all the error messages it wraps. 317func (m LbEndpointMultiError) Error() string { 318 var msgs []string 319 for _, err := range m { 320 msgs = append(msgs, err.Error()) 321 } 322 return strings.Join(msgs, "; ") 323} 324 325// AllErrors returns a list of validation violation errors. 326func (m LbEndpointMultiError) AllErrors() []error { return m } 327 328// LbEndpointValidationError is the validation error returned by 329// LbEndpoint.Validate if the designated constraints aren't met. 330type LbEndpointValidationError struct { 331 field string 332 reason string 333 cause error 334 key bool 335} 336 337// Field function returns field value. 338func (e LbEndpointValidationError) Field() string { return e.field } 339 340// Reason function returns reason value. 341func (e LbEndpointValidationError) Reason() string { return e.reason } 342 343// Cause function returns cause value. 344func (e LbEndpointValidationError) Cause() error { return e.cause } 345 346// Key function returns key value. 347func (e LbEndpointValidationError) Key() bool { return e.key } 348 349// ErrorName returns error name. 350func (e LbEndpointValidationError) ErrorName() string { return "LbEndpointValidationError" } 351 352// Error satisfies the builtin error interface 353func (e LbEndpointValidationError) Error() string { 354 cause := "" 355 if e.cause != nil { 356 cause = fmt.Sprintf(" | caused by: %v", e.cause) 357 } 358 359 key := "" 360 if e.key { 361 key = "key for " 362 } 363 364 return fmt.Sprintf( 365 "invalid %sLbEndpoint.%s: %s%s", 366 key, 367 e.field, 368 e.reason, 369 cause) 370} 371 372var _ error = LbEndpointValidationError{} 373 374var _ interface { 375 Field() string 376 Reason() string 377 Key() bool 378 Cause() error 379 ErrorName() string 380} = LbEndpointValidationError{} 381 382// Validate checks the field values on LedsClusterLocalityConfig with the rules 383// defined in the proto definition for this message. If any rules are 384// violated, the first error encountered is returned, or nil if there are no violations. 385func (m *LedsClusterLocalityConfig) Validate() error { 386 return m.validate(false) 387} 388 389// ValidateAll checks the field values on LedsClusterLocalityConfig with the 390// rules defined in the proto definition for this message. If any rules are 391// violated, the result is a list of violation errors wrapped in 392// LedsClusterLocalityConfigMultiError, or nil if none found. 393func (m *LedsClusterLocalityConfig) ValidateAll() error { 394 return m.validate(true) 395} 396 397func (m *LedsClusterLocalityConfig) validate(all bool) error { 398 if m == nil { 399 return nil 400 } 401 402 var errors []error 403 404 if all { 405 switch v := interface{}(m.GetLedsConfig()).(type) { 406 case interface{ ValidateAll() error }: 407 if err := v.ValidateAll(); err != nil { 408 errors = append(errors, LedsClusterLocalityConfigValidationError{ 409 field: "LedsConfig", 410 reason: "embedded message failed validation", 411 cause: err, 412 }) 413 } 414 case interface{ Validate() error }: 415 if err := v.Validate(); err != nil { 416 errors = append(errors, LedsClusterLocalityConfigValidationError{ 417 field: "LedsConfig", 418 reason: "embedded message failed validation", 419 cause: err, 420 }) 421 } 422 } 423 } else if v, ok := interface{}(m.GetLedsConfig()).(interface{ Validate() error }); ok { 424 if err := v.Validate(); err != nil { 425 return LedsClusterLocalityConfigValidationError{ 426 field: "LedsConfig", 427 reason: "embedded message failed validation", 428 cause: err, 429 } 430 } 431 } 432 433 // no validation rules for LedsCollectionName 434 435 if len(errors) > 0 { 436 return LedsClusterLocalityConfigMultiError(errors) 437 } 438 return nil 439} 440 441// LedsClusterLocalityConfigMultiError is an error wrapping multiple validation 442// errors returned by LedsClusterLocalityConfig.ValidateAll() if the 443// designated constraints aren't met. 444type LedsClusterLocalityConfigMultiError []error 445 446// Error returns a concatenation of all the error messages it wraps. 447func (m LedsClusterLocalityConfigMultiError) Error() string { 448 var msgs []string 449 for _, err := range m { 450 msgs = append(msgs, err.Error()) 451 } 452 return strings.Join(msgs, "; ") 453} 454 455// AllErrors returns a list of validation violation errors. 456func (m LedsClusterLocalityConfigMultiError) AllErrors() []error { return m } 457 458// LedsClusterLocalityConfigValidationError is the validation error returned by 459// LedsClusterLocalityConfig.Validate if the designated constraints aren't met. 460type LedsClusterLocalityConfigValidationError struct { 461 field string 462 reason string 463 cause error 464 key bool 465} 466 467// Field function returns field value. 468func (e LedsClusterLocalityConfigValidationError) Field() string { return e.field } 469 470// Reason function returns reason value. 471func (e LedsClusterLocalityConfigValidationError) Reason() string { return e.reason } 472 473// Cause function returns cause value. 474func (e LedsClusterLocalityConfigValidationError) Cause() error { return e.cause } 475 476// Key function returns key value. 477func (e LedsClusterLocalityConfigValidationError) Key() bool { return e.key } 478 479// ErrorName returns error name. 480func (e LedsClusterLocalityConfigValidationError) ErrorName() string { 481 return "LedsClusterLocalityConfigValidationError" 482} 483 484// Error satisfies the builtin error interface 485func (e LedsClusterLocalityConfigValidationError) Error() string { 486 cause := "" 487 if e.cause != nil { 488 cause = fmt.Sprintf(" | caused by: %v", e.cause) 489 } 490 491 key := "" 492 if e.key { 493 key = "key for " 494 } 495 496 return fmt.Sprintf( 497 "invalid %sLedsClusterLocalityConfig.%s: %s%s", 498 key, 499 e.field, 500 e.reason, 501 cause) 502} 503 504var _ error = LedsClusterLocalityConfigValidationError{} 505 506var _ interface { 507 Field() string 508 Reason() string 509 Key() bool 510 Cause() error 511 ErrorName() string 512} = LedsClusterLocalityConfigValidationError{} 513 514// Validate checks the field values on LocalityLbEndpoints with the rules 515// defined in the proto definition for this message. If any rules are 516// violated, the first error encountered is returned, or nil if there are no violations. 517func (m *LocalityLbEndpoints) Validate() error { 518 return m.validate(false) 519} 520 521// ValidateAll checks the field values on LocalityLbEndpoints with the rules 522// defined in the proto definition for this message. If any rules are 523// violated, the result is a list of violation errors wrapped in 524// LocalityLbEndpointsMultiError, or nil if none found. 525func (m *LocalityLbEndpoints) ValidateAll() error { 526 return m.validate(true) 527} 528 529func (m *LocalityLbEndpoints) validate(all bool) error { 530 if m == nil { 531 return nil 532 } 533 534 var errors []error 535 536 if all { 537 switch v := interface{}(m.GetLocality()).(type) { 538 case interface{ ValidateAll() error }: 539 if err := v.ValidateAll(); err != nil { 540 errors = append(errors, LocalityLbEndpointsValidationError{ 541 field: "Locality", 542 reason: "embedded message failed validation", 543 cause: err, 544 }) 545 } 546 case interface{ Validate() error }: 547 if err := v.Validate(); err != nil { 548 errors = append(errors, LocalityLbEndpointsValidationError{ 549 field: "Locality", 550 reason: "embedded message failed validation", 551 cause: err, 552 }) 553 } 554 } 555 } else if v, ok := interface{}(m.GetLocality()).(interface{ Validate() error }); ok { 556 if err := v.Validate(); err != nil { 557 return LocalityLbEndpointsValidationError{ 558 field: "Locality", 559 reason: "embedded message failed validation", 560 cause: err, 561 } 562 } 563 } 564 565 for idx, item := range m.GetLbEndpoints() { 566 _, _ = idx, item 567 568 if all { 569 switch v := interface{}(item).(type) { 570 case interface{ ValidateAll() error }: 571 if err := v.ValidateAll(); err != nil { 572 errors = append(errors, LocalityLbEndpointsValidationError{ 573 field: fmt.Sprintf("LbEndpoints[%v]", idx), 574 reason: "embedded message failed validation", 575 cause: err, 576 }) 577 } 578 case interface{ Validate() error }: 579 if err := v.Validate(); err != nil { 580 errors = append(errors, LocalityLbEndpointsValidationError{ 581 field: fmt.Sprintf("LbEndpoints[%v]", idx), 582 reason: "embedded message failed validation", 583 cause: err, 584 }) 585 } 586 } 587 } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { 588 if err := v.Validate(); err != nil { 589 return LocalityLbEndpointsValidationError{ 590 field: fmt.Sprintf("LbEndpoints[%v]", idx), 591 reason: "embedded message failed validation", 592 cause: err, 593 } 594 } 595 } 596 597 } 598 599 if wrapper := m.GetLoadBalancingWeight(); wrapper != nil { 600 601 if wrapper.GetValue() < 1 { 602 err := LocalityLbEndpointsValidationError{ 603 field: "LoadBalancingWeight", 604 reason: "value must be greater than or equal to 1", 605 } 606 if !all { 607 return err 608 } 609 errors = append(errors, err) 610 } 611 612 } 613 614 if m.GetPriority() > 128 { 615 err := LocalityLbEndpointsValidationError{ 616 field: "Priority", 617 reason: "value must be less than or equal to 128", 618 } 619 if !all { 620 return err 621 } 622 errors = append(errors, err) 623 } 624 625 if all { 626 switch v := interface{}(m.GetProximity()).(type) { 627 case interface{ ValidateAll() error }: 628 if err := v.ValidateAll(); err != nil { 629 errors = append(errors, LocalityLbEndpointsValidationError{ 630 field: "Proximity", 631 reason: "embedded message failed validation", 632 cause: err, 633 }) 634 } 635 case interface{ Validate() error }: 636 if err := v.Validate(); err != nil { 637 errors = append(errors, LocalityLbEndpointsValidationError{ 638 field: "Proximity", 639 reason: "embedded message failed validation", 640 cause: err, 641 }) 642 } 643 } 644 } else if v, ok := interface{}(m.GetProximity()).(interface{ Validate() error }); ok { 645 if err := v.Validate(); err != nil { 646 return LocalityLbEndpointsValidationError{ 647 field: "Proximity", 648 reason: "embedded message failed validation", 649 cause: err, 650 } 651 } 652 } 653 654 switch m.LbConfig.(type) { 655 656 case *LocalityLbEndpoints_LoadBalancerEndpoints: 657 658 if all { 659 switch v := interface{}(m.GetLoadBalancerEndpoints()).(type) { 660 case interface{ ValidateAll() error }: 661 if err := v.ValidateAll(); err != nil { 662 errors = append(errors, LocalityLbEndpointsValidationError{ 663 field: "LoadBalancerEndpoints", 664 reason: "embedded message failed validation", 665 cause: err, 666 }) 667 } 668 case interface{ Validate() error }: 669 if err := v.Validate(); err != nil { 670 errors = append(errors, LocalityLbEndpointsValidationError{ 671 field: "LoadBalancerEndpoints", 672 reason: "embedded message failed validation", 673 cause: err, 674 }) 675 } 676 } 677 } else if v, ok := interface{}(m.GetLoadBalancerEndpoints()).(interface{ Validate() error }); ok { 678 if err := v.Validate(); err != nil { 679 return LocalityLbEndpointsValidationError{ 680 field: "LoadBalancerEndpoints", 681 reason: "embedded message failed validation", 682 cause: err, 683 } 684 } 685 } 686 687 case *LocalityLbEndpoints_LedsClusterLocalityConfig: 688 689 if all { 690 switch v := interface{}(m.GetLedsClusterLocalityConfig()).(type) { 691 case interface{ ValidateAll() error }: 692 if err := v.ValidateAll(); err != nil { 693 errors = append(errors, LocalityLbEndpointsValidationError{ 694 field: "LedsClusterLocalityConfig", 695 reason: "embedded message failed validation", 696 cause: err, 697 }) 698 } 699 case interface{ Validate() error }: 700 if err := v.Validate(); err != nil { 701 errors = append(errors, LocalityLbEndpointsValidationError{ 702 field: "LedsClusterLocalityConfig", 703 reason: "embedded message failed validation", 704 cause: err, 705 }) 706 } 707 } 708 } else if v, ok := interface{}(m.GetLedsClusterLocalityConfig()).(interface{ Validate() error }); ok { 709 if err := v.Validate(); err != nil { 710 return LocalityLbEndpointsValidationError{ 711 field: "LedsClusterLocalityConfig", 712 reason: "embedded message failed validation", 713 cause: err, 714 } 715 } 716 } 717 718 } 719 720 if len(errors) > 0 { 721 return LocalityLbEndpointsMultiError(errors) 722 } 723 return nil 724} 725 726// LocalityLbEndpointsMultiError is an error wrapping multiple validation 727// errors returned by LocalityLbEndpoints.ValidateAll() if the designated 728// constraints aren't met. 729type LocalityLbEndpointsMultiError []error 730 731// Error returns a concatenation of all the error messages it wraps. 732func (m LocalityLbEndpointsMultiError) Error() string { 733 var msgs []string 734 for _, err := range m { 735 msgs = append(msgs, err.Error()) 736 } 737 return strings.Join(msgs, "; ") 738} 739 740// AllErrors returns a list of validation violation errors. 741func (m LocalityLbEndpointsMultiError) AllErrors() []error { return m } 742 743// LocalityLbEndpointsValidationError is the validation error returned by 744// LocalityLbEndpoints.Validate if the designated constraints aren't met. 745type LocalityLbEndpointsValidationError struct { 746 field string 747 reason string 748 cause error 749 key bool 750} 751 752// Field function returns field value. 753func (e LocalityLbEndpointsValidationError) Field() string { return e.field } 754 755// Reason function returns reason value. 756func (e LocalityLbEndpointsValidationError) Reason() string { return e.reason } 757 758// Cause function returns cause value. 759func (e LocalityLbEndpointsValidationError) Cause() error { return e.cause } 760 761// Key function returns key value. 762func (e LocalityLbEndpointsValidationError) Key() bool { return e.key } 763 764// ErrorName returns error name. 765func (e LocalityLbEndpointsValidationError) ErrorName() string { 766 return "LocalityLbEndpointsValidationError" 767} 768 769// Error satisfies the builtin error interface 770func (e LocalityLbEndpointsValidationError) Error() string { 771 cause := "" 772 if e.cause != nil { 773 cause = fmt.Sprintf(" | caused by: %v", e.cause) 774 } 775 776 key := "" 777 if e.key { 778 key = "key for " 779 } 780 781 return fmt.Sprintf( 782 "invalid %sLocalityLbEndpoints.%s: %s%s", 783 key, 784 e.field, 785 e.reason, 786 cause) 787} 788 789var _ error = LocalityLbEndpointsValidationError{} 790 791var _ interface { 792 Field() string 793 Reason() string 794 Key() bool 795 Cause() error 796 ErrorName() string 797} = LocalityLbEndpointsValidationError{} 798 799// Validate checks the field values on Endpoint_HealthCheckConfig with the 800// rules defined in the proto definition for this message. If any rules are 801// violated, the first error encountered is returned, or nil if there are no violations. 802func (m *Endpoint_HealthCheckConfig) Validate() error { 803 return m.validate(false) 804} 805 806// ValidateAll checks the field values on Endpoint_HealthCheckConfig with the 807// rules defined in the proto definition for this message. If any rules are 808// violated, the result is a list of violation errors wrapped in 809// Endpoint_HealthCheckConfigMultiError, or nil if none found. 810func (m *Endpoint_HealthCheckConfig) ValidateAll() error { 811 return m.validate(true) 812} 813 814func (m *Endpoint_HealthCheckConfig) validate(all bool) error { 815 if m == nil { 816 return nil 817 } 818 819 var errors []error 820 821 if m.GetPortValue() > 65535 { 822 err := Endpoint_HealthCheckConfigValidationError{ 823 field: "PortValue", 824 reason: "value must be less than or equal to 65535", 825 } 826 if !all { 827 return err 828 } 829 errors = append(errors, err) 830 } 831 832 // no validation rules for Hostname 833 834 if len(errors) > 0 { 835 return Endpoint_HealthCheckConfigMultiError(errors) 836 } 837 return nil 838} 839 840// Endpoint_HealthCheckConfigMultiError is an error wrapping multiple 841// validation errors returned by Endpoint_HealthCheckConfig.ValidateAll() if 842// the designated constraints aren't met. 843type Endpoint_HealthCheckConfigMultiError []error 844 845// Error returns a concatenation of all the error messages it wraps. 846func (m Endpoint_HealthCheckConfigMultiError) Error() string { 847 var msgs []string 848 for _, err := range m { 849 msgs = append(msgs, err.Error()) 850 } 851 return strings.Join(msgs, "; ") 852} 853 854// AllErrors returns a list of validation violation errors. 855func (m Endpoint_HealthCheckConfigMultiError) AllErrors() []error { return m } 856 857// Endpoint_HealthCheckConfigValidationError is the validation error returned 858// by Endpoint_HealthCheckConfig.Validate if the designated constraints aren't met. 859type Endpoint_HealthCheckConfigValidationError struct { 860 field string 861 reason string 862 cause error 863 key bool 864} 865 866// Field function returns field value. 867func (e Endpoint_HealthCheckConfigValidationError) Field() string { return e.field } 868 869// Reason function returns reason value. 870func (e Endpoint_HealthCheckConfigValidationError) Reason() string { return e.reason } 871 872// Cause function returns cause value. 873func (e Endpoint_HealthCheckConfigValidationError) Cause() error { return e.cause } 874 875// Key function returns key value. 876func (e Endpoint_HealthCheckConfigValidationError) Key() bool { return e.key } 877 878// ErrorName returns error name. 879func (e Endpoint_HealthCheckConfigValidationError) ErrorName() string { 880 return "Endpoint_HealthCheckConfigValidationError" 881} 882 883// Error satisfies the builtin error interface 884func (e Endpoint_HealthCheckConfigValidationError) Error() string { 885 cause := "" 886 if e.cause != nil { 887 cause = fmt.Sprintf(" | caused by: %v", e.cause) 888 } 889 890 key := "" 891 if e.key { 892 key = "key for " 893 } 894 895 return fmt.Sprintf( 896 "invalid %sEndpoint_HealthCheckConfig.%s: %s%s", 897 key, 898 e.field, 899 e.reason, 900 cause) 901} 902 903var _ error = Endpoint_HealthCheckConfigValidationError{} 904 905var _ interface { 906 Field() string 907 Reason() string 908 Key() bool 909 Cause() error 910 ErrorName() string 911} = Endpoint_HealthCheckConfigValidationError{} 912 913// Validate checks the field values on LocalityLbEndpoints_LbEndpointList with 914// the rules defined in the proto definition for this message. If any rules 915// are violated, the first error encountered is returned, or nil if there are 916// no violations. 917func (m *LocalityLbEndpoints_LbEndpointList) Validate() error { 918 return m.validate(false) 919} 920 921// ValidateAll checks the field values on LocalityLbEndpoints_LbEndpointList 922// with the rules defined in the proto definition for this message. If any 923// rules are violated, the result is a list of violation errors wrapped in 924// LocalityLbEndpoints_LbEndpointListMultiError, or nil if none found. 925func (m *LocalityLbEndpoints_LbEndpointList) ValidateAll() error { 926 return m.validate(true) 927} 928 929func (m *LocalityLbEndpoints_LbEndpointList) validate(all bool) error { 930 if m == nil { 931 return nil 932 } 933 934 var errors []error 935 936 for idx, item := range m.GetLbEndpoints() { 937 _, _ = idx, item 938 939 if all { 940 switch v := interface{}(item).(type) { 941 case interface{ ValidateAll() error }: 942 if err := v.ValidateAll(); err != nil { 943 errors = append(errors, LocalityLbEndpoints_LbEndpointListValidationError{ 944 field: fmt.Sprintf("LbEndpoints[%v]", idx), 945 reason: "embedded message failed validation", 946 cause: err, 947 }) 948 } 949 case interface{ Validate() error }: 950 if err := v.Validate(); err != nil { 951 errors = append(errors, LocalityLbEndpoints_LbEndpointListValidationError{ 952 field: fmt.Sprintf("LbEndpoints[%v]", idx), 953 reason: "embedded message failed validation", 954 cause: err, 955 }) 956 } 957 } 958 } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { 959 if err := v.Validate(); err != nil { 960 return LocalityLbEndpoints_LbEndpointListValidationError{ 961 field: fmt.Sprintf("LbEndpoints[%v]", idx), 962 reason: "embedded message failed validation", 963 cause: err, 964 } 965 } 966 } 967 968 } 969 970 if len(errors) > 0 { 971 return LocalityLbEndpoints_LbEndpointListMultiError(errors) 972 } 973 return nil 974} 975 976// LocalityLbEndpoints_LbEndpointListMultiError is an error wrapping multiple 977// validation errors returned by 978// LocalityLbEndpoints_LbEndpointList.ValidateAll() if the designated 979// constraints aren't met. 980type LocalityLbEndpoints_LbEndpointListMultiError []error 981 982// Error returns a concatenation of all the error messages it wraps. 983func (m LocalityLbEndpoints_LbEndpointListMultiError) Error() string { 984 var msgs []string 985 for _, err := range m { 986 msgs = append(msgs, err.Error()) 987 } 988 return strings.Join(msgs, "; ") 989} 990 991// AllErrors returns a list of validation violation errors. 992func (m LocalityLbEndpoints_LbEndpointListMultiError) AllErrors() []error { return m } 993 994// LocalityLbEndpoints_LbEndpointListValidationError is the validation error 995// returned by LocalityLbEndpoints_LbEndpointList.Validate if the designated 996// constraints aren't met. 997type LocalityLbEndpoints_LbEndpointListValidationError struct { 998 field string 999 reason string 1000 cause error 1001 key bool 1002} 1003 1004// Field function returns field value. 1005func (e LocalityLbEndpoints_LbEndpointListValidationError) Field() string { return e.field } 1006 1007// Reason function returns reason value. 1008func (e LocalityLbEndpoints_LbEndpointListValidationError) Reason() string { return e.reason } 1009 1010// Cause function returns cause value. 1011func (e LocalityLbEndpoints_LbEndpointListValidationError) Cause() error { return e.cause } 1012 1013// Key function returns key value. 1014func (e LocalityLbEndpoints_LbEndpointListValidationError) Key() bool { return e.key } 1015 1016// ErrorName returns error name. 1017func (e LocalityLbEndpoints_LbEndpointListValidationError) ErrorName() string { 1018 return "LocalityLbEndpoints_LbEndpointListValidationError" 1019} 1020 1021// Error satisfies the builtin error interface 1022func (e LocalityLbEndpoints_LbEndpointListValidationError) Error() string { 1023 cause := "" 1024 if e.cause != nil { 1025 cause = fmt.Sprintf(" | caused by: %v", e.cause) 1026 } 1027 1028 key := "" 1029 if e.key { 1030 key = "key for " 1031 } 1032 1033 return fmt.Sprintf( 1034 "invalid %sLocalityLbEndpoints_LbEndpointList.%s: %s%s", 1035 key, 1036 e.field, 1037 e.reason, 1038 cause) 1039} 1040 1041var _ error = LocalityLbEndpoints_LbEndpointListValidationError{} 1042 1043var _ interface { 1044 Field() string 1045 Reason() string 1046 Key() bool 1047 Cause() error 1048 ErrorName() string 1049} = LocalityLbEndpoints_LbEndpointListValidationError{} 1050