// splitUsernameAndSuffix is a helper for extracting usernames and suffixes from
// backend key values.
splitUsernameAndSuffix is a helper for extracting usernames and suffixes from
backend key values.
// splitUsernameAndSuffix is a helper for extracting usernames and suffixes from // backend key values .
func splitUsernameAndSuffix(key string) (name string, suffix string, err error) {
	if !strings.HasPrefix(key, fullUsersPrefix) {
		return "", "", trace.BadParameter("expected format '%s/<name>/<suffix>', got '%s'", fullUsersPrefix, key)
	}
	key = strings.TrimPrefix(key, fullUsersPrefix)
	idx := strings.LastIndex(key, "/")
	if idx < 1 || idx >= len(key) {
		return "", "", trace.BadParameter("expected format <name>/<suffix>, got %q", key)
	}
	return key[:idx], key[idx+1:], nil
}
func splitUsernameAndSuffix ( key string ) ( name string , suffix string , err error ) { if ! strings . HasPrefix ( key , fullUsersPrefix ) { return " " , " " , trace . BadParameter ( " " , fullUsersPrefix , key ) } key = strings . TrimPrefix ( key , fullUsersPrefix ) idx := strings . LastIndex ( key , " " ) if idx < 1 || idx >= len ( key ) { return " " , " " , trace . BadParameter ( " " , key ) } return key [ : idx ] , key [ idx + 1 : ] , nil }
splitUsernameAndSuffix is a helper for extracting usernames and suffixes from
backend key values.
splitUsernameAndSuffix is a helper for extracting usernames and suffixes from backend key values .