github.com/kubearmor/cilium@v1.6.12/api/v1/models/node_element.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 // NodeElement Known node in the cluster 18 // swagger:model NodeElement 19 // +k8s:deepcopy-gen=true 20 type NodeElement struct { 21 22 // Address used for probing cluster connectivity 23 HealthEndpointAddress *NodeAddressing `json:"health-endpoint-address,omitempty"` 24 25 // Name of the node including the cluster association. This is typically 26 // <clustername>/<hostname>. 27 // 28 Name string `json:"name,omitempty"` 29 30 // Primary address used for intra-cluster communication 31 PrimaryAddress *NodeAddressing `json:"primary-address,omitempty"` 32 33 // Alternative addresses assigned to the node 34 SecondaryAddresses []*NodeAddressingElement `json:"secondary-addresses"` 35 } 36 37 // Validate validates this node element 38 func (m *NodeElement) Validate(formats strfmt.Registry) error { 39 var res []error 40 41 if err := m.validateHealthEndpointAddress(formats); err != nil { 42 res = append(res, err) 43 } 44 45 if err := m.validatePrimaryAddress(formats); err != nil { 46 res = append(res, err) 47 } 48 49 if err := m.validateSecondaryAddresses(formats); err != nil { 50 res = append(res, err) 51 } 52 53 if len(res) > 0 { 54 return errors.CompositeValidationError(res...) 55 } 56 return nil 57 } 58 59 func (m *NodeElement) validateHealthEndpointAddress(formats strfmt.Registry) error { 60 61 if swag.IsZero(m.HealthEndpointAddress) { // not required 62 return nil 63 } 64 65 if m.HealthEndpointAddress != nil { 66 if err := m.HealthEndpointAddress.Validate(formats); err != nil { 67 if ve, ok := err.(*errors.Validation); ok { 68 return ve.ValidateName("health-endpoint-address") 69 } 70 return err 71 } 72 } 73 74 return nil 75 } 76 77 func (m *NodeElement) validatePrimaryAddress(formats strfmt.Registry) error { 78 79 if swag.IsZero(m.PrimaryAddress) { // not required 80 return nil 81 } 82 83 if m.PrimaryAddress != nil { 84 if err := m.PrimaryAddress.Validate(formats); err != nil { 85 if ve, ok := err.(*errors.Validation); ok { 86 return ve.ValidateName("primary-address") 87 } 88 return err 89 } 90 } 91 92 return nil 93 } 94 95 func (m *NodeElement) validateSecondaryAddresses(formats strfmt.Registry) error { 96 97 if swag.IsZero(m.SecondaryAddresses) { // not required 98 return nil 99 } 100 101 for i := 0; i < len(m.SecondaryAddresses); i++ { 102 if swag.IsZero(m.SecondaryAddresses[i]) { // not required 103 continue 104 } 105 106 if m.SecondaryAddresses[i] != nil { 107 if err := m.SecondaryAddresses[i].Validate(formats); err != nil { 108 if ve, ok := err.(*errors.Validation); ok { 109 return ve.ValidateName("secondary-addresses" + "." + strconv.Itoa(i)) 110 } 111 return err 112 } 113 } 114 115 } 116 117 return nil 118 } 119 120 // MarshalBinary interface implementation 121 func (m *NodeElement) MarshalBinary() ([]byte, error) { 122 if m == nil { 123 return nil, nil 124 } 125 return swag.WriteJSON(m) 126 } 127 128 // UnmarshalBinary interface implementation 129 func (m *NodeElement) UnmarshalBinary(b []byte) error { 130 var res NodeElement 131 if err := swag.ReadJSON(b, &res); err != nil { 132 return err 133 } 134 *m = res 135 return nil 136 }