github.com/kubearmor/cilium@v1.6.12/api/v1/models/endpoint.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 // Endpoint An endpoint is a namespaced network interface to which cilium applies policies 16 // swagger:model Endpoint 17 type Endpoint struct { 18 19 // The cilium-agent-local ID of the endpoint 20 ID int64 `json:"id,omitempty"` 21 22 // The desired configuration state of the endpoint 23 Spec *EndpointConfigurationSpec `json:"spec,omitempty"` 24 25 // The desired and realized configuration state of the endpoint 26 Status *EndpointStatus `json:"status,omitempty"` 27 } 28 29 // Validate validates this endpoint 30 func (m *Endpoint) Validate(formats strfmt.Registry) error { 31 var res []error 32 33 if err := m.validateSpec(formats); err != nil { 34 res = append(res, err) 35 } 36 37 if err := m.validateStatus(formats); err != nil { 38 res = append(res, err) 39 } 40 41 if len(res) > 0 { 42 return errors.CompositeValidationError(res...) 43 } 44 return nil 45 } 46 47 func (m *Endpoint) validateSpec(formats strfmt.Registry) error { 48 49 if swag.IsZero(m.Spec) { // not required 50 return nil 51 } 52 53 if m.Spec != nil { 54 if err := m.Spec.Validate(formats); err != nil { 55 if ve, ok := err.(*errors.Validation); ok { 56 return ve.ValidateName("spec") 57 } 58 return err 59 } 60 } 61 62 return nil 63 } 64 65 func (m *Endpoint) validateStatus(formats strfmt.Registry) error { 66 67 if swag.IsZero(m.Status) { // not required 68 return nil 69 } 70 71 if m.Status != nil { 72 if err := m.Status.Validate(formats); err != nil { 73 if ve, ok := err.(*errors.Validation); ok { 74 return ve.ValidateName("status") 75 } 76 return err 77 } 78 } 79 80 return nil 81 } 82 83 // MarshalBinary interface implementation 84 func (m *Endpoint) MarshalBinary() ([]byte, error) { 85 if m == nil { 86 return nil, nil 87 } 88 return swag.WriteJSON(m) 89 } 90 91 // UnmarshalBinary interface implementation 92 func (m *Endpoint) UnmarshalBinary(b []byte) error { 93 var res Endpoint 94 if err := swag.ReadJSON(b, &res); err != nil { 95 return err 96 } 97 *m = res 98 return nil 99 }