gitee.com/ks-custle/core-gm@v0.0.0-20230922171213-b83bdd97b62c/go-control-plane/envoy/config/ratelimit/v3/rls.pb.validate.go (about) 1 // Code generated by protoc-gen-validate. DO NOT EDIT. 2 // source: envoy/config/ratelimit/v3/rls.proto 3 4 package envoy_config_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 v3 "gitee.com/ks-custle/core-gm/go-control-plane/envoy/config/core/v3" 21 ) 22 23 // ensure the imports are used 24 var ( 25 _ = bytes.MinRead 26 _ = errors.New("") 27 _ = fmt.Print 28 _ = utf8.UTFMax 29 _ = (*regexp.Regexp)(nil) 30 _ = (*strings.Reader)(nil) 31 _ = net.IPv4len 32 _ = time.Duration(0) 33 _ = (*url.URL)(nil) 34 _ = (*mail.Address)(nil) 35 _ = anypb.Any{} 36 37 _ = v3.ApiVersion(0) 38 ) 39 40 // Validate checks the field values on RateLimitServiceConfig with the rules 41 // defined in the proto definition for this message. If any rules are 42 // violated, an error is returned. 43 func (m *RateLimitServiceConfig) Validate() error { 44 if m == nil { 45 return nil 46 } 47 48 if m.GetGrpcService() == nil { 49 return RateLimitServiceConfigValidationError{ 50 field: "GrpcService", 51 reason: "value is required", 52 } 53 } 54 55 if v, ok := interface{}(m.GetGrpcService()).(interface{ Validate() error }); ok { 56 if err := v.Validate(); err != nil { 57 return RateLimitServiceConfigValidationError{ 58 field: "GrpcService", 59 reason: "embedded message failed validation", 60 cause: err, 61 } 62 } 63 } 64 65 if _, ok := v3.ApiVersion_name[int32(m.GetTransportApiVersion())]; !ok { 66 return RateLimitServiceConfigValidationError{ 67 field: "TransportApiVersion", 68 reason: "value must be one of the defined enum values", 69 } 70 } 71 72 return nil 73 } 74 75 // RateLimitServiceConfigValidationError is the validation error returned by 76 // RateLimitServiceConfig.Validate if the designated constraints aren't met. 77 type RateLimitServiceConfigValidationError struct { 78 field string 79 reason string 80 cause error 81 key bool 82 } 83 84 // Field function returns field value. 85 func (e RateLimitServiceConfigValidationError) Field() string { return e.field } 86 87 // Reason function returns reason value. 88 func (e RateLimitServiceConfigValidationError) Reason() string { return e.reason } 89 90 // Cause function returns cause value. 91 func (e RateLimitServiceConfigValidationError) Cause() error { return e.cause } 92 93 // Key function returns key value. 94 func (e RateLimitServiceConfigValidationError) Key() bool { return e.key } 95 96 // ErrorName returns error name. 97 func (e RateLimitServiceConfigValidationError) ErrorName() string { 98 return "RateLimitServiceConfigValidationError" 99 } 100 101 // Error satisfies the builtin error interface 102 func (e RateLimitServiceConfigValidationError) Error() string { 103 cause := "" 104 if e.cause != nil { 105 cause = fmt.Sprintf(" | caused by: %v", e.cause) 106 } 107 108 key := "" 109 if e.key { 110 key = "key for " 111 } 112 113 return fmt.Sprintf( 114 "invalid %sRateLimitServiceConfig.%s: %s%s", 115 key, 116 e.field, 117 e.reason, 118 cause) 119 } 120 121 var _ error = RateLimitServiceConfigValidationError{} 122 123 var _ interface { 124 Field() string 125 Reason() string 126 Key() bool 127 Cause() error 128 ErrorName() string 129 } = RateLimitServiceConfigValidationError{}