[
https://issues.apache.org/jira/browse/HELIX-691?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16430971#comment-16430971
]
ASF GitHub Bot commented on HELIX-691:
--------------------------------------
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
> Allow users to update InstanceConfig
> ------------------------------------
>
> Key: HELIX-691
> URL: https://issues.apache.org/jira/browse/HELIX-691
> Project: Apache Helix
> Issue Type: Improvement
> Reporter: Hunter L
> Priority: Major
>
> In helix-rest, we provide in InstanceAccessor a method updateInstanceConfig
> updates the instance's config through a POST call.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)