github.com/kubearmor/cilium@v1.6.12/api/v1/models/endpoint_policy_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 // EndpointPolicyStatus Policy information of an endpoint 18 // swagger:model EndpointPolicyStatus 19 type EndpointPolicyStatus struct { 20 21 // The policy revision currently enforced in the proxy for this endpoint 22 ProxyPolicyRevision int64 `json:"proxy-policy-revision,omitempty"` 23 24 // Statistics of the proxy redirects configured for this endpoint 25 ProxyStatistics []*ProxyStatistics `json:"proxy-statistics"` 26 27 // The policy in the datapath for this endpoint 28 Realized *EndpointPolicy `json:"realized,omitempty"` 29 30 // The policy that should apply to this endpoint 31 Spec *EndpointPolicy `json:"spec,omitempty"` 32 } 33 34 // Validate validates this endpoint policy status 35 func (m *EndpointPolicyStatus) Validate(formats strfmt.Registry) error { 36 var res []error 37 38 if err := m.validateProxyStatistics(formats); err != nil { 39 res = append(res, err) 40 } 41 42 if err := m.validateRealized(formats); err != nil { 43 res = append(res, err) 44 } 45 46 if err := m.validateSpec(formats); err != nil { 47 res = append(res, err) 48 } 49 50 if len(res) > 0 { 51 return errors.CompositeValidationError(res...) 52 } 53 return nil 54 } 55 56 func (m *EndpointPolicyStatus) validateProxyStatistics(formats strfmt.Registry) error { 57 58 if swag.IsZero(m.ProxyStatistics) { // not required 59 return nil 60 } 61 62 for i := 0; i < len(m.ProxyStatistics); i++ { 63 if swag.IsZero(m.ProxyStatistics[i]) { // not required 64 continue 65 } 66 67 if m.ProxyStatistics[i] != nil { 68 if err := m.ProxyStatistics[i].Validate(formats); err != nil { 69 if ve, ok := err.(*errors.Validation); ok { 70 return ve.ValidateName("proxy-statistics" + "." + strconv.Itoa(i)) 71 } 72 return err 73 } 74 } 75 76 } 77 78 return nil 79 } 80 81 func (m *EndpointPolicyStatus) validateRealized(formats strfmt.Registry) error { 82 83 if swag.IsZero(m.Realized) { // not required 84 return nil 85 } 86 87 if m.Realized != nil { 88 if err := m.Realized.Validate(formats); err != nil { 89 if ve, ok := err.(*errors.Validation); ok { 90 return ve.ValidateName("realized") 91 } 92 return err 93 } 94 } 95 96 return nil 97 } 98 99 func (m *EndpointPolicyStatus) validateSpec(formats strfmt.Registry) error { 100 101 if swag.IsZero(m.Spec) { // not required 102 return nil 103 } 104 105 if m.Spec != nil { 106 if err := m.Spec.Validate(formats); err != nil { 107 if ve, ok := err.(*errors.Validation); ok { 108 return ve.ValidateName("spec") 109 } 110 return err 111 } 112 } 113 114 return nil 115 } 116 117 // MarshalBinary interface implementation 118 func (m *EndpointPolicyStatus) MarshalBinary() ([]byte, error) { 119 if m == nil { 120 return nil, nil 121 } 122 return swag.WriteJSON(m) 123 } 124 125 // UnmarshalBinary interface implementation 126 func (m *EndpointPolicyStatus) UnmarshalBinary(b []byte) error { 127 var res EndpointPolicyStatus 128 if err := swag.ReadJSON(b, &res); err != nil { 129 return err 130 } 131 *m = res 132 return nil 133 }