insightsclient

package
v0.0.0-...-898015a Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2024 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrTooLong = fmt.Errorf("the incoming sample data is too long")
View Source
var ErrWaitingForVersion = fmt.Errorf("waiting for the cluster version to be loaded")

Functions

func IsHttpError

func IsHttpError(err error) bool

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.

Types

type Authorizer

type Authorizer interface {
	Authorize(req *http.Request) error
	NewSystemOrConfiguredProxy() func(*http.Request) (*url.URL, error)
	Token() (string, error)
}

type Client

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

func New

func New(client *http.Client, maxBytes int64, metricsName string, authorizer Authorizer, configClient *configv1client.Clientset) *Client

New creates a Client

func (*Client) GetClusterVersion

func (c *Client) GetClusterVersion() (*configv1.ClusterVersion, error)

func (*Client) GetWithPathParams

func (c *Client) GetWithPathParams(ctx context.Context, endpoint, requestID string) (*http.Response, error)

GetWithPathParams makes an HTTP GET request to the specified endpoint using the specified "requestID" as a part of the endpoint path

func (*Client) IncrementRecvReportMetric

func (c *Client) IncrementRecvReportMetric(statusCode int)

IncrementRecvReportMetric increments the "insightsclient_request_recvreport_total" metric for the given HTTP status code

func (*Client) RecvClusterTransfer

func (c *Client) RecvClusterTransfer(endpoint string) ([]byte, error)

RecvClusterTransfer performs a request to the OCM cluster transfer API. It is an HTTP GET request with the `search` query parameter limiting the result only for the one cluster and only for the `accepted` cluster transfers.

func (*Client) RecvGatheringRules

func (c *Client) RecvGatheringRules(ctx context.Context, endpoint string) ([]byte, error)

RecvGatheringRules performs a request to Insights Operator Gathering Conditions Service https://github.com/RedHatInsights/insights-operator-gathering-conditions-service and returns the response body or an error

func (*Client) RecvReport

func (c *Client) RecvReport(ctx context.Context, endpoint string) (*http.Response, error)

RecvReport performs a request to Insights Results Smart Proxy endpoint

func (*Client) RecvSCACerts

func (c *Client) RecvSCACerts(_ context.Context, endpoint string) ([]byte, error)

func (*Client) Send

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

Send uploads archives to Ingress service

func (*Client) SendAndGetID

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

type HttpError

type HttpError struct {
	Err        error
	StatusCode int
}

HttpError is helper error type to have HTTP error status code

func (HttpError) Error

func (e HttpError) Error() string

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)

type Source

type Source struct {
	ID           string
	Type         string
	CreationTime time.Time
	Contents     io.ReadCloser
}

Jump to

Keyboard shortcuts

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