Debian Codegraph @

envoy/extensions/access_loggers/open_telemetry/v3/logs_service.pb.validate.go

raw
1 //go:build !disable_pgv
2 // Code generated by protoc-gen-validate. DO NOT EDIT.
3 // source: envoy/extensions/access_loggers/open_telemetry/v3/logs_service.proto
4
5 package open_telemetryv3
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 OpenTelemetryAccessLogConfig with the
40 // rules defined in the proto definition for this message. If any rules are
41 // violated, the first error encountered is returned, or nil if there are no violations.
42 func (m *OpenTelemetryAccessLogConfig) Validate() error {
43 return m.validate(false)
44 }
45
46 // ValidateAll checks the field values on OpenTelemetryAccessLogConfig with the
47 // rules 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 // OpenTelemetryAccessLogConfigMultiError, or nil if none found.
50 func (m *OpenTelemetryAccessLogConfig) ValidateAll() error {
51 return m.validate(true)
52 }
53
54 func (m *OpenTelemetryAccessLogConfig) validate(all bool) error {
55 if m == nil {
56 return nil
57 }
58
59 var errors []error
60
61 if m.GetCommonConfig() == nil {
62 err := OpenTelemetryAccessLogConfigValidationError{
63 field: "CommonConfig",
64 reason: "value is required",
65 }
66 if !all {
67 return err
68 }
69 errors = append(errors, err)
70 }
71
72 if all {
73 switch v := interface{}(m.GetCommonConfig()).(type) {
74 case interface{ ValidateAll() error }:
75 if err := v.ValidateAll(); err != nil {
76 errors = append(errors, OpenTelemetryAccessLogConfigValidationError{
77 field: "CommonConfig",
78 reason: "embedded message failed validation",
79 cause: err,
80 })
81 }
82 case interface{ Validate() error }:
83 if err := v.Validate(); err != nil {
84 errors = append(errors, OpenTelemetryAccessLogConfigValidationError{
85 field: "CommonConfig",
86 reason: "embedded message failed validation",
87 cause: err,
88 })
89 }
90 }
91 } else if v, ok := interface{}(m.GetCommonConfig()).(interface{ Validate() error }); ok {
92 if err := v.Validate(); err != nil {
93 return OpenTelemetryAccessLogConfigValidationError{
94 field: "CommonConfig",
95 reason: "embedded message failed validation",
96 cause: err,
97 }
98 }
99 }
100
101 // no validation rules for DisableBuiltinLabels
102
103 if all {
104 switch v := interface{}(m.GetResourceAttributes()).(type) {
105 case interface{ ValidateAll() error }:
106 if err := v.ValidateAll(); err != nil {
107 errors = append(errors, OpenTelemetryAccessLogConfigValidationError{
108 field: "ResourceAttributes",
109 reason: "embedded message failed validation",
110 cause: err,
111 })
112 }
113 case interface{ Validate() error }:
114 if err := v.Validate(); err != nil {
115 errors = append(errors, OpenTelemetryAccessLogConfigValidationError{
116 field: "ResourceAttributes",
117 reason: "embedded message failed validation",
118 cause: err,
119 })
120 }
121 }
122 } else if v, ok := interface{}(m.GetResourceAttributes()).(interface{ Validate() error }); ok {
123 if err := v.Validate(); err != nil {
124 return OpenTelemetryAccessLogConfigValidationError{
125 field: "ResourceAttributes",
126 reason: "embedded message failed validation",
127 cause: err,
128 }
129 }
130 }
131
132 if all {
133 switch v := interface{}(m.GetBody()).(type) {
134 case interface{ ValidateAll() error }:
135 if err := v.ValidateAll(); err != nil {
136 errors = append(errors, OpenTelemetryAccessLogConfigValidationError{
137 field: "Body",
138 reason: "embedded message failed validation",
139 cause: err,
140 })
141 }
142 case interface{ Validate() error }:
143 if err := v.Validate(); err != nil {
144 errors = append(errors, OpenTelemetryAccessLogConfigValidationError{
145 field: "Body",
146 reason: "embedded message failed validation",
147 cause: err,
148 })
149 }
150 }
151 } else if v, ok := interface{}(m.GetBody()).(interface{ Validate() error }); ok {
152 if err := v.Validate(); err != nil {
153 return OpenTelemetryAccessLogConfigValidationError{
154 field: "Body",
155 reason: "embedded message failed validation",
156 cause: err,
157 }
158 }
159 }
160
161 if all {
162 switch v := interface{}(m.GetAttributes()).(type) {
163 case interface{ ValidateAll() error }:
164 if err := v.ValidateAll(); err != nil {
165 errors = append(errors, OpenTelemetryAccessLogConfigValidationError{
166 field: "Attributes",
167 reason: "embedded message failed validation",
168 cause: err,
169 })
170 }
171 case interface{ Validate() error }:
172 if err := v.Validate(); err != nil {
173 errors = append(errors, OpenTelemetryAccessLogConfigValidationError{
174 field: "Attributes",
175 reason: "embedded message failed validation",
176 cause: err,
177 })
178 }
179 }
180 } else if v, ok := interface{}(m.GetAttributes()).(interface{ Validate() error }); ok {
181 if err := v.Validate(); err != nil {
182 return OpenTelemetryAccessLogConfigValidationError{
183 field: "Attributes",
184 reason: "embedded message failed validation",
185 cause: err,
186 }
187 }
188 }
189
190 // no validation rules for StatPrefix
191
192 for idx, item := range m.GetFormatters() {
193 _, _ = idx, item
194
195 if all {
196 switch v := interface{}(item).(type) {
197 case interface{ ValidateAll() error }:
198 if err := v.ValidateAll(); err != nil {
199 errors = append(errors, OpenTelemetryAccessLogConfigValidationError{
200 field: fmt.Sprintf("Formatters[%v]", idx),
201 reason: "embedded message failed validation",
202 cause: err,
203 })
204 }
205 case interface{ Validate() error }:
206 if err := v.Validate(); err != nil {
207 errors = append(errors, OpenTelemetryAccessLogConfigValidationError{
208 field: fmt.Sprintf("Formatters[%v]", idx),
209 reason: "embedded message failed validation",
210 cause: err,
211 })
212 }
213 }
214 } else if v, ok := interface{}(item).(interface{ Validate() error }); ok {
215 if err := v.Validate(); err != nil {
216 return OpenTelemetryAccessLogConfigValidationError{
217 field: fmt.Sprintf("Formatters[%v]", idx),
218 reason: "embedded message failed validation",
219 cause: err,
220 }
221 }
222 }
223
224 }
225
226 if len(errors) > 0 {
227 return OpenTelemetryAccessLogConfigMultiError(errors)
228 }
229
230 return nil
231 }
232
233 // OpenTelemetryAccessLogConfigMultiError is an error wrapping multiple
234 // validation errors returned by OpenTelemetryAccessLogConfig.ValidateAll() if
235 // the designated constraints aren't met.
236 type OpenTelemetryAccessLogConfigMultiError []error
237
238 // Error returns a concatenation of all the error messages it wraps.
239 func (m OpenTelemetryAccessLogConfigMultiError) Error() string {
240 var msgs []string
241 for _, err := range m {
242 msgs = append(msgs, err.Error())
243 }
244 return strings.Join(msgs, "; ")
245 }
246
247 // AllErrors returns a list of validation violation errors.
248 func (m OpenTelemetryAccessLogConfigMultiError) AllErrors() []error { return m }
249
250 // OpenTelemetryAccessLogConfigValidationError is the validation error returned
251 // by OpenTelemetryAccessLogConfig.Validate if the designated constraints
252 // aren't met.
253 type OpenTelemetryAccessLogConfigValidationError struct {
254 field string
255 reason string
256 cause error
257 key bool
258 }
259
260 // Field function returns field value.
261 func (e OpenTelemetryAccessLogConfigValidationError) Field() string { return e.field }
262
263 // Reason function returns reason value.
264 func (e OpenTelemetryAccessLogConfigValidationError) Reason() string { return e.reason }
265
266 // Cause function returns cause value.
267 func (e OpenTelemetryAccessLogConfigValidationError) Cause() error { return e.cause }
268
269 // Key function returns key value.
270 func (e OpenTelemetryAccessLogConfigValidationError) Key() bool { return e.key }
271
272 // ErrorName returns error name.
273 func (e OpenTelemetryAccessLogConfigValidationError) ErrorName() string {
274 return "OpenTelemetryAccessLogConfigValidationError"
275 }
276
277 // Error satisfies the builtin error interface
278 func (e OpenTelemetryAccessLogConfigValidationError) Error() string {
279 cause := ""
280 if e.cause != nil {
281 cause = fmt.Sprintf(" | caused by: %v", e.cause)
282 }
283
284 key := ""
285 if e.key {
286 key = "key for "
287 }
288
289 return fmt.Sprintf(
290 "invalid %sOpenTelemetryAccessLogConfig.%s: %s%s",
291 key,
292 e.field,
293 e.reason,
294 cause)
295 }
296
297 var _ error = OpenTelemetryAccessLogConfigValidationError{}
298
299 var _ interface {
300 Field() string
301 Reason() string
302 Key() bool
303 Cause() error
304 ErrorName() string
305 } = OpenTelemetryAccessLogConfigValidationError{}