github.com/kubearmor/cilium@v1.6.12/api/v1/health/models/health_response.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 // TODO: Upstream swagger doesn't autogenerate this include, but it 12 // should for spec cross-references. 13 ciliumModels "github.com/cilium/cilium/api/v1/models" 14 15 "github.com/go-openapi/errors" 16 "github.com/go-openapi/swag" 17 ) 18 19 // HealthResponse Health and status information of local node 20 // swagger:model HealthResponse 21 type HealthResponse struct { 22 23 // Status of Cilium daemon 24 Cilium *ciliumModels.StatusResponse `json:"cilium,omitempty"` 25 26 // System load on node 27 SystemLoad *LoadResponse `json:"system-load,omitempty"` 28 29 // Uptime of cilium-health instance 30 Uptime string `json:"uptime,omitempty"` 31 } 32 33 // Validate validates this health response 34 func (m *HealthResponse) Validate(formats strfmt.Registry) error { 35 var res []error 36 37 if err := m.validateCilium(formats); err != nil { 38 res = append(res, err) 39 } 40 41 if err := m.validateSystemLoad(formats); err != nil { 42 res = append(res, err) 43 } 44 45 if len(res) > 0 { 46 return errors.CompositeValidationError(res...) 47 } 48 return nil 49 } 50 51 func (m *HealthResponse) validateCilium(formats strfmt.Registry) error { 52 53 if swag.IsZero(m.Cilium) { // not required 54 return nil 55 } 56 57 if m.Cilium != nil { 58 if err := m.Cilium.Validate(formats); err != nil { 59 if ve, ok := err.(*errors.Validation); ok { 60 return ve.ValidateName("cilium") 61 } 62 return err 63 } 64 } 65 66 return nil 67 } 68 69 func (m *HealthResponse) validateSystemLoad(formats strfmt.Registry) error { 70 71 if swag.IsZero(m.SystemLoad) { // not required 72 return nil 73 } 74 75 if m.SystemLoad != nil { 76 if err := m.SystemLoad.Validate(formats); err != nil { 77 if ve, ok := err.(*errors.Validation); ok { 78 return ve.ValidateName("system-load") 79 } 80 return err 81 } 82 } 83 84 return nil 85 } 86 87 // MarshalBinary interface implementation 88 func (m *HealthResponse) MarshalBinary() ([]byte, error) { 89 if m == nil { 90 return nil, nil 91 } 92 return swag.WriteJSON(m) 93 } 94 95 // UnmarshalBinary interface implementation 96 func (m *HealthResponse) UnmarshalBinary(b []byte) error { 97 var res HealthResponse 98 if err := swag.ReadJSON(b, &res); err != nil { 99 return err 100 } 101 *m = res 102 return nil 103 }