github.com/wanddynosios/cli/v8@v8.7.9-0.20240221182337-1a92e3a7017f/api/cloudcontroller/ccv3/connection_wrapper.go (about)

     1  package ccv3
     2  
     3  import "code.cloudfoundry.org/cli/api/cloudcontroller"
     4  
     5  //go:generate go run github.com/maxbrunsfeld/counterfeiter/v6 . ConnectionWrapper
     6  
     7  // ConnectionWrapper can wrap a given connection allowing the wrapper to modify
     8  // all requests going in and out of the given connection.
     9  type ConnectionWrapper interface {
    10  	cloudcontroller.Connection
    11  	Wrap(innerconnection cloudcontroller.Connection) cloudcontroller.Connection
    12  }
    13  
    14  // WrapConnection wraps the current Client connection in the wrapper.
    15  func (requester *RealRequester) WrapConnection(wrapper ConnectionWrapper) {
    16  	requester.connection = wrapper.Wrap(requester.connection)
    17  }