Debian Codegraph @

envoy/service/redis_auth/v3/redis_external_auth.pb.validate.go

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