public static Account getAccountFromArgs(Map<String, Object> args) throws RestServiceException {
    Object account = args.get(InternalKeys.TARGET_ACCOUNT_KEY);
    if (account == null) {
      throw new RestServiceException(InternalKeys.TARGET_ACCOUNT_KEY + " is not set",
          RestServiceErrorCode.InternalServerError);
    }
    if (!(account instanceof Account)) {
      throw new RestServiceException(InternalKeys.TARGET_ACCOUNT_KEY + " not instance of Account",
          RestServiceErrorCode.InternalServerError);
    }
    return (Account) account;
  }
Extract the injected {@link Account} from a map of arguments.
@param args a map of arguments that possibly contains the injected {@link Account} and {@link Container}.
@return the {@link Account}
@throws RestServiceException
ambry-api/src/main/java/com/github/ambry/rest/RestUtils.java