Revision 9877e07c999219b3423ae83733376465f399c736 authored by Nicolas Busseneau on 15 October 2021, 15:02:17 UTC, committed by Nicolas Busseneau on 15 October 2021, 15:02:17 UTC
Signed-off-by: Nicolas Busseneau <nicolas@isovalent.com>
1 parent 2282066
l4_policy.go
// Code generated by go-swagger; DO NOT EDIT.
// Copyright 2017-2021 Authors of Cilium
// SPDX-License-Identifier: Apache-2.0
package models
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"strconv"
"github.com/go-openapi/errors"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
)
// L4Policy L4 endpoint policy
//
// +k8s:deepcopy-gen=true
//
// swagger:model L4Policy
type L4Policy struct {
// List of L4 egress rules
Egress []*PolicyRule `json:"egress"`
// List of L4 ingress rules
Ingress []*PolicyRule `json:"ingress"`
}
// Validate validates this l4 policy
func (m *L4Policy) Validate(formats strfmt.Registry) error {
var res []error
if err := m.validateEgress(formats); err != nil {
res = append(res, err)
}
if err := m.validateIngress(formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (m *L4Policy) validateEgress(formats strfmt.Registry) error {
if swag.IsZero(m.Egress) { // not required
return nil
}
for i := 0; i < len(m.Egress); i++ {
if swag.IsZero(m.Egress[i]) { // not required
continue
}
if m.Egress[i] != nil {
if err := m.Egress[i].Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("egress" + "." + strconv.Itoa(i))
}
return err
}
}
}
return nil
}
func (m *L4Policy) validateIngress(formats strfmt.Registry) error {
if swag.IsZero(m.Ingress) { // not required
return nil
}
for i := 0; i < len(m.Ingress); i++ {
if swag.IsZero(m.Ingress[i]) { // not required
continue
}
if m.Ingress[i] != nil {
if err := m.Ingress[i].Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("ingress" + "." + strconv.Itoa(i))
}
return err
}
}
}
return nil
}
// MarshalBinary interface implementation
func (m *L4Policy) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return swag.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *L4Policy) UnmarshalBinary(b []byte) error {
var res L4Policy
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*m = res
return nil
}
Computing file changes ...