...

Source file src/github.com/sigstore/rekor/pkg/generated/client/index/index_client.go

Documentation: github.com/sigstore/rekor/pkg/generated/client/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 swagger generate command
    23  
    24  import (
    25  	"github.com/go-openapi/runtime"
    26  	"github.com/go-openapi/strfmt"
    27  )
    28  
    29  // New creates a new index API client.
    30  func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService {
    31  	return &Client{transport: transport, formats: formats}
    32  }
    33  
    34  /*
    35  Client for index API
    36  */
    37  type Client struct {
    38  	transport runtime.ClientTransport
    39  	formats   strfmt.Registry
    40  }
    41  
    42  // ClientOption is the option for Client methods
    43  type ClientOption func(*runtime.ClientOperation)
    44  
    45  // ClientService is the interface for Client methods
    46  type ClientService interface {
    47  	SearchIndex(params *SearchIndexParams, opts ...ClientOption) (*SearchIndexOK, error)
    48  
    49  	SetTransport(transport runtime.ClientTransport)
    50  }
    51  
    52  /*
    53  	SearchIndex searches index by entry metadata
    54  
    55  	EXPERIMENTAL - this endpoint is offered as best effort only and may be changed or removed in future releases.
    56  
    57  The results returned from this endpoint may be incomplete.
    58  */
    59  func (a *Client) SearchIndex(params *SearchIndexParams, opts ...ClientOption) (*SearchIndexOK, error) {
    60  	// TODO: Validate the params before sending
    61  	if params == nil {
    62  		params = NewSearchIndexParams()
    63  	}
    64  	op := &runtime.ClientOperation{
    65  		ID:                 "searchIndex",
    66  		Method:             "POST",
    67  		PathPattern:        "/api/v1/index/retrieve",
    68  		ProducesMediaTypes: []string{"application/json"},
    69  		ConsumesMediaTypes: []string{"application/json"},
    70  		Schemes:            []string{"http"},
    71  		Params:             params,
    72  		Reader:             &SearchIndexReader{formats: a.formats},
    73  		Context:            params.Context,
    74  		Client:             params.HTTPClient,
    75  	}
    76  	for _, opt := range opts {
    77  		opt(op)
    78  	}
    79  
    80  	result, err := a.transport.Submit(op)
    81  	if err != nil {
    82  		return nil, err
    83  	}
    84  	success, ok := result.(*SearchIndexOK)
    85  	if ok {
    86  		return success, nil
    87  	}
    88  	// unexpected success response
    89  	unexpectedSuccess := result.(*SearchIndexDefault)
    90  	return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code())
    91  }
    92  
    93  // SetTransport changes the transport on the client
    94  func (a *Client) SetTransport(transport runtime.ClientTransport) {
    95  	a.transport = transport
    96  }
    97  

View as plain text