func ValidateConfigKey(configKey api.ConfigKey) errors.Error {
	if len(configKey.MspID) == 0 {
		return errors.New(errors.InvalidConfigKey, "Cannot create config key using empty MspId")
	}
	if len(configKey.PeerID) == 0 && len(configKey.AppName) == 0 {
		return errors.New(errors.InvalidConfigKey, "Cannot create config key using empty PeerID and an empty AppName")
	}
	if len(configKey.PeerID) > 0 && len(configKey.AppName) == 0 {
		return errors.New(errors.InvalidConfigKey, "Cannot create config key using empty AppName")
	}
	if len(configKey.AppVersion) == 0 {
		return errors.New(errors.InvalidConfigKey, "Cannot create config key using empty AppVersion")
	}
	return nil
}
ValidateConfigKey validates component parts of ConfigKey
package mgmt
import (
	"strings"
	"github.com/securekey/fabric-snaps/util/errors"
	"github.com/securekey/fabric-snaps/configmanager/api"
)
const (
	KeyDivider = "!"
)
func CreateConfigKey(mspID, peerID, appName, appVersion, componentName, componentVersion string) (api.ConfigKey, errors.Error) {
	configKey := api.ConfigKey{MspID: mspID, PeerID: peerID, AppName: appName, AppVersion: appVersion, ComponentName: componentName, ComponentVersion: componentVersion}
	if err := ValidateConfigKey(configKey); err != nil {
		return configKey, err
	}
	return configKey, nil
}