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

     1  package config
     2  
     3  import (
     4  	"github.com/kyma-project/kyma-environment-broker/internal"
     5  	"gopkg.in/yaml.v2"
     6  )
     7  
     8  type ConfigMapConverter struct{}
     9  
    10  func NewConfigMapConverter() *ConfigMapConverter {
    11  	return &ConfigMapConverter{}
    12  }
    13  
    14  func (c *ConfigMapConverter) ConvertToStruct(cfgString string) (internal.ConfigForPlan, error) {
    15  	var cfg internal.ConfigForPlan
    16  	if err := yaml.Unmarshal([]byte(cfgString), &cfg); err != nil {
    17  		return internal.ConfigForPlan{}, err
    18  	}
    19  	return cfg, nil
    20  }