github.com/cilium/cilium@v1.16.2/api/v1/models/prefilter_status.go (about) 1 // Code generated by go-swagger; DO NOT EDIT. 2 3 // Copyright Authors of Cilium 4 // SPDX-License-Identifier: Apache-2.0 5 6 package models 7 8 // This file was generated by the swagger tool. 9 // Editing this file might prove futile when you re-run the swagger generate command 10 11 import ( 12 "context" 13 14 "github.com/go-openapi/errors" 15 "github.com/go-openapi/strfmt" 16 "github.com/go-openapi/swag" 17 ) 18 19 // PrefilterStatus CIDR ranges implemented in the Prefilter 20 // 21 // swagger:model PrefilterStatus 22 type PrefilterStatus struct { 23 24 // realized 25 Realized *PrefilterSpec `json:"realized,omitempty"` 26 } 27 28 // Validate validates this prefilter status 29 func (m *PrefilterStatus) Validate(formats strfmt.Registry) error { 30 var res []error 31 32 if err := m.validateRealized(formats); err != nil { 33 res = append(res, err) 34 } 35 36 if len(res) > 0 { 37 return errors.CompositeValidationError(res...) 38 } 39 return nil 40 } 41 42 func (m *PrefilterStatus) validateRealized(formats strfmt.Registry) error { 43 if swag.IsZero(m.Realized) { // not required 44 return nil 45 } 46 47 if m.Realized != nil { 48 if err := m.Realized.Validate(formats); err != nil { 49 if ve, ok := err.(*errors.Validation); ok { 50 return ve.ValidateName("realized") 51 } else if ce, ok := err.(*errors.CompositeError); ok { 52 return ce.ValidateName("realized") 53 } 54 return err 55 } 56 } 57 58 return nil 59 } 60 61 // ContextValidate validate this prefilter status based on the context it is used 62 func (m *PrefilterStatus) ContextValidate(ctx context.Context, formats strfmt.Registry) error { 63 var res []error 64 65 if err := m.contextValidateRealized(ctx, formats); err != nil { 66 res = append(res, err) 67 } 68 69 if len(res) > 0 { 70 return errors.CompositeValidationError(res...) 71 } 72 return nil 73 } 74 75 func (m *PrefilterStatus) contextValidateRealized(ctx context.Context, formats strfmt.Registry) error { 76 77 if m.Realized != nil { 78 79 if swag.IsZero(m.Realized) { // not required 80 return nil 81 } 82 83 if err := m.Realized.ContextValidate(ctx, formats); err != nil { 84 if ve, ok := err.(*errors.Validation); ok { 85 return ve.ValidateName("realized") 86 } else if ce, ok := err.(*errors.CompositeError); ok { 87 return ce.ValidateName("realized") 88 } 89 return err 90 } 91 } 92 93 return nil 94 } 95 96 // MarshalBinary interface implementation 97 func (m *PrefilterStatus) MarshalBinary() ([]byte, error) { 98 if m == nil { 99 return nil, nil 100 } 101 return swag.WriteJSON(m) 102 } 103 104 // UnmarshalBinary interface implementation 105 func (m *PrefilterStatus) UnmarshalBinary(b []byte) error { 106 var res PrefilterStatus 107 if err := swag.ReadJSON(b, &res); err != nil { 108 return err 109 } 110 *m = res 111 return nil 112 }