Documentation
¶
Index ¶
- Variables
- func GetMultiPartBodyAndHeaders(filename string) (*bytes.Buffer, string, error)
- func ProcessResponse(logger logr.Logger, resp *http.Response) ([]byte, error)
- func SetupRequest(authConfig *AuthConfig, contentType, method, uri string, body *bytes.Buffer) (*http.Request, error)
- func Upload(authConfig *AuthConfig, contentType, method, uri string, body *bytes.Buffer) (string, metav1.Time, error)
- type AuthConfig
- type HTTPClient
Constants ¶
This section is empty.
Variables ¶
View Source
var DefaultTransport = &http.Transport{ Proxy: http.ProxyFromEnvironment, DialContext: (&net.Dialer{ Timeout: 30 * time.Second, KeepAlive: 30 * time.Second, DualStack: true, }).DialContext, ForceAttemptHTTP2: true, MaxIdleConns: 100, IdleConnTimeout: 90 * time.Second, TLSHandshakeTimeout: 10 * time.Second, ExpectContinueTimeout: 1 * time.Second, }
DefaultTransport is a copy from the golang http package
Functions ¶
func GetMultiPartBodyAndHeaders ¶
GetMultiPartBodyAndHeaders Get multi-part body and headers for upload
func ProcessResponse ¶
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
Types ¶
type AuthConfig ¶
type AuthConfig struct { Client client.Client ClusterID string Authentication kokumetricscfgv1beta1.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 ¶
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
Click to show internal directories.
Click to hide internal directories.