github.com/kubearmor/cilium@v1.6.12/api/v1/server/restapi/daemon/get_cluster_nodes_parameters.go (about)

     1  // Code generated by go-swagger; DO NOT EDIT.
     2  
     3  package daemon
     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  	"net/http"
    10  
    11  	"github.com/go-openapi/errors"
    12  	"github.com/go-openapi/runtime/middleware"
    13  	"github.com/go-openapi/swag"
    14  
    15  	strfmt "github.com/go-openapi/strfmt"
    16  )
    17  
    18  // NewGetClusterNodesParams creates a new GetClusterNodesParams object
    19  // no default values defined in spec.
    20  func NewGetClusterNodesParams() GetClusterNodesParams {
    21  
    22  	return GetClusterNodesParams{}
    23  }
    24  
    25  // GetClusterNodesParams contains all the bound params for the get cluster nodes operation
    26  // typically these are obtained from a http.Request
    27  //
    28  // swagger:parameters GetClusterNodes
    29  type GetClusterNodesParams struct {
    30  
    31  	// HTTP Request Object
    32  	HTTPRequest *http.Request `json:"-"`
    33  
    34  	/*Client UUID should be used when the client wants to request
    35  	a diff of nodes added and / or removed since the last time
    36  	that client has made a request.
    37  
    38  	  In: header
    39  	*/
    40  	ClientID *int64
    41  }
    42  
    43  // BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface
    44  // for simple values it will use straight method calls.
    45  //
    46  // To ensure default values, the struct must have been initialized with NewGetClusterNodesParams() beforehand.
    47  func (o *GetClusterNodesParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error {
    48  	var res []error
    49  
    50  	o.HTTPRequest = r
    51  
    52  	if err := o.bindClientID(r.Header[http.CanonicalHeaderKey("client-id")], true, route.Formats); err != nil {
    53  		res = append(res, err)
    54  	}
    55  
    56  	if len(res) > 0 {
    57  		return errors.CompositeValidationError(res...)
    58  	}
    59  	return nil
    60  }
    61  
    62  // bindClientID binds and validates parameter ClientID from header.
    63  func (o *GetClusterNodesParams) bindClientID(rawData []string, hasKey bool, formats strfmt.Registry) error {
    64  	var raw string
    65  	if len(rawData) > 0 {
    66  		raw = rawData[len(rawData)-1]
    67  	}
    68  
    69  	// Required: false
    70  
    71  	if raw == "" { // empty values pass all other validations
    72  		return nil
    73  	}
    74  
    75  	value, err := swag.ConvertInt64(raw)
    76  	if err != nil {
    77  		return errors.InvalidType("client-id", "header", "int64", raw)
    78  	}
    79  	o.ClientID = &value
    80  
    81  	return nil
    82  }