github.com/cilium/cilium@v1.16.2/api/v1/server/restapi/daemon/get_map_name_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/middleware"
    16  	"github.com/go-openapi/strfmt"
    17  )
    18  
    19  // NewGetMapNameParams creates a new GetMapNameParams object
    20  //
    21  // There are no default values defined in the spec.
    22  func NewGetMapNameParams() GetMapNameParams {
    23  
    24  	return GetMapNameParams{}
    25  }
    26  
    27  // GetMapNameParams contains all the bound params for the get map name operation
    28  // typically these are obtained from a http.Request
    29  //
    30  // swagger:parameters GetMapName
    31  type GetMapNameParams struct {
    32  
    33  	// HTTP Request Object
    34  	HTTPRequest *http.Request `json:"-"`
    35  
    36  	/*Name of map
    37  	  Required: true
    38  	  In: path
    39  	*/
    40  	Name string
    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 NewGetMapNameParams() beforehand.
    47  func (o *GetMapNameParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error {
    48  	var res []error
    49  
    50  	o.HTTPRequest = r
    51  
    52  	rName, rhkName, _ := route.Params.GetOK("name")
    53  	if err := o.bindName(rName, rhkName, route.Formats); err != nil {
    54  		res = append(res, err)
    55  	}
    56  	if len(res) > 0 {
    57  		return errors.CompositeValidationError(res...)
    58  	}
    59  	return nil
    60  }
    61  
    62  // bindName binds and validates parameter Name from path.
    63  func (o *GetMapNameParams) bindName(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: true
    70  	// Parameter is provided by construction from the route
    71  	o.Name = raw
    72  
    73  	return nil
    74  }