github.com/hxx258456/ccgo@v0.0.5-0.20230213014102-48b35f46f66f/go-control-plane/envoy/data/dns/v3/dns_table.pb.validate.go (about) 1 // Code generated by protoc-gen-validate. DO NOT EDIT. 2 // source: envoy/data/dns/v3/dns_table.proto 3 4 package envoy_data_dns_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 DnsTable with the rules defined in the 37 // proto definition for this message. If any rules are violated, an error is returned. 38 func (m *DnsTable) Validate() error { 39 if m == nil { 40 return nil 41 } 42 43 if m.GetExternalRetryCount() > 3 { 44 return DnsTableValidationError{ 45 field: "ExternalRetryCount", 46 reason: "value must be less than or equal to 3", 47 } 48 } 49 50 for idx, item := range m.GetVirtualDomains() { 51 _, _ = idx, item 52 53 if v, ok := interface{}(item).(interface{ Validate() error }); ok { 54 if err := v.Validate(); err != nil { 55 return DnsTableValidationError{ 56 field: fmt.Sprintf("VirtualDomains[%v]", idx), 57 reason: "embedded message failed validation", 58 cause: err, 59 } 60 } 61 } 62 63 } 64 65 for idx, item := range m.GetKnownSuffixes() { 66 _, _ = idx, item 67 68 if v, ok := interface{}(item).(interface{ Validate() error }); ok { 69 if err := v.Validate(); err != nil { 70 return DnsTableValidationError{ 71 field: fmt.Sprintf("KnownSuffixes[%v]", idx), 72 reason: "embedded message failed validation", 73 cause: err, 74 } 75 } 76 } 77 78 } 79 80 return nil 81 } 82 83 // DnsTableValidationError is the validation error returned by 84 // DnsTable.Validate if the designated constraints aren't met. 85 type DnsTableValidationError struct { 86 field string 87 reason string 88 cause error 89 key bool 90 } 91 92 // Field function returns field value. 93 func (e DnsTableValidationError) Field() string { return e.field } 94 95 // Reason function returns reason value. 96 func (e DnsTableValidationError) Reason() string { return e.reason } 97 98 // Cause function returns cause value. 99 func (e DnsTableValidationError) Cause() error { return e.cause } 100 101 // Key function returns key value. 102 func (e DnsTableValidationError) Key() bool { return e.key } 103 104 // ErrorName returns error name. 105 func (e DnsTableValidationError) ErrorName() string { return "DnsTableValidationError" } 106 107 // Error satisfies the builtin error interface 108 func (e DnsTableValidationError) Error() string { 109 cause := "" 110 if e.cause != nil { 111 cause = fmt.Sprintf(" | caused by: %v", e.cause) 112 } 113 114 key := "" 115 if e.key { 116 key = "key for " 117 } 118 119 return fmt.Sprintf( 120 "invalid %sDnsTable.%s: %s%s", 121 key, 122 e.field, 123 e.reason, 124 cause) 125 } 126 127 var _ error = DnsTableValidationError{} 128 129 var _ interface { 130 Field() string 131 Reason() string 132 Key() bool 133 Cause() error 134 ErrorName() string 135 } = DnsTableValidationError{} 136 137 // Validate checks the field values on DnsTable_AddressList with the rules 138 // defined in the proto definition for this message. If any rules are 139 // violated, an error is returned. 140 func (m *DnsTable_AddressList) Validate() error { 141 if m == nil { 142 return nil 143 } 144 145 if len(m.GetAddress()) < 1 { 146 return DnsTable_AddressListValidationError{ 147 field: "Address", 148 reason: "value must contain at least 1 item(s)", 149 } 150 } 151 152 for idx, item := range m.GetAddress() { 153 _, _ = idx, item 154 155 if utf8.RuneCountInString(item) < 3 { 156 return DnsTable_AddressListValidationError{ 157 field: fmt.Sprintf("Address[%v]", idx), 158 reason: "value length must be at least 3 runes", 159 } 160 } 161 162 } 163 164 return nil 165 } 166 167 // DnsTable_AddressListValidationError is the validation error returned by 168 // DnsTable_AddressList.Validate if the designated constraints aren't met. 169 type DnsTable_AddressListValidationError struct { 170 field string 171 reason string 172 cause error 173 key bool 174 } 175 176 // Field function returns field value. 177 func (e DnsTable_AddressListValidationError) Field() string { return e.field } 178 179 // Reason function returns reason value. 180 func (e DnsTable_AddressListValidationError) Reason() string { return e.reason } 181 182 // Cause function returns cause value. 183 func (e DnsTable_AddressListValidationError) Cause() error { return e.cause } 184 185 // Key function returns key value. 186 func (e DnsTable_AddressListValidationError) Key() bool { return e.key } 187 188 // ErrorName returns error name. 189 func (e DnsTable_AddressListValidationError) ErrorName() string { 190 return "DnsTable_AddressListValidationError" 191 } 192 193 // Error satisfies the builtin error interface 194 func (e DnsTable_AddressListValidationError) Error() string { 195 cause := "" 196 if e.cause != nil { 197 cause = fmt.Sprintf(" | caused by: %v", e.cause) 198 } 199 200 key := "" 201 if e.key { 202 key = "key for " 203 } 204 205 return fmt.Sprintf( 206 "invalid %sDnsTable_AddressList.%s: %s%s", 207 key, 208 e.field, 209 e.reason, 210 cause) 211 } 212 213 var _ error = DnsTable_AddressListValidationError{} 214 215 var _ interface { 216 Field() string 217 Reason() string 218 Key() bool 219 Cause() error 220 ErrorName() string 221 } = DnsTable_AddressListValidationError{} 222 223 // Validate checks the field values on DnsTable_DnsServiceProtocol with the 224 // rules defined in the proto definition for this message. If any rules are 225 // violated, an error is returned. 226 func (m *DnsTable_DnsServiceProtocol) Validate() error { 227 if m == nil { 228 return nil 229 } 230 231 switch m.ProtocolConfig.(type) { 232 233 case *DnsTable_DnsServiceProtocol_Number: 234 235 if m.GetNumber() >= 255 { 236 return DnsTable_DnsServiceProtocolValidationError{ 237 field: "Number", 238 reason: "value must be less than 255", 239 } 240 } 241 242 case *DnsTable_DnsServiceProtocol_Name: 243 244 if utf8.RuneCountInString(m.GetName()) < 1 { 245 return DnsTable_DnsServiceProtocolValidationError{ 246 field: "Name", 247 reason: "value length must be at least 1 runes", 248 } 249 } 250 251 if !_DnsTable_DnsServiceProtocol_Name_Pattern.MatchString(m.GetName()) { 252 return DnsTable_DnsServiceProtocolValidationError{ 253 field: "Name", 254 reason: "value does not match regex pattern \"^:?[0-9a-zA-Z!#$%&'*+-.^_|~`]+$\"", 255 } 256 } 257 258 default: 259 return DnsTable_DnsServiceProtocolValidationError{ 260 field: "ProtocolConfig", 261 reason: "value is required", 262 } 263 264 } 265 266 return nil 267 } 268 269 // DnsTable_DnsServiceProtocolValidationError is the validation error returned 270 // by DnsTable_DnsServiceProtocol.Validate if the designated constraints 271 // aren't met. 272 type DnsTable_DnsServiceProtocolValidationError struct { 273 field string 274 reason string 275 cause error 276 key bool 277 } 278 279 // Field function returns field value. 280 func (e DnsTable_DnsServiceProtocolValidationError) Field() string { return e.field } 281 282 // Reason function returns reason value. 283 func (e DnsTable_DnsServiceProtocolValidationError) Reason() string { return e.reason } 284 285 // Cause function returns cause value. 286 func (e DnsTable_DnsServiceProtocolValidationError) Cause() error { return e.cause } 287 288 // Key function returns key value. 289 func (e DnsTable_DnsServiceProtocolValidationError) Key() bool { return e.key } 290 291 // ErrorName returns error name. 292 func (e DnsTable_DnsServiceProtocolValidationError) ErrorName() string { 293 return "DnsTable_DnsServiceProtocolValidationError" 294 } 295 296 // Error satisfies the builtin error interface 297 func (e DnsTable_DnsServiceProtocolValidationError) Error() string { 298 cause := "" 299 if e.cause != nil { 300 cause = fmt.Sprintf(" | caused by: %v", e.cause) 301 } 302 303 key := "" 304 if e.key { 305 key = "key for " 306 } 307 308 return fmt.Sprintf( 309 "invalid %sDnsTable_DnsServiceProtocol.%s: %s%s", 310 key, 311 e.field, 312 e.reason, 313 cause) 314 } 315 316 var _ error = DnsTable_DnsServiceProtocolValidationError{} 317 318 var _ interface { 319 Field() string 320 Reason() string 321 Key() bool 322 Cause() error 323 ErrorName() string 324 } = DnsTable_DnsServiceProtocolValidationError{} 325 326 var _DnsTable_DnsServiceProtocol_Name_Pattern = regexp.MustCompile("^:?[0-9a-zA-Z!#$%&'*+-.^_|~`]+$") 327 328 // Validate checks the field values on DnsTable_DnsServiceTarget with the rules 329 // defined in the proto definition for this message. If any rules are 330 // violated, an error is returned. 331 func (m *DnsTable_DnsServiceTarget) Validate() error { 332 if m == nil { 333 return nil 334 } 335 336 if m.GetPriority() >= 65536 { 337 return DnsTable_DnsServiceTargetValidationError{ 338 field: "Priority", 339 reason: "value must be less than 65536", 340 } 341 } 342 343 if m.GetWeight() >= 65536 { 344 return DnsTable_DnsServiceTargetValidationError{ 345 field: "Weight", 346 reason: "value must be less than 65536", 347 } 348 } 349 350 if m.GetPort() >= 65536 { 351 return DnsTable_DnsServiceTargetValidationError{ 352 field: "Port", 353 reason: "value must be less than 65536", 354 } 355 } 356 357 switch m.EndpointType.(type) { 358 359 case *DnsTable_DnsServiceTarget_HostName: 360 361 if utf8.RuneCountInString(m.GetHostName()) < 1 { 362 return DnsTable_DnsServiceTargetValidationError{ 363 field: "HostName", 364 reason: "value length must be at least 1 runes", 365 } 366 } 367 368 if !_DnsTable_DnsServiceTarget_HostName_Pattern.MatchString(m.GetHostName()) { 369 return DnsTable_DnsServiceTargetValidationError{ 370 field: "HostName", 371 reason: "value does not match regex pattern \"^:?[0-9a-zA-Z!#$%&'*+-.^_|~`]+$\"", 372 } 373 } 374 375 case *DnsTable_DnsServiceTarget_ClusterName: 376 377 if utf8.RuneCountInString(m.GetClusterName()) < 1 { 378 return DnsTable_DnsServiceTargetValidationError{ 379 field: "ClusterName", 380 reason: "value length must be at least 1 runes", 381 } 382 } 383 384 if !_DnsTable_DnsServiceTarget_ClusterName_Pattern.MatchString(m.GetClusterName()) { 385 return DnsTable_DnsServiceTargetValidationError{ 386 field: "ClusterName", 387 reason: "value does not match regex pattern \"^:?[0-9a-zA-Z!#$%&'*+-.^_|~`]+$\"", 388 } 389 } 390 391 default: 392 return DnsTable_DnsServiceTargetValidationError{ 393 field: "EndpointType", 394 reason: "value is required", 395 } 396 397 } 398 399 return nil 400 } 401 402 // DnsTable_DnsServiceTargetValidationError is the validation error returned by 403 // DnsTable_DnsServiceTarget.Validate if the designated constraints aren't met. 404 type DnsTable_DnsServiceTargetValidationError struct { 405 field string 406 reason string 407 cause error 408 key bool 409 } 410 411 // Field function returns field value. 412 func (e DnsTable_DnsServiceTargetValidationError) Field() string { return e.field } 413 414 // Reason function returns reason value. 415 func (e DnsTable_DnsServiceTargetValidationError) Reason() string { return e.reason } 416 417 // Cause function returns cause value. 418 func (e DnsTable_DnsServiceTargetValidationError) Cause() error { return e.cause } 419 420 // Key function returns key value. 421 func (e DnsTable_DnsServiceTargetValidationError) Key() bool { return e.key } 422 423 // ErrorName returns error name. 424 func (e DnsTable_DnsServiceTargetValidationError) ErrorName() string { 425 return "DnsTable_DnsServiceTargetValidationError" 426 } 427 428 // Error satisfies the builtin error interface 429 func (e DnsTable_DnsServiceTargetValidationError) Error() string { 430 cause := "" 431 if e.cause != nil { 432 cause = fmt.Sprintf(" | caused by: %v", e.cause) 433 } 434 435 key := "" 436 if e.key { 437 key = "key for " 438 } 439 440 return fmt.Sprintf( 441 "invalid %sDnsTable_DnsServiceTarget.%s: %s%s", 442 key, 443 e.field, 444 e.reason, 445 cause) 446 } 447 448 var _ error = DnsTable_DnsServiceTargetValidationError{} 449 450 var _ interface { 451 Field() string 452 Reason() string 453 Key() bool 454 Cause() error 455 ErrorName() string 456 } = DnsTable_DnsServiceTargetValidationError{} 457 458 var _DnsTable_DnsServiceTarget_HostName_Pattern = regexp.MustCompile("^:?[0-9a-zA-Z!#$%&'*+-.^_|~`]+$") 459 460 var _DnsTable_DnsServiceTarget_ClusterName_Pattern = regexp.MustCompile("^:?[0-9a-zA-Z!#$%&'*+-.^_|~`]+$") 461 462 // Validate checks the field values on DnsTable_DnsService with the rules 463 // defined in the proto definition for this message. If any rules are 464 // violated, an error is returned. 465 func (m *DnsTable_DnsService) Validate() error { 466 if m == nil { 467 return nil 468 } 469 470 if utf8.RuneCountInString(m.GetServiceName()) < 1 { 471 return DnsTable_DnsServiceValidationError{ 472 field: "ServiceName", 473 reason: "value length must be at least 1 runes", 474 } 475 } 476 477 if !_DnsTable_DnsService_ServiceName_Pattern.MatchString(m.GetServiceName()) { 478 return DnsTable_DnsServiceValidationError{ 479 field: "ServiceName", 480 reason: "value does not match regex pattern \"^:?[0-9a-zA-Z!#$%&'*+-.^_|~`]+$\"", 481 } 482 } 483 484 if v, ok := interface{}(m.GetProtocol()).(interface{ Validate() error }); ok { 485 if err := v.Validate(); err != nil { 486 return DnsTable_DnsServiceValidationError{ 487 field: "Protocol", 488 reason: "embedded message failed validation", 489 cause: err, 490 } 491 } 492 } 493 494 if d := m.GetTtl(); d != nil { 495 dur, err := d.AsDuration(), d.CheckValid() 496 if err != nil { 497 return DnsTable_DnsServiceValidationError{ 498 field: "Ttl", 499 reason: "value is not a valid duration", 500 cause: err, 501 } 502 } 503 504 gte := time.Duration(1*time.Second + 0*time.Nanosecond) 505 506 if dur < gte { 507 return DnsTable_DnsServiceValidationError{ 508 field: "Ttl", 509 reason: "value must be greater than or equal to 1s", 510 } 511 } 512 513 } 514 515 if len(m.GetTargets()) < 1 { 516 return DnsTable_DnsServiceValidationError{ 517 field: "Targets", 518 reason: "value must contain at least 1 item(s)", 519 } 520 } 521 522 for idx, item := range m.GetTargets() { 523 _, _ = idx, item 524 525 if v, ok := interface{}(item).(interface{ Validate() error }); ok { 526 if err := v.Validate(); err != nil { 527 return DnsTable_DnsServiceValidationError{ 528 field: fmt.Sprintf("Targets[%v]", idx), 529 reason: "embedded message failed validation", 530 cause: err, 531 } 532 } 533 } 534 535 } 536 537 return nil 538 } 539 540 // DnsTable_DnsServiceValidationError is the validation error returned by 541 // DnsTable_DnsService.Validate if the designated constraints aren't met. 542 type DnsTable_DnsServiceValidationError struct { 543 field string 544 reason string 545 cause error 546 key bool 547 } 548 549 // Field function returns field value. 550 func (e DnsTable_DnsServiceValidationError) Field() string { return e.field } 551 552 // Reason function returns reason value. 553 func (e DnsTable_DnsServiceValidationError) Reason() string { return e.reason } 554 555 // Cause function returns cause value. 556 func (e DnsTable_DnsServiceValidationError) Cause() error { return e.cause } 557 558 // Key function returns key value. 559 func (e DnsTable_DnsServiceValidationError) Key() bool { return e.key } 560 561 // ErrorName returns error name. 562 func (e DnsTable_DnsServiceValidationError) ErrorName() string { 563 return "DnsTable_DnsServiceValidationError" 564 } 565 566 // Error satisfies the builtin error interface 567 func (e DnsTable_DnsServiceValidationError) Error() string { 568 cause := "" 569 if e.cause != nil { 570 cause = fmt.Sprintf(" | caused by: %v", e.cause) 571 } 572 573 key := "" 574 if e.key { 575 key = "key for " 576 } 577 578 return fmt.Sprintf( 579 "invalid %sDnsTable_DnsService.%s: %s%s", 580 key, 581 e.field, 582 e.reason, 583 cause) 584 } 585 586 var _ error = DnsTable_DnsServiceValidationError{} 587 588 var _ interface { 589 Field() string 590 Reason() string 591 Key() bool 592 Cause() error 593 ErrorName() string 594 } = DnsTable_DnsServiceValidationError{} 595 596 var _DnsTable_DnsService_ServiceName_Pattern = regexp.MustCompile("^:?[0-9a-zA-Z!#$%&'*+-.^_|~`]+$") 597 598 // Validate checks the field values on DnsTable_DnsServiceList with the rules 599 // defined in the proto definition for this message. If any rules are 600 // violated, an error is returned. 601 func (m *DnsTable_DnsServiceList) Validate() error { 602 if m == nil { 603 return nil 604 } 605 606 if len(m.GetServices()) < 1 { 607 return DnsTable_DnsServiceListValidationError{ 608 field: "Services", 609 reason: "value must contain at least 1 item(s)", 610 } 611 } 612 613 for idx, item := range m.GetServices() { 614 _, _ = idx, item 615 616 if v, ok := interface{}(item).(interface{ Validate() error }); ok { 617 if err := v.Validate(); err != nil { 618 return DnsTable_DnsServiceListValidationError{ 619 field: fmt.Sprintf("Services[%v]", idx), 620 reason: "embedded message failed validation", 621 cause: err, 622 } 623 } 624 } 625 626 } 627 628 return nil 629 } 630 631 // DnsTable_DnsServiceListValidationError is the validation error returned by 632 // DnsTable_DnsServiceList.Validate if the designated constraints aren't met. 633 type DnsTable_DnsServiceListValidationError struct { 634 field string 635 reason string 636 cause error 637 key bool 638 } 639 640 // Field function returns field value. 641 func (e DnsTable_DnsServiceListValidationError) Field() string { return e.field } 642 643 // Reason function returns reason value. 644 func (e DnsTable_DnsServiceListValidationError) Reason() string { return e.reason } 645 646 // Cause function returns cause value. 647 func (e DnsTable_DnsServiceListValidationError) Cause() error { return e.cause } 648 649 // Key function returns key value. 650 func (e DnsTable_DnsServiceListValidationError) Key() bool { return e.key } 651 652 // ErrorName returns error name. 653 func (e DnsTable_DnsServiceListValidationError) ErrorName() string { 654 return "DnsTable_DnsServiceListValidationError" 655 } 656 657 // Error satisfies the builtin error interface 658 func (e DnsTable_DnsServiceListValidationError) Error() string { 659 cause := "" 660 if e.cause != nil { 661 cause = fmt.Sprintf(" | caused by: %v", e.cause) 662 } 663 664 key := "" 665 if e.key { 666 key = "key for " 667 } 668 669 return fmt.Sprintf( 670 "invalid %sDnsTable_DnsServiceList.%s: %s%s", 671 key, 672 e.field, 673 e.reason, 674 cause) 675 } 676 677 var _ error = DnsTable_DnsServiceListValidationError{} 678 679 var _ interface { 680 Field() string 681 Reason() string 682 Key() bool 683 Cause() error 684 ErrorName() string 685 } = DnsTable_DnsServiceListValidationError{} 686 687 // Validate checks the field values on DnsTable_DnsEndpoint with the rules 688 // defined in the proto definition for this message. If any rules are 689 // violated, an error is returned. 690 func (m *DnsTable_DnsEndpoint) Validate() error { 691 if m == nil { 692 return nil 693 } 694 695 switch m.EndpointConfig.(type) { 696 697 case *DnsTable_DnsEndpoint_AddressList: 698 699 if v, ok := interface{}(m.GetAddressList()).(interface{ Validate() error }); ok { 700 if err := v.Validate(); err != nil { 701 return DnsTable_DnsEndpointValidationError{ 702 field: "AddressList", 703 reason: "embedded message failed validation", 704 cause: err, 705 } 706 } 707 } 708 709 case *DnsTable_DnsEndpoint_ClusterName: 710 // no validation rules for ClusterName 711 712 case *DnsTable_DnsEndpoint_ServiceList: 713 714 if v, ok := interface{}(m.GetServiceList()).(interface{ Validate() error }); ok { 715 if err := v.Validate(); err != nil { 716 return DnsTable_DnsEndpointValidationError{ 717 field: "ServiceList", 718 reason: "embedded message failed validation", 719 cause: err, 720 } 721 } 722 } 723 724 default: 725 return DnsTable_DnsEndpointValidationError{ 726 field: "EndpointConfig", 727 reason: "value is required", 728 } 729 730 } 731 732 return nil 733 } 734 735 // DnsTable_DnsEndpointValidationError is the validation error returned by 736 // DnsTable_DnsEndpoint.Validate if the designated constraints aren't met. 737 type DnsTable_DnsEndpointValidationError struct { 738 field string 739 reason string 740 cause error 741 key bool 742 } 743 744 // Field function returns field value. 745 func (e DnsTable_DnsEndpointValidationError) Field() string { return e.field } 746 747 // Reason function returns reason value. 748 func (e DnsTable_DnsEndpointValidationError) Reason() string { return e.reason } 749 750 // Cause function returns cause value. 751 func (e DnsTable_DnsEndpointValidationError) Cause() error { return e.cause } 752 753 // Key function returns key value. 754 func (e DnsTable_DnsEndpointValidationError) Key() bool { return e.key } 755 756 // ErrorName returns error name. 757 func (e DnsTable_DnsEndpointValidationError) ErrorName() string { 758 return "DnsTable_DnsEndpointValidationError" 759 } 760 761 // Error satisfies the builtin error interface 762 func (e DnsTable_DnsEndpointValidationError) Error() string { 763 cause := "" 764 if e.cause != nil { 765 cause = fmt.Sprintf(" | caused by: %v", e.cause) 766 } 767 768 key := "" 769 if e.key { 770 key = "key for " 771 } 772 773 return fmt.Sprintf( 774 "invalid %sDnsTable_DnsEndpoint.%s: %s%s", 775 key, 776 e.field, 777 e.reason, 778 cause) 779 } 780 781 var _ error = DnsTable_DnsEndpointValidationError{} 782 783 var _ interface { 784 Field() string 785 Reason() string 786 Key() bool 787 Cause() error 788 ErrorName() string 789 } = DnsTable_DnsEndpointValidationError{} 790 791 // Validate checks the field values on DnsTable_DnsVirtualDomain with the rules 792 // defined in the proto definition for this message. If any rules are 793 // violated, an error is returned. 794 func (m *DnsTable_DnsVirtualDomain) Validate() error { 795 if m == nil { 796 return nil 797 } 798 799 if utf8.RuneCountInString(m.GetName()) < 1 { 800 return DnsTable_DnsVirtualDomainValidationError{ 801 field: "Name", 802 reason: "value length must be at least 1 runes", 803 } 804 } 805 806 if !_DnsTable_DnsVirtualDomain_Name_Pattern.MatchString(m.GetName()) { 807 return DnsTable_DnsVirtualDomainValidationError{ 808 field: "Name", 809 reason: "value does not match regex pattern \"^:?[0-9a-zA-Z!#$%&'*+-.^_|~`]+$\"", 810 } 811 } 812 813 if v, ok := interface{}(m.GetEndpoint()).(interface{ Validate() error }); ok { 814 if err := v.Validate(); err != nil { 815 return DnsTable_DnsVirtualDomainValidationError{ 816 field: "Endpoint", 817 reason: "embedded message failed validation", 818 cause: err, 819 } 820 } 821 } 822 823 if d := m.GetAnswerTtl(); d != nil { 824 dur, err := d.AsDuration(), d.CheckValid() 825 if err != nil { 826 return DnsTable_DnsVirtualDomainValidationError{ 827 field: "AnswerTtl", 828 reason: "value is not a valid duration", 829 cause: err, 830 } 831 } 832 833 gte := time.Duration(30*time.Second + 0*time.Nanosecond) 834 835 if dur < gte { 836 return DnsTable_DnsVirtualDomainValidationError{ 837 field: "AnswerTtl", 838 reason: "value must be greater than or equal to 30s", 839 } 840 } 841 842 } 843 844 return nil 845 } 846 847 // DnsTable_DnsVirtualDomainValidationError is the validation error returned by 848 // DnsTable_DnsVirtualDomain.Validate if the designated constraints aren't met. 849 type DnsTable_DnsVirtualDomainValidationError struct { 850 field string 851 reason string 852 cause error 853 key bool 854 } 855 856 // Field function returns field value. 857 func (e DnsTable_DnsVirtualDomainValidationError) Field() string { return e.field } 858 859 // Reason function returns reason value. 860 func (e DnsTable_DnsVirtualDomainValidationError) Reason() string { return e.reason } 861 862 // Cause function returns cause value. 863 func (e DnsTable_DnsVirtualDomainValidationError) Cause() error { return e.cause } 864 865 // Key function returns key value. 866 func (e DnsTable_DnsVirtualDomainValidationError) Key() bool { return e.key } 867 868 // ErrorName returns error name. 869 func (e DnsTable_DnsVirtualDomainValidationError) ErrorName() string { 870 return "DnsTable_DnsVirtualDomainValidationError" 871 } 872 873 // Error satisfies the builtin error interface 874 func (e DnsTable_DnsVirtualDomainValidationError) Error() string { 875 cause := "" 876 if e.cause != nil { 877 cause = fmt.Sprintf(" | caused by: %v", e.cause) 878 } 879 880 key := "" 881 if e.key { 882 key = "key for " 883 } 884 885 return fmt.Sprintf( 886 "invalid %sDnsTable_DnsVirtualDomain.%s: %s%s", 887 key, 888 e.field, 889 e.reason, 890 cause) 891 } 892 893 var _ error = DnsTable_DnsVirtualDomainValidationError{} 894 895 var _ interface { 896 Field() string 897 Reason() string 898 Key() bool 899 Cause() error 900 ErrorName() string 901 } = DnsTable_DnsVirtualDomainValidationError{} 902 903 var _DnsTable_DnsVirtualDomain_Name_Pattern = regexp.MustCompile("^:?[0-9a-zA-Z!#$%&'*+-.^_|~`]+$")