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

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