github.com/kubearmor/cilium@v1.6.12/api/v1/models/cluster_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 // ClusterStatus Status of cluster 18 // swagger:model ClusterStatus 19 // +k8s:deepcopy-gen=true 20 type ClusterStatus struct { 21 22 // Status of local cilium-health daemon 23 CiliumHealth *Status `json:"ciliumHealth,omitempty"` 24 25 // List of known nodes 26 Nodes []*NodeElement `json:"nodes"` 27 28 // Name of local node (if available) 29 Self string `json:"self,omitempty"` 30 } 31 32 // Validate validates this cluster status 33 func (m *ClusterStatus) Validate(formats strfmt.Registry) error { 34 var res []error 35 36 if err := m.validateCiliumHealth(formats); err != nil { 37 res = append(res, err) 38 } 39 40 if err := m.validateNodes(formats); err != nil { 41 res = append(res, err) 42 } 43 44 if len(res) > 0 { 45 return errors.CompositeValidationError(res...) 46 } 47 return nil 48 } 49 50 func (m *ClusterStatus) validateCiliumHealth(formats strfmt.Registry) error { 51 52 if swag.IsZero(m.CiliumHealth) { // not required 53 return nil 54 } 55 56 if m.CiliumHealth != nil { 57 if err := m.CiliumHealth.Validate(formats); err != nil { 58 if ve, ok := err.(*errors.Validation); ok { 59 return ve.ValidateName("ciliumHealth") 60 } 61 return err 62 } 63 } 64 65 return nil 66 } 67 68 func (m *ClusterStatus) validateNodes(formats strfmt.Registry) error { 69 70 if swag.IsZero(m.Nodes) { // not required 71 return nil 72 } 73 74 for i := 0; i < len(m.Nodes); i++ { 75 if swag.IsZero(m.Nodes[i]) { // not required 76 continue 77 } 78 79 if m.Nodes[i] != nil { 80 if err := m.Nodes[i].Validate(formats); err != nil { 81 if ve, ok := err.(*errors.Validation); ok { 82 return ve.ValidateName("nodes" + "." + strconv.Itoa(i)) 83 } 84 return err 85 } 86 } 87 88 } 89 90 return nil 91 } 92 93 // MarshalBinary interface implementation 94 func (m *ClusterStatus) MarshalBinary() ([]byte, error) { 95 if m == nil { 96 return nil, nil 97 } 98 return swag.WriteJSON(m) 99 } 100 101 // UnmarshalBinary interface implementation 102 func (m *ClusterStatus) UnmarshalBinary(b []byte) error { 103 var res ClusterStatus 104 if err := swag.ReadJSON(b, &res); err != nil { 105 return err 106 } 107 *m = res 108 return nil 109 }