github.com/hxx258456/ccgo@v0.0.5-0.20230213014102-48b35f46f66f/go-control-plane/envoy/config/endpoint/v3/endpoint_components.pb.validate.go (about) 1 // Code generated by protoc-gen-validate. DO NOT EDIT. 2 // source: envoy/config/endpoint/v3/endpoint_components.proto 3 4 package envoy_config_endpoint_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 v3 "github.com/hxx258456/ccgo/go-control-plane/envoy/config/core/v3" 21 ) 22 23 // ensure the imports are used 24 var ( 25 _ = bytes.MinRead 26 _ = errors.New("") 27 _ = fmt.Print 28 _ = utf8.UTFMax 29 _ = (*regexp.Regexp)(nil) 30 _ = (*strings.Reader)(nil) 31 _ = net.IPv4len 32 _ = time.Duration(0) 33 _ = (*url.URL)(nil) 34 _ = (*mail.Address)(nil) 35 _ = anypb.Any{} 36 37 _ = v3.HealthStatus(0) 38 ) 39 40 // Validate checks the field values on Endpoint with the rules defined in the 41 // proto definition for this message. If any rules are violated, an error is returned. 42 func (m *Endpoint) Validate() error { 43 if m == nil { 44 return nil 45 } 46 47 if v, ok := interface{}(m.GetAddress()).(interface{ Validate() error }); ok { 48 if err := v.Validate(); err != nil { 49 return EndpointValidationError{ 50 field: "Address", 51 reason: "embedded message failed validation", 52 cause: err, 53 } 54 } 55 } 56 57 if v, ok := interface{}(m.GetHealthCheckConfig()).(interface{ Validate() error }); ok { 58 if err := v.Validate(); err != nil { 59 return EndpointValidationError{ 60 field: "HealthCheckConfig", 61 reason: "embedded message failed validation", 62 cause: err, 63 } 64 } 65 } 66 67 // no validation rules for Hostname 68 69 return nil 70 } 71 72 // EndpointValidationError is the validation error returned by 73 // Endpoint.Validate if the designated constraints aren't met. 74 type EndpointValidationError struct { 75 field string 76 reason string 77 cause error 78 key bool 79 } 80 81 // Field function returns field value. 82 func (e EndpointValidationError) Field() string { return e.field } 83 84 // Reason function returns reason value. 85 func (e EndpointValidationError) Reason() string { return e.reason } 86 87 // Cause function returns cause value. 88 func (e EndpointValidationError) Cause() error { return e.cause } 89 90 // Key function returns key value. 91 func (e EndpointValidationError) Key() bool { return e.key } 92 93 // ErrorName returns error name. 94 func (e EndpointValidationError) ErrorName() string { return "EndpointValidationError" } 95 96 // Error satisfies the builtin error interface 97 func (e EndpointValidationError) Error() string { 98 cause := "" 99 if e.cause != nil { 100 cause = fmt.Sprintf(" | caused by: %v", e.cause) 101 } 102 103 key := "" 104 if e.key { 105 key = "key for " 106 } 107 108 return fmt.Sprintf( 109 "invalid %sEndpoint.%s: %s%s", 110 key, 111 e.field, 112 e.reason, 113 cause) 114 } 115 116 var _ error = EndpointValidationError{} 117 118 var _ interface { 119 Field() string 120 Reason() string 121 Key() bool 122 Cause() error 123 ErrorName() string 124 } = EndpointValidationError{} 125 126 // Validate checks the field values on LbEndpoint with the rules defined in the 127 // proto definition for this message. If any rules are violated, an error is returned. 128 func (m *LbEndpoint) Validate() error { 129 if m == nil { 130 return nil 131 } 132 133 // no validation rules for HealthStatus 134 135 if v, ok := interface{}(m.GetMetadata()).(interface{ Validate() error }); ok { 136 if err := v.Validate(); err != nil { 137 return LbEndpointValidationError{ 138 field: "Metadata", 139 reason: "embedded message failed validation", 140 cause: err, 141 } 142 } 143 } 144 145 if wrapper := m.GetLoadBalancingWeight(); wrapper != nil { 146 147 if wrapper.GetValue() < 1 { 148 return LbEndpointValidationError{ 149 field: "LoadBalancingWeight", 150 reason: "value must be greater than or equal to 1", 151 } 152 } 153 154 } 155 156 switch m.HostIdentifier.(type) { 157 158 case *LbEndpoint_Endpoint: 159 160 if v, ok := interface{}(m.GetEndpoint()).(interface{ Validate() error }); ok { 161 if err := v.Validate(); err != nil { 162 return LbEndpointValidationError{ 163 field: "Endpoint", 164 reason: "embedded message failed validation", 165 cause: err, 166 } 167 } 168 } 169 170 case *LbEndpoint_EndpointName: 171 // no validation rules for EndpointName 172 173 } 174 175 return nil 176 } 177 178 // LbEndpointValidationError is the validation error returned by 179 // LbEndpoint.Validate if the designated constraints aren't met. 180 type LbEndpointValidationError struct { 181 field string 182 reason string 183 cause error 184 key bool 185 } 186 187 // Field function returns field value. 188 func (e LbEndpointValidationError) Field() string { return e.field } 189 190 // Reason function returns reason value. 191 func (e LbEndpointValidationError) Reason() string { return e.reason } 192 193 // Cause function returns cause value. 194 func (e LbEndpointValidationError) Cause() error { return e.cause } 195 196 // Key function returns key value. 197 func (e LbEndpointValidationError) Key() bool { return e.key } 198 199 // ErrorName returns error name. 200 func (e LbEndpointValidationError) ErrorName() string { return "LbEndpointValidationError" } 201 202 // Error satisfies the builtin error interface 203 func (e LbEndpointValidationError) Error() string { 204 cause := "" 205 if e.cause != nil { 206 cause = fmt.Sprintf(" | caused by: %v", e.cause) 207 } 208 209 key := "" 210 if e.key { 211 key = "key for " 212 } 213 214 return fmt.Sprintf( 215 "invalid %sLbEndpoint.%s: %s%s", 216 key, 217 e.field, 218 e.reason, 219 cause) 220 } 221 222 var _ error = LbEndpointValidationError{} 223 224 var _ interface { 225 Field() string 226 Reason() string 227 Key() bool 228 Cause() error 229 ErrorName() string 230 } = LbEndpointValidationError{} 231 232 // Validate checks the field values on LedsClusterLocalityConfig with the rules 233 // defined in the proto definition for this message. If any rules are 234 // violated, an error is returned. 235 func (m *LedsClusterLocalityConfig) Validate() error { 236 if m == nil { 237 return nil 238 } 239 240 if v, ok := interface{}(m.GetLedsConfig()).(interface{ Validate() error }); ok { 241 if err := v.Validate(); err != nil { 242 return LedsClusterLocalityConfigValidationError{ 243 field: "LedsConfig", 244 reason: "embedded message failed validation", 245 cause: err, 246 } 247 } 248 } 249 250 // no validation rules for LedsCollectionName 251 252 return nil 253 } 254 255 // LedsClusterLocalityConfigValidationError is the validation error returned by 256 // LedsClusterLocalityConfig.Validate if the designated constraints aren't met. 257 type LedsClusterLocalityConfigValidationError struct { 258 field string 259 reason string 260 cause error 261 key bool 262 } 263 264 // Field function returns field value. 265 func (e LedsClusterLocalityConfigValidationError) Field() string { return e.field } 266 267 // Reason function returns reason value. 268 func (e LedsClusterLocalityConfigValidationError) Reason() string { return e.reason } 269 270 // Cause function returns cause value. 271 func (e LedsClusterLocalityConfigValidationError) Cause() error { return e.cause } 272 273 // Key function returns key value. 274 func (e LedsClusterLocalityConfigValidationError) Key() bool { return e.key } 275 276 // ErrorName returns error name. 277 func (e LedsClusterLocalityConfigValidationError) ErrorName() string { 278 return "LedsClusterLocalityConfigValidationError" 279 } 280 281 // Error satisfies the builtin error interface 282 func (e LedsClusterLocalityConfigValidationError) Error() string { 283 cause := "" 284 if e.cause != nil { 285 cause = fmt.Sprintf(" | caused by: %v", e.cause) 286 } 287 288 key := "" 289 if e.key { 290 key = "key for " 291 } 292 293 return fmt.Sprintf( 294 "invalid %sLedsClusterLocalityConfig.%s: %s%s", 295 key, 296 e.field, 297 e.reason, 298 cause) 299 } 300 301 var _ error = LedsClusterLocalityConfigValidationError{} 302 303 var _ interface { 304 Field() string 305 Reason() string 306 Key() bool 307 Cause() error 308 ErrorName() string 309 } = LedsClusterLocalityConfigValidationError{} 310 311 // Validate checks the field values on LocalityLbEndpoints with the rules 312 // defined in the proto definition for this message. If any rules are 313 // violated, an error is returned. 314 func (m *LocalityLbEndpoints) Validate() error { 315 if m == nil { 316 return nil 317 } 318 319 if v, ok := interface{}(m.GetLocality()).(interface{ Validate() error }); ok { 320 if err := v.Validate(); err != nil { 321 return LocalityLbEndpointsValidationError{ 322 field: "Locality", 323 reason: "embedded message failed validation", 324 cause: err, 325 } 326 } 327 } 328 329 for idx, item := range m.GetLbEndpoints() { 330 _, _ = idx, item 331 332 if v, ok := interface{}(item).(interface{ Validate() error }); ok { 333 if err := v.Validate(); err != nil { 334 return LocalityLbEndpointsValidationError{ 335 field: fmt.Sprintf("LbEndpoints[%v]", idx), 336 reason: "embedded message failed validation", 337 cause: err, 338 } 339 } 340 } 341 342 } 343 344 if wrapper := m.GetLoadBalancingWeight(); wrapper != nil { 345 346 if wrapper.GetValue() < 1 { 347 return LocalityLbEndpointsValidationError{ 348 field: "LoadBalancingWeight", 349 reason: "value must be greater than or equal to 1", 350 } 351 } 352 353 } 354 355 if m.GetPriority() > 128 { 356 return LocalityLbEndpointsValidationError{ 357 field: "Priority", 358 reason: "value must be less than or equal to 128", 359 } 360 } 361 362 if v, ok := interface{}(m.GetProximity()).(interface{ Validate() error }); ok { 363 if err := v.Validate(); err != nil { 364 return LocalityLbEndpointsValidationError{ 365 field: "Proximity", 366 reason: "embedded message failed validation", 367 cause: err, 368 } 369 } 370 } 371 372 switch m.LbConfig.(type) { 373 374 case *LocalityLbEndpoints_LoadBalancerEndpoints: 375 376 if v, ok := interface{}(m.GetLoadBalancerEndpoints()).(interface{ Validate() error }); ok { 377 if err := v.Validate(); err != nil { 378 return LocalityLbEndpointsValidationError{ 379 field: "LoadBalancerEndpoints", 380 reason: "embedded message failed validation", 381 cause: err, 382 } 383 } 384 } 385 386 case *LocalityLbEndpoints_LedsClusterLocalityConfig: 387 388 if v, ok := interface{}(m.GetLedsClusterLocalityConfig()).(interface{ Validate() error }); ok { 389 if err := v.Validate(); err != nil { 390 return LocalityLbEndpointsValidationError{ 391 field: "LedsClusterLocalityConfig", 392 reason: "embedded message failed validation", 393 cause: err, 394 } 395 } 396 } 397 398 } 399 400 return nil 401 } 402 403 // LocalityLbEndpointsValidationError is the validation error returned by 404 // LocalityLbEndpoints.Validate if the designated constraints aren't met. 405 type LocalityLbEndpointsValidationError struct { 406 field string 407 reason string 408 cause error 409 key bool 410 } 411 412 // Field function returns field value. 413 func (e LocalityLbEndpointsValidationError) Field() string { return e.field } 414 415 // Reason function returns reason value. 416 func (e LocalityLbEndpointsValidationError) Reason() string { return e.reason } 417 418 // Cause function returns cause value. 419 func (e LocalityLbEndpointsValidationError) Cause() error { return e.cause } 420 421 // Key function returns key value. 422 func (e LocalityLbEndpointsValidationError) Key() bool { return e.key } 423 424 // ErrorName returns error name. 425 func (e LocalityLbEndpointsValidationError) ErrorName() string { 426 return "LocalityLbEndpointsValidationError" 427 } 428 429 // Error satisfies the builtin error interface 430 func (e LocalityLbEndpointsValidationError) Error() string { 431 cause := "" 432 if e.cause != nil { 433 cause = fmt.Sprintf(" | caused by: %v", e.cause) 434 } 435 436 key := "" 437 if e.key { 438 key = "key for " 439 } 440 441 return fmt.Sprintf( 442 "invalid %sLocalityLbEndpoints.%s: %s%s", 443 key, 444 e.field, 445 e.reason, 446 cause) 447 } 448 449 var _ error = LocalityLbEndpointsValidationError{} 450 451 var _ interface { 452 Field() string 453 Reason() string 454 Key() bool 455 Cause() error 456 ErrorName() string 457 } = LocalityLbEndpointsValidationError{} 458 459 // Validate checks the field values on Endpoint_HealthCheckConfig with the 460 // rules defined in the proto definition for this message. If any rules are 461 // violated, an error is returned. 462 func (m *Endpoint_HealthCheckConfig) Validate() error { 463 if m == nil { 464 return nil 465 } 466 467 if m.GetPortValue() > 65535 { 468 return Endpoint_HealthCheckConfigValidationError{ 469 field: "PortValue", 470 reason: "value must be less than or equal to 65535", 471 } 472 } 473 474 // no validation rules for Hostname 475 476 return nil 477 } 478 479 // Endpoint_HealthCheckConfigValidationError is the validation error returned 480 // by Endpoint_HealthCheckConfig.Validate if the designated constraints aren't met. 481 type Endpoint_HealthCheckConfigValidationError struct { 482 field string 483 reason string 484 cause error 485 key bool 486 } 487 488 // Field function returns field value. 489 func (e Endpoint_HealthCheckConfigValidationError) Field() string { return e.field } 490 491 // Reason function returns reason value. 492 func (e Endpoint_HealthCheckConfigValidationError) Reason() string { return e.reason } 493 494 // Cause function returns cause value. 495 func (e Endpoint_HealthCheckConfigValidationError) Cause() error { return e.cause } 496 497 // Key function returns key value. 498 func (e Endpoint_HealthCheckConfigValidationError) Key() bool { return e.key } 499 500 // ErrorName returns error name. 501 func (e Endpoint_HealthCheckConfigValidationError) ErrorName() string { 502 return "Endpoint_HealthCheckConfigValidationError" 503 } 504 505 // Error satisfies the builtin error interface 506 func (e Endpoint_HealthCheckConfigValidationError) Error() string { 507 cause := "" 508 if e.cause != nil { 509 cause = fmt.Sprintf(" | caused by: %v", e.cause) 510 } 511 512 key := "" 513 if e.key { 514 key = "key for " 515 } 516 517 return fmt.Sprintf( 518 "invalid %sEndpoint_HealthCheckConfig.%s: %s%s", 519 key, 520 e.field, 521 e.reason, 522 cause) 523 } 524 525 var _ error = Endpoint_HealthCheckConfigValidationError{} 526 527 var _ interface { 528 Field() string 529 Reason() string 530 Key() bool 531 Cause() error 532 ErrorName() string 533 } = Endpoint_HealthCheckConfigValidationError{} 534 535 // Validate checks the field values on LocalityLbEndpoints_LbEndpointList with 536 // the rules defined in the proto definition for this message. If any rules 537 // are violated, an error is returned. 538 func (m *LocalityLbEndpoints_LbEndpointList) Validate() error { 539 if m == nil { 540 return nil 541 } 542 543 for idx, item := range m.GetLbEndpoints() { 544 _, _ = idx, item 545 546 if v, ok := interface{}(item).(interface{ Validate() error }); ok { 547 if err := v.Validate(); err != nil { 548 return LocalityLbEndpoints_LbEndpointListValidationError{ 549 field: fmt.Sprintf("LbEndpoints[%v]", idx), 550 reason: "embedded message failed validation", 551 cause: err, 552 } 553 } 554 } 555 556 } 557 558 return nil 559 } 560 561 // LocalityLbEndpoints_LbEndpointListValidationError is the validation error 562 // returned by LocalityLbEndpoints_LbEndpointList.Validate if the designated 563 // constraints aren't met. 564 type LocalityLbEndpoints_LbEndpointListValidationError struct { 565 field string 566 reason string 567 cause error 568 key bool 569 } 570 571 // Field function returns field value. 572 func (e LocalityLbEndpoints_LbEndpointListValidationError) Field() string { return e.field } 573 574 // Reason function returns reason value. 575 func (e LocalityLbEndpoints_LbEndpointListValidationError) Reason() string { return e.reason } 576 577 // Cause function returns cause value. 578 func (e LocalityLbEndpoints_LbEndpointListValidationError) Cause() error { return e.cause } 579 580 // Key function returns key value. 581 func (e LocalityLbEndpoints_LbEndpointListValidationError) Key() bool { return e.key } 582 583 // ErrorName returns error name. 584 func (e LocalityLbEndpoints_LbEndpointListValidationError) ErrorName() string { 585 return "LocalityLbEndpoints_LbEndpointListValidationError" 586 } 587 588 // Error satisfies the builtin error interface 589 func (e LocalityLbEndpoints_LbEndpointListValidationError) Error() string { 590 cause := "" 591 if e.cause != nil { 592 cause = fmt.Sprintf(" | caused by: %v", e.cause) 593 } 594 595 key := "" 596 if e.key { 597 key = "key for " 598 } 599 600 return fmt.Sprintf( 601 "invalid %sLocalityLbEndpoints_LbEndpointList.%s: %s%s", 602 key, 603 e.field, 604 e.reason, 605 cause) 606 } 607 608 var _ error = LocalityLbEndpoints_LbEndpointListValidationError{} 609 610 var _ interface { 611 Field() string 612 Reason() string 613 Key() bool 614 Cause() error 615 ErrorName() string 616 } = LocalityLbEndpoints_LbEndpointListValidationError{}