use of com.yahoo.athenz.zms.Policy in project athenz by yahoo.
the class ZTSTestUtils method createPolicyObject.
public static Policy createPolicyObject(final String domainName, final String policyName, final String roleName, boolean generateRoleName, final String action, final String resource, AssertionEffect effect) {
Policy policy = new Policy();
policy.setName(domainName + ":policy." + policyName);
com.yahoo.athenz.zms.Assertion assertion = new com.yahoo.athenz.zms.Assertion();
assertion.setAction(action);
assertion.setEffect(effect);
assertion.setResource(resource);
if (generateRoleName) {
assertion.setRole(domainName + ":role." + roleName);
} else {
assertion.setRole(roleName);
}
List<Assertion> assertList = new ArrayList<>();
assertList.add(assertion);
policy.setAssertions(assertList);
return policy;
}
Aggregations