github.com/cilium/cilium@v1.16.2/api/v1/models/endpoint_status.go (about) 1 // Code generated by go-swagger; DO NOT EDIT. 2 3 // Copyright Authors of Cilium 4 // SPDX-License-Identifier: Apache-2.0 5 6 package models 7 8 // This file was generated by the swagger tool. 9 // Editing this file might prove futile when you re-run the swagger generate command 10 11 import ( 12 "context" 13 14 "github.com/go-openapi/errors" 15 "github.com/go-openapi/strfmt" 16 "github.com/go-openapi/swag" 17 "github.com/go-openapi/validate" 18 ) 19 20 // EndpointStatus The current state and configuration of the endpoint, its policy & datapath, and subcomponents 21 // 22 // swagger:model EndpointStatus 23 type EndpointStatus struct { 24 25 // Status of internal controllers attached to this endpoint 26 Controllers ControllerStatuses `json:"controllers,omitempty"` 27 28 // Unique identifiers for this endpoint from outside cilium 29 ExternalIdentifiers *EndpointIdentifiers `json:"external-identifiers,omitempty"` 30 31 // Summary overall endpoint & subcomponent health 32 Health *EndpointHealth `json:"health,omitempty"` 33 34 // The security identity for this endpoint 35 Identity *Identity `json:"identity,omitempty"` 36 37 // Labels applied to this endpoint 38 Labels *LabelConfigurationStatus `json:"labels,omitempty"` 39 40 // Most recent status log. See endpoint/{id}/log for the complete log. 41 Log EndpointStatusLog `json:"log,omitempty"` 42 43 // List of named ports that can be used in Network Policy 44 NamedPorts NamedPorts `json:"namedPorts,omitempty"` 45 46 // Networking properties of the endpoint 47 Networking *EndpointNetworking `json:"networking,omitempty"` 48 49 // The policy applied to this endpoint from the policy repository 50 Policy *EndpointPolicyStatus `json:"policy,omitempty"` 51 52 // The configuration in effect on this endpoint 53 Realized *EndpointConfigurationSpec `json:"realized,omitempty"` 54 55 // Current state of endpoint 56 // Required: true 57 State *EndpointState `json:"state"` 58 } 59 60 // Validate validates this endpoint status 61 func (m *EndpointStatus) Validate(formats strfmt.Registry) error { 62 var res []error 63 64 if err := m.validateControllers(formats); err != nil { 65 res = append(res, err) 66 } 67 68 if err := m.validateExternalIdentifiers(formats); err != nil { 69 res = append(res, err) 70 } 71 72 if err := m.validateHealth(formats); err != nil { 73 res = append(res, err) 74 } 75 76 if err := m.validateIdentity(formats); err != nil { 77 res = append(res, err) 78 } 79 80 if err := m.validateLabels(formats); err != nil { 81 res = append(res, err) 82 } 83 84 if err := m.validateLog(formats); err != nil { 85 res = append(res, err) 86 } 87 88 if err := m.validateNamedPorts(formats); err != nil { 89 res = append(res, err) 90 } 91 92 if err := m.validateNetworking(formats); err != nil { 93 res = append(res, err) 94 } 95 96 if err := m.validatePolicy(formats); err != nil { 97 res = append(res, err) 98 } 99 100 if err := m.validateRealized(formats); err != nil { 101 res = append(res, err) 102 } 103 104 if err := m.validateState(formats); err != nil { 105 res = append(res, err) 106 } 107 108 if len(res) > 0 { 109 return errors.CompositeValidationError(res...) 110 } 111 return nil 112 } 113 114 func (m *EndpointStatus) validateControllers(formats strfmt.Registry) error { 115 if swag.IsZero(m.Controllers) { // not required 116 return nil 117 } 118 119 if err := m.Controllers.Validate(formats); err != nil { 120 if ve, ok := err.(*errors.Validation); ok { 121 return ve.ValidateName("controllers") 122 } else if ce, ok := err.(*errors.CompositeError); ok { 123 return ce.ValidateName("controllers") 124 } 125 return err 126 } 127 128 return nil 129 } 130 131 func (m *EndpointStatus) validateExternalIdentifiers(formats strfmt.Registry) error { 132 if swag.IsZero(m.ExternalIdentifiers) { // not required 133 return nil 134 } 135 136 if m.ExternalIdentifiers != nil { 137 if err := m.ExternalIdentifiers.Validate(formats); err != nil { 138 if ve, ok := err.(*errors.Validation); ok { 139 return ve.ValidateName("external-identifiers") 140 } else if ce, ok := err.(*errors.CompositeError); ok { 141 return ce.ValidateName("external-identifiers") 142 } 143 return err 144 } 145 } 146 147 return nil 148 } 149 150 func (m *EndpointStatus) validateHealth(formats strfmt.Registry) error { 151 if swag.IsZero(m.Health) { // not required 152 return nil 153 } 154 155 if m.Health != nil { 156 if err := m.Health.Validate(formats); err != nil { 157 if ve, ok := err.(*errors.Validation); ok { 158 return ve.ValidateName("health") 159 } else if ce, ok := err.(*errors.CompositeError); ok { 160 return ce.ValidateName("health") 161 } 162 return err 163 } 164 } 165 166 return nil 167 } 168 169 func (m *EndpointStatus) validateIdentity(formats strfmt.Registry) error { 170 if swag.IsZero(m.Identity) { // not required 171 return nil 172 } 173 174 if m.Identity != nil { 175 if err := m.Identity.Validate(formats); err != nil { 176 if ve, ok := err.(*errors.Validation); ok { 177 return ve.ValidateName("identity") 178 } else if ce, ok := err.(*errors.CompositeError); ok { 179 return ce.ValidateName("identity") 180 } 181 return err 182 } 183 } 184 185 return nil 186 } 187 188 func (m *EndpointStatus) validateLabels(formats strfmt.Registry) error { 189 if swag.IsZero(m.Labels) { // not required 190 return nil 191 } 192 193 if m.Labels != nil { 194 if err := m.Labels.Validate(formats); err != nil { 195 if ve, ok := err.(*errors.Validation); ok { 196 return ve.ValidateName("labels") 197 } else if ce, ok := err.(*errors.CompositeError); ok { 198 return ce.ValidateName("labels") 199 } 200 return err 201 } 202 } 203 204 return nil 205 } 206 207 func (m *EndpointStatus) validateLog(formats strfmt.Registry) error { 208 if swag.IsZero(m.Log) { // not required 209 return nil 210 } 211 212 if err := m.Log.Validate(formats); err != nil { 213 if ve, ok := err.(*errors.Validation); ok { 214 return ve.ValidateName("log") 215 } else if ce, ok := err.(*errors.CompositeError); ok { 216 return ce.ValidateName("log") 217 } 218 return err 219 } 220 221 return nil 222 } 223 224 func (m *EndpointStatus) validateNamedPorts(formats strfmt.Registry) error { 225 if swag.IsZero(m.NamedPorts) { // not required 226 return nil 227 } 228 229 if err := m.NamedPorts.Validate(formats); err != nil { 230 if ve, ok := err.(*errors.Validation); ok { 231 return ve.ValidateName("namedPorts") 232 } else if ce, ok := err.(*errors.CompositeError); ok { 233 return ce.ValidateName("namedPorts") 234 } 235 return err 236 } 237 238 return nil 239 } 240 241 func (m *EndpointStatus) validateNetworking(formats strfmt.Registry) error { 242 if swag.IsZero(m.Networking) { // not required 243 return nil 244 } 245 246 if m.Networking != nil { 247 if err := m.Networking.Validate(formats); err != nil { 248 if ve, ok := err.(*errors.Validation); ok { 249 return ve.ValidateName("networking") 250 } else if ce, ok := err.(*errors.CompositeError); ok { 251 return ce.ValidateName("networking") 252 } 253 return err 254 } 255 } 256 257 return nil 258 } 259 260 func (m *EndpointStatus) validatePolicy(formats strfmt.Registry) error { 261 if swag.IsZero(m.Policy) { // not required 262 return nil 263 } 264 265 if m.Policy != nil { 266 if err := m.Policy.Validate(formats); err != nil { 267 if ve, ok := err.(*errors.Validation); ok { 268 return ve.ValidateName("policy") 269 } else if ce, ok := err.(*errors.CompositeError); ok { 270 return ce.ValidateName("policy") 271 } 272 return err 273 } 274 } 275 276 return nil 277 } 278 279 func (m *EndpointStatus) validateRealized(formats strfmt.Registry) error { 280 if swag.IsZero(m.Realized) { // not required 281 return nil 282 } 283 284 if m.Realized != nil { 285 if err := m.Realized.Validate(formats); err != nil { 286 if ve, ok := err.(*errors.Validation); ok { 287 return ve.ValidateName("realized") 288 } else if ce, ok := err.(*errors.CompositeError); ok { 289 return ce.ValidateName("realized") 290 } 291 return err 292 } 293 } 294 295 return nil 296 } 297 298 func (m *EndpointStatus) validateState(formats strfmt.Registry) error { 299 300 if err := validate.Required("state", "body", m.State); err != nil { 301 return err 302 } 303 304 if err := validate.Required("state", "body", m.State); err != nil { 305 return err 306 } 307 308 if m.State != nil { 309 if err := m.State.Validate(formats); err != nil { 310 if ve, ok := err.(*errors.Validation); ok { 311 return ve.ValidateName("state") 312 } else if ce, ok := err.(*errors.CompositeError); ok { 313 return ce.ValidateName("state") 314 } 315 return err 316 } 317 } 318 319 return nil 320 } 321 322 // ContextValidate validate this endpoint status based on the context it is used 323 func (m *EndpointStatus) ContextValidate(ctx context.Context, formats strfmt.Registry) error { 324 var res []error 325 326 if err := m.contextValidateControllers(ctx, formats); err != nil { 327 res = append(res, err) 328 } 329 330 if err := m.contextValidateExternalIdentifiers(ctx, formats); err != nil { 331 res = append(res, err) 332 } 333 334 if err := m.contextValidateHealth(ctx, formats); err != nil { 335 res = append(res, err) 336 } 337 338 if err := m.contextValidateIdentity(ctx, formats); err != nil { 339 res = append(res, err) 340 } 341 342 if err := m.contextValidateLabels(ctx, formats); err != nil { 343 res = append(res, err) 344 } 345 346 if err := m.contextValidateLog(ctx, formats); err != nil { 347 res = append(res, err) 348 } 349 350 if err := m.contextValidateNamedPorts(ctx, formats); err != nil { 351 res = append(res, err) 352 } 353 354 if err := m.contextValidateNetworking(ctx, formats); err != nil { 355 res = append(res, err) 356 } 357 358 if err := m.contextValidatePolicy(ctx, formats); err != nil { 359 res = append(res, err) 360 } 361 362 if err := m.contextValidateRealized(ctx, formats); err != nil { 363 res = append(res, err) 364 } 365 366 if err := m.contextValidateState(ctx, formats); err != nil { 367 res = append(res, err) 368 } 369 370 if len(res) > 0 { 371 return errors.CompositeValidationError(res...) 372 } 373 return nil 374 } 375 376 func (m *EndpointStatus) contextValidateControllers(ctx context.Context, formats strfmt.Registry) error { 377 378 if err := m.Controllers.ContextValidate(ctx, formats); err != nil { 379 if ve, ok := err.(*errors.Validation); ok { 380 return ve.ValidateName("controllers") 381 } else if ce, ok := err.(*errors.CompositeError); ok { 382 return ce.ValidateName("controllers") 383 } 384 return err 385 } 386 387 return nil 388 } 389 390 func (m *EndpointStatus) contextValidateExternalIdentifiers(ctx context.Context, formats strfmt.Registry) error { 391 392 if m.ExternalIdentifiers != nil { 393 394 if swag.IsZero(m.ExternalIdentifiers) { // not required 395 return nil 396 } 397 398 if err := m.ExternalIdentifiers.ContextValidate(ctx, formats); err != nil { 399 if ve, ok := err.(*errors.Validation); ok { 400 return ve.ValidateName("external-identifiers") 401 } else if ce, ok := err.(*errors.CompositeError); ok { 402 return ce.ValidateName("external-identifiers") 403 } 404 return err 405 } 406 } 407 408 return nil 409 } 410 411 func (m *EndpointStatus) contextValidateHealth(ctx context.Context, formats strfmt.Registry) error { 412 413 if m.Health != nil { 414 415 if swag.IsZero(m.Health) { // not required 416 return nil 417 } 418 419 if err := m.Health.ContextValidate(ctx, formats); err != nil { 420 if ve, ok := err.(*errors.Validation); ok { 421 return ve.ValidateName("health") 422 } else if ce, ok := err.(*errors.CompositeError); ok { 423 return ce.ValidateName("health") 424 } 425 return err 426 } 427 } 428 429 return nil 430 } 431 432 func (m *EndpointStatus) contextValidateIdentity(ctx context.Context, formats strfmt.Registry) error { 433 434 if m.Identity != nil { 435 436 if swag.IsZero(m.Identity) { // not required 437 return nil 438 } 439 440 if err := m.Identity.ContextValidate(ctx, formats); err != nil { 441 if ve, ok := err.(*errors.Validation); ok { 442 return ve.ValidateName("identity") 443 } else if ce, ok := err.(*errors.CompositeError); ok { 444 return ce.ValidateName("identity") 445 } 446 return err 447 } 448 } 449 450 return nil 451 } 452 453 func (m *EndpointStatus) contextValidateLabels(ctx context.Context, formats strfmt.Registry) error { 454 455 if m.Labels != nil { 456 457 if swag.IsZero(m.Labels) { // not required 458 return nil 459 } 460 461 if err := m.Labels.ContextValidate(ctx, formats); err != nil { 462 if ve, ok := err.(*errors.Validation); ok { 463 return ve.ValidateName("labels") 464 } else if ce, ok := err.(*errors.CompositeError); ok { 465 return ce.ValidateName("labels") 466 } 467 return err 468 } 469 } 470 471 return nil 472 } 473 474 func (m *EndpointStatus) contextValidateLog(ctx context.Context, formats strfmt.Registry) error { 475 476 if err := m.Log.ContextValidate(ctx, formats); err != nil { 477 if ve, ok := err.(*errors.Validation); ok { 478 return ve.ValidateName("log") 479 } else if ce, ok := err.(*errors.CompositeError); ok { 480 return ce.ValidateName("log") 481 } 482 return err 483 } 484 485 return nil 486 } 487 488 func (m *EndpointStatus) contextValidateNamedPorts(ctx context.Context, formats strfmt.Registry) error { 489 490 if err := m.NamedPorts.ContextValidate(ctx, formats); err != nil { 491 if ve, ok := err.(*errors.Validation); ok { 492 return ve.ValidateName("namedPorts") 493 } else if ce, ok := err.(*errors.CompositeError); ok { 494 return ce.ValidateName("namedPorts") 495 } 496 return err 497 } 498 499 return nil 500 } 501 502 func (m *EndpointStatus) contextValidateNetworking(ctx context.Context, formats strfmt.Registry) error { 503 504 if m.Networking != nil { 505 506 if swag.IsZero(m.Networking) { // not required 507 return nil 508 } 509 510 if err := m.Networking.ContextValidate(ctx, formats); err != nil { 511 if ve, ok := err.(*errors.Validation); ok { 512 return ve.ValidateName("networking") 513 } else if ce, ok := err.(*errors.CompositeError); ok { 514 return ce.ValidateName("networking") 515 } 516 return err 517 } 518 } 519 520 return nil 521 } 522 523 func (m *EndpointStatus) contextValidatePolicy(ctx context.Context, formats strfmt.Registry) error { 524 525 if m.Policy != nil { 526 527 if swag.IsZero(m.Policy) { // not required 528 return nil 529 } 530 531 if err := m.Policy.ContextValidate(ctx, formats); err != nil { 532 if ve, ok := err.(*errors.Validation); ok { 533 return ve.ValidateName("policy") 534 } else if ce, ok := err.(*errors.CompositeError); ok { 535 return ce.ValidateName("policy") 536 } 537 return err 538 } 539 } 540 541 return nil 542 } 543 544 func (m *EndpointStatus) contextValidateRealized(ctx context.Context, formats strfmt.Registry) error { 545 546 if m.Realized != nil { 547 548 if swag.IsZero(m.Realized) { // not required 549 return nil 550 } 551 552 if err := m.Realized.ContextValidate(ctx, formats); err != nil { 553 if ve, ok := err.(*errors.Validation); ok { 554 return ve.ValidateName("realized") 555 } else if ce, ok := err.(*errors.CompositeError); ok { 556 return ce.ValidateName("realized") 557 } 558 return err 559 } 560 } 561 562 return nil 563 } 564 565 func (m *EndpointStatus) contextValidateState(ctx context.Context, formats strfmt.Registry) error { 566 567 if m.State != nil { 568 569 if err := m.State.ContextValidate(ctx, formats); err != nil { 570 if ve, ok := err.(*errors.Validation); ok { 571 return ve.ValidateName("state") 572 } else if ce, ok := err.(*errors.CompositeError); ok { 573 return ce.ValidateName("state") 574 } 575 return err 576 } 577 } 578 579 return nil 580 } 581 582 // MarshalBinary interface implementation 583 func (m *EndpointStatus) MarshalBinary() ([]byte, error) { 584 if m == nil { 585 return nil, nil 586 } 587 return swag.WriteJSON(m) 588 } 589 590 // UnmarshalBinary interface implementation 591 func (m *EndpointStatus) UnmarshalBinary(b []byte) error { 592 var res EndpointStatus 593 if err := swag.ReadJSON(b, &res); err != nil { 594 return err 595 } 596 *m = res 597 return nil 598 }