static ApiError validateQuotaKeyValue(
        Map<String, ConfigDef.ConfigKey> validKeys,
        String key,
        double value
    ) {
        // Ensure we have an allowed quota key
        ConfigDef.ConfigKey configKey = validKeys.get(key);
        if (configKey == null) {
            return new ApiError(Errors.INVALID_REQUEST, "Invalid configuration key " + key);
        }
        if (value <= 0.0) {
            return new ApiError(Errors.INVALID_REQUEST, "Quota " + key + " must be greater than 0");
        }

        // Ensure the quota value is valid
        switch (configKey.type()) {
            case DOUBLE:
                return ApiError.NONE;
            case SHORT:
                if (value > Short.MAX_VALUE) {
                    return new ApiError(Errors.INVALID_REQUEST,
                        "Proposed value for " + key + " is too large for a SHORT.");
                }
                return getErrorForIntegralQuotaValue(value, key);
            case INT:
                if (value > Integer.MAX_VALUE) {
                    return new ApiError(Errors.INVALID_REQUEST,
                        "Proposed value for " + key + " is too large for an INT.");
                }
                return getErrorForIntegralQuotaValue(value, key);
            case LONG: {
                if (value > Long.MAX_VALUE) {
                    return new ApiError(Errors.INVALID_REQUEST,
                        "Proposed value for " + key + " is too large for a LONG.");
                }
                return getErrorForIntegralQuotaValue(value, key);
            }
            default:
                return new ApiError(Errors.UNKNOWN_SERVER_ERROR,
                        "Unexpected config type " + configKey.type() + " should be Long or Double");
        }
    }
Apply a quota record to the in-memory state.

@param record    A ClientQuotaRecord instance.
metadata/src/main/java/org/apache/kafka/controller/ClientQuotaControlManager.java