github.com/kubearmor/cilium@v1.6.12/api/v1/models/endpoint_networking.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  // EndpointNetworking Unique identifiers for this endpoint from outside cilium
    18  // swagger:model EndpointNetworking
    19  type EndpointNetworking struct {
    20  
    21  	// IP4/6 addresses assigned to this Endpoint
    22  	Addressing []*AddressPair `json:"addressing"`
    23  
    24  	// host addressing
    25  	HostAddressing *NodeAddressing `json:"host-addressing,omitempty"`
    26  
    27  	// MAC address
    28  	HostMac string `json:"host-mac,omitempty"`
    29  
    30  	// Index of network device
    31  	InterfaceIndex int64 `json:"interface-index,omitempty"`
    32  
    33  	// Name of network device
    34  	InterfaceName string `json:"interface-name,omitempty"`
    35  
    36  	// MAC address
    37  	Mac string `json:"mac,omitempty"`
    38  }
    39  
    40  // Validate validates this endpoint networking
    41  func (m *EndpointNetworking) Validate(formats strfmt.Registry) error {
    42  	var res []error
    43  
    44  	if err := m.validateAddressing(formats); err != nil {
    45  		res = append(res, err)
    46  	}
    47  
    48  	if err := m.validateHostAddressing(formats); err != nil {
    49  		res = append(res, err)
    50  	}
    51  
    52  	if len(res) > 0 {
    53  		return errors.CompositeValidationError(res...)
    54  	}
    55  	return nil
    56  }
    57  
    58  func (m *EndpointNetworking) validateAddressing(formats strfmt.Registry) error {
    59  
    60  	if swag.IsZero(m.Addressing) { // not required
    61  		return nil
    62  	}
    63  
    64  	for i := 0; i < len(m.Addressing); i++ {
    65  		if swag.IsZero(m.Addressing[i]) { // not required
    66  			continue
    67  		}
    68  
    69  		if m.Addressing[i] != nil {
    70  			if err := m.Addressing[i].Validate(formats); err != nil {
    71  				if ve, ok := err.(*errors.Validation); ok {
    72  					return ve.ValidateName("addressing" + "." + strconv.Itoa(i))
    73  				}
    74  				return err
    75  			}
    76  		}
    77  
    78  	}
    79  
    80  	return nil
    81  }
    82  
    83  func (m *EndpointNetworking) validateHostAddressing(formats strfmt.Registry) error {
    84  
    85  	if swag.IsZero(m.HostAddressing) { // not required
    86  		return nil
    87  	}
    88  
    89  	if m.HostAddressing != nil {
    90  		if err := m.HostAddressing.Validate(formats); err != nil {
    91  			if ve, ok := err.(*errors.Validation); ok {
    92  				return ve.ValidateName("host-addressing")
    93  			}
    94  			return err
    95  		}
    96  	}
    97  
    98  	return nil
    99  }
   100  
   101  // MarshalBinary interface implementation
   102  func (m *EndpointNetworking) MarshalBinary() ([]byte, error) {
   103  	if m == nil {
   104  		return nil, nil
   105  	}
   106  	return swag.WriteJSON(m)
   107  }
   108  
   109  // UnmarshalBinary interface implementation
   110  func (m *EndpointNetworking) UnmarshalBinary(b []byte) error {
   111  	var res EndpointNetworking
   112  	if err := swag.ReadJSON(b, &res); err != nil {
   113  		return err
   114  	}
   115  	*m = res
   116  	return nil
   117  }