func (cmngr *configManagerImpl) Get(configKey api.ConfigKey) ([]*api.ConfigKV, errors.Error) {
	err := ValidateConfigKey(configKey)
	if err != nil {
		return cmngr.getConfigs(configKey)
	}
	if len(configKey.ComponentName) > 0 && len(configKey.ComponentVersion) == 0 {
		values, getConfigsErr := cmngr.getConfigs(configKey)
		if getConfigsErr != nil {
			return nil, getConfigsErr
		}
		filterComp := make([]*api.ConfigKV, 0)
		for _, v := range values {
			if v.Key.ComponentName == configKey.ComponentName && v.Key.AppName == configKey.AppName {
				filterComp = append(filterComp, v)
			}
		}
		return filterComp, nil
	}
	config, getConfigErr := cmngr.getConfig(configKey)
	if getConfigErr != nil {
		return nil, getConfigErr
	}
	configKeys := []*api.ConfigKV{{Key: configKey, Value: config}}
	return configKeys, nil
}
Get gets configuration from the ledger using config key
package mgmt
import (
	"encoding/json"
	"github.com/hyperledger/fabric-sdk-go/pkg/common/logging"
	"github.com/hyperledger/fabric/core/chaincode/shim"
	"github.com/securekey/fabric-snaps/configmanager/api"
	cfgsnapapi "github.com/securekey/fabric-snaps/configurationsnap/api"
	"github.com/securekey/fabric-snaps/util/errors"
)
var logger = logging.NewLogger("configsnap")
const (
	indexMspID = "cfgmgmt-mspid"
)
var indexes = [...]string{indexMspID}
type configManagerImpl struct {
	stub shim.ChaincodeStubInterface
}
func NewConfigManager(stub shim.ChaincodeStubInterface) api.ConfigManager {
	return &configManagerImpl{stub: stub}
}
func (cmngr *configManagerImpl) Save(configData []byte) errors.Error {
	if len(configData) == 0 {
		return errors.New(errors.MissingRequiredParameterError, "Configuration must be provided")
	}
	configMessageMap, err := ParseConfigMessage(configData, cmngr.stub.GetTxID())
	if err != nil {
		return err
	}
	err1 := cmngr.stub.SetEvent(cfgsnapapi.ConfigCCEventName, nil)
	if err1 != nil {
		return errors.Wrap(errors.SystemError, err1, "SetEvent failed")
	}
	return cmngr.saveConfigs(configMessageMap)
}
func (cmngr *configManagerImpl) saveConfigs(configMessageMap map[api.ConfigKey][]byte) errors.Error {
	for key, value := range configMessageMap {
		logger.Debugf("Saving configs %v,%s", key, string(value[:]))
		strkey, err := ConfigKeyToString(key)
		if err != nil {
			return err
		}
		if e := cmngr.stub.PutState(strkey, value); e != nil {
			return errors.Wrap(errors.SystemError, e, "PutState has failed")
		}
		if err := cmngr.addIndexes(key); err != nil {
			return err
		}
	}
	return nil
}