CedarPolicySet.fromJson constructor

CedarPolicySet.fromJson(
  1. Map<String, Object?> json
)

Implementation

factory CedarPolicySet.fromJson(Map<String, Object?> json) {
  return CedarPolicySet.build((b) {
    for (final MapEntry(key: id, value: json) in json.entries) {
      final policyOrTemplate =
          CedarPolicy.fromJson(json as Map<String, Object?>);
      if (policyOrTemplate.isTemplate) {
        b.templates[id] = policyOrTemplate;
      } else {
        b.policies[id] = policyOrTemplate;
      }
    }
  });
}