github.com/kyma-project/kyma-environment-broker@v0.0.1/internal/runtime/disabled_components_service.go (about)

     1  package runtime
     2  
     3  import (
     4  	"github.com/kyma-project/kyma-environment-broker/internal"
     5  )
     6  
     7  type DisabledComponentsService struct {
     8  	disabledComponents map[string]struct{}
     9  }
    10  
    11  // NewDisabledComponentsService returns new instance of ResourceSupervisorAggregator
    12  func NewDisabledComponentsService(disabledComponents map[string]struct{}) *DisabledComponentsService {
    13  	return &DisabledComponentsService{
    14  		disabledComponents: disabledComponents,
    15  	}
    16  }
    17  
    18  // DisableComponents executes disablers on given input and returns modified list.
    19  //
    20  // BE AWARE: in current implementation the input is also modified.
    21  func (f *DisabledComponentsService) DisableComponents(components internal.ComponentConfigurationInputList) (internal.ComponentConfigurationInputList, error) {
    22  	var filterOut = components
    23  	for name := range f.disabledComponents {
    24  		filterOut = NewGenericComponentDisabler(name).Disable(filterOut)
    25  	}
    26  
    27  	return filterOut, nil
    28  }