@Override public boolean equals(Object obj) { if (this == obj) return true; if (!(obj instanceof PolicyType)) return false; PolicyType o = (PolicyType) obj; return Objects.equal(name, o.getName()) && Objects.equal(getConfigKeys(), o.getConfigKeys()); }
@Override public boolean equals(Object obj) { if (this == obj) return true; if (!(obj instanceof PolicyType)) return false; PolicyType o = (PolicyType) obj; return Objects.equal(getName(), o.getName()) && Objects.equal(getConfigKeys(), o.getConfigKeys()); }
public static void dumpInfo(Policy pol, Writer out, String currentIndentation, String tab) throws IOException { out.append(currentIndentation+pol.toString()+"\n"); for (ConfigKey<?> key : sortConfigKeys(pol.getPolicyType().getConfigKeys())) { Object val = ((AbstractPolicy)pol).getConfigMap().getRawConfig(key); if (!isTrivial(val)) { out.append(currentIndentation+tab+tab+key); out.append(" = "); if (isSecret(key.getName())) out.append("xxxxxxxx"); else out.append(""+val); out.append("\n"); } } out.flush(); }
@Override public List<PolicyConfigSummary> list( final String application, final String entityToken, final String policyToken ) { EntityLocal entity = brooklyn().getEntity(application, entityToken); Policy policy = brooklyn().getPolicy(entity, policyToken); List<PolicyConfigSummary> result = Lists.newArrayList(); for (ConfigKey<?> key : policy.getPolicyType().getConfigKeys()) { result.add(PolicyTransformer.policyConfigSummary(brooklyn(), entity, policy, key)); } return result; }
@GET @ApiOperation(value = "Fetch the config keys for a specific policy", responseClass = "brooklyn.rest.domain.ConfigSummary", multiValueResponse = true) @ApiErrors(value = { @ApiError(code = 404, reason = "Could not find application or entity or policy") }) public List<PolicyConfigSummary> list( @ApiParam(value = "Application ID or name", required = true) @PathParam("application") final String application, @ApiParam(value = "Entity ID or name", required = true) @PathParam("entity") final String entityToken, @ApiParam(value = "Policy ID or name", required = true) @PathParam("policy") final String policyToken ) { EntityLocal entity = brooklyn().getEntity(application, entityToken); Policy policy = brooklyn().getPolicy(entity, policyToken); List<PolicyConfigSummary> result = Lists.newArrayList(); for (ConfigKey<?> key : policy.getPolicyType().getConfigKeys()) { result.add(new PolicyConfigSummary(entity, policy, key)); } return result; }