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