github.com/cilium/cilium@v1.16.2/api/v1/server/restapi/policy/get_identity_id_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 policy
     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  // NewGetIdentityIDParams creates a new GetIdentityIDParams object
    20  //
    21  // There are no default values defined in the spec.
    22  func NewGetIdentityIDParams() GetIdentityIDParams {
    23  
    24  	return GetIdentityIDParams{}
    25  }
    26  
    27  // GetIdentityIDParams contains all the bound params for the get identity ID operation
    28  // typically these are obtained from a http.Request
    29  //
    30  // swagger:parameters GetIdentityID
    31  type GetIdentityIDParams struct {
    32  
    33  	// HTTP Request Object
    34  	HTTPRequest *http.Request `json:"-"`
    35  
    36  	/*Cluster wide unique identifier of a security identity.
    37  
    38  	  Required: true
    39  	  In: path
    40  	*/
    41  	ID string
    42  }
    43  
    44  // BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface
    45  // for simple values it will use straight method calls.
    46  //
    47  // To ensure default values, the struct must have been initialized with NewGetIdentityIDParams() beforehand.
    48  func (o *GetIdentityIDParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error {
    49  	var res []error
    50  
    51  	o.HTTPRequest = r
    52  
    53  	rID, rhkID, _ := route.Params.GetOK("id")
    54  	if err := o.bindID(rID, rhkID, route.Formats); err != nil {
    55  		res = append(res, err)
    56  	}
    57  	if len(res) > 0 {
    58  		return errors.CompositeValidationError(res...)
    59  	}
    60  	return nil
    61  }
    62  
    63  // bindID binds and validates parameter ID from path.
    64  func (o *GetIdentityIDParams) bindID(rawData []string, hasKey bool, formats strfmt.Registry) error {
    65  	var raw string
    66  	if len(rawData) > 0 {
    67  		raw = rawData[len(rawData)-1]
    68  	}
    69  
    70  	// Required: true
    71  	// Parameter is provided by construction from the route
    72  	o.ID = raw
    73  
    74  	return nil
    75  }