github.com/kubearmor/cilium@v1.6.12/api/v1/models/cluster_nodes_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 // ClusterNodesResponse cluster nodes response 18 // swagger:model ClusterNodesResponse 19 type ClusterNodesResponse struct { 20 21 // List of known nodes 22 Nodes []*NodeElement `json:"nodes"` 23 24 // Name of local node (if available) 25 Self string `json:"self,omitempty"` 26 } 27 28 // Validate validates this cluster nodes response 29 func (m *ClusterNodesResponse) Validate(formats strfmt.Registry) error { 30 var res []error 31 32 if err := m.validateNodes(formats); err != nil { 33 res = append(res, err) 34 } 35 36 if len(res) > 0 { 37 return errors.CompositeValidationError(res...) 38 } 39 return nil 40 } 41 42 func (m *ClusterNodesResponse) validateNodes(formats strfmt.Registry) error { 43 44 if swag.IsZero(m.Nodes) { // not required 45 return nil 46 } 47 48 for i := 0; i < len(m.Nodes); i++ { 49 if swag.IsZero(m.Nodes[i]) { // not required 50 continue 51 } 52 53 if m.Nodes[i] != nil { 54 if err := m.Nodes[i].Validate(formats); err != nil { 55 if ve, ok := err.(*errors.Validation); ok { 56 return ve.ValidateName("nodes" + "." + strconv.Itoa(i)) 57 } 58 return err 59 } 60 } 61 62 } 63 64 return nil 65 } 66 67 // MarshalBinary interface implementation 68 func (m *ClusterNodesResponse) MarshalBinary() ([]byte, error) { 69 if m == nil { 70 return nil, nil 71 } 72 return swag.WriteJSON(m) 73 } 74 75 // UnmarshalBinary interface implementation 76 func (m *ClusterNodesResponse) UnmarshalBinary(b []byte) error { 77 var res ClusterNodesResponse 78 if err := swag.ReadJSON(b, &res); err != nil { 79 return err 80 } 81 *m = res 82 return nil 83 }