github.com/cilium/cilium@v1.16.2/api/v1/models/policy_rule.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 // PolicyRule A policy rule including the rule labels it derives from 19 // 20 // +k8s:deepcopy-gen=true 21 // 22 // swagger:model PolicyRule 23 type PolicyRule struct { 24 25 // The policy rule labels identifying the policy rules this rule derives from 26 DerivedFromRules [][]string `json:"derived-from-rules"` 27 28 // The policy rule as json 29 Rule string `json:"rule,omitempty"` 30 31 // The policy rule labels identifying the policy rules this rule derives from, mapped by selector 32 RulesBySelector map[string][][]string `json:"rules-by-selector,omitempty"` 33 } 34 35 // Validate validates this policy rule 36 func (m *PolicyRule) Validate(formats strfmt.Registry) error { 37 return nil 38 } 39 40 // ContextValidate validates this policy rule based on context it is used 41 func (m *PolicyRule) ContextValidate(ctx context.Context, formats strfmt.Registry) error { 42 return nil 43 } 44 45 // MarshalBinary interface implementation 46 func (m *PolicyRule) MarshalBinary() ([]byte, error) { 47 if m == nil { 48 return nil, nil 49 } 50 return swag.WriteJSON(m) 51 } 52 53 // UnmarshalBinary interface implementation 54 func (m *PolicyRule) UnmarshalBinary(b []byte) error { 55 var res PolicyRule 56 if err := swag.ReadJSON(b, &res); err != nil { 57 return err 58 } 59 *m = res 60 return nil 61 }