github.com/kubearmor/cilium@v1.6.12/api/v1/models/endpoint_configuration_status.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  // EndpointConfigurationStatus An endpoint's configuration
    16  // swagger:model EndpointConfigurationStatus
    17  type EndpointConfigurationStatus struct {
    18  
    19  	// Most recent error, if applicable
    20  	Error Error `json:"error,omitempty"`
    21  
    22  	// Immutable configuration (read-only)
    23  	Immutable ConfigurationMap `json:"immutable,omitempty"`
    24  
    25  	// currently applied changeable configuration
    26  	Realized *EndpointConfigurationSpec `json:"realized,omitempty"`
    27  }
    28  
    29  // Validate validates this endpoint configuration status
    30  func (m *EndpointConfigurationStatus) Validate(formats strfmt.Registry) error {
    31  	var res []error
    32  
    33  	if err := m.validateError(formats); err != nil {
    34  		res = append(res, err)
    35  	}
    36  
    37  	if err := m.validateImmutable(formats); err != nil {
    38  		res = append(res, err)
    39  	}
    40  
    41  	if err := m.validateRealized(formats); err != nil {
    42  		res = append(res, err)
    43  	}
    44  
    45  	if len(res) > 0 {
    46  		return errors.CompositeValidationError(res...)
    47  	}
    48  	return nil
    49  }
    50  
    51  func (m *EndpointConfigurationStatus) validateError(formats strfmt.Registry) error {
    52  
    53  	if swag.IsZero(m.Error) { // not required
    54  		return nil
    55  	}
    56  
    57  	if err := m.Error.Validate(formats); err != nil {
    58  		if ve, ok := err.(*errors.Validation); ok {
    59  			return ve.ValidateName("error")
    60  		}
    61  		return err
    62  	}
    63  
    64  	return nil
    65  }
    66  
    67  func (m *EndpointConfigurationStatus) validateImmutable(formats strfmt.Registry) error {
    68  
    69  	if swag.IsZero(m.Immutable) { // not required
    70  		return nil
    71  	}
    72  
    73  	if err := m.Immutable.Validate(formats); err != nil {
    74  		if ve, ok := err.(*errors.Validation); ok {
    75  			return ve.ValidateName("immutable")
    76  		}
    77  		return err
    78  	}
    79  
    80  	return nil
    81  }
    82  
    83  func (m *EndpointConfigurationStatus) validateRealized(formats strfmt.Registry) error {
    84  
    85  	if swag.IsZero(m.Realized) { // not required
    86  		return nil
    87  	}
    88  
    89  	if m.Realized != nil {
    90  		if err := m.Realized.Validate(formats); err != nil {
    91  			if ve, ok := err.(*errors.Validation); ok {
    92  				return ve.ValidateName("realized")
    93  			}
    94  			return err
    95  		}
    96  	}
    97  
    98  	return nil
    99  }
   100  
   101  // MarshalBinary interface implementation
   102  func (m *EndpointConfigurationStatus) 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 *EndpointConfigurationStatus) UnmarshalBinary(b []byte) error {
   111  	var res EndpointConfigurationStatus
   112  	if err := swag.ReadJSON(b, &res); err != nil {
   113  		return err
   114  	}
   115  	*m = res
   116  	return nil
   117  }