github.com/kubearmor/cilium@v1.6.12/api/v1/models/cluster_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 "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 // ClusterNodeStatus Status of cluster 18 // swagger:model ClusterNodeStatus 19 type ClusterNodeStatus struct { 20 21 // ID that should be used by the client to receive a diff from the previous request 22 ClientID int64 `json:"client-id,omitempty"` 23 24 // List of known nodes 25 NodesAdded []*NodeElement `json:"nodes-added"` 26 27 // List of known nodes 28 NodesRemoved []*NodeElement `json:"nodes-removed"` 29 30 // Name of local node (if available) 31 Self string `json:"self,omitempty"` 32 } 33 34 // Validate validates this cluster node status 35 func (m *ClusterNodeStatus) Validate(formats strfmt.Registry) error { 36 var res []error 37 38 if err := m.validateNodesAdded(formats); err != nil { 39 res = append(res, err) 40 } 41 42 if err := m.validateNodesRemoved(formats); err != nil { 43 res = append(res, err) 44 } 45 46 if len(res) > 0 { 47 return errors.CompositeValidationError(res...) 48 } 49 return nil 50 } 51 52 func (m *ClusterNodeStatus) validateNodesAdded(formats strfmt.Registry) error { 53 54 if swag.IsZero(m.NodesAdded) { // not required 55 return nil 56 } 57 58 for i := 0; i < len(m.NodesAdded); i++ { 59 if swag.IsZero(m.NodesAdded[i]) { // not required 60 continue 61 } 62 63 if m.NodesAdded[i] != nil { 64 if err := m.NodesAdded[i].Validate(formats); err != nil { 65 if ve, ok := err.(*errors.Validation); ok { 66 return ve.ValidateName("nodes-added" + "." + strconv.Itoa(i)) 67 } 68 return err 69 } 70 } 71 72 } 73 74 return nil 75 } 76 77 func (m *ClusterNodeStatus) validateNodesRemoved(formats strfmt.Registry) error { 78 79 if swag.IsZero(m.NodesRemoved) { // not required 80 return nil 81 } 82 83 for i := 0; i < len(m.NodesRemoved); i++ { 84 if swag.IsZero(m.NodesRemoved[i]) { // not required 85 continue 86 } 87 88 if m.NodesRemoved[i] != nil { 89 if err := m.NodesRemoved[i].Validate(formats); err != nil { 90 if ve, ok := err.(*errors.Validation); ok { 91 return ve.ValidateName("nodes-removed" + "." + strconv.Itoa(i)) 92 } 93 return err 94 } 95 } 96 97 } 98 99 return nil 100 } 101 102 // MarshalBinary interface implementation 103 func (m *ClusterNodeStatus) 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 *ClusterNodeStatus) UnmarshalBinary(b []byte) error { 112 var res ClusterNodeStatus 113 if err := swag.ReadJSON(b, &res); err != nil { 114 return err 115 } 116 *m = res 117 return nil 118 }