...

Source file src/github.com/sigstore/rekor/pkg/generated/client/pubkey/pubkey_client.go

Documentation: github.com/sigstore/rekor/pkg/generated/client/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 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 pubkey 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 pubkey 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  	GetPublicKey(params *GetPublicKeyParams, opts ...ClientOption) (*GetPublicKeyOK, error)
    48  
    49  	SetTransport(transport runtime.ClientTransport)
    50  }
    51  
    52  /*
    53  GetPublicKey retrieves the public key that can be used to validate the signed tree head
    54  
    55  Returns the public key that can be used to validate the signed tree head
    56  */
    57  func (a *Client) GetPublicKey(params *GetPublicKeyParams, opts ...ClientOption) (*GetPublicKeyOK, error) {
    58  	// TODO: Validate the params before sending
    59  	if params == nil {
    60  		params = NewGetPublicKeyParams()
    61  	}
    62  	op := &runtime.ClientOperation{
    63  		ID:                 "getPublicKey",
    64  		Method:             "GET",
    65  		PathPattern:        "/api/v1/log/publicKey",
    66  		ProducesMediaTypes: []string{"application/x-pem-file"},
    67  		ConsumesMediaTypes: []string{"application/json"},
    68  		Schemes:            []string{"http"},
    69  		Params:             params,
    70  		Reader:             &GetPublicKeyReader{formats: a.formats},
    71  		Context:            params.Context,
    72  		Client:             params.HTTPClient,
    73  	}
    74  	for _, opt := range opts {
    75  		opt(op)
    76  	}
    77  
    78  	result, err := a.transport.Submit(op)
    79  	if err != nil {
    80  		return nil, err
    81  	}
    82  	success, ok := result.(*GetPublicKeyOK)
    83  	if ok {
    84  		return success, nil
    85  	}
    86  	// unexpected success response
    87  	unexpectedSuccess := result.(*GetPublicKeyDefault)
    88  	return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code())
    89  }
    90  
    91  // SetTransport changes the transport on the client
    92  func (a *Client) SetTransport(transport runtime.ClientTransport) {
    93  	a.transport = transport
    94  }
    95  

View as plain text