class WhitelistOptionParser {

    WhitelistOperation parseWhitelistOperation(String inputOption)
    {
        String normalizedInput = normalizeUserInput(inputOption);

        if (normalizedInput.startsWith(GRANT_PREFIX))
        {
            return WhitelistOperation.GRANT;
        }
        else if (normalizedInput.startsWith(REVOKE_PREFIX))
        {
            return WhitelistOperation.REVOKE;
        }
        else if (normalizedInput.equals(DROP_LEGACY_KEY_PATTERN))
        {
            return WhitelistOperation.DROP_LEGACY;
        }
        else
        {
            throw new InvalidRequestException("Invalid whitelist operation option: " + inputOption);
        }
    }

}