github.com/kubearmor/cilium@v1.6.12/api/v1/health/models/node_status.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 // NodeStatus Connectivity status of a remote cilium-health instance 16 // swagger:model NodeStatus 17 type NodeStatus struct { 18 19 // Connectivity status to simulated endpoint on node IP 20 Endpoint *PathStatus `json:"endpoint,omitempty"` 21 22 // Connectivity status to cilium-health instance on node IP 23 Host *HostStatus `json:"host,omitempty"` 24 25 // Identifying name for the node 26 Name string `json:"name,omitempty"` 27 } 28 29 // Validate validates this node status 30 func (m *NodeStatus) Validate(formats strfmt.Registry) error { 31 var res []error 32 33 if err := m.validateEndpoint(formats); err != nil { 34 res = append(res, err) 35 } 36 37 if err := m.validateHost(formats); err != nil { 38 res = append(res, err) 39 } 40 41 if len(res) > 0 { 42 return errors.CompositeValidationError(res...) 43 } 44 return nil 45 } 46 47 func (m *NodeStatus) validateEndpoint(formats strfmt.Registry) error { 48 49 if swag.IsZero(m.Endpoint) { // not required 50 return nil 51 } 52 53 if m.Endpoint != nil { 54 if err := m.Endpoint.Validate(formats); err != nil { 55 if ve, ok := err.(*errors.Validation); ok { 56 return ve.ValidateName("endpoint") 57 } 58 return err 59 } 60 } 61 62 return nil 63 } 64 65 func (m *NodeStatus) validateHost(formats strfmt.Registry) error { 66 67 if swag.IsZero(m.Host) { // not required 68 return nil 69 } 70 71 if m.Host != nil { 72 if err := m.Host.Validate(formats); err != nil { 73 if ve, ok := err.(*errors.Validation); ok { 74 return ve.ValidateName("host") 75 } 76 return err 77 } 78 } 79 80 return nil 81 } 82 83 // MarshalBinary interface implementation 84 func (m *NodeStatus) MarshalBinary() ([]byte, error) { 85 if m == nil { 86 return nil, nil 87 } 88 return swag.WriteJSON(m) 89 } 90 91 // UnmarshalBinary interface implementation 92 func (m *NodeStatus) UnmarshalBinary(b []byte) error { 93 var res NodeStatus 94 if err := swag.ReadJSON(b, &res); err != nil { 95 return err 96 } 97 *m = res 98 return nil 99 }