github.com/chenbh/concourse/v6@v6.4.2/atc/wrappa/policy_check_wrappa.go (about)

     1  package wrappa
     2  
     3  import (
     4  	"code.cloudfoundry.org/lager"
     5  	"github.com/chenbh/concourse/v6/atc/api/policychecker"
     6  	"github.com/tedsuo/rata"
     7  )
     8  
     9  func NewPolicyCheckWrappa(
    10  	logger lager.Logger,
    11  	checker policychecker.PolicyChecker,
    12  ) *PolicyCheckWrappa {
    13  	return &PolicyCheckWrappa{logger, checker}
    14  }
    15  
    16  type PolicyCheckWrappa struct {
    17  	logger  lager.Logger
    18  	checker policychecker.PolicyChecker
    19  }
    20  
    21  func (w *PolicyCheckWrappa) Wrap(handlers rata.Handlers) rata.Handlers {
    22  	wrapped := rata.Handlers{}
    23  
    24  	for name, handler := range handlers {
    25  		wrapped[name] = policychecker.NewHandler(w.logger, handler, name, w.checker)
    26  	}
    27  
    28  	return wrapped
    29  }