github.com/kubearmor/cilium@v1.6.12/api/v1/models/debug_info.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  // DebugInfo groups some debugging related information on the agent
    18  // swagger:model DebugInfo
    19  type DebugInfo struct {
    20  
    21  	// cilium memory map
    22  	CiliumMemoryMap string `json:"cilium-memory-map,omitempty"`
    23  
    24  	// cilium nodemonitor memory map
    25  	CiliumNodemonitorMemoryMap string `json:"cilium-nodemonitor-memory-map,omitempty"`
    26  
    27  	// cilium status
    28  	CiliumStatus *StatusResponse `json:"cilium-status,omitempty"`
    29  
    30  	// cilium version
    31  	CiliumVersion string `json:"cilium-version,omitempty"`
    32  
    33  	// endpoint list
    34  	EndpointList []*Endpoint `json:"endpoint-list"`
    35  
    36  	// environment variables
    37  	EnvironmentVariables []string `json:"environment-variables"`
    38  
    39  	// kernel version
    40  	KernelVersion string `json:"kernel-version,omitempty"`
    41  
    42  	// policy
    43  	Policy *Policy `json:"policy,omitempty"`
    44  
    45  	// service list
    46  	ServiceList []*Service `json:"service-list"`
    47  
    48  	// subsystem
    49  	Subsystem map[string]string `json:"subsystem,omitempty"`
    50  }
    51  
    52  // Validate validates this debug info
    53  func (m *DebugInfo) Validate(formats strfmt.Registry) error {
    54  	var res []error
    55  
    56  	if err := m.validateCiliumStatus(formats); err != nil {
    57  		res = append(res, err)
    58  	}
    59  
    60  	if err := m.validateEndpointList(formats); err != nil {
    61  		res = append(res, err)
    62  	}
    63  
    64  	if err := m.validatePolicy(formats); err != nil {
    65  		res = append(res, err)
    66  	}
    67  
    68  	if err := m.validateServiceList(formats); err != nil {
    69  		res = append(res, err)
    70  	}
    71  
    72  	if len(res) > 0 {
    73  		return errors.CompositeValidationError(res...)
    74  	}
    75  	return nil
    76  }
    77  
    78  func (m *DebugInfo) validateCiliumStatus(formats strfmt.Registry) error {
    79  
    80  	if swag.IsZero(m.CiliumStatus) { // not required
    81  		return nil
    82  	}
    83  
    84  	if m.CiliumStatus != nil {
    85  		if err := m.CiliumStatus.Validate(formats); err != nil {
    86  			if ve, ok := err.(*errors.Validation); ok {
    87  				return ve.ValidateName("cilium-status")
    88  			}
    89  			return err
    90  		}
    91  	}
    92  
    93  	return nil
    94  }
    95  
    96  func (m *DebugInfo) validateEndpointList(formats strfmt.Registry) error {
    97  
    98  	if swag.IsZero(m.EndpointList) { // not required
    99  		return nil
   100  	}
   101  
   102  	for i := 0; i < len(m.EndpointList); i++ {
   103  		if swag.IsZero(m.EndpointList[i]) { // not required
   104  			continue
   105  		}
   106  
   107  		if m.EndpointList[i] != nil {
   108  			if err := m.EndpointList[i].Validate(formats); err != nil {
   109  				if ve, ok := err.(*errors.Validation); ok {
   110  					return ve.ValidateName("endpoint-list" + "." + strconv.Itoa(i))
   111  				}
   112  				return err
   113  			}
   114  		}
   115  
   116  	}
   117  
   118  	return nil
   119  }
   120  
   121  func (m *DebugInfo) validatePolicy(formats strfmt.Registry) error {
   122  
   123  	if swag.IsZero(m.Policy) { // not required
   124  		return nil
   125  	}
   126  
   127  	if m.Policy != nil {
   128  		if err := m.Policy.Validate(formats); err != nil {
   129  			if ve, ok := err.(*errors.Validation); ok {
   130  				return ve.ValidateName("policy")
   131  			}
   132  			return err
   133  		}
   134  	}
   135  
   136  	return nil
   137  }
   138  
   139  func (m *DebugInfo) validateServiceList(formats strfmt.Registry) error {
   140  
   141  	if swag.IsZero(m.ServiceList) { // not required
   142  		return nil
   143  	}
   144  
   145  	for i := 0; i < len(m.ServiceList); i++ {
   146  		if swag.IsZero(m.ServiceList[i]) { // not required
   147  			continue
   148  		}
   149  
   150  		if m.ServiceList[i] != nil {
   151  			if err := m.ServiceList[i].Validate(formats); err != nil {
   152  				if ve, ok := err.(*errors.Validation); ok {
   153  					return ve.ValidateName("service-list" + "." + strconv.Itoa(i))
   154  				}
   155  				return err
   156  			}
   157  		}
   158  
   159  	}
   160  
   161  	return nil
   162  }
   163  
   164  // MarshalBinary interface implementation
   165  func (m *DebugInfo) MarshalBinary() ([]byte, error) {
   166  	if m == nil {
   167  		return nil, nil
   168  	}
   169  	return swag.WriteJSON(m)
   170  }
   171  
   172  // UnmarshalBinary interface implementation
   173  func (m *DebugInfo) UnmarshalBinary(b []byte) error {
   174  	var res DebugInfo
   175  	if err := swag.ReadJSON(b, &res); err != nil {
   176  		return err
   177  	}
   178  	*m = res
   179  	return nil
   180  }