production_plan.go 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. // Code generated by go-swagger; DO NOT EDIT.
  2. package operations
  3. // This file was generated by the swagger tool.
  4. // Editing this file might prove futile when you re-run the generate command
  5. import (
  6. "net/http"
  7. "github.com/go-openapi/runtime/middleware"
  8. )
  9. // ProductionPlanHandlerFunc turns a function with the right signature into a production plan handler
  10. type ProductionPlanHandlerFunc func(ProductionPlanParams) middleware.Responder
  11. // Handle executing the request and returning a response
  12. func (fn ProductionPlanHandlerFunc) Handle(params ProductionPlanParams) middleware.Responder {
  13. return fn(params)
  14. }
  15. // ProductionPlanHandler interface for that can handle valid production plan params
  16. type ProductionPlanHandler interface {
  17. Handle(ProductionPlanParams) middleware.Responder
  18. }
  19. // NewProductionPlan creates a new http.Handler for the production plan operation
  20. func NewProductionPlan(ctx *middleware.Context, handler ProductionPlanHandler) *ProductionPlan {
  21. return &ProductionPlan{Context: ctx, Handler: handler}
  22. }
  23. /*ProductionPlan swagger:route POST /productionplan productionPlan
  24. compute production plan
  25. Compute the optimal production plan for given load and capacity.
  26. */
  27. type ProductionPlan struct {
  28. Context *middleware.Context
  29. Handler ProductionPlanHandler
  30. }
  31. func (o *ProductionPlan) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
  32. route, rCtx, _ := o.Context.RouteInfo(r)
  33. if rCtx != nil {
  34. r = rCtx
  35. }
  36. var Params = NewProductionPlanParams()
  37. if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params
  38. o.Context.Respond(rw, r, route.Produces, route, err)
  39. return
  40. }
  41. res := o.Handler.Handle(Params) // actually handle the request
  42. o.Context.Respond(rw, r, route.Produces, route, res)
  43. }