github.com/kyma-project/kyma-environment-broker@v0.0.1/internal/runtime/custom_disabler_example.go (about) 1 // This package is NOT FOR PRODUCTION USE CASE. EXAMPLE ONLY. 2 package runtime 3 4 import ( 5 "github.com/kyma-project/control-plane/components/provisioner/pkg/gqlschema" 6 "github.com/kyma-project/kyma-environment-broker/internal" 7 ) 8 9 // CustomDisablerComponentName defines the component name 10 const CustomDisablerComponentName = "component-x" 11 12 // CustomDisablerExample provides example how to add functionality for disabling some 13 // which requires more complex logic 14 type CustomDisablerExample struct{} 15 16 // NewCustomDisablerExample returns new instance of CustomDisablerExample 17 func NewCustomDisablerExample() *CustomDisablerExample { 18 return &CustomDisablerExample{} 19 } 20 21 // Disable disables given component by adding new overrides to existing module 22 func (CustomDisablerExample) Disable(components internal.ComponentConfigurationInputList) internal.ComponentConfigurationInputList { 23 disableOverrides := []*gqlschema.ConfigEntryInput{ 24 { 25 Key: "component-x.enabled", 26 Value: "false", 27 }, 28 { 29 Key: "component-x.Output.conf.enabled", 30 Value: "false", 31 }, 32 } 33 34 for _, c := range components { 35 if c.Component == CustomDisablerComponentName { 36 c.Configuration = append(c.Configuration, disableOverrides...) 37 } 38 } 39 40 return components 41 }