github.com/cilium/cilium@v1.16.2/api/v1/server/restapi/daemon/get_map_name_events_parameters.go (about)

     1  // Code generated by go-swagger; DO NOT EDIT.
     2  
     3  // Copyright Authors of Cilium
     4  // SPDX-License-Identifier: Apache-2.0
     5  
     6  package daemon
     7  
     8  // This file was generated by the swagger tool.
     9  // Editing this file might prove futile when you re-run the swagger generate command
    10  
    11  import (
    12  	"net/http"
    13  
    14  	"github.com/go-openapi/errors"
    15  	"github.com/go-openapi/runtime"
    16  	"github.com/go-openapi/runtime/middleware"
    17  	"github.com/go-openapi/strfmt"
    18  	"github.com/go-openapi/swag"
    19  )
    20  
    21  // NewGetMapNameEventsParams creates a new GetMapNameEventsParams object
    22  //
    23  // There are no default values defined in the spec.
    24  func NewGetMapNameEventsParams() GetMapNameEventsParams {
    25  
    26  	return GetMapNameEventsParams{}
    27  }
    28  
    29  // GetMapNameEventsParams contains all the bound params for the get map name events operation
    30  // typically these are obtained from a http.Request
    31  //
    32  // swagger:parameters GetMapNameEvents
    33  type GetMapNameEventsParams struct {
    34  
    35  	// HTTP Request Object
    36  	HTTPRequest *http.Request `json:"-"`
    37  
    38  	/*Whether to follow streamed requests
    39  	  In: query
    40  	*/
    41  	Follow *bool
    42  	/*Name of map
    43  	  Required: true
    44  	  In: path
    45  	*/
    46  	Name string
    47  }
    48  
    49  // BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface
    50  // for simple values it will use straight method calls.
    51  //
    52  // To ensure default values, the struct must have been initialized with NewGetMapNameEventsParams() beforehand.
    53  func (o *GetMapNameEventsParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error {
    54  	var res []error
    55  
    56  	o.HTTPRequest = r
    57  
    58  	qs := runtime.Values(r.URL.Query())
    59  
    60  	qFollow, qhkFollow, _ := qs.GetOK("follow")
    61  	if err := o.bindFollow(qFollow, qhkFollow, route.Formats); err != nil {
    62  		res = append(res, err)
    63  	}
    64  
    65  	rName, rhkName, _ := route.Params.GetOK("name")
    66  	if err := o.bindName(rName, rhkName, route.Formats); err != nil {
    67  		res = append(res, err)
    68  	}
    69  	if len(res) > 0 {
    70  		return errors.CompositeValidationError(res...)
    71  	}
    72  	return nil
    73  }
    74  
    75  // bindFollow binds and validates parameter Follow from query.
    76  func (o *GetMapNameEventsParams) bindFollow(rawData []string, hasKey bool, formats strfmt.Registry) error {
    77  	var raw string
    78  	if len(rawData) > 0 {
    79  		raw = rawData[len(rawData)-1]
    80  	}
    81  
    82  	// Required: false
    83  	// AllowEmptyValue: false
    84  
    85  	if raw == "" { // empty values pass all other validations
    86  		return nil
    87  	}
    88  
    89  	value, err := swag.ConvertBool(raw)
    90  	if err != nil {
    91  		return errors.InvalidType("follow", "query", "bool", raw)
    92  	}
    93  	o.Follow = &value
    94  
    95  	return nil
    96  }
    97  
    98  // bindName binds and validates parameter Name from path.
    99  func (o *GetMapNameEventsParams) bindName(rawData []string, hasKey bool, formats strfmt.Registry) error {
   100  	var raw string
   101  	if len(rawData) > 0 {
   102  		raw = rawData[len(rawData)-1]
   103  	}
   104  
   105  	// Required: true
   106  	// Parameter is provided by construction from the route
   107  	o.Name = raw
   108  
   109  	return nil
   110  }