github.com/kubearmor/cilium@v1.6.12/api/v1/health/models/health_status_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 "strconv" 10 11 strfmt "github.com/go-openapi/strfmt" 12 13 "github.com/go-openapi/errors" 14 "github.com/go-openapi/swag" 15 ) 16 17 // HealthStatusResponse Connectivity status to other daemons 18 // swagger:model HealthStatusResponse 19 type HealthStatusResponse struct { 20 21 // Description of the local node 22 Local *SelfStatus `json:"local,omitempty"` 23 24 // Connectivity status to each other node 25 Nodes []*NodeStatus `json:"nodes"` 26 27 // timestamp 28 Timestamp string `json:"timestamp,omitempty"` 29 } 30 31 // Validate validates this health status response 32 func (m *HealthStatusResponse) Validate(formats strfmt.Registry) error { 33 var res []error 34 35 if err := m.validateLocal(formats); err != nil { 36 res = append(res, err) 37 } 38 39 if err := m.validateNodes(formats); err != nil { 40 res = append(res, err) 41 } 42 43 if len(res) > 0 { 44 return errors.CompositeValidationError(res...) 45 } 46 return nil 47 } 48 49 func (m *HealthStatusResponse) validateLocal(formats strfmt.Registry) error { 50 51 if swag.IsZero(m.Local) { // not required 52 return nil 53 } 54 55 if m.Local != nil { 56 if err := m.Local.Validate(formats); err != nil { 57 if ve, ok := err.(*errors.Validation); ok { 58 return ve.ValidateName("local") 59 } 60 return err 61 } 62 } 63 64 return nil 65 } 66 67 func (m *HealthStatusResponse) validateNodes(formats strfmt.Registry) error { 68 69 if swag.IsZero(m.Nodes) { // not required 70 return nil 71 } 72 73 for i := 0; i < len(m.Nodes); i++ { 74 if swag.IsZero(m.Nodes[i]) { // not required 75 continue 76 } 77 78 if m.Nodes[i] != nil { 79 if err := m.Nodes[i].Validate(formats); err != nil { 80 if ve, ok := err.(*errors.Validation); ok { 81 return ve.ValidateName("nodes" + "." + strconv.Itoa(i)) 82 } 83 return err 84 } 85 } 86 87 } 88 89 return nil 90 } 91 92 // MarshalBinary interface implementation 93 func (m *HealthStatusResponse) MarshalBinary() ([]byte, error) { 94 if m == nil { 95 return nil, nil 96 } 97 return swag.WriteJSON(m) 98 } 99 100 // UnmarshalBinary interface implementation 101 func (m *HealthStatusResponse) UnmarshalBinary(b []byte) error { 102 var res HealthStatusResponse 103 if err := swag.ReadJSON(b, &res); err != nil { 104 return err 105 } 106 *m = res 107 return nil 108 }