{"modulePath":"github.com/gmllt/cloudfoundry-cli","version":"v6.44.2+incompatible","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package wrapper\n\n## Types\n\n```go\ntype CustomWrapper struct {\n\tCustomMake func(connection cloudcontroller.Connection, request *cloudcontroller.Request, passedResponse *cloudcontroller.Response) error\n\t// contains filtered or unexported fields\n}\n```\nCustomWrapper is a wrapper that can execute arbitrary code via the CustomMake function on every request that passes through Make.\n\n```go\nfunc (e *CustomWrapper) Make(request *cloudcontroller.Request, passedResponse *cloudcontroller.Response) error\n```\n\n```go\nfunc (e *CustomWrapper) Wrap(innerconnection cloudcontroller.Connection) cloudcontroller.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 *cloudcontroller.Request, passedResponse *cloudcontroller.Response) error\n```\nMake records the request and the response to UI\n\n```go\nfunc (logger *RequestLogger) Wrap(innerconnection cloudcontroller.Connection) cloudcontroller.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 RetryRequest struct {\n\t// contains filtered or unexported fields\n}\n```\nRetryRequest is a wrapper that retries failed requests if they contain a 5XX status code.\n\n```go\nfunc NewRetryRequest(maxRetries int) *RetryRequest\n```\nNewRetryRequest returns a pointer to a RetryRequest wrapper.\n\n```go\nfunc (retry *RetryRequest) Make(request *cloudcontroller.Request, passedResponse *cloudcontroller.Response) error\n```\nMake retries the request if it comes back with a 5XX status code.\n\n```go\nfunc (retry *RetryRequest) Wrap(innerconnection cloudcontroller.Connection) cloudcontroller.Connection\n```\nWrap sets the connection in the RetryRequest and returns itself.\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 *cloudcontroller.Request, passedResponse *cloudcontroller.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 cloudcontroller.Connection) cloudcontroller.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":"github.com/gmllt/cloudfoundry-cli/api/cloudcontroller/wrapper","name":"wrapper","synopsis":"","isRedistributable":true}
