gitee.com/ks-custle/core-gm@v0.0.0-20230922171213-b83bdd97b62c/go-control-plane/envoy/admin/v2alpha/clusters.pb.validate.go (about) 1 // Code generated by protoc-gen-validate. DO NOT EDIT. 2 // source: envoy/admin/v2alpha/clusters.proto 3 4 package envoy_admin_v2alpha 5 6 import ( 7 "bytes" 8 "errors" 9 "fmt" 10 "net" 11 "net/mail" 12 "net/url" 13 "regexp" 14 "strings" 15 "time" 16 "unicode/utf8" 17 18 "google.golang.org/protobuf/types/known/anypb" 19 20 core "gitee.com/ks-custle/core-gm/go-control-plane/envoy/api/v2/core" 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 37 _ = core.HealthStatus(0) 38 ) 39 40 // Validate checks the field values on Clusters with the rules defined in the 41 // proto definition for this message. If any rules are violated, an error is returned. 42 func (m *Clusters) Validate() error { 43 if m == nil { 44 return nil 45 } 46 47 for idx, item := range m.GetClusterStatuses() { 48 _, _ = idx, item 49 50 if v, ok := interface{}(item).(interface{ Validate() error }); ok { 51 if err := v.Validate(); err != nil { 52 return ClustersValidationError{ 53 field: fmt.Sprintf("ClusterStatuses[%v]", idx), 54 reason: "embedded message failed validation", 55 cause: err, 56 } 57 } 58 } 59 60 } 61 62 return nil 63 } 64 65 // ClustersValidationError is the validation error returned by 66 // Clusters.Validate if the designated constraints aren't met. 67 type ClustersValidationError struct { 68 field string 69 reason string 70 cause error 71 key bool 72 } 73 74 // Field function returns field value. 75 func (e ClustersValidationError) Field() string { return e.field } 76 77 // Reason function returns reason value. 78 func (e ClustersValidationError) Reason() string { return e.reason } 79 80 // Cause function returns cause value. 81 func (e ClustersValidationError) Cause() error { return e.cause } 82 83 // Key function returns key value. 84 func (e ClustersValidationError) Key() bool { return e.key } 85 86 // ErrorName returns error name. 87 func (e ClustersValidationError) ErrorName() string { return "ClustersValidationError" } 88 89 // Error satisfies the builtin error interface 90 func (e ClustersValidationError) Error() string { 91 cause := "" 92 if e.cause != nil { 93 cause = fmt.Sprintf(" | caused by: %v", e.cause) 94 } 95 96 key := "" 97 if e.key { 98 key = "key for " 99 } 100 101 return fmt.Sprintf( 102 "invalid %sClusters.%s: %s%s", 103 key, 104 e.field, 105 e.reason, 106 cause) 107 } 108 109 var _ error = ClustersValidationError{} 110 111 var _ interface { 112 Field() string 113 Reason() string 114 Key() bool 115 Cause() error 116 ErrorName() string 117 } = ClustersValidationError{} 118 119 // Validate checks the field values on ClusterStatus with the rules defined in 120 // the proto definition for this message. If any rules are violated, an error 121 // is returned. 122 func (m *ClusterStatus) Validate() error { 123 if m == nil { 124 return nil 125 } 126 127 // no validation rules for Name 128 129 // no validation rules for AddedViaApi 130 131 if v, ok := interface{}(m.GetSuccessRateEjectionThreshold()).(interface{ Validate() error }); ok { 132 if err := v.Validate(); err != nil { 133 return ClusterStatusValidationError{ 134 field: "SuccessRateEjectionThreshold", 135 reason: "embedded message failed validation", 136 cause: err, 137 } 138 } 139 } 140 141 for idx, item := range m.GetHostStatuses() { 142 _, _ = idx, item 143 144 if v, ok := interface{}(item).(interface{ Validate() error }); ok { 145 if err := v.Validate(); err != nil { 146 return ClusterStatusValidationError{ 147 field: fmt.Sprintf("HostStatuses[%v]", idx), 148 reason: "embedded message failed validation", 149 cause: err, 150 } 151 } 152 } 153 154 } 155 156 if v, ok := interface{}(m.GetLocalOriginSuccessRateEjectionThreshold()).(interface{ Validate() error }); ok { 157 if err := v.Validate(); err != nil { 158 return ClusterStatusValidationError{ 159 field: "LocalOriginSuccessRateEjectionThreshold", 160 reason: "embedded message failed validation", 161 cause: err, 162 } 163 } 164 } 165 166 return nil 167 } 168 169 // ClusterStatusValidationError is the validation error returned by 170 // ClusterStatus.Validate if the designated constraints aren't met. 171 type ClusterStatusValidationError struct { 172 field string 173 reason string 174 cause error 175 key bool 176 } 177 178 // Field function returns field value. 179 func (e ClusterStatusValidationError) Field() string { return e.field } 180 181 // Reason function returns reason value. 182 func (e ClusterStatusValidationError) Reason() string { return e.reason } 183 184 // Cause function returns cause value. 185 func (e ClusterStatusValidationError) Cause() error { return e.cause } 186 187 // Key function returns key value. 188 func (e ClusterStatusValidationError) Key() bool { return e.key } 189 190 // ErrorName returns error name. 191 func (e ClusterStatusValidationError) ErrorName() string { return "ClusterStatusValidationError" } 192 193 // Error satisfies the builtin error interface 194 func (e ClusterStatusValidationError) Error() string { 195 cause := "" 196 if e.cause != nil { 197 cause = fmt.Sprintf(" | caused by: %v", e.cause) 198 } 199 200 key := "" 201 if e.key { 202 key = "key for " 203 } 204 205 return fmt.Sprintf( 206 "invalid %sClusterStatus.%s: %s%s", 207 key, 208 e.field, 209 e.reason, 210 cause) 211 } 212 213 var _ error = ClusterStatusValidationError{} 214 215 var _ interface { 216 Field() string 217 Reason() string 218 Key() bool 219 Cause() error 220 ErrorName() string 221 } = ClusterStatusValidationError{} 222 223 // Validate checks the field values on HostStatus with the rules defined in the 224 // proto definition for this message. If any rules are violated, an error is returned. 225 func (m *HostStatus) Validate() error { 226 if m == nil { 227 return nil 228 } 229 230 if v, ok := interface{}(m.GetAddress()).(interface{ Validate() error }); ok { 231 if err := v.Validate(); err != nil { 232 return HostStatusValidationError{ 233 field: "Address", 234 reason: "embedded message failed validation", 235 cause: err, 236 } 237 } 238 } 239 240 for idx, item := range m.GetStats() { 241 _, _ = idx, item 242 243 if v, ok := interface{}(item).(interface{ Validate() error }); ok { 244 if err := v.Validate(); err != nil { 245 return HostStatusValidationError{ 246 field: fmt.Sprintf("Stats[%v]", idx), 247 reason: "embedded message failed validation", 248 cause: err, 249 } 250 } 251 } 252 253 } 254 255 if v, ok := interface{}(m.GetHealthStatus()).(interface{ Validate() error }); ok { 256 if err := v.Validate(); err != nil { 257 return HostStatusValidationError{ 258 field: "HealthStatus", 259 reason: "embedded message failed validation", 260 cause: err, 261 } 262 } 263 } 264 265 if v, ok := interface{}(m.GetSuccessRate()).(interface{ Validate() error }); ok { 266 if err := v.Validate(); err != nil { 267 return HostStatusValidationError{ 268 field: "SuccessRate", 269 reason: "embedded message failed validation", 270 cause: err, 271 } 272 } 273 } 274 275 // no validation rules for Weight 276 277 // no validation rules for Hostname 278 279 // no validation rules for Priority 280 281 if v, ok := interface{}(m.GetLocalOriginSuccessRate()).(interface{ Validate() error }); ok { 282 if err := v.Validate(); err != nil { 283 return HostStatusValidationError{ 284 field: "LocalOriginSuccessRate", 285 reason: "embedded message failed validation", 286 cause: err, 287 } 288 } 289 } 290 291 if v, ok := interface{}(m.GetLocality()).(interface{ Validate() error }); ok { 292 if err := v.Validate(); err != nil { 293 return HostStatusValidationError{ 294 field: "Locality", 295 reason: "embedded message failed validation", 296 cause: err, 297 } 298 } 299 } 300 301 return nil 302 } 303 304 // HostStatusValidationError is the validation error returned by 305 // HostStatus.Validate if the designated constraints aren't met. 306 type HostStatusValidationError struct { 307 field string 308 reason string 309 cause error 310 key bool 311 } 312 313 // Field function returns field value. 314 func (e HostStatusValidationError) Field() string { return e.field } 315 316 // Reason function returns reason value. 317 func (e HostStatusValidationError) Reason() string { return e.reason } 318 319 // Cause function returns cause value. 320 func (e HostStatusValidationError) Cause() error { return e.cause } 321 322 // Key function returns key value. 323 func (e HostStatusValidationError) Key() bool { return e.key } 324 325 // ErrorName returns error name. 326 func (e HostStatusValidationError) ErrorName() string { return "HostStatusValidationError" } 327 328 // Error satisfies the builtin error interface 329 func (e HostStatusValidationError) Error() string { 330 cause := "" 331 if e.cause != nil { 332 cause = fmt.Sprintf(" | caused by: %v", e.cause) 333 } 334 335 key := "" 336 if e.key { 337 key = "key for " 338 } 339 340 return fmt.Sprintf( 341 "invalid %sHostStatus.%s: %s%s", 342 key, 343 e.field, 344 e.reason, 345 cause) 346 } 347 348 var _ error = HostStatusValidationError{} 349 350 var _ interface { 351 Field() string 352 Reason() string 353 Key() bool 354 Cause() error 355 ErrorName() string 356 } = HostStatusValidationError{} 357 358 // Validate checks the field values on HostHealthStatus with the rules defined 359 // in the proto definition for this message. If any rules are violated, an 360 // error is returned. 361 func (m *HostHealthStatus) Validate() error { 362 if m == nil { 363 return nil 364 } 365 366 // no validation rules for FailedActiveHealthCheck 367 368 // no validation rules for FailedOutlierCheck 369 370 // no validation rules for FailedActiveDegradedCheck 371 372 // no validation rules for PendingDynamicRemoval 373 374 // no validation rules for PendingActiveHc 375 376 // no validation rules for EdsHealthStatus 377 378 return nil 379 } 380 381 // HostHealthStatusValidationError is the validation error returned by 382 // HostHealthStatus.Validate if the designated constraints aren't met. 383 type HostHealthStatusValidationError struct { 384 field string 385 reason string 386 cause error 387 key bool 388 } 389 390 // Field function returns field value. 391 func (e HostHealthStatusValidationError) Field() string { return e.field } 392 393 // Reason function returns reason value. 394 func (e HostHealthStatusValidationError) Reason() string { return e.reason } 395 396 // Cause function returns cause value. 397 func (e HostHealthStatusValidationError) Cause() error { return e.cause } 398 399 // Key function returns key value. 400 func (e HostHealthStatusValidationError) Key() bool { return e.key } 401 402 // ErrorName returns error name. 403 func (e HostHealthStatusValidationError) ErrorName() string { return "HostHealthStatusValidationError" } 404 405 // Error satisfies the builtin error interface 406 func (e HostHealthStatusValidationError) Error() string { 407 cause := "" 408 if e.cause != nil { 409 cause = fmt.Sprintf(" | caused by: %v", e.cause) 410 } 411 412 key := "" 413 if e.key { 414 key = "key for " 415 } 416 417 return fmt.Sprintf( 418 "invalid %sHostHealthStatus.%s: %s%s", 419 key, 420 e.field, 421 e.reason, 422 cause) 423 } 424 425 var _ error = HostHealthStatusValidationError{} 426 427 var _ interface { 428 Field() string 429 Reason() string 430 Key() bool 431 Cause() error 432 ErrorName() string 433 } = HostHealthStatusValidationError{}