@GET
@Path("/current-state")
@ApiOperation(value = "Fetch config key values in batch", notes="Returns a map of config name to value")
public Map<String, Object> batchConfigRead(
@ApiParam(value = "Application ID or name", required = true)
@PathParam("application") String application,
@ApiParam(value = "Entity ID or name", required = true)
@PathParam("entity") String entityToken,
@ApiParam(value = "Policy ID or name", required = true)
@PathParam("policy") String policyToken) {
Policy policy = brooklyn().getPolicy(application, entityToken, policyToken);
Map<ConfigKey<?>, Object> source = policy.getAllConfig();
Map<String, Object> result = Maps.newLinkedHashMap();
for (Map.Entry<ConfigKey<?>, Object> ek: source.entrySet()) {
result.put(ek.getKey().getName(), getValueForDisplay(policy, ek.getValue()));
}
return result;
}