github.com/cloudfoundry-attic/cli-with-i18n@v6.32.1-0.20171002233121-7401370d3b85+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  }