github.com/kubearmor/cilium@v1.6.12/api/v1/models/request_response_statistics.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  // RequestResponseStatistics Statistics of a proxy redirect
    16  // swagger:model RequestResponseStatistics
    17  // +k8s:deepcopy-gen=true
    18  type RequestResponseStatistics struct {
    19  
    20  	// requests
    21  	Requests *MessageForwardingStatistics `json:"requests,omitempty"`
    22  
    23  	// responses
    24  	Responses *MessageForwardingStatistics `json:"responses,omitempty"`
    25  }
    26  
    27  // Validate validates this request response statistics
    28  func (m *RequestResponseStatistics) Validate(formats strfmt.Registry) error {
    29  	var res []error
    30  
    31  	if err := m.validateRequests(formats); err != nil {
    32  		res = append(res, err)
    33  	}
    34  
    35  	if err := m.validateResponses(formats); err != nil {
    36  		res = append(res, err)
    37  	}
    38  
    39  	if len(res) > 0 {
    40  		return errors.CompositeValidationError(res...)
    41  	}
    42  	return nil
    43  }
    44  
    45  func (m *RequestResponseStatistics) validateRequests(formats strfmt.Registry) error {
    46  
    47  	if swag.IsZero(m.Requests) { // not required
    48  		return nil
    49  	}
    50  
    51  	if m.Requests != nil {
    52  		if err := m.Requests.Validate(formats); err != nil {
    53  			if ve, ok := err.(*errors.Validation); ok {
    54  				return ve.ValidateName("requests")
    55  			}
    56  			return err
    57  		}
    58  	}
    59  
    60  	return nil
    61  }
    62  
    63  func (m *RequestResponseStatistics) validateResponses(formats strfmt.Registry) error {
    64  
    65  	if swag.IsZero(m.Responses) { // not required
    66  		return nil
    67  	}
    68  
    69  	if m.Responses != nil {
    70  		if err := m.Responses.Validate(formats); err != nil {
    71  			if ve, ok := err.(*errors.Validation); ok {
    72  				return ve.ValidateName("responses")
    73  			}
    74  			return err
    75  		}
    76  	}
    77  
    78  	return nil
    79  }
    80  
    81  // MarshalBinary interface implementation
    82  func (m *RequestResponseStatistics) MarshalBinary() ([]byte, error) {
    83  	if m == nil {
    84  		return nil, nil
    85  	}
    86  	return swag.WriteJSON(m)
    87  }
    88  
    89  // UnmarshalBinary interface implementation
    90  func (m *RequestResponseStatistics) UnmarshalBinary(b []byte) error {
    91  	var res RequestResponseStatistics
    92  	if err := swag.ReadJSON(b, &res); err != nil {
    93  		return err
    94  	}
    95  	*m = res
    96  	return nil
    97  }