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

     1  package provisioning
     2  
     3  import (
     4  	"time"
     5  
     6  	"github.com/kyma-project/kyma-environment-broker/internal/process"
     7  
     8  	"github.com/sirupsen/logrus"
     9  
    10  	"github.com/kyma-project/kyma-environment-broker/internal"
    11  	"github.com/kyma-project/kyma-environment-broker/internal/broker"
    12  )
    13  
    14  type EnableForTrialPlanStep struct {
    15  	step process.Step
    16  }
    17  
    18  var _ process.Step = &EnableForTrialPlanStep{}
    19  
    20  func NewEnableForTrialPlanStep(step process.Step) EnableForTrialPlanStep {
    21  	return EnableForTrialPlanStep{
    22  		step: step,
    23  	}
    24  }
    25  
    26  func (s EnableForTrialPlanStep) Name() string {
    27  	return s.step.Name()
    28  }
    29  
    30  func (s EnableForTrialPlanStep) Run(operation internal.Operation, log logrus.FieldLogger) (internal.Operation, time.Duration, error) {
    31  	if !broker.IsTrialPlan(operation.ProvisioningParameters.PlanID) {
    32  		log.Infof("Skipping step %s", s.Name())
    33  		return operation, 0, nil
    34  	}
    35  
    36  	return s.step.Run(operation, log)
    37  }