github.com/kubearmor/cilium@v1.6.12/api/v1/models/endpoint_health.go (about) 1 // Code generated by go-swagger; DO NOT EDIT. 2 3 package models 4 5 // This file was generated by the swagger tool. 6 // Editing this file might prove futile when you re-run the swagger generate command 7 8 import ( 9 strfmt "github.com/go-openapi/strfmt" 10 11 "github.com/go-openapi/errors" 12 "github.com/go-openapi/swag" 13 ) 14 15 // EndpointHealth Health of the endpoint 16 // swagger:model EndpointHealth 17 type EndpointHealth struct { 18 19 // bpf 20 Bpf EndpointHealthStatus `json:"bpf,omitempty"` 21 22 // Is this endpoint reachable 23 Connected bool `json:"connected,omitempty"` 24 25 // overall health 26 OverallHealth EndpointHealthStatus `json:"overallHealth,omitempty"` 27 28 // policy 29 Policy EndpointHealthStatus `json:"policy,omitempty"` 30 } 31 32 // Validate validates this endpoint health 33 func (m *EndpointHealth) Validate(formats strfmt.Registry) error { 34 var res []error 35 36 if err := m.validateBpf(formats); err != nil { 37 res = append(res, err) 38 } 39 40 if err := m.validateOverallHealth(formats); err != nil { 41 res = append(res, err) 42 } 43 44 if err := m.validatePolicy(formats); err != nil { 45 res = append(res, err) 46 } 47 48 if len(res) > 0 { 49 return errors.CompositeValidationError(res...) 50 } 51 return nil 52 } 53 54 func (m *EndpointHealth) validateBpf(formats strfmt.Registry) error { 55 56 if swag.IsZero(m.Bpf) { // not required 57 return nil 58 } 59 60 if err := m.Bpf.Validate(formats); err != nil { 61 if ve, ok := err.(*errors.Validation); ok { 62 return ve.ValidateName("bpf") 63 } 64 return err 65 } 66 67 return nil 68 } 69 70 func (m *EndpointHealth) validateOverallHealth(formats strfmt.Registry) error { 71 72 if swag.IsZero(m.OverallHealth) { // not required 73 return nil 74 } 75 76 if err := m.OverallHealth.Validate(formats); err != nil { 77 if ve, ok := err.(*errors.Validation); ok { 78 return ve.ValidateName("overallHealth") 79 } 80 return err 81 } 82 83 return nil 84 } 85 86 func (m *EndpointHealth) validatePolicy(formats strfmt.Registry) error { 87 88 if swag.IsZero(m.Policy) { // not required 89 return nil 90 } 91 92 if err := m.Policy.Validate(formats); err != nil { 93 if ve, ok := err.(*errors.Validation); ok { 94 return ve.ValidateName("policy") 95 } 96 return err 97 } 98 99 return nil 100 } 101 102 // MarshalBinary interface implementation 103 func (m *EndpointHealth) MarshalBinary() ([]byte, error) { 104 if m == nil { 105 return nil, nil 106 } 107 return swag.WriteJSON(m) 108 } 109 110 // UnmarshalBinary interface implementation 111 func (m *EndpointHealth) UnmarshalBinary(b []byte) error { 112 var res EndpointHealth 113 if err := swag.ReadJSON(b, &res); err != nil { 114 return err 115 } 116 *m = res 117 return nil 118 }