func parseAllowedClient()

in appconfigmgrv2/controllers/utils.go [77:91]


func parseAllowedClient(allowedClient, defaultNamespace string) (string, string, error) {
	if allowedClient == "" {
		return "", "", errors.New("empty allowed client")
	}

	split := strings.Split(allowedClient, "/")
	switch n := len(split); n {
	case 2:
		return split[0], split[1], nil
	case 1:
		return defaultNamespace, allowedClient, nil
	default:
		return "", "", fmt.Errorf("expected format <namespace>/<app> or <app>, got: %s", allowedClient)
	}
}