{"modulePath":"code.cloudfoundry.org/cli","version":"v7.1.0+incompatible","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package wrapper\n\n## Types\n\n```go\ntype ErrorWrapper struct {\n\t// contains filtered or unexported fields\n}\n```\nErrorWrapper is the wrapper that converts responses with 4xx and 5xx status codes to an error.\n\n```go\nfunc NewErrorWrapper() *ErrorWrapper\n```\n\n```go\nfunc (e *ErrorWrapper) Make(request *router.Request, passedResponse *router.Response) error\n```\n\n```go\nfunc (e *ErrorWrapper) Wrap(connection router.Connection) router.Connection\n```\n\n```go\ntype RequestLogger struct {\n\t// contains filtered or unexported fields\n}\n```\nRequestLogger is the wrapper that logs requests to and responses from the Cloud Controller server\n\n```go\nfunc NewRequestLogger(output RequestLoggerOutput) *RequestLogger\n```\nNewRequestLogger returns a pointer to a RequestLogger wrapper\n\n```go\nfunc (logger *RequestLogger) Make(request *router.Request, passedResponse *router.Response) error\n```\nMake records the request and the response to UI\n\n```go\nfunc (logger *RequestLogger) Wrap(innerconnection router.Connection) router.Connection\n```\nWrap sets the connection on the RequestLogger and returns itself\n\n```go\ntype RequestLoggerOutput interface {\n\tDisplayHeader(name string, value string) error\n\tDisplayHost(name string) error\n\tDisplayJSONBody(body []byte) error\n\tDisplayMessage(msg string) error\n\tDisplayRequestHeader(method string, uri string, httpProtocol string) error\n\tDisplayResponseHeader(httpProtocol string, status string) error\n\tDisplayType(name string, requestDate time.Time) error\n\tHandleInternalError(err error)\n\tStart() error\n\tStop() error\n}\n```\nRequestLoggerOutput is the interface for displaying logs\n\n```go\ntype TokenCache interface {\n\tAccessToken() string\n\tRefreshToken() string\n\tSetAccessToken(token string)\n\tSetRefreshToken(token string)\n}\n```\nTokenCache is where the UAA token information is stored.\n\n```go\ntype UAAAuthentication struct {\n\t// contains filtered or unexported fields\n}\n```\nUAAAuthentication wraps connections and adds authentication headers to all requests\n\n```go\nfunc NewUAAAuthentication(client UAAClient, cache TokenCache) *UAAAuthentication\n```\nNewUAAAuthentication returns a pointer to a UAAAuthentication wrapper with the client and a token cache.\n\n```go\nfunc (t *UAAAuthentication) Make(request *router.Request, passedResponse *router.Response) error\n```\nMake 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.\n\n```go\nfunc (t *UAAAuthentication) SetClient(client UAAClient)\n```\nSetClient sets the UAA client that the wrapper will use.\n\n```go\nfunc (t *UAAAuthentication) Wrap(innerconnection router.Connection) router.Connection\n```\nWrap sets the connection on the UAAAuthentication and returns itself\n\n```go\ntype UAAClient interface {\n\tRefreshAccessToken(refreshToken string) (uaa.RefreshedTokens, error)\n}\n```\nUAAClient is the interface for getting a valid access token\n\n","path":"code.cloudfoundry.org/cli/api/router/wrapper","name":"wrapper","synopsis":"","isRedistributable":true}
