github.com/hxx258456/ccgo@v0.0.5-0.20230213014102-48b35f46f66f/go-control-plane/envoy/admin/v3/clusters.pb.validate.go (about) 1 // Code generated by protoc-gen-validate. DO NOT EDIT. 2 // source: envoy/admin/v3/clusters.proto 3 4 package envoy_admin_v3 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 v3 "github.com/hxx258456/ccgo/go-control-plane/envoy/config/core/v3" 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 _ = v3.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 if v, ok := interface{}(m.GetCircuitBreakers()).(interface{ Validate() error }); ok { 167 if err := v.Validate(); err != nil { 168 return ClusterStatusValidationError{ 169 field: "CircuitBreakers", 170 reason: "embedded message failed validation", 171 cause: err, 172 } 173 } 174 } 175 176 // no validation rules for ObservabilityName 177 178 return nil 179 } 180 181 // ClusterStatusValidationError is the validation error returned by 182 // ClusterStatus.Validate if the designated constraints aren't met. 183 type ClusterStatusValidationError struct { 184 field string 185 reason string 186 cause error 187 key bool 188 } 189 190 // Field function returns field value. 191 func (e ClusterStatusValidationError) Field() string { return e.field } 192 193 // Reason function returns reason value. 194 func (e ClusterStatusValidationError) Reason() string { return e.reason } 195 196 // Cause function returns cause value. 197 func (e ClusterStatusValidationError) Cause() error { return e.cause } 198 199 // Key function returns key value. 200 func (e ClusterStatusValidationError) Key() bool { return e.key } 201 202 // ErrorName returns error name. 203 func (e ClusterStatusValidationError) ErrorName() string { return "ClusterStatusValidationError" } 204 205 // Error satisfies the builtin error interface 206 func (e ClusterStatusValidationError) Error() string { 207 cause := "" 208 if e.cause != nil { 209 cause = fmt.Sprintf(" | caused by: %v", e.cause) 210 } 211 212 key := "" 213 if e.key { 214 key = "key for " 215 } 216 217 return fmt.Sprintf( 218 "invalid %sClusterStatus.%s: %s%s", 219 key, 220 e.field, 221 e.reason, 222 cause) 223 } 224 225 var _ error = ClusterStatusValidationError{} 226 227 var _ interface { 228 Field() string 229 Reason() string 230 Key() bool 231 Cause() error 232 ErrorName() string 233 } = ClusterStatusValidationError{} 234 235 // Validate checks the field values on HostStatus with the rules defined in the 236 // proto definition for this message. If any rules are violated, an error is returned. 237 func (m *HostStatus) Validate() error { 238 if m == nil { 239 return nil 240 } 241 242 if v, ok := interface{}(m.GetAddress()).(interface{ Validate() error }); ok { 243 if err := v.Validate(); err != nil { 244 return HostStatusValidationError{ 245 field: "Address", 246 reason: "embedded message failed validation", 247 cause: err, 248 } 249 } 250 } 251 252 for idx, item := range m.GetStats() { 253 _, _ = idx, item 254 255 if v, ok := interface{}(item).(interface{ Validate() error }); ok { 256 if err := v.Validate(); err != nil { 257 return HostStatusValidationError{ 258 field: fmt.Sprintf("Stats[%v]", idx), 259 reason: "embedded message failed validation", 260 cause: err, 261 } 262 } 263 } 264 265 } 266 267 if v, ok := interface{}(m.GetHealthStatus()).(interface{ Validate() error }); ok { 268 if err := v.Validate(); err != nil { 269 return HostStatusValidationError{ 270 field: "HealthStatus", 271 reason: "embedded message failed validation", 272 cause: err, 273 } 274 } 275 } 276 277 if v, ok := interface{}(m.GetSuccessRate()).(interface{ Validate() error }); ok { 278 if err := v.Validate(); err != nil { 279 return HostStatusValidationError{ 280 field: "SuccessRate", 281 reason: "embedded message failed validation", 282 cause: err, 283 } 284 } 285 } 286 287 // no validation rules for Weight 288 289 // no validation rules for Hostname 290 291 // no validation rules for Priority 292 293 if v, ok := interface{}(m.GetLocalOriginSuccessRate()).(interface{ Validate() error }); ok { 294 if err := v.Validate(); err != nil { 295 return HostStatusValidationError{ 296 field: "LocalOriginSuccessRate", 297 reason: "embedded message failed validation", 298 cause: err, 299 } 300 } 301 } 302 303 if v, ok := interface{}(m.GetLocality()).(interface{ Validate() error }); ok { 304 if err := v.Validate(); err != nil { 305 return HostStatusValidationError{ 306 field: "Locality", 307 reason: "embedded message failed validation", 308 cause: err, 309 } 310 } 311 } 312 313 return nil 314 } 315 316 // HostStatusValidationError is the validation error returned by 317 // HostStatus.Validate if the designated constraints aren't met. 318 type HostStatusValidationError struct { 319 field string 320 reason string 321 cause error 322 key bool 323 } 324 325 // Field function returns field value. 326 func (e HostStatusValidationError) Field() string { return e.field } 327 328 // Reason function returns reason value. 329 func (e HostStatusValidationError) Reason() string { return e.reason } 330 331 // Cause function returns cause value. 332 func (e HostStatusValidationError) Cause() error { return e.cause } 333 334 // Key function returns key value. 335 func (e HostStatusValidationError) Key() bool { return e.key } 336 337 // ErrorName returns error name. 338 func (e HostStatusValidationError) ErrorName() string { return "HostStatusValidationError" } 339 340 // Error satisfies the builtin error interface 341 func (e HostStatusValidationError) Error() string { 342 cause := "" 343 if e.cause != nil { 344 cause = fmt.Sprintf(" | caused by: %v", e.cause) 345 } 346 347 key := "" 348 if e.key { 349 key = "key for " 350 } 351 352 return fmt.Sprintf( 353 "invalid %sHostStatus.%s: %s%s", 354 key, 355 e.field, 356 e.reason, 357 cause) 358 } 359 360 var _ error = HostStatusValidationError{} 361 362 var _ interface { 363 Field() string 364 Reason() string 365 Key() bool 366 Cause() error 367 ErrorName() string 368 } = HostStatusValidationError{} 369 370 // Validate checks the field values on HostHealthStatus with the rules defined 371 // in the proto definition for this message. If any rules are violated, an 372 // error is returned. 373 func (m *HostHealthStatus) Validate() error { 374 if m == nil { 375 return nil 376 } 377 378 // no validation rules for FailedActiveHealthCheck 379 380 // no validation rules for FailedOutlierCheck 381 382 // no validation rules for FailedActiveDegradedCheck 383 384 // no validation rules for PendingDynamicRemoval 385 386 // no validation rules for PendingActiveHc 387 388 // no validation rules for ExcludedViaImmediateHcFail 389 390 // no validation rules for ActiveHcTimeout 391 392 // no validation rules for EdsHealthStatus 393 394 return nil 395 } 396 397 // HostHealthStatusValidationError is the validation error returned by 398 // HostHealthStatus.Validate if the designated constraints aren't met. 399 type HostHealthStatusValidationError struct { 400 field string 401 reason string 402 cause error 403 key bool 404 } 405 406 // Field function returns field value. 407 func (e HostHealthStatusValidationError) Field() string { return e.field } 408 409 // Reason function returns reason value. 410 func (e HostHealthStatusValidationError) Reason() string { return e.reason } 411 412 // Cause function returns cause value. 413 func (e HostHealthStatusValidationError) Cause() error { return e.cause } 414 415 // Key function returns key value. 416 func (e HostHealthStatusValidationError) Key() bool { return e.key } 417 418 // ErrorName returns error name. 419 func (e HostHealthStatusValidationError) ErrorName() string { return "HostHealthStatusValidationError" } 420 421 // Error satisfies the builtin error interface 422 func (e HostHealthStatusValidationError) Error() string { 423 cause := "" 424 if e.cause != nil { 425 cause = fmt.Sprintf(" | caused by: %v", e.cause) 426 } 427 428 key := "" 429 if e.key { 430 key = "key for " 431 } 432 433 return fmt.Sprintf( 434 "invalid %sHostHealthStatus.%s: %s%s", 435 key, 436 e.field, 437 e.reason, 438 cause) 439 } 440 441 var _ error = HostHealthStatusValidationError{} 442 443 var _ interface { 444 Field() string 445 Reason() string 446 Key() bool 447 Cause() error 448 ErrorName() string 449 } = HostHealthStatusValidationError{}