gitee.com/zhaochuninhefei/gmgo@v0.0.31-0.20240209061119-069254a02979/go-control-plane/envoy/service/ratelimit/v2/rls.pb.validate.go (about) 1 // Code generated by protoc-gen-validate. DO NOT EDIT. 2 // source: envoy/service/ratelimit/v2/rls.proto 3 4 package envoy_service_ratelimit_v2 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.GetHeaders() { 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("Headers[%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 return nil 176 } 177 178 // RateLimitResponseValidationError is the validation error returned by 179 // RateLimitResponse.Validate if the designated constraints aren't met. 180 type RateLimitResponseValidationError struct { 181 field string 182 reason string 183 cause error 184 key bool 185 } 186 187 // Field function returns field value. 188 func (e RateLimitResponseValidationError) Field() string { return e.field } 189 190 // Reason function returns reason value. 191 func (e RateLimitResponseValidationError) Reason() string { return e.reason } 192 193 // Cause function returns cause value. 194 func (e RateLimitResponseValidationError) Cause() error { return e.cause } 195 196 // Key function returns key value. 197 func (e RateLimitResponseValidationError) Key() bool { return e.key } 198 199 // ErrorName returns error name. 200 func (e RateLimitResponseValidationError) ErrorName() string { 201 return "RateLimitResponseValidationError" 202 } 203 204 // Error satisfies the builtin error interface 205 func (e RateLimitResponseValidationError) Error() string { 206 cause := "" 207 if e.cause != nil { 208 cause = fmt.Sprintf(" | caused by: %v", e.cause) 209 } 210 211 key := "" 212 if e.key { 213 key = "key for " 214 } 215 216 return fmt.Sprintf( 217 "invalid %sRateLimitResponse.%s: %s%s", 218 key, 219 e.field, 220 e.reason, 221 cause) 222 } 223 224 var _ error = RateLimitResponseValidationError{} 225 226 var _ interface { 227 Field() string 228 Reason() string 229 Key() bool 230 Cause() error 231 ErrorName() string 232 } = RateLimitResponseValidationError{} 233 234 // Validate checks the field values on RateLimitResponse_RateLimit with the 235 // rules defined in the proto definition for this message. If any rules are 236 // violated, an error is returned. 237 func (m *RateLimitResponse_RateLimit) Validate() error { 238 if m == nil { 239 return nil 240 } 241 242 // no validation rules for Name 243 244 // no validation rules for RequestsPerUnit 245 246 // no validation rules for Unit 247 248 return nil 249 } 250 251 // RateLimitResponse_RateLimitValidationError is the validation error returned 252 // by RateLimitResponse_RateLimit.Validate if the designated constraints 253 // aren't met. 254 type RateLimitResponse_RateLimitValidationError struct { 255 field string 256 reason string 257 cause error 258 key bool 259 } 260 261 // Field function returns field value. 262 func (e RateLimitResponse_RateLimitValidationError) Field() string { return e.field } 263 264 // Reason function returns reason value. 265 func (e RateLimitResponse_RateLimitValidationError) Reason() string { return e.reason } 266 267 // Cause function returns cause value. 268 func (e RateLimitResponse_RateLimitValidationError) Cause() error { return e.cause } 269 270 // Key function returns key value. 271 func (e RateLimitResponse_RateLimitValidationError) Key() bool { return e.key } 272 273 // ErrorName returns error name. 274 func (e RateLimitResponse_RateLimitValidationError) ErrorName() string { 275 return "RateLimitResponse_RateLimitValidationError" 276 } 277 278 // Error satisfies the builtin error interface 279 func (e RateLimitResponse_RateLimitValidationError) Error() string { 280 cause := "" 281 if e.cause != nil { 282 cause = fmt.Sprintf(" | caused by: %v", e.cause) 283 } 284 285 key := "" 286 if e.key { 287 key = "key for " 288 } 289 290 return fmt.Sprintf( 291 "invalid %sRateLimitResponse_RateLimit.%s: %s%s", 292 key, 293 e.field, 294 e.reason, 295 cause) 296 } 297 298 var _ error = RateLimitResponse_RateLimitValidationError{} 299 300 var _ interface { 301 Field() string 302 Reason() string 303 Key() bool 304 Cause() error 305 ErrorName() string 306 } = RateLimitResponse_RateLimitValidationError{} 307 308 // Validate checks the field values on RateLimitResponse_DescriptorStatus with 309 // the rules defined in the proto definition for this message. If any rules 310 // are violated, an error is returned. 311 func (m *RateLimitResponse_DescriptorStatus) Validate() error { 312 if m == nil { 313 return nil 314 } 315 316 // no validation rules for Code 317 318 if v, ok := interface{}(m.GetCurrentLimit()).(interface{ Validate() error }); ok { 319 if err := v.Validate(); err != nil { 320 return RateLimitResponse_DescriptorStatusValidationError{ 321 field: "CurrentLimit", 322 reason: "embedded message failed validation", 323 cause: err, 324 } 325 } 326 } 327 328 // no validation rules for LimitRemaining 329 330 return nil 331 } 332 333 // RateLimitResponse_DescriptorStatusValidationError is the validation error 334 // returned by RateLimitResponse_DescriptorStatus.Validate if the designated 335 // constraints aren't met. 336 type RateLimitResponse_DescriptorStatusValidationError struct { 337 field string 338 reason string 339 cause error 340 key bool 341 } 342 343 // Field function returns field value. 344 func (e RateLimitResponse_DescriptorStatusValidationError) Field() string { return e.field } 345 346 // Reason function returns reason value. 347 func (e RateLimitResponse_DescriptorStatusValidationError) Reason() string { return e.reason } 348 349 // Cause function returns cause value. 350 func (e RateLimitResponse_DescriptorStatusValidationError) Cause() error { return e.cause } 351 352 // Key function returns key value. 353 func (e RateLimitResponse_DescriptorStatusValidationError) Key() bool { return e.key } 354 355 // ErrorName returns error name. 356 func (e RateLimitResponse_DescriptorStatusValidationError) ErrorName() string { 357 return "RateLimitResponse_DescriptorStatusValidationError" 358 } 359 360 // Error satisfies the builtin error interface 361 func (e RateLimitResponse_DescriptorStatusValidationError) Error() string { 362 cause := "" 363 if e.cause != nil { 364 cause = fmt.Sprintf(" | caused by: %v", e.cause) 365 } 366 367 key := "" 368 if e.key { 369 key = "key for " 370 } 371 372 return fmt.Sprintf( 373 "invalid %sRateLimitResponse_DescriptorStatus.%s: %s%s", 374 key, 375 e.field, 376 e.reason, 377 cause) 378 } 379 380 var _ error = RateLimitResponse_DescriptorStatusValidationError{} 381 382 var _ interface { 383 Field() string 384 Reason() string 385 Key() bool 386 Cause() error 387 ErrorName() string 388 } = RateLimitResponse_DescriptorStatusValidationError{}