github.com/kubearmor/cilium@v1.6.12/api/v1/models/endpoint_configuration_spec.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  // EndpointConfigurationSpec An endpoint's configuration
    16  // swagger:model EndpointConfigurationSpec
    17  type EndpointConfigurationSpec struct {
    18  
    19  	// the endpoint's labels
    20  	LabelConfiguration *LabelConfigurationSpec `json:"label-configuration,omitempty"`
    21  
    22  	// Changeable configuration
    23  	Options ConfigurationMap `json:"options,omitempty"`
    24  }
    25  
    26  // Validate validates this endpoint configuration spec
    27  func (m *EndpointConfigurationSpec) Validate(formats strfmt.Registry) error {
    28  	var res []error
    29  
    30  	if err := m.validateLabelConfiguration(formats); err != nil {
    31  		res = append(res, err)
    32  	}
    33  
    34  	if err := m.validateOptions(formats); err != nil {
    35  		res = append(res, err)
    36  	}
    37  
    38  	if len(res) > 0 {
    39  		return errors.CompositeValidationError(res...)
    40  	}
    41  	return nil
    42  }
    43  
    44  func (m *EndpointConfigurationSpec) validateLabelConfiguration(formats strfmt.Registry) error {
    45  
    46  	if swag.IsZero(m.LabelConfiguration) { // not required
    47  		return nil
    48  	}
    49  
    50  	if m.LabelConfiguration != nil {
    51  		if err := m.LabelConfiguration.Validate(formats); err != nil {
    52  			if ve, ok := err.(*errors.Validation); ok {
    53  				return ve.ValidateName("label-configuration")
    54  			}
    55  			return err
    56  		}
    57  	}
    58  
    59  	return nil
    60  }
    61  
    62  func (m *EndpointConfigurationSpec) validateOptions(formats strfmt.Registry) error {
    63  
    64  	if swag.IsZero(m.Options) { // not required
    65  		return nil
    66  	}
    67  
    68  	if err := m.Options.Validate(formats); err != nil {
    69  		if ve, ok := err.(*errors.Validation); ok {
    70  			return ve.ValidateName("options")
    71  		}
    72  		return err
    73  	}
    74  
    75  	return nil
    76  }
    77  
    78  // MarshalBinary interface implementation
    79  func (m *EndpointConfigurationSpec) MarshalBinary() ([]byte, error) {
    80  	if m == nil {
    81  		return nil, nil
    82  	}
    83  	return swag.WriteJSON(m)
    84  }
    85  
    86  // UnmarshalBinary interface implementation
    87  func (m *EndpointConfigurationSpec) UnmarshalBinary(b []byte) error {
    88  	var res EndpointConfigurationSpec
    89  	if err := swag.ReadJSON(b, &res); err != nil {
    90  		return err
    91  	}
    92  	*m = res
    93  	return nil
    94  }