/*
  * For tenant creation
  */
 @Override
 @Post("json")
 public Representation post(Representation entity) {
   StringRepresentation presentation = null;
   try {
     PinotResourceManagerResponse response = null;
     final Tenant tenant = _objectMapper.readValue(entity.getText(), Tenant.class);
     switch (tenant.getTenantRole()) {
       case BROKER:
         response = _pinotHelixResourceMananger.createBrokerTenant(tenant);
         presentation = new StringRepresentation(response.toString());
         break;
       case SERVER:
         response = _pinotHelixResourceMananger.createServerTenant(tenant);
         presentation = new StringRepresentation(response.toString());
         break;
       default:
         throw new RuntimeException("Not a valid tenant creation call");
     }
   } catch (final Exception e) {
     presentation = exceptionToStringRepresentation(e);
     LOGGER.error("Caught exception while processing put request", e);
     setStatus(Status.SERVER_ERROR_INTERNAL);
   }
   return presentation;
 }
 public static JSONObject buildBrokerTenantCreateRequestJSON(
     String tenantName, int numberOfInstances) throws JSONException {
   Tenant tenant =
       new TenantBuilder(tenantName)
           .setRole(TenantRole.BROKER)
           .setTotalInstances(numberOfInstances)
           .setOfflineInstances(0)
           .setRealtimeInstances(0)
           .build();
   return tenant.toJSON();
 }