github.com/kyma-project/kyma-environment-broker@v0.0.1/internal/process/provisioning/skip_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 SkipForTrialPlanStep struct {
    15  	step process.Step
    16  }
    17  
    18  var _ process.Step = &SkipForTrialPlanStep{}
    19  
    20  func NewSkipForTrialPlanStep(step process.Step) SkipForTrialPlanStep {
    21  	return SkipForTrialPlanStep{
    22  		step: step,
    23  	}
    24  }
    25  
    26  func (s SkipForTrialPlanStep) Name() string {
    27  	return s.step.Name()
    28  }
    29  
    30  func (s SkipForTrialPlanStep) 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  }