...

Source file src/github.com/sigstore/rekor/pkg/generated/restapi/operations/index/search_index.go

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

     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 index
    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  // SearchIndexHandlerFunc turns a function with the right signature into a search index handler
    31  type SearchIndexHandlerFunc func(SearchIndexParams) middleware.Responder
    32  
    33  // Handle executing the request and returning a response
    34  func (fn SearchIndexHandlerFunc) Handle(params SearchIndexParams) middleware.Responder {
    35  	return fn(params)
    36  }
    37  
    38  // SearchIndexHandler interface for that can handle valid search index params
    39  type SearchIndexHandler interface {
    40  	Handle(SearchIndexParams) middleware.Responder
    41  }
    42  
    43  // NewSearchIndex creates a new http.Handler for the search index operation
    44  func NewSearchIndex(ctx *middleware.Context, handler SearchIndexHandler) *SearchIndex {
    45  	return &SearchIndex{Context: ctx, Handler: handler}
    46  }
    47  
    48  /*
    49  	SearchIndex swagger:route POST /api/v1/index/retrieve index searchIndex
    50  
    51  # Searches index by entry metadata
    52  
    53  EXPERIMENTAL - this endpoint is offered as best effort only and may be changed or removed in future releases.
    54  The results returned from this endpoint may be incomplete.
    55  */
    56  type SearchIndex struct {
    57  	Context *middleware.Context
    58  	Handler SearchIndexHandler
    59  }
    60  
    61  func (o *SearchIndex) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
    62  	route, rCtx, _ := o.Context.RouteInfo(r)
    63  	if rCtx != nil {
    64  		*r = *rCtx
    65  	}
    66  	var Params = NewSearchIndexParams()
    67  	if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params
    68  		o.Context.Respond(rw, r, route.Produces, route, err)
    69  		return
    70  	}
    71  
    72  	res := o.Handler.Handle(Params) // actually handle the request
    73  	o.Context.Respond(rw, r, route.Produces, route, res)
    74  
    75  }
    76  

View as plain text