github.com/hxx258456/ccgo@v0.0.5-0.20230213014102-48b35f46f66f/go-control-plane/envoy/admin/v2alpha/memory.pb.validate.go (about) 1 // Code generated by protoc-gen-validate. DO NOT EDIT. 2 // source: envoy/admin/v2alpha/memory.proto 3 4 package envoy_admin_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 Memory with the rules defined in the 37 // proto definition for this message. If any rules are violated, an error is returned. 38 func (m *Memory) Validate() error { 39 if m == nil { 40 return nil 41 } 42 43 // no validation rules for Allocated 44 45 // no validation rules for HeapSize 46 47 // no validation rules for PageheapUnmapped 48 49 // no validation rules for PageheapFree 50 51 // no validation rules for TotalThreadCache 52 53 // no validation rules for TotalPhysicalBytes 54 55 return nil 56 } 57 58 // MemoryValidationError is the validation error returned by Memory.Validate if 59 // the designated constraints aren't met. 60 type MemoryValidationError struct { 61 field string 62 reason string 63 cause error 64 key bool 65 } 66 67 // Field function returns field value. 68 func (e MemoryValidationError) Field() string { return e.field } 69 70 // Reason function returns reason value. 71 func (e MemoryValidationError) Reason() string { return e.reason } 72 73 // Cause function returns cause value. 74 func (e MemoryValidationError) Cause() error { return e.cause } 75 76 // Key function returns key value. 77 func (e MemoryValidationError) Key() bool { return e.key } 78 79 // ErrorName returns error name. 80 func (e MemoryValidationError) ErrorName() string { return "MemoryValidationError" } 81 82 // Error satisfies the builtin error interface 83 func (e MemoryValidationError) Error() string { 84 cause := "" 85 if e.cause != nil { 86 cause = fmt.Sprintf(" | caused by: %v", e.cause) 87 } 88 89 key := "" 90 if e.key { 91 key = "key for " 92 } 93 94 return fmt.Sprintf( 95 "invalid %sMemory.%s: %s%s", 96 key, 97 e.field, 98 e.reason, 99 cause) 100 } 101 102 var _ error = MemoryValidationError{} 103 104 var _ interface { 105 Field() string 106 Reason() string 107 Key() bool 108 Cause() error 109 ErrorName() string 110 } = MemoryValidationError{}