wrapper

package
v6.53.0 Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2020 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CustomWrapper added in v6.27.0

type CustomWrapper struct {
	CustomMake func(connection cloudcontroller.Connection, request *cloudcontroller.Request, passedResponse *cloudcontroller.Response) error
	// contains filtered or unexported fields
}

CustomWrapper is a wrapper that can execute arbitrary code via the CustomMake function on every request that passes through Make.

func (*CustomWrapper) Make added in v6.27.0

func (e *CustomWrapper) Make(request *cloudcontroller.Request, passedResponse *cloudcontroller.Response) error

func (*CustomWrapper) Wrap added in v6.27.0

type RequestLogger added in v6.23.0

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

RequestLogger is the wrapper that logs requests to and responses from the Cloud Controller server

func NewRequestLogger added in v6.23.0

func NewRequestLogger(output RequestLoggerOutput) *RequestLogger

NewRequestLogger returns a pointer to a RequestLogger wrapper

func (*RequestLogger) Make added in v6.23.0

func (logger *RequestLogger) Make(request *cloudcontroller.Request, passedResponse *cloudcontroller.Response) error

Make records the request and the response to UI

func (*RequestLogger) Wrap added in v6.23.0

func (logger *RequestLogger) Wrap(innerconnection cloudcontroller.Connection) cloudcontroller.Connection

Wrap sets the connection on the RequestLogger and returns itself

type RequestLoggerOutput added in v6.23.0

type RequestLoggerOutput interface {
	DisplayHeader(name string, value string) error
	DisplayHost(name string) error
	DisplayJSONBody(body []byte) error
	DisplayMessage(msg string) error
	DisplayRequestHeader(method string, uri string, httpProtocol string) error
	DisplayResponseHeader(httpProtocol string, status string) error
	DisplayType(name string, requestDate time.Time) error
	HandleInternalError(err error)
	Start() error
	Stop() error
}

RequestLoggerOutput is the interface for displaying logs

type RetryRequest added in v6.23.0

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

RetryRequest is a wrapper that retries failed requests if they contain a 5XX status code.

func NewRetryRequest added in v6.23.0

func NewRetryRequest(maxRetries int) *RetryRequest

NewRetryRequest returns a pointer to a RetryRequest wrapper.

func (*RetryRequest) Make added in v6.23.0

func (retry *RetryRequest) Make(request *cloudcontroller.Request, passedResponse *cloudcontroller.Response) error

Make retries the request if it comes back with a 5XX status code.

func (*RetryRequest) Wrap added in v6.23.0

func (retry *RetryRequest) Wrap(innerconnection cloudcontroller.Connection) cloudcontroller.Connection

Wrap sets the connection in the RetryRequest and returns itself.

type TokenCache added in v6.24.0

type TokenCache interface {
	AccessToken() string
	RefreshToken() string
	SetAccessToken(token string)
	SetRefreshToken(token string)
}

TokenCache is where the UAA token information is stored.

type UAAAuthentication

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

UAAAuthentication wraps connections and adds authentication headers to all requests

func NewUAAAuthentication

func NewUAAAuthentication(client UAAClient, cache TokenCache) *UAAAuthentication

NewUAAAuthentication returns a pointer to a UAAAuthentication wrapper with the client and a token cache.

func (*UAAAuthentication) Make

func (t *UAAAuthentication) Make(request *cloudcontroller.Request, passedResponse *cloudcontroller.Response) error

Make adds authentication headers to the passed in request and then calls the wrapped connection's Make. If the client is not set on the wrapper, it will not add any header or handle any authentication errors.

func (*UAAAuthentication) SetClient added in v6.26.0

func (t *UAAAuthentication) SetClient(client UAAClient)

SetClient sets the UAA client that the wrapper will use.

func (*UAAAuthentication) Wrap

Wrap sets the connection on the UAAAuthentication and returns itself

type UAAClient

type UAAClient interface {
	RefreshAccessToken(refreshToken string) (uaa.RefreshedTokens, error)
}

UAAClient is the interface for getting a valid access token

Directories

Path Synopsis
Code generated by counterfeiter.
Code generated by counterfeiter.

Jump to

Keyboard shortcuts

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