github.com/hxx258456/ccgo@v0.0.5-0.20230213014102-48b35f46f66f/go-control-plane/envoy/service/auth/v3/external_auth.pb.validate.go (about) 1 // Code generated by protoc-gen-validate. DO NOT EDIT. 2 // source: envoy/service/auth/v3/external_auth.proto 3 4 package envoy_service_auth_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 21 // ensure the imports are used 22 var ( 23 _ = bytes.MinRead 24 _ = errors.New("") 25 _ = fmt.Print 26 _ = utf8.UTFMax 27 _ = (*regexp.Regexp)(nil) 28 _ = (*strings.Reader)(nil) 29 _ = net.IPv4len 30 _ = time.Duration(0) 31 _ = (*url.URL)(nil) 32 _ = (*mail.Address)(nil) 33 _ = anypb.Any{} 34 ) 35 36 // Validate checks the field values on CheckRequest with the rules defined in 37 // the proto definition for this message. If any rules are violated, an error 38 // is returned. 39 func (m *CheckRequest) Validate() error { 40 if m == nil { 41 return nil 42 } 43 44 if v, ok := interface{}(m.GetAttributes()).(interface{ Validate() error }); ok { 45 if err := v.Validate(); err != nil { 46 return CheckRequestValidationError{ 47 field: "Attributes", 48 reason: "embedded message failed validation", 49 cause: err, 50 } 51 } 52 } 53 54 return nil 55 } 56 57 // CheckRequestValidationError is the validation error returned by 58 // CheckRequest.Validate if the designated constraints aren't met. 59 type CheckRequestValidationError struct { 60 field string 61 reason string 62 cause error 63 key bool 64 } 65 66 // Field function returns field value. 67 func (e CheckRequestValidationError) Field() string { return e.field } 68 69 // Reason function returns reason value. 70 func (e CheckRequestValidationError) Reason() string { return e.reason } 71 72 // Cause function returns cause value. 73 func (e CheckRequestValidationError) Cause() error { return e.cause } 74 75 // Key function returns key value. 76 func (e CheckRequestValidationError) Key() bool { return e.key } 77 78 // ErrorName returns error name. 79 func (e CheckRequestValidationError) ErrorName() string { return "CheckRequestValidationError" } 80 81 // Error satisfies the builtin error interface 82 func (e CheckRequestValidationError) Error() string { 83 cause := "" 84 if e.cause != nil { 85 cause = fmt.Sprintf(" | caused by: %v", e.cause) 86 } 87 88 key := "" 89 if e.key { 90 key = "key for " 91 } 92 93 return fmt.Sprintf( 94 "invalid %sCheckRequest.%s: %s%s", 95 key, 96 e.field, 97 e.reason, 98 cause) 99 } 100 101 var _ error = CheckRequestValidationError{} 102 103 var _ interface { 104 Field() string 105 Reason() string 106 Key() bool 107 Cause() error 108 ErrorName() string 109 } = CheckRequestValidationError{} 110 111 // Validate checks the field values on DeniedHttpResponse with the rules 112 // defined in the proto definition for this message. If any rules are 113 // violated, an error is returned. 114 func (m *DeniedHttpResponse) Validate() error { 115 if m == nil { 116 return nil 117 } 118 119 if m.GetStatus() == nil { 120 return DeniedHttpResponseValidationError{ 121 field: "Status", 122 reason: "value is required", 123 } 124 } 125 126 if v, ok := interface{}(m.GetStatus()).(interface{ Validate() error }); ok { 127 if err := v.Validate(); err != nil { 128 return DeniedHttpResponseValidationError{ 129 field: "Status", 130 reason: "embedded message failed validation", 131 cause: err, 132 } 133 } 134 } 135 136 for idx, item := range m.GetHeaders() { 137 _, _ = idx, item 138 139 if v, ok := interface{}(item).(interface{ Validate() error }); ok { 140 if err := v.Validate(); err != nil { 141 return DeniedHttpResponseValidationError{ 142 field: fmt.Sprintf("Headers[%v]", idx), 143 reason: "embedded message failed validation", 144 cause: err, 145 } 146 } 147 } 148 149 } 150 151 // no validation rules for Body 152 153 return nil 154 } 155 156 // DeniedHttpResponseValidationError is the validation error returned by 157 // DeniedHttpResponse.Validate if the designated constraints aren't met. 158 type DeniedHttpResponseValidationError struct { 159 field string 160 reason string 161 cause error 162 key bool 163 } 164 165 // Field function returns field value. 166 func (e DeniedHttpResponseValidationError) Field() string { return e.field } 167 168 // Reason function returns reason value. 169 func (e DeniedHttpResponseValidationError) Reason() string { return e.reason } 170 171 // Cause function returns cause value. 172 func (e DeniedHttpResponseValidationError) Cause() error { return e.cause } 173 174 // Key function returns key value. 175 func (e DeniedHttpResponseValidationError) Key() bool { return e.key } 176 177 // ErrorName returns error name. 178 func (e DeniedHttpResponseValidationError) ErrorName() string { 179 return "DeniedHttpResponseValidationError" 180 } 181 182 // Error satisfies the builtin error interface 183 func (e DeniedHttpResponseValidationError) Error() string { 184 cause := "" 185 if e.cause != nil { 186 cause = fmt.Sprintf(" | caused by: %v", e.cause) 187 } 188 189 key := "" 190 if e.key { 191 key = "key for " 192 } 193 194 return fmt.Sprintf( 195 "invalid %sDeniedHttpResponse.%s: %s%s", 196 key, 197 e.field, 198 e.reason, 199 cause) 200 } 201 202 var _ error = DeniedHttpResponseValidationError{} 203 204 var _ interface { 205 Field() string 206 Reason() string 207 Key() bool 208 Cause() error 209 ErrorName() string 210 } = DeniedHttpResponseValidationError{} 211 212 // Validate checks the field values on OkHttpResponse with the rules defined in 213 // the proto definition for this message. If any rules are violated, an error 214 // is returned. 215 func (m *OkHttpResponse) Validate() error { 216 if m == nil { 217 return nil 218 } 219 220 for idx, item := range m.GetHeaders() { 221 _, _ = idx, item 222 223 if v, ok := interface{}(item).(interface{ Validate() error }); ok { 224 if err := v.Validate(); err != nil { 225 return OkHttpResponseValidationError{ 226 field: fmt.Sprintf("Headers[%v]", idx), 227 reason: "embedded message failed validation", 228 cause: err, 229 } 230 } 231 } 232 233 } 234 235 if v, ok := interface{}(m.GetDynamicMetadata()).(interface{ Validate() error }); ok { 236 if err := v.Validate(); err != nil { 237 return OkHttpResponseValidationError{ 238 field: "DynamicMetadata", 239 reason: "embedded message failed validation", 240 cause: err, 241 } 242 } 243 } 244 245 for idx, item := range m.GetResponseHeadersToAdd() { 246 _, _ = idx, item 247 248 if v, ok := interface{}(item).(interface{ Validate() error }); ok { 249 if err := v.Validate(); err != nil { 250 return OkHttpResponseValidationError{ 251 field: fmt.Sprintf("ResponseHeadersToAdd[%v]", idx), 252 reason: "embedded message failed validation", 253 cause: err, 254 } 255 } 256 } 257 258 } 259 260 return nil 261 } 262 263 // OkHttpResponseValidationError is the validation error returned by 264 // OkHttpResponse.Validate if the designated constraints aren't met. 265 type OkHttpResponseValidationError struct { 266 field string 267 reason string 268 cause error 269 key bool 270 } 271 272 // Field function returns field value. 273 func (e OkHttpResponseValidationError) Field() string { return e.field } 274 275 // Reason function returns reason value. 276 func (e OkHttpResponseValidationError) Reason() string { return e.reason } 277 278 // Cause function returns cause value. 279 func (e OkHttpResponseValidationError) Cause() error { return e.cause } 280 281 // Key function returns key value. 282 func (e OkHttpResponseValidationError) Key() bool { return e.key } 283 284 // ErrorName returns error name. 285 func (e OkHttpResponseValidationError) ErrorName() string { return "OkHttpResponseValidationError" } 286 287 // Error satisfies the builtin error interface 288 func (e OkHttpResponseValidationError) Error() string { 289 cause := "" 290 if e.cause != nil { 291 cause = fmt.Sprintf(" | caused by: %v", e.cause) 292 } 293 294 key := "" 295 if e.key { 296 key = "key for " 297 } 298 299 return fmt.Sprintf( 300 "invalid %sOkHttpResponse.%s: %s%s", 301 key, 302 e.field, 303 e.reason, 304 cause) 305 } 306 307 var _ error = OkHttpResponseValidationError{} 308 309 var _ interface { 310 Field() string 311 Reason() string 312 Key() bool 313 Cause() error 314 ErrorName() string 315 } = OkHttpResponseValidationError{} 316 317 // Validate checks the field values on CheckResponse with the rules defined in 318 // the proto definition for this message. If any rules are violated, an error 319 // is returned. 320 func (m *CheckResponse) Validate() error { 321 if m == nil { 322 return nil 323 } 324 325 if v, ok := interface{}(m.GetStatus()).(interface{ Validate() error }); ok { 326 if err := v.Validate(); err != nil { 327 return CheckResponseValidationError{ 328 field: "Status", 329 reason: "embedded message failed validation", 330 cause: err, 331 } 332 } 333 } 334 335 if v, ok := interface{}(m.GetDynamicMetadata()).(interface{ Validate() error }); ok { 336 if err := v.Validate(); err != nil { 337 return CheckResponseValidationError{ 338 field: "DynamicMetadata", 339 reason: "embedded message failed validation", 340 cause: err, 341 } 342 } 343 } 344 345 switch m.HttpResponse.(type) { 346 347 case *CheckResponse_DeniedResponse: 348 349 if v, ok := interface{}(m.GetDeniedResponse()).(interface{ Validate() error }); ok { 350 if err := v.Validate(); err != nil { 351 return CheckResponseValidationError{ 352 field: "DeniedResponse", 353 reason: "embedded message failed validation", 354 cause: err, 355 } 356 } 357 } 358 359 case *CheckResponse_OkResponse: 360 361 if v, ok := interface{}(m.GetOkResponse()).(interface{ Validate() error }); ok { 362 if err := v.Validate(); err != nil { 363 return CheckResponseValidationError{ 364 field: "OkResponse", 365 reason: "embedded message failed validation", 366 cause: err, 367 } 368 } 369 } 370 371 } 372 373 return nil 374 } 375 376 // CheckResponseValidationError is the validation error returned by 377 // CheckResponse.Validate if the designated constraints aren't met. 378 type CheckResponseValidationError struct { 379 field string 380 reason string 381 cause error 382 key bool 383 } 384 385 // Field function returns field value. 386 func (e CheckResponseValidationError) Field() string { return e.field } 387 388 // Reason function returns reason value. 389 func (e CheckResponseValidationError) Reason() string { return e.reason } 390 391 // Cause function returns cause value. 392 func (e CheckResponseValidationError) Cause() error { return e.cause } 393 394 // Key function returns key value. 395 func (e CheckResponseValidationError) Key() bool { return e.key } 396 397 // ErrorName returns error name. 398 func (e CheckResponseValidationError) ErrorName() string { return "CheckResponseValidationError" } 399 400 // Error satisfies the builtin error interface 401 func (e CheckResponseValidationError) Error() string { 402 cause := "" 403 if e.cause != nil { 404 cause = fmt.Sprintf(" | caused by: %v", e.cause) 405 } 406 407 key := "" 408 if e.key { 409 key = "key for " 410 } 411 412 return fmt.Sprintf( 413 "invalid %sCheckResponse.%s: %s%s", 414 key, 415 e.field, 416 e.reason, 417 cause) 418 } 419 420 var _ error = CheckResponseValidationError{} 421 422 var _ interface { 423 Field() string 424 Reason() string 425 Key() bool 426 Cause() error 427 ErrorName() string 428 } = CheckResponseValidationError{}