@GET
@Path("/{config}")
@ApiOperation(value = "Fetch config value", responseClass = "Object")
@ApiErrors(value = {
@ApiError(code = 404, reason = "Could not find application, entity, policy or config key")
})
public String get(
@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,
@ApiParam(value = "Config key ID", required = true)
@PathParam("config") String configKeyName
) {
Policy policy = brooklyn().getPolicy(application, entityToken, policyToken);
ConfigKey<?> ck = policy.getPolicyType().getConfigKey(configKeyName);
if (ck == null) throw WebResourceUtils.notFound("Cannot find config key '%s' in policy '%s' of entity '%s'", configKeyName, policy, entityToken);
return getValueForDisplay(policy, policy.getConfig(ck));
}