github.com/hxx258456/ccgo@v0.0.5-0.20230213014102-48b35f46f66f/go-control-plane/envoy/config/resource_monitor/injected_resource/v2alpha/injected_resource.pb.validate.go (about) 1 // Code generated by protoc-gen-validate. DO NOT EDIT. 2 // source: envoy/config/resource_monitor/injected_resource/v2alpha/injected_resource.proto 3 4 package envoy_config_resource_monitor_injected_resource_v2alpha 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 InjectedResourceConfig 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 *InjectedResourceConfig) Validate() error { 40 if m == nil { 41 return nil 42 } 43 44 if len(m.GetFilename()) < 1 { 45 return InjectedResourceConfigValidationError{ 46 field: "Filename", 47 reason: "value length must be at least 1 bytes", 48 } 49 } 50 51 return nil 52 } 53 54 // InjectedResourceConfigValidationError is the validation error returned by 55 // InjectedResourceConfig.Validate if the designated constraints aren't met. 56 type InjectedResourceConfigValidationError struct { 57 field string 58 reason string 59 cause error 60 key bool 61 } 62 63 // Field function returns field value. 64 func (e InjectedResourceConfigValidationError) Field() string { return e.field } 65 66 // Reason function returns reason value. 67 func (e InjectedResourceConfigValidationError) Reason() string { return e.reason } 68 69 // Cause function returns cause value. 70 func (e InjectedResourceConfigValidationError) Cause() error { return e.cause } 71 72 // Key function returns key value. 73 func (e InjectedResourceConfigValidationError) Key() bool { return e.key } 74 75 // ErrorName returns error name. 76 func (e InjectedResourceConfigValidationError) ErrorName() string { 77 return "InjectedResourceConfigValidationError" 78 } 79 80 // Error satisfies the builtin error interface 81 func (e InjectedResourceConfigValidationError) Error() string { 82 cause := "" 83 if e.cause != nil { 84 cause = fmt.Sprintf(" | caused by: %v", e.cause) 85 } 86 87 key := "" 88 if e.key { 89 key = "key for " 90 } 91 92 return fmt.Sprintf( 93 "invalid %sInjectedResourceConfig.%s: %s%s", 94 key, 95 e.field, 96 e.reason, 97 cause) 98 } 99 100 var _ error = InjectedResourceConfigValidationError{} 101 102 var _ interface { 103 Field() string 104 Reason() string 105 Key() bool 106 Cause() error 107 ErrorName() string 108 } = InjectedResourceConfigValidationError{}