egressclient

package
v1.4.5 Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2021 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewEgressClient

func NewEgressClient(httpAddr, uaaAddr, uaaClientId, uaaClientSecret string) (prom_versioned_api_client.API, error)

Types

type EgressClient

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

EgressClient sets the "Authorization" header of any outgoing request. It gets a JWT from the configured Oauth2 server. It only gets a new JWT when a request comes back with a 401.

func (*EgressClient) Do

func (c *EgressClient) Do(ctx context.Context, req *http.Request) (*http.Response, []byte, error)

Do implements HTTPClient. It adds the Authorization header to the request (unless the header already exists). If the token is expired, it will reach out the Oauth2 server and get a new one. The given error CAN be from the request to the Oauth2 server.

Do modifies the given Request. It is invalid to use the same Request instance on multiple go-routines.

func (*EgressClient) URL

func (c *EgressClient) URL(ep string, args map[string]string) *url.URL

Jump to

Keyboard shortcuts

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