insightsclient

package
v0.0.0-...-507705e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 4, 2021 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrObtainingForVersion = fmt.Errorf("waiting for the cluster version to be loaded")

ErrObtainingForVersion An error due to cluster version client collection

View Source
var ErrTooLong = fmt.Errorf("the incoming sample data is too long")

ErrTooLong An error for sample data that is too long

View Source
var ErrWaitingForVersion = fmt.Errorf("waiting for the cluster version to be loaded")

ErrWaitingForVersion An error due to cluster version responding slowly

Functions

func LimitReader

func LimitReader(r io.Reader, n int64) io.Reader

LimitReader returns a Reader that reads from r but stops with ErrTooLong after n bytes. The underlying implementation is a *LimitedReader.

func NewLimitReadCloser

func NewLimitReadCloser(r io.ReadCloser, n int64) io.ReadCloser

NewLimitReadCloser Initialize a new limitReadCloser object

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client The client structure for making requests to cloud.redhat.com

func New

func New(client *http.Client, maxBytes int64, certPath string, metricsName string, proxyCtrl *proxycontrol.ProxyControl, reqDecorator *requestdecorator.RequestDecorator) *Client

New Initialize a new client object

func (*Client) GetMultiPartBodyAndHeaders

func (c *Client) GetMultiPartBodyAndHeaders(req *http.Request, data source.Source) int64

GetMultiPartBodyAndHeaders Get multi-part body and headers for upload

func (*Client) Send

func (c *Client) Send(ctx context.Context, endpoint string, data source.Source) error

Send Posts source data to an endpoint

func (*Client) SetupRequest

func (c *Client) SetupRequest(ctx context.Context, method, uri string, body *bytes.Buffer, contentType string) (*http.Request, error)

SetupRequest creates a new request, adds headers to request object for communication, and returns the request

type LimitedReader

type LimitedReader struct {
	R io.Reader // underlying reader
	N int64     // max bytes remaining
}

A LimitedReader reads from R but limits the amount of data returned to just N bytes. Each call to Read updates N to reflect the new amount remaining. Read returns ErrTooLong when N <= 0 or when the underlying R returns EOF.

func (*LimitedReader) Read

func (l *LimitedReader) Read(p []byte) (n int, err error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL