...

Source file src/github.com/sigstore/rekor/pkg/generated/client/entries/entries_client.go

Documentation: github.com/sigstore/rekor/pkg/generated/client/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 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 entries 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 entries 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  	CreateLogEntry(params *CreateLogEntryParams, opts ...ClientOption) (*CreateLogEntryCreated, error)
    48  
    49  	GetLogEntryByIndex(params *GetLogEntryByIndexParams, opts ...ClientOption) (*GetLogEntryByIndexOK, error)
    50  
    51  	GetLogEntryByUUID(params *GetLogEntryByUUIDParams, opts ...ClientOption) (*GetLogEntryByUUIDOK, error)
    52  
    53  	SearchLogQuery(params *SearchLogQueryParams, opts ...ClientOption) (*SearchLogQueryOK, error)
    54  
    55  	SetTransport(transport runtime.ClientTransport)
    56  }
    57  
    58  /*
    59  CreateLogEntry creates an entry in the transparency log
    60  
    61  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.
    62  */
    63  func (a *Client) CreateLogEntry(params *CreateLogEntryParams, opts ...ClientOption) (*CreateLogEntryCreated, error) {
    64  	// TODO: Validate the params before sending
    65  	if params == nil {
    66  		params = NewCreateLogEntryParams()
    67  	}
    68  	op := &runtime.ClientOperation{
    69  		ID:                 "createLogEntry",
    70  		Method:             "POST",
    71  		PathPattern:        "/api/v1/log/entries",
    72  		ProducesMediaTypes: []string{"application/json"},
    73  		ConsumesMediaTypes: []string{"application/json"},
    74  		Schemes:            []string{"http"},
    75  		Params:             params,
    76  		Reader:             &CreateLogEntryReader{formats: a.formats},
    77  		Context:            params.Context,
    78  		Client:             params.HTTPClient,
    79  	}
    80  	for _, opt := range opts {
    81  		opt(op)
    82  	}
    83  
    84  	result, err := a.transport.Submit(op)
    85  	if err != nil {
    86  		return nil, err
    87  	}
    88  	success, ok := result.(*CreateLogEntryCreated)
    89  	if ok {
    90  		return success, nil
    91  	}
    92  	// unexpected success response
    93  	unexpectedSuccess := result.(*CreateLogEntryDefault)
    94  	return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code())
    95  }
    96  
    97  /*
    98  GetLogEntryByIndex retrieves an entry and inclusion proof from the transparency log if it exists by index
    99  */
   100  func (a *Client) GetLogEntryByIndex(params *GetLogEntryByIndexParams, opts ...ClientOption) (*GetLogEntryByIndexOK, error) {
   101  	// TODO: Validate the params before sending
   102  	if params == nil {
   103  		params = NewGetLogEntryByIndexParams()
   104  	}
   105  	op := &runtime.ClientOperation{
   106  		ID:                 "getLogEntryByIndex",
   107  		Method:             "GET",
   108  		PathPattern:        "/api/v1/log/entries",
   109  		ProducesMediaTypes: []string{"application/json"},
   110  		ConsumesMediaTypes: []string{"application/json"},
   111  		Schemes:            []string{"http"},
   112  		Params:             params,
   113  		Reader:             &GetLogEntryByIndexReader{formats: a.formats},
   114  		Context:            params.Context,
   115  		Client:             params.HTTPClient,
   116  	}
   117  	for _, opt := range opts {
   118  		opt(op)
   119  	}
   120  
   121  	result, err := a.transport.Submit(op)
   122  	if err != nil {
   123  		return nil, err
   124  	}
   125  	success, ok := result.(*GetLogEntryByIndexOK)
   126  	if ok {
   127  		return success, nil
   128  	}
   129  	// unexpected success response
   130  	unexpectedSuccess := result.(*GetLogEntryByIndexDefault)
   131  	return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code())
   132  }
   133  
   134  /*
   135  GetLogEntryByUUID gets log entry and information required to generate an inclusion proof for the entry in the transparency log
   136  
   137  Returns the entry, root hash, tree size, and a list of hashes that can be used to calculate proof of an entry being included in the transparency log
   138  */
   139  func (a *Client) GetLogEntryByUUID(params *GetLogEntryByUUIDParams, opts ...ClientOption) (*GetLogEntryByUUIDOK, error) {
   140  	// TODO: Validate the params before sending
   141  	if params == nil {
   142  		params = NewGetLogEntryByUUIDParams()
   143  	}
   144  	op := &runtime.ClientOperation{
   145  		ID:                 "getLogEntryByUUID",
   146  		Method:             "GET",
   147  		PathPattern:        "/api/v1/log/entries/{entryUUID}",
   148  		ProducesMediaTypes: []string{"application/json"},
   149  		ConsumesMediaTypes: []string{"application/json"},
   150  		Schemes:            []string{"http"},
   151  		Params:             params,
   152  		Reader:             &GetLogEntryByUUIDReader{formats: a.formats},
   153  		Context:            params.Context,
   154  		Client:             params.HTTPClient,
   155  	}
   156  	for _, opt := range opts {
   157  		opt(op)
   158  	}
   159  
   160  	result, err := a.transport.Submit(op)
   161  	if err != nil {
   162  		return nil, err
   163  	}
   164  	success, ok := result.(*GetLogEntryByUUIDOK)
   165  	if ok {
   166  		return success, nil
   167  	}
   168  	// unexpected success response
   169  	unexpectedSuccess := result.(*GetLogEntryByUUIDDefault)
   170  	return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code())
   171  }
   172  
   173  /*
   174  SearchLogQuery searches transparency log for one or more log entries
   175  */
   176  func (a *Client) SearchLogQuery(params *SearchLogQueryParams, opts ...ClientOption) (*SearchLogQueryOK, error) {
   177  	// TODO: Validate the params before sending
   178  	if params == nil {
   179  		params = NewSearchLogQueryParams()
   180  	}
   181  	op := &runtime.ClientOperation{
   182  		ID:                 "searchLogQuery",
   183  		Method:             "POST",
   184  		PathPattern:        "/api/v1/log/entries/retrieve",
   185  		ProducesMediaTypes: []string{"application/json"},
   186  		ConsumesMediaTypes: []string{"application/json"},
   187  		Schemes:            []string{"http"},
   188  		Params:             params,
   189  		Reader:             &SearchLogQueryReader{formats: a.formats},
   190  		Context:            params.Context,
   191  		Client:             params.HTTPClient,
   192  	}
   193  	for _, opt := range opts {
   194  		opt(op)
   195  	}
   196  
   197  	result, err := a.transport.Submit(op)
   198  	if err != nil {
   199  		return nil, err
   200  	}
   201  	success, ok := result.(*SearchLogQueryOK)
   202  	if ok {
   203  		return success, nil
   204  	}
   205  	// unexpected success response
   206  	unexpectedSuccess := result.(*SearchLogQueryDefault)
   207  	return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code())
   208  }
   209  
   210  // SetTransport changes the transport on the client
   211  func (a *Client) SetTransport(transport runtime.ClientTransport) {
   212  	a.transport = transport
   213  }
   214  

View as plain text