tibrewalpratik17 commented on code in PR #10993: URL: https://github.com/apache/pinot/pull/10993#discussion_r1248335682
########## pinot-controller/src/main/java/org/apache/pinot/controller/api/resources/PinotTenantRestletResource.java: ########## @@ -203,19 +204,36 @@ public TenantsList getAllTenants( @GET @Path("/tenants/{tenantName}") @Produces(MediaType.APPLICATION_JSON) - @ApiOperation(value = "List instance for a tenant, or enable/disable/drop a tenant") + @ApiOperation(value = "List instance for a tenant") @ApiResponses(value = { @ApiResponse(code = 200, message = "Success"), @ApiResponse(code = 500, message = "Error reading tenants list") }) - public String listInstanceOrToggleTenantState( + public String listInstance( + @ApiParam(value = "Tenant name", required = true) @PathParam("tenantName") String tenantName, + @ApiParam(value = "Tenant type (server|broker)") @QueryParam("type") String tenantType, + @ApiParam(value = "Table type (offline|realtime)") @QueryParam("tableType") String tableType) { + return listInstancesForTenant(tenantName, tenantType, tableType); + } + + @POST + @Path("/tenants/{tenantName}") + @Produces(MediaType.APPLICATION_JSON) + @ApiOperation(value = "enable/disable/drop a tenant") + @ApiResponses(value = { + @ApiResponse(code = 200, message = "Success"), + @ApiResponse(code = 500, message = "Error applying state to tenant") + }) + public SuccessResponse toggleTenantState( Review Comment: Yes looks like the logic is same. Marked the other one as deprecated. ########## pinot-controller/src/main/java/org/apache/pinot/controller/api/resources/PinotTenantRestletResource.java: ########## @@ -284,19 +302,24 @@ private String toggleTenantState(String tenantName, String stateStr, @Nullable S _pinotHelixResourceManager.deleteBrokerTenantFor(tenantName); _pinotHelixResourceManager.deleteOfflineServerTenantFor(tenantName); _pinotHelixResourceManager.deleteRealtimeServerTenantFor(tenantName); - return new SuccessResponse("Dropped tenant " + tenantName + " successfully.").toString(); + return new SuccessResponse("Dropped tenant " + tenantName + " successfully."); } - boolean enable = StateType.ENABLE.name().equalsIgnoreCase(stateStr) ? true : false; - for (String instance : allInstances) { - if (enable) { + if (StateType.ENABLE.name().equalsIgnoreCase(stateStr)) { + for (String instance : allInstances) { instanceResult.put(instance, JsonUtils.objectToJsonNode(_pinotHelixResourceManager.enableInstance(instance))); - } else { + } + return new SuccessResponse("Enabled tenant " + tenantName + " successfully."); + } + + if (StateType.DISABLE.name().equalsIgnoreCase(stateStr)) { + for (String instance : allInstances) { instanceResult.put(instance, JsonUtils.objectToJsonNode(_pinotHelixResourceManager.disableInstance(instance))); } + return new SuccessResponse("Disabled tenant " + tenantName + " successfully."); } - return null; + return new SuccessResponse("No-Op done on tenant " + tenantName); Review Comment: Removed. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org For additional commands, e-mail: commits-h...@pinot.apache.org