github.com/loggregator/cli@v6.33.1-0.20180224010324-82334f081791+incompatible/api/cloudcontroller/wrapper/custom_wrapper.go (about)

     1  package wrapper
     2  
     3  import "code.cloudfoundry.org/cli/api/cloudcontroller"
     4  
     5  // CustomWrapper is a wrapper that can execute arbitrary code via the
     6  // CustomMake function on every request that passes through Make.
     7  type CustomWrapper struct {
     8  	connection cloudcontroller.Connection
     9  	CustomMake func(connection cloudcontroller.Connection, request *cloudcontroller.Request, passedResponse *cloudcontroller.Response) error
    10  }
    11  
    12  func (e *CustomWrapper) Wrap(innerconnection cloudcontroller.Connection) cloudcontroller.Connection {
    13  	e.connection = innerconnection
    14  	return e
    15  }
    16  
    17  func (e *CustomWrapper) Make(request *cloudcontroller.Request, passedResponse *cloudcontroller.Response) error {
    18  	return e.CustomMake(e.connection, request, passedResponse)
    19  }