docs: @POST
    @Path("/segment/allocate")
    @Produces(SmileMediaTypes.APPLICATION_JACKSON_SMILE)
    @Consumes(SmileMediaTypes.APPLICATION_JACKSON_SMILE)
    public Response allocateSegment(DateTime timestamp, @Context final HttpServletRequest req)
    {
      ChatHandlers.authorizationCheck(
          req,
          Action.READ,
          getDataSource(),
          authorizerMapper
      );
  
      if (toolbox == null) {
        return Response.status(Response.Status.SERVICE_UNAVAILABLE).entity("task is not running yet").build();
      }
  
      try {
        final SegmentIdWithShardSpec segmentIdentifier = allocateNewSegment(timestamp);
        return Response.ok(toolbox.getObjectMapper().writeValueAsBytes(segmentIdentifier)).build();
      }
      catch (IOException | IllegalStateException e) {
        return Response.serverError().entity(Throwables.getStackTraceAsString(e)).build();
      }
      catch (IllegalArgumentException e) {
        return Response.status(Response.Status.BAD_REQUEST).entity(Throwables.getStackTraceAsString(e)).build();
      }
    }