github.com/goharbor/go-client@v0.210.0/pkg/sdk/v2.0/client/ping/ping_client.go (about)

     1  // Code generated by go-swagger; DO NOT EDIT.
     2  
     3  package ping
     4  
     5  // This file was generated by the swagger tool.
     6  // Editing this file might prove futile when you re-run the swagger generate command
     7  
     8  import (
     9  	"context"
    10  
    11  	"github.com/go-openapi/runtime"
    12  
    13  	strfmt "github.com/go-openapi/strfmt"
    14  )
    15  
    16  //go:generate mockery -name API -inpkg
    17  
    18  // API is the interface of the ping client
    19  type API interface {
    20  	/*
    21  	   GetPing pings harbor to check if the API server is alive
    22  
    23  	   This API simply replies a pong to indicate the process to handle API is up, disregarding the health status of dependent components. This path does not require any authentication.*/
    24  	GetPing(ctx context.Context, params *GetPingParams) (*GetPingOK, error)
    25  }
    26  
    27  // New creates a new ping API client.
    28  func New(transport runtime.ClientTransport, formats strfmt.Registry, authInfo runtime.ClientAuthInfoWriter) *Client {
    29  	return &Client{
    30  		transport: transport,
    31  		formats:   formats,
    32  		authInfo:  authInfo,
    33  	}
    34  }
    35  
    36  /*
    37  Client for ping API
    38  */
    39  type Client struct {
    40  	transport runtime.ClientTransport
    41  	formats   strfmt.Registry
    42  	authInfo  runtime.ClientAuthInfoWriter
    43  }
    44  
    45  /*
    46  GetPing pings harbor to check if the API server is alive
    47  
    48  This API simply replies a pong to indicate the process to handle API is up, disregarding the health status of dependent components. This path does not require any authentication.
    49  */
    50  func (a *Client) GetPing(ctx context.Context, params *GetPingParams) (*GetPingOK, error) {
    51  
    52  	result, err := a.transport.Submit(&runtime.ClientOperation{
    53  		ID:                 "getPing",
    54  		Method:             "GET",
    55  		PathPattern:        "/ping",
    56  		ProducesMediaTypes: []string{"text/plain"},
    57  		ConsumesMediaTypes: []string{"application/json"},
    58  		Schemes:            []string{"http", "https"},
    59  		Params:             params,
    60  		Reader:             &GetPingReader{formats: a.formats},
    61  		AuthInfo:           a.authInfo,
    62  		Context:            ctx,
    63  		Client:             params.HTTPClient,
    64  	})
    65  	if err != nil {
    66  		return nil, err
    67  	}
    68  	return result.(*GetPingOK), nil
    69  
    70  }