github.com/kyma-project/kyma-environment-broker@v0.0.1/internal/process/provisioning/external_eval.go (about)

     1  package provisioning
     2  
     3  import (
     4  	"time"
     5  
     6  	"github.com/kyma-project/kyma-environment-broker/internal"
     7  	"github.com/kyma-project/kyma-environment-broker/internal/avs"
     8  	"github.com/sirupsen/logrus"
     9  )
    10  
    11  type ExternalEvalCreator struct {
    12  	delegator *avs.Delegator
    13  	assistant *avs.ExternalEvalAssistant
    14  	disabled  bool
    15  }
    16  
    17  func NewExternalEvalCreator(delegator *avs.Delegator, disabled bool, assistant *avs.ExternalEvalAssistant) *ExternalEvalCreator {
    18  	return &ExternalEvalCreator{
    19  		delegator: delegator,
    20  		assistant: assistant,
    21  		disabled:  disabled,
    22  	}
    23  }
    24  
    25  func (eec *ExternalEvalCreator) createEval(operation internal.Operation, url string, logger logrus.FieldLogger) (internal.Operation, time.Duration, error) {
    26  	if eec.disabled {
    27  		logger.Infof("creating AVS external evaluation is disabled")
    28  		return operation, 0, nil
    29  	} else {
    30  		return eec.delegator.CreateEvaluation(logger, operation, eec.assistant, url)
    31  	}
    32  }