github.com/kubearmor/cilium@v1.6.12/api/v1/models/endpoint_change_request.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  	strfmt "github.com/go-openapi/strfmt"
    10  
    11  	"github.com/go-openapi/errors"
    12  	"github.com/go-openapi/swag"
    13  )
    14  
    15  // EndpointChangeRequest Structure which contains the mutable elements of an Endpoint.
    16  //
    17  // swagger:model EndpointChangeRequest
    18  type EndpointChangeRequest struct {
    19  
    20  	// addressing
    21  	Addressing *AddressPair `json:"addressing,omitempty"`
    22  
    23  	// ID assigned by container runtime
    24  	ContainerID string `json:"container-id,omitempty"`
    25  
    26  	// Name assigned to container
    27  	ContainerName string `json:"container-name,omitempty"`
    28  
    29  	// datapath configuration
    30  	DatapathConfiguration *EndpointDatapathConfiguration `json:"datapath-configuration,omitempty"`
    31  
    32  	// ID of datapath tail call map
    33  	DatapathMapID int64 `json:"datapath-map-id,omitempty"`
    34  
    35  	// Docker endpoint ID
    36  	DockerEndpointID string `json:"docker-endpoint-id,omitempty"`
    37  
    38  	// Docker network ID
    39  	DockerNetworkID string `json:"docker-network-id,omitempty"`
    40  
    41  	// MAC address
    42  	HostMac string `json:"host-mac,omitempty"`
    43  
    44  	// Local endpoint ID
    45  	ID int64 `json:"id,omitempty"`
    46  
    47  	// Index of network device
    48  	InterfaceIndex int64 `json:"interface-index,omitempty"`
    49  
    50  	// Name of network device
    51  	InterfaceName string `json:"interface-name,omitempty"`
    52  
    53  	// Kubernetes namespace name
    54  	K8sNamespace string `json:"k8s-namespace,omitempty"`
    55  
    56  	// Kubernetes pod name
    57  	K8sPodName string `json:"k8s-pod-name,omitempty"`
    58  
    59  	// Labels describing the identity
    60  	Labels Labels `json:"labels,omitempty"`
    61  
    62  	// MAC address
    63  	Mac string `json:"mac,omitempty"`
    64  
    65  	// Process ID of the workload belonging to this endpoint
    66  	Pid int64 `json:"pid,omitempty"`
    67  
    68  	// Whether policy enforcement is enabled or not
    69  	PolicyEnabled bool `json:"policy-enabled,omitempty"`
    70  
    71  	// Current state of endpoint
    72  	// Required: true
    73  	State EndpointState `json:"state"`
    74  
    75  	// Whether to build an endpoint synchronously
    76  	//
    77  	SyncBuildEndpoint bool `json:"sync-build-endpoint,omitempty"`
    78  }
    79  
    80  // Validate validates this endpoint change request
    81  func (m *EndpointChangeRequest) Validate(formats strfmt.Registry) error {
    82  	var res []error
    83  
    84  	if err := m.validateAddressing(formats); err != nil {
    85  		res = append(res, err)
    86  	}
    87  
    88  	if err := m.validateDatapathConfiguration(formats); err != nil {
    89  		res = append(res, err)
    90  	}
    91  
    92  	if err := m.validateLabels(formats); err != nil {
    93  		res = append(res, err)
    94  	}
    95  
    96  	if err := m.validateState(formats); err != nil {
    97  		res = append(res, err)
    98  	}
    99  
   100  	if len(res) > 0 {
   101  		return errors.CompositeValidationError(res...)
   102  	}
   103  	return nil
   104  }
   105  
   106  func (m *EndpointChangeRequest) validateAddressing(formats strfmt.Registry) error {
   107  
   108  	if swag.IsZero(m.Addressing) { // not required
   109  		return nil
   110  	}
   111  
   112  	if m.Addressing != nil {
   113  		if err := m.Addressing.Validate(formats); err != nil {
   114  			if ve, ok := err.(*errors.Validation); ok {
   115  				return ve.ValidateName("addressing")
   116  			}
   117  			return err
   118  		}
   119  	}
   120  
   121  	return nil
   122  }
   123  
   124  func (m *EndpointChangeRequest) validateDatapathConfiguration(formats strfmt.Registry) error {
   125  
   126  	if swag.IsZero(m.DatapathConfiguration) { // not required
   127  		return nil
   128  	}
   129  
   130  	if m.DatapathConfiguration != nil {
   131  		if err := m.DatapathConfiguration.Validate(formats); err != nil {
   132  			if ve, ok := err.(*errors.Validation); ok {
   133  				return ve.ValidateName("datapath-configuration")
   134  			}
   135  			return err
   136  		}
   137  	}
   138  
   139  	return nil
   140  }
   141  
   142  func (m *EndpointChangeRequest) validateLabels(formats strfmt.Registry) error {
   143  
   144  	if swag.IsZero(m.Labels) { // not required
   145  		return nil
   146  	}
   147  
   148  	if err := m.Labels.Validate(formats); err != nil {
   149  		if ve, ok := err.(*errors.Validation); ok {
   150  			return ve.ValidateName("labels")
   151  		}
   152  		return err
   153  	}
   154  
   155  	return nil
   156  }
   157  
   158  func (m *EndpointChangeRequest) validateState(formats strfmt.Registry) error {
   159  
   160  	if err := m.State.Validate(formats); err != nil {
   161  		if ve, ok := err.(*errors.Validation); ok {
   162  			return ve.ValidateName("state")
   163  		}
   164  		return err
   165  	}
   166  
   167  	return nil
   168  }
   169  
   170  // MarshalBinary interface implementation
   171  func (m *EndpointChangeRequest) MarshalBinary() ([]byte, error) {
   172  	if m == nil {
   173  		return nil, nil
   174  	}
   175  	return swag.WriteJSON(m)
   176  }
   177  
   178  // UnmarshalBinary interface implementation
   179  func (m *EndpointChangeRequest) UnmarshalBinary(b []byte) error {
   180  	var res EndpointChangeRequest
   181  	if err := swag.ReadJSON(b, &res); err != nil {
   182  		return err
   183  	}
   184  	*m = res
   185  	return nil
   186  }