gitee.com/ks-custle/core-gm@v0.0.0-20230922171213-b83bdd97b62c/go-control-plane/envoy/api/v2/cluster/circuit_breaker.pb.validate.go (about) 1 // Code generated by protoc-gen-validate. DO NOT EDIT. 2 // source: envoy/api/v2/cluster/circuit_breaker.proto 3 4 package envoy_api_v2_cluster 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.RoutingPriority(0) 38 ) 39 40 // Validate checks the field values on CircuitBreakers with the rules defined 41 // in the proto definition for this message. If any rules are violated, an 42 // error is returned. 43 func (m *CircuitBreakers) Validate() error { 44 if m == nil { 45 return nil 46 } 47 48 for idx, item := range m.GetThresholds() { 49 _, _ = idx, item 50 51 if v, ok := interface{}(item).(interface{ Validate() error }); ok { 52 if err := v.Validate(); err != nil { 53 return CircuitBreakersValidationError{ 54 field: fmt.Sprintf("Thresholds[%v]", idx), 55 reason: "embedded message failed validation", 56 cause: err, 57 } 58 } 59 } 60 61 } 62 63 return nil 64 } 65 66 // CircuitBreakersValidationError is the validation error returned by 67 // CircuitBreakers.Validate if the designated constraints aren't met. 68 type CircuitBreakersValidationError struct { 69 field string 70 reason string 71 cause error 72 key bool 73 } 74 75 // Field function returns field value. 76 func (e CircuitBreakersValidationError) Field() string { return e.field } 77 78 // Reason function returns reason value. 79 func (e CircuitBreakersValidationError) Reason() string { return e.reason } 80 81 // Cause function returns cause value. 82 func (e CircuitBreakersValidationError) Cause() error { return e.cause } 83 84 // Key function returns key value. 85 func (e CircuitBreakersValidationError) Key() bool { return e.key } 86 87 // ErrorName returns error name. 88 func (e CircuitBreakersValidationError) ErrorName() string { return "CircuitBreakersValidationError" } 89 90 // Error satisfies the builtin error interface 91 func (e CircuitBreakersValidationError) Error() string { 92 cause := "" 93 if e.cause != nil { 94 cause = fmt.Sprintf(" | caused by: %v", e.cause) 95 } 96 97 key := "" 98 if e.key { 99 key = "key for " 100 } 101 102 return fmt.Sprintf( 103 "invalid %sCircuitBreakers.%s: %s%s", 104 key, 105 e.field, 106 e.reason, 107 cause) 108 } 109 110 var _ error = CircuitBreakersValidationError{} 111 112 var _ interface { 113 Field() string 114 Reason() string 115 Key() bool 116 Cause() error 117 ErrorName() string 118 } = CircuitBreakersValidationError{} 119 120 // Validate checks the field values on CircuitBreakers_Thresholds with the 121 // rules defined in the proto definition for this message. If any rules are 122 // violated, an error is returned. 123 func (m *CircuitBreakers_Thresholds) Validate() error { 124 if m == nil { 125 return nil 126 } 127 128 if _, ok := core.RoutingPriority_name[int32(m.GetPriority())]; !ok { 129 return CircuitBreakers_ThresholdsValidationError{ 130 field: "Priority", 131 reason: "value must be one of the defined enum values", 132 } 133 } 134 135 if v, ok := interface{}(m.GetMaxConnections()).(interface{ Validate() error }); ok { 136 if err := v.Validate(); err != nil { 137 return CircuitBreakers_ThresholdsValidationError{ 138 field: "MaxConnections", 139 reason: "embedded message failed validation", 140 cause: err, 141 } 142 } 143 } 144 145 if v, ok := interface{}(m.GetMaxPendingRequests()).(interface{ Validate() error }); ok { 146 if err := v.Validate(); err != nil { 147 return CircuitBreakers_ThresholdsValidationError{ 148 field: "MaxPendingRequests", 149 reason: "embedded message failed validation", 150 cause: err, 151 } 152 } 153 } 154 155 if v, ok := interface{}(m.GetMaxRequests()).(interface{ Validate() error }); ok { 156 if err := v.Validate(); err != nil { 157 return CircuitBreakers_ThresholdsValidationError{ 158 field: "MaxRequests", 159 reason: "embedded message failed validation", 160 cause: err, 161 } 162 } 163 } 164 165 if v, ok := interface{}(m.GetMaxRetries()).(interface{ Validate() error }); ok { 166 if err := v.Validate(); err != nil { 167 return CircuitBreakers_ThresholdsValidationError{ 168 field: "MaxRetries", 169 reason: "embedded message failed validation", 170 cause: err, 171 } 172 } 173 } 174 175 if v, ok := interface{}(m.GetRetryBudget()).(interface{ Validate() error }); ok { 176 if err := v.Validate(); err != nil { 177 return CircuitBreakers_ThresholdsValidationError{ 178 field: "RetryBudget", 179 reason: "embedded message failed validation", 180 cause: err, 181 } 182 } 183 } 184 185 // no validation rules for TrackRemaining 186 187 if v, ok := interface{}(m.GetMaxConnectionPools()).(interface{ Validate() error }); ok { 188 if err := v.Validate(); err != nil { 189 return CircuitBreakers_ThresholdsValidationError{ 190 field: "MaxConnectionPools", 191 reason: "embedded message failed validation", 192 cause: err, 193 } 194 } 195 } 196 197 return nil 198 } 199 200 // CircuitBreakers_ThresholdsValidationError is the validation error returned 201 // by CircuitBreakers_Thresholds.Validate if the designated constraints aren't met. 202 type CircuitBreakers_ThresholdsValidationError struct { 203 field string 204 reason string 205 cause error 206 key bool 207 } 208 209 // Field function returns field value. 210 func (e CircuitBreakers_ThresholdsValidationError) Field() string { return e.field } 211 212 // Reason function returns reason value. 213 func (e CircuitBreakers_ThresholdsValidationError) Reason() string { return e.reason } 214 215 // Cause function returns cause value. 216 func (e CircuitBreakers_ThresholdsValidationError) Cause() error { return e.cause } 217 218 // Key function returns key value. 219 func (e CircuitBreakers_ThresholdsValidationError) Key() bool { return e.key } 220 221 // ErrorName returns error name. 222 func (e CircuitBreakers_ThresholdsValidationError) ErrorName() string { 223 return "CircuitBreakers_ThresholdsValidationError" 224 } 225 226 // Error satisfies the builtin error interface 227 func (e CircuitBreakers_ThresholdsValidationError) Error() string { 228 cause := "" 229 if e.cause != nil { 230 cause = fmt.Sprintf(" | caused by: %v", e.cause) 231 } 232 233 key := "" 234 if e.key { 235 key = "key for " 236 } 237 238 return fmt.Sprintf( 239 "invalid %sCircuitBreakers_Thresholds.%s: %s%s", 240 key, 241 e.field, 242 e.reason, 243 cause) 244 } 245 246 var _ error = CircuitBreakers_ThresholdsValidationError{} 247 248 var _ interface { 249 Field() string 250 Reason() string 251 Key() bool 252 Cause() error 253 ErrorName() string 254 } = CircuitBreakers_ThresholdsValidationError{} 255 256 // Validate checks the field values on CircuitBreakers_Thresholds_RetryBudget 257 // with the rules defined in the proto definition for this message. If any 258 // rules are violated, an error is returned. 259 func (m *CircuitBreakers_Thresholds_RetryBudget) Validate() error { 260 if m == nil { 261 return nil 262 } 263 264 if v, ok := interface{}(m.GetBudgetPercent()).(interface{ Validate() error }); ok { 265 if err := v.Validate(); err != nil { 266 return CircuitBreakers_Thresholds_RetryBudgetValidationError{ 267 field: "BudgetPercent", 268 reason: "embedded message failed validation", 269 cause: err, 270 } 271 } 272 } 273 274 if v, ok := interface{}(m.GetMinRetryConcurrency()).(interface{ Validate() error }); ok { 275 if err := v.Validate(); err != nil { 276 return CircuitBreakers_Thresholds_RetryBudgetValidationError{ 277 field: "MinRetryConcurrency", 278 reason: "embedded message failed validation", 279 cause: err, 280 } 281 } 282 } 283 284 return nil 285 } 286 287 // CircuitBreakers_Thresholds_RetryBudgetValidationError is the validation 288 // error returned by CircuitBreakers_Thresholds_RetryBudget.Validate if the 289 // designated constraints aren't met. 290 type CircuitBreakers_Thresholds_RetryBudgetValidationError struct { 291 field string 292 reason string 293 cause error 294 key bool 295 } 296 297 // Field function returns field value. 298 func (e CircuitBreakers_Thresholds_RetryBudgetValidationError) Field() string { return e.field } 299 300 // Reason function returns reason value. 301 func (e CircuitBreakers_Thresholds_RetryBudgetValidationError) Reason() string { return e.reason } 302 303 // Cause function returns cause value. 304 func (e CircuitBreakers_Thresholds_RetryBudgetValidationError) Cause() error { return e.cause } 305 306 // Key function returns key value. 307 func (e CircuitBreakers_Thresholds_RetryBudgetValidationError) Key() bool { return e.key } 308 309 // ErrorName returns error name. 310 func (e CircuitBreakers_Thresholds_RetryBudgetValidationError) ErrorName() string { 311 return "CircuitBreakers_Thresholds_RetryBudgetValidationError" 312 } 313 314 // Error satisfies the builtin error interface 315 func (e CircuitBreakers_Thresholds_RetryBudgetValidationError) Error() string { 316 cause := "" 317 if e.cause != nil { 318 cause = fmt.Sprintf(" | caused by: %v", e.cause) 319 } 320 321 key := "" 322 if e.key { 323 key = "key for " 324 } 325 326 return fmt.Sprintf( 327 "invalid %sCircuitBreakers_Thresholds_RetryBudget.%s: %s%s", 328 key, 329 e.field, 330 e.reason, 331 cause) 332 } 333 334 var _ error = CircuitBreakers_Thresholds_RetryBudgetValidationError{} 335 336 var _ interface { 337 Field() string 338 Reason() string 339 Key() bool 340 Cause() error 341 ErrorName() string 342 } = CircuitBreakers_Thresholds_RetryBudgetValidationError{}