github.com/cilium/cilium@v1.16.2/api/v1/models/policy.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/strfmt" 15 "github.com/go-openapi/swag" 16 ) 17 18 // Policy Policy definition 19 // 20 // swagger:model Policy 21 type Policy struct { 22 23 // Policy definition as JSON. 24 Policy string `json:"policy,omitempty"` 25 26 // Revision number of the policy. Incremented each time the policy is 27 // changed in the agent's repository 28 // 29 Revision int64 `json:"revision,omitempty"` 30 } 31 32 // Validate validates this policy 33 func (m *Policy) Validate(formats strfmt.Registry) error { 34 return nil 35 } 36 37 // ContextValidate validates this policy based on context it is used 38 func (m *Policy) ContextValidate(ctx context.Context, formats strfmt.Registry) error { 39 return nil 40 } 41 42 // MarshalBinary interface implementation 43 func (m *Policy) MarshalBinary() ([]byte, error) { 44 if m == nil { 45 return nil, nil 46 } 47 return swag.WriteJSON(m) 48 } 49 50 // UnmarshalBinary interface implementation 51 func (m *Policy) UnmarshalBinary(b []byte) error { 52 var res Policy 53 if err := swag.ReadJSON(b, &res); err != nil { 54 return err 55 } 56 *m = res 57 return nil 58 }