gitee.com/ks-custle/core-gm@v0.0.0-20230922171213-b83bdd97b62c/go-control-plane/envoy/config/metrics/v3/stats.pb.validate.go (about) 1 // Code generated by protoc-gen-validate. DO NOT EDIT. 2 // source: envoy/config/metrics/v3/stats.proto 3 4 package envoy_config_metrics_v3 5 6 import ( 7 "bytes" 8 "errors" 9 "fmt" 10 "net" 11 "net/mail" 12 "net/url" 13 "regexp" 14 "strings" 15 "time" 16 "unicode/utf8" 17 18 "google.golang.org/protobuf/types/known/anypb" 19 ) 20 21 // ensure the imports are used 22 var ( 23 _ = bytes.MinRead 24 _ = errors.New("") 25 _ = fmt.Print 26 _ = utf8.UTFMax 27 _ = (*regexp.Regexp)(nil) 28 _ = (*strings.Reader)(nil) 29 _ = net.IPv4len 30 _ = time.Duration(0) 31 _ = (*url.URL)(nil) 32 _ = (*mail.Address)(nil) 33 _ = anypb.Any{} 34 ) 35 36 // Validate checks the field values on StatsSink with the rules defined in the 37 // proto definition for this message. If any rules are violated, an error is returned. 38 func (m *StatsSink) Validate() error { 39 if m == nil { 40 return nil 41 } 42 43 // no validation rules for Name 44 45 switch m.ConfigType.(type) { 46 47 case *StatsSink_TypedConfig: 48 49 if v, ok := interface{}(m.GetTypedConfig()).(interface{ Validate() error }); ok { 50 if err := v.Validate(); err != nil { 51 return StatsSinkValidationError{ 52 field: "TypedConfig", 53 reason: "embedded message failed validation", 54 cause: err, 55 } 56 } 57 } 58 59 case *StatsSink_HiddenEnvoyDeprecatedConfig: 60 61 if v, ok := interface{}(m.GetHiddenEnvoyDeprecatedConfig()).(interface{ Validate() error }); ok { 62 if err := v.Validate(); err != nil { 63 return StatsSinkValidationError{ 64 field: "HiddenEnvoyDeprecatedConfig", 65 reason: "embedded message failed validation", 66 cause: err, 67 } 68 } 69 } 70 71 } 72 73 return nil 74 } 75 76 // StatsSinkValidationError is the validation error returned by 77 // StatsSink.Validate if the designated constraints aren't met. 78 type StatsSinkValidationError struct { 79 field string 80 reason string 81 cause error 82 key bool 83 } 84 85 // Field function returns field value. 86 func (e StatsSinkValidationError) Field() string { return e.field } 87 88 // Reason function returns reason value. 89 func (e StatsSinkValidationError) Reason() string { return e.reason } 90 91 // Cause function returns cause value. 92 func (e StatsSinkValidationError) Cause() error { return e.cause } 93 94 // Key function returns key value. 95 func (e StatsSinkValidationError) Key() bool { return e.key } 96 97 // ErrorName returns error name. 98 func (e StatsSinkValidationError) ErrorName() string { return "StatsSinkValidationError" } 99 100 // Error satisfies the builtin error interface 101 func (e StatsSinkValidationError) Error() string { 102 cause := "" 103 if e.cause != nil { 104 cause = fmt.Sprintf(" | caused by: %v", e.cause) 105 } 106 107 key := "" 108 if e.key { 109 key = "key for " 110 } 111 112 return fmt.Sprintf( 113 "invalid %sStatsSink.%s: %s%s", 114 key, 115 e.field, 116 e.reason, 117 cause) 118 } 119 120 var _ error = StatsSinkValidationError{} 121 122 var _ interface { 123 Field() string 124 Reason() string 125 Key() bool 126 Cause() error 127 ErrorName() string 128 } = StatsSinkValidationError{} 129 130 // Validate checks the field values on StatsConfig with the rules defined in 131 // the proto definition for this message. If any rules are violated, an error 132 // is returned. 133 func (m *StatsConfig) Validate() error { 134 if m == nil { 135 return nil 136 } 137 138 for idx, item := range m.GetStatsTags() { 139 _, _ = idx, item 140 141 if v, ok := interface{}(item).(interface{ Validate() error }); ok { 142 if err := v.Validate(); err != nil { 143 return StatsConfigValidationError{ 144 field: fmt.Sprintf("StatsTags[%v]", idx), 145 reason: "embedded message failed validation", 146 cause: err, 147 } 148 } 149 } 150 151 } 152 153 if v, ok := interface{}(m.GetUseAllDefaultTags()).(interface{ Validate() error }); ok { 154 if err := v.Validate(); err != nil { 155 return StatsConfigValidationError{ 156 field: "UseAllDefaultTags", 157 reason: "embedded message failed validation", 158 cause: err, 159 } 160 } 161 } 162 163 if v, ok := interface{}(m.GetStatsMatcher()).(interface{ Validate() error }); ok { 164 if err := v.Validate(); err != nil { 165 return StatsConfigValidationError{ 166 field: "StatsMatcher", 167 reason: "embedded message failed validation", 168 cause: err, 169 } 170 } 171 } 172 173 for idx, item := range m.GetHistogramBucketSettings() { 174 _, _ = idx, item 175 176 if v, ok := interface{}(item).(interface{ Validate() error }); ok { 177 if err := v.Validate(); err != nil { 178 return StatsConfigValidationError{ 179 field: fmt.Sprintf("HistogramBucketSettings[%v]", idx), 180 reason: "embedded message failed validation", 181 cause: err, 182 } 183 } 184 } 185 186 } 187 188 return nil 189 } 190 191 // StatsConfigValidationError is the validation error returned by 192 // StatsConfig.Validate if the designated constraints aren't met. 193 type StatsConfigValidationError struct { 194 field string 195 reason string 196 cause error 197 key bool 198 } 199 200 // Field function returns field value. 201 func (e StatsConfigValidationError) Field() string { return e.field } 202 203 // Reason function returns reason value. 204 func (e StatsConfigValidationError) Reason() string { return e.reason } 205 206 // Cause function returns cause value. 207 func (e StatsConfigValidationError) Cause() error { return e.cause } 208 209 // Key function returns key value. 210 func (e StatsConfigValidationError) Key() bool { return e.key } 211 212 // ErrorName returns error name. 213 func (e StatsConfigValidationError) ErrorName() string { return "StatsConfigValidationError" } 214 215 // Error satisfies the builtin error interface 216 func (e StatsConfigValidationError) Error() string { 217 cause := "" 218 if e.cause != nil { 219 cause = fmt.Sprintf(" | caused by: %v", e.cause) 220 } 221 222 key := "" 223 if e.key { 224 key = "key for " 225 } 226 227 return fmt.Sprintf( 228 "invalid %sStatsConfig.%s: %s%s", 229 key, 230 e.field, 231 e.reason, 232 cause) 233 } 234 235 var _ error = StatsConfigValidationError{} 236 237 var _ interface { 238 Field() string 239 Reason() string 240 Key() bool 241 Cause() error 242 ErrorName() string 243 } = StatsConfigValidationError{} 244 245 // Validate checks the field values on StatsMatcher with the rules defined in 246 // the proto definition for this message. If any rules are violated, an error 247 // is returned. 248 func (m *StatsMatcher) Validate() error { 249 if m == nil { 250 return nil 251 } 252 253 switch m.StatsMatcher.(type) { 254 255 case *StatsMatcher_RejectAll: 256 // no validation rules for RejectAll 257 258 case *StatsMatcher_ExclusionList: 259 260 if v, ok := interface{}(m.GetExclusionList()).(interface{ Validate() error }); ok { 261 if err := v.Validate(); err != nil { 262 return StatsMatcherValidationError{ 263 field: "ExclusionList", 264 reason: "embedded message failed validation", 265 cause: err, 266 } 267 } 268 } 269 270 case *StatsMatcher_InclusionList: 271 272 if v, ok := interface{}(m.GetInclusionList()).(interface{ Validate() error }); ok { 273 if err := v.Validate(); err != nil { 274 return StatsMatcherValidationError{ 275 field: "InclusionList", 276 reason: "embedded message failed validation", 277 cause: err, 278 } 279 } 280 } 281 282 default: 283 return StatsMatcherValidationError{ 284 field: "StatsMatcher", 285 reason: "value is required", 286 } 287 288 } 289 290 return nil 291 } 292 293 // StatsMatcherValidationError is the validation error returned by 294 // StatsMatcher.Validate if the designated constraints aren't met. 295 type StatsMatcherValidationError struct { 296 field string 297 reason string 298 cause error 299 key bool 300 } 301 302 // Field function returns field value. 303 func (e StatsMatcherValidationError) Field() string { return e.field } 304 305 // Reason function returns reason value. 306 func (e StatsMatcherValidationError) Reason() string { return e.reason } 307 308 // Cause function returns cause value. 309 func (e StatsMatcherValidationError) Cause() error { return e.cause } 310 311 // Key function returns key value. 312 func (e StatsMatcherValidationError) Key() bool { return e.key } 313 314 // ErrorName returns error name. 315 func (e StatsMatcherValidationError) ErrorName() string { return "StatsMatcherValidationError" } 316 317 // Error satisfies the builtin error interface 318 func (e StatsMatcherValidationError) Error() string { 319 cause := "" 320 if e.cause != nil { 321 cause = fmt.Sprintf(" | caused by: %v", e.cause) 322 } 323 324 key := "" 325 if e.key { 326 key = "key for " 327 } 328 329 return fmt.Sprintf( 330 "invalid %sStatsMatcher.%s: %s%s", 331 key, 332 e.field, 333 e.reason, 334 cause) 335 } 336 337 var _ error = StatsMatcherValidationError{} 338 339 var _ interface { 340 Field() string 341 Reason() string 342 Key() bool 343 Cause() error 344 ErrorName() string 345 } = StatsMatcherValidationError{} 346 347 // Validate checks the field values on TagSpecifier with the rules defined in 348 // the proto definition for this message. If any rules are violated, an error 349 // is returned. 350 func (m *TagSpecifier) Validate() error { 351 if m == nil { 352 return nil 353 } 354 355 // no validation rules for TagName 356 357 switch m.TagValue.(type) { 358 359 case *TagSpecifier_Regex: 360 361 if len(m.GetRegex()) > 1024 { 362 return TagSpecifierValidationError{ 363 field: "Regex", 364 reason: "value length must be at most 1024 bytes", 365 } 366 } 367 368 case *TagSpecifier_FixedValue: 369 // no validation rules for FixedValue 370 371 } 372 373 return nil 374 } 375 376 // TagSpecifierValidationError is the validation error returned by 377 // TagSpecifier.Validate if the designated constraints aren't met. 378 type TagSpecifierValidationError struct { 379 field string 380 reason string 381 cause error 382 key bool 383 } 384 385 // Field function returns field value. 386 func (e TagSpecifierValidationError) Field() string { return e.field } 387 388 // Reason function returns reason value. 389 func (e TagSpecifierValidationError) Reason() string { return e.reason } 390 391 // Cause function returns cause value. 392 func (e TagSpecifierValidationError) Cause() error { return e.cause } 393 394 // Key function returns key value. 395 func (e TagSpecifierValidationError) Key() bool { return e.key } 396 397 // ErrorName returns error name. 398 func (e TagSpecifierValidationError) ErrorName() string { return "TagSpecifierValidationError" } 399 400 // Error satisfies the builtin error interface 401 func (e TagSpecifierValidationError) Error() string { 402 cause := "" 403 if e.cause != nil { 404 cause = fmt.Sprintf(" | caused by: %v", e.cause) 405 } 406 407 key := "" 408 if e.key { 409 key = "key for " 410 } 411 412 return fmt.Sprintf( 413 "invalid %sTagSpecifier.%s: %s%s", 414 key, 415 e.field, 416 e.reason, 417 cause) 418 } 419 420 var _ error = TagSpecifierValidationError{} 421 422 var _ interface { 423 Field() string 424 Reason() string 425 Key() bool 426 Cause() error 427 ErrorName() string 428 } = TagSpecifierValidationError{} 429 430 // Validate checks the field values on HistogramBucketSettings with the rules 431 // defined in the proto definition for this message. If any rules are 432 // violated, an error is returned. 433 func (m *HistogramBucketSettings) Validate() error { 434 if m == nil { 435 return nil 436 } 437 438 if m.GetMatch() == nil { 439 return HistogramBucketSettingsValidationError{ 440 field: "Match", 441 reason: "value is required", 442 } 443 } 444 445 if v, ok := interface{}(m.GetMatch()).(interface{ Validate() error }); ok { 446 if err := v.Validate(); err != nil { 447 return HistogramBucketSettingsValidationError{ 448 field: "Match", 449 reason: "embedded message failed validation", 450 cause: err, 451 } 452 } 453 } 454 455 if len(m.GetBuckets()) < 1 { 456 return HistogramBucketSettingsValidationError{ 457 field: "Buckets", 458 reason: "value must contain at least 1 item(s)", 459 } 460 } 461 462 _HistogramBucketSettings_Buckets_Unique := make(map[float64]struct{}, len(m.GetBuckets())) 463 464 for idx, item := range m.GetBuckets() { 465 _, _ = idx, item 466 467 if _, exists := _HistogramBucketSettings_Buckets_Unique[item]; exists { 468 return HistogramBucketSettingsValidationError{ 469 field: fmt.Sprintf("Buckets[%v]", idx), 470 reason: "repeated value must contain unique items", 471 } 472 } else { 473 _HistogramBucketSettings_Buckets_Unique[item] = struct{}{} 474 } 475 476 if item <= 0 { 477 return HistogramBucketSettingsValidationError{ 478 field: fmt.Sprintf("Buckets[%v]", idx), 479 reason: "value must be greater than 0", 480 } 481 } 482 483 } 484 485 return nil 486 } 487 488 // HistogramBucketSettingsValidationError is the validation error returned by 489 // HistogramBucketSettings.Validate if the designated constraints aren't met. 490 type HistogramBucketSettingsValidationError struct { 491 field string 492 reason string 493 cause error 494 key bool 495 } 496 497 // Field function returns field value. 498 func (e HistogramBucketSettingsValidationError) Field() string { return e.field } 499 500 // Reason function returns reason value. 501 func (e HistogramBucketSettingsValidationError) Reason() string { return e.reason } 502 503 // Cause function returns cause value. 504 func (e HistogramBucketSettingsValidationError) Cause() error { return e.cause } 505 506 // Key function returns key value. 507 func (e HistogramBucketSettingsValidationError) Key() bool { return e.key } 508 509 // ErrorName returns error name. 510 func (e HistogramBucketSettingsValidationError) ErrorName() string { 511 return "HistogramBucketSettingsValidationError" 512 } 513 514 // Error satisfies the builtin error interface 515 func (e HistogramBucketSettingsValidationError) Error() string { 516 cause := "" 517 if e.cause != nil { 518 cause = fmt.Sprintf(" | caused by: %v", e.cause) 519 } 520 521 key := "" 522 if e.key { 523 key = "key for " 524 } 525 526 return fmt.Sprintf( 527 "invalid %sHistogramBucketSettings.%s: %s%s", 528 key, 529 e.field, 530 e.reason, 531 cause) 532 } 533 534 var _ error = HistogramBucketSettingsValidationError{} 535 536 var _ interface { 537 Field() string 538 Reason() string 539 Key() bool 540 Cause() error 541 ErrorName() string 542 } = HistogramBucketSettingsValidationError{} 543 544 // Validate checks the field values on StatsdSink with the rules defined in the 545 // proto definition for this message. If any rules are violated, an error is returned. 546 func (m *StatsdSink) Validate() error { 547 if m == nil { 548 return nil 549 } 550 551 // no validation rules for Prefix 552 553 switch m.StatsdSpecifier.(type) { 554 555 case *StatsdSink_Address: 556 557 if v, ok := interface{}(m.GetAddress()).(interface{ Validate() error }); ok { 558 if err := v.Validate(); err != nil { 559 return StatsdSinkValidationError{ 560 field: "Address", 561 reason: "embedded message failed validation", 562 cause: err, 563 } 564 } 565 } 566 567 case *StatsdSink_TcpClusterName: 568 // no validation rules for TcpClusterName 569 570 default: 571 return StatsdSinkValidationError{ 572 field: "StatsdSpecifier", 573 reason: "value is required", 574 } 575 576 } 577 578 return nil 579 } 580 581 // StatsdSinkValidationError is the validation error returned by 582 // StatsdSink.Validate if the designated constraints aren't met. 583 type StatsdSinkValidationError struct { 584 field string 585 reason string 586 cause error 587 key bool 588 } 589 590 // Field function returns field value. 591 func (e StatsdSinkValidationError) Field() string { return e.field } 592 593 // Reason function returns reason value. 594 func (e StatsdSinkValidationError) Reason() string { return e.reason } 595 596 // Cause function returns cause value. 597 func (e StatsdSinkValidationError) Cause() error { return e.cause } 598 599 // Key function returns key value. 600 func (e StatsdSinkValidationError) Key() bool { return e.key } 601 602 // ErrorName returns error name. 603 func (e StatsdSinkValidationError) ErrorName() string { return "StatsdSinkValidationError" } 604 605 // Error satisfies the builtin error interface 606 func (e StatsdSinkValidationError) Error() string { 607 cause := "" 608 if e.cause != nil { 609 cause = fmt.Sprintf(" | caused by: %v", e.cause) 610 } 611 612 key := "" 613 if e.key { 614 key = "key for " 615 } 616 617 return fmt.Sprintf( 618 "invalid %sStatsdSink.%s: %s%s", 619 key, 620 e.field, 621 e.reason, 622 cause) 623 } 624 625 var _ error = StatsdSinkValidationError{} 626 627 var _ interface { 628 Field() string 629 Reason() string 630 Key() bool 631 Cause() error 632 ErrorName() string 633 } = StatsdSinkValidationError{} 634 635 // Validate checks the field values on DogStatsdSink with the rules defined in 636 // the proto definition for this message. If any rules are violated, an error 637 // is returned. 638 func (m *DogStatsdSink) Validate() error { 639 if m == nil { 640 return nil 641 } 642 643 // no validation rules for Prefix 644 645 if wrapper := m.GetMaxBytesPerDatagram(); wrapper != nil { 646 647 if wrapper.GetValue() <= 0 { 648 return DogStatsdSinkValidationError{ 649 field: "MaxBytesPerDatagram", 650 reason: "value must be greater than 0", 651 } 652 } 653 654 } 655 656 switch m.DogStatsdSpecifier.(type) { 657 658 case *DogStatsdSink_Address: 659 660 if v, ok := interface{}(m.GetAddress()).(interface{ Validate() error }); ok { 661 if err := v.Validate(); err != nil { 662 return DogStatsdSinkValidationError{ 663 field: "Address", 664 reason: "embedded message failed validation", 665 cause: err, 666 } 667 } 668 } 669 670 default: 671 return DogStatsdSinkValidationError{ 672 field: "DogStatsdSpecifier", 673 reason: "value is required", 674 } 675 676 } 677 678 return nil 679 } 680 681 // DogStatsdSinkValidationError is the validation error returned by 682 // DogStatsdSink.Validate if the designated constraints aren't met. 683 type DogStatsdSinkValidationError struct { 684 field string 685 reason string 686 cause error 687 key bool 688 } 689 690 // Field function returns field value. 691 func (e DogStatsdSinkValidationError) Field() string { return e.field } 692 693 // Reason function returns reason value. 694 func (e DogStatsdSinkValidationError) Reason() string { return e.reason } 695 696 // Cause function returns cause value. 697 func (e DogStatsdSinkValidationError) Cause() error { return e.cause } 698 699 // Key function returns key value. 700 func (e DogStatsdSinkValidationError) Key() bool { return e.key } 701 702 // ErrorName returns error name. 703 func (e DogStatsdSinkValidationError) ErrorName() string { return "DogStatsdSinkValidationError" } 704 705 // Error satisfies the builtin error interface 706 func (e DogStatsdSinkValidationError) Error() string { 707 cause := "" 708 if e.cause != nil { 709 cause = fmt.Sprintf(" | caused by: %v", e.cause) 710 } 711 712 key := "" 713 if e.key { 714 key = "key for " 715 } 716 717 return fmt.Sprintf( 718 "invalid %sDogStatsdSink.%s: %s%s", 719 key, 720 e.field, 721 e.reason, 722 cause) 723 } 724 725 var _ error = DogStatsdSinkValidationError{} 726 727 var _ interface { 728 Field() string 729 Reason() string 730 Key() bool 731 Cause() error 732 ErrorName() string 733 } = DogStatsdSinkValidationError{} 734 735 // Validate checks the field values on HystrixSink with the rules defined in 736 // the proto definition for this message. If any rules are violated, an error 737 // is returned. 738 func (m *HystrixSink) Validate() error { 739 if m == nil { 740 return nil 741 } 742 743 // no validation rules for NumBuckets 744 745 return nil 746 } 747 748 // HystrixSinkValidationError is the validation error returned by 749 // HystrixSink.Validate if the designated constraints aren't met. 750 type HystrixSinkValidationError struct { 751 field string 752 reason string 753 cause error 754 key bool 755 } 756 757 // Field function returns field value. 758 func (e HystrixSinkValidationError) Field() string { return e.field } 759 760 // Reason function returns reason value. 761 func (e HystrixSinkValidationError) Reason() string { return e.reason } 762 763 // Cause function returns cause value. 764 func (e HystrixSinkValidationError) Cause() error { return e.cause } 765 766 // Key function returns key value. 767 func (e HystrixSinkValidationError) Key() bool { return e.key } 768 769 // ErrorName returns error name. 770 func (e HystrixSinkValidationError) ErrorName() string { return "HystrixSinkValidationError" } 771 772 // Error satisfies the builtin error interface 773 func (e HystrixSinkValidationError) Error() string { 774 cause := "" 775 if e.cause != nil { 776 cause = fmt.Sprintf(" | caused by: %v", e.cause) 777 } 778 779 key := "" 780 if e.key { 781 key = "key for " 782 } 783 784 return fmt.Sprintf( 785 "invalid %sHystrixSink.%s: %s%s", 786 key, 787 e.field, 788 e.reason, 789 cause) 790 } 791 792 var _ error = HystrixSinkValidationError{} 793 794 var _ interface { 795 Field() string 796 Reason() string 797 Key() bool 798 Cause() error 799 ErrorName() string 800 } = HystrixSinkValidationError{}