Skip to content
Snippets Groups Projects
get_interfaces.go 1.66 KiB
Newer Older
  • Learn to ignore specific revisions
  • Manuel Kieweg's avatar
    Manuel Kieweg committed
    // Code generated by go-swagger; DO NOT EDIT.
    
    package interface_operations
    
    // This file was generated by the swagger tool.
    // Editing this file might prove futile when you re-run the generate command
    
    import (
    	"net/http"
    
    	"github.com/go-openapi/runtime/middleware"
    )
    
    // GetInterfacesHandlerFunc turns a function with the right signature into a get interfaces handler
    type GetInterfacesHandlerFunc func(GetInterfacesParams) middleware.Responder
    
    // Handle executing the request and returning a response
    func (fn GetInterfacesHandlerFunc) Handle(params GetInterfacesParams) middleware.Responder {
    	return fn(params)
    }
    
    // GetInterfacesHandler interface for that can handle valid get interfaces params
    type GetInterfacesHandler interface {
    	Handle(GetInterfacesParams) middleware.Responder
    }
    
    // NewGetInterfaces creates a new http.Handler for the get interfaces operation
    func NewGetInterfaces(ctx *middleware.Context, handler GetInterfacesHandler) *GetInterfaces {
    	return &GetInterfaces{Context: ctx, Handler: handler}
    }
    
    /*GetInterfaces swagger:route GET /data/cocsn-interfaces interface getInterfaces
    
    Returns a list of interfaces
    
    */
    type GetInterfaces struct {
    	Context *middleware.Context
    	Handler GetInterfacesHandler
    }
    
    func (o *GetInterfaces) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
    	route, rCtx, _ := o.Context.RouteInfo(r)
    	if rCtx != nil {
    		r = rCtx
    	}
    	var Params = NewGetInterfacesParams()
    
    	if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params
    		o.Context.Respond(rw, r, route.Produces, route, err)
    		return
    	}
    
    	res := o.Handler.Handle(Params) // actually handle the request
    
    	o.Context.Respond(rw, r, route.Produces, route, res)
    
    }