| 1 |
//go:build !disable_pgv |
| 2 |
// Code generated by protoc-gen-validate. DO NOT EDIT. |
| 3 |
// source: envoy/config/cluster/v3/cluster.proto |
| 4 |
|
| 5 |
package clusterv3 |
| 6 |
|
| 7 |
import ( |
| 8 |
"bytes" |
| 9 |
"errors" |
| 10 |
"fmt" |
| 11 |
"net" |
| 12 |
"net/mail" |
| 13 |
"net/url" |
| 14 |
"regexp" |
| 15 |
"sort" |
| 16 |
"strings" |
| 17 |
"time" |
| 18 |
"unicode/utf8" |
| 19 |
|
| 20 |
"google.golang.org/protobuf/types/known/anypb" |
| 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 |
_ = sort.Sort |
| 37 |
) |
| 38 |
|
| 39 |
// Validate checks the field values on ClusterCollection with the rules defined |
| 40 |
// in the proto definition for this message. If any rules are violated, the |
| 41 |
// first error encountered is returned, or nil if there are no violations. |
| 42 |
func (m *ClusterCollection) Validate() error { |
| 43 |
return m.validate(false) |
| 44 |
} |
| 45 |
|
| 46 |
// ValidateAll checks the field values on ClusterCollection with the rules |
| 47 |
// defined in the proto definition for this message. If any rules are |
| 48 |
// violated, the result is a list of violation errors wrapped in |
| 49 |
// ClusterCollectionMultiError, or nil if none found. |
| 50 |
func (m *ClusterCollection) ValidateAll() error { |
| 51 |
return m.validate(true) |
| 52 |
} |
| 53 |
|
| 54 |
func (m *ClusterCollection) validate(all bool) error { |
| 55 |
if m == nil { |
| 56 |
return nil |
| 57 |
} |
| 58 |
|
| 59 |
var errors []error |
| 60 |
|
| 61 |
if all { |
| 62 |
switch v := interface{}(m.GetEntries()).(type) { |
| 63 |
case interface{ ValidateAll() error }: |
| 64 |
if err := v.ValidateAll(); err != nil { |
| 65 |
errors = append(errors, ClusterCollectionValidationError{ |
| 66 |
field: "Entries", |
| 67 |
reason: "embedded message failed validation", |
| 68 |
cause: err, |
| 69 |
}) |
| 70 |
} |
| 71 |
case interface{ Validate() error }: |
| 72 |
if err := v.Validate(); err != nil { |
| 73 |
errors = append(errors, ClusterCollectionValidationError{ |
| 74 |
field: "Entries", |
| 75 |
reason: "embedded message failed validation", |
| 76 |
cause: err, |
| 77 |
}) |
| 78 |
} |
| 79 |
} |
| 80 |
} else if v, ok := interface{}(m.GetEntries()).(interface{ Validate() error }); ok { |
| 81 |
if err := v.Validate(); err != nil { |
| 82 |
return ClusterCollectionValidationError{ |
| 83 |
field: "Entries", |
| 84 |
reason: "embedded message failed validation", |
| 85 |
cause: err, |
| 86 |
} |
| 87 |
} |
| 88 |
} |
| 89 |
|
| 90 |
if len(errors) > 0 { |
| 91 |
return ClusterCollectionMultiError(errors) |
| 92 |
} |
| 93 |
|
| 94 |
return nil |
| 95 |
} |
| 96 |
|
| 97 |
// ClusterCollectionMultiError is an error wrapping multiple validation errors |
| 98 |
// returned by ClusterCollection.ValidateAll() if the designated constraints |
| 99 |
// aren't met. |
| 100 |
type ClusterCollectionMultiError []error |
| 101 |
|
| 102 |
// Error returns a concatenation of all the error messages it wraps. |
| 103 |
func (m ClusterCollectionMultiError) Error() string { |
| 104 |
var msgs []string |
| 105 |
for _, err := range m { |
| 106 |
msgs = append(msgs, err.Error()) |
| 107 |
} |
| 108 |
return strings.Join(msgs, "; ") |
| 109 |
} |
| 110 |
|
| 111 |
// AllErrors returns a list of validation violation errors. |
| 112 |
func (m ClusterCollectionMultiError) AllErrors() []error { return m } |
| 113 |
|
| 114 |
// ClusterCollectionValidationError is the validation error returned by |
| 115 |
// ClusterCollection.Validate if the designated constraints aren't met. |
| 116 |
type ClusterCollectionValidationError struct { |
| 117 |
field string |
| 118 |
reason string |
| 119 |
cause error |
| 120 |
key bool |
| 121 |
} |
| 122 |
|
| 123 |
// Field function returns field value. |
| 124 |
func (e ClusterCollectionValidationError) Field() string { return e.field } |
| 125 |
|
| 126 |
// Reason function returns reason value. |
| 127 |
func (e ClusterCollectionValidationError) Reason() string { return e.reason } |
| 128 |
|
| 129 |
// Cause function returns cause value. |
| 130 |
func (e ClusterCollectionValidationError) Cause() error { return e.cause } |
| 131 |
|
| 132 |
// Key function returns key value. |
| 133 |
func (e ClusterCollectionValidationError) Key() bool { return e.key } |
| 134 |
|
| 135 |
// ErrorName returns error name. |
| 136 |
func (e ClusterCollectionValidationError) ErrorName() string { |
| 137 |
return "ClusterCollectionValidationError" |
| 138 |
} |
| 139 |
|
| 140 |
// Error satisfies the builtin error interface |
| 141 |
func (e ClusterCollectionValidationError) Error() string { |
| 142 |
cause := "" |
| 143 |
if e.cause != nil { |
| 144 |
cause = fmt.Sprintf(" | caused by: %v", e.cause) |
| 145 |
} |
| 146 |
|
| 147 |
key := "" |
| 148 |
if e.key { |
| 149 |
key = "key for " |
| 150 |
} |
| 151 |
|
| 152 |
return fmt.Sprintf( |
| 153 |
"invalid %sClusterCollection.%s: %s%s", |
| 154 |
key, |
| 155 |
e.field, |
| 156 |
e.reason, |
| 157 |
cause) |
| 158 |
} |
| 159 |
|
| 160 |
var _ error = ClusterCollectionValidationError{} |
| 161 |
|
| 162 |
var _ interface { |
| 163 |
Field() string |
| 164 |
Reason() string |
| 165 |
Key() bool |
| 166 |
Cause() error |
| 167 |
ErrorName() string |
| 168 |
} = ClusterCollectionValidationError{} |
| 169 |
|
| 170 |
// Validate checks the field values on Cluster with the rules defined in the |
| 171 |
// proto definition for this message. If any rules are violated, the first |
| 172 |
// error encountered is returned, or nil if there are no violations. |
| 173 |
func (m *Cluster) Validate() error { |
| 174 |
return m.validate(false) |
| 175 |
} |
| 176 |
|
| 177 |
// ValidateAll checks the field values on Cluster with the rules defined in the |
| 178 |
// proto definition for this message. If any rules are violated, the result is |
| 179 |
// a list of violation errors wrapped in ClusterMultiError, or nil if none found. |
| 180 |
func (m *Cluster) ValidateAll() error { |
| 181 |
return m.validate(true) |
| 182 |
} |
| 183 |
|
| 184 |
func (m *Cluster) validate(all bool) error { |
| 185 |
if m == nil { |
| 186 |
return nil |
| 187 |
} |
| 188 |
|
| 189 |
var errors []error |
| 190 |
|
| 191 |
for idx, item := range m.GetTransportSocketMatches() { |
| 192 |
_, _ = idx, item |
| 193 |
|
| 194 |
if all { |
| 195 |
switch v := interface{}(item).(type) { |
| 196 |
case interface{ ValidateAll() error }: |
| 197 |
if err := v.ValidateAll(); err != nil { |
| 198 |
errors = append(errors, ClusterValidationError{ |
| 199 |
field: fmt.Sprintf("TransportSocketMatches[%v]", idx), |
| 200 |
reason: "embedded message failed validation", |
| 201 |
cause: err, |
| 202 |
}) |
| 203 |
} |
| 204 |
case interface{ Validate() error }: |
| 205 |
if err := v.Validate(); err != nil { |
| 206 |
errors = append(errors, ClusterValidationError{ |
| 207 |
field: fmt.Sprintf("TransportSocketMatches[%v]", idx), |
| 208 |
reason: "embedded message failed validation", |
| 209 |
cause: err, |
| 210 |
}) |
| 211 |
} |
| 212 |
} |
| 213 |
} else if v, ok := interface{}(item).(interface{ Validate() error }); ok { |
| 214 |
if err := v.Validate(); err != nil { |
| 215 |
return ClusterValidationError{ |
| 216 |
field: fmt.Sprintf("TransportSocketMatches[%v]", idx), |
| 217 |
reason: "embedded message failed validation", |
| 218 |
cause: err, |
| 219 |
} |
| 220 |
} |
| 221 |
} |
| 222 |
|
| 223 |
} |
| 224 |
|
| 225 |
if utf8.RuneCountInString(m.GetName()) < 1 { |
| 226 |
err := ClusterValidationError{ |
| 227 |
field: "Name", |
| 228 |
reason: "value length must be at least 1 runes", |
| 229 |
} |
| 230 |
if !all { |
| 231 |
return err |
| 232 |
} |
| 233 |
errors = append(errors, err) |
| 234 |
} |
| 235 |
|
| 236 |
// no validation rules for AltStatName |
| 237 |
|
| 238 |
if all { |
| 239 |
switch v := interface{}(m.GetEdsClusterConfig()).(type) { |
| 240 |
case interface{ ValidateAll() error }: |
| 241 |
if err := v.ValidateAll(); err != nil { |
| 242 |
errors = append(errors, ClusterValidationError{ |
| 243 |
field: "EdsClusterConfig", |
| 244 |
reason: "embedded message failed validation", |
| 245 |
cause: err, |
| 246 |
}) |
| 247 |
} |
| 248 |
case interface{ Validate() error }: |
| 249 |
if err := v.Validate(); err != nil { |
| 250 |
errors = append(errors, ClusterValidationError{ |
| 251 |
field: "EdsClusterConfig", |
| 252 |
reason: "embedded message failed validation", |
| 253 |
cause: err, |
| 254 |
}) |
| 255 |
} |
| 256 |
} |
| 257 |
} else if v, ok := interface{}(m.GetEdsClusterConfig()).(interface{ Validate() error }); ok { |
| 258 |
if err := v.Validate(); err != nil { |
| 259 |
return ClusterValidationError{ |
| 260 |
field: "EdsClusterConfig", |
| 261 |
reason: "embedded message failed validation", |
| 262 |
cause: err, |
| 263 |
} |
| 264 |
} |
| 265 |
} |
| 266 |
|
| 267 |
if d := m.GetConnectTimeout(); d != nil { |
| 268 |
dur, err := d.AsDuration(), d.CheckValid() |
| 269 |
if err != nil { |
| 270 |
err = ClusterValidationError{ |
| 271 |
field: "ConnectTimeout", |
| 272 |
reason: "value is not a valid duration", |
| 273 |
cause: err, |
| 274 |
} |
| 275 |
if !all { |
| 276 |
return err |
| 277 |
} |
| 278 |
errors = append(errors, err) |
| 279 |
} else { |
| 280 |
|
| 281 |
gt := time.Duration(0*time.Second + 0*time.Nanosecond) |
| 282 |
|
| 283 |
if dur <= gt { |
| 284 |
err := ClusterValidationError{ |
| 285 |
field: "ConnectTimeout", |
| 286 |
reason: "value must be greater than 0s", |
| 287 |
} |
| 288 |
if !all { |
| 289 |
return err |
| 290 |
} |
| 291 |
errors = append(errors, err) |
| 292 |
} |
| 293 |
|
| 294 |
} |
| 295 |
} |
| 296 |
|
| 297 |
if all { |
| 298 |
switch v := interface{}(m.GetPerConnectionBufferLimitBytes()).(type) { |
| 299 |
case interface{ ValidateAll() error }: |
| 300 |
if err := v.ValidateAll(); err != nil { |
| 301 |
errors = append(errors, ClusterValidationError{ |
| 302 |
field: "PerConnectionBufferLimitBytes", |
| 303 |
reason: "embedded message failed validation", |
| 304 |
cause: err, |
| 305 |
}) |
| 306 |
} |
| 307 |
case interface{ Validate() error }: |
| 308 |
if err := v.Validate(); err != nil { |
| 309 |
errors = append(errors, ClusterValidationError{ |
| 310 |
field: "PerConnectionBufferLimitBytes", |
| 311 |
reason: "embedded message failed validation", |
| 312 |
cause: err, |
| 313 |
}) |
| 314 |
} |
| 315 |
} |
| 316 |
} else if v, ok := interface{}(m.GetPerConnectionBufferLimitBytes()).(interface{ Validate() error }); ok { |
| 317 |
if err := v.Validate(); err != nil { |
| 318 |
return ClusterValidationError{ |
| 319 |
field: "PerConnectionBufferLimitBytes", |
| 320 |
reason: "embedded message failed validation", |
| 321 |
cause: err, |
| 322 |
} |
| 323 |
} |
| 324 |
} |
| 325 |
|
| 326 |
if _, ok := Cluster_LbPolicy_name[int32(m.GetLbPolicy())]; !ok { |
| 327 |
err := ClusterValidationError{ |
| 328 |
field: "LbPolicy", |
| 329 |
reason: "value must be one of the defined enum values", |
| 330 |
} |
| 331 |
if !all { |
| 332 |
return err |
| 333 |
} |
| 334 |
errors = append(errors, err) |
| 335 |
} |
| 336 |
|
| 337 |
if all { |
| 338 |
switch v := interface{}(m.GetLoadAssignment()).(type) { |
| 339 |
case interface{ ValidateAll() error }: |
| 340 |
if err := v.ValidateAll(); err != nil { |
| 341 |
errors = append(errors, ClusterValidationError{ |
| 342 |
field: "LoadAssignment", |
| 343 |
reason: "embedded message failed validation", |
| 344 |
cause: err, |
| 345 |
}) |
| 346 |
} |
| 347 |
case interface{ Validate() error }: |
| 348 |
if err := v.Validate(); err != nil { |
| 349 |
errors = append(errors, ClusterValidationError{ |
| 350 |
field: "LoadAssignment", |
| 351 |
reason: "embedded message failed validation", |
| 352 |
cause: err, |
| 353 |
}) |
| 354 |
} |
| 355 |
} |
| 356 |
} else if v, ok := interface{}(m.GetLoadAssignment()).(interface{ Validate() error }); ok { |
| 357 |
if err := v.Validate(); err != nil { |
| 358 |
return ClusterValidationError{ |
| 359 |
field: "LoadAssignment", |
| 360 |
reason: "embedded message failed validation", |
| 361 |
cause: err, |
| 362 |
} |
| 363 |
} |
| 364 |
} |
| 365 |
|
| 366 |
for idx, item := range m.GetHealthChecks() { |
| 367 |
_, _ = idx, item |
| 368 |
|
| 369 |
if all { |
| 370 |
switch v := interface{}(item).(type) { |
| 371 |
case interface{ ValidateAll() error }: |
| 372 |
if err := v.ValidateAll(); err != nil { |
| 373 |
errors = append(errors, ClusterValidationError{ |
| 374 |
field: fmt.Sprintf("HealthChecks[%v]", idx), |
| 375 |
reason: "embedded message failed validation", |
| 376 |
cause: err, |
| 377 |
}) |
| 378 |
} |
| 379 |
case interface{ Validate() error }: |
| 380 |
if err := v.Validate(); err != nil { |
| 381 |
errors = append(errors, ClusterValidationError{ |
| 382 |
field: fmt.Sprintf("HealthChecks[%v]", idx), |
| 383 |
reason: "embedded message failed validation", |
| 384 |
cause: err, |
| 385 |
}) |
| 386 |
} |
| 387 |
} |
| 388 |
} else if v, ok := interface{}(item).(interface{ Validate() error }); ok { |
| 389 |
if err := v.Validate(); err != nil { |
| 390 |
return ClusterValidationError{ |
| 391 |
field: fmt.Sprintf("HealthChecks[%v]", idx), |
| 392 |
reason: "embedded message failed validation", |
| 393 |
cause: err, |
| 394 |
} |
| 395 |
} |
| 396 |
} |
| 397 |
|
| 398 |
} |
| 399 |
|
| 400 |
if all { |
| 401 |
switch v := interface{}(m.GetMaxRequestsPerConnection()).(type) { |
| 402 |
case interface{ ValidateAll() error }: |
| 403 |
if err := v.ValidateAll(); err != nil { |
| 404 |
errors = append(errors, ClusterValidationError{ |
| 405 |
field: "MaxRequestsPerConnection", |
| 406 |
reason: "embedded message failed validation", |
| 407 |
cause: err, |
| 408 |
}) |
| 409 |
} |
| 410 |
case interface{ Validate() error }: |
| 411 |
if err := v.Validate(); err != nil { |
| 412 |
errors = append(errors, ClusterValidationError{ |
| 413 |
field: "MaxRequestsPerConnection", |
| 414 |
reason: "embedded message failed validation", |
| 415 |
cause: err, |
| 416 |
}) |
| 417 |
} |
| 418 |
} |
| 419 |
} else if v, ok := interface{}(m.GetMaxRequestsPerConnection()).(interface{ Validate() error }); ok { |
| 420 |
if err := v.Validate(); err != nil { |
| 421 |
return ClusterValidationError{ |
| 422 |
field: "MaxRequestsPerConnection", |
| 423 |
reason: "embedded message failed validation", |
| 424 |
cause: err, |
| 425 |
} |
| 426 |
} |
| 427 |
} |
| 428 |
|
| 429 |
if all { |
| 430 |
switch v := interface{}(m.GetCircuitBreakers()).(type) { |
| 431 |
case interface{ ValidateAll() error }: |
| 432 |
if err := v.ValidateAll(); err != nil { |
| 433 |
errors = append(errors, ClusterValidationError{ |
| 434 |
field: "CircuitBreakers", |
| 435 |
reason: "embedded message failed validation", |
| 436 |
cause: err, |
| 437 |
}) |
| 438 |
} |
| 439 |
case interface{ Validate() error }: |
| 440 |
if err := v.Validate(); err != nil { |
| 441 |
errors = append(errors, ClusterValidationError{ |
| 442 |
field: "CircuitBreakers", |
| 443 |
reason: "embedded message failed validation", |
| 444 |
cause: err, |
| 445 |
}) |
| 446 |
} |
| 447 |
} |
| 448 |
} else if v, ok := interface{}(m.GetCircuitBreakers()).(interface{ Validate() error }); ok { |
| 449 |
if err := v.Validate(); err != nil { |
| 450 |
return ClusterValidationError{ |
| 451 |
field: "CircuitBreakers", |
| 452 |
reason: "embedded message failed validation", |
| 453 |
cause: err, |
| 454 |
} |
| 455 |
} |
| 456 |
} |
| 457 |
|
| 458 |
if all { |
| 459 |
switch v := interface{}(m.GetUpstreamHttpProtocolOptions()).(type) { |
| 460 |
case interface{ ValidateAll() error }: |
| 461 |
if err := v.ValidateAll(); err != nil { |
| 462 |
errors = append(errors, ClusterValidationError{ |
| 463 |
field: "UpstreamHttpProtocolOptions", |
| 464 |
reason: "embedded message failed validation", |
| 465 |
cause: err, |
| 466 |
}) |
| 467 |
} |
| 468 |
case interface{ Validate() error }: |
| 469 |
if err := v.Validate(); err != nil { |
| 470 |
errors = append(errors, ClusterValidationError{ |
| 471 |
field: "UpstreamHttpProtocolOptions", |
| 472 |
reason: "embedded message failed validation", |
| 473 |
cause: err, |
| 474 |
}) |
| 475 |
} |
| 476 |
} |
| 477 |
} else if v, ok := interface{}(m.GetUpstreamHttpProtocolOptions()).(interface{ Validate() error }); ok { |
| 478 |
if err := v.Validate(); err != nil { |
| 479 |
return ClusterValidationError{ |
| 480 |
field: "UpstreamHttpProtocolOptions", |
| 481 |
reason: "embedded message failed validation", |
| 482 |
cause: err, |
| 483 |
} |
| 484 |
} |
| 485 |
} |
| 486 |
|
| 487 |
if all { |
| 488 |
switch v := interface{}(m.GetCommonHttpProtocolOptions()).(type) { |
| 489 |
case interface{ ValidateAll() error }: |
| 490 |
if err := v.ValidateAll(); err != nil { |
| 491 |
errors = append(errors, ClusterValidationError{ |
| 492 |
field: "CommonHttpProtocolOptions", |
| 493 |
reason: "embedded message failed validation", |
| 494 |
cause: err, |
| 495 |
}) |
| 496 |
} |
| 497 |
case interface{ Validate() error }: |
| 498 |
if err := v.Validate(); err != nil { |
| 499 |
errors = append(errors, ClusterValidationError{ |
| 500 |
field: "CommonHttpProtocolOptions", |
| 501 |
reason: "embedded message failed validation", |
| 502 |
cause: err, |
| 503 |
}) |
| 504 |
} |
| 505 |
} |
| 506 |
} else if v, ok := interface{}(m.GetCommonHttpProtocolOptions()).(interface{ Validate() error }); ok { |
| 507 |
if err := v.Validate(); err != nil { |
| 508 |
return ClusterValidationError{ |
| 509 |
field: "CommonHttpProtocolOptions", |
| 510 |
reason: "embedded message failed validation", |
| 511 |
cause: err, |
| 512 |
} |
| 513 |
} |
| 514 |
} |
| 515 |
|
| 516 |
if all { |
| 517 |
switch v := interface{}(m.GetHttpProtocolOptions()).(type) { |
| 518 |
case interface{ ValidateAll() error }: |
| 519 |
if err := v.ValidateAll(); err != nil { |
| 520 |
errors = append(errors, ClusterValidationError{ |
| 521 |
field: "HttpProtocolOptions", |
| 522 |
reason: "embedded message failed validation", |
| 523 |
cause: err, |
| 524 |
}) |
| 525 |
} |
| 526 |
case interface{ Validate() error }: |
| 527 |
if err := v.Validate(); err != nil { |
| 528 |
errors = append(errors, ClusterValidationError{ |
| 529 |
field: "HttpProtocolOptions", |
| 530 |
reason: "embedded message failed validation", |
| 531 |
cause: err, |
| 532 |
}) |
| 533 |
} |
| 534 |
} |
| 535 |
} else if v, ok := interface{}(m.GetHttpProtocolOptions()).(interface{ Validate() error }); ok { |
| 536 |
if err := v.Validate(); err != nil { |
| 537 |
return ClusterValidationError{ |
| 538 |
field: "HttpProtocolOptions", |
| 539 |
reason: "embedded message failed validation", |
| 540 |
cause: err, |
| 541 |
} |
| 542 |
} |
| 543 |
} |
| 544 |
|
| 545 |
if all { |
| 546 |
switch v := interface{}(m.GetHttp2ProtocolOptions()).(type) { |
| 547 |
case interface{ ValidateAll() error }: |
| 548 |
if err := v.ValidateAll(); err != nil { |
| 549 |
errors = append(errors, ClusterValidationError{ |
| 550 |
field: "Http2ProtocolOptions", |
| 551 |
reason: "embedded message failed validation", |
| 552 |
cause: err, |
| 553 |
}) |
| 554 |
} |
| 555 |
case interface{ Validate() error }: |
| 556 |
if err := v.Validate(); err != nil { |
| 557 |
errors = append(errors, ClusterValidationError{ |
| 558 |
field: "Http2ProtocolOptions", |
| 559 |
reason: "embedded message failed validation", |
| 560 |
cause: err, |
| 561 |
}) |
| 562 |
} |
| 563 |
} |
| 564 |
} else if v, ok := interface{}(m.GetHttp2ProtocolOptions()).(interface{ Validate() error }); ok { |
| 565 |
if err := v.Validate(); err != nil { |
| 566 |
return ClusterValidationError{ |
| 567 |
field: "Http2ProtocolOptions", |
| 568 |
reason: "embedded message failed validation", |
| 569 |
cause: err, |
| 570 |
} |
| 571 |
} |
| 572 |
} |
| 573 |
|
| 574 |
{ |
| 575 |
sorted_keys := make([]string, len(m.GetTypedExtensionProtocolOptions())) |
| 576 |
i := 0 |
| 577 |
for key := range m.GetTypedExtensionProtocolOptions() { |
| 578 |
sorted_keys[i] = key |
| 579 |
i++ |
| 580 |
} |
| 581 |
sort.Slice(sorted_keys, func(i, j int) bool { return sorted_keys[i] < sorted_keys[j] }) |
| 582 |
for _, key := range sorted_keys { |
| 583 |
val := m.GetTypedExtensionProtocolOptions()[key] |
| 584 |
_ = val |
| 585 |
|
| 586 |
// no validation rules for TypedExtensionProtocolOptions[key] |
| 587 |
|
| 588 |
if all { |
| 589 |
switch v := interface{}(val).(type) { |
| 590 |
case interface{ ValidateAll() error }: |
| 591 |
if err := v.ValidateAll(); err != nil { |
| 592 |
errors = append(errors, ClusterValidationError{ |
| 593 |
field: fmt.Sprintf("TypedExtensionProtocolOptions[%v]", key), |
| 594 |
reason: "embedded message failed validation", |
| 595 |
cause: err, |
| 596 |
}) |
| 597 |
} |
| 598 |
case interface{ Validate() error }: |
| 599 |
if err := v.Validate(); err != nil { |
| 600 |
errors = append(errors, ClusterValidationError{ |
| 601 |
field: fmt.Sprintf("TypedExtensionProtocolOptions[%v]", key), |
| 602 |
reason: "embedded message failed validation", |
| 603 |
cause: err, |
| 604 |
}) |
| 605 |
} |
| 606 |
} |
| 607 |
} else if v, ok := interface{}(val).(interface{ Validate() error }); ok { |
| 608 |
if err := v.Validate(); err != nil { |
| 609 |
return ClusterValidationError{ |
| 610 |
field: fmt.Sprintf("TypedExtensionProtocolOptions[%v]", key), |
| 611 |
reason: "embedded message failed validation", |
| 612 |
cause: err, |
| 613 |
} |
| 614 |
} |
| 615 |
} |
| 616 |
|
| 617 |
} |
| 618 |
} |
| 619 |
|
| 620 |
if d := m.GetDnsRefreshRate(); d != nil { |
| 621 |
dur, err := d.AsDuration(), d.CheckValid() |
| 622 |
if err != nil { |
| 623 |
err = ClusterValidationError{ |
| 624 |
field: "DnsRefreshRate", |
| 625 |
reason: "value is not a valid duration", |
| 626 |
cause: err, |
| 627 |
} |
| 628 |
if !all { |
| 629 |
return err |
| 630 |
} |
| 631 |
errors = append(errors, err) |
| 632 |
} else { |
| 633 |
|
| 634 |
gt := time.Duration(0*time.Second + 1000000*time.Nanosecond) |
| 635 |
|
| 636 |
if dur <= gt { |
| 637 |
err := ClusterValidationError{ |
| 638 |
field: "DnsRefreshRate", |
| 639 |
reason: "value must be greater than 1ms", |
| 640 |
} |
| 641 |
if !all { |
| 642 |
return err |
| 643 |
} |
| 644 |
errors = append(errors, err) |
| 645 |
} |
| 646 |
|
| 647 |
} |
| 648 |
} |
| 649 |
|
| 650 |
if d := m.GetDnsJitter(); d != nil { |
| 651 |
dur, err := d.AsDuration(), d.CheckValid() |
| 652 |
if err != nil { |
| 653 |
err = ClusterValidationError{ |
| 654 |
field: "DnsJitter", |
| 655 |
reason: "value is not a valid duration", |
| 656 |
cause: err, |
| 657 |
} |
| 658 |
if !all { |
| 659 |
return err |
| 660 |
} |
| 661 |
errors = append(errors, err) |
| 662 |
} else { |
| 663 |
|
| 664 |
gte := time.Duration(0*time.Second + 0*time.Nanosecond) |
| 665 |
|
| 666 |
if dur < gte { |
| 667 |
err := ClusterValidationError{ |
| 668 |
field: "DnsJitter", |
| 669 |
reason: "value must be greater than or equal to 0s", |
| 670 |
} |
| 671 |
if !all { |
| 672 |
return err |
| 673 |
} |
| 674 |
errors = append(errors, err) |
| 675 |
} |
| 676 |
|
| 677 |
} |
| 678 |
} |
| 679 |
|
| 680 |
if all { |
| 681 |
switch v := interface{}(m.GetDnsFailureRefreshRate()).(type) { |
| 682 |
case interface{ ValidateAll() error }: |
| 683 |
if err := v.ValidateAll(); err != nil { |
| 684 |
errors = append(errors, ClusterValidationError{ |
| 685 |
field: "DnsFailureRefreshRate", |
| 686 |
reason: "embedded message failed validation", |
| 687 |
cause: err, |
| 688 |
}) |
| 689 |
} |
| 690 |
case interface{ Validate() error }: |
| 691 |
if err := v.Validate(); err != nil { |
| 692 |
errors = append(errors, ClusterValidationError{ |
| 693 |
field: "DnsFailureRefreshRate", |
| 694 |
reason: "embedded message failed validation", |
| 695 |
cause: err, |
| 696 |
}) |
| 697 |
} |
| 698 |
} |
| 699 |
} else if v, ok := interface{}(m.GetDnsFailureRefreshRate()).(interface{ Validate() error }); ok { |
| 700 |
if err := v.Validate(); err != nil { |
| 701 |
return ClusterValidationError{ |
| 702 |
field: "DnsFailureRefreshRate", |
| 703 |
reason: "embedded message failed validation", |
| 704 |
cause: err, |
| 705 |
} |
| 706 |
} |
| 707 |
} |
| 708 |
|
| 709 |
// no validation rules for RespectDnsTtl |
| 710 |
|
| 711 |
if _, ok := Cluster_DnsLookupFamily_name[int32(m.GetDnsLookupFamily())]; !ok { |
| 712 |
err := ClusterValidationError{ |
| 713 |
field: "DnsLookupFamily", |
| 714 |
reason: "value must be one of the defined enum values", |
| 715 |
} |
| 716 |
if !all { |
| 717 |
return err |
| 718 |
} |
| 719 |
errors = append(errors, err) |
| 720 |
} |
| 721 |
|
| 722 |
for idx, item := range m.GetDnsResolvers() { |
| 723 |
_, _ = idx, item |
| 724 |
|
| 725 |
if all { |
| 726 |
switch v := interface{}(item).(type) { |
| 727 |
case interface{ ValidateAll() error }: |
| 728 |
if err := v.ValidateAll(); err != nil { |
| 729 |
errors = append(errors, ClusterValidationError{ |
| 730 |
field: fmt.Sprintf("DnsResolvers[%v]", idx), |
| 731 |
reason: "embedded message failed validation", |
| 732 |
cause: err, |
| 733 |
}) |
| 734 |
} |
| 735 |
case interface{ Validate() error }: |
| 736 |
if err := v.Validate(); err != nil { |
| 737 |
errors = append(errors, ClusterValidationError{ |
| 738 |
field: fmt.Sprintf("DnsResolvers[%v]", idx), |
| 739 |
reason: "embedded message failed validation", |
| 740 |
cause: err, |
| 741 |
}) |
| 742 |
} |
| 743 |
} |
| 744 |
} else if v, ok := interface{}(item).(interface{ Validate() error }); ok { |
| 745 |
if err := v.Validate(); err != nil { |
| 746 |
return ClusterValidationError{ |
| 747 |
field: fmt.Sprintf("DnsResolvers[%v]", idx), |
| 748 |
reason: "embedded message failed validation", |
| 749 |
cause: err, |
| 750 |
} |
| 751 |
} |
| 752 |
} |
| 753 |
|
| 754 |
} |
| 755 |
|
| 756 |
// no validation rules for UseTcpForDnsLookups |
| 757 |
|
| 758 |
if all { |
| 759 |
switch v := interface{}(m.GetDnsResolutionConfig()).(type) { |
| 760 |
case interface{ ValidateAll() error }: |
| 761 |
if err := v.ValidateAll(); err != nil { |
| 762 |
errors = append(errors, ClusterValidationError{ |
| 763 |
field: "DnsResolutionConfig", |
| 764 |
reason: "embedded message failed validation", |
| 765 |
cause: err, |
| 766 |
}) |
| 767 |
} |
| 768 |
case interface{ Validate() error }: |
| 769 |
if err := v.Validate(); err != nil { |
| 770 |
errors = append(errors, ClusterValidationError{ |
| 771 |
field: "DnsResolutionConfig", |
| 772 |
reason: "embedded message failed validation", |
| 773 |
cause: err, |
| 774 |
}) |
| 775 |
} |
| 776 |
} |
| 777 |
} else if v, ok := interface{}(m.GetDnsResolutionConfig()).(interface{ Validate() error }); ok { |
| 778 |
if err := v.Validate(); err != nil { |
| 779 |
return ClusterValidationError{ |
| 780 |
field: "DnsResolutionConfig", |
| 781 |
reason: "embedded message failed validation", |
| 782 |
cause: err, |
| 783 |
} |
| 784 |
} |
| 785 |
} |
| 786 |
|
| 787 |
if all { |
| 788 |
switch v := interface{}(m.GetTypedDnsResolverConfig()).(type) { |
| 789 |
case interface{ ValidateAll() error }: |
| 790 |
if err := v.ValidateAll(); err != nil { |
| 791 |
errors = append(errors, ClusterValidationError{ |
| 792 |
field: "TypedDnsResolverConfig", |
| 793 |
reason: "embedded message failed validation", |
| 794 |
cause: err, |
| 795 |
}) |
| 796 |
} |
| 797 |
case interface{ Validate() error }: |
| 798 |
if err := v.Validate(); err != nil { |
| 799 |
errors = append(errors, ClusterValidationError{ |
| 800 |
field: "TypedDnsResolverConfig", |
| 801 |
reason: "embedded message failed validation", |
| 802 |
cause: err, |
| 803 |
}) |
| 804 |
} |
| 805 |
} |
| 806 |
} else if v, ok := interface{}(m.GetTypedDnsResolverConfig()).(interface{ Validate() error }); ok { |
| 807 |
if err := v.Validate(); err != nil { |
| 808 |
return ClusterValidationError{ |
| 809 |
field: "TypedDnsResolverConfig", |
| 810 |
reason: "embedded message failed validation", |
| 811 |
cause: err, |
| 812 |
} |
| 813 |
} |
| 814 |
} |
| 815 |
|
| 816 |
if all { |
| 817 |
switch v := interface{}(m.GetWaitForWarmOnInit()).(type) { |
| 818 |
case interface{ ValidateAll() error }: |
| 819 |
if err := v.ValidateAll(); err != nil { |
| 820 |
errors = append(errors, ClusterValidationError{ |
| 821 |
field: "WaitForWarmOnInit", |
| 822 |
reason: "embedded message failed validation", |
| 823 |
cause: err, |
| 824 |
}) |
| 825 |
} |
| 826 |
case interface{ Validate() error }: |
| 827 |
if err := v.Validate(); err != nil { |
| 828 |
errors = append(errors, ClusterValidationError{ |
| 829 |
field: "WaitForWarmOnInit", |
| 830 |
reason: "embedded message failed validation", |
| 831 |
cause: err, |
| 832 |
}) |
| 833 |
} |
| 834 |
} |
| 835 |
} else if v, ok := interface{}(m.GetWaitForWarmOnInit()).(interface{ Validate() error }); ok { |
| 836 |
if err := v.Validate(); err != nil { |
| 837 |
return ClusterValidationError{ |
| 838 |
field: "WaitForWarmOnInit", |
| 839 |
reason: "embedded message failed validation", |
| 840 |
cause: err, |
| 841 |
} |
| 842 |
} |
| 843 |
} |
| 844 |
|
| 845 |
if all { |
| 846 |
switch v := interface{}(m.GetOutlierDetection()).(type) { |
| 847 |
case interface{ ValidateAll() error }: |
| 848 |
if err := v.ValidateAll(); err != nil { |
| 849 |
errors = append(errors, ClusterValidationError{ |
| 850 |
field: "OutlierDetection", |
| 851 |
reason: "embedded message failed validation", |
| 852 |
cause: err, |
| 853 |
}) |
| 854 |
} |
| 855 |
case interface{ Validate() error }: |
| 856 |
if err := v.Validate(); err != nil { |
| 857 |
errors = append(errors, ClusterValidationError{ |
| 858 |
field: "OutlierDetection", |
| 859 |
reason: "embedded message failed validation", |
| 860 |
cause: err, |
| 861 |
}) |
| 862 |
} |
| 863 |
} |
| 864 |
} else if v, ok := interface{}(m.GetOutlierDetection()).(interface{ Validate() error }); ok { |
| 865 |
if err := v.Validate(); err != nil { |
| 866 |
return ClusterValidationError{ |
| 867 |
field: "OutlierDetection", |
| 868 |
reason: "embedded message failed validation", |
| 869 |
cause: err, |
| 870 |
} |
| 871 |
} |
| 872 |
} |
| 873 |
|
| 874 |
if d := m.GetCleanupInterval(); d != nil { |
| 875 |
dur, err := d.AsDuration(), d.CheckValid() |
| 876 |
if err != nil { |
| 877 |
err = ClusterValidationError{ |
| 878 |
field: "CleanupInterval", |
| 879 |
reason: "value is not a valid duration", |
| 880 |
cause: err, |
| 881 |
} |
| 882 |
if !all { |
| 883 |
return err |
| 884 |
} |
| 885 |
errors = append(errors, err) |
| 886 |
} else { |
| 887 |
|
| 888 |
gt := time.Duration(0*time.Second + 0*time.Nanosecond) |
| 889 |
|
| 890 |
if dur <= gt { |
| 891 |
err := ClusterValidationError{ |
| 892 |
field: "CleanupInterval", |
| 893 |
reason: "value must be greater than 0s", |
| 894 |
} |
| 895 |
if !all { |
| 896 |
return err |
| 897 |
} |
| 898 |
errors = append(errors, err) |
| 899 |
} |
| 900 |
|
| 901 |
} |
| 902 |
} |
| 903 |
|
| 904 |
if all { |
| 905 |
switch v := interface{}(m.GetUpstreamBindConfig()).(type) { |
| 906 |
case interface{ ValidateAll() error }: |
| 907 |
if err := v.ValidateAll(); err != nil { |
| 908 |
errors = append(errors, ClusterValidationError{ |
| 909 |
field: "UpstreamBindConfig", |
| 910 |
reason: "embedded message failed validation", |
| 911 |
cause: err, |
| 912 |
}) |
| 913 |
} |
| 914 |
case interface{ Validate() error }: |
| 915 |
if err := v.Validate(); err != nil { |
| 916 |
errors = append(errors, ClusterValidationError{ |
| 917 |
field: "UpstreamBindConfig", |
| 918 |
reason: "embedded message failed validation", |
| 919 |
cause: err, |
| 920 |
}) |
| 921 |
} |
| 922 |
} |
| 923 |
} else if v, ok := interface{}(m.GetUpstreamBindConfig()).(interface{ Validate() error }); ok { |
| 924 |
if err := v.Validate(); err != nil { |
| 925 |
return ClusterValidationError{ |
| 926 |
field: "UpstreamBindConfig", |
| 927 |
reason: "embedded message failed validation", |
| 928 |
cause: err, |
| 929 |
} |
| 930 |
} |
| 931 |
} |
| 932 |
|
| 933 |
if all { |
| 934 |
switch v := interface{}(m.GetLbSubsetConfig()).(type) { |
| 935 |
case interface{ ValidateAll() error }: |
| 936 |
if err := v.ValidateAll(); err != nil { |
| 937 |
errors = append(errors, ClusterValidationError{ |
| 938 |
field: "LbSubsetConfig", |
| 939 |
reason: "embedded message failed validation", |
| 940 |
cause: err, |
| 941 |
}) |
| 942 |
} |
| 943 |
case interface{ Validate() error }: |
| 944 |
if err := v.Validate(); err != nil { |
| 945 |
errors = append(errors, ClusterValidationError{ |
| 946 |
field: "LbSubsetConfig", |
| 947 |
reason: "embedded message failed validation", |
| 948 |
cause: err, |
| 949 |
}) |
| 950 |
} |
| 951 |
} |
| 952 |
} else if v, ok := interface{}(m.GetLbSubsetConfig()).(interface{ Validate() error }); ok { |
| 953 |
if err := v.Validate(); err != nil { |
| 954 |
return ClusterValidationError{ |
| 955 |
field: "LbSubsetConfig", |
| 956 |
reason: "embedded message failed validation", |
| 957 |
cause: err, |
| 958 |
} |
| 959 |
} |
| 960 |
} |
| 961 |
|
| 962 |
if all { |
| 963 |
switch v := interface{}(m.GetCommonLbConfig()).(type) { |
| 964 |
case interface{ ValidateAll() error }: |
| 965 |
if err := v.ValidateAll(); err != nil { |
| 966 |
errors = append(errors, ClusterValidationError{ |
| 967 |
field: "CommonLbConfig", |
| 968 |
reason: "embedded message failed validation", |
| 969 |
cause: err, |
| 970 |
}) |
| 971 |
} |
| 972 |
case interface{ Validate() error }: |
| 973 |
if err := v.Validate(); err != nil { |
| 974 |
errors = append(errors, ClusterValidationError{ |
| 975 |
field: "CommonLbConfig", |
| 976 |
reason: "embedded message failed validation", |
| 977 |
cause: err, |
| 978 |
}) |
| 979 |
} |
| 980 |
} |
| 981 |
} else if v, ok := interface{}(m.GetCommonLbConfig()).(interface{ Validate() error }); ok { |
| 982 |
if err := v.Validate(); err != nil { |
| 983 |
return ClusterValidationError{ |
| 984 |
field: "CommonLbConfig", |
| 985 |
reason: "embedded message failed validation", |
| 986 |
cause: err, |
| 987 |
} |
| 988 |
} |
| 989 |
} |
| 990 |
|
| 991 |
if all { |
| 992 |
switch v := interface{}(m.GetTransportSocket()).(type) { |
| 993 |
case interface{ ValidateAll() error }: |
| 994 |
if err := v.ValidateAll(); err != nil { |
| 995 |
errors = append(errors, ClusterValidationError{ |
| 996 |
field: "TransportSocket", |
| 997 |
reason: "embedded message failed validation", |
| 998 |
cause: err, |
| 999 |
}) |
| 1000 |
} |
| 1001 |
case interface{ Validate() error }: |
| 1002 |
if err := v.Validate(); err != nil { |
| 1003 |
errors = append(errors, ClusterValidationError{ |
| 1004 |
field: "TransportSocket", |
| 1005 |
reason: "embedded message failed validation", |
| 1006 |
cause: err, |
| 1007 |
}) |
| 1008 |
} |
| 1009 |
} |
| 1010 |
} else if v, ok := interface{}(m.GetTransportSocket()).(interface{ Validate() error }); ok { |
| 1011 |
if err := v.Validate(); err != nil { |
| 1012 |
return ClusterValidationError{ |
| 1013 |
field: "TransportSocket", |
| 1014 |
reason: "embedded message failed validation", |
| 1015 |
cause: err, |
| 1016 |
} |
| 1017 |
} |
| 1018 |
} |
| 1019 |
|
| 1020 |
if all { |
| 1021 |
switch v := interface{}(m.GetMetadata()).(type) { |
| 1022 |
case interface{ ValidateAll() error }: |
| 1023 |
if err := v.ValidateAll(); err != nil { |
| 1024 |
errors = append(errors, ClusterValidationError{ |
| 1025 |
field: "Metadata", |
| 1026 |
reason: "embedded message failed validation", |
| 1027 |
cause: err, |
| 1028 |
}) |
| 1029 |
} |
| 1030 |
case interface{ Validate() error }: |
| 1031 |
if err := v.Validate(); err != nil { |
| 1032 |
errors = append(errors, ClusterValidationError{ |
| 1033 |
field: "Metadata", |
| 1034 |
reason: "embedded message failed validation", |
| 1035 |
cause: err, |
| 1036 |
}) |
| 1037 |
} |
| 1038 |
} |
| 1039 |
} else if v, ok := interface{}(m.GetMetadata()).(interface{ Validate() error }); ok { |
| 1040 |
if err := v.Validate(); err != nil { |
| 1041 |
return ClusterValidationError{ |
| 1042 |
field: "Metadata", |
| 1043 |
reason: "embedded message failed validation", |
| 1044 |
cause: err, |
| 1045 |
} |
| 1046 |
} |
| 1047 |
} |
| 1048 |
|
| 1049 |
// no validation rules for ProtocolSelection |
| 1050 |
|
| 1051 |
if all { |
| 1052 |
switch v := interface{}(m.GetUpstreamConnectionOptions()).(type) { |
| 1053 |
case interface{ ValidateAll() error }: |
| 1054 |
if err := v.ValidateAll(); err != nil { |
| 1055 |
errors = append(errors, ClusterValidationError{ |
| 1056 |
field: "UpstreamConnectionOptions", |
| 1057 |
reason: "embedded message failed validation", |
| 1058 |
cause: err, |
| 1059 |
}) |
| 1060 |
} |
| 1061 |
case interface{ Validate() error }: |
| 1062 |
if err := v.Validate(); err != nil { |
| 1063 |
errors = append(errors, ClusterValidationError{ |
| 1064 |
field: "UpstreamConnectionOptions", |
| 1065 |
reason: "embedded message failed validation", |
| 1066 |
cause: err, |
| 1067 |
}) |
| 1068 |
} |
| 1069 |
} |
| 1070 |
} else if v, ok := interface{}(m.GetUpstreamConnectionOptions()).(interface{ Validate() error }); ok { |
| 1071 |
if err := v.Validate(); err != nil { |
| 1072 |
return ClusterValidationError{ |
| 1073 |
field: "UpstreamConnectionOptions", |
| 1074 |
reason: "embedded message failed validation", |
| 1075 |
cause: err, |
| 1076 |
} |
| 1077 |
} |
| 1078 |
} |
| 1079 |
|
| 1080 |
// no validation rules for CloseConnectionsOnHostHealthFailure |
| 1081 |
|
| 1082 |
// no validation rules for IgnoreHealthOnHostRemoval |
| 1083 |
|
| 1084 |
for idx, item := range m.GetFilters() { |
| 1085 |
_, _ = idx, item |
| 1086 |
|
| 1087 |
if all { |
| 1088 |
switch v := interface{}(item).(type) { |
| 1089 |
case interface{ ValidateAll() error }: |
| 1090 |
if err := v.ValidateAll(); err != nil { |
| 1091 |
errors = append(errors, ClusterValidationError{ |
| 1092 |
field: fmt.Sprintf("Filters[%v]", idx), |
| 1093 |
reason: "embedded message failed validation", |
| 1094 |
cause: err, |
| 1095 |
}) |
| 1096 |
} |
| 1097 |
case interface{ Validate() error }: |
| 1098 |
if err := v.Validate(); err != nil { |
| 1099 |
errors = append(errors, ClusterValidationError{ |
| 1100 |
field: fmt.Sprintf("Filters[%v]", idx), |
| 1101 |
reason: "embedded message failed validation", |
| 1102 |
cause: err, |
| 1103 |
}) |
| 1104 |
} |
| 1105 |
} |
| 1106 |
} else if v, ok := interface{}(item).(interface{ Validate() error }); ok { |
| 1107 |
if err := v.Validate(); err != nil { |
| 1108 |
return ClusterValidationError{ |
| 1109 |
field: fmt.Sprintf("Filters[%v]", idx), |
| 1110 |
reason: "embedded message failed validation", |
| 1111 |
cause: err, |
| 1112 |
} |
| 1113 |
} |
| 1114 |
} |
| 1115 |
|
| 1116 |
} |
| 1117 |
|
| 1118 |
if all { |
| 1119 |
switch v := interface{}(m.GetLoadBalancingPolicy()).(type) { |
| 1120 |
case interface{ ValidateAll() error }: |
| 1121 |
if err := v.ValidateAll(); err != nil { |
| 1122 |
errors = append(errors, ClusterValidationError{ |
| 1123 |
field: "LoadBalancingPolicy", |
| 1124 |
reason: "embedded message failed validation", |
| 1125 |
cause: err, |
| 1126 |
}) |
| 1127 |
} |
| 1128 |
case interface{ Validate() error }: |
| 1129 |
if err := v.Validate(); err != nil { |
| 1130 |
errors = append(errors, ClusterValidationError{ |
| 1131 |
field: "LoadBalancingPolicy", |
| 1132 |
reason: "embedded message failed validation", |
| 1133 |
cause: err, |
| 1134 |
}) |
| 1135 |
} |
| 1136 |
} |
| 1137 |
} else if v, ok := interface{}(m.GetLoadBalancingPolicy()).(interface{ Validate() error }); ok { |
| 1138 |
if err := v.Validate(); err != nil { |
| 1139 |
return ClusterValidationError{ |
| 1140 |
field: "LoadBalancingPolicy", |
| 1141 |
reason: "embedded message failed validation", |
| 1142 |
cause: err, |
| 1143 |
} |
| 1144 |
} |
| 1145 |
} |
| 1146 |
|
| 1147 |
if all { |
| 1148 |
switch v := interface{}(m.GetLrsServer()).(type) { |
| 1149 |
case interface{ ValidateAll() error }: |
| 1150 |
if err := v.ValidateAll(); err != nil { |
| 1151 |
errors = append(errors, ClusterValidationError{ |
| 1152 |
field: "LrsServer", |
| 1153 |
reason: "embedded message failed validation", |
| 1154 |
cause: err, |
| 1155 |
}) |
| 1156 |
} |
| 1157 |
case interface{ Validate() error }: |
| 1158 |
if err := v.Validate(); err != nil { |
| 1159 |
errors = append(errors, ClusterValidationError{ |
| 1160 |
field: "LrsServer", |
| 1161 |
reason: "embedded message failed validation", |
| 1162 |
cause: err, |
| 1163 |
}) |
| 1164 |
} |
| 1165 |
} |
| 1166 |
} else if v, ok := interface{}(m.GetLrsServer()).(interface{ Validate() error }); ok { |
| 1167 |
if err := v.Validate(); err != nil { |
| 1168 |
return ClusterValidationError{ |
| 1169 |
field: "LrsServer", |
| 1170 |
reason: "embedded message failed validation", |
| 1171 |
cause: err, |
| 1172 |
} |
| 1173 |
} |
| 1174 |
} |
| 1175 |
|
| 1176 |
// no validation rules for TrackTimeoutBudgets |
| 1177 |
|
| 1178 |
if all { |
| 1179 |
switch v := interface{}(m.GetUpstreamConfig()).(type) { |
| 1180 |
case interface{ ValidateAll() error }: |
| 1181 |
if err := v.ValidateAll(); err != nil { |
| 1182 |
errors = append(errors, ClusterValidationError{ |
| 1183 |
field: "UpstreamConfig", |
| 1184 |
reason: "embedded message failed validation", |
| 1185 |
cause: err, |
| 1186 |
}) |
| 1187 |
} |
| 1188 |
case interface{ Validate() error }: |
| 1189 |
if err := v.Validate(); err != nil { |
| 1190 |
errors = append(errors, ClusterValidationError{ |
| 1191 |
field: "UpstreamConfig", |
| 1192 |
reason: "embedded message failed validation", |
| 1193 |
cause: err, |
| 1194 |
}) |
| 1195 |
} |
| 1196 |
} |
| 1197 |
} else if v, ok := interface{}(m.GetUpstreamConfig()).(interface{ Validate() error }); ok { |
| 1198 |
if err := v.Validate(); err != nil { |
| 1199 |
return ClusterValidationError{ |
| 1200 |
field: "UpstreamConfig", |
| 1201 |
reason: "embedded message failed validation", |
| 1202 |
cause: err, |
| 1203 |
} |
| 1204 |
} |
| 1205 |
} |
| 1206 |
|
| 1207 |
if all { |
| 1208 |
switch v := interface{}(m.GetTrackClusterStats()).(type) { |
| 1209 |
case interface{ ValidateAll() error }: |
| 1210 |
if err := v.ValidateAll(); err != nil { |
| 1211 |
errors = append(errors, ClusterValidationError{ |
| 1212 |
field: "TrackClusterStats", |
| 1213 |
reason: "embedded message failed validation", |
| 1214 |
cause: err, |
| 1215 |
}) |
| 1216 |
} |
| 1217 |
case interface{ Validate() error }: |
| 1218 |
if err := v.Validate(); err != nil { |
| 1219 |
errors = append(errors, ClusterValidationError{ |
| 1220 |
field: "TrackClusterStats", |
| 1221 |
reason: "embedded message failed validation", |
| 1222 |
cause: err, |
| 1223 |
}) |
| 1224 |
} |
| 1225 |
} |
| 1226 |
} else if v, ok := interface{}(m.GetTrackClusterStats()).(interface{ Validate() error }); ok { |
| 1227 |
if err := v.Validate(); err != nil { |
| 1228 |
return ClusterValidationError{ |
| 1229 |
field: "TrackClusterStats", |
| 1230 |
reason: "embedded message failed validation", |
| 1231 |
cause: err, |
| 1232 |
} |
| 1233 |
} |
| 1234 |
} |
| 1235 |
|
| 1236 |
if all { |
| 1237 |
switch v := interface{}(m.GetPreconnectPolicy()).(type) { |
| 1238 |
case interface{ ValidateAll() error }: |
| 1239 |
if err := v.ValidateAll(); err != nil { |
| 1240 |
errors = append(errors, ClusterValidationError{ |
| 1241 |
field: "PreconnectPolicy", |
| 1242 |
reason: "embedded message failed validation", |
| 1243 |
cause: err, |
| 1244 |
}) |
| 1245 |
} |
| 1246 |
case interface{ Validate() error }: |
| 1247 |
if err := v.Validate(); err != nil { |
| 1248 |
errors = append(errors, ClusterValidationError{ |
| 1249 |
field: "PreconnectPolicy", |
| 1250 |
reason: "embedded message failed validation", |
| 1251 |
cause: err, |
| 1252 |
}) |
| 1253 |
} |
| 1254 |
} |
| 1255 |
} else if v, ok := interface{}(m.GetPreconnectPolicy()).(interface{ Validate() error }); ok { |
| 1256 |
if err := v.Validate(); err != nil { |
| 1257 |
return ClusterValidationError{ |
| 1258 |
field: "PreconnectPolicy", |
| 1259 |
reason: "embedded message failed validation", |
| 1260 |
cause: err, |
| 1261 |
} |
| 1262 |
} |
| 1263 |
} |
| 1264 |
|
| 1265 |
// no validation rules for ConnectionPoolPerDownstreamConnection |
| 1266 |
|
| 1267 |
switch v := m.ClusterDiscoveryType.(type) { |
| 1268 |
case *Cluster_Type: |
| 1269 |
if v == nil { |
| 1270 |
err := ClusterValidationError{ |
| 1271 |
field: "ClusterDiscoveryType", |
| 1272 |
reason: "oneof value cannot be a typed-nil", |
| 1273 |
} |
| 1274 |
if !all { |
| 1275 |
return err |
| 1276 |
} |
| 1277 |
errors = append(errors, err) |
| 1278 |
} |
| 1279 |
|
| 1280 |
if _, ok := Cluster_DiscoveryType_name[int32(m.GetType())]; !ok { |
| 1281 |
err := ClusterValidationError{ |
| 1282 |
field: "Type", |
| 1283 |
reason: "value must be one of the defined enum values", |
| 1284 |
} |
| 1285 |
if !all { |
| 1286 |
return err |
| 1287 |
} |
| 1288 |
errors = append(errors, err) |
| 1289 |
} |
| 1290 |
|
| 1291 |
case *Cluster_ClusterType: |
| 1292 |
if v == nil { |
| 1293 |
err := ClusterValidationError{ |
| 1294 |
field: "ClusterDiscoveryType", |
| 1295 |
reason: "oneof value cannot be a typed-nil", |
| 1296 |
} |
| 1297 |
if !all { |
| 1298 |
return err |
| 1299 |
} |
| 1300 |
errors = append(errors, err) |
| 1301 |
} |
| 1302 |
|
| 1303 |
if all { |
| 1304 |
switch v := interface{}(m.GetClusterType()).(type) { |
| 1305 |
case interface{ ValidateAll() error }: |
| 1306 |
if err := v.ValidateAll(); err != nil { |
| 1307 |
errors = append(errors, ClusterValidationError{ |
| 1308 |
field: "ClusterType", |
| 1309 |
reason: "embedded message failed validation", |
| 1310 |
cause: err, |
| 1311 |
}) |
| 1312 |
} |
| 1313 |
case interface{ Validate() error }: |
| 1314 |
if err := v.Validate(); err != nil { |
| 1315 |
errors = append(errors, ClusterValidationError{ |
| 1316 |
field: "ClusterType", |
| 1317 |
reason: "embedded message failed validation", |
| 1318 |
cause: err, |
| 1319 |
}) |
| 1320 |
} |
| 1321 |
} |
| 1322 |
} else if v, ok := interface{}(m.GetClusterType()).(interface{ Validate() error }); ok { |
| 1323 |
if err := v.Validate(); err != nil { |
| 1324 |
return ClusterValidationError{ |
| 1325 |
field: "ClusterType", |
| 1326 |
reason: "embedded message failed validation", |
| 1327 |
cause: err, |
| 1328 |
} |
| 1329 |
} |
| 1330 |
} |
| 1331 |
|
| 1332 |
default: |
| 1333 |
_ = v // ensures v is used |
| 1334 |
} |
| 1335 |
switch v := m.LbConfig.(type) { |
| 1336 |
case *Cluster_RingHashLbConfig_: |
| 1337 |
if v == nil { |
| 1338 |
err := ClusterValidationError{ |
| 1339 |
field: "LbConfig", |
| 1340 |
reason: "oneof value cannot be a typed-nil", |
| 1341 |
} |
| 1342 |
if !all { |
| 1343 |
return err |
| 1344 |
} |
| 1345 |
errors = append(errors, err) |
| 1346 |
} |
| 1347 |
|
| 1348 |
if all { |
| 1349 |
switch v := interface{}(m.GetRingHashLbConfig()).(type) { |
| 1350 |
case interface{ ValidateAll() error }: |
| 1351 |
if err := v.ValidateAll(); err != nil { |
| 1352 |
errors = append(errors, ClusterValidationError{ |
| 1353 |
field: "RingHashLbConfig", |
| 1354 |
reason: "embedded message failed validation", |
| 1355 |
cause: err, |
| 1356 |
}) |
| 1357 |
} |
| 1358 |
case interface{ Validate() error }: |
| 1359 |
if err := v.Validate(); err != nil { |
| 1360 |
errors = append(errors, ClusterValidationError{ |
| 1361 |
field: "RingHashLbConfig", |
| 1362 |
reason: "embedded message failed validation", |
| 1363 |
cause: err, |
| 1364 |
}) |
| 1365 |
} |
| 1366 |
} |
| 1367 |
} else if v, ok := interface{}(m.GetRingHashLbConfig()).(interface{ Validate() error }); ok { |
| 1368 |
if err := v.Validate(); err != nil { |
| 1369 |
return ClusterValidationError{ |
| 1370 |
field: "RingHashLbConfig", |
| 1371 |
reason: "embedded message failed validation", |
| 1372 |
cause: err, |
| 1373 |
} |
| 1374 |
} |
| 1375 |
} |
| 1376 |
|
| 1377 |
case *Cluster_MaglevLbConfig_: |
| 1378 |
if v == nil { |
| 1379 |
err := ClusterValidationError{ |
| 1380 |
field: "LbConfig", |
| 1381 |
reason: "oneof value cannot be a typed-nil", |
| 1382 |
} |
| 1383 |
if !all { |
| 1384 |
return err |
| 1385 |
} |
| 1386 |
errors = append(errors, err) |
| 1387 |
} |
| 1388 |
|
| 1389 |
if all { |
| 1390 |
switch v := interface{}(m.GetMaglevLbConfig()).(type) { |
| 1391 |
case interface{ ValidateAll() error }: |
| 1392 |
if err := v.ValidateAll(); err != nil { |
| 1393 |
errors = append(errors, ClusterValidationError{ |
| 1394 |
field: "MaglevLbConfig", |
| 1395 |
reason: "embedded message failed validation", |
| 1396 |
cause: err, |
| 1397 |
}) |
| 1398 |
} |
| 1399 |
case interface{ Validate() error }: |
| 1400 |
if err := v.Validate(); err != nil { |
| 1401 |
errors = append(errors, ClusterValidationError{ |
| 1402 |
field: "MaglevLbConfig", |
| 1403 |
reason: "embedded message failed validation", |
| 1404 |
cause: err, |
| 1405 |
}) |
| 1406 |
} |
| 1407 |
} |
| 1408 |
} else if v, ok := interface{}(m.GetMaglevLbConfig()).(interface{ Validate() error }); ok { |
| 1409 |
if err := v.Validate(); err != nil { |
| 1410 |
return ClusterValidationError{ |
| 1411 |
field: "MaglevLbConfig", |
| 1412 |
reason: "embedded message failed validation", |
| 1413 |
cause: err, |
| 1414 |
} |
| 1415 |
} |
| 1416 |
} |
| 1417 |
|
| 1418 |
case *Cluster_OriginalDstLbConfig_: |
| 1419 |
if v == nil { |
| 1420 |
err := ClusterValidationError{ |
| 1421 |
field: "LbConfig", |
| 1422 |
reason: "oneof value cannot be a typed-nil", |
| 1423 |
} |
| 1424 |
if !all { |
| 1425 |
return err |
| 1426 |
} |
| 1427 |
errors = append(errors, err) |
| 1428 |
} |
| 1429 |
|
| 1430 |
if all { |
| 1431 |
switch v := interface{}(m.GetOriginalDstLbConfig()).(type) { |
| 1432 |
case interface{ ValidateAll() error }: |
| 1433 |
if err := v.ValidateAll(); err != nil { |
| 1434 |
errors = append(errors, ClusterValidationError{ |
| 1435 |
field: "OriginalDstLbConfig", |
| 1436 |
reason: "embedded message failed validation", |
| 1437 |
cause: err, |
| 1438 |
}) |
| 1439 |
} |
| 1440 |
case interface{ Validate() error }: |
| 1441 |
if err := v.Validate(); err != nil { |
| 1442 |
errors = append(errors, ClusterValidationError{ |
| 1443 |
field: "OriginalDstLbConfig", |
| 1444 |
reason: "embedded message failed validation", |
| 1445 |
cause: err, |
| 1446 |
}) |
| 1447 |
} |
| 1448 |
} |
| 1449 |
} else if v, ok := interface{}(m.GetOriginalDstLbConfig()).(interface{ Validate() error }); ok { |
| 1450 |
if err := v.Validate(); err != nil { |
| 1451 |
return ClusterValidationError{ |
| 1452 |
field: "OriginalDstLbConfig", |
| 1453 |
reason: "embedded message failed validation", |
| 1454 |
cause: err, |
| 1455 |
} |
| 1456 |
} |
| 1457 |
} |
| 1458 |
|
| 1459 |
case *Cluster_LeastRequestLbConfig_: |
| 1460 |
if v == nil { |
| 1461 |
err := ClusterValidationError{ |
| 1462 |
field: "LbConfig", |
| 1463 |
reason: "oneof value cannot be a typed-nil", |
| 1464 |
} |
| 1465 |
if !all { |
| 1466 |
return err |
| 1467 |
} |
| 1468 |
errors = append(errors, err) |
| 1469 |
} |
| 1470 |
|
| 1471 |
if all { |
| 1472 |
switch v := interface{}(m.GetLeastRequestLbConfig()).(type) { |
| 1473 |
case interface{ ValidateAll() error }: |
| 1474 |
if err := v.ValidateAll(); err != nil { |
| 1475 |
errors = append(errors, ClusterValidationError{ |
| 1476 |
field: "LeastRequestLbConfig", |
| 1477 |
reason: "embedded message failed validation", |
| 1478 |
cause: err, |
| 1479 |
}) |
| 1480 |
} |
| 1481 |
case interface{ Validate() error }: |
| 1482 |
if err := v.Validate(); err != nil { |
| 1483 |
errors = append(errors, ClusterValidationError{ |
| 1484 |
field: "LeastRequestLbConfig", |
| 1485 |
reason: "embedded message failed validation", |
| 1486 |
cause: err, |
| 1487 |
}) |
| 1488 |
} |
| 1489 |
} |
| 1490 |
} else if v, ok := interface{}(m.GetLeastRequestLbConfig()).(interface{ Validate() error }); ok { |
| 1491 |
if err := v.Validate(); err != nil { |
| 1492 |
return ClusterValidationError{ |
| 1493 |
field: "LeastRequestLbConfig", |
| 1494 |
reason: "embedded message failed validation", |
| 1495 |
cause: err, |
| 1496 |
} |
| 1497 |
} |
| 1498 |
} |
| 1499 |
|
| 1500 |
case *Cluster_RoundRobinLbConfig_: |
| 1501 |
if v == nil { |
| 1502 |
err := ClusterValidationError{ |
| 1503 |
field: "LbConfig", |
| 1504 |
reason: "oneof value cannot be a typed-nil", |
| 1505 |
} |
| 1506 |
if !all { |
| 1507 |
return err |
| 1508 |
} |
| 1509 |
errors = append(errors, err) |
| 1510 |
} |
| 1511 |
|
| 1512 |
if all { |
| 1513 |
switch v := interface{}(m.GetRoundRobinLbConfig()).(type) { |
| 1514 |
case interface{ ValidateAll() error }: |
| 1515 |
if err := v.ValidateAll(); err != nil { |
| 1516 |
errors = append(errors, ClusterValidationError{ |
| 1517 |
field: "RoundRobinLbConfig", |
| 1518 |
reason: "embedded message failed validation", |
| 1519 |
cause: err, |
| 1520 |
}) |
| 1521 |
} |
| 1522 |
case interface{ Validate() error }: |
| 1523 |
if err := v.Validate(); err != nil { |
| 1524 |
errors = append(errors, ClusterValidationError{ |
| 1525 |
field: "RoundRobinLbConfig", |
| 1526 |
reason: "embedded message failed validation", |
| 1527 |
cause: err, |
| 1528 |
}) |
| 1529 |
} |
| 1530 |
} |
| 1531 |
} else if v, ok := interface{}(m.GetRoundRobinLbConfig()).(interface{ Validate() error }); ok { |
| 1532 |
if err := v.Validate(); err != nil { |
| 1533 |
return ClusterValidationError{ |
| 1534 |
field: "RoundRobinLbConfig", |
| 1535 |
reason: "embedded message failed validation", |
| 1536 |
cause: err, |
| 1537 |
} |
| 1538 |
} |
| 1539 |
} |
| 1540 |
|
| 1541 |
default: |
| 1542 |
_ = v // ensures v is used |
| 1543 |
} |
| 1544 |
|
| 1545 |
if len(errors) > 0 { |
| 1546 |
return ClusterMultiError(errors) |
| 1547 |
} |
| 1548 |
|
| 1549 |
return nil |
| 1550 |
} |
| 1551 |
|
| 1552 |
// ClusterMultiError is an error wrapping multiple validation errors returned |
| 1553 |
// by Cluster.ValidateAll() if the designated constraints aren't met. |
| 1554 |
type ClusterMultiError []error |
| 1555 |
|
| 1556 |
// Error returns a concatenation of all the error messages it wraps. |
| 1557 |
func (m ClusterMultiError) Error() string { |
| 1558 |
var msgs []string |
| 1559 |
for _, err := range m { |
| 1560 |
msgs = append(msgs, err.Error()) |
| 1561 |
} |
| 1562 |
return strings.Join(msgs, "; ") |
| 1563 |
} |
| 1564 |
|
| 1565 |
// AllErrors returns a list of validation violation errors. |
| 1566 |
func (m ClusterMultiError) AllErrors() []error { return m } |
| 1567 |
|
| 1568 |
// ClusterValidationError is the validation error returned by Cluster.Validate |
| 1569 |
// if the designated constraints aren't met. |
| 1570 |
type ClusterValidationError struct { |
| 1571 |
field string |
| 1572 |
reason string |
| 1573 |
cause error |
| 1574 |
key bool |
| 1575 |
} |
| 1576 |
|
| 1577 |
// Field function returns field value. |
| 1578 |
func (e ClusterValidationError) Field() string { return e.field } |
| 1579 |
|
| 1580 |
// Reason function returns reason value. |
| 1581 |
func (e ClusterValidationError) Reason() string { return e.reason } |
| 1582 |
|
| 1583 |
// Cause function returns cause value. |
| 1584 |
func (e ClusterValidationError) Cause() error { return e.cause } |
| 1585 |
|
| 1586 |
// Key function returns key value. |
| 1587 |
func (e ClusterValidationError) Key() bool { return e.key } |
| 1588 |
|
| 1589 |
// ErrorName returns error name. |
| 1590 |
func (e ClusterValidationError) ErrorName() string { return "ClusterValidationError" } |
| 1591 |
|
| 1592 |
// Error satisfies the builtin error interface |
| 1593 |
func (e ClusterValidationError) Error() string { |
| 1594 |
cause := "" |
| 1595 |
if e.cause != nil { |
| 1596 |
cause = fmt.Sprintf(" | caused by: %v", e.cause) |
| 1597 |
} |
| 1598 |
|
| 1599 |
key := "" |
| 1600 |
if e.key { |
| 1601 |
key = "key for " |
| 1602 |
} |
| 1603 |
|
| 1604 |
return fmt.Sprintf( |
| 1605 |
"invalid %sCluster.%s: %s%s", |
| 1606 |
key, |
| 1607 |
e.field, |
| 1608 |
e.reason, |
| 1609 |
cause) |
| 1610 |
} |
| 1611 |
|
| 1612 |
var _ error = ClusterValidationError{} |
| 1613 |
|
| 1614 |
var _ interface { |
| 1615 |
Field() string |
| 1616 |
Reason() string |
| 1617 |
Key() bool |
| 1618 |
Cause() error |
| 1619 |
ErrorName() string |
| 1620 |
} = ClusterValidationError{} |
| 1621 |
|
| 1622 |
// Validate checks the field values on LoadBalancingPolicy with the rules |
| 1623 |
// defined in the proto definition for this message. If any rules are |
| 1624 |
// violated, the first error encountered is returned, or nil if there are no violations. |
| 1625 |
func (m *LoadBalancingPolicy) Validate() error { |
| 1626 |
return m.validate(false) |
| 1627 |
} |
| 1628 |
|
| 1629 |
// ValidateAll checks the field values on LoadBalancingPolicy with the rules |
| 1630 |
// defined in the proto definition for this message. If any rules are |
| 1631 |
// violated, the result is a list of violation errors wrapped in |
| 1632 |
// LoadBalancingPolicyMultiError, or nil if none found. |
| 1633 |
func (m *LoadBalancingPolicy) ValidateAll() error { |
| 1634 |
return m.validate(true) |
| 1635 |
} |
| 1636 |
|
| 1637 |
func (m *LoadBalancingPolicy) validate(all bool) error { |
| 1638 |
if m == nil { |
| 1639 |
return nil |
| 1640 |
} |
| 1641 |
|
| 1642 |
var errors []error |
| 1643 |
|
| 1644 |
for idx, item := range m.GetPolicies() { |
| 1645 |
_, _ = idx, item |
| 1646 |
|
| 1647 |
if all { |
| 1648 |
switch v := interface{}(item).(type) { |
| 1649 |
case interface{ ValidateAll() error }: |
| 1650 |
if err := v.ValidateAll(); err != nil { |
| 1651 |
errors = append(errors, LoadBalancingPolicyValidationError{ |
| 1652 |
field: fmt.Sprintf("Policies[%v]", idx), |
| 1653 |
reason: "embedded message failed validation", |
| 1654 |
cause: err, |
| 1655 |
}) |
| 1656 |
} |
| 1657 |
case interface{ Validate() error }: |
| 1658 |
if err := v.Validate(); err != nil { |
| 1659 |
errors = append(errors, LoadBalancingPolicyValidationError{ |
| 1660 |
field: fmt.Sprintf("Policies[%v]", idx), |
| 1661 |
reason: "embedded message failed validation", |
| 1662 |
cause: err, |
| 1663 |
}) |
| 1664 |
} |
| 1665 |
} |
| 1666 |
} else if v, ok := interface{}(item).(interface{ Validate() error }); ok { |
| 1667 |
if err := v.Validate(); err != nil { |
| 1668 |
return LoadBalancingPolicyValidationError{ |
| 1669 |
field: fmt.Sprintf("Policies[%v]", idx), |
| 1670 |
reason: "embedded message failed validation", |
| 1671 |
cause: err, |
| 1672 |
} |
| 1673 |
} |
| 1674 |
} |
| 1675 |
|
| 1676 |
} |
| 1677 |
|
| 1678 |
if len(errors) > 0 { |
| 1679 |
return LoadBalancingPolicyMultiError(errors) |
| 1680 |
} |
| 1681 |
|
| 1682 |
return nil |
| 1683 |
} |
| 1684 |
|
| 1685 |
// LoadBalancingPolicyMultiError is an error wrapping multiple validation |
| 1686 |
// errors returned by LoadBalancingPolicy.ValidateAll() if the designated |
| 1687 |
// constraints aren't met. |
| 1688 |
type LoadBalancingPolicyMultiError []error |
| 1689 |
|
| 1690 |
// Error returns a concatenation of all the error messages it wraps. |
| 1691 |
func (m LoadBalancingPolicyMultiError) Error() string { |
| 1692 |
var msgs []string |
| 1693 |
for _, err := range m { |
| 1694 |
msgs = append(msgs, err.Error()) |
| 1695 |
} |
| 1696 |
return strings.Join(msgs, "; ") |
| 1697 |
} |
| 1698 |
|
| 1699 |
// AllErrors returns a list of validation violation errors. |
| 1700 |
func (m LoadBalancingPolicyMultiError) AllErrors() []error { return m } |
| 1701 |
|
| 1702 |
// LoadBalancingPolicyValidationError is the validation error returned by |
| 1703 |
// LoadBalancingPolicy.Validate if the designated constraints aren't met. |
| 1704 |
type LoadBalancingPolicyValidationError struct { |
| 1705 |
field string |
| 1706 |
reason string |
| 1707 |
cause error |
| 1708 |
key bool |
| 1709 |
} |
| 1710 |
|
| 1711 |
// Field function returns field value. |
| 1712 |
func (e LoadBalancingPolicyValidationError) Field() string { return e.field } |
| 1713 |
|
| 1714 |
// Reason function returns reason value. |
| 1715 |
func (e LoadBalancingPolicyValidationError) Reason() string { return e.reason } |
| 1716 |
|
| 1717 |
// Cause function returns cause value. |
| 1718 |
func (e LoadBalancingPolicyValidationError) Cause() error { return e.cause } |
| 1719 |
|
| 1720 |
// Key function returns key value. |
| 1721 |
func (e LoadBalancingPolicyValidationError) Key() bool { return e.key } |
| 1722 |
|
| 1723 |
// ErrorName returns error name. |
| 1724 |
func (e LoadBalancingPolicyValidationError) ErrorName() string { |
| 1725 |
return "LoadBalancingPolicyValidationError" |
| 1726 |
} |
| 1727 |
|
| 1728 |
// Error satisfies the builtin error interface |
| 1729 |
func (e LoadBalancingPolicyValidationError) Error() string { |
| 1730 |
cause := "" |
| 1731 |
if e.cause != nil { |
| 1732 |
cause = fmt.Sprintf(" | caused by: %v", e.cause) |
| 1733 |
} |
| 1734 |
|
| 1735 |
key := "" |
| 1736 |
if e.key { |
| 1737 |
key = "key for " |
| 1738 |
} |
| 1739 |
|
| 1740 |
return fmt.Sprintf( |
| 1741 |
"invalid %sLoadBalancingPolicy.%s: %s%s", |
| 1742 |
key, |
| 1743 |
e.field, |
| 1744 |
e.reason, |
| 1745 |
cause) |
| 1746 |
} |
| 1747 |
|
| 1748 |
var _ error = LoadBalancingPolicyValidationError{} |
| 1749 |
|
| 1750 |
var _ interface { |
| 1751 |
Field() string |
| 1752 |
Reason() string |
| 1753 |
Key() bool |
| 1754 |
Cause() error |
| 1755 |
ErrorName() string |
| 1756 |
} = LoadBalancingPolicyValidationError{} |
| 1757 |
|
| 1758 |
// Validate checks the field values on UpstreamConnectionOptions with the rules |
| 1759 |
// defined in the proto definition for this message. If any rules are |
| 1760 |
// violated, the first error encountered is returned, or nil if there are no violations. |
| 1761 |
func (m *UpstreamConnectionOptions) Validate() error { |
| 1762 |
return m.validate(false) |
| 1763 |
} |
| 1764 |
|
| 1765 |
// ValidateAll checks the field values on UpstreamConnectionOptions with the |
| 1766 |
// rules defined in the proto definition for this message. If any rules are |
| 1767 |
// violated, the result is a list of violation errors wrapped in |
| 1768 |
// UpstreamConnectionOptionsMultiError, or nil if none found. |
| 1769 |
func (m *UpstreamConnectionOptions) ValidateAll() error { |
| 1770 |
return m.validate(true) |
| 1771 |
} |
| 1772 |
|
| 1773 |
func (m *UpstreamConnectionOptions) validate(all bool) error { |
| 1774 |
if m == nil { |
| 1775 |
return nil |
| 1776 |
} |
| 1777 |
|
| 1778 |
var errors []error |
| 1779 |
|
| 1780 |
if all { |
| 1781 |
switch v := interface{}(m.GetTcpKeepalive()).(type) { |
| 1782 |
case interface{ ValidateAll() error }: |
| 1783 |
if err := v.ValidateAll(); err != nil { |
| 1784 |
errors = append(errors, UpstreamConnectionOptionsValidationError{ |
| 1785 |
field: "TcpKeepalive", |
| 1786 |
reason: "embedded message failed validation", |
| 1787 |
cause: err, |
| 1788 |
}) |
| 1789 |
} |
| 1790 |
case interface{ Validate() error }: |
| 1791 |
if err := v.Validate(); err != nil { |
| 1792 |
errors = append(errors, UpstreamConnectionOptionsValidationError{ |
| 1793 |
field: "TcpKeepalive", |
| 1794 |
reason: "embedded message failed validation", |
| 1795 |
cause: err, |
| 1796 |
}) |
| 1797 |
} |
| 1798 |
} |
| 1799 |
} else if v, ok := interface{}(m.GetTcpKeepalive()).(interface{ Validate() error }); ok { |
| 1800 |
if err := v.Validate(); err != nil { |
| 1801 |
return UpstreamConnectionOptionsValidationError{ |
| 1802 |
field: "TcpKeepalive", |
| 1803 |
reason: "embedded message failed validation", |
| 1804 |
cause: err, |
| 1805 |
} |
| 1806 |
} |
| 1807 |
} |
| 1808 |
|
| 1809 |
// no validation rules for SetLocalInterfaceNameOnUpstreamConnections |
| 1810 |
|
| 1811 |
if all { |
| 1812 |
switch v := interface{}(m.GetHappyEyeballsConfig()).(type) { |
| 1813 |
case interface{ ValidateAll() error }: |
| 1814 |
if err := v.ValidateAll(); err != nil { |
| 1815 |
errors = append(errors, UpstreamConnectionOptionsValidationError{ |
| 1816 |
field: "HappyEyeballsConfig", |
| 1817 |
reason: "embedded message failed validation", |
| 1818 |
cause: err, |
| 1819 |
}) |
| 1820 |
} |
| 1821 |
case interface{ Validate() error }: |
| 1822 |
if err := v.Validate(); err != nil { |
| 1823 |
errors = append(errors, UpstreamConnectionOptionsValidationError{ |
| 1824 |
field: "HappyEyeballsConfig", |
| 1825 |
reason: "embedded message failed validation", |
| 1826 |
cause: err, |
| 1827 |
}) |
| 1828 |
} |
| 1829 |
} |
| 1830 |
} else if v, ok := interface{}(m.GetHappyEyeballsConfig()).(interface{ Validate() error }); ok { |
| 1831 |
if err := v.Validate(); err != nil { |
| 1832 |
return UpstreamConnectionOptionsValidationError{ |
| 1833 |
field: "HappyEyeballsConfig", |
| 1834 |
reason: "embedded message failed validation", |
| 1835 |
cause: err, |
| 1836 |
} |
| 1837 |
} |
| 1838 |
} |
| 1839 |
|
| 1840 |
if len(errors) > 0 { |
| 1841 |
return UpstreamConnectionOptionsMultiError(errors) |
| 1842 |
} |
| 1843 |
|
| 1844 |
return nil |
| 1845 |
} |
| 1846 |
|
| 1847 |
// UpstreamConnectionOptionsMultiError is an error wrapping multiple validation |
| 1848 |
// errors returned by UpstreamConnectionOptions.ValidateAll() if the |
| 1849 |
// designated constraints aren't met. |
| 1850 |
type UpstreamConnectionOptionsMultiError []error |
| 1851 |
|
| 1852 |
// Error returns a concatenation of all the error messages it wraps. |
| 1853 |
func (m UpstreamConnectionOptionsMultiError) Error() string { |
| 1854 |
var msgs []string |
| 1855 |
for _, err := range m { |
| 1856 |
msgs = append(msgs, err.Error()) |
| 1857 |
} |
| 1858 |
return strings.Join(msgs, "; ") |
| 1859 |
} |
| 1860 |
|
| 1861 |
// AllErrors returns a list of validation violation errors. |
| 1862 |
func (m UpstreamConnectionOptionsMultiError) AllErrors() []error { return m } |
| 1863 |
|
| 1864 |
// UpstreamConnectionOptionsValidationError is the validation error returned by |
| 1865 |
// UpstreamConnectionOptions.Validate if the designated constraints aren't met. |
| 1866 |
type UpstreamConnectionOptionsValidationError struct { |
| 1867 |
field string |
| 1868 |
reason string |
| 1869 |
cause error |
| 1870 |
key bool |
| 1871 |
} |
| 1872 |
|
| 1873 |
// Field function returns field value. |
| 1874 |
func (e UpstreamConnectionOptionsValidationError) Field() string { return e.field } |
| 1875 |
|
| 1876 |
// Reason function returns reason value. |
| 1877 |
func (e UpstreamConnectionOptionsValidationError) Reason() string { return e.reason } |
| 1878 |
|
| 1879 |
// Cause function returns cause value. |
| 1880 |
func (e UpstreamConnectionOptionsValidationError) Cause() error { return e.cause } |
| 1881 |
|
| 1882 |
// Key function returns key value. |
| 1883 |
func (e UpstreamConnectionOptionsValidationError) Key() bool { return e.key } |
| 1884 |
|
| 1885 |
// ErrorName returns error name. |
| 1886 |
func (e UpstreamConnectionOptionsValidationError) ErrorName() string { |
| 1887 |
return "UpstreamConnectionOptionsValidationError" |
| 1888 |
} |
| 1889 |
|
| 1890 |
// Error satisfies the builtin error interface |
| 1891 |
func (e UpstreamConnectionOptionsValidationError) Error() string { |
| 1892 |
cause := "" |
| 1893 |
if e.cause != nil { |
| 1894 |
cause = fmt.Sprintf(" | caused by: %v", e.cause) |
| 1895 |
} |
| 1896 |
|
| 1897 |
key := "" |
| 1898 |
if e.key { |
| 1899 |
key = "key for " |
| 1900 |
} |
| 1901 |
|
| 1902 |
return fmt.Sprintf( |
| 1903 |
"invalid %sUpstreamConnectionOptions.%s: %s%s", |
| 1904 |
key, |
| 1905 |
e.field, |
| 1906 |
e.reason, |
| 1907 |
cause) |
| 1908 |
} |
| 1909 |
|
| 1910 |
var _ error = UpstreamConnectionOptionsValidationError{} |
| 1911 |
|
| 1912 |
var _ interface { |
| 1913 |
Field() string |
| 1914 |
Reason() string |
| 1915 |
Key() bool |
| 1916 |
Cause() error |
| 1917 |
ErrorName() string |
| 1918 |
} = UpstreamConnectionOptionsValidationError{} |
| 1919 |
|
| 1920 |
// Validate checks the field values on TrackClusterStats with the rules defined |
| 1921 |
// in the proto definition for this message. If any rules are violated, the |
| 1922 |
// first error encountered is returned, or nil if there are no violations. |
| 1923 |
func (m *TrackClusterStats) Validate() error { |
| 1924 |
return m.validate(false) |
| 1925 |
} |
| 1926 |
|
| 1927 |
// ValidateAll checks the field values on TrackClusterStats with the rules |
| 1928 |
// defined in the proto definition for this message. If any rules are |
| 1929 |
// violated, the result is a list of violation errors wrapped in |
| 1930 |
// TrackClusterStatsMultiError, or nil if none found. |
| 1931 |
func (m *TrackClusterStats) ValidateAll() error { |
| 1932 |
return m.validate(true) |
| 1933 |
} |
| 1934 |
|
| 1935 |
func (m *TrackClusterStats) validate(all bool) error { |
| 1936 |
if m == nil { |
| 1937 |
return nil |
| 1938 |
} |
| 1939 |
|
| 1940 |
var errors []error |
| 1941 |
|
| 1942 |
// no validation rules for TimeoutBudgets |
| 1943 |
|
| 1944 |
// no validation rules for RequestResponseSizes |
| 1945 |
|
| 1946 |
// no validation rules for PerEndpointStats |
| 1947 |
|
| 1948 |
if len(errors) > 0 { |
| 1949 |
return TrackClusterStatsMultiError(errors) |
| 1950 |
} |
| 1951 |
|
| 1952 |
return nil |
| 1953 |
} |
| 1954 |
|
| 1955 |
// TrackClusterStatsMultiError is an error wrapping multiple validation errors |
| 1956 |
// returned by TrackClusterStats.ValidateAll() if the designated constraints |
| 1957 |
// aren't met. |
| 1958 |
type TrackClusterStatsMultiError []error |
| 1959 |
|
| 1960 |
// Error returns a concatenation of all the error messages it wraps. |
| 1961 |
func (m TrackClusterStatsMultiError) Error() string { |
| 1962 |
var msgs []string |
| 1963 |
for _, err := range m { |
| 1964 |
msgs = append(msgs, err.Error()) |
| 1965 |
} |
| 1966 |
return strings.Join(msgs, "; ") |
| 1967 |
} |
| 1968 |
|
| 1969 |
// AllErrors returns a list of validation violation errors. |
| 1970 |
func (m TrackClusterStatsMultiError) AllErrors() []error { return m } |
| 1971 |
|
| 1972 |
// TrackClusterStatsValidationError is the validation error returned by |
| 1973 |
// TrackClusterStats.Validate if the designated constraints aren't met. |
| 1974 |
type TrackClusterStatsValidationError struct { |
| 1975 |
field string |
| 1976 |
reason string |
| 1977 |
cause error |
| 1978 |
key bool |
| 1979 |
} |
| 1980 |
|
| 1981 |
// Field function returns field value. |
| 1982 |
func (e TrackClusterStatsValidationError) Field() string { return e.field } |
| 1983 |
|
| 1984 |
// Reason function returns reason value. |
| 1985 |
func (e TrackClusterStatsValidationError) Reason() string { return e.reason } |
| 1986 |
|
| 1987 |
// Cause function returns cause value. |
| 1988 |
func (e TrackClusterStatsValidationError) Cause() error { return e.cause } |
| 1989 |
|
| 1990 |
// Key function returns key value. |
| 1991 |
func (e TrackClusterStatsValidationError) Key() bool { return e.key } |
| 1992 |
|
| 1993 |
// ErrorName returns error name. |
| 1994 |
func (e TrackClusterStatsValidationError) ErrorName() string { |
| 1995 |
return "TrackClusterStatsValidationError" |
| 1996 |
} |
| 1997 |
|
| 1998 |
// Error satisfies the builtin error interface |
| 1999 |
func (e TrackClusterStatsValidationError) Error() string { |
| 2000 |
cause := "" |
| 2001 |
if e.cause != nil { |
| 2002 |
cause = fmt.Sprintf(" | caused by: %v", e.cause) |
| 2003 |
} |
| 2004 |
|
| 2005 |
key := "" |
| 2006 |
if e.key { |
| 2007 |
key = "key for " |
| 2008 |
} |
| 2009 |
|
| 2010 |
return fmt.Sprintf( |
| 2011 |
"invalid %sTrackClusterStats.%s: %s%s", |
| 2012 |
key, |
| 2013 |
e.field, |
| 2014 |
e.reason, |
| 2015 |
cause) |
| 2016 |
} |
| 2017 |
|
| 2018 |
var _ error = TrackClusterStatsValidationError{} |
| 2019 |
|
| 2020 |
var _ interface { |
| 2021 |
Field() string |
| 2022 |
Reason() string |
| 2023 |
Key() bool |
| 2024 |
Cause() error |
| 2025 |
ErrorName() string |
| 2026 |
} = TrackClusterStatsValidationError{} |
| 2027 |
|
| 2028 |
// Validate checks the field values on Cluster_TransportSocketMatch with the |
| 2029 |
// rules defined in the proto definition for this message. If any rules are |
| 2030 |
// violated, the first error encountered is returned, or nil if there are no violations. |
| 2031 |
func (m *Cluster_TransportSocketMatch) Validate() error { |
| 2032 |
return m.validate(false) |
| 2033 |
} |
| 2034 |
|
| 2035 |
// ValidateAll checks the field values on Cluster_TransportSocketMatch with the |
| 2036 |
// rules defined in the proto definition for this message. If any rules are |
| 2037 |
// violated, the result is a list of violation errors wrapped in |
| 2038 |
// Cluster_TransportSocketMatchMultiError, or nil if none found. |
| 2039 |
func (m *Cluster_TransportSocketMatch) ValidateAll() error { |
| 2040 |
return m.validate(true) |
| 2041 |
} |
| 2042 |
|
| 2043 |
func (m *Cluster_TransportSocketMatch) validate(all bool) error { |
| 2044 |
if m == nil { |
| 2045 |
return nil |
| 2046 |
} |
| 2047 |
|
| 2048 |
var errors []error |
| 2049 |
|
| 2050 |
if utf8.RuneCountInString(m.GetName()) < 1 { |
| 2051 |
err := Cluster_TransportSocketMatchValidationError{ |
| 2052 |
field: "Name", |
| 2053 |
reason: "value length must be at least 1 runes", |
| 2054 |
} |
| 2055 |
if !all { |
| 2056 |
return err |
| 2057 |
} |
| 2058 |
errors = append(errors, err) |
| 2059 |
} |
| 2060 |
|
| 2061 |
if all { |
| 2062 |
switch v := interface{}(m.GetMatch()).(type) { |
| 2063 |
case interface{ ValidateAll() error }: |
| 2064 |
if err := v.ValidateAll(); err != nil { |
| 2065 |
errors = append(errors, Cluster_TransportSocketMatchValidationError{ |
| 2066 |
field: "Match", |
| 2067 |
reason: "embedded message failed validation", |
| 2068 |
cause: err, |
| 2069 |
}) |
| 2070 |
} |
| 2071 |
case interface{ Validate() error }: |
| 2072 |
if err := v.Validate(); err != nil { |
| 2073 |
errors = append(errors, Cluster_TransportSocketMatchValidationError{ |
| 2074 |
field: "Match", |
| 2075 |
reason: "embedded message failed validation", |
| 2076 |
cause: err, |
| 2077 |
}) |
| 2078 |
} |
| 2079 |
} |
| 2080 |
} else if v, ok := interface{}(m.GetMatch()).(interface{ Validate() error }); ok { |
| 2081 |
if err := v.Validate(); err != nil { |
| 2082 |
return Cluster_TransportSocketMatchValidationError{ |
| 2083 |
field: "Match", |
| 2084 |
reason: "embedded message failed validation", |
| 2085 |
cause: err, |
| 2086 |
} |
| 2087 |
} |
| 2088 |
} |
| 2089 |
|
| 2090 |
if all { |
| 2091 |
switch v := interface{}(m.GetTransportSocket()).(type) { |
| 2092 |
case interface{ ValidateAll() error }: |
| 2093 |
if err := v.ValidateAll(); err != nil { |
| 2094 |
errors = append(errors, Cluster_TransportSocketMatchValidationError{ |
| 2095 |
field: "TransportSocket", |
| 2096 |
reason: "embedded message failed validation", |
| 2097 |
cause: err, |
| 2098 |
}) |
| 2099 |
} |
| 2100 |
case interface{ Validate() error }: |
| 2101 |
if err := v.Validate(); err != nil { |
| 2102 |
errors = append(errors, Cluster_TransportSocketMatchValidationError{ |
| 2103 |
field: "TransportSocket", |
| 2104 |
reason: "embedded message failed validation", |
| 2105 |
cause: err, |
| 2106 |
}) |
| 2107 |
} |
| 2108 |
} |
| 2109 |
} else if v, ok := interface{}(m.GetTransportSocket()).(interface{ Validate() error }); ok { |
| 2110 |
if err := v.Validate(); err != nil { |
| 2111 |
return Cluster_TransportSocketMatchValidationError{ |
| 2112 |
field: "TransportSocket", |
| 2113 |
reason: "embedded message failed validation", |
| 2114 |
cause: err, |
| 2115 |
} |
| 2116 |
} |
| 2117 |
} |
| 2118 |
|
| 2119 |
if len(errors) > 0 { |
| 2120 |
return Cluster_TransportSocketMatchMultiError(errors) |
| 2121 |
} |
| 2122 |
|
| 2123 |
return nil |
| 2124 |
} |
| 2125 |
|
| 2126 |
// Cluster_TransportSocketMatchMultiError is an error wrapping multiple |
| 2127 |
// validation errors returned by Cluster_TransportSocketMatch.ValidateAll() if |
| 2128 |
// the designated constraints aren't met. |
| 2129 |
type Cluster_TransportSocketMatchMultiError []error |
| 2130 |
|
| 2131 |
// Error returns a concatenation of all the error messages it wraps. |
| 2132 |
func (m Cluster_TransportSocketMatchMultiError) Error() string { |
| 2133 |
var msgs []string |
| 2134 |
for _, err := range m { |
| 2135 |
msgs = append(msgs, err.Error()) |
| 2136 |
} |
| 2137 |
return strings.Join(msgs, "; ") |
| 2138 |
} |
| 2139 |
|
| 2140 |
// AllErrors returns a list of validation violation errors. |
| 2141 |
func (m Cluster_TransportSocketMatchMultiError) AllErrors() []error { return m } |
| 2142 |
|
| 2143 |
// Cluster_TransportSocketMatchValidationError is the validation error returned |
| 2144 |
// by Cluster_TransportSocketMatch.Validate if the designated constraints |
| 2145 |
// aren't met. |
| 2146 |
type Cluster_TransportSocketMatchValidationError struct { |
| 2147 |
field string |
| 2148 |
reason string |
| 2149 |
cause error |
| 2150 |
key bool |
| 2151 |
} |
| 2152 |
|
| 2153 |
// Field function returns field value. |
| 2154 |
func (e Cluster_TransportSocketMatchValidationError) Field() string { return e.field } |
| 2155 |
|
| 2156 |
// Reason function returns reason value. |
| 2157 |
func (e Cluster_TransportSocketMatchValidationError) Reason() string { return e.reason } |
| 2158 |
|
| 2159 |
// Cause function returns cause value. |
| 2160 |
func (e Cluster_TransportSocketMatchValidationError) Cause() error { return e.cause } |
| 2161 |
|
| 2162 |
// Key function returns key value. |
| 2163 |
func (e Cluster_TransportSocketMatchValidationError) Key() bool { return e.key } |
| 2164 |
|
| 2165 |
// ErrorName returns error name. |
| 2166 |
func (e Cluster_TransportSocketMatchValidationError) ErrorName() string { |
| 2167 |
return "Cluster_TransportSocketMatchValidationError" |
| 2168 |
} |
| 2169 |
|
| 2170 |
// Error satisfies the builtin error interface |
| 2171 |
func (e Cluster_TransportSocketMatchValidationError) Error() string { |
| 2172 |
cause := "" |
| 2173 |
if e.cause != nil { |
| 2174 |
cause = fmt.Sprintf(" | caused by: %v", e.cause) |
| 2175 |
} |
| 2176 |
|
| 2177 |
key := "" |
| 2178 |
if e.key { |
| 2179 |
key = "key for " |
| 2180 |
} |
| 2181 |
|
| 2182 |
return fmt.Sprintf( |
| 2183 |
"invalid %sCluster_TransportSocketMatch.%s: %s%s", |
| 2184 |
key, |
| 2185 |
e.field, |
| 2186 |
e.reason, |
| 2187 |
cause) |
| 2188 |
} |
| 2189 |
|
| 2190 |
var _ error = Cluster_TransportSocketMatchValidationError{} |
| 2191 |
|
| 2192 |
var _ interface { |
| 2193 |
Field() string |
| 2194 |
Reason() string |
| 2195 |
Key() bool |
| 2196 |
Cause() error |
| 2197 |
ErrorName() string |
| 2198 |
} = Cluster_TransportSocketMatchValidationError{} |
| 2199 |
|
| 2200 |
// Validate checks the field values on Cluster_CustomClusterType with the rules |
| 2201 |
// defined in the proto definition for this message. If any rules are |
| 2202 |
// violated, the first error encountered is returned, or nil if there are no violations. |
| 2203 |
func (m *Cluster_CustomClusterType) Validate() error { |
| 2204 |
return m.validate(false) |
| 2205 |
} |
| 2206 |
|
| 2207 |
// ValidateAll checks the field values on Cluster_CustomClusterType with the |
| 2208 |
// rules defined in the proto definition for this message. If any rules are |
| 2209 |
// violated, the result is a list of violation errors wrapped in |
| 2210 |
// Cluster_CustomClusterTypeMultiError, or nil if none found. |
| 2211 |
func (m *Cluster_CustomClusterType) ValidateAll() error { |
| 2212 |
return m.validate(true) |
| 2213 |
} |
| 2214 |
|
| 2215 |
func (m *Cluster_CustomClusterType) validate(all bool) error { |
| 2216 |
if m == nil { |
| 2217 |
return nil |
| 2218 |
} |
| 2219 |
|
| 2220 |
var errors []error |
| 2221 |
|
| 2222 |
if utf8.RuneCountInString(m.GetName()) < 1 { |
| 2223 |
err := Cluster_CustomClusterTypeValidationError{ |
| 2224 |
field: "Name", |
| 2225 |
reason: "value length must be at least 1 runes", |
| 2226 |
} |
| 2227 |
if !all { |
| 2228 |
return err |
| 2229 |
} |
| 2230 |
errors = append(errors, err) |
| 2231 |
} |
| 2232 |
|
| 2233 |
if all { |
| 2234 |
switch v := interface{}(m.GetTypedConfig()).(type) { |
| 2235 |
case interface{ ValidateAll() error }: |
| 2236 |
if err := v.ValidateAll(); err != nil { |
| 2237 |
errors = append(errors, Cluster_CustomClusterTypeValidationError{ |
| 2238 |
field: "TypedConfig", |
| 2239 |
reason: "embedded message failed validation", |
| 2240 |
cause: err, |
| 2241 |
}) |
| 2242 |
} |
| 2243 |
case interface{ Validate() error }: |
| 2244 |
if err := v.Validate(); err != nil { |
| 2245 |
errors = append(errors, Cluster_CustomClusterTypeValidationError{ |
| 2246 |
field: "TypedConfig", |
| 2247 |
reason: "embedded message failed validation", |
| 2248 |
cause: err, |
| 2249 |
}) |
| 2250 |
} |
| 2251 |
} |
| 2252 |
} else if v, ok := interface{}(m.GetTypedConfig()).(interface{ Validate() error }); ok { |
| 2253 |
if err := v.Validate(); err != nil { |
| 2254 |
return Cluster_CustomClusterTypeValidationError{ |
| 2255 |
field: "TypedConfig", |
| 2256 |
reason: "embedded message failed validation", |
| 2257 |
cause: err, |
| 2258 |
} |
| 2259 |
} |
| 2260 |
} |
| 2261 |
|
| 2262 |
if len(errors) > 0 { |
| 2263 |
return Cluster_CustomClusterTypeMultiError(errors) |
| 2264 |
} |
| 2265 |
|
| 2266 |
return nil |
| 2267 |
} |
| 2268 |
|
| 2269 |
// Cluster_CustomClusterTypeMultiError is an error wrapping multiple validation |
| 2270 |
// errors returned by Cluster_CustomClusterType.ValidateAll() if the |
| 2271 |
// designated constraints aren't met. |
| 2272 |
type Cluster_CustomClusterTypeMultiError []error |
| 2273 |
|
| 2274 |
// Error returns a concatenation of all the error messages it wraps. |
| 2275 |
func (m Cluster_CustomClusterTypeMultiError) Error() string { |
| 2276 |
var msgs []string |
| 2277 |
for _, err := range m { |
| 2278 |
msgs = append(msgs, err.Error()) |
| 2279 |
} |
| 2280 |
return strings.Join(msgs, "; ") |
| 2281 |
} |
| 2282 |
|
| 2283 |
// AllErrors returns a list of validation violation errors. |
| 2284 |
func (m Cluster_CustomClusterTypeMultiError) AllErrors() []error { return m } |
| 2285 |
|
| 2286 |
// Cluster_CustomClusterTypeValidationError is the validation error returned by |
| 2287 |
// Cluster_CustomClusterType.Validate if the designated constraints aren't met. |
| 2288 |
type Cluster_CustomClusterTypeValidationError struct { |
| 2289 |
field string |
| 2290 |
reason string |
| 2291 |
cause error |
| 2292 |
key bool |
| 2293 |
} |
| 2294 |
|
| 2295 |
// Field function returns field value. |
| 2296 |
func (e Cluster_CustomClusterTypeValidationError) Field() string { return e.field } |
| 2297 |
|
| 2298 |
// Reason function returns reason value. |
| 2299 |
func (e Cluster_CustomClusterTypeValidationError) Reason() string { return e.reason } |
| 2300 |
|
| 2301 |
// Cause function returns cause value. |
| 2302 |
func (e Cluster_CustomClusterTypeValidationError) Cause() error { return e.cause } |
| 2303 |
|
| 2304 |
// Key function returns key value. |
| 2305 |
func (e Cluster_CustomClusterTypeValidationError) Key() bool { return e.key } |
| 2306 |
|
| 2307 |
// ErrorName returns error name. |
| 2308 |
func (e Cluster_CustomClusterTypeValidationError) ErrorName() string { |
| 2309 |
return "Cluster_CustomClusterTypeValidationError" |
| 2310 |
} |
| 2311 |
|
| 2312 |
// Error satisfies the builtin error interface |
| 2313 |
func (e Cluster_CustomClusterTypeValidationError) Error() string { |
| 2314 |
cause := "" |
| 2315 |
if e.cause != nil { |
| 2316 |
cause = fmt.Sprintf(" | caused by: %v", e.cause) |
| 2317 |
} |
| 2318 |
|
| 2319 |
key := "" |
| 2320 |
if e.key { |
| 2321 |
key = "key for " |
| 2322 |
} |
| 2323 |
|
| 2324 |
return fmt.Sprintf( |
| 2325 |
"invalid %sCluster_CustomClusterType.%s: %s%s", |
| 2326 |
key, |
| 2327 |
e.field, |
| 2328 |
e.reason, |
| 2329 |
cause) |
| 2330 |
} |
| 2331 |
|
| 2332 |
var _ error = Cluster_CustomClusterTypeValidationError{} |
| 2333 |
|
| 2334 |
var _ interface { |
| 2335 |
Field() string |
| 2336 |
Reason() string |
| 2337 |
Key() bool |
| 2338 |
Cause() error |
| 2339 |
ErrorName() string |
| 2340 |
} = Cluster_CustomClusterTypeValidationError{} |
| 2341 |
|
| 2342 |
// Validate checks the field values on Cluster_EdsClusterConfig with the rules |
| 2343 |
// defined in the proto definition for this message. If any rules are |
| 2344 |
// violated, the first error encountered is returned, or nil if there are no violations. |
| 2345 |
func (m *Cluster_EdsClusterConfig) Validate() error { |
| 2346 |
return m.validate(false) |
| 2347 |
} |
| 2348 |
|
| 2349 |
// ValidateAll checks the field values on Cluster_EdsClusterConfig with the |
| 2350 |
// rules defined in the proto definition for this message. If any rules are |
| 2351 |
// violated, the result is a list of violation errors wrapped in |
| 2352 |
// Cluster_EdsClusterConfigMultiError, or nil if none found. |
| 2353 |
func (m *Cluster_EdsClusterConfig) ValidateAll() error { |
| 2354 |
return m.validate(true) |
| 2355 |
} |
| 2356 |
|
| 2357 |
func (m *Cluster_EdsClusterConfig) validate(all bool) error { |
| 2358 |
if m == nil { |
| 2359 |
return nil |
| 2360 |
} |
| 2361 |
|
| 2362 |
var errors []error |
| 2363 |
|
| 2364 |
if all { |
| 2365 |
switch v := interface{}(m.GetEdsConfig()).(type) { |
| 2366 |
case interface{ ValidateAll() error }: |
| 2367 |
if err := v.ValidateAll(); err != nil { |
| 2368 |
errors = append(errors, Cluster_EdsClusterConfigValidationError{ |
| 2369 |
field: "EdsConfig", |
| 2370 |
reason: "embedded message failed validation", |
| 2371 |
cause: err, |
| 2372 |
}) |
| 2373 |
} |
| 2374 |
case interface{ Validate() error }: |
| 2375 |
if err := v.Validate(); err != nil { |
| 2376 |
errors = append(errors, Cluster_EdsClusterConfigValidationError{ |
| 2377 |
field: "EdsConfig", |
| 2378 |
reason: "embedded message failed validation", |
| 2379 |
cause: err, |
| 2380 |
}) |
| 2381 |
} |
| 2382 |
} |
| 2383 |
} else if v, ok := interface{}(m.GetEdsConfig()).(interface{ Validate() error }); ok { |
| 2384 |
if err := v.Validate(); err != nil { |
| 2385 |
return Cluster_EdsClusterConfigValidationError{ |
| 2386 |
field: "EdsConfig", |
| 2387 |
reason: "embedded message failed validation", |
| 2388 |
cause: err, |
| 2389 |
} |
| 2390 |
} |
| 2391 |
} |
| 2392 |
|
| 2393 |
// no validation rules for ServiceName |
| 2394 |
|
| 2395 |
if len(errors) > 0 { |
| 2396 |
return Cluster_EdsClusterConfigMultiError(errors) |
| 2397 |
} |
| 2398 |
|
| 2399 |
return nil |
| 2400 |
} |
| 2401 |
|
| 2402 |
// Cluster_EdsClusterConfigMultiError is an error wrapping multiple validation |
| 2403 |
// errors returned by Cluster_EdsClusterConfig.ValidateAll() if the designated |
| 2404 |
// constraints aren't met. |
| 2405 |
type Cluster_EdsClusterConfigMultiError []error |
| 2406 |
|
| 2407 |
// Error returns a concatenation of all the error messages it wraps. |
| 2408 |
func (m Cluster_EdsClusterConfigMultiError) Error() string { |
| 2409 |
var msgs []string |
| 2410 |
for _, err := range m { |
| 2411 |
msgs = append(msgs, err.Error()) |
| 2412 |
} |
| 2413 |
return strings.Join(msgs, "; ") |
| 2414 |
} |
| 2415 |
|
| 2416 |
// AllErrors returns a list of validation violation errors. |
| 2417 |
func (m Cluster_EdsClusterConfigMultiError) AllErrors() []error { return m } |
| 2418 |
|
| 2419 |
// Cluster_EdsClusterConfigValidationError is the validation error returned by |
| 2420 |
// Cluster_EdsClusterConfig.Validate if the designated constraints aren't met. |
| 2421 |
type Cluster_EdsClusterConfigValidationError struct { |
| 2422 |
field string |
| 2423 |
reason string |
| 2424 |
cause error |
| 2425 |
key bool |
| 2426 |
} |
| 2427 |
|
| 2428 |
// Field function returns field value. |
| 2429 |
func (e Cluster_EdsClusterConfigValidationError) Field() string { return e.field } |
| 2430 |
|
| 2431 |
// Reason function returns reason value. |
| 2432 |
func (e Cluster_EdsClusterConfigValidationError) Reason() string { return e.reason } |
| 2433 |
|
| 2434 |
// Cause function returns cause value. |
| 2435 |
func (e Cluster_EdsClusterConfigValidationError) Cause() error { return e.cause } |
| 2436 |
|
| 2437 |
// Key function returns key value. |
| 2438 |
func (e Cluster_EdsClusterConfigValidationError) Key() bool { return e.key } |
| 2439 |
|
| 2440 |
// ErrorName returns error name. |
| 2441 |
func (e Cluster_EdsClusterConfigValidationError) ErrorName() string { |
| 2442 |
return "Cluster_EdsClusterConfigValidationError" |
| 2443 |
} |
| 2444 |
|
| 2445 |
// Error satisfies the builtin error interface |
| 2446 |
func (e Cluster_EdsClusterConfigValidationError) Error() string { |
| 2447 |
cause := "" |
| 2448 |
if e.cause != nil { |
| 2449 |
cause = fmt.Sprintf(" | caused by: %v", e.cause) |
| 2450 |
} |
| 2451 |
|
| 2452 |
key := "" |
| 2453 |
if e.key { |
| 2454 |
key = "key for " |
| 2455 |
} |
| 2456 |
|
| 2457 |
return fmt.Sprintf( |
| 2458 |
"invalid %sCluster_EdsClusterConfig.%s: %s%s", |
| 2459 |
key, |
| 2460 |
e.field, |
| 2461 |
e.reason, |
| 2462 |
cause) |
| 2463 |
} |
| 2464 |
|
| 2465 |
var _ error = Cluster_EdsClusterConfigValidationError{} |
| 2466 |
|
| 2467 |
var _ interface { |
| 2468 |
Field() string |
| 2469 |
Reason() string |
| 2470 |
Key() bool |
| 2471 |
Cause() error |
| 2472 |
ErrorName() string |
| 2473 |
} = Cluster_EdsClusterConfigValidationError{} |
| 2474 |
|
| 2475 |
// Validate checks the field values on Cluster_LbSubsetConfig with the rules |
| 2476 |
// defined in the proto definition for this message. If any rules are |
| 2477 |
// violated, the first error encountered is returned, or nil if there are no violations. |
| 2478 |
func (m *Cluster_LbSubsetConfig) Validate() error { |
| 2479 |
return m.validate(false) |
| 2480 |
} |
| 2481 |
|
| 2482 |
// ValidateAll checks the field values on Cluster_LbSubsetConfig with the rules |
| 2483 |
// defined in the proto definition for this message. If any rules are |
| 2484 |
// violated, the result is a list of violation errors wrapped in |
| 2485 |
// Cluster_LbSubsetConfigMultiError, or nil if none found. |
| 2486 |
func (m *Cluster_LbSubsetConfig) ValidateAll() error { |
| 2487 |
return m.validate(true) |
| 2488 |
} |
| 2489 |
|
| 2490 |
func (m *Cluster_LbSubsetConfig) validate(all bool) error { |
| 2491 |
if m == nil { |
| 2492 |
return nil |
| 2493 |
} |
| 2494 |
|
| 2495 |
var errors []error |
| 2496 |
|
| 2497 |
if _, ok := Cluster_LbSubsetConfig_LbSubsetFallbackPolicy_name[int32(m.GetFallbackPolicy())]; !ok { |
| 2498 |
err := Cluster_LbSubsetConfigValidationError{ |
| 2499 |
field: "FallbackPolicy", |
| 2500 |
reason: "value must be one of the defined enum values", |
| 2501 |
} |
| 2502 |
if !all { |
| 2503 |
return err |
| 2504 |
} |
| 2505 |
errors = append(errors, err) |
| 2506 |
} |
| 2507 |
|
| 2508 |
if all { |
| 2509 |
switch v := interface{}(m.GetDefaultSubset()).(type) { |
| 2510 |
case interface{ ValidateAll() error }: |
| 2511 |
if err := v.ValidateAll(); err != nil { |
| 2512 |
errors = append(errors, Cluster_LbSubsetConfigValidationError{ |
| 2513 |
field: "DefaultSubset", |
| 2514 |
reason: "embedded message failed validation", |
| 2515 |
cause: err, |
| 2516 |
}) |
| 2517 |
} |
| 2518 |
case interface{ Validate() error }: |
| 2519 |
if err := v.Validate(); err != nil { |
| 2520 |
errors = append(errors, Cluster_LbSubsetConfigValidationError{ |
| 2521 |
field: "DefaultSubset", |
| 2522 |
reason: "embedded message failed validation", |
| 2523 |
cause: err, |
| 2524 |
}) |
| 2525 |
} |
| 2526 |
} |
| 2527 |
} else if v, ok := interface{}(m.GetDefaultSubset()).(interface{ Validate() error }); ok { |
| 2528 |
if err := v.Validate(); err != nil { |
| 2529 |
return Cluster_LbSubsetConfigValidationError{ |
| 2530 |
field: "DefaultSubset", |
| 2531 |
reason: "embedded message failed validation", |
| 2532 |
cause: err, |
| 2533 |
} |
| 2534 |
} |
| 2535 |
} |
| 2536 |
|
| 2537 |
for idx, item := range m.GetSubsetSelectors() { |
| 2538 |
_, _ = idx, item |
| 2539 |
|
| 2540 |
if all { |
| 2541 |
switch v := interface{}(item).(type) { |
| 2542 |
case interface{ ValidateAll() error }: |
| 2543 |
if err := v.ValidateAll(); err != nil { |
| 2544 |
errors = append(errors, Cluster_LbSubsetConfigValidationError{ |
| 2545 |
field: fmt.Sprintf("SubsetSelectors[%v]", idx), |
| 2546 |
reason: "embedded message failed validation", |
| 2547 |
cause: err, |
| 2548 |
}) |
| 2549 |
} |
| 2550 |
case interface{ Validate() error }: |
| 2551 |
if err := v.Validate(); err != nil { |
| 2552 |
errors = append(errors, Cluster_LbSubsetConfigValidationError{ |
| 2553 |
field: fmt.Sprintf("SubsetSelectors[%v]", idx), |
| 2554 |
reason: "embedded message failed validation", |
| 2555 |
cause: err, |
| 2556 |
}) |
| 2557 |
} |
| 2558 |
} |
| 2559 |
} else if v, ok := interface{}(item).(interface{ Validate() error }); ok { |
| 2560 |
if err := v.Validate(); err != nil { |
| 2561 |
return Cluster_LbSubsetConfigValidationError{ |
| 2562 |
field: fmt.Sprintf("SubsetSelectors[%v]", idx), |
| 2563 |
reason: "embedded message failed validation", |
| 2564 |
cause: err, |
| 2565 |
} |
| 2566 |
} |
| 2567 |
} |
| 2568 |
|
| 2569 |
} |
| 2570 |
|
| 2571 |
// no validation rules for LocalityWeightAware |
| 2572 |
|
| 2573 |
// no validation rules for ScaleLocalityWeight |
| 2574 |
|
| 2575 |
// no validation rules for PanicModeAny |
| 2576 |
|
| 2577 |
// no validation rules for ListAsAny |
| 2578 |
|
| 2579 |
if _, ok := Cluster_LbSubsetConfig_LbSubsetMetadataFallbackPolicy_name[int32(m.GetMetadataFallbackPolicy())]; !ok { |
| 2580 |
err := Cluster_LbSubsetConfigValidationError{ |
| 2581 |
field: "MetadataFallbackPolicy", |
| 2582 |
reason: "value must be one of the defined enum values", |
| 2583 |
} |
| 2584 |
if !all { |
| 2585 |
return err |
| 2586 |
} |
| 2587 |
errors = append(errors, err) |
| 2588 |
} |
| 2589 |
|
| 2590 |
if len(errors) > 0 { |
| 2591 |
return Cluster_LbSubsetConfigMultiError(errors) |
| 2592 |
} |
| 2593 |
|
| 2594 |
return nil |
| 2595 |
} |
| 2596 |
|
| 2597 |
// Cluster_LbSubsetConfigMultiError is an error wrapping multiple validation |
| 2598 |
// errors returned by Cluster_LbSubsetConfig.ValidateAll() if the designated |
| 2599 |
// constraints aren't met. |
| 2600 |
type Cluster_LbSubsetConfigMultiError []error |
| 2601 |
|
| 2602 |
// Error returns a concatenation of all the error messages it wraps. |
| 2603 |
func (m Cluster_LbSubsetConfigMultiError) Error() string { |
| 2604 |
var msgs []string |
| 2605 |
for _, err := range m { |
| 2606 |
msgs = append(msgs, err.Error()) |
| 2607 |
} |
| 2608 |
return strings.Join(msgs, "; ") |
| 2609 |
} |
| 2610 |
|
| 2611 |
// AllErrors returns a list of validation violation errors. |
| 2612 |
func (m Cluster_LbSubsetConfigMultiError) AllErrors() []error { return m } |
| 2613 |
|
| 2614 |
// Cluster_LbSubsetConfigValidationError is the validation error returned by |
| 2615 |
// Cluster_LbSubsetConfig.Validate if the designated constraints aren't met. |
| 2616 |
type Cluster_LbSubsetConfigValidationError struct { |
| 2617 |
field string |
| 2618 |
reason string |
| 2619 |
cause error |
| 2620 |
key bool |
| 2621 |
} |
| 2622 |
|
| 2623 |
// Field function returns field value. |
| 2624 |
func (e Cluster_LbSubsetConfigValidationError) Field() string { return e.field } |
| 2625 |
|
| 2626 |
// Reason function returns reason value. |
| 2627 |
func (e Cluster_LbSubsetConfigValidationError) Reason() string { return e.reason } |
| 2628 |
|
| 2629 |
// Cause function returns cause value. |
| 2630 |
func (e Cluster_LbSubsetConfigValidationError) Cause() error { return e.cause } |
| 2631 |
|
| 2632 |
// Key function returns key value. |
| 2633 |
func (e Cluster_LbSubsetConfigValidationError) Key() bool { return e.key } |
| 2634 |
|
| 2635 |
// ErrorName returns error name. |
| 2636 |
func (e Cluster_LbSubsetConfigValidationError) ErrorName() string { |
| 2637 |
return "Cluster_LbSubsetConfigValidationError" |
| 2638 |
} |
| 2639 |
|
| 2640 |
// Error satisfies the builtin error interface |
| 2641 |
func (e Cluster_LbSubsetConfigValidationError) Error() string { |
| 2642 |
cause := "" |
| 2643 |
if e.cause != nil { |
| 2644 |
cause = fmt.Sprintf(" | caused by: %v", e.cause) |
| 2645 |
} |
| 2646 |
|
| 2647 |
key := "" |
| 2648 |
if e.key { |
| 2649 |
key = "key for " |
| 2650 |
} |
| 2651 |
|
| 2652 |
return fmt.Sprintf( |
| 2653 |
"invalid %sCluster_LbSubsetConfig.%s: %s%s", |
| 2654 |
key, |
| 2655 |
e.field, |
| 2656 |
e.reason, |
| 2657 |
cause) |
| 2658 |
} |
| 2659 |
|
| 2660 |
var _ error = Cluster_LbSubsetConfigValidationError{} |
| 2661 |
|
| 2662 |
var _ interface { |
| 2663 |
Field() string |
| 2664 |
Reason() string |
| 2665 |
Key() bool |
| 2666 |
Cause() error |
| 2667 |
ErrorName() string |
| 2668 |
} = Cluster_LbSubsetConfigValidationError{} |
| 2669 |
|
| 2670 |
// Validate checks the field values on Cluster_SlowStartConfig with the rules |
| 2671 |
// defined in the proto definition for this message. If any rules are |
| 2672 |
// violated, the first error encountered is returned, or nil if there are no violations. |
| 2673 |
func (m *Cluster_SlowStartConfig) Validate() error { |
| 2674 |
return m.validate(false) |
| 2675 |
} |
| 2676 |
|
| 2677 |
// ValidateAll checks the field values on Cluster_SlowStartConfig with the |
| 2678 |
// rules defined in the proto definition for this message. If any rules are |
| 2679 |
// violated, the result is a list of violation errors wrapped in |
| 2680 |
// Cluster_SlowStartConfigMultiError, or nil if none found. |
| 2681 |
func (m *Cluster_SlowStartConfig) ValidateAll() error { |
| 2682 |
return m.validate(true) |
| 2683 |
} |
| 2684 |
|
| 2685 |
func (m *Cluster_SlowStartConfig) validate(all bool) error { |
| 2686 |
if m == nil { |
| 2687 |
return nil |
| 2688 |
} |
| 2689 |
|
| 2690 |
var errors []error |
| 2691 |
|
| 2692 |
if all { |
| 2693 |
switch v := interface{}(m.GetSlowStartWindow()).(type) { |
| 2694 |
case interface{ ValidateAll() error }: |
| 2695 |
if err := v.ValidateAll(); err != nil { |
| 2696 |
errors = append(errors, Cluster_SlowStartConfigValidationError{ |
| 2697 |
field: "SlowStartWindow", |
| 2698 |
reason: "embedded message failed validation", |
| 2699 |
cause: err, |
| 2700 |
}) |
| 2701 |
} |
| 2702 |
case interface{ Validate() error }: |
| 2703 |
if err := v.Validate(); err != nil { |
| 2704 |
errors = append(errors, Cluster_SlowStartConfigValidationError{ |
| 2705 |
field: "SlowStartWindow", |
| 2706 |
reason: "embedded message failed validation", |
| 2707 |
cause: err, |
| 2708 |
}) |
| 2709 |
} |
| 2710 |
} |
| 2711 |
} else if v, ok := interface{}(m.GetSlowStartWindow()).(interface{ Validate() error }); ok { |
| 2712 |
if err := v.Validate(); err != nil { |
| 2713 |
return Cluster_SlowStartConfigValidationError{ |
| 2714 |
field: "SlowStartWindow", |
| 2715 |
reason: "embedded message failed validation", |
| 2716 |
cause: err, |
| 2717 |
} |
| 2718 |
} |
| 2719 |
} |
| 2720 |
|
| 2721 |
if all { |
| 2722 |
switch v := interface{}(m.GetAggression()).(type) { |
| 2723 |
case interface{ ValidateAll() error }: |
| 2724 |
if err := v.ValidateAll(); err != nil { |
| 2725 |
errors = append(errors, Cluster_SlowStartConfigValidationError{ |
| 2726 |
field: "Aggression", |
| 2727 |
reason: "embedded message failed validation", |
| 2728 |
cause: err, |
| 2729 |
}) |
| 2730 |
} |
| 2731 |
case interface{ Validate() error }: |
| 2732 |
if err := v.Validate(); err != nil { |
| 2733 |
errors = append(errors, Cluster_SlowStartConfigValidationError{ |
| 2734 |
field: "Aggression", |
| 2735 |
reason: "embedded message failed validation", |
| 2736 |
cause: err, |
| 2737 |
}) |
| 2738 |
} |
| 2739 |
} |
| 2740 |
} else if v, ok := interface{}(m.GetAggression()).(interface{ Validate() error }); ok { |
| 2741 |
if err := v.Validate(); err != nil { |
| 2742 |
return Cluster_SlowStartConfigValidationError{ |
| 2743 |
field: "Aggression", |
| 2744 |
reason: "embedded message failed validation", |
| 2745 |
cause: err, |
| 2746 |
} |
| 2747 |
} |
| 2748 |
} |
| 2749 |
|
| 2750 |
if all { |
| 2751 |
switch v := interface{}(m.GetMinWeightPercent()).(type) { |
| 2752 |
case interface{ ValidateAll() error }: |
| 2753 |
if err := v.ValidateAll(); err != nil { |
| 2754 |
errors = append(errors, Cluster_SlowStartConfigValidationError{ |
| 2755 |
field: "MinWeightPercent", |
| 2756 |
reason: "embedded message failed validation", |
| 2757 |
cause: err, |
| 2758 |
}) |
| 2759 |
} |
| 2760 |
case interface{ Validate() error }: |
| 2761 |
if err := v.Validate(); err != nil { |
| 2762 |
errors = append(errors, Cluster_SlowStartConfigValidationError{ |
| 2763 |
field: "MinWeightPercent", |
| 2764 |
reason: "embedded message failed validation", |
| 2765 |
cause: err, |
| 2766 |
}) |
| 2767 |
} |
| 2768 |
} |
| 2769 |
} else if v, ok := interface{}(m.GetMinWeightPercent()).(interface{ Validate() error }); ok { |
| 2770 |
if err := v.Validate(); err != nil { |
| 2771 |
return Cluster_SlowStartConfigValidationError{ |
| 2772 |
field: "MinWeightPercent", |
| 2773 |
reason: "embedded message failed validation", |
| 2774 |
cause: err, |
| 2775 |
} |
| 2776 |
} |
| 2777 |
} |
| 2778 |
|
| 2779 |
if len(errors) > 0 { |
| 2780 |
return Cluster_SlowStartConfigMultiError(errors) |
| 2781 |
} |
| 2782 |
|
| 2783 |
return nil |
| 2784 |
} |
| 2785 |
|
| 2786 |
// Cluster_SlowStartConfigMultiError is an error wrapping multiple validation |
| 2787 |
// errors returned by Cluster_SlowStartConfig.ValidateAll() if the designated |
| 2788 |
// constraints aren't met. |
| 2789 |
type Cluster_SlowStartConfigMultiError []error |
| 2790 |
|
| 2791 |
// Error returns a concatenation of all the error messages it wraps. |
| 2792 |
func (m Cluster_SlowStartConfigMultiError) Error() string { |
| 2793 |
var msgs []string |
| 2794 |
for _, err := range m { |
| 2795 |
msgs = append(msgs, err.Error()) |
| 2796 |
} |
| 2797 |
return strings.Join(msgs, "; ") |
| 2798 |
} |
| 2799 |
|
| 2800 |
// AllErrors returns a list of validation violation errors. |
| 2801 |
func (m Cluster_SlowStartConfigMultiError) AllErrors() []error { return m } |
| 2802 |
|
| 2803 |
// Cluster_SlowStartConfigValidationError is the validation error returned by |
| 2804 |
// Cluster_SlowStartConfig.Validate if the designated constraints aren't met. |
| 2805 |
type Cluster_SlowStartConfigValidationError struct { |
| 2806 |
field string |
| 2807 |
reason string |
| 2808 |
cause error |
| 2809 |
key bool |
| 2810 |
} |
| 2811 |
|
| 2812 |
// Field function returns field value. |
| 2813 |
func (e Cluster_SlowStartConfigValidationError) Field() string { return e.field } |
| 2814 |
|
| 2815 |
// Reason function returns reason value. |
| 2816 |
func (e Cluster_SlowStartConfigValidationError) Reason() string { return e.reason } |
| 2817 |
|
| 2818 |
// Cause function returns cause value. |
| 2819 |
func (e Cluster_SlowStartConfigValidationError) Cause() error { return e.cause } |
| 2820 |
|
| 2821 |
// Key function returns key value. |
| 2822 |
func (e Cluster_SlowStartConfigValidationError) Key() bool { return e.key } |
| 2823 |
|
| 2824 |
// ErrorName returns error name. |
| 2825 |
func (e Cluster_SlowStartConfigValidationError) ErrorName() string { |
| 2826 |
return "Cluster_SlowStartConfigValidationError" |
| 2827 |
} |
| 2828 |
|
| 2829 |
// Error satisfies the builtin error interface |
| 2830 |
func (e Cluster_SlowStartConfigValidationError) Error() string { |
| 2831 |
cause := "" |
| 2832 |
if e.cause != nil { |
| 2833 |
cause = fmt.Sprintf(" | caused by: %v", e.cause) |
| 2834 |
} |
| 2835 |
|
| 2836 |
key := "" |
| 2837 |
if e.key { |
| 2838 |
key = "key for " |
| 2839 |
} |
| 2840 |
|
| 2841 |
return fmt.Sprintf( |
| 2842 |
"invalid %sCluster_SlowStartConfig.%s: %s%s", |
| 2843 |
key, |
| 2844 |
e.field, |
| 2845 |
e.reason, |
| 2846 |
cause) |
| 2847 |
} |
| 2848 |
|
| 2849 |
var _ error = Cluster_SlowStartConfigValidationError{} |
| 2850 |
|
| 2851 |
var _ interface { |
| 2852 |
Field() string |
| 2853 |
Reason() string |
| 2854 |
Key() bool |
| 2855 |
Cause() error |
| 2856 |
ErrorName() string |
| 2857 |
} = Cluster_SlowStartConfigValidationError{} |
| 2858 |
|
| 2859 |
// Validate checks the field values on Cluster_RoundRobinLbConfig with the |
| 2860 |
// rules defined in the proto definition for this message. If any rules are |
| 2861 |
// violated, the first error encountered is returned, or nil if there are no violations. |
| 2862 |
func (m *Cluster_RoundRobinLbConfig) Validate() error { |
| 2863 |
return m.validate(false) |
| 2864 |
} |
| 2865 |
|
| 2866 |
// ValidateAll checks the field values on Cluster_RoundRobinLbConfig with the |
| 2867 |
// rules defined in the proto definition for this message. If any rules are |
| 2868 |
// violated, the result is a list of violation errors wrapped in |
| 2869 |
// Cluster_RoundRobinLbConfigMultiError, or nil if none found. |
| 2870 |
func (m *Cluster_RoundRobinLbConfig) ValidateAll() error { |
| 2871 |
return m.validate(true) |
| 2872 |
} |
| 2873 |
|
| 2874 |
func (m *Cluster_RoundRobinLbConfig) validate(all bool) error { |
| 2875 |
if m == nil { |
| 2876 |
return nil |
| 2877 |
} |
| 2878 |
|
| 2879 |
var errors []error |
| 2880 |
|
| 2881 |
if all { |
| 2882 |
switch v := interface{}(m.GetSlowStartConfig()).(type) { |
| 2883 |
case interface{ ValidateAll() error }: |
| 2884 |
if err := v.ValidateAll(); err != nil { |
| 2885 |
errors = append(errors, Cluster_RoundRobinLbConfigValidationError{ |
| 2886 |
field: "SlowStartConfig", |
| 2887 |
reason: "embedded message failed validation", |
| 2888 |
cause: err, |
| 2889 |
}) |
| 2890 |
} |
| 2891 |
case interface{ Validate() error }: |
| 2892 |
if err := v.Validate(); err != nil { |
| 2893 |
errors = append(errors, Cluster_RoundRobinLbConfigValidationError{ |
| 2894 |
field: "SlowStartConfig", |
| 2895 |
reason: "embedded message failed validation", |
| 2896 |
cause: err, |
| 2897 |
}) |
| 2898 |
} |
| 2899 |
} |
| 2900 |
} else if v, ok := interface{}(m.GetSlowStartConfig()).(interface{ Validate() error }); ok { |
| 2901 |
if err := v.Validate(); err != nil { |
| 2902 |
return Cluster_RoundRobinLbConfigValidationError{ |
| 2903 |
field: "SlowStartConfig", |
| 2904 |
reason: "embedded message failed validation", |
| 2905 |
cause: err, |
| 2906 |
} |
| 2907 |
} |
| 2908 |
} |
| 2909 |
|
| 2910 |
if len(errors) > 0 { |
| 2911 |
return Cluster_RoundRobinLbConfigMultiError(errors) |
| 2912 |
} |
| 2913 |
|
| 2914 |
return nil |
| 2915 |
} |
| 2916 |
|
| 2917 |
// Cluster_RoundRobinLbConfigMultiError is an error wrapping multiple |
| 2918 |
// validation errors returned by Cluster_RoundRobinLbConfig.ValidateAll() if |
| 2919 |
// the designated constraints aren't met. |
| 2920 |
type Cluster_RoundRobinLbConfigMultiError []error |
| 2921 |
|
| 2922 |
// Error returns a concatenation of all the error messages it wraps. |
| 2923 |
func (m Cluster_RoundRobinLbConfigMultiError) Error() string { |
| 2924 |
var msgs []string |
| 2925 |
for _, err := range m { |
| 2926 |
msgs = append(msgs, err.Error()) |
| 2927 |
} |
| 2928 |
return strings.Join(msgs, "; ") |
| 2929 |
} |
| 2930 |
|
| 2931 |
// AllErrors returns a list of validation violation errors. |
| 2932 |
func (m Cluster_RoundRobinLbConfigMultiError) AllErrors() []error { return m } |
| 2933 |
|
| 2934 |
// Cluster_RoundRobinLbConfigValidationError is the validation error returned |
| 2935 |
// by Cluster_RoundRobinLbConfig.Validate if the designated constraints aren't met. |
| 2936 |
type Cluster_RoundRobinLbConfigValidationError struct { |
| 2937 |
field string |
| 2938 |
reason string |
| 2939 |
cause error |
| 2940 |
key bool |
| 2941 |
} |
| 2942 |
|
| 2943 |
// Field function returns field value. |
| 2944 |
func (e Cluster_RoundRobinLbConfigValidationError) Field() string { return e.field } |
| 2945 |
|
| 2946 |
// Reason function returns reason value. |
| 2947 |
func (e Cluster_RoundRobinLbConfigValidationError) Reason() string { return e.reason } |
| 2948 |
|
| 2949 |
// Cause function returns cause value. |
| 2950 |
func (e Cluster_RoundRobinLbConfigValidationError) Cause() error { return e.cause } |
| 2951 |
|
| 2952 |
// Key function returns key value. |
| 2953 |
func (e Cluster_RoundRobinLbConfigValidationError) Key() bool { return e.key } |
| 2954 |
|
| 2955 |
// ErrorName returns error name. |
| 2956 |
func (e Cluster_RoundRobinLbConfigValidationError) ErrorName() string { |
| 2957 |
return "Cluster_RoundRobinLbConfigValidationError" |
| 2958 |
} |
| 2959 |
|
| 2960 |
// Error satisfies the builtin error interface |
| 2961 |
func (e Cluster_RoundRobinLbConfigValidationError) Error() string { |
| 2962 |
cause := "" |
| 2963 |
if e.cause != nil { |
| 2964 |
cause = fmt.Sprintf(" | caused by: %v", e.cause) |
| 2965 |
} |
| 2966 |
|
| 2967 |
key := "" |
| 2968 |
if e.key { |
| 2969 |
key = "key for " |
| 2970 |
} |
| 2971 |
|
| 2972 |
return fmt.Sprintf( |
| 2973 |
"invalid %sCluster_RoundRobinLbConfig.%s: %s%s", |
| 2974 |
key, |
| 2975 |
e.field, |
| 2976 |
e.reason, |
| 2977 |
cause) |
| 2978 |
} |
| 2979 |
|
| 2980 |
var _ error = Cluster_RoundRobinLbConfigValidationError{} |
| 2981 |
|
| 2982 |
var _ interface { |
| 2983 |
Field() string |
| 2984 |
Reason() string |
| 2985 |
Key() bool |
| 2986 |
Cause() error |
| 2987 |
ErrorName() string |
| 2988 |
} = Cluster_RoundRobinLbConfigValidationError{} |
| 2989 |
|
| 2990 |
// Validate checks the field values on Cluster_LeastRequestLbConfig with the |
| 2991 |
// rules defined in the proto definition for this message. If any rules are |
| 2992 |
// violated, the first error encountered is returned, or nil if there are no violations. |
| 2993 |
func (m *Cluster_LeastRequestLbConfig) Validate() error { |
| 2994 |
return m.validate(false) |
| 2995 |
} |
| 2996 |
|
| 2997 |
// ValidateAll checks the field values on Cluster_LeastRequestLbConfig with the |
| 2998 |
// rules defined in the proto definition for this message. If any rules are |
| 2999 |
// violated, the result is a list of violation errors wrapped in |
| 3000 |
// Cluster_LeastRequestLbConfigMultiError, or nil if none found. |
| 3001 |
func (m *Cluster_LeastRequestLbConfig) ValidateAll() error { |
| 3002 |
return m.validate(true) |
| 3003 |
} |
| 3004 |
|
| 3005 |
func (m *Cluster_LeastRequestLbConfig) validate(all bool) error { |
| 3006 |
if m == nil { |
| 3007 |
return nil |
| 3008 |
} |
| 3009 |
|
| 3010 |
var errors []error |
| 3011 |
|
| 3012 |
if wrapper := m.GetChoiceCount(); wrapper != nil { |
| 3013 |
|
| 3014 |
if wrapper.GetValue() < 2 { |
| 3015 |
err := Cluster_LeastRequestLbConfigValidationError{ |
| 3016 |
field: "ChoiceCount", |
| 3017 |
reason: "value must be greater than or equal to 2", |
| 3018 |
} |
| 3019 |
if !all { |
| 3020 |
return err |
| 3021 |
} |
| 3022 |
errors = append(errors, err) |
| 3023 |
} |
| 3024 |
|
| 3025 |
} |
| 3026 |
|
| 3027 |
if all { |
| 3028 |
switch v := interface{}(m.GetActiveRequestBias()).(type) { |
| 3029 |
case interface{ ValidateAll() error }: |
| 3030 |
if err := v.ValidateAll(); err != nil { |
| 3031 |
errors = append(errors, Cluster_LeastRequestLbConfigValidationError{ |
| 3032 |
field: "ActiveRequestBias", |
| 3033 |
reason: "embedded message failed validation", |
| 3034 |
cause: err, |
| 3035 |
}) |
| 3036 |
} |
| 3037 |
case interface{ Validate() error }: |
| 3038 |
if err := v.Validate(); err != nil { |
| 3039 |
errors = append(errors, Cluster_LeastRequestLbConfigValidationError{ |
| 3040 |
field: "ActiveRequestBias", |
| 3041 |
reason: "embedded message failed validation", |
| 3042 |
cause: err, |
| 3043 |
}) |
| 3044 |
} |
| 3045 |
} |
| 3046 |
} else if v, ok := interface{}(m.GetActiveRequestBias()).(interface{ Validate() error }); ok { |
| 3047 |
if err := v.Validate(); err != nil { |
| 3048 |
return Cluster_LeastRequestLbConfigValidationError{ |
| 3049 |
field: "ActiveRequestBias", |
| 3050 |
reason: "embedded message failed validation", |
| 3051 |
cause: err, |
| 3052 |
} |
| 3053 |
} |
| 3054 |
} |
| 3055 |
|
| 3056 |
if all { |
| 3057 |
switch v := interface{}(m.GetSlowStartConfig()).(type) { |
| 3058 |
case interface{ ValidateAll() error }: |
| 3059 |
if err := v.ValidateAll(); err != nil { |
| 3060 |
errors = append(errors, Cluster_LeastRequestLbConfigValidationError{ |
| 3061 |
field: "SlowStartConfig", |
| 3062 |
reason: "embedded message failed validation", |
| 3063 |
cause: err, |
| 3064 |
}) |
| 3065 |
} |
| 3066 |
case interface{ Validate() error }: |
| 3067 |
if err := v.Validate(); err != nil { |
| 3068 |
errors = append(errors, Cluster_LeastRequestLbConfigValidationError{ |
| 3069 |
field: "SlowStartConfig", |
| 3070 |
reason: "embedded message failed validation", |
| 3071 |
cause: err, |
| 3072 |
}) |
| 3073 |
} |
| 3074 |
} |
| 3075 |
} else if v, ok := interface{}(m.GetSlowStartConfig()).(interface{ Validate() error }); ok { |
| 3076 |
if err := v.Validate(); err != nil { |
| 3077 |
return Cluster_LeastRequestLbConfigValidationError{ |
| 3078 |
field: "SlowStartConfig", |
| 3079 |
reason: "embedded message failed validation", |
| 3080 |
cause: err, |
| 3081 |
} |
| 3082 |
} |
| 3083 |
} |
| 3084 |
|
| 3085 |
if len(errors) > 0 { |
| 3086 |
return Cluster_LeastRequestLbConfigMultiError(errors) |
| 3087 |
} |
| 3088 |
|
| 3089 |
return nil |
| 3090 |
} |
| 3091 |
|
| 3092 |
// Cluster_LeastRequestLbConfigMultiError is an error wrapping multiple |
| 3093 |
// validation errors returned by Cluster_LeastRequestLbConfig.ValidateAll() if |
| 3094 |
// the designated constraints aren't met. |
| 3095 |
type Cluster_LeastRequestLbConfigMultiError []error |
| 3096 |
|
| 3097 |
// Error returns a concatenation of all the error messages it wraps. |
| 3098 |
func (m Cluster_LeastRequestLbConfigMultiError) Error() string { |
| 3099 |
var msgs []string |
| 3100 |
for _, err := range m { |
| 3101 |
msgs = append(msgs, err.Error()) |
| 3102 |
} |
| 3103 |
return strings.Join(msgs, "; ") |
| 3104 |
} |
| 3105 |
|
| 3106 |
// AllErrors returns a list of validation violation errors. |
| 3107 |
func (m Cluster_LeastRequestLbConfigMultiError) AllErrors() []error { return m } |
| 3108 |
|
| 3109 |
// Cluster_LeastRequestLbConfigValidationError is the validation error returned |
| 3110 |
// by Cluster_LeastRequestLbConfig.Validate if the designated constraints |
| 3111 |
// aren't met. |
| 3112 |
type Cluster_LeastRequestLbConfigValidationError struct { |
| 3113 |
field string |
| 3114 |
reason string |
| 3115 |
cause error |
| 3116 |
key bool |
| 3117 |
} |
| 3118 |
|
| 3119 |
// Field function returns field value. |
| 3120 |
func (e Cluster_LeastRequestLbConfigValidationError) Field() string { return e.field } |
| 3121 |
|
| 3122 |
// Reason function returns reason value. |
| 3123 |
func (e Cluster_LeastRequestLbConfigValidationError) Reason() string { return e.reason } |
| 3124 |
|
| 3125 |
// Cause function returns cause value. |
| 3126 |
func (e Cluster_LeastRequestLbConfigValidationError) Cause() error { return e.cause } |
| 3127 |
|
| 3128 |
// Key function returns key value. |
| 3129 |
func (e Cluster_LeastRequestLbConfigValidationError) Key() bool { return e.key } |
| 3130 |
|
| 3131 |
// ErrorName returns error name. |
| 3132 |
func (e Cluster_LeastRequestLbConfigValidationError) ErrorName() string { |
| 3133 |
return "Cluster_LeastRequestLbConfigValidationError" |
| 3134 |
} |
| 3135 |
|
| 3136 |
// Error satisfies the builtin error interface |
| 3137 |
func (e Cluster_LeastRequestLbConfigValidationError) Error() string { |
| 3138 |
cause := "" |
| 3139 |
if e.cause != nil { |
| 3140 |
cause = fmt.Sprintf(" | caused by: %v", e.cause) |
| 3141 |
} |
| 3142 |
|
| 3143 |
key := "" |
| 3144 |
if e.key { |
| 3145 |
key = "key for " |
| 3146 |
} |
| 3147 |
|
| 3148 |
return fmt.Sprintf( |
| 3149 |
"invalid %sCluster_LeastRequestLbConfig.%s: %s%s", |
| 3150 |
key, |
| 3151 |
e.field, |
| 3152 |
e.reason, |
| 3153 |
cause) |
| 3154 |
} |
| 3155 |
|
| 3156 |
var _ error = Cluster_LeastRequestLbConfigValidationError{} |
| 3157 |
|
| 3158 |
var _ interface { |
| 3159 |
Field() string |
| 3160 |
Reason() string |
| 3161 |
Key() bool |
| 3162 |
Cause() error |
| 3163 |
ErrorName() string |
| 3164 |
} = Cluster_LeastRequestLbConfigValidationError{} |
| 3165 |
|
| 3166 |
// Validate checks the field values on Cluster_RingHashLbConfig with the rules |
| 3167 |
// defined in the proto definition for this message. If any rules are |
| 3168 |
// violated, the first error encountered is returned, or nil if there are no violations. |
| 3169 |
func (m *Cluster_RingHashLbConfig) Validate() error { |
| 3170 |
return m.validate(false) |
| 3171 |
} |
| 3172 |
|
| 3173 |
// ValidateAll checks the field values on Cluster_RingHashLbConfig with the |
| 3174 |
// rules defined in the proto definition for this message. If any rules are |
| 3175 |
// violated, the result is a list of violation errors wrapped in |
| 3176 |
// Cluster_RingHashLbConfigMultiError, or nil if none found. |
| 3177 |
func (m *Cluster_RingHashLbConfig) ValidateAll() error { |
| 3178 |
return m.validate(true) |
| 3179 |
} |
| 3180 |
|
| 3181 |
func (m *Cluster_RingHashLbConfig) validate(all bool) error { |
| 3182 |
if m == nil { |
| 3183 |
return nil |
| 3184 |
} |
| 3185 |
|
| 3186 |
var errors []error |
| 3187 |
|
| 3188 |
if wrapper := m.GetMinimumRingSize(); wrapper != nil { |
| 3189 |
|
| 3190 |
if wrapper.GetValue() > 8388608 { |
| 3191 |
err := Cluster_RingHashLbConfigValidationError{ |
| 3192 |
field: "MinimumRingSize", |
| 3193 |
reason: "value must be less than or equal to 8388608", |
| 3194 |
} |
| 3195 |
if !all { |
| 3196 |
return err |
| 3197 |
} |
| 3198 |
errors = append(errors, err) |
| 3199 |
} |
| 3200 |
|
| 3201 |
} |
| 3202 |
|
| 3203 |
if _, ok := Cluster_RingHashLbConfig_HashFunction_name[int32(m.GetHashFunction())]; !ok { |
| 3204 |
err := Cluster_RingHashLbConfigValidationError{ |
| 3205 |
field: "HashFunction", |
| 3206 |
reason: "value must be one of the defined enum values", |
| 3207 |
} |
| 3208 |
if !all { |
| 3209 |
return err |
| 3210 |
} |
| 3211 |
errors = append(errors, err) |
| 3212 |
} |
| 3213 |
|
| 3214 |
if wrapper := m.GetMaximumRingSize(); wrapper != nil { |
| 3215 |
|
| 3216 |
if wrapper.GetValue() > 8388608 { |
| 3217 |
err := Cluster_RingHashLbConfigValidationError{ |
| 3218 |
field: "MaximumRingSize", |
| 3219 |
reason: "value must be less than or equal to 8388608", |
| 3220 |
} |
| 3221 |
if !all { |
| 3222 |
return err |
| 3223 |
} |
| 3224 |
errors = append(errors, err) |
| 3225 |
} |
| 3226 |
|
| 3227 |
} |
| 3228 |
|
| 3229 |
if len(errors) > 0 { |
| 3230 |
return Cluster_RingHashLbConfigMultiError(errors) |
| 3231 |
} |
| 3232 |
|
| 3233 |
return nil |
| 3234 |
} |
| 3235 |
|
| 3236 |
// Cluster_RingHashLbConfigMultiError is an error wrapping multiple validation |
| 3237 |
// errors returned by Cluster_RingHashLbConfig.ValidateAll() if the designated |
| 3238 |
// constraints aren't met. |
| 3239 |
type Cluster_RingHashLbConfigMultiError []error |
| 3240 |
|
| 3241 |
// Error returns a concatenation of all the error messages it wraps. |
| 3242 |
func (m Cluster_RingHashLbConfigMultiError) Error() string { |
| 3243 |
var msgs []string |
| 3244 |
for _, err := range m { |
| 3245 |
msgs = append(msgs, err.Error()) |
| 3246 |
} |
| 3247 |
return strings.Join(msgs, "; ") |
| 3248 |
} |
| 3249 |
|
| 3250 |
// AllErrors returns a list of validation violation errors. |
| 3251 |
func (m Cluster_RingHashLbConfigMultiError) AllErrors() []error { return m } |
| 3252 |
|
| 3253 |
// Cluster_RingHashLbConfigValidationError is the validation error returned by |
| 3254 |
// Cluster_RingHashLbConfig.Validate if the designated constraints aren't met. |
| 3255 |
type Cluster_RingHashLbConfigValidationError struct { |
| 3256 |
field string |
| 3257 |
reason string |
| 3258 |
cause error |
| 3259 |
key bool |
| 3260 |
} |
| 3261 |
|
| 3262 |
// Field function returns field value. |
| 3263 |
func (e Cluster_RingHashLbConfigValidationError) Field() string { return e.field } |
| 3264 |
|
| 3265 |
// Reason function returns reason value. |
| 3266 |
func (e Cluster_RingHashLbConfigValidationError) Reason() string { return e.reason } |
| 3267 |
|
| 3268 |
// Cause function returns cause value. |
| 3269 |
func (e Cluster_RingHashLbConfigValidationError) Cause() error { return e.cause } |
| 3270 |
|
| 3271 |
// Key function returns key value. |
| 3272 |
func (e Cluster_RingHashLbConfigValidationError) Key() bool { return e.key } |
| 3273 |
|
| 3274 |
// ErrorName returns error name. |
| 3275 |
func (e Cluster_RingHashLbConfigValidationError) ErrorName() string { |
| 3276 |
return "Cluster_RingHashLbConfigValidationError" |
| 3277 |
} |
| 3278 |
|
| 3279 |
// Error satisfies the builtin error interface |
| 3280 |
func (e Cluster_RingHashLbConfigValidationError) Error() string { |
| 3281 |
cause := "" |
| 3282 |
if e.cause != nil { |
| 3283 |
cause = fmt.Sprintf(" | caused by: %v", e.cause) |
| 3284 |
} |
| 3285 |
|
| 3286 |
key := "" |
| 3287 |
if e.key { |
| 3288 |
key = "key for " |
| 3289 |
} |
| 3290 |
|
| 3291 |
return fmt.Sprintf( |
| 3292 |
"invalid %sCluster_RingHashLbConfig.%s: %s%s", |
| 3293 |
key, |
| 3294 |
e.field, |
| 3295 |
e.reason, |
| 3296 |
cause) |
| 3297 |
} |
| 3298 |
|
| 3299 |
var _ error = Cluster_RingHashLbConfigValidationError{} |
| 3300 |
|
| 3301 |
var _ interface { |
| 3302 |
Field() string |
| 3303 |
Reason() string |
| 3304 |
Key() bool |
| 3305 |
Cause() error |
| 3306 |
ErrorName() string |
| 3307 |
} = Cluster_RingHashLbConfigValidationError{} |
| 3308 |
|
| 3309 |
// Validate checks the field values on Cluster_MaglevLbConfig with the rules |
| 3310 |
// defined in the proto definition for this message. If any rules are |
| 3311 |
// violated, the first error encountered is returned, or nil if there are no violations. |
| 3312 |
func (m *Cluster_MaglevLbConfig) Validate() error { |
| 3313 |
return m.validate(false) |
| 3314 |
} |
| 3315 |
|
| 3316 |
// ValidateAll checks the field values on Cluster_MaglevLbConfig with the rules |
| 3317 |
// defined in the proto definition for this message. If any rules are |
| 3318 |
// violated, the result is a list of violation errors wrapped in |
| 3319 |
// Cluster_MaglevLbConfigMultiError, or nil if none found. |
| 3320 |
func (m *Cluster_MaglevLbConfig) ValidateAll() error { |
| 3321 |
return m.validate(true) |
| 3322 |
} |
| 3323 |
|
| 3324 |
func (m *Cluster_MaglevLbConfig) validate(all bool) error { |
| 3325 |
if m == nil { |
| 3326 |
return nil |
| 3327 |
} |
| 3328 |
|
| 3329 |
var errors []error |
| 3330 |
|
| 3331 |
if wrapper := m.GetTableSize(); wrapper != nil { |
| 3332 |
|
| 3333 |
if wrapper.GetValue() > 5000011 { |
| 3334 |
err := Cluster_MaglevLbConfigValidationError{ |
| 3335 |
field: "TableSize", |
| 3336 |
reason: "value must be less than or equal to 5000011", |
| 3337 |
} |
| 3338 |
if !all { |
| 3339 |
return err |
| 3340 |
} |
| 3341 |
errors = append(errors, err) |
| 3342 |
} |
| 3343 |
|
| 3344 |
} |
| 3345 |
|
| 3346 |
if len(errors) > 0 { |
| 3347 |
return Cluster_MaglevLbConfigMultiError(errors) |
| 3348 |
} |
| 3349 |
|
| 3350 |
return nil |
| 3351 |
} |
| 3352 |
|
| 3353 |
// Cluster_MaglevLbConfigMultiError is an error wrapping multiple validation |
| 3354 |
// errors returned by Cluster_MaglevLbConfig.ValidateAll() if the designated |
| 3355 |
// constraints aren't met. |
| 3356 |
type Cluster_MaglevLbConfigMultiError []error |
| 3357 |
|
| 3358 |
// Error returns a concatenation of all the error messages it wraps. |
| 3359 |
func (m Cluster_MaglevLbConfigMultiError) Error() string { |
| 3360 |
var msgs []string |
| 3361 |
for _, err := range m { |
| 3362 |
msgs = append(msgs, err.Error()) |
| 3363 |
} |
| 3364 |
return strings.Join(msgs, "; ") |
| 3365 |
} |
| 3366 |
|
| 3367 |
// AllErrors returns a list of validation violation errors. |
| 3368 |
func (m Cluster_MaglevLbConfigMultiError) AllErrors() []error { return m } |
| 3369 |
|
| 3370 |
// Cluster_MaglevLbConfigValidationError is the validation error returned by |
| 3371 |
// Cluster_MaglevLbConfig.Validate if the designated constraints aren't met. |
| 3372 |
type Cluster_MaglevLbConfigValidationError struct { |
| 3373 |
field string |
| 3374 |
reason string |
| 3375 |
cause error |
| 3376 |
key bool |
| 3377 |
} |
| 3378 |
|
| 3379 |
// Field function returns field value. |
| 3380 |
func (e Cluster_MaglevLbConfigValidationError) Field() string { return e.field } |
| 3381 |
|
| 3382 |
// Reason function returns reason value. |
| 3383 |
func (e Cluster_MaglevLbConfigValidationError) Reason() string { return e.reason } |
| 3384 |
|
| 3385 |
// Cause function returns cause value. |
| 3386 |
func (e Cluster_MaglevLbConfigValidationError) Cause() error { return e.cause } |
| 3387 |
|
| 3388 |
// Key function returns key value. |
| 3389 |
func (e Cluster_MaglevLbConfigValidationError) Key() bool { return e.key } |
| 3390 |
|
| 3391 |
// ErrorName returns error name. |
| 3392 |
func (e Cluster_MaglevLbConfigValidationError) ErrorName() string { |
| 3393 |
return "Cluster_MaglevLbConfigValidationError" |
| 3394 |
} |
| 3395 |
|
| 3396 |
// Error satisfies the builtin error interface |
| 3397 |
func (e Cluster_MaglevLbConfigValidationError) Error() string { |
| 3398 |
cause := "" |
| 3399 |
if e.cause != nil { |
| 3400 |
cause = fmt.Sprintf(" | caused by: %v", e.cause) |
| 3401 |
} |
| 3402 |
|
| 3403 |
key := "" |
| 3404 |
if e.key { |
| 3405 |
key = "key for " |
| 3406 |
} |
| 3407 |
|
| 3408 |
return fmt.Sprintf( |
| 3409 |
"invalid %sCluster_MaglevLbConfig.%s: %s%s", |
| 3410 |
key, |
| 3411 |
e.field, |
| 3412 |
e.reason, |
| 3413 |
cause) |
| 3414 |
} |
| 3415 |
|
| 3416 |
var _ error = Cluster_MaglevLbConfigValidationError{} |
| 3417 |
|
| 3418 |
var _ interface { |
| 3419 |
Field() string |
| 3420 |
Reason() string |
| 3421 |
Key() bool |
| 3422 |
Cause() error |
| 3423 |
ErrorName() string |
| 3424 |
} = Cluster_MaglevLbConfigValidationError{} |
| 3425 |
|
| 3426 |
// Validate checks the field values on Cluster_OriginalDstLbConfig with the |
| 3427 |
// rules defined in the proto definition for this message. If any rules are |
| 3428 |
// violated, the first error encountered is returned, or nil if there are no violations. |
| 3429 |
func (m *Cluster_OriginalDstLbConfig) Validate() error { |
| 3430 |
return m.validate(false) |
| 3431 |
} |
| 3432 |
|
| 3433 |
// ValidateAll checks the field values on Cluster_OriginalDstLbConfig with the |
| 3434 |
// rules defined in the proto definition for this message. If any rules are |
| 3435 |
// violated, the result is a list of violation errors wrapped in |
| 3436 |
// Cluster_OriginalDstLbConfigMultiError, or nil if none found. |
| 3437 |
func (m *Cluster_OriginalDstLbConfig) ValidateAll() error { |
| 3438 |
return m.validate(true) |
| 3439 |
} |
| 3440 |
|
| 3441 |
func (m *Cluster_OriginalDstLbConfig) validate(all bool) error { |
| 3442 |
if m == nil { |
| 3443 |
return nil |
| 3444 |
} |
| 3445 |
|
| 3446 |
var errors []error |
| 3447 |
|
| 3448 |
// no validation rules for UseHttpHeader |
| 3449 |
|
| 3450 |
// no validation rules for HttpHeaderName |
| 3451 |
|
| 3452 |
if wrapper := m.GetUpstreamPortOverride(); wrapper != nil { |
| 3453 |
|
| 3454 |
if wrapper.GetValue() > 65535 { |
| 3455 |
err := Cluster_OriginalDstLbConfigValidationError{ |
| 3456 |
field: "UpstreamPortOverride", |
| 3457 |
reason: "value must be less than or equal to 65535", |
| 3458 |
} |
| 3459 |
if !all { |
| 3460 |
return err |
| 3461 |
} |
| 3462 |
errors = append(errors, err) |
| 3463 |
} |
| 3464 |
|
| 3465 |
} |
| 3466 |
|
| 3467 |
if all { |
| 3468 |
switch v := interface{}(m.GetMetadataKey()).(type) { |
| 3469 |
case interface{ ValidateAll() error }: |
| 3470 |
if err := v.ValidateAll(); err != nil { |
| 3471 |
errors = append(errors, Cluster_OriginalDstLbConfigValidationError{ |
| 3472 |
field: "MetadataKey", |
| 3473 |
reason: "embedded message failed validation", |
| 3474 |
cause: err, |
| 3475 |
}) |
| 3476 |
} |
| 3477 |
case interface{ Validate() error }: |
| 3478 |
if err := v.Validate(); err != nil { |
| 3479 |
errors = append(errors, Cluster_OriginalDstLbConfigValidationError{ |
| 3480 |
field: "MetadataKey", |
| 3481 |
reason: "embedded message failed validation", |
| 3482 |
cause: err, |
| 3483 |
}) |
| 3484 |
} |
| 3485 |
} |
| 3486 |
} else if v, ok := interface{}(m.GetMetadataKey()).(interface{ Validate() error }); ok { |
| 3487 |
if err := v.Validate(); err != nil { |
| 3488 |
return Cluster_OriginalDstLbConfigValidationError{ |
| 3489 |
field: "MetadataKey", |
| 3490 |
reason: "embedded message failed validation", |
| 3491 |
cause: err, |
| 3492 |
} |
| 3493 |
} |
| 3494 |
} |
| 3495 |
|
| 3496 |
if len(errors) > 0 { |
| 3497 |
return Cluster_OriginalDstLbConfigMultiError(errors) |
| 3498 |
} |
| 3499 |
|
| 3500 |
return nil |
| 3501 |
} |
| 3502 |
|
| 3503 |
// Cluster_OriginalDstLbConfigMultiError is an error wrapping multiple |
| 3504 |
// validation errors returned by Cluster_OriginalDstLbConfig.ValidateAll() if |
| 3505 |
// the designated constraints aren't met. |
| 3506 |
type Cluster_OriginalDstLbConfigMultiError []error |
| 3507 |
|
| 3508 |
// Error returns a concatenation of all the error messages it wraps. |
| 3509 |
func (m Cluster_OriginalDstLbConfigMultiError) Error() string { |
| 3510 |
var msgs []string |
| 3511 |
for _, err := range m { |
| 3512 |
msgs = append(msgs, err.Error()) |
| 3513 |
} |
| 3514 |
return strings.Join(msgs, "; ") |
| 3515 |
} |
| 3516 |
|
| 3517 |
// AllErrors returns a list of validation violation errors. |
| 3518 |
func (m Cluster_OriginalDstLbConfigMultiError) AllErrors() []error { return m } |
| 3519 |
|
| 3520 |
// Cluster_OriginalDstLbConfigValidationError is the validation error returned |
| 3521 |
// by Cluster_OriginalDstLbConfig.Validate if the designated constraints |
| 3522 |
// aren't met. |
| 3523 |
type Cluster_OriginalDstLbConfigValidationError struct { |
| 3524 |
field string |
| 3525 |
reason string |
| 3526 |
cause error |
| 3527 |
key bool |
| 3528 |
} |
| 3529 |
|
| 3530 |
// Field function returns field value. |
| 3531 |
func (e Cluster_OriginalDstLbConfigValidationError) Field() string { return e.field } |
| 3532 |
|
| 3533 |
// Reason function returns reason value. |
| 3534 |
func (e Cluster_OriginalDstLbConfigValidationError) Reason() string { return e.reason } |
| 3535 |
|
| 3536 |
// Cause function returns cause value. |
| 3537 |
func (e Cluster_OriginalDstLbConfigValidationError) Cause() error { return e.cause } |
| 3538 |
|
| 3539 |
// Key function returns key value. |
| 3540 |
func (e Cluster_OriginalDstLbConfigValidationError) Key() bool { return e.key } |
| 3541 |
|
| 3542 |
// ErrorName returns error name. |
| 3543 |
func (e Cluster_OriginalDstLbConfigValidationError) ErrorName() string { |
| 3544 |
return "Cluster_OriginalDstLbConfigValidationError" |
| 3545 |
} |
| 3546 |
|
| 3547 |
// Error satisfies the builtin error interface |
| 3548 |
func (e Cluster_OriginalDstLbConfigValidationError) Error() string { |
| 3549 |
cause := "" |
| 3550 |
if e.cause != nil { |
| 3551 |
cause = fmt.Sprintf(" | caused by: %v", e.cause) |
| 3552 |
} |
| 3553 |
|
| 3554 |
key := "" |
| 3555 |
if e.key { |
| 3556 |
key = "key for " |
| 3557 |
} |
| 3558 |
|
| 3559 |
return fmt.Sprintf( |
| 3560 |
"invalid %sCluster_OriginalDstLbConfig.%s: %s%s", |
| 3561 |
key, |
| 3562 |
e.field, |
| 3563 |
e.reason, |
| 3564 |
cause) |
| 3565 |
} |
| 3566 |
|
| 3567 |
var _ error = Cluster_OriginalDstLbConfigValidationError{} |
| 3568 |
|
| 3569 |
var _ interface { |
| 3570 |
Field() string |
| 3571 |
Reason() string |
| 3572 |
Key() bool |
| 3573 |
Cause() error |
| 3574 |
ErrorName() string |
| 3575 |
} = Cluster_OriginalDstLbConfigValidationError{} |
| 3576 |
|
| 3577 |
// Validate checks the field values on Cluster_CommonLbConfig with the rules |
| 3578 |
// defined in the proto definition for this message. If any rules are |
| 3579 |
// violated, the first error encountered is returned, or nil if there are no violations. |
| 3580 |
func (m *Cluster_CommonLbConfig) Validate() error { |
| 3581 |
return m.validate(false) |
| 3582 |
} |
| 3583 |
|
| 3584 |
// ValidateAll checks the field values on Cluster_CommonLbConfig with the rules |
| 3585 |
// defined in the proto definition for this message. If any rules are |
| 3586 |
// violated, the result is a list of violation errors wrapped in |
| 3587 |
// Cluster_CommonLbConfigMultiError, or nil if none found. |
| 3588 |
func (m *Cluster_CommonLbConfig) ValidateAll() error { |
| 3589 |
return m.validate(true) |
| 3590 |
} |
| 3591 |
|
| 3592 |
func (m *Cluster_CommonLbConfig) validate(all bool) error { |
| 3593 |
if m == nil { |
| 3594 |
return nil |
| 3595 |
} |
| 3596 |
|
| 3597 |
var errors []error |
| 3598 |
|
| 3599 |
if all { |
| 3600 |
switch v := interface{}(m.GetHealthyPanicThreshold()).(type) { |
| 3601 |
case interface{ ValidateAll() error }: |
| 3602 |
if err := v.ValidateAll(); err != nil { |
| 3603 |
errors = append(errors, Cluster_CommonLbConfigValidationError{ |
| 3604 |
field: "HealthyPanicThreshold", |
| 3605 |
reason: "embedded message failed validation", |
| 3606 |
cause: err, |
| 3607 |
}) |
| 3608 |
} |
| 3609 |
case interface{ Validate() error }: |
| 3610 |
if err := v.Validate(); err != nil { |
| 3611 |
errors = append(errors, Cluster_CommonLbConfigValidationError{ |
| 3612 |
field: "HealthyPanicThreshold", |
| 3613 |
reason: "embedded message failed validation", |
| 3614 |
cause: err, |
| 3615 |
}) |
| 3616 |
} |
| 3617 |
} |
| 3618 |
} else if v, ok := interface{}(m.GetHealthyPanicThreshold()).(interface{ Validate() error }); ok { |
| 3619 |
if err := v.Validate(); err != nil { |
| 3620 |
return Cluster_CommonLbConfigValidationError{ |
| 3621 |
field: "HealthyPanicThreshold", |
| 3622 |
reason: "embedded message failed validation", |
| 3623 |
cause: err, |
| 3624 |
} |
| 3625 |
} |
| 3626 |
} |
| 3627 |
|
| 3628 |
if all { |
| 3629 |
switch v := interface{}(m.GetUpdateMergeWindow()).(type) { |
| 3630 |
case interface{ ValidateAll() error }: |
| 3631 |
if err := v.ValidateAll(); err != nil { |
| 3632 |
errors = append(errors, Cluster_CommonLbConfigValidationError{ |
| 3633 |
field: "UpdateMergeWindow", |
| 3634 |
reason: "embedded message failed validation", |
| 3635 |
cause: err, |
| 3636 |
}) |
| 3637 |
} |
| 3638 |
case interface{ Validate() error }: |
| 3639 |
if err := v.Validate(); err != nil { |
| 3640 |
errors = append(errors, Cluster_CommonLbConfigValidationError{ |
| 3641 |
field: "UpdateMergeWindow", |
| 3642 |
reason: "embedded message failed validation", |
| 3643 |
cause: err, |
| 3644 |
}) |
| 3645 |
} |
| 3646 |
} |
| 3647 |
} else if v, ok := interface{}(m.GetUpdateMergeWindow()).(interface{ Validate() error }); ok { |
| 3648 |
if err := v.Validate(); err != nil { |
| 3649 |
return Cluster_CommonLbConfigValidationError{ |
| 3650 |
field: "UpdateMergeWindow", |
| 3651 |
reason: "embedded message failed validation", |
| 3652 |
cause: err, |
| 3653 |
} |
| 3654 |
} |
| 3655 |
} |
| 3656 |
|
| 3657 |
// no validation rules for IgnoreNewHostsUntilFirstHc |
| 3658 |
|
| 3659 |
// no validation rules for CloseConnectionsOnHostSetChange |
| 3660 |
|
| 3661 |
if all { |
| 3662 |
switch v := interface{}(m.GetConsistentHashingLbConfig()).(type) { |
| 3663 |
case interface{ ValidateAll() error }: |
| 3664 |
if err := v.ValidateAll(); err != nil { |
| 3665 |
errors = append(errors, Cluster_CommonLbConfigValidationError{ |
| 3666 |
field: "ConsistentHashingLbConfig", |
| 3667 |
reason: "embedded message failed validation", |
| 3668 |
cause: err, |
| 3669 |
}) |
| 3670 |
} |
| 3671 |
case interface{ Validate() error }: |
| 3672 |
if err := v.Validate(); err != nil { |
| 3673 |
errors = append(errors, Cluster_CommonLbConfigValidationError{ |
| 3674 |
field: "ConsistentHashingLbConfig", |
| 3675 |
reason: "embedded message failed validation", |
| 3676 |
cause: err, |
| 3677 |
}) |
| 3678 |
} |
| 3679 |
} |
| 3680 |
} else if v, ok := interface{}(m.GetConsistentHashingLbConfig()).(interface{ Validate() error }); ok { |
| 3681 |
if err := v.Validate(); err != nil { |
| 3682 |
return Cluster_CommonLbConfigValidationError{ |
| 3683 |
field: "ConsistentHashingLbConfig", |
| 3684 |
reason: "embedded message failed validation", |
| 3685 |
cause: err, |
| 3686 |
} |
| 3687 |
} |
| 3688 |
} |
| 3689 |
|
| 3690 |
if all { |
| 3691 |
switch v := interface{}(m.GetOverrideHostStatus()).(type) { |
| 3692 |
case interface{ ValidateAll() error }: |
| 3693 |
if err := v.ValidateAll(); err != nil { |
| 3694 |
errors = append(errors, Cluster_CommonLbConfigValidationError{ |
| 3695 |
field: "OverrideHostStatus", |
| 3696 |
reason: "embedded message failed validation", |
| 3697 |
cause: err, |
| 3698 |
}) |
| 3699 |
} |
| 3700 |
case interface{ Validate() error }: |
| 3701 |
if err := v.Validate(); err != nil { |
| 3702 |
errors = append(errors, Cluster_CommonLbConfigValidationError{ |
| 3703 |
field: "OverrideHostStatus", |
| 3704 |
reason: "embedded message failed validation", |
| 3705 |
cause: err, |
| 3706 |
}) |
| 3707 |
} |
| 3708 |
} |
| 3709 |
} else if v, ok := interface{}(m.GetOverrideHostStatus()).(interface{ Validate() error }); ok { |
| 3710 |
if err := v.Validate(); err != nil { |
| 3711 |
return Cluster_CommonLbConfigValidationError{ |
| 3712 |
field: "OverrideHostStatus", |
| 3713 |
reason: "embedded message failed validation", |
| 3714 |
cause: err, |
| 3715 |
} |
| 3716 |
} |
| 3717 |
} |
| 3718 |
|
| 3719 |
switch v := m.LocalityConfigSpecifier.(type) { |
| 3720 |
case *Cluster_CommonLbConfig_ZoneAwareLbConfig_: |
| 3721 |
if v == nil { |
| 3722 |
err := Cluster_CommonLbConfigValidationError{ |
| 3723 |
field: "LocalityConfigSpecifier", |
| 3724 |
reason: "oneof value cannot be a typed-nil", |
| 3725 |
} |
| 3726 |
if !all { |
| 3727 |
return err |
| 3728 |
} |
| 3729 |
errors = append(errors, err) |
| 3730 |
} |
| 3731 |
|
| 3732 |
if all { |
| 3733 |
switch v := interface{}(m.GetZoneAwareLbConfig()).(type) { |
| 3734 |
case interface{ ValidateAll() error }: |
| 3735 |
if err := v.ValidateAll(); err != nil { |
| 3736 |
errors = append(errors, Cluster_CommonLbConfigValidationError{ |
| 3737 |
field: "ZoneAwareLbConfig", |
| 3738 |
reason: "embedded message failed validation", |
| 3739 |
cause: err, |
| 3740 |
}) |
| 3741 |
} |
| 3742 |
case interface{ Validate() error }: |
| 3743 |
if err := v.Validate(); err != nil { |
| 3744 |
errors = append(errors, Cluster_CommonLbConfigValidationError{ |
| 3745 |
field: "ZoneAwareLbConfig", |
| 3746 |
reason: "embedded message failed validation", |
| 3747 |
cause: err, |
| 3748 |
}) |
| 3749 |
} |
| 3750 |
} |
| 3751 |
} else if v, ok := interface{}(m.GetZoneAwareLbConfig()).(interface{ Validate() error }); ok { |
| 3752 |
if err := v.Validate(); err != nil { |
| 3753 |
return Cluster_CommonLbConfigValidationError{ |
| 3754 |
field: "ZoneAwareLbConfig", |
| 3755 |
reason: "embedded message failed validation", |
| 3756 |
cause: err, |
| 3757 |
} |
| 3758 |
} |
| 3759 |
} |
| 3760 |
|
| 3761 |
case *Cluster_CommonLbConfig_LocalityWeightedLbConfig_: |
| 3762 |
if v == nil { |
| 3763 |
err := Cluster_CommonLbConfigValidationError{ |
| 3764 |
field: "LocalityConfigSpecifier", |
| 3765 |
reason: "oneof value cannot be a typed-nil", |
| 3766 |
} |
| 3767 |
if !all { |
| 3768 |
return err |
| 3769 |
} |
| 3770 |
errors = append(errors, err) |
| 3771 |
} |
| 3772 |
|
| 3773 |
if all { |
| 3774 |
switch v := interface{}(m.GetLocalityWeightedLbConfig()).(type) { |
| 3775 |
case interface{ ValidateAll() error }: |
| 3776 |
if err := v.ValidateAll(); err != nil { |
| 3777 |
errors = append(errors, Cluster_CommonLbConfigValidationError{ |
| 3778 |
field: "LocalityWeightedLbConfig", |
| 3779 |
reason: "embedded message failed validation", |
| 3780 |
cause: err, |
| 3781 |
}) |
| 3782 |
} |
| 3783 |
case interface{ Validate() error }: |
| 3784 |
if err := v.Validate(); err != nil { |
| 3785 |
errors = append(errors, Cluster_CommonLbConfigValidationError{ |
| 3786 |
field: "LocalityWeightedLbConfig", |
| 3787 |
reason: "embedded message failed validation", |
| 3788 |
cause: err, |
| 3789 |
}) |
| 3790 |
} |
| 3791 |
} |
| 3792 |
} else if v, ok := interface{}(m.GetLocalityWeightedLbConfig()).(interface{ Validate() error }); ok { |
| 3793 |
if err := v.Validate(); err != nil { |
| 3794 |
return Cluster_CommonLbConfigValidationError{ |
| 3795 |
field: "LocalityWeightedLbConfig", |
| 3796 |
reason: "embedded message failed validation", |
| 3797 |
cause: err, |
| 3798 |
} |
| 3799 |
} |
| 3800 |
} |
| 3801 |
|
| 3802 |
default: |
| 3803 |
_ = v // ensures v is used |
| 3804 |
} |
| 3805 |
|
| 3806 |
if len(errors) > 0 { |
| 3807 |
return Cluster_CommonLbConfigMultiError(errors) |
| 3808 |
} |
| 3809 |
|
| 3810 |
return nil |
| 3811 |
} |
| 3812 |
|
| 3813 |
// Cluster_CommonLbConfigMultiError is an error wrapping multiple validation |
| 3814 |
// errors returned by Cluster_CommonLbConfig.ValidateAll() if the designated |
| 3815 |
// constraints aren't met. |
| 3816 |
type Cluster_CommonLbConfigMultiError []error |
| 3817 |
|
| 3818 |
// Error returns a concatenation of all the error messages it wraps. |
| 3819 |
func (m Cluster_CommonLbConfigMultiError) Error() string { |
| 3820 |
var msgs []string |
| 3821 |
for _, err := range m { |
| 3822 |
msgs = append(msgs, err.Error()) |
| 3823 |
} |
| 3824 |
return strings.Join(msgs, "; ") |
| 3825 |
} |
| 3826 |
|
| 3827 |
// AllErrors returns a list of validation violation errors. |
| 3828 |
func (m Cluster_CommonLbConfigMultiError) AllErrors() []error { return m } |
| 3829 |
|
| 3830 |
// Cluster_CommonLbConfigValidationError is the validation error returned by |
| 3831 |
// Cluster_CommonLbConfig.Validate if the designated constraints aren't met. |
| 3832 |
type Cluster_CommonLbConfigValidationError struct { |
| 3833 |
field string |
| 3834 |
reason string |
| 3835 |
cause error |
| 3836 |
key bool |
| 3837 |
} |
| 3838 |
|
| 3839 |
// Field function returns field value. |
| 3840 |
func (e Cluster_CommonLbConfigValidationError) Field() string { return e.field } |
| 3841 |
|
| 3842 |
// Reason function returns reason value. |
| 3843 |
func (e Cluster_CommonLbConfigValidationError) Reason() string { return e.reason } |
| 3844 |
|
| 3845 |
// Cause function returns cause value. |
| 3846 |
func (e Cluster_CommonLbConfigValidationError) Cause() error { return e.cause } |
| 3847 |
|
| 3848 |
// Key function returns key value. |
| 3849 |
func (e Cluster_CommonLbConfigValidationError) Key() bool { return e.key } |
| 3850 |
|
| 3851 |
// ErrorName returns error name. |
| 3852 |
func (e Cluster_CommonLbConfigValidationError) ErrorName() string { |
| 3853 |
return "Cluster_CommonLbConfigValidationError" |
| 3854 |
} |
| 3855 |
|
| 3856 |
// Error satisfies the builtin error interface |
| 3857 |
func (e Cluster_CommonLbConfigValidationError) Error() string { |
| 3858 |
cause := "" |
| 3859 |
if e.cause != nil { |
| 3860 |
cause = fmt.Sprintf(" | caused by: %v", e.cause) |
| 3861 |
} |
| 3862 |
|
| 3863 |
key := "" |
| 3864 |
if e.key { |
| 3865 |
key = "key for " |
| 3866 |
} |
| 3867 |
|
| 3868 |
return fmt.Sprintf( |
| 3869 |
"invalid %sCluster_CommonLbConfig.%s: %s%s", |
| 3870 |
key, |
| 3871 |
e.field, |
| 3872 |
e.reason, |
| 3873 |
cause) |
| 3874 |
} |
| 3875 |
|
| 3876 |
var _ error = Cluster_CommonLbConfigValidationError{} |
| 3877 |
|
| 3878 |
var _ interface { |
| 3879 |
Field() string |
| 3880 |
Reason() string |
| 3881 |
Key() bool |
| 3882 |
Cause() error |
| 3883 |
ErrorName() string |
| 3884 |
} = Cluster_CommonLbConfigValidationError{} |
| 3885 |
|
| 3886 |
// Validate checks the field values on Cluster_RefreshRate with the rules |
| 3887 |
// defined in the proto definition for this message. If any rules are |
| 3888 |
// violated, the first error encountered is returned, or nil if there are no violations. |
| 3889 |
func (m *Cluster_RefreshRate) Validate() error { |
| 3890 |
return m.validate(false) |
| 3891 |
} |
| 3892 |
|
| 3893 |
// ValidateAll checks the field values on Cluster_RefreshRate with the rules |
| 3894 |
// defined in the proto definition for this message. If any rules are |
| 3895 |
// violated, the result is a list of violation errors wrapped in |
| 3896 |
// Cluster_RefreshRateMultiError, or nil if none found. |
| 3897 |
func (m *Cluster_RefreshRate) ValidateAll() error { |
| 3898 |
return m.validate(true) |
| 3899 |
} |
| 3900 |
|
| 3901 |
func (m *Cluster_RefreshRate) validate(all bool) error { |
| 3902 |
if m == nil { |
| 3903 |
return nil |
| 3904 |
} |
| 3905 |
|
| 3906 |
var errors []error |
| 3907 |
|
| 3908 |
if m.GetBaseInterval() == nil { |
| 3909 |
err := Cluster_RefreshRateValidationError{ |
| 3910 |
field: "BaseInterval", |
| 3911 |
reason: "value is required", |
| 3912 |
} |
| 3913 |
if !all { |
| 3914 |
return err |
| 3915 |
} |
| 3916 |
errors = append(errors, err) |
| 3917 |
} |
| 3918 |
|
| 3919 |
if d := m.GetBaseInterval(); d != nil { |
| 3920 |
dur, err := d.AsDuration(), d.CheckValid() |
| 3921 |
if err != nil { |
| 3922 |
err = Cluster_RefreshRateValidationError{ |
| 3923 |
field: "BaseInterval", |
| 3924 |
reason: "value is not a valid duration", |
| 3925 |
cause: err, |
| 3926 |
} |
| 3927 |
if !all { |
| 3928 |
return err |
| 3929 |
} |
| 3930 |
errors = append(errors, err) |
| 3931 |
} else { |
| 3932 |
|
| 3933 |
gt := time.Duration(0*time.Second + 1000000*time.Nanosecond) |
| 3934 |
|
| 3935 |
if dur <= gt { |
| 3936 |
err := Cluster_RefreshRateValidationError{ |
| 3937 |
field: "BaseInterval", |
| 3938 |
reason: "value must be greater than 1ms", |
| 3939 |
} |
| 3940 |
if !all { |
| 3941 |
return err |
| 3942 |
} |
| 3943 |
errors = append(errors, err) |
| 3944 |
} |
| 3945 |
|
| 3946 |
} |
| 3947 |
} |
| 3948 |
|
| 3949 |
if d := m.GetMaxInterval(); d != nil { |
| 3950 |
dur, err := d.AsDuration(), d.CheckValid() |
| 3951 |
if err != nil { |
| 3952 |
err = Cluster_RefreshRateValidationError{ |
| 3953 |
field: "MaxInterval", |
| 3954 |
reason: "value is not a valid duration", |
| 3955 |
cause: err, |
| 3956 |
} |
| 3957 |
if !all { |
| 3958 |
return err |
| 3959 |
} |
| 3960 |
errors = append(errors, err) |
| 3961 |
} else { |
| 3962 |
|
| 3963 |
gt := time.Duration(0*time.Second + 1000000*time.Nanosecond) |
| 3964 |
|
| 3965 |
if dur <= gt { |
| 3966 |
err := Cluster_RefreshRateValidationError{ |
| 3967 |
field: "MaxInterval", |
| 3968 |
reason: "value must be greater than 1ms", |
| 3969 |
} |
| 3970 |
if !all { |
| 3971 |
return err |
| 3972 |
} |
| 3973 |
errors = append(errors, err) |
| 3974 |
} |
| 3975 |
|
| 3976 |
} |
| 3977 |
} |
| 3978 |
|
| 3979 |
if len(errors) > 0 { |
| 3980 |
return Cluster_RefreshRateMultiError(errors) |
| 3981 |
} |
| 3982 |
|
| 3983 |
return nil |
| 3984 |
} |
| 3985 |
|
| 3986 |
// Cluster_RefreshRateMultiError is an error wrapping multiple validation |
| 3987 |
// errors returned by Cluster_RefreshRate.ValidateAll() if the designated |
| 3988 |
// constraints aren't met. |
| 3989 |
type Cluster_RefreshRateMultiError []error |
| 3990 |
|
| 3991 |
// Error returns a concatenation of all the error messages it wraps. |
| 3992 |
func (m Cluster_RefreshRateMultiError) Error() string { |
| 3993 |
var msgs []string |
| 3994 |
for _, err := range m { |
| 3995 |
msgs = append(msgs, err.Error()) |
| 3996 |
} |
| 3997 |
return strings.Join(msgs, "; ") |
| 3998 |
} |
| 3999 |
|
| 4000 |
// AllErrors returns a list of validation violation errors. |
| 4001 |
func (m Cluster_RefreshRateMultiError) AllErrors() []error { return m } |
| 4002 |
|
| 4003 |
// Cluster_RefreshRateValidationError is the validation error returned by |
| 4004 |
// Cluster_RefreshRate.Validate if the designated constraints aren't met. |
| 4005 |
type Cluster_RefreshRateValidationError struct { |
| 4006 |
field string |
| 4007 |
reason string |
| 4008 |
cause error |
| 4009 |
key bool |
| 4010 |
} |
| 4011 |
|
| 4012 |
// Field function returns field value. |
| 4013 |
func (e Cluster_RefreshRateValidationError) Field() string { return e.field } |
| 4014 |
|
| 4015 |
// Reason function returns reason value. |
| 4016 |
func (e Cluster_RefreshRateValidationError) Reason() string { return e.reason } |
| 4017 |
|
| 4018 |
// Cause function returns cause value. |
| 4019 |
func (e Cluster_RefreshRateValidationError) Cause() error { return e.cause } |
| 4020 |
|
| 4021 |
// Key function returns key value. |
| 4022 |
func (e Cluster_RefreshRateValidationError) Key() bool { return e.key } |
| 4023 |
|
| 4024 |
// ErrorName returns error name. |
| 4025 |
func (e Cluster_RefreshRateValidationError) ErrorName() string { |
| 4026 |
return "Cluster_RefreshRateValidationError" |
| 4027 |
} |
| 4028 |
|
| 4029 |
// Error satisfies the builtin error interface |
| 4030 |
func (e Cluster_RefreshRateValidationError) Error() string { |
| 4031 |
cause := "" |
| 4032 |
if e.cause != nil { |
| 4033 |
cause = fmt.Sprintf(" | caused by: %v", e.cause) |
| 4034 |
} |
| 4035 |
|
| 4036 |
key := "" |
| 4037 |
if e.key { |
| 4038 |
key = "key for " |
| 4039 |
} |
| 4040 |
|
| 4041 |
return fmt.Sprintf( |
| 4042 |
"invalid %sCluster_RefreshRate.%s: %s%s", |
| 4043 |
key, |
| 4044 |
e.field, |
| 4045 |
e.reason, |
| 4046 |
cause) |
| 4047 |
} |
| 4048 |
|
| 4049 |
var _ error = Cluster_RefreshRateValidationError{} |
| 4050 |
|
| 4051 |
var _ interface { |
| 4052 |
Field() string |
| 4053 |
Reason() string |
| 4054 |
Key() bool |
| 4055 |
Cause() error |
| 4056 |
ErrorName() string |
| 4057 |
} = Cluster_RefreshRateValidationError{} |
| 4058 |
|
| 4059 |
// Validate checks the field values on Cluster_PreconnectPolicy with the rules |
| 4060 |
// defined in the proto definition for this message. If any rules are |
| 4061 |
// violated, the first error encountered is returned, or nil if there are no violations. |
| 4062 |
func (m *Cluster_PreconnectPolicy) Validate() error { |
| 4063 |
return m.validate(false) |
| 4064 |
} |
| 4065 |
|
| 4066 |
// ValidateAll checks the field values on Cluster_PreconnectPolicy with the |
| 4067 |
// rules defined in the proto definition for this message. If any rules are |
| 4068 |
// violated, the result is a list of violation errors wrapped in |
| 4069 |
// Cluster_PreconnectPolicyMultiError, or nil if none found. |
| 4070 |
func (m *Cluster_PreconnectPolicy) ValidateAll() error { |
| 4071 |
return m.validate(true) |
| 4072 |
} |
| 4073 |
|
| 4074 |
func (m *Cluster_PreconnectPolicy) validate(all bool) error { |
| 4075 |
if m == nil { |
| 4076 |
return nil |
| 4077 |
} |
| 4078 |
|
| 4079 |
var errors []error |
| 4080 |
|
| 4081 |
if wrapper := m.GetPerUpstreamPreconnectRatio(); wrapper != nil { |
| 4082 |
|
| 4083 |
if val := wrapper.GetValue(); val < 1 || val > 3 { |
| 4084 |
err := Cluster_PreconnectPolicyValidationError{ |
| 4085 |
field: "PerUpstreamPreconnectRatio", |
| 4086 |
reason: "value must be inside range [1, 3]", |
| 4087 |
} |
| 4088 |
if !all { |
| 4089 |
return err |
| 4090 |
} |
| 4091 |
errors = append(errors, err) |
| 4092 |
} |
| 4093 |
|
| 4094 |
} |
| 4095 |
|
| 4096 |
if wrapper := m.GetPredictivePreconnectRatio(); wrapper != nil { |
| 4097 |
|
| 4098 |
if val := wrapper.GetValue(); val < 1 || val > 3 { |
| 4099 |
err := Cluster_PreconnectPolicyValidationError{ |
| 4100 |
field: "PredictivePreconnectRatio", |
| 4101 |
reason: "value must be inside range [1, 3]", |
| 4102 |
} |
| 4103 |
if !all { |
| 4104 |
return err |
| 4105 |
} |
| 4106 |
errors = append(errors, err) |
| 4107 |
} |
| 4108 |
|
| 4109 |
} |
| 4110 |
|
| 4111 |
if len(errors) > 0 { |
| 4112 |
return Cluster_PreconnectPolicyMultiError(errors) |
| 4113 |
} |
| 4114 |
|
| 4115 |
return nil |
| 4116 |
} |
| 4117 |
|
| 4118 |
// Cluster_PreconnectPolicyMultiError is an error wrapping multiple validation |
| 4119 |
// errors returned by Cluster_PreconnectPolicy.ValidateAll() if the designated |
| 4120 |
// constraints aren't met. |
| 4121 |
type Cluster_PreconnectPolicyMultiError []error |
| 4122 |
|
| 4123 |
// Error returns a concatenation of all the error messages it wraps. |
| 4124 |
func (m Cluster_PreconnectPolicyMultiError) Error() string { |
| 4125 |
var msgs []string |
| 4126 |
for _, err := range m { |
| 4127 |
msgs = append(msgs, err.Error()) |
| 4128 |
} |
| 4129 |
return strings.Join(msgs, "; ") |
| 4130 |
} |
| 4131 |
|
| 4132 |
// AllErrors returns a list of validation violation errors. |
| 4133 |
func (m Cluster_PreconnectPolicyMultiError) AllErrors() []error { return m } |
| 4134 |
|
| 4135 |
// Cluster_PreconnectPolicyValidationError is the validation error returned by |
| 4136 |
// Cluster_PreconnectPolicy.Validate if the designated constraints aren't met. |
| 4137 |
type Cluster_PreconnectPolicyValidationError struct { |
| 4138 |
field string |
| 4139 |
reason string |
| 4140 |
cause error |
| 4141 |
key bool |
| 4142 |
} |
| 4143 |
|
| 4144 |
// Field function returns field value. |
| 4145 |
func (e Cluster_PreconnectPolicyValidationError) Field() string { return e.field } |
| 4146 |
|
| 4147 |
// Reason function returns reason value. |
| 4148 |
func (e Cluster_PreconnectPolicyValidationError) Reason() string { return e.reason } |
| 4149 |
|
| 4150 |
// Cause function returns cause value. |
| 4151 |
func (e Cluster_PreconnectPolicyValidationError) Cause() error { return e.cause } |
| 4152 |
|
| 4153 |
// Key function returns key value. |
| 4154 |
func (e Cluster_PreconnectPolicyValidationError) Key() bool { return e.key } |
| 4155 |
|
| 4156 |
// ErrorName returns error name. |
| 4157 |
func (e Cluster_PreconnectPolicyValidationError) ErrorName() string { |
| 4158 |
return "Cluster_PreconnectPolicyValidationError" |
| 4159 |
} |
| 4160 |
|
| 4161 |
// Error satisfies the builtin error interface |
| 4162 |
func (e Cluster_PreconnectPolicyValidationError) Error() string { |
| 4163 |
cause := "" |
| 4164 |
if e.cause != nil { |
| 4165 |
cause = fmt.Sprintf(" | caused by: %v", e.cause) |
| 4166 |
} |
| 4167 |
|
| 4168 |
key := "" |
| 4169 |
if e.key { |
| 4170 |
key = "key for " |
| 4171 |
} |
| 4172 |
|
| 4173 |
return fmt.Sprintf( |
| 4174 |
"invalid %sCluster_PreconnectPolicy.%s: %s%s", |
| 4175 |
key, |
| 4176 |
e.field, |
| 4177 |
e.reason, |
| 4178 |
cause) |
| 4179 |
} |
| 4180 |
|
| 4181 |
var _ error = Cluster_PreconnectPolicyValidationError{} |
| 4182 |
|
| 4183 |
var _ interface { |
| 4184 |
Field() string |
| 4185 |
Reason() string |
| 4186 |
Key() bool |
| 4187 |
Cause() error |
| 4188 |
ErrorName() string |
| 4189 |
} = Cluster_PreconnectPolicyValidationError{} |
| 4190 |
|
| 4191 |
// Validate checks the field values on Cluster_LbSubsetConfig_LbSubsetSelector |
| 4192 |
// with the rules defined in the proto definition for this message. If any |
| 4193 |
// rules are violated, the first error encountered is returned, or nil if |
| 4194 |
// there are no violations. |
| 4195 |
func (m *Cluster_LbSubsetConfig_LbSubsetSelector) Validate() error { |
| 4196 |
return m.validate(false) |
| 4197 |
} |
| 4198 |
|
| 4199 |
// ValidateAll checks the field values on |
| 4200 |
// Cluster_LbSubsetConfig_LbSubsetSelector with the rules defined in the proto |
| 4201 |
// definition for this message. If any rules are violated, the result is a |
| 4202 |
// list of violation errors wrapped in |
| 4203 |
// Cluster_LbSubsetConfig_LbSubsetSelectorMultiError, or nil if none found. |
| 4204 |
func (m *Cluster_LbSubsetConfig_LbSubsetSelector) ValidateAll() error { |
| 4205 |
return m.validate(true) |
| 4206 |
} |
| 4207 |
|
| 4208 |
func (m *Cluster_LbSubsetConfig_LbSubsetSelector) validate(all bool) error { |
| 4209 |
if m == nil { |
| 4210 |
return nil |
| 4211 |
} |
| 4212 |
|
| 4213 |
var errors []error |
| 4214 |
|
| 4215 |
// no validation rules for SingleHostPerSubset |
| 4216 |
|
| 4217 |
if _, ok := Cluster_LbSubsetConfig_LbSubsetSelector_LbSubsetSelectorFallbackPolicy_name[int32(m.GetFallbackPolicy())]; !ok { |
| 4218 |
err := Cluster_LbSubsetConfig_LbSubsetSelectorValidationError{ |
| 4219 |
field: "FallbackPolicy", |
| 4220 |
reason: "value must be one of the defined enum values", |
| 4221 |
} |
| 4222 |
if !all { |
| 4223 |
return err |
| 4224 |
} |
| 4225 |
errors = append(errors, err) |
| 4226 |
} |
| 4227 |
|
| 4228 |
if len(errors) > 0 { |
| 4229 |
return Cluster_LbSubsetConfig_LbSubsetSelectorMultiError(errors) |
| 4230 |
} |
| 4231 |
|
| 4232 |
return nil |
| 4233 |
} |
| 4234 |
|
| 4235 |
// Cluster_LbSubsetConfig_LbSubsetSelectorMultiError is an error wrapping |
| 4236 |
// multiple validation errors returned by |
| 4237 |
// Cluster_LbSubsetConfig_LbSubsetSelector.ValidateAll() if the designated |
| 4238 |
// constraints aren't met. |
| 4239 |
type Cluster_LbSubsetConfig_LbSubsetSelectorMultiError []error |
| 4240 |
|
| 4241 |
// Error returns a concatenation of all the error messages it wraps. |
| 4242 |
func (m Cluster_LbSubsetConfig_LbSubsetSelectorMultiError) Error() string { |
| 4243 |
var msgs []string |
| 4244 |
for _, err := range m { |
| 4245 |
msgs = append(msgs, err.Error()) |
| 4246 |
} |
| 4247 |
return strings.Join(msgs, "; ") |
| 4248 |
} |
| 4249 |
|
| 4250 |
// AllErrors returns a list of validation violation errors. |
| 4251 |
func (m Cluster_LbSubsetConfig_LbSubsetSelectorMultiError) AllErrors() []error { return m } |
| 4252 |
|
| 4253 |
// Cluster_LbSubsetConfig_LbSubsetSelectorValidationError is the validation |
| 4254 |
// error returned by Cluster_LbSubsetConfig_LbSubsetSelector.Validate if the |
| 4255 |
// designated constraints aren't met. |
| 4256 |
type Cluster_LbSubsetConfig_LbSubsetSelectorValidationError struct { |
| 4257 |
field string |
| 4258 |
reason string |
| 4259 |
cause error |
| 4260 |
key bool |
| 4261 |
} |
| 4262 |
|
| 4263 |
// Field function returns field value. |
| 4264 |
func (e Cluster_LbSubsetConfig_LbSubsetSelectorValidationError) Field() string { return e.field } |
| 4265 |
|
| 4266 |
// Reason function returns reason value. |
| 4267 |
func (e Cluster_LbSubsetConfig_LbSubsetSelectorValidationError) Reason() string { return e.reason } |
| 4268 |
|
| 4269 |
// Cause function returns cause value. |
| 4270 |
func (e Cluster_LbSubsetConfig_LbSubsetSelectorValidationError) Cause() error { return e.cause } |
| 4271 |
|
| 4272 |
// Key function returns key value. |
| 4273 |
func (e Cluster_LbSubsetConfig_LbSubsetSelectorValidationError) Key() bool { return e.key } |
| 4274 |
|
| 4275 |
// ErrorName returns error name. |
| 4276 |
func (e Cluster_LbSubsetConfig_LbSubsetSelectorValidationError) ErrorName() string { |
| 4277 |
return "Cluster_LbSubsetConfig_LbSubsetSelectorValidationError" |
| 4278 |
} |
| 4279 |
|
| 4280 |
// Error satisfies the builtin error interface |
| 4281 |
func (e Cluster_LbSubsetConfig_LbSubsetSelectorValidationError) Error() string { |
| 4282 |
cause := "" |
| 4283 |
if e.cause != nil { |
| 4284 |
cause = fmt.Sprintf(" | caused by: %v", e.cause) |
| 4285 |
} |
| 4286 |
|
| 4287 |
key := "" |
| 4288 |
if e.key { |
| 4289 |
key = "key for " |
| 4290 |
} |
| 4291 |
|
| 4292 |
return fmt.Sprintf( |
| 4293 |
"invalid %sCluster_LbSubsetConfig_LbSubsetSelector.%s: %s%s", |
| 4294 |
key, |
| 4295 |
e.field, |
| 4296 |
e.reason, |
| 4297 |
cause) |
| 4298 |
} |
| 4299 |
|
| 4300 |
var _ error = Cluster_LbSubsetConfig_LbSubsetSelectorValidationError{} |
| 4301 |
|
| 4302 |
var _ interface { |
| 4303 |
Field() string |
| 4304 |
Reason() string |
| 4305 |
Key() bool |
| 4306 |
Cause() error |
| 4307 |
ErrorName() string |
| 4308 |
} = Cluster_LbSubsetConfig_LbSubsetSelectorValidationError{} |
| 4309 |
|
| 4310 |
// Validate checks the field values on Cluster_CommonLbConfig_ZoneAwareLbConfig |
| 4311 |
// with the rules defined in the proto definition for this message. If any |
| 4312 |
// rules are violated, the first error encountered is returned, or nil if |
| 4313 |
// there are no violations. |
| 4314 |
func (m *Cluster_CommonLbConfig_ZoneAwareLbConfig) Validate() error { |
| 4315 |
return m.validate(false) |
| 4316 |
} |
| 4317 |
|
| 4318 |
// ValidateAll checks the field values on |
| 4319 |
// Cluster_CommonLbConfig_ZoneAwareLbConfig with the rules defined in the |
| 4320 |
// proto definition for this message. If any rules are violated, the result is |
| 4321 |
// a list of violation errors wrapped in |
| 4322 |
// Cluster_CommonLbConfig_ZoneAwareLbConfigMultiError, or nil if none found. |
| 4323 |
func (m *Cluster_CommonLbConfig_ZoneAwareLbConfig) ValidateAll() error { |
| 4324 |
return m.validate(true) |
| 4325 |
} |
| 4326 |
|
| 4327 |
func (m *Cluster_CommonLbConfig_ZoneAwareLbConfig) validate(all bool) error { |
| 4328 |
if m == nil { |
| 4329 |
return nil |
| 4330 |
} |
| 4331 |
|
| 4332 |
var errors []error |
| 4333 |
|
| 4334 |
if all { |
| 4335 |
switch v := interface{}(m.GetRoutingEnabled()).(type) { |
| 4336 |
case interface{ ValidateAll() error }: |
| 4337 |
if err := v.ValidateAll(); err != nil { |
| 4338 |
errors = append(errors, Cluster_CommonLbConfig_ZoneAwareLbConfigValidationError{ |
| 4339 |
field: "RoutingEnabled", |
| 4340 |
reason: "embedded message failed validation", |
| 4341 |
cause: err, |
| 4342 |
}) |
| 4343 |
} |
| 4344 |
case interface{ Validate() error }: |
| 4345 |
if err := v.Validate(); err != nil { |
| 4346 |
errors = append(errors, Cluster_CommonLbConfig_ZoneAwareLbConfigValidationError{ |
| 4347 |
field: "RoutingEnabled", |
| 4348 |
reason: "embedded message failed validation", |
| 4349 |
cause: err, |
| 4350 |
}) |
| 4351 |
} |
| 4352 |
} |
| 4353 |
} else if v, ok := interface{}(m.GetRoutingEnabled()).(interface{ Validate() error }); ok { |
| 4354 |
if err := v.Validate(); err != nil { |
| 4355 |
return Cluster_CommonLbConfig_ZoneAwareLbConfigValidationError{ |
| 4356 |
field: "RoutingEnabled", |
| 4357 |
reason: "embedded message failed validation", |
| 4358 |
cause: err, |
| 4359 |
} |
| 4360 |
} |
| 4361 |
} |
| 4362 |
|
| 4363 |
if all { |
| 4364 |
switch v := interface{}(m.GetMinClusterSize()).(type) { |
| 4365 |
case interface{ ValidateAll() error }: |
| 4366 |
if err := v.ValidateAll(); err != nil { |
| 4367 |
errors = append(errors, Cluster_CommonLbConfig_ZoneAwareLbConfigValidationError{ |
| 4368 |
field: "MinClusterSize", |
| 4369 |
reason: "embedded message failed validation", |
| 4370 |
cause: err, |
| 4371 |
}) |
| 4372 |
} |
| 4373 |
case interface{ Validate() error }: |
| 4374 |
if err := v.Validate(); err != nil { |
| 4375 |
errors = append(errors, Cluster_CommonLbConfig_ZoneAwareLbConfigValidationError{ |
| 4376 |
field: "MinClusterSize", |
| 4377 |
reason: "embedded message failed validation", |
| 4378 |
cause: err, |
| 4379 |
}) |
| 4380 |
} |
| 4381 |
} |
| 4382 |
} else if v, ok := interface{}(m.GetMinClusterSize()).(interface{ Validate() error }); ok { |
| 4383 |
if err := v.Validate(); err != nil { |
| 4384 |
return Cluster_CommonLbConfig_ZoneAwareLbConfigValidationError{ |
| 4385 |
field: "MinClusterSize", |
| 4386 |
reason: "embedded message failed validation", |
| 4387 |
cause: err, |
| 4388 |
} |
| 4389 |
} |
| 4390 |
} |
| 4391 |
|
| 4392 |
// no validation rules for FailTrafficOnPanic |
| 4393 |
|
| 4394 |
if len(errors) > 0 { |
| 4395 |
return Cluster_CommonLbConfig_ZoneAwareLbConfigMultiError(errors) |
| 4396 |
} |
| 4397 |
|
| 4398 |
return nil |
| 4399 |
} |
| 4400 |
|
| 4401 |
// Cluster_CommonLbConfig_ZoneAwareLbConfigMultiError is an error wrapping |
| 4402 |
// multiple validation errors returned by |
| 4403 |
// Cluster_CommonLbConfig_ZoneAwareLbConfig.ValidateAll() if the designated |
| 4404 |
// constraints aren't met. |
| 4405 |
type Cluster_CommonLbConfig_ZoneAwareLbConfigMultiError []error |
| 4406 |
|
| 4407 |
// Error returns a concatenation of all the error messages it wraps. |
| 4408 |
func (m Cluster_CommonLbConfig_ZoneAwareLbConfigMultiError) Error() string { |
| 4409 |
var msgs []string |
| 4410 |
for _, err := range m { |
| 4411 |
msgs = append(msgs, err.Error()) |
| 4412 |
} |
| 4413 |
return strings.Join(msgs, "; ") |
| 4414 |
} |
| 4415 |
|
| 4416 |
// AllErrors returns a list of validation violation errors. |
| 4417 |
func (m Cluster_CommonLbConfig_ZoneAwareLbConfigMultiError) AllErrors() []error { return m } |
| 4418 |
|
| 4419 |
// Cluster_CommonLbConfig_ZoneAwareLbConfigValidationError is the validation |
| 4420 |
// error returned by Cluster_CommonLbConfig_ZoneAwareLbConfig.Validate if the |
| 4421 |
// designated constraints aren't met. |
| 4422 |
type Cluster_CommonLbConfig_ZoneAwareLbConfigValidationError struct { |
| 4423 |
field string |
| 4424 |
reason string |
| 4425 |
cause error |
| 4426 |
key bool |
| 4427 |
} |
| 4428 |
|
| 4429 |
// Field function returns field value. |
| 4430 |
func (e Cluster_CommonLbConfig_ZoneAwareLbConfigValidationError) Field() string { return e.field } |
| 4431 |
|
| 4432 |
// Reason function returns reason value. |
| 4433 |
func (e Cluster_CommonLbConfig_ZoneAwareLbConfigValidationError) Reason() string { return e.reason } |
| 4434 |
|
| 4435 |
// Cause function returns cause value. |
| 4436 |
func (e Cluster_CommonLbConfig_ZoneAwareLbConfigValidationError) Cause() error { return e.cause } |
| 4437 |
|
| 4438 |
// Key function returns key value. |
| 4439 |
func (e Cluster_CommonLbConfig_ZoneAwareLbConfigValidationError) Key() bool { return e.key } |
| 4440 |
|
| 4441 |
// ErrorName returns error name. |
| 4442 |
func (e Cluster_CommonLbConfig_ZoneAwareLbConfigValidationError) ErrorName() string { |
| 4443 |
return "Cluster_CommonLbConfig_ZoneAwareLbConfigValidationError" |
| 4444 |
} |
| 4445 |
|
| 4446 |
// Error satisfies the builtin error interface |
| 4447 |
func (e Cluster_CommonLbConfig_ZoneAwareLbConfigValidationError) Error() string { |
| 4448 |
cause := "" |
| 4449 |
if e.cause != nil { |
| 4450 |
cause = fmt.Sprintf(" | caused by: %v", e.cause) |
| 4451 |
} |
| 4452 |
|
| 4453 |
key := "" |
| 4454 |
if e.key { |
| 4455 |
key = "key for " |
| 4456 |
} |
| 4457 |
|
| 4458 |
return fmt.Sprintf( |
| 4459 |
"invalid %sCluster_CommonLbConfig_ZoneAwareLbConfig.%s: %s%s", |
| 4460 |
key, |
| 4461 |
e.field, |
| 4462 |
e.reason, |
| 4463 |
cause) |
| 4464 |
} |
| 4465 |
|
| 4466 |
var _ error = Cluster_CommonLbConfig_ZoneAwareLbConfigValidationError{} |
| 4467 |
|
| 4468 |
var _ interface { |
| 4469 |
Field() string |
| 4470 |
Reason() string |
| 4471 |
Key() bool |
| 4472 |
Cause() error |
| 4473 |
ErrorName() string |
| 4474 |
} = Cluster_CommonLbConfig_ZoneAwareLbConfigValidationError{} |
| 4475 |
|
| 4476 |
// Validate checks the field values on |
| 4477 |
// Cluster_CommonLbConfig_LocalityWeightedLbConfig with the rules defined in |
| 4478 |
// the proto definition for this message. If any rules are violated, the first |
| 4479 |
// error encountered is returned, or nil if there are no violations. |
| 4480 |
func (m *Cluster_CommonLbConfig_LocalityWeightedLbConfig) Validate() error { |
| 4481 |
return m.validate(false) |
| 4482 |
} |
| 4483 |
|
| 4484 |
// ValidateAll checks the field values on |
| 4485 |
// Cluster_CommonLbConfig_LocalityWeightedLbConfig with the rules defined in |
| 4486 |
// the proto definition for this message. If any rules are violated, the |
| 4487 |
// result is a list of violation errors wrapped in |
| 4488 |
// Cluster_CommonLbConfig_LocalityWeightedLbConfigMultiError, or nil if none found. |
| 4489 |
func (m *Cluster_CommonLbConfig_LocalityWeightedLbConfig) ValidateAll() error { |
| 4490 |
return m.validate(true) |
| 4491 |
} |
| 4492 |
|
| 4493 |
func (m *Cluster_CommonLbConfig_LocalityWeightedLbConfig) validate(all bool) error { |
| 4494 |
if m == nil { |
| 4495 |
return nil |
| 4496 |
} |
| 4497 |
|
| 4498 |
var errors []error |
| 4499 |
|
| 4500 |
if len(errors) > 0 { |
| 4501 |
return Cluster_CommonLbConfig_LocalityWeightedLbConfigMultiError(errors) |
| 4502 |
} |
| 4503 |
|
| 4504 |
return nil |
| 4505 |
} |
| 4506 |
|
| 4507 |
// Cluster_CommonLbConfig_LocalityWeightedLbConfigMultiError is an error |
| 4508 |
// wrapping multiple validation errors returned by |
| 4509 |
// Cluster_CommonLbConfig_LocalityWeightedLbConfig.ValidateAll() if the |
| 4510 |
// designated constraints aren't met. |
| 4511 |
type Cluster_CommonLbConfig_LocalityWeightedLbConfigMultiError []error |
| 4512 |
|
| 4513 |
// Error returns a concatenation of all the error messages it wraps. |
| 4514 |
func (m Cluster_CommonLbConfig_LocalityWeightedLbConfigMultiError) Error() string { |
| 4515 |
var msgs []string |
| 4516 |
for _, err := range m { |
| 4517 |
msgs = append(msgs, err.Error()) |
| 4518 |
} |
| 4519 |
return strings.Join(msgs, "; ") |
| 4520 |
} |
| 4521 |
|
| 4522 |
// AllErrors returns a list of validation violation errors. |
| 4523 |
func (m Cluster_CommonLbConfig_LocalityWeightedLbConfigMultiError) AllErrors() []error { return m } |
| 4524 |
|
| 4525 |
// Cluster_CommonLbConfig_LocalityWeightedLbConfigValidationError is the |
| 4526 |
// validation error returned by |
| 4527 |
// Cluster_CommonLbConfig_LocalityWeightedLbConfig.Validate if the designated |
| 4528 |
// constraints aren't met. |
| 4529 |
type Cluster_CommonLbConfig_LocalityWeightedLbConfigValidationError struct { |
| 4530 |
field string |
| 4531 |
reason string |
| 4532 |
cause error |
| 4533 |
key bool |
| 4534 |
} |
| 4535 |
|
| 4536 |
// Field function returns field value. |
| 4537 |
func (e Cluster_CommonLbConfig_LocalityWeightedLbConfigValidationError) Field() string { |
| 4538 |
return e.field |
| 4539 |
} |
| 4540 |
|
| 4541 |
// Reason function returns reason value. |
| 4542 |
func (e Cluster_CommonLbConfig_LocalityWeightedLbConfigValidationError) Reason() string { |
| 4543 |
return e.reason |
| 4544 |
} |
| 4545 |
|
| 4546 |
// Cause function returns cause value. |
| 4547 |
func (e Cluster_CommonLbConfig_LocalityWeightedLbConfigValidationError) Cause() error { return e.cause } |
| 4548 |
|
| 4549 |
// Key function returns key value. |
| 4550 |
func (e Cluster_CommonLbConfig_LocalityWeightedLbConfigValidationError) Key() bool { return e.key } |
| 4551 |
|
| 4552 |
// ErrorName returns error name. |
| 4553 |
func (e Cluster_CommonLbConfig_LocalityWeightedLbConfigValidationError) ErrorName() string { |
| 4554 |
return "Cluster_CommonLbConfig_LocalityWeightedLbConfigValidationError" |
| 4555 |
} |
| 4556 |
|
| 4557 |
// Error satisfies the builtin error interface |
| 4558 |
func (e Cluster_CommonLbConfig_LocalityWeightedLbConfigValidationError) Error() string { |
| 4559 |
cause := "" |
| 4560 |
if e.cause != nil { |
| 4561 |
cause = fmt.Sprintf(" | caused by: %v", e.cause) |
| 4562 |
} |
| 4563 |
|
| 4564 |
key := "" |
| 4565 |
if e.key { |
| 4566 |
key = "key for " |
| 4567 |
} |
| 4568 |
|
| 4569 |
return fmt.Sprintf( |
| 4570 |
"invalid %sCluster_CommonLbConfig_LocalityWeightedLbConfig.%s: %s%s", |
| 4571 |
key, |
| 4572 |
e.field, |
| 4573 |
e.reason, |
| 4574 |
cause) |
| 4575 |
} |
| 4576 |
|
| 4577 |
var _ error = Cluster_CommonLbConfig_LocalityWeightedLbConfigValidationError{} |
| 4578 |
|
| 4579 |
var _ interface { |
| 4580 |
Field() string |
| 4581 |
Reason() string |
| 4582 |
Key() bool |
| 4583 |
Cause() error |
| 4584 |
ErrorName() string |
| 4585 |
} = Cluster_CommonLbConfig_LocalityWeightedLbConfigValidationError{} |
| 4586 |
|
| 4587 |
// Validate checks the field values on |
| 4588 |
// Cluster_CommonLbConfig_ConsistentHashingLbConfig with the rules defined in |
| 4589 |
// the proto definition for this message. If any rules are violated, the first |
| 4590 |
// error encountered is returned, or nil if there are no violations. |
| 4591 |
func (m *Cluster_CommonLbConfig_ConsistentHashingLbConfig) Validate() error { |
| 4592 |
return m.validate(false) |
| 4593 |
} |
| 4594 |
|
| 4595 |
// ValidateAll checks the field values on |
| 4596 |
// Cluster_CommonLbConfig_ConsistentHashingLbConfig with the rules defined in |
| 4597 |
// the proto definition for this message. If any rules are violated, the |
| 4598 |
// result is a list of violation errors wrapped in |
| 4599 |
// Cluster_CommonLbConfig_ConsistentHashingLbConfigMultiError, or nil if none found. |
| 4600 |
func (m *Cluster_CommonLbConfig_ConsistentHashingLbConfig) ValidateAll() error { |
| 4601 |
return m.validate(true) |
| 4602 |
} |
| 4603 |
|
| 4604 |
func (m *Cluster_CommonLbConfig_ConsistentHashingLbConfig) validate(all bool) error { |
| 4605 |
if m == nil { |
| 4606 |
return nil |
| 4607 |
} |
| 4608 |
|
| 4609 |
var errors []error |
| 4610 |
|
| 4611 |
// no validation rules for UseHostnameForHashing |
| 4612 |
|
| 4613 |
if wrapper := m.GetHashBalanceFactor(); wrapper != nil { |
| 4614 |
|
| 4615 |
if wrapper.GetValue() < 100 { |
| 4616 |
err := Cluster_CommonLbConfig_ConsistentHashingLbConfigValidationError{ |
| 4617 |
field: "HashBalanceFactor", |
| 4618 |
reason: "value must be greater than or equal to 100", |
| 4619 |
} |
| 4620 |
if !all { |
| 4621 |
return err |
| 4622 |
} |
| 4623 |
errors = append(errors, err) |
| 4624 |
} |
| 4625 |
|
| 4626 |
} |
| 4627 |
|
| 4628 |
if len(errors) > 0 { |
| 4629 |
return Cluster_CommonLbConfig_ConsistentHashingLbConfigMultiError(errors) |
| 4630 |
} |
| 4631 |
|
| 4632 |
return nil |
| 4633 |
} |
| 4634 |
|
| 4635 |
// Cluster_CommonLbConfig_ConsistentHashingLbConfigMultiError is an error |
| 4636 |
// wrapping multiple validation errors returned by |
| 4637 |
// Cluster_CommonLbConfig_ConsistentHashingLbConfig.ValidateAll() if the |
| 4638 |
// designated constraints aren't met. |
| 4639 |
type Cluster_CommonLbConfig_ConsistentHashingLbConfigMultiError []error |
| 4640 |
|
| 4641 |
// Error returns a concatenation of all the error messages it wraps. |
| 4642 |
func (m Cluster_CommonLbConfig_ConsistentHashingLbConfigMultiError) Error() string { |
| 4643 |
var msgs []string |
| 4644 |
for _, err := range m { |
| 4645 |
msgs = append(msgs, err.Error()) |
| 4646 |
} |
| 4647 |
return strings.Join(msgs, "; ") |
| 4648 |
} |
| 4649 |
|
| 4650 |
// AllErrors returns a list of validation violation errors. |
| 4651 |
func (m Cluster_CommonLbConfig_ConsistentHashingLbConfigMultiError) AllErrors() []error { return m } |
| 4652 |
|
| 4653 |
// Cluster_CommonLbConfig_ConsistentHashingLbConfigValidationError is the |
| 4654 |
// validation error returned by |
| 4655 |
// Cluster_CommonLbConfig_ConsistentHashingLbConfig.Validate if the designated |
| 4656 |
// constraints aren't met. |
| 4657 |
type Cluster_CommonLbConfig_ConsistentHashingLbConfigValidationError struct { |
| 4658 |
field string |
| 4659 |
reason string |
| 4660 |
cause error |
| 4661 |
key bool |
| 4662 |
} |
| 4663 |
|
| 4664 |
// Field function returns field value. |
| 4665 |
func (e Cluster_CommonLbConfig_ConsistentHashingLbConfigValidationError) Field() string { |
| 4666 |
return e.field |
| 4667 |
} |
| 4668 |
|
| 4669 |
// Reason function returns reason value. |
| 4670 |
func (e Cluster_CommonLbConfig_ConsistentHashingLbConfigValidationError) Reason() string { |
| 4671 |
return e.reason |
| 4672 |
} |
| 4673 |
|
| 4674 |
// Cause function returns cause value. |
| 4675 |
func (e Cluster_CommonLbConfig_ConsistentHashingLbConfigValidationError) Cause() error { |
| 4676 |
return e.cause |
| 4677 |
} |
| 4678 |
|
| 4679 |
// Key function returns key value. |
| 4680 |
func (e Cluster_CommonLbConfig_ConsistentHashingLbConfigValidationError) Key() bool { return e.key } |
| 4681 |
|
| 4682 |
// ErrorName returns error name. |
| 4683 |
func (e Cluster_CommonLbConfig_ConsistentHashingLbConfigValidationError) ErrorName() string { |
| 4684 |
return "Cluster_CommonLbConfig_ConsistentHashingLbConfigValidationError" |
| 4685 |
} |
| 4686 |
|
| 4687 |
// Error satisfies the builtin error interface |
| 4688 |
func (e Cluster_CommonLbConfig_ConsistentHashingLbConfigValidationError) Error() string { |
| 4689 |
cause := "" |
| 4690 |
if e.cause != nil { |
| 4691 |
cause = fmt.Sprintf(" | caused by: %v", e.cause) |
| 4692 |
} |
| 4693 |
|
| 4694 |
key := "" |
| 4695 |
if e.key { |
| 4696 |
key = "key for " |
| 4697 |
} |
| 4698 |
|
| 4699 |
return fmt.Sprintf( |
| 4700 |
"invalid %sCluster_CommonLbConfig_ConsistentHashingLbConfig.%s: %s%s", |
| 4701 |
key, |
| 4702 |
e.field, |
| 4703 |
e.reason, |
| 4704 |
cause) |
| 4705 |
} |
| 4706 |
|
| 4707 |
var _ error = Cluster_CommonLbConfig_ConsistentHashingLbConfigValidationError{} |
| 4708 |
|
| 4709 |
var _ interface { |
| 4710 |
Field() string |
| 4711 |
Reason() string |
| 4712 |
Key() bool |
| 4713 |
Cause() error |
| 4714 |
ErrorName() string |
| 4715 |
} = Cluster_CommonLbConfig_ConsistentHashingLbConfigValidationError{} |
| 4716 |
|
| 4717 |
// Validate checks the field values on LoadBalancingPolicy_Policy with the |
| 4718 |
// rules defined in the proto definition for this message. If any rules are |
| 4719 |
// violated, the first error encountered is returned, or nil if there are no violations. |
| 4720 |
func (m *LoadBalancingPolicy_Policy) Validate() error { |
| 4721 |
return m.validate(false) |
| 4722 |
} |
| 4723 |
|
| 4724 |
// ValidateAll checks the field values on LoadBalancingPolicy_Policy with the |
| 4725 |
// rules defined in the proto definition for this message. If any rules are |
| 4726 |
// violated, the result is a list of violation errors wrapped in |
| 4727 |
// LoadBalancingPolicy_PolicyMultiError, or nil if none found. |
| 4728 |
func (m *LoadBalancingPolicy_Policy) ValidateAll() error { |
| 4729 |
return m.validate(true) |
| 4730 |
} |
| 4731 |
|
| 4732 |
func (m *LoadBalancingPolicy_Policy) validate(all bool) error { |
| 4733 |
if m == nil { |
| 4734 |
return nil |
| 4735 |
} |
| 4736 |
|
| 4737 |
var errors []error |
| 4738 |
|
| 4739 |
if all { |
| 4740 |
switch v := interface{}(m.GetTypedExtensionConfig()).(type) { |
| 4741 |
case interface{ ValidateAll() error }: |
| 4742 |
if err := v.ValidateAll(); err != nil { |
| 4743 |
errors = append(errors, LoadBalancingPolicy_PolicyValidationError{ |
| 4744 |
field: "TypedExtensionConfig", |
| 4745 |
reason: "embedded message failed validation", |
| 4746 |
cause: err, |
| 4747 |
}) |
| 4748 |
} |
| 4749 |
case interface{ Validate() error }: |
| 4750 |
if err := v.Validate(); err != nil { |
| 4751 |
errors = append(errors, LoadBalancingPolicy_PolicyValidationError{ |
| 4752 |
field: "TypedExtensionConfig", |
| 4753 |
reason: "embedded message failed validation", |
| 4754 |
cause: err, |
| 4755 |
}) |
| 4756 |
} |
| 4757 |
} |
| 4758 |
} else if v, ok := interface{}(m.GetTypedExtensionConfig()).(interface{ Validate() error }); ok { |
| 4759 |
if err := v.Validate(); err != nil { |
| 4760 |
return LoadBalancingPolicy_PolicyValidationError{ |
| 4761 |
field: "TypedExtensionConfig", |
| 4762 |
reason: "embedded message failed validation", |
| 4763 |
cause: err, |
| 4764 |
} |
| 4765 |
} |
| 4766 |
} |
| 4767 |
|
| 4768 |
if len(errors) > 0 { |
| 4769 |
return LoadBalancingPolicy_PolicyMultiError(errors) |
| 4770 |
} |
| 4771 |
|
| 4772 |
return nil |
| 4773 |
} |
| 4774 |
|
| 4775 |
// LoadBalancingPolicy_PolicyMultiError is an error wrapping multiple |
| 4776 |
// validation errors returned by LoadBalancingPolicy_Policy.ValidateAll() if |
| 4777 |
// the designated constraints aren't met. |
| 4778 |
type LoadBalancingPolicy_PolicyMultiError []error |
| 4779 |
|
| 4780 |
// Error returns a concatenation of all the error messages it wraps. |
| 4781 |
func (m LoadBalancingPolicy_PolicyMultiError) Error() string { |
| 4782 |
var msgs []string |
| 4783 |
for _, err := range m { |
| 4784 |
msgs = append(msgs, err.Error()) |
| 4785 |
} |
| 4786 |
return strings.Join(msgs, "; ") |
| 4787 |
} |
| 4788 |
|
| 4789 |
// AllErrors returns a list of validation violation errors. |
| 4790 |
func (m LoadBalancingPolicy_PolicyMultiError) AllErrors() []error { return m } |
| 4791 |
|
| 4792 |
// LoadBalancingPolicy_PolicyValidationError is the validation error returned |
| 4793 |
// by LoadBalancingPolicy_Policy.Validate if the designated constraints aren't met. |
| 4794 |
type LoadBalancingPolicy_PolicyValidationError struct { |
| 4795 |
field string |
| 4796 |
reason string |
| 4797 |
cause error |
| 4798 |
key bool |
| 4799 |
} |
| 4800 |
|
| 4801 |
// Field function returns field value. |
| 4802 |
func (e LoadBalancingPolicy_PolicyValidationError) Field() string { return e.field } |
| 4803 |
|
| 4804 |
// Reason function returns reason value. |
| 4805 |
func (e LoadBalancingPolicy_PolicyValidationError) Reason() string { return e.reason } |
| 4806 |
|
| 4807 |
// Cause function returns cause value. |
| 4808 |
func (e LoadBalancingPolicy_PolicyValidationError) Cause() error { return e.cause } |
| 4809 |
|
| 4810 |
// Key function returns key value. |
| 4811 |
func (e LoadBalancingPolicy_PolicyValidationError) Key() bool { return e.key } |
| 4812 |
|
| 4813 |
// ErrorName returns error name. |
| 4814 |
func (e LoadBalancingPolicy_PolicyValidationError) ErrorName() string { |
| 4815 |
return "LoadBalancingPolicy_PolicyValidationError" |
| 4816 |
} |
| 4817 |
|
| 4818 |
// Error satisfies the builtin error interface |
| 4819 |
func (e LoadBalancingPolicy_PolicyValidationError) Error() string { |
| 4820 |
cause := "" |
| 4821 |
if e.cause != nil { |
| 4822 |
cause = fmt.Sprintf(" | caused by: %v", e.cause) |
| 4823 |
} |
| 4824 |
|
| 4825 |
key := "" |
| 4826 |
if e.key { |
| 4827 |
key = "key for " |
| 4828 |
} |
| 4829 |
|
| 4830 |
return fmt.Sprintf( |
| 4831 |
"invalid %sLoadBalancingPolicy_Policy.%s: %s%s", |
| 4832 |
key, |
| 4833 |
e.field, |
| 4834 |
e.reason, |
| 4835 |
cause) |
| 4836 |
} |
| 4837 |
|
| 4838 |
var _ error = LoadBalancingPolicy_PolicyValidationError{} |
| 4839 |
|
| 4840 |
var _ interface { |
| 4841 |
Field() string |
| 4842 |
Reason() string |
| 4843 |
Key() bool |
| 4844 |
Cause() error |
| 4845 |
ErrorName() string |
| 4846 |
} = LoadBalancingPolicy_PolicyValidationError{} |
| 4847 |
|
| 4848 |
// Validate checks the field values on |
| 4849 |
// UpstreamConnectionOptions_HappyEyeballsConfig with the rules defined in the |
| 4850 |
// proto definition for this message. If any rules are violated, the first |
| 4851 |
// error encountered is returned, or nil if there are no violations. |
| 4852 |
func (m *UpstreamConnectionOptions_HappyEyeballsConfig) Validate() error { |
| 4853 |
return m.validate(false) |
| 4854 |
} |
| 4855 |
|
| 4856 |
// ValidateAll checks the field values on |
| 4857 |
// UpstreamConnectionOptions_HappyEyeballsConfig with the rules defined in the |
| 4858 |
// proto definition for this message. If any rules are violated, the result is |
| 4859 |
// a list of violation errors wrapped in |
| 4860 |
// UpstreamConnectionOptions_HappyEyeballsConfigMultiError, or nil if none found. |
| 4861 |
func (m *UpstreamConnectionOptions_HappyEyeballsConfig) ValidateAll() error { |
| 4862 |
return m.validate(true) |
| 4863 |
} |
| 4864 |
|
| 4865 |
func (m *UpstreamConnectionOptions_HappyEyeballsConfig) validate(all bool) error { |
| 4866 |
if m == nil { |
| 4867 |
return nil |
| 4868 |
} |
| 4869 |
|
| 4870 |
var errors []error |
| 4871 |
|
| 4872 |
// no validation rules for FirstAddressFamilyVersion |
| 4873 |
|
| 4874 |
if wrapper := m.GetFirstAddressFamilyCount(); wrapper != nil { |
| 4875 |
|
| 4876 |
if wrapper.GetValue() < 1 { |
| 4877 |
err := UpstreamConnectionOptions_HappyEyeballsConfigValidationError{ |
| 4878 |
field: "FirstAddressFamilyCount", |
| 4879 |
reason: "value must be greater than or equal to 1", |
| 4880 |
} |
| 4881 |
if !all { |
| 4882 |
return err |
| 4883 |
} |
| 4884 |
errors = append(errors, err) |
| 4885 |
} |
| 4886 |
|
| 4887 |
} |
| 4888 |
|
| 4889 |
if len(errors) > 0 { |
| 4890 |
return UpstreamConnectionOptions_HappyEyeballsConfigMultiError(errors) |
| 4891 |
} |
| 4892 |
|
| 4893 |
return nil |
| 4894 |
} |
| 4895 |
|
| 4896 |
// UpstreamConnectionOptions_HappyEyeballsConfigMultiError is an error wrapping |
| 4897 |
// multiple validation errors returned by |
| 4898 |
// UpstreamConnectionOptions_HappyEyeballsConfig.ValidateAll() if the |
| 4899 |
// designated constraints aren't met. |
| 4900 |
type UpstreamConnectionOptions_HappyEyeballsConfigMultiError []error |
| 4901 |
|
| 4902 |
// Error returns a concatenation of all the error messages it wraps. |
| 4903 |
func (m UpstreamConnectionOptions_HappyEyeballsConfigMultiError) Error() string { |
| 4904 |
var msgs []string |
| 4905 |
for _, err := range m { |
| 4906 |
msgs = append(msgs, err.Error()) |
| 4907 |
} |
| 4908 |
return strings.Join(msgs, "; ") |
| 4909 |
} |
| 4910 |
|
| 4911 |
// AllErrors returns a list of validation violation errors. |
| 4912 |
func (m UpstreamConnectionOptions_HappyEyeballsConfigMultiError) AllErrors() []error { return m } |
| 4913 |
|
| 4914 |
// UpstreamConnectionOptions_HappyEyeballsConfigValidationError is the |
| 4915 |
// validation error returned by |
| 4916 |
// UpstreamConnectionOptions_HappyEyeballsConfig.Validate if the designated |
| 4917 |
// constraints aren't met. |
| 4918 |
type UpstreamConnectionOptions_HappyEyeballsConfigValidationError struct { |
| 4919 |
field string |
| 4920 |
reason string |
| 4921 |
cause error |
| 4922 |
key bool |
| 4923 |
} |
| 4924 |
|
| 4925 |
// Field function returns field value. |
| 4926 |
func (e UpstreamConnectionOptions_HappyEyeballsConfigValidationError) Field() string { return e.field } |
| 4927 |
|
| 4928 |
// Reason function returns reason value. |
| 4929 |
func (e UpstreamConnectionOptions_HappyEyeballsConfigValidationError) Reason() string { |
| 4930 |
return e.reason |
| 4931 |
} |
| 4932 |
|
| 4933 |
// Cause function returns cause value. |
| 4934 |
func (e UpstreamConnectionOptions_HappyEyeballsConfigValidationError) Cause() error { return e.cause } |
| 4935 |
|
| 4936 |
// Key function returns key value. |
| 4937 |
func (e UpstreamConnectionOptions_HappyEyeballsConfigValidationError) Key() bool { return e.key } |
| 4938 |
|
| 4939 |
// ErrorName returns error name. |
| 4940 |
func (e UpstreamConnectionOptions_HappyEyeballsConfigValidationError) ErrorName() string { |
| 4941 |
return "UpstreamConnectionOptions_HappyEyeballsConfigValidationError" |
| 4942 |
} |
| 4943 |
|
| 4944 |
// Error satisfies the builtin error interface |
| 4945 |
func (e UpstreamConnectionOptions_HappyEyeballsConfigValidationError) Error() string { |
| 4946 |
cause := "" |
| 4947 |
if e.cause != nil { |
| 4948 |
cause = fmt.Sprintf(" | caused by: %v", e.cause) |
| 4949 |
} |
| 4950 |
|
| 4951 |
key := "" |
| 4952 |
if e.key { |
| 4953 |
key = "key for " |
| 4954 |
} |
| 4955 |
|
| 4956 |
return fmt.Sprintf( |
| 4957 |
"invalid %sUpstreamConnectionOptions_HappyEyeballsConfig.%s: %s%s", |
| 4958 |
key, |
| 4959 |
e.field, |
| 4960 |
e.reason, |
| 4961 |
cause) |
| 4962 |
} |
| 4963 |
|
| 4964 |
var _ error = UpstreamConnectionOptions_HappyEyeballsConfigValidationError{} |
| 4965 |
|
| 4966 |
var _ interface { |
| 4967 |
Field() string |
| 4968 |
Reason() string |
| 4969 |
Key() bool |
| 4970 |
Cause() error |
| 4971 |
ErrorName() string |
| 4972 |
} = UpstreamConnectionOptions_HappyEyeballsConfigValidationError{} |