Debian Codegraph @

envoy/config/resource_monitor/fixed_heap/v2alpha/fixed_heap.pb.validate.go

raw
1 //go:build !disable_pgv
2 // Code generated by protoc-gen-validate. DO NOT EDIT.
3 // source: envoy/config/resource_monitor/fixed_heap/v2alpha/fixed_heap.proto
4
5 package v2alpha
6
7 import (
8 "bytes"
9 "errors"
10 "fmt"
11 "net"
12 "net/mail"
13 "net/url"
14 "regexp"
15 "sort"
16 "strings"
17 "time"
18 "unicode/utf8"
19
20 "google.golang.org/protobuf/types/known/anypb"
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 _ = sort.Sort
37 )
38
39 // Validate checks the field values on FixedHeapConfig with the rules defined
40 // in the proto definition for this message. If any rules are violated, the
41 // first error encountered is returned, or nil if there are no violations.
42 func (m *FixedHeapConfig) Validate() error {
43 return m.validate(false)
44 }
45
46 // ValidateAll checks the field values on FixedHeapConfig with the rules
47 // defined in the proto definition for this message. If any rules are
48 // violated, the result is a list of violation errors wrapped in
49 // FixedHeapConfigMultiError, or nil if none found.
50 func (m *FixedHeapConfig) ValidateAll() error {
51 return m.validate(true)
52 }
53
54 func (m *FixedHeapConfig) validate(all bool) error {
55 if m == nil {
56 return nil
57 }
58
59 var errors []error
60
61 if m.GetMaxHeapSizeBytes() <= 0 {
62 err := FixedHeapConfigValidationError{
63 field: "MaxHeapSizeBytes",
64 reason: "value must be greater than 0",
65 }
66 if !all {
67 return err
68 }
69 errors = append(errors, err)
70 }
71
72 if len(errors) > 0 {
73 return FixedHeapConfigMultiError(errors)
74 }
75
76 return nil
77 }
78
79 // FixedHeapConfigMultiError is an error wrapping multiple validation errors
80 // returned by FixedHeapConfig.ValidateAll() if the designated constraints
81 // aren't met.
82 type FixedHeapConfigMultiError []error
83
84 // Error returns a concatenation of all the error messages it wraps.
85 func (m FixedHeapConfigMultiError) Error() string {
86 var msgs []string
87 for _, err := range m {
88 msgs = append(msgs, err.Error())
89 }
90 return strings.Join(msgs, "; ")
91 }
92
93 // AllErrors returns a list of validation violation errors.
94 func (m FixedHeapConfigMultiError) AllErrors() []error { return m }
95
96 // FixedHeapConfigValidationError is the validation error returned by
97 // FixedHeapConfig.Validate if the designated constraints aren't met.
98 type FixedHeapConfigValidationError struct {
99 field string
100 reason string
101 cause error
102 key bool
103 }
104
105 // Field function returns field value.
106 func (e FixedHeapConfigValidationError) Field() string { return e.field }
107
108 // Reason function returns reason value.
109 func (e FixedHeapConfigValidationError) Reason() string { return e.reason }
110
111 // Cause function returns cause value.
112 func (e FixedHeapConfigValidationError) Cause() error { return e.cause }
113
114 // Key function returns key value.
115 func (e FixedHeapConfigValidationError) Key() bool { return e.key }
116
117 // ErrorName returns error name.
118 func (e FixedHeapConfigValidationError) ErrorName() string { return "FixedHeapConfigValidationError" }
119
120 // Error satisfies the builtin error interface
121 func (e FixedHeapConfigValidationError) Error() string {
122 cause := ""
123 if e.cause != nil {
124 cause = fmt.Sprintf(" | caused by: %v", e.cause)
125 }
126
127 key := ""
128 if e.key {
129 key = "key for "
130 }
131
132 return fmt.Sprintf(
133 "invalid %sFixedHeapConfig.%s: %s%s",
134 key,
135 e.field,
136 e.reason,
137 cause)
138 }
139
140 var _ error = FixedHeapConfigValidationError{}
141
142 var _ interface {
143 Field() string
144 Reason() string
145 Key() bool
146 Cause() error
147 ErrorName() string
148 } = FixedHeapConfigValidationError{}