...

Source file src/github.com/sigstore/rekor/pkg/generated/restapi/operations/pubkey/get_public_key.go

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

     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 pubkey
    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  // GetPublicKeyHandlerFunc turns a function with the right signature into a get public key handler
    31  type GetPublicKeyHandlerFunc func(GetPublicKeyParams) middleware.Responder
    32  
    33  // Handle executing the request and returning a response
    34  func (fn GetPublicKeyHandlerFunc) Handle(params GetPublicKeyParams) middleware.Responder {
    35  	return fn(params)
    36  }
    37  
    38  // GetPublicKeyHandler interface for that can handle valid get public key params
    39  type GetPublicKeyHandler interface {
    40  	Handle(GetPublicKeyParams) middleware.Responder
    41  }
    42  
    43  // NewGetPublicKey creates a new http.Handler for the get public key operation
    44  func NewGetPublicKey(ctx *middleware.Context, handler GetPublicKeyHandler) *GetPublicKey {
    45  	return &GetPublicKey{Context: ctx, Handler: handler}
    46  }
    47  
    48  /*
    49  	GetPublicKey swagger:route GET /api/v1/log/publicKey pubkey getPublicKey
    50  
    51  # Retrieve the public key that can be used to validate the signed tree head
    52  
    53  Returns the public key that can be used to validate the signed tree head
    54  */
    55  type GetPublicKey struct {
    56  	Context *middleware.Context
    57  	Handler GetPublicKeyHandler
    58  }
    59  
    60  func (o *GetPublicKey) 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 = NewGetPublicKeyParams()
    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