public static Map<String, String> buildUserQuotaHeadersMap(ThrottlingRecommendation throttlingRecommendation) {
    if (throttlingRecommendation.getQuotaUsagePercentage().isEmpty()) {
      return Collections.emptyMap();
    }

    Map<String, String> quotaHeadersMap = new HashMap<>();
    // set usage headers.
    quotaHeadersMap.put(RequestQuotaHeaders.USER_QUOTA_USAGE, KVHeaderValueEncoderDecoder.encodeKVHeaderValue(
        throttlingRecommendation.getQuotaUsagePercentage()
            .entrySet()
            .stream()
            .collect(Collectors.toMap(e -> e.getKey().name(), e -> String.valueOf(e.getValue())))));

    // set retry header if present.
    if (throttlingRecommendation.getRetryAfterMs() != ThrottlingRecommendation.NO_RETRY_AFTER_MS) {
      quotaHeadersMap.put(RequestQuotaHeaders.RETRY_AFTER_MS,
          String.valueOf(throttlingRecommendation.getRetryAfterMs()));
    }

    // set the warning header.
    quotaHeadersMap.put(RequestQuotaHeaders.USER_QUOTA_WARNING, throttlingRecommendation.getQuotaUsageLevel().name());
    return quotaHeadersMap;
  }
Build the user quota headers map.
@param throttlingRecommendation {@link ThrottlingRecommendation} object.
@return Map of request headers key-value pair related to request quota.
ambry-api/src/main/java/com/github/ambry/rest/RestUtils.java