| 1 |
//go:build !disable_pgv |
| 2 |
// Code generated by protoc-gen-validate. DO NOT EDIT. |
| 3 |
// source: envoy/service/accesslog/v3/als.proto |
| 4 |
|
| 5 |
package accesslogv3 |
| 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 StreamAccessLogsResponse with the rules |
| 40 |
// defined in the proto definition for this message. If any rules are |
| 41 |
// violated, the first error encountered is returned, or nil if there are no violations. |
| 42 |
func (m *StreamAccessLogsResponse) Validate() error { |
| 43 |
return m.validate(false) |
| 44 |
} |
| 45 |
|
| 46 |
// ValidateAll checks the field values on StreamAccessLogsResponse with the |
| 47 |
// rules 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 |
// StreamAccessLogsResponseMultiError, or nil if none found. |
| 50 |
func (m *StreamAccessLogsResponse) ValidateAll() error { |
| 51 |
return m.validate(true) |
| 52 |
} |
| 53 |
|
| 54 |
func (m *StreamAccessLogsResponse) validate(all bool) error { |
| 55 |
if m == nil { |
| 56 |
return nil |
| 57 |
} |
| 58 |
|
| 59 |
var errors []error |
| 60 |
|
| 61 |
if len(errors) > 0 { |
| 62 |
return StreamAccessLogsResponseMultiError(errors) |
| 63 |
} |
| 64 |
|
| 65 |
return nil |
| 66 |
} |
| 67 |
|
| 68 |
// StreamAccessLogsResponseMultiError is an error wrapping multiple validation |
| 69 |
// errors returned by StreamAccessLogsResponse.ValidateAll() if the designated |
| 70 |
// constraints aren't met. |
| 71 |
type StreamAccessLogsResponseMultiError []error |
| 72 |
|
| 73 |
// Error returns a concatenation of all the error messages it wraps. |
| 74 |
func (m StreamAccessLogsResponseMultiError) Error() string { |
| 75 |
var msgs []string |
| 76 |
for _, err := range m { |
| 77 |
msgs = append(msgs, err.Error()) |
| 78 |
} |
| 79 |
return strings.Join(msgs, "; ") |
| 80 |
} |
| 81 |
|
| 82 |
// AllErrors returns a list of validation violation errors. |
| 83 |
func (m StreamAccessLogsResponseMultiError) AllErrors() []error { return m } |
| 84 |
|
| 85 |
// StreamAccessLogsResponseValidationError is the validation error returned by |
| 86 |
// StreamAccessLogsResponse.Validate if the designated constraints aren't met. |
| 87 |
type StreamAccessLogsResponseValidationError struct { |
| 88 |
field string |
| 89 |
reason string |
| 90 |
cause error |
| 91 |
key bool |
| 92 |
} |
| 93 |
|
| 94 |
// Field function returns field value. |
| 95 |
func (e StreamAccessLogsResponseValidationError) Field() string { return e.field } |
| 96 |
|
| 97 |
// Reason function returns reason value. |
| 98 |
func (e StreamAccessLogsResponseValidationError) Reason() string { return e.reason } |
| 99 |
|
| 100 |
// Cause function returns cause value. |
| 101 |
func (e StreamAccessLogsResponseValidationError) Cause() error { return e.cause } |
| 102 |
|
| 103 |
// Key function returns key value. |
| 104 |
func (e StreamAccessLogsResponseValidationError) Key() bool { return e.key } |
| 105 |
|
| 106 |
// ErrorName returns error name. |
| 107 |
func (e StreamAccessLogsResponseValidationError) ErrorName() string { |
| 108 |
return "StreamAccessLogsResponseValidationError" |
| 109 |
} |
| 110 |
|
| 111 |
// Error satisfies the builtin error interface |
| 112 |
func (e StreamAccessLogsResponseValidationError) Error() string { |
| 113 |
cause := "" |
| 114 |
if e.cause != nil { |
| 115 |
cause = fmt.Sprintf(" | caused by: %v", e.cause) |
| 116 |
} |
| 117 |
|
| 118 |
key := "" |
| 119 |
if e.key { |
| 120 |
key = "key for " |
| 121 |
} |
| 122 |
|
| 123 |
return fmt.Sprintf( |
| 124 |
"invalid %sStreamAccessLogsResponse.%s: %s%s", |
| 125 |
key, |
| 126 |
e.field, |
| 127 |
e.reason, |
| 128 |
cause) |
| 129 |
} |
| 130 |
|
| 131 |
var _ error = StreamAccessLogsResponseValidationError{} |
| 132 |
|
| 133 |
var _ interface { |
| 134 |
Field() string |
| 135 |
Reason() string |
| 136 |
Key() bool |
| 137 |
Cause() error |
| 138 |
ErrorName() string |
| 139 |
} = StreamAccessLogsResponseValidationError{} |
| 140 |
|
| 141 |
// Validate checks the field values on StreamAccessLogsMessage with the rules |
| 142 |
// defined in the proto definition for this message. If any rules are |
| 143 |
// violated, the first error encountered is returned, or nil if there are no violations. |
| 144 |
func (m *StreamAccessLogsMessage) Validate() error { |
| 145 |
return m.validate(false) |
| 146 |
} |
| 147 |
|
| 148 |
// ValidateAll checks the field values on StreamAccessLogsMessage with the |
| 149 |
// rules defined in the proto definition for this message. If any rules are |
| 150 |
// violated, the result is a list of violation errors wrapped in |
| 151 |
// StreamAccessLogsMessageMultiError, or nil if none found. |
| 152 |
func (m *StreamAccessLogsMessage) ValidateAll() error { |
| 153 |
return m.validate(true) |
| 154 |
} |
| 155 |
|
| 156 |
func (m *StreamAccessLogsMessage) validate(all bool) error { |
| 157 |
if m == nil { |
| 158 |
return nil |
| 159 |
} |
| 160 |
|
| 161 |
var errors []error |
| 162 |
|
| 163 |
if all { |
| 164 |
switch v := interface{}(m.GetIdentifier()).(type) { |
| 165 |
case interface{ ValidateAll() error }: |
| 166 |
if err := v.ValidateAll(); err != nil { |
| 167 |
errors = append(errors, StreamAccessLogsMessageValidationError{ |
| 168 |
field: "Identifier", |
| 169 |
reason: "embedded message failed validation", |
| 170 |
cause: err, |
| 171 |
}) |
| 172 |
} |
| 173 |
case interface{ Validate() error }: |
| 174 |
if err := v.Validate(); err != nil { |
| 175 |
errors = append(errors, StreamAccessLogsMessageValidationError{ |
| 176 |
field: "Identifier", |
| 177 |
reason: "embedded message failed validation", |
| 178 |
cause: err, |
| 179 |
}) |
| 180 |
} |
| 181 |
} |
| 182 |
} else if v, ok := interface{}(m.GetIdentifier()).(interface{ Validate() error }); ok { |
| 183 |
if err := v.Validate(); err != nil { |
| 184 |
return StreamAccessLogsMessageValidationError{ |
| 185 |
field: "Identifier", |
| 186 |
reason: "embedded message failed validation", |
| 187 |
cause: err, |
| 188 |
} |
| 189 |
} |
| 190 |
} |
| 191 |
|
| 192 |
oneofLogEntriesPresent := false |
| 193 |
switch v := m.LogEntries.(type) { |
| 194 |
case *StreamAccessLogsMessage_HttpLogs: |
| 195 |
if v == nil { |
| 196 |
err := StreamAccessLogsMessageValidationError{ |
| 197 |
field: "LogEntries", |
| 198 |
reason: "oneof value cannot be a typed-nil", |
| 199 |
} |
| 200 |
if !all { |
| 201 |
return err |
| 202 |
} |
| 203 |
errors = append(errors, err) |
| 204 |
} |
| 205 |
oneofLogEntriesPresent = true |
| 206 |
|
| 207 |
if all { |
| 208 |
switch v := interface{}(m.GetHttpLogs()).(type) { |
| 209 |
case interface{ ValidateAll() error }: |
| 210 |
if err := v.ValidateAll(); err != nil { |
| 211 |
errors = append(errors, StreamAccessLogsMessageValidationError{ |
| 212 |
field: "HttpLogs", |
| 213 |
reason: "embedded message failed validation", |
| 214 |
cause: err, |
| 215 |
}) |
| 216 |
} |
| 217 |
case interface{ Validate() error }: |
| 218 |
if err := v.Validate(); err != nil { |
| 219 |
errors = append(errors, StreamAccessLogsMessageValidationError{ |
| 220 |
field: "HttpLogs", |
| 221 |
reason: "embedded message failed validation", |
| 222 |
cause: err, |
| 223 |
}) |
| 224 |
} |
| 225 |
} |
| 226 |
} else if v, ok := interface{}(m.GetHttpLogs()).(interface{ Validate() error }); ok { |
| 227 |
if err := v.Validate(); err != nil { |
| 228 |
return StreamAccessLogsMessageValidationError{ |
| 229 |
field: "HttpLogs", |
| 230 |
reason: "embedded message failed validation", |
| 231 |
cause: err, |
| 232 |
} |
| 233 |
} |
| 234 |
} |
| 235 |
|
| 236 |
case *StreamAccessLogsMessage_TcpLogs: |
| 237 |
if v == nil { |
| 238 |
err := StreamAccessLogsMessageValidationError{ |
| 239 |
field: "LogEntries", |
| 240 |
reason: "oneof value cannot be a typed-nil", |
| 241 |
} |
| 242 |
if !all { |
| 243 |
return err |
| 244 |
} |
| 245 |
errors = append(errors, err) |
| 246 |
} |
| 247 |
oneofLogEntriesPresent = true |
| 248 |
|
| 249 |
if all { |
| 250 |
switch v := interface{}(m.GetTcpLogs()).(type) { |
| 251 |
case interface{ ValidateAll() error }: |
| 252 |
if err := v.ValidateAll(); err != nil { |
| 253 |
errors = append(errors, StreamAccessLogsMessageValidationError{ |
| 254 |
field: "TcpLogs", |
| 255 |
reason: "embedded message failed validation", |
| 256 |
cause: err, |
| 257 |
}) |
| 258 |
} |
| 259 |
case interface{ Validate() error }: |
| 260 |
if err := v.Validate(); err != nil { |
| 261 |
errors = append(errors, StreamAccessLogsMessageValidationError{ |
| 262 |
field: "TcpLogs", |
| 263 |
reason: "embedded message failed validation", |
| 264 |
cause: err, |
| 265 |
}) |
| 266 |
} |
| 267 |
} |
| 268 |
} else if v, ok := interface{}(m.GetTcpLogs()).(interface{ Validate() error }); ok { |
| 269 |
if err := v.Validate(); err != nil { |
| 270 |
return StreamAccessLogsMessageValidationError{ |
| 271 |
field: "TcpLogs", |
| 272 |
reason: "embedded message failed validation", |
| 273 |
cause: err, |
| 274 |
} |
| 275 |
} |
| 276 |
} |
| 277 |
|
| 278 |
default: |
| 279 |
_ = v // ensures v is used |
| 280 |
} |
| 281 |
if !oneofLogEntriesPresent { |
| 282 |
err := StreamAccessLogsMessageValidationError{ |
| 283 |
field: "LogEntries", |
| 284 |
reason: "value is required", |
| 285 |
} |
| 286 |
if !all { |
| 287 |
return err |
| 288 |
} |
| 289 |
errors = append(errors, err) |
| 290 |
} |
| 291 |
|
| 292 |
if len(errors) > 0 { |
| 293 |
return StreamAccessLogsMessageMultiError(errors) |
| 294 |
} |
| 295 |
|
| 296 |
return nil |
| 297 |
} |
| 298 |
|
| 299 |
// StreamAccessLogsMessageMultiError is an error wrapping multiple validation |
| 300 |
// errors returned by StreamAccessLogsMessage.ValidateAll() if the designated |
| 301 |
// constraints aren't met. |
| 302 |
type StreamAccessLogsMessageMultiError []error |
| 303 |
|
| 304 |
// Error returns a concatenation of all the error messages it wraps. |
| 305 |
func (m StreamAccessLogsMessageMultiError) Error() string { |
| 306 |
var msgs []string |
| 307 |
for _, err := range m { |
| 308 |
msgs = append(msgs, err.Error()) |
| 309 |
} |
| 310 |
return strings.Join(msgs, "; ") |
| 311 |
} |
| 312 |
|
| 313 |
// AllErrors returns a list of validation violation errors. |
| 314 |
func (m StreamAccessLogsMessageMultiError) AllErrors() []error { return m } |
| 315 |
|
| 316 |
// StreamAccessLogsMessageValidationError is the validation error returned by |
| 317 |
// StreamAccessLogsMessage.Validate if the designated constraints aren't met. |
| 318 |
type StreamAccessLogsMessageValidationError struct { |
| 319 |
field string |
| 320 |
reason string |
| 321 |
cause error |
| 322 |
key bool |
| 323 |
} |
| 324 |
|
| 325 |
// Field function returns field value. |
| 326 |
func (e StreamAccessLogsMessageValidationError) Field() string { return e.field } |
| 327 |
|
| 328 |
// Reason function returns reason value. |
| 329 |
func (e StreamAccessLogsMessageValidationError) Reason() string { return e.reason } |
| 330 |
|
| 331 |
// Cause function returns cause value. |
| 332 |
func (e StreamAccessLogsMessageValidationError) Cause() error { return e.cause } |
| 333 |
|
| 334 |
// Key function returns key value. |
| 335 |
func (e StreamAccessLogsMessageValidationError) Key() bool { return e.key } |
| 336 |
|
| 337 |
// ErrorName returns error name. |
| 338 |
func (e StreamAccessLogsMessageValidationError) ErrorName() string { |
| 339 |
return "StreamAccessLogsMessageValidationError" |
| 340 |
} |
| 341 |
|
| 342 |
// Error satisfies the builtin error interface |
| 343 |
func (e StreamAccessLogsMessageValidationError) Error() string { |
| 344 |
cause := "" |
| 345 |
if e.cause != nil { |
| 346 |
cause = fmt.Sprintf(" | caused by: %v", e.cause) |
| 347 |
} |
| 348 |
|
| 349 |
key := "" |
| 350 |
if e.key { |
| 351 |
key = "key for " |
| 352 |
} |
| 353 |
|
| 354 |
return fmt.Sprintf( |
| 355 |
"invalid %sStreamAccessLogsMessage.%s: %s%s", |
| 356 |
key, |
| 357 |
e.field, |
| 358 |
e.reason, |
| 359 |
cause) |
| 360 |
} |
| 361 |
|
| 362 |
var _ error = StreamAccessLogsMessageValidationError{} |
| 363 |
|
| 364 |
var _ interface { |
| 365 |
Field() string |
| 366 |
Reason() string |
| 367 |
Key() bool |
| 368 |
Cause() error |
| 369 |
ErrorName() string |
| 370 |
} = StreamAccessLogsMessageValidationError{} |
| 371 |
|
| 372 |
// Validate checks the field values on StreamAccessLogsMessage_Identifier with |
| 373 |
// the rules defined in the proto definition for this message. If any rules |
| 374 |
// are violated, the first error encountered is returned, or nil if there are |
| 375 |
// no violations. |
| 376 |
func (m *StreamAccessLogsMessage_Identifier) Validate() error { |
| 377 |
return m.validate(false) |
| 378 |
} |
| 379 |
|
| 380 |
// ValidateAll checks the field values on StreamAccessLogsMessage_Identifier |
| 381 |
// with the rules defined in the proto definition for this message. If any |
| 382 |
// rules are violated, the result is a list of violation errors wrapped in |
| 383 |
// StreamAccessLogsMessage_IdentifierMultiError, or nil if none found. |
| 384 |
func (m *StreamAccessLogsMessage_Identifier) ValidateAll() error { |
| 385 |
return m.validate(true) |
| 386 |
} |
| 387 |
|
| 388 |
func (m *StreamAccessLogsMessage_Identifier) validate(all bool) error { |
| 389 |
if m == nil { |
| 390 |
return nil |
| 391 |
} |
| 392 |
|
| 393 |
var errors []error |
| 394 |
|
| 395 |
if m.GetNode() == nil { |
| 396 |
err := StreamAccessLogsMessage_IdentifierValidationError{ |
| 397 |
field: "Node", |
| 398 |
reason: "value is required", |
| 399 |
} |
| 400 |
if !all { |
| 401 |
return err |
| 402 |
} |
| 403 |
errors = append(errors, err) |
| 404 |
} |
| 405 |
|
| 406 |
if all { |
| 407 |
switch v := interface{}(m.GetNode()).(type) { |
| 408 |
case interface{ ValidateAll() error }: |
| 409 |
if err := v.ValidateAll(); err != nil { |
| 410 |
errors = append(errors, StreamAccessLogsMessage_IdentifierValidationError{ |
| 411 |
field: "Node", |
| 412 |
reason: "embedded message failed validation", |
| 413 |
cause: err, |
| 414 |
}) |
| 415 |
} |
| 416 |
case interface{ Validate() error }: |
| 417 |
if err := v.Validate(); err != nil { |
| 418 |
errors = append(errors, StreamAccessLogsMessage_IdentifierValidationError{ |
| 419 |
field: "Node", |
| 420 |
reason: "embedded message failed validation", |
| 421 |
cause: err, |
| 422 |
}) |
| 423 |
} |
| 424 |
} |
| 425 |
} else if v, ok := interface{}(m.GetNode()).(interface{ Validate() error }); ok { |
| 426 |
if err := v.Validate(); err != nil { |
| 427 |
return StreamAccessLogsMessage_IdentifierValidationError{ |
| 428 |
field: "Node", |
| 429 |
reason: "embedded message failed validation", |
| 430 |
cause: err, |
| 431 |
} |
| 432 |
} |
| 433 |
} |
| 434 |
|
| 435 |
if utf8.RuneCountInString(m.GetLogName()) < 1 { |
| 436 |
err := StreamAccessLogsMessage_IdentifierValidationError{ |
| 437 |
field: "LogName", |
| 438 |
reason: "value length must be at least 1 runes", |
| 439 |
} |
| 440 |
if !all { |
| 441 |
return err |
| 442 |
} |
| 443 |
errors = append(errors, err) |
| 444 |
} |
| 445 |
|
| 446 |
if len(errors) > 0 { |
| 447 |
return StreamAccessLogsMessage_IdentifierMultiError(errors) |
| 448 |
} |
| 449 |
|
| 450 |
return nil |
| 451 |
} |
| 452 |
|
| 453 |
// StreamAccessLogsMessage_IdentifierMultiError is an error wrapping multiple |
| 454 |
// validation errors returned by |
| 455 |
// StreamAccessLogsMessage_Identifier.ValidateAll() if the designated |
| 456 |
// constraints aren't met. |
| 457 |
type StreamAccessLogsMessage_IdentifierMultiError []error |
| 458 |
|
| 459 |
// Error returns a concatenation of all the error messages it wraps. |
| 460 |
func (m StreamAccessLogsMessage_IdentifierMultiError) Error() string { |
| 461 |
var msgs []string |
| 462 |
for _, err := range m { |
| 463 |
msgs = append(msgs, err.Error()) |
| 464 |
} |
| 465 |
return strings.Join(msgs, "; ") |
| 466 |
} |
| 467 |
|
| 468 |
// AllErrors returns a list of validation violation errors. |
| 469 |
func (m StreamAccessLogsMessage_IdentifierMultiError) AllErrors() []error { return m } |
| 470 |
|
| 471 |
// StreamAccessLogsMessage_IdentifierValidationError is the validation error |
| 472 |
// returned by StreamAccessLogsMessage_Identifier.Validate if the designated |
| 473 |
// constraints aren't met. |
| 474 |
type StreamAccessLogsMessage_IdentifierValidationError struct { |
| 475 |
field string |
| 476 |
reason string |
| 477 |
cause error |
| 478 |
key bool |
| 479 |
} |
| 480 |
|
| 481 |
// Field function returns field value. |
| 482 |
func (e StreamAccessLogsMessage_IdentifierValidationError) Field() string { return e.field } |
| 483 |
|
| 484 |
// Reason function returns reason value. |
| 485 |
func (e StreamAccessLogsMessage_IdentifierValidationError) Reason() string { return e.reason } |
| 486 |
|
| 487 |
// Cause function returns cause value. |
| 488 |
func (e StreamAccessLogsMessage_IdentifierValidationError) Cause() error { return e.cause } |
| 489 |
|
| 490 |
// Key function returns key value. |
| 491 |
func (e StreamAccessLogsMessage_IdentifierValidationError) Key() bool { return e.key } |
| 492 |
|
| 493 |
// ErrorName returns error name. |
| 494 |
func (e StreamAccessLogsMessage_IdentifierValidationError) ErrorName() string { |
| 495 |
return "StreamAccessLogsMessage_IdentifierValidationError" |
| 496 |
} |
| 497 |
|
| 498 |
// Error satisfies the builtin error interface |
| 499 |
func (e StreamAccessLogsMessage_IdentifierValidationError) Error() string { |
| 500 |
cause := "" |
| 501 |
if e.cause != nil { |
| 502 |
cause = fmt.Sprintf(" | caused by: %v", e.cause) |
| 503 |
} |
| 504 |
|
| 505 |
key := "" |
| 506 |
if e.key { |
| 507 |
key = "key for " |
| 508 |
} |
| 509 |
|
| 510 |
return fmt.Sprintf( |
| 511 |
"invalid %sStreamAccessLogsMessage_Identifier.%s: %s%s", |
| 512 |
key, |
| 513 |
e.field, |
| 514 |
e.reason, |
| 515 |
cause) |
| 516 |
} |
| 517 |
|
| 518 |
var _ error = StreamAccessLogsMessage_IdentifierValidationError{} |
| 519 |
|
| 520 |
var _ interface { |
| 521 |
Field() string |
| 522 |
Reason() string |
| 523 |
Key() bool |
| 524 |
Cause() error |
| 525 |
ErrorName() string |
| 526 |
} = StreamAccessLogsMessage_IdentifierValidationError{} |
| 527 |
|
| 528 |
// Validate checks the field values on |
| 529 |
// StreamAccessLogsMessage_HTTPAccessLogEntries with the rules defined in the |
| 530 |
// proto definition for this message. If any rules are violated, the first |
| 531 |
// error encountered is returned, or nil if there are no violations. |
| 532 |
func (m *StreamAccessLogsMessage_HTTPAccessLogEntries) Validate() error { |
| 533 |
return m.validate(false) |
| 534 |
} |
| 535 |
|
| 536 |
// ValidateAll checks the field values on |
| 537 |
// StreamAccessLogsMessage_HTTPAccessLogEntries with the rules defined in the |
| 538 |
// proto definition for this message. If any rules are violated, the result is |
| 539 |
// a list of violation errors wrapped in |
| 540 |
// StreamAccessLogsMessage_HTTPAccessLogEntriesMultiError, or nil if none found. |
| 541 |
func (m *StreamAccessLogsMessage_HTTPAccessLogEntries) ValidateAll() error { |
| 542 |
return m.validate(true) |
| 543 |
} |
| 544 |
|
| 545 |
func (m *StreamAccessLogsMessage_HTTPAccessLogEntries) validate(all bool) error { |
| 546 |
if m == nil { |
| 547 |
return nil |
| 548 |
} |
| 549 |
|
| 550 |
var errors []error |
| 551 |
|
| 552 |
if len(m.GetLogEntry()) < 1 { |
| 553 |
err := StreamAccessLogsMessage_HTTPAccessLogEntriesValidationError{ |
| 554 |
field: "LogEntry", |
| 555 |
reason: "value must contain at least 1 item(s)", |
| 556 |
} |
| 557 |
if !all { |
| 558 |
return err |
| 559 |
} |
| 560 |
errors = append(errors, err) |
| 561 |
} |
| 562 |
|
| 563 |
for idx, item := range m.GetLogEntry() { |
| 564 |
_, _ = idx, item |
| 565 |
|
| 566 |
if all { |
| 567 |
switch v := interface{}(item).(type) { |
| 568 |
case interface{ ValidateAll() error }: |
| 569 |
if err := v.ValidateAll(); err != nil { |
| 570 |
errors = append(errors, StreamAccessLogsMessage_HTTPAccessLogEntriesValidationError{ |
| 571 |
field: fmt.Sprintf("LogEntry[%v]", idx), |
| 572 |
reason: "embedded message failed validation", |
| 573 |
cause: err, |
| 574 |
}) |
| 575 |
} |
| 576 |
case interface{ Validate() error }: |
| 577 |
if err := v.Validate(); err != nil { |
| 578 |
errors = append(errors, StreamAccessLogsMessage_HTTPAccessLogEntriesValidationError{ |
| 579 |
field: fmt.Sprintf("LogEntry[%v]", idx), |
| 580 |
reason: "embedded message failed validation", |
| 581 |
cause: err, |
| 582 |
}) |
| 583 |
} |
| 584 |
} |
| 585 |
} else if v, ok := interface{}(item).(interface{ Validate() error }); ok { |
| 586 |
if err := v.Validate(); err != nil { |
| 587 |
return StreamAccessLogsMessage_HTTPAccessLogEntriesValidationError{ |
| 588 |
field: fmt.Sprintf("LogEntry[%v]", idx), |
| 589 |
reason: "embedded message failed validation", |
| 590 |
cause: err, |
| 591 |
} |
| 592 |
} |
| 593 |
} |
| 594 |
|
| 595 |
} |
| 596 |
|
| 597 |
if len(errors) > 0 { |
| 598 |
return StreamAccessLogsMessage_HTTPAccessLogEntriesMultiError(errors) |
| 599 |
} |
| 600 |
|
| 601 |
return nil |
| 602 |
} |
| 603 |
|
| 604 |
// StreamAccessLogsMessage_HTTPAccessLogEntriesMultiError is an error wrapping |
| 605 |
// multiple validation errors returned by |
| 606 |
// StreamAccessLogsMessage_HTTPAccessLogEntries.ValidateAll() if the |
| 607 |
// designated constraints aren't met. |
| 608 |
type StreamAccessLogsMessage_HTTPAccessLogEntriesMultiError []error |
| 609 |
|
| 610 |
// Error returns a concatenation of all the error messages it wraps. |
| 611 |
func (m StreamAccessLogsMessage_HTTPAccessLogEntriesMultiError) Error() string { |
| 612 |
var msgs []string |
| 613 |
for _, err := range m { |
| 614 |
msgs = append(msgs, err.Error()) |
| 615 |
} |
| 616 |
return strings.Join(msgs, "; ") |
| 617 |
} |
| 618 |
|
| 619 |
// AllErrors returns a list of validation violation errors. |
| 620 |
func (m StreamAccessLogsMessage_HTTPAccessLogEntriesMultiError) AllErrors() []error { return m } |
| 621 |
|
| 622 |
// StreamAccessLogsMessage_HTTPAccessLogEntriesValidationError is the |
| 623 |
// validation error returned by |
| 624 |
// StreamAccessLogsMessage_HTTPAccessLogEntries.Validate if the designated |
| 625 |
// constraints aren't met. |
| 626 |
type StreamAccessLogsMessage_HTTPAccessLogEntriesValidationError struct { |
| 627 |
field string |
| 628 |
reason string |
| 629 |
cause error |
| 630 |
key bool |
| 631 |
} |
| 632 |
|
| 633 |
// Field function returns field value. |
| 634 |
func (e StreamAccessLogsMessage_HTTPAccessLogEntriesValidationError) Field() string { return e.field } |
| 635 |
|
| 636 |
// Reason function returns reason value. |
| 637 |
func (e StreamAccessLogsMessage_HTTPAccessLogEntriesValidationError) Reason() string { return e.reason } |
| 638 |
|
| 639 |
// Cause function returns cause value. |
| 640 |
func (e StreamAccessLogsMessage_HTTPAccessLogEntriesValidationError) Cause() error { return e.cause } |
| 641 |
|
| 642 |
// Key function returns key value. |
| 643 |
func (e StreamAccessLogsMessage_HTTPAccessLogEntriesValidationError) Key() bool { return e.key } |
| 644 |
|
| 645 |
// ErrorName returns error name. |
| 646 |
func (e StreamAccessLogsMessage_HTTPAccessLogEntriesValidationError) ErrorName() string { |
| 647 |
return "StreamAccessLogsMessage_HTTPAccessLogEntriesValidationError" |
| 648 |
} |
| 649 |
|
| 650 |
// Error satisfies the builtin error interface |
| 651 |
func (e StreamAccessLogsMessage_HTTPAccessLogEntriesValidationError) Error() string { |
| 652 |
cause := "" |
| 653 |
if e.cause != nil { |
| 654 |
cause = fmt.Sprintf(" | caused by: %v", e.cause) |
| 655 |
} |
| 656 |
|
| 657 |
key := "" |
| 658 |
if e.key { |
| 659 |
key = "key for " |
| 660 |
} |
| 661 |
|
| 662 |
return fmt.Sprintf( |
| 663 |
"invalid %sStreamAccessLogsMessage_HTTPAccessLogEntries.%s: %s%s", |
| 664 |
key, |
| 665 |
e.field, |
| 666 |
e.reason, |
| 667 |
cause) |
| 668 |
} |
| 669 |
|
| 670 |
var _ error = StreamAccessLogsMessage_HTTPAccessLogEntriesValidationError{} |
| 671 |
|
| 672 |
var _ interface { |
| 673 |
Field() string |
| 674 |
Reason() string |
| 675 |
Key() bool |
| 676 |
Cause() error |
| 677 |
ErrorName() string |
| 678 |
} = StreamAccessLogsMessage_HTTPAccessLogEntriesValidationError{} |
| 679 |
|
| 680 |
// Validate checks the field values on |
| 681 |
// StreamAccessLogsMessage_TCPAccessLogEntries with the rules defined in the |
| 682 |
// proto definition for this message. If any rules are violated, the first |
| 683 |
// error encountered is returned, or nil if there are no violations. |
| 684 |
func (m *StreamAccessLogsMessage_TCPAccessLogEntries) Validate() error { |
| 685 |
return m.validate(false) |
| 686 |
} |
| 687 |
|
| 688 |
// ValidateAll checks the field values on |
| 689 |
// StreamAccessLogsMessage_TCPAccessLogEntries with the rules defined in the |
| 690 |
// proto definition for this message. If any rules are violated, the result is |
| 691 |
// a list of violation errors wrapped in |
| 692 |
// StreamAccessLogsMessage_TCPAccessLogEntriesMultiError, or nil if none found. |
| 693 |
func (m *StreamAccessLogsMessage_TCPAccessLogEntries) ValidateAll() error { |
| 694 |
return m.validate(true) |
| 695 |
} |
| 696 |
|
| 697 |
func (m *StreamAccessLogsMessage_TCPAccessLogEntries) validate(all bool) error { |
| 698 |
if m == nil { |
| 699 |
return nil |
| 700 |
} |
| 701 |
|
| 702 |
var errors []error |
| 703 |
|
| 704 |
if len(m.GetLogEntry()) < 1 { |
| 705 |
err := StreamAccessLogsMessage_TCPAccessLogEntriesValidationError{ |
| 706 |
field: "LogEntry", |
| 707 |
reason: "value must contain at least 1 item(s)", |
| 708 |
} |
| 709 |
if !all { |
| 710 |
return err |
| 711 |
} |
| 712 |
errors = append(errors, err) |
| 713 |
} |
| 714 |
|
| 715 |
for idx, item := range m.GetLogEntry() { |
| 716 |
_, _ = idx, item |
| 717 |
|
| 718 |
if all { |
| 719 |
switch v := interface{}(item).(type) { |
| 720 |
case interface{ ValidateAll() error }: |
| 721 |
if err := v.ValidateAll(); err != nil { |
| 722 |
errors = append(errors, StreamAccessLogsMessage_TCPAccessLogEntriesValidationError{ |
| 723 |
field: fmt.Sprintf("LogEntry[%v]", idx), |
| 724 |
reason: "embedded message failed validation", |
| 725 |
cause: err, |
| 726 |
}) |
| 727 |
} |
| 728 |
case interface{ Validate() error }: |
| 729 |
if err := v.Validate(); err != nil { |
| 730 |
errors = append(errors, StreamAccessLogsMessage_TCPAccessLogEntriesValidationError{ |
| 731 |
field: fmt.Sprintf("LogEntry[%v]", idx), |
| 732 |
reason: "embedded message failed validation", |
| 733 |
cause: err, |
| 734 |
}) |
| 735 |
} |
| 736 |
} |
| 737 |
} else if v, ok := interface{}(item).(interface{ Validate() error }); ok { |
| 738 |
if err := v.Validate(); err != nil { |
| 739 |
return StreamAccessLogsMessage_TCPAccessLogEntriesValidationError{ |
| 740 |
field: fmt.Sprintf("LogEntry[%v]", idx), |
| 741 |
reason: "embedded message failed validation", |
| 742 |
cause: err, |
| 743 |
} |
| 744 |
} |
| 745 |
} |
| 746 |
|
| 747 |
} |
| 748 |
|
| 749 |
if len(errors) > 0 { |
| 750 |
return StreamAccessLogsMessage_TCPAccessLogEntriesMultiError(errors) |
| 751 |
} |
| 752 |
|
| 753 |
return nil |
| 754 |
} |
| 755 |
|
| 756 |
// StreamAccessLogsMessage_TCPAccessLogEntriesMultiError is an error wrapping |
| 757 |
// multiple validation errors returned by |
| 758 |
// StreamAccessLogsMessage_TCPAccessLogEntries.ValidateAll() if the designated |
| 759 |
// constraints aren't met. |
| 760 |
type StreamAccessLogsMessage_TCPAccessLogEntriesMultiError []error |
| 761 |
|
| 762 |
// Error returns a concatenation of all the error messages it wraps. |
| 763 |
func (m StreamAccessLogsMessage_TCPAccessLogEntriesMultiError) Error() string { |
| 764 |
var msgs []string |
| 765 |
for _, err := range m { |
| 766 |
msgs = append(msgs, err.Error()) |
| 767 |
} |
| 768 |
return strings.Join(msgs, "; ") |
| 769 |
} |
| 770 |
|
| 771 |
// AllErrors returns a list of validation violation errors. |
| 772 |
func (m StreamAccessLogsMessage_TCPAccessLogEntriesMultiError) AllErrors() []error { return m } |
| 773 |
|
| 774 |
// StreamAccessLogsMessage_TCPAccessLogEntriesValidationError is the validation |
| 775 |
// error returned by StreamAccessLogsMessage_TCPAccessLogEntries.Validate if |
| 776 |
// the designated constraints aren't met. |
| 777 |
type StreamAccessLogsMessage_TCPAccessLogEntriesValidationError struct { |
| 778 |
field string |
| 779 |
reason string |
| 780 |
cause error |
| 781 |
key bool |
| 782 |
} |
| 783 |
|
| 784 |
// Field function returns field value. |
| 785 |
func (e StreamAccessLogsMessage_TCPAccessLogEntriesValidationError) Field() string { return e.field } |
| 786 |
|
| 787 |
// Reason function returns reason value. |
| 788 |
func (e StreamAccessLogsMessage_TCPAccessLogEntriesValidationError) Reason() string { return e.reason } |
| 789 |
|
| 790 |
// Cause function returns cause value. |
| 791 |
func (e StreamAccessLogsMessage_TCPAccessLogEntriesValidationError) Cause() error { return e.cause } |
| 792 |
|
| 793 |
// Key function returns key value. |
| 794 |
func (e StreamAccessLogsMessage_TCPAccessLogEntriesValidationError) Key() bool { return e.key } |
| 795 |
|
| 796 |
// ErrorName returns error name. |
| 797 |
func (e StreamAccessLogsMessage_TCPAccessLogEntriesValidationError) ErrorName() string { |
| 798 |
return "StreamAccessLogsMessage_TCPAccessLogEntriesValidationError" |
| 799 |
} |
| 800 |
|
| 801 |
// Error satisfies the builtin error interface |
| 802 |
func (e StreamAccessLogsMessage_TCPAccessLogEntriesValidationError) Error() string { |
| 803 |
cause := "" |
| 804 |
if e.cause != nil { |
| 805 |
cause = fmt.Sprintf(" | caused by: %v", e.cause) |
| 806 |
} |
| 807 |
|
| 808 |
key := "" |
| 809 |
if e.key { |
| 810 |
key = "key for " |
| 811 |
} |
| 812 |
|
| 813 |
return fmt.Sprintf( |
| 814 |
"invalid %sStreamAccessLogsMessage_TCPAccessLogEntries.%s: %s%s", |
| 815 |
key, |
| 816 |
e.field, |
| 817 |
e.reason, |
| 818 |
cause) |
| 819 |
} |
| 820 |
|
| 821 |
var _ error = StreamAccessLogsMessage_TCPAccessLogEntriesValidationError{} |
| 822 |
|
| 823 |
var _ interface { |
| 824 |
Field() string |
| 825 |
Reason() string |
| 826 |
Key() bool |
| 827 |
Cause() error |
| 828 |
ErrorName() string |
| 829 |
} = StreamAccessLogsMessage_TCPAccessLogEntriesValidationError{} |