github.com/kubearmor/cilium@v1.6.12/api/v1/models/identity_endpoints.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  // IdentityEndpoints Security identities owned by endpoints on the local node
    16  // swagger:model IdentityEndpoints
    17  type IdentityEndpoints struct {
    18  
    19  	// Security identity
    20  	Identity *Identity `json:"identity,omitempty"`
    21  
    22  	// number of endpoints consuming this identity locally (should always be > 0)
    23  	RefCount int64 `json:"refCount,omitempty"`
    24  }
    25  
    26  // Validate validates this identity endpoints
    27  func (m *IdentityEndpoints) Validate(formats strfmt.Registry) error {
    28  	var res []error
    29  
    30  	if err := m.validateIdentity(formats); err != nil {
    31  		res = append(res, err)
    32  	}
    33  
    34  	if len(res) > 0 {
    35  		return errors.CompositeValidationError(res...)
    36  	}
    37  	return nil
    38  }
    39  
    40  func (m *IdentityEndpoints) validateIdentity(formats strfmt.Registry) error {
    41  
    42  	if swag.IsZero(m.Identity) { // not required
    43  		return nil
    44  	}
    45  
    46  	if m.Identity != nil {
    47  		if err := m.Identity.Validate(formats); err != nil {
    48  			if ve, ok := err.(*errors.Validation); ok {
    49  				return ve.ValidateName("identity")
    50  			}
    51  			return err
    52  		}
    53  	}
    54  
    55  	return nil
    56  }
    57  
    58  // MarshalBinary interface implementation
    59  func (m *IdentityEndpoints) MarshalBinary() ([]byte, error) {
    60  	if m == nil {
    61  		return nil, nil
    62  	}
    63  	return swag.WriteJSON(m)
    64  }
    65  
    66  // UnmarshalBinary interface implementation
    67  func (m *IdentityEndpoints) UnmarshalBinary(b []byte) error {
    68  	var res IdentityEndpoints
    69  	if err := swag.ReadJSON(b, &res); err != nil {
    70  		return err
    71  	}
    72  	*m = res
    73  	return nil
    74  }