1 // Code generated by go-swagger; DO NOT EDIT. 2 3 // Copyright 2022 The Sigstore Authors. 4 // 5 // Licensed under the Apache License, Version 2.0 (the "License"); 6 // you may not use this file except in compliance with the License. 7 // You may obtain a copy of the License at 8 // 9 // http://www.apache.org/licenses/LICENSE-2.0 10 // 11 // Unless required by applicable law or agreed to in writing, software 12 // distributed under the License is distributed on an "AS IS" BASIS, 13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 // See the License for the specific language governing permissions and 15 // limitations under the License. 16 // 17 18 package timestamp 19 20 // This file was generated by the swagger tool. 21 // Editing this file might prove futile when you re-run the generate command 22 23 import ( 24 "net/http" 25 26 "github.com/go-openapi/runtime/middleware" 27 ) 28 29 // GetTimestampResponseHandlerFunc turns a function with the right signature into a get timestamp response handler 30 type GetTimestampResponseHandlerFunc func(GetTimestampResponseParams) middleware.Responder 31 32 // Handle executing the request and returning a response 33 func (fn GetTimestampResponseHandlerFunc) Handle(params GetTimestampResponseParams) middleware.Responder { 34 return fn(params) 35 } 36 37 // GetTimestampResponseHandler interface for that can handle valid get timestamp response params 38 type GetTimestampResponseHandler interface { 39 Handle(GetTimestampResponseParams) middleware.Responder 40 } 41 42 // NewGetTimestampResponse creates a new http.Handler for the get timestamp response operation 43 func NewGetTimestampResponse(ctx *middleware.Context, handler GetTimestampResponseHandler) *GetTimestampResponse { 44 return &GetTimestampResponse{Context: ctx, Handler: handler} 45 } 46 47 /* 48 GetTimestampResponse swagger:route POST /api/v1/timestamp timestamp getTimestampResponse 49 50 Generates a new timestamp response and creates a new log entry for the timestamp in the transparency log 51 */ 52 type GetTimestampResponse struct { 53 Context *middleware.Context 54 Handler GetTimestampResponseHandler 55 } 56 57 func (o *GetTimestampResponse) ServeHTTP(rw http.ResponseWriter, r *http.Request) { 58 route, rCtx, _ := o.Context.RouteInfo(r) 59 if rCtx != nil { 60 *r = *rCtx 61 } 62 var Params = NewGetTimestampResponseParams() 63 if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params 64 o.Context.Respond(rw, r, route.Produces, route, err) 65 return 66 } 67 68 res := o.Handler.Handle(Params) // actually handle the request 69 o.Context.Respond(rw, r, route.Produces, route, res) 70 71 } 72