github.com/hxx258456/ccgo@v0.0.5-0.20230213014102-48b35f46f66f/go-control-plane/envoy/config/ratelimit/v2/rls.pb.validate.go (about) 1 // Code generated by protoc-gen-validate. DO NOT EDIT. 2 // source: envoy/config/ratelimit/v2/rls.proto 3 4 package envoy_config_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 RateLimitServiceConfig with the rules 37 // defined in the proto definition for this message. If any rules are 38 // violated, an error is returned. 39 func (m *RateLimitServiceConfig) Validate() error { 40 if m == nil { 41 return nil 42 } 43 44 if m.GetGrpcService() == nil { 45 return RateLimitServiceConfigValidationError{ 46 field: "GrpcService", 47 reason: "value is required", 48 } 49 } 50 51 if v, ok := interface{}(m.GetGrpcService()).(interface{ Validate() error }); ok { 52 if err := v.Validate(); err != nil { 53 return RateLimitServiceConfigValidationError{ 54 field: "GrpcService", 55 reason: "embedded message failed validation", 56 cause: err, 57 } 58 } 59 } 60 61 return nil 62 } 63 64 // RateLimitServiceConfigValidationError is the validation error returned by 65 // RateLimitServiceConfig.Validate if the designated constraints aren't met. 66 type RateLimitServiceConfigValidationError struct { 67 field string 68 reason string 69 cause error 70 key bool 71 } 72 73 // Field function returns field value. 74 func (e RateLimitServiceConfigValidationError) Field() string { return e.field } 75 76 // Reason function returns reason value. 77 func (e RateLimitServiceConfigValidationError) Reason() string { return e.reason } 78 79 // Cause function returns cause value. 80 func (e RateLimitServiceConfigValidationError) Cause() error { return e.cause } 81 82 // Key function returns key value. 83 func (e RateLimitServiceConfigValidationError) Key() bool { return e.key } 84 85 // ErrorName returns error name. 86 func (e RateLimitServiceConfigValidationError) ErrorName() string { 87 return "RateLimitServiceConfigValidationError" 88 } 89 90 // Error satisfies the builtin error interface 91 func (e RateLimitServiceConfigValidationError) 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 %sRateLimitServiceConfig.%s: %s%s", 104 key, 105 e.field, 106 e.reason, 107 cause) 108 } 109 110 var _ error = RateLimitServiceConfigValidationError{} 111 112 var _ interface { 113 Field() string 114 Reason() string 115 Key() bool 116 Cause() error 117 ErrorName() string 118 } = RateLimitServiceConfigValidationError{}