...

Source file src/github.com/sigstore/rekor/pkg/generated/restapi/operations/entries/create_log_entry.go

Documentation: github.com/sigstore/rekor/pkg/generated/restapi/operations/entries

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

View as plain text