github.com/kubearmor/cilium@v1.6.12/api/v1/models/node_addressing.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 // NodeAddressing Addressing information of a node for all address families 16 // swagger:model NodeAddressing 17 // +k8s:deepcopy-gen=true 18 type NodeAddressing struct { 19 20 // ipv4 21 IPV4 *NodeAddressingElement `json:"ipv4,omitempty"` 22 23 // ipv6 24 IPV6 *NodeAddressingElement `json:"ipv6,omitempty"` 25 } 26 27 // Validate validates this node addressing 28 func (m *NodeAddressing) Validate(formats strfmt.Registry) error { 29 var res []error 30 31 if err := m.validateIPV4(formats); err != nil { 32 res = append(res, err) 33 } 34 35 if err := m.validateIPV6(formats); err != nil { 36 res = append(res, err) 37 } 38 39 if len(res) > 0 { 40 return errors.CompositeValidationError(res...) 41 } 42 return nil 43 } 44 45 func (m *NodeAddressing) validateIPV4(formats strfmt.Registry) error { 46 47 if swag.IsZero(m.IPV4) { // not required 48 return nil 49 } 50 51 if m.IPV4 != nil { 52 if err := m.IPV4.Validate(formats); err != nil { 53 if ve, ok := err.(*errors.Validation); ok { 54 return ve.ValidateName("ipv4") 55 } 56 return err 57 } 58 } 59 60 return nil 61 } 62 63 func (m *NodeAddressing) validateIPV6(formats strfmt.Registry) error { 64 65 if swag.IsZero(m.IPV6) { // not required 66 return nil 67 } 68 69 if m.IPV6 != nil { 70 if err := m.IPV6.Validate(formats); err != nil { 71 if ve, ok := err.(*errors.Validation); ok { 72 return ve.ValidateName("ipv6") 73 } 74 return err 75 } 76 } 77 78 return nil 79 } 80 81 // MarshalBinary interface implementation 82 func (m *NodeAddressing) MarshalBinary() ([]byte, error) { 83 if m == nil { 84 return nil, nil 85 } 86 return swag.WriteJSON(m) 87 } 88 89 // UnmarshalBinary interface implementation 90 func (m *NodeAddressing) UnmarshalBinary(b []byte) error { 91 var res NodeAddressing 92 if err := swag.ReadJSON(b, &res); err != nil { 93 return err 94 } 95 *m = res 96 return nil 97 }