crhchttp

package
v0.9.2 Latest Latest
Warning

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

Go to latest
Published: Jan 22, 2021 License: AGPL-3.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetMultiPartBodyAndHeaders

func GetMultiPartBodyAndHeaders(filename string) (*bytes.Buffer, string, error)

GetMultiPartBodyAndHeaders Get multi-part body and headers for upload

func ProcessResponse

func ProcessResponse(logger logr.Logger, resp *http.Response) ([]byte, error)

ProcessResponse Log response for request and return valid

func SetupRequest

func SetupRequest(authConfig *AuthConfig, contentType, method, uri string, body *bytes.Buffer) (*http.Request, error)

SetupRequest creates a new request, adds headers to request object for communication to cloud.redhat.com, and returns the request

func Upload

func Upload(authConfig *AuthConfig, contentType, method, uri string, body *bytes.Buffer) (string, metav1.Time, error)

Upload Send data to cloud.redhat.com

Types

type AuthConfig

type AuthConfig struct {
	Client            client.Client
	ClusterID         string
	Authentication    kokumetricscfgv1alpha1.AuthenticationType
	BearerTokenString string
	BasicAuthUser     string
	BasicAuthPassword string
	ValidateCert      bool
	OperatorCommit    string
	Log               logr.Logger
}

AuthConfig provides the data for reconciling the CR with defaults

type HTTPClient

type HTTPClient interface {
	Do(req *http.Request) (*http.Response, error)
}

HTTPClient gives us a testable interface

var Client HTTPClient

Client is an http.Client

func GetClient

func GetClient(authConfig *AuthConfig) HTTPClient

GetClient Return client with certificate handling based on configuration

Jump to

Keyboard shortcuts

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