gitee.com/ks-custle/core-gm@v0.0.0-20230922171213-b83bdd97b62c/go-control-plane/envoy/service/ratelimit/v3/rls.pb.validate.go (about) 1 // Code generated by protoc-gen-validate. DO NOT EDIT. 2 // source: envoy/service/ratelimit/v3/rls.proto 3 4 package envoy_service_ratelimit_v3 5 6 import ( 7 "bytes" 8 "errors" 9 "fmt" 10 "net" 11 "net/mail" 12 "net/url" 13 "regexp" 14 "strings" 15 "time" 16 "unicode/utf8" 17 18 "google.golang.org/protobuf/types/known/anypb" 19 ) 20 21 // ensure the imports are used 22 var ( 23 _ = bytes.MinRead 24 _ = errors.New("") 25 _ = fmt.Print 26 _ = utf8.UTFMax 27 _ = (*regexp.Regexp)(nil) 28 _ = (*strings.Reader)(nil) 29 _ = net.IPv4len 30 _ = time.Duration(0) 31 _ = (*url.URL)(nil) 32 _ = (*mail.Address)(nil) 33 _ = anypb.Any{} 34 ) 35 36 // Validate checks the field values on RateLimitRequest with the rules defined 37 // in the proto definition for this message. If any rules are violated, an 38 // error is returned. 39 func (m *RateLimitRequest) Validate() error { 40 if m == nil { 41 return nil 42 } 43 44 // no validation rules for Domain 45 46 for idx, item := range m.GetDescriptors() { 47 _, _ = idx, item 48 49 if v, ok := interface{}(item).(interface{ Validate() error }); ok { 50 if err := v.Validate(); err != nil { 51 return RateLimitRequestValidationError{ 52 field: fmt.Sprintf("Descriptors[%v]", idx), 53 reason: "embedded message failed validation", 54 cause: err, 55 } 56 } 57 } 58 59 } 60 61 // no validation rules for HitsAddend 62 63 return nil 64 } 65 66 // RateLimitRequestValidationError is the validation error returned by 67 // RateLimitRequest.Validate if the designated constraints aren't met. 68 type RateLimitRequestValidationError struct { 69 field string 70 reason string 71 cause error 72 key bool 73 } 74 75 // Field function returns field value. 76 func (e RateLimitRequestValidationError) Field() string { return e.field } 77 78 // Reason function returns reason value. 79 func (e RateLimitRequestValidationError) Reason() string { return e.reason } 80 81 // Cause function returns cause value. 82 func (e RateLimitRequestValidationError) Cause() error { return e.cause } 83 84 // Key function returns key value. 85 func (e RateLimitRequestValidationError) Key() bool { return e.key } 86 87 // ErrorName returns error name. 88 func (e RateLimitRequestValidationError) ErrorName() string { return "RateLimitRequestValidationError" } 89 90 // Error satisfies the builtin error interface 91 func (e RateLimitRequestValidationError) Error() string { 92 cause := "" 93 if e.cause != nil { 94 cause = fmt.Sprintf(" | caused by: %v", e.cause) 95 } 96 97 key := "" 98 if e.key { 99 key = "key for " 100 } 101 102 return fmt.Sprintf( 103 "invalid %sRateLimitRequest.%s: %s%s", 104 key, 105 e.field, 106 e.reason, 107 cause) 108 } 109 110 var _ error = RateLimitRequestValidationError{} 111 112 var _ interface { 113 Field() string 114 Reason() string 115 Key() bool 116 Cause() error 117 ErrorName() string 118 } = RateLimitRequestValidationError{} 119 120 // Validate checks the field values on RateLimitResponse with the rules defined 121 // in the proto definition for this message. If any rules are violated, an 122 // error is returned. 123 func (m *RateLimitResponse) Validate() error { 124 if m == nil { 125 return nil 126 } 127 128 // no validation rules for OverallCode 129 130 for idx, item := range m.GetStatuses() { 131 _, _ = idx, item 132 133 if v, ok := interface{}(item).(interface{ Validate() error }); ok { 134 if err := v.Validate(); err != nil { 135 return RateLimitResponseValidationError{ 136 field: fmt.Sprintf("Statuses[%v]", idx), 137 reason: "embedded message failed validation", 138 cause: err, 139 } 140 } 141 } 142 143 } 144 145 for idx, item := range m.GetResponseHeadersToAdd() { 146 _, _ = idx, item 147 148 if v, ok := interface{}(item).(interface{ Validate() error }); ok { 149 if err := v.Validate(); err != nil { 150 return RateLimitResponseValidationError{ 151 field: fmt.Sprintf("ResponseHeadersToAdd[%v]", idx), 152 reason: "embedded message failed validation", 153 cause: err, 154 } 155 } 156 } 157 158 } 159 160 for idx, item := range m.GetRequestHeadersToAdd() { 161 _, _ = idx, item 162 163 if v, ok := interface{}(item).(interface{ Validate() error }); ok { 164 if err := v.Validate(); err != nil { 165 return RateLimitResponseValidationError{ 166 field: fmt.Sprintf("RequestHeadersToAdd[%v]", idx), 167 reason: "embedded message failed validation", 168 cause: err, 169 } 170 } 171 } 172 173 } 174 175 // no validation rules for RawBody 176 177 if v, ok := interface{}(m.GetDynamicMetadata()).(interface{ Validate() error }); ok { 178 if err := v.Validate(); err != nil { 179 return RateLimitResponseValidationError{ 180 field: "DynamicMetadata", 181 reason: "embedded message failed validation", 182 cause: err, 183 } 184 } 185 } 186 187 return nil 188 } 189 190 // RateLimitResponseValidationError is the validation error returned by 191 // RateLimitResponse.Validate if the designated constraints aren't met. 192 type RateLimitResponseValidationError struct { 193 field string 194 reason string 195 cause error 196 key bool 197 } 198 199 // Field function returns field value. 200 func (e RateLimitResponseValidationError) Field() string { return e.field } 201 202 // Reason function returns reason value. 203 func (e RateLimitResponseValidationError) Reason() string { return e.reason } 204 205 // Cause function returns cause value. 206 func (e RateLimitResponseValidationError) Cause() error { return e.cause } 207 208 // Key function returns key value. 209 func (e RateLimitResponseValidationError) Key() bool { return e.key } 210 211 // ErrorName returns error name. 212 func (e RateLimitResponseValidationError) ErrorName() string { 213 return "RateLimitResponseValidationError" 214 } 215 216 // Error satisfies the builtin error interface 217 func (e RateLimitResponseValidationError) Error() string { 218 cause := "" 219 if e.cause != nil { 220 cause = fmt.Sprintf(" | caused by: %v", e.cause) 221 } 222 223 key := "" 224 if e.key { 225 key = "key for " 226 } 227 228 return fmt.Sprintf( 229 "invalid %sRateLimitResponse.%s: %s%s", 230 key, 231 e.field, 232 e.reason, 233 cause) 234 } 235 236 var _ error = RateLimitResponseValidationError{} 237 238 var _ interface { 239 Field() string 240 Reason() string 241 Key() bool 242 Cause() error 243 ErrorName() string 244 } = RateLimitResponseValidationError{} 245 246 // Validate checks the field values on RateLimitResponse_RateLimit with the 247 // rules defined in the proto definition for this message. If any rules are 248 // violated, an error is returned. 249 func (m *RateLimitResponse_RateLimit) Validate() error { 250 if m == nil { 251 return nil 252 } 253 254 // no validation rules for Name 255 256 // no validation rules for RequestsPerUnit 257 258 // no validation rules for Unit 259 260 return nil 261 } 262 263 // RateLimitResponse_RateLimitValidationError is the validation error returned 264 // by RateLimitResponse_RateLimit.Validate if the designated constraints 265 // aren't met. 266 type RateLimitResponse_RateLimitValidationError struct { 267 field string 268 reason string 269 cause error 270 key bool 271 } 272 273 // Field function returns field value. 274 func (e RateLimitResponse_RateLimitValidationError) Field() string { return e.field } 275 276 // Reason function returns reason value. 277 func (e RateLimitResponse_RateLimitValidationError) Reason() string { return e.reason } 278 279 // Cause function returns cause value. 280 func (e RateLimitResponse_RateLimitValidationError) Cause() error { return e.cause } 281 282 // Key function returns key value. 283 func (e RateLimitResponse_RateLimitValidationError) Key() bool { return e.key } 284 285 // ErrorName returns error name. 286 func (e RateLimitResponse_RateLimitValidationError) ErrorName() string { 287 return "RateLimitResponse_RateLimitValidationError" 288 } 289 290 // Error satisfies the builtin error interface 291 func (e RateLimitResponse_RateLimitValidationError) Error() string { 292 cause := "" 293 if e.cause != nil { 294 cause = fmt.Sprintf(" | caused by: %v", e.cause) 295 } 296 297 key := "" 298 if e.key { 299 key = "key for " 300 } 301 302 return fmt.Sprintf( 303 "invalid %sRateLimitResponse_RateLimit.%s: %s%s", 304 key, 305 e.field, 306 e.reason, 307 cause) 308 } 309 310 var _ error = RateLimitResponse_RateLimitValidationError{} 311 312 var _ interface { 313 Field() string 314 Reason() string 315 Key() bool 316 Cause() error 317 ErrorName() string 318 } = RateLimitResponse_RateLimitValidationError{} 319 320 // Validate checks the field values on RateLimitResponse_Quota with the rules 321 // defined in the proto definition for this message. If any rules are 322 // violated, an error is returned. 323 func (m *RateLimitResponse_Quota) Validate() error { 324 if m == nil { 325 return nil 326 } 327 328 if m.GetRequests() <= 0 { 329 return RateLimitResponse_QuotaValidationError{ 330 field: "Requests", 331 reason: "value must be greater than 0", 332 } 333 } 334 335 switch m.ExpirationSpecifier.(type) { 336 337 case *RateLimitResponse_Quota_ValidUntil: 338 339 if v, ok := interface{}(m.GetValidUntil()).(interface{ Validate() error }); ok { 340 if err := v.Validate(); err != nil { 341 return RateLimitResponse_QuotaValidationError{ 342 field: "ValidUntil", 343 reason: "embedded message failed validation", 344 cause: err, 345 } 346 } 347 } 348 349 } 350 351 return nil 352 } 353 354 // RateLimitResponse_QuotaValidationError is the validation error returned by 355 // RateLimitResponse_Quota.Validate if the designated constraints aren't met. 356 type RateLimitResponse_QuotaValidationError struct { 357 field string 358 reason string 359 cause error 360 key bool 361 } 362 363 // Field function returns field value. 364 func (e RateLimitResponse_QuotaValidationError) Field() string { return e.field } 365 366 // Reason function returns reason value. 367 func (e RateLimitResponse_QuotaValidationError) Reason() string { return e.reason } 368 369 // Cause function returns cause value. 370 func (e RateLimitResponse_QuotaValidationError) Cause() error { return e.cause } 371 372 // Key function returns key value. 373 func (e RateLimitResponse_QuotaValidationError) Key() bool { return e.key } 374 375 // ErrorName returns error name. 376 func (e RateLimitResponse_QuotaValidationError) ErrorName() string { 377 return "RateLimitResponse_QuotaValidationError" 378 } 379 380 // Error satisfies the builtin error interface 381 func (e RateLimitResponse_QuotaValidationError) Error() string { 382 cause := "" 383 if e.cause != nil { 384 cause = fmt.Sprintf(" | caused by: %v", e.cause) 385 } 386 387 key := "" 388 if e.key { 389 key = "key for " 390 } 391 392 return fmt.Sprintf( 393 "invalid %sRateLimitResponse_Quota.%s: %s%s", 394 key, 395 e.field, 396 e.reason, 397 cause) 398 } 399 400 var _ error = RateLimitResponse_QuotaValidationError{} 401 402 var _ interface { 403 Field() string 404 Reason() string 405 Key() bool 406 Cause() error 407 ErrorName() string 408 } = RateLimitResponse_QuotaValidationError{} 409 410 // Validate checks the field values on RateLimitResponse_DescriptorStatus with 411 // the rules defined in the proto definition for this message. If any rules 412 // are violated, an error is returned. 413 func (m *RateLimitResponse_DescriptorStatus) Validate() error { 414 if m == nil { 415 return nil 416 } 417 418 // no validation rules for Code 419 420 if v, ok := interface{}(m.GetCurrentLimit()).(interface{ Validate() error }); ok { 421 if err := v.Validate(); err != nil { 422 return RateLimitResponse_DescriptorStatusValidationError{ 423 field: "CurrentLimit", 424 reason: "embedded message failed validation", 425 cause: err, 426 } 427 } 428 } 429 430 // no validation rules for LimitRemaining 431 432 if v, ok := interface{}(m.GetDurationUntilReset()).(interface{ Validate() error }); ok { 433 if err := v.Validate(); err != nil { 434 return RateLimitResponse_DescriptorStatusValidationError{ 435 field: "DurationUntilReset", 436 reason: "embedded message failed validation", 437 cause: err, 438 } 439 } 440 } 441 442 if v, ok := interface{}(m.GetQuota()).(interface{ Validate() error }); ok { 443 if err := v.Validate(); err != nil { 444 return RateLimitResponse_DescriptorStatusValidationError{ 445 field: "Quota", 446 reason: "embedded message failed validation", 447 cause: err, 448 } 449 } 450 } 451 452 return nil 453 } 454 455 // RateLimitResponse_DescriptorStatusValidationError is the validation error 456 // returned by RateLimitResponse_DescriptorStatus.Validate if the designated 457 // constraints aren't met. 458 type RateLimitResponse_DescriptorStatusValidationError struct { 459 field string 460 reason string 461 cause error 462 key bool 463 } 464 465 // Field function returns field value. 466 func (e RateLimitResponse_DescriptorStatusValidationError) Field() string { return e.field } 467 468 // Reason function returns reason value. 469 func (e RateLimitResponse_DescriptorStatusValidationError) Reason() string { return e.reason } 470 471 // Cause function returns cause value. 472 func (e RateLimitResponse_DescriptorStatusValidationError) Cause() error { return e.cause } 473 474 // Key function returns key value. 475 func (e RateLimitResponse_DescriptorStatusValidationError) Key() bool { return e.key } 476 477 // ErrorName returns error name. 478 func (e RateLimitResponse_DescriptorStatusValidationError) ErrorName() string { 479 return "RateLimitResponse_DescriptorStatusValidationError" 480 } 481 482 // Error satisfies the builtin error interface 483 func (e RateLimitResponse_DescriptorStatusValidationError) Error() string { 484 cause := "" 485 if e.cause != nil { 486 cause = fmt.Sprintf(" | caused by: %v", e.cause) 487 } 488 489 key := "" 490 if e.key { 491 key = "key for " 492 } 493 494 return fmt.Sprintf( 495 "invalid %sRateLimitResponse_DescriptorStatus.%s: %s%s", 496 key, 497 e.field, 498 e.reason, 499 cause) 500 } 501 502 var _ error = RateLimitResponse_DescriptorStatusValidationError{} 503 504 var _ interface { 505 Field() string 506 Reason() string 507 Key() bool 508 Cause() error 509 ErrorName() string 510 } = RateLimitResponse_DescriptorStatusValidationError{}