Passed
Push — master ( 197452...9d95d2 )
by
unknown
03:10 queued 15s
created

basev1.HealthCheckRequestValidationError.Error   A

Complexity

Conditions 3

Size

Total Lines 17
Code Lines 13

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 3
eloc 13
nop 0
dl 0
loc 17
rs 9.75
c 0
b 0
f 0
1
// Code generated by protoc-gen-validate. DO NOT EDIT.
2
// source: base/v1/health.proto
3
4
package basev1
5
6
import (
7
	"bytes"
8
	"errors"
9
	"fmt"
10
	"net"
11
	"net/mail"
12
	"net/url"
13
	"regexp"
14
	"sort"
15
	"strings"
16
	"time"
17
	"unicode/utf8"
18
19
	"google.golang.org/protobuf/types/known/anypb"
20
)
21
22
// ensure the imports are used
23
var (
24
	_ = bytes.MinRead
25
	_ = errors.New("")
26
	_ = fmt.Print
27
	_ = utf8.UTFMax
28
	_ = (*regexp.Regexp)(nil)
29
	_ = (*strings.Reader)(nil)
30
	_ = net.IPv4len
31
	_ = time.Duration(0)
32
	_ = (*url.URL)(nil)
33
	_ = (*mail.Address)(nil)
34
	_ = anypb.Any{}
35
	_ = sort.Sort
36
)
37
38
// Validate checks the field values on HealthCheckRequest with the rules
39
// defined in the proto definition for this message. If any rules are
40
// violated, the first error encountered is returned, or nil if there are no violations.
41
func (m *HealthCheckRequest) Validate() error {
42
	return m.validate(false)
43
}
44
45
// ValidateAll checks the field values on HealthCheckRequest with the rules
46
// defined in the proto definition for this message. If any rules are
47
// violated, the result is a list of violation errors wrapped in
48
// HealthCheckRequestMultiError, or nil if none found.
49
func (m *HealthCheckRequest) ValidateAll() error {
50
	return m.validate(true)
51
}
52
53
func (m *HealthCheckRequest) validate(all bool) error {
54
	if m == nil {
55
		return nil
56
	}
57
58
	var errors []error
59
60
	// no validation rules for Service
61
62
	if len(errors) > 0 {
63
		return HealthCheckRequestMultiError(errors)
64
	}
65
66
	return nil
67
}
68
69
// HealthCheckRequestMultiError is an error wrapping multiple validation errors
70
// returned by HealthCheckRequest.ValidateAll() if the designated constraints
71
// aren't met.
72
type HealthCheckRequestMultiError []error
73
74
// Error returns a concatenation of all the error messages it wraps.
75
func (m HealthCheckRequestMultiError) Error() string {
76
	var msgs []string
77
	for _, err := range m {
78
		msgs = append(msgs, err.Error())
79
	}
80
	return strings.Join(msgs, "; ")
81
}
82
83
// AllErrors returns a list of validation violation errors.
84
func (m HealthCheckRequestMultiError) AllErrors() []error { return m }
85
86
// HealthCheckRequestValidationError is the validation error returned by
87
// HealthCheckRequest.Validate if the designated constraints aren't met.
88
type HealthCheckRequestValidationError struct {
89
	field  string
90
	reason string
91
	cause  error
92
	key    bool
93
}
94
95
// Field function returns field value.
96
func (e HealthCheckRequestValidationError) Field() string { return e.field }
97
98
// Reason function returns reason value.
99
func (e HealthCheckRequestValidationError) Reason() string { return e.reason }
100
101
// Cause function returns cause value.
102
func (e HealthCheckRequestValidationError) Cause() error { return e.cause }
103
104
// Key function returns key value.
105
func (e HealthCheckRequestValidationError) Key() bool { return e.key }
106
107
// ErrorName returns error name.
108
func (e HealthCheckRequestValidationError) ErrorName() string {
109
	return "HealthCheckRequestValidationError"
110
}
111
112
// Error satisfies the builtin error interface
113
func (e HealthCheckRequestValidationError) Error() string {
114
	cause := ""
115
	if e.cause != nil {
116
		cause = fmt.Sprintf(" | caused by: %v", e.cause)
117
	}
118
119
	key := ""
120
	if e.key {
121
		key = "key for "
122
	}
123
124
	return fmt.Sprintf(
125
		"invalid %sHealthCheckRequest.%s: %s%s",
126
		key,
127
		e.field,
128
		e.reason,
129
		cause)
130
}
131
132
var _ error = HealthCheckRequestValidationError{}
133
134
var _ interface {
135
	Field() string
136
	Reason() string
137
	Key() bool
138
	Cause() error
139
	ErrorName() string
140
} = HealthCheckRequestValidationError{}
141
142
// Validate checks the field values on HealthCheckResponse with the rules
143
// defined in the proto definition for this message. If any rules are
144
// violated, the first error encountered is returned, or nil if there are no violations.
145
func (m *HealthCheckResponse) Validate() error {
146
	return m.validate(false)
147
}
148
149
// ValidateAll checks the field values on HealthCheckResponse with the rules
150
// defined in the proto definition for this message. If any rules are
151
// violated, the result is a list of violation errors wrapped in
152
// HealthCheckResponseMultiError, or nil if none found.
153
func (m *HealthCheckResponse) ValidateAll() error {
154
	return m.validate(true)
155
}
156
157
func (m *HealthCheckResponse) validate(all bool) error {
158
	if m == nil {
159
		return nil
160
	}
161
162
	var errors []error
163
164
	// no validation rules for Status
165
166
	if len(errors) > 0 {
167
		return HealthCheckResponseMultiError(errors)
168
	}
169
170
	return nil
171
}
172
173
// HealthCheckResponseMultiError is an error wrapping multiple validation
174
// errors returned by HealthCheckResponse.ValidateAll() if the designated
175
// constraints aren't met.
176
type HealthCheckResponseMultiError []error
177
178
// Error returns a concatenation of all the error messages it wraps.
179
func (m HealthCheckResponseMultiError) Error() string {
180
	var msgs []string
181
	for _, err := range m {
182
		msgs = append(msgs, err.Error())
183
	}
184
	return strings.Join(msgs, "; ")
185
}
186
187
// AllErrors returns a list of validation violation errors.
188
func (m HealthCheckResponseMultiError) AllErrors() []error { return m }
189
190
// HealthCheckResponseValidationError is the validation error returned by
191
// HealthCheckResponse.Validate if the designated constraints aren't met.
192
type HealthCheckResponseValidationError struct {
193
	field  string
194
	reason string
195
	cause  error
196
	key    bool
197
}
198
199
// Field function returns field value.
200
func (e HealthCheckResponseValidationError) Field() string { return e.field }
201
202
// Reason function returns reason value.
203
func (e HealthCheckResponseValidationError) Reason() string { return e.reason }
204
205
// Cause function returns cause value.
206
func (e HealthCheckResponseValidationError) Cause() error { return e.cause }
207
208
// Key function returns key value.
209
func (e HealthCheckResponseValidationError) Key() bool { return e.key }
210
211
// ErrorName returns error name.
212
func (e HealthCheckResponseValidationError) ErrorName() string {
213
	return "HealthCheckResponseValidationError"
214
}
215
216
// Error satisfies the builtin error interface
217
func (e HealthCheckResponseValidationError) Error() string {
218
	cause := ""
219
	if e.cause != nil {
220
		cause = fmt.Sprintf(" | caused by: %v", e.cause)
221
	}
222
223
	key := ""
224
	if e.key {
225
		key = "key for "
226
	}
227
228
	return fmt.Sprintf(
229
		"invalid %sHealthCheckResponse.%s: %s%s",
230
		key,
231
		e.field,
232
		e.reason,
233
		cause)
234
}
235
236
var _ error = HealthCheckResponseValidationError{}
237
238
var _ interface {
239
	Field() string
240
	Reason() string
241
	Key() bool
242
	Cause() error
243
	ErrorName() string
244
} = HealthCheckResponseValidationError{}
245
246
// Validate checks the field values on HealthRequest with the rules defined in
247
// the proto definition for this message. If any rules are violated, the first
248
// error encountered is returned, or nil if there are no violations.
249
func (m *HealthRequest) Validate() error {
250
	return m.validate(false)
251
}
252
253
// ValidateAll checks the field values on HealthRequest with the rules defined
254
// in the proto definition for this message. If any rules are violated, the
255
// result is a list of violation errors wrapped in HealthRequestMultiError, or
256
// nil if none found.
257
func (m *HealthRequest) ValidateAll() error {
258
	return m.validate(true)
259
}
260
261
func (m *HealthRequest) validate(all bool) error {
262
	if m == nil {
263
		return nil
264
	}
265
266
	var errors []error
267
268
	if len(errors) > 0 {
269
		return HealthRequestMultiError(errors)
270
	}
271
272
	return nil
273
}
274
275
// HealthRequestMultiError is an error wrapping multiple validation errors
276
// returned by HealthRequest.ValidateAll() if the designated constraints
277
// aren't met.
278
type HealthRequestMultiError []error
279
280
// Error returns a concatenation of all the error messages it wraps.
281
func (m HealthRequestMultiError) Error() string {
282
	var msgs []string
283
	for _, err := range m {
284
		msgs = append(msgs, err.Error())
285
	}
286
	return strings.Join(msgs, "; ")
287
}
288
289
// AllErrors returns a list of validation violation errors.
290
func (m HealthRequestMultiError) AllErrors() []error { return m }
291
292
// HealthRequestValidationError is the validation error returned by
293
// HealthRequest.Validate if the designated constraints aren't met.
294
type HealthRequestValidationError struct {
295
	field  string
296
	reason string
297
	cause  error
298
	key    bool
299
}
300
301
// Field function returns field value.
302
func (e HealthRequestValidationError) Field() string { return e.field }
303
304
// Reason function returns reason value.
305
func (e HealthRequestValidationError) Reason() string { return e.reason }
306
307
// Cause function returns cause value.
308
func (e HealthRequestValidationError) Cause() error { return e.cause }
309
310
// Key function returns key value.
311
func (e HealthRequestValidationError) Key() bool { return e.key }
312
313
// ErrorName returns error name.
314
func (e HealthRequestValidationError) ErrorName() string { return "HealthRequestValidationError" }
315
316
// Error satisfies the builtin error interface
317
func (e HealthRequestValidationError) Error() string {
318
	cause := ""
319
	if e.cause != nil {
320
		cause = fmt.Sprintf(" | caused by: %v", e.cause)
321
	}
322
323
	key := ""
324
	if e.key {
325
		key = "key for "
326
	}
327
328
	return fmt.Sprintf(
329
		"invalid %sHealthRequest.%s: %s%s",
330
		key,
331
		e.field,
332
		e.reason,
333
		cause)
334
}
335
336
var _ error = HealthRequestValidationError{}
337
338
var _ interface {
339
	Field() string
340
	Reason() string
341
	Key() bool
342
	Cause() error
343
	ErrorName() string
344
} = HealthRequestValidationError{}
345
346
// Validate checks the field values on HealthResponse with the rules defined in
347
// the proto definition for this message. If any rules are violated, the first
348
// error encountered is returned, or nil if there are no violations.
349
func (m *HealthResponse) Validate() error {
350
	return m.validate(false)
351
}
352
353
// ValidateAll checks the field values on HealthResponse with the rules defined
354
// in the proto definition for this message. If any rules are violated, the
355
// result is a list of violation errors wrapped in HealthResponseMultiError,
356
// or nil if none found.
357
func (m *HealthResponse) ValidateAll() error {
358
	return m.validate(true)
359
}
360
361
func (m *HealthResponse) validate(all bool) error {
362
	if m == nil {
363
		return nil
364
	}
365
366
	var errors []error
367
368
	// no validation rules for Status
369
370
	if len(errors) > 0 {
371
		return HealthResponseMultiError(errors)
372
	}
373
374
	return nil
375
}
376
377
// HealthResponseMultiError is an error wrapping multiple validation errors
378
// returned by HealthResponse.ValidateAll() if the designated constraints
379
// aren't met.
380
type HealthResponseMultiError []error
381
382
// Error returns a concatenation of all the error messages it wraps.
383
func (m HealthResponseMultiError) Error() string {
384
	var msgs []string
385
	for _, err := range m {
386
		msgs = append(msgs, err.Error())
387
	}
388
	return strings.Join(msgs, "; ")
389
}
390
391
// AllErrors returns a list of validation violation errors.
392
func (m HealthResponseMultiError) AllErrors() []error { return m }
393
394
// HealthResponseValidationError is the validation error returned by
395
// HealthResponse.Validate if the designated constraints aren't met.
396
type HealthResponseValidationError struct {
397
	field  string
398
	reason string
399
	cause  error
400
	key    bool
401
}
402
403
// Field function returns field value.
404
func (e HealthResponseValidationError) Field() string { return e.field }
405
406
// Reason function returns reason value.
407
func (e HealthResponseValidationError) Reason() string { return e.reason }
408
409
// Cause function returns cause value.
410
func (e HealthResponseValidationError) Cause() error { return e.cause }
411
412
// Key function returns key value.
413
func (e HealthResponseValidationError) Key() bool { return e.key }
414
415
// ErrorName returns error name.
416
func (e HealthResponseValidationError) ErrorName() string { return "HealthResponseValidationError" }
417
418
// Error satisfies the builtin error interface
419
func (e HealthResponseValidationError) Error() string {
420
	cause := ""
421
	if e.cause != nil {
422
		cause = fmt.Sprintf(" | caused by: %v", e.cause)
423
	}
424
425
	key := ""
426
	if e.key {
427
		key = "key for "
428
	}
429
430
	return fmt.Sprintf(
431
		"invalid %sHealthResponse.%s: %s%s",
432
		key,
433
		e.field,
434
		e.reason,
435
		cause)
436
}
437
438
var _ error = HealthResponseValidationError{}
439
440
var _ interface {
441
	Field() string
442
	Reason() string
443
	Key() bool
444
	Cause() error
445
	ErrorName() string
446
} = HealthResponseValidationError{}
447