jasperjiaguo commented on code in PR #11578: URL: https://github.com/apache/pinot/pull/11578#discussion_r1372529334
########## pinot-controller/src/main/java/org/apache/pinot/controller/api/resources/PinotTenantRestletResource.java: ########## @@ -286,6 +290,81 @@ public String getTablesOnTenant( } } + @GET + @Path("/tenants/{tenantName}/instancePartitions") + @Authorize(targetType = TargetType.CLUSTER, action = Actions.Cluster.GET_INSTANCE_PARTITIONS) + @Authenticate(AccessType.READ) + @Produces(MediaType.APPLICATION_JSON) + @ApiOperation(value = "Get the instance partitions of a tenant") + @ApiResponses(value = {@ApiResponse(code = 200, message = "Success", response = InstancePartitions.class), + @ApiResponse(code = 404, message = "Instance partitions not found")}) + public InstancePartitions getInstancePartitions( + @ApiParam(value = "Tenant name ", required = true) @PathParam("tenantName") String tenantName, + @ApiParam(value = "instancePartitionType (OFFLINE|CONSUMING|COMPLETED)", required = true, + allowableValues = "OFFLINE, CONSUMING, COMPLETED") + @QueryParam("instancePartitionType") String instancePartitionType) { + String tenantNameWithType = InstancePartitionsType.valueOf(instancePartitionType) + .getInstancePartitionsName(tenantName); + InstancePartitions instancePartitions = + InstancePartitionsUtils.fetchInstancePartitions(_pinotHelixResourceManager.getPropertyStore(), + tenantNameWithType); + + if (instancePartitions == null) { + throw new ControllerApplicationException(LOGGER, + String.format("Failed to find the instance partitions for %s", tenantNameWithType), + Response.Status.NOT_FOUND); + } else { + return instancePartitions; + } + } + + @PUT + @Path("/tenants/{tenantName}/instancePartitions") + @Authorize(targetType = TargetType.CLUSTER, action = Actions.Cluster.UPDATE_INSTANCE_PARTITIONS) + @Authenticate(AccessType.UPDATE) + @Consumes(MediaType.APPLICATION_JSON) + @Produces(MediaType.APPLICATION_JSON) + @ApiOperation(value = "Update an instance partition for a server type in a tenant") + @ApiResponses(value = {@ApiResponse(code = 200, message = "Success", response = InstancePartitions.class), + @ApiResponse(code = 400, message = "Failed to update the tenant")}) Review Comment: Yes, added -- 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