Passed
Pull Request — master (#1691)
by
unknown
03:16
created

basev1.HealthCheckResponseValidationError.Cause   A

Complexity

Conditions 1

Size

Total Lines 1
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nop 0
dl 0
loc 1
rs 10
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