use of com.google.api.services.cloudresourcemanager.model.Binding in project google-cloud-java by GoogleCloudPlatform.
the class PolicyMarshaller method toPb.
@Override
protected com.google.api.services.cloudresourcemanager.model.Policy toPb(Policy policy) {
com.google.api.services.cloudresourcemanager.model.Policy policyPb = new com.google.api.services.cloudresourcemanager.model.Policy();
List<Binding> bindingPbList = new LinkedList<>();
for (Map.Entry<Role, Set<Identity>> binding : policy.getBindings().entrySet()) {
Binding bindingPb = new Binding();
bindingPb.setRole(binding.getKey().getValue());
bindingPb.setMembers(Lists.transform(new ArrayList<>(binding.getValue()), new Function<Identity, String>() {
@Override
public String apply(Identity identity) {
return IDENTITY_STR_VALUE_FUNCTION.apply(identity);
}
}));
bindingPbList.add(bindingPb);
}
policyPb.setBindings(bindingPbList);
policyPb.setEtag(policy.getEtag());
policyPb.setVersion(policy.getVersion());
return policyPb;
}
Aggregations