Github user zhan849 commented on a diff in the pull request:
https://github.com/apache/helix/pull/174#discussion_r180175528
--- Diff:
helix-rest/src/main/java/org/apache/helix/rest/server/resources/helix/InstanceAccessor.java
---
@@ -223,60 +224,60 @@ public Response
updateInstance(@PathParam("clusterId") String clusterId,
}
switch (cmd) {
- case enable:
- admin.enableInstance(clusterId, instanceName, true);
- break;
- case disable:
- admin.enableInstance(clusterId, instanceName, false);
- break;
- case reset:
- if (!validInstance(node, instanceName)) {
- return badRequest("Instance names are not match!");
- }
- admin.resetPartition(clusterId, instanceName,
- node.get(InstanceProperties.resource.name()).toString(),
(List<String>) OBJECT_MAPPER
-
.readValue(node.get(InstanceProperties.partitions.name()).toString(),
- OBJECT_MAPPER.getTypeFactory()
- .constructCollectionType(List.class,
String.class)));
- break;
- case addInstanceTag:
- if (!validInstance(node, instanceName)) {
- return badRequest("Instance names are not match!");
- }
- for (String tag : (List<String>) OBJECT_MAPPER
-
.readValue(node.get(InstanceProperties.instanceTags.name()).toString(),
-
OBJECT_MAPPER.getTypeFactory().constructCollectionType(List.class,
String.class))) {
- admin.addInstanceTag(clusterId, instanceName, tag);
- }
- break;
- case removeInstanceTag:
- if (!validInstance(node, instanceName)) {
- return badRequest("Instance names are not match!");
- }
- for (String tag : (List<String>) OBJECT_MAPPER
-
.readValue(node.get(InstanceProperties.instanceTags.name()).toString(),
-
OBJECT_MAPPER.getTypeFactory().constructCollectionType(List.class,
String.class))) {
- admin.removeInstanceTag(clusterId, instanceName, tag);
- }
- break;
- case enablePartitions:
- admin.enablePartition(true, clusterId, instanceName,
- node.get(InstanceProperties.resource.name()).getTextValue(),
- (List<String>) OBJECT_MAPPER
-
.readValue(node.get(InstanceProperties.partitions.name()).toString(),
- OBJECT_MAPPER.getTypeFactory()
- .constructCollectionType(List.class,
String.class)));
- break;
- case disablePartitions:
- admin.enablePartition(false, clusterId, instanceName,
- node.get(InstanceProperties.resource.name()).getTextValue(),
- (List<String>) OBJECT_MAPPER
-
.readValue(node.get(InstanceProperties.partitions.name()).toString(),
-
OBJECT_MAPPER.getTypeFactory().constructCollectionType(List.class,
String.class)));
- break;
- default:
- _logger.error("Unsupported command :" + command);
- return badRequest("Unsupported command :" + command);
+ case enable:
--- End diff --
Helix's formatter does not indent case, could you pls revert it back? Same
for other places
---