| 317 | } |
| 318 | |
| 319 | pub(crate) fn call_cedar(call: &str, input: &str) -> String { |
| 320 | let result = match call { |
| 321 | V0_AUTH_OP => is_authorized_json_str(input), |
| 322 | #[cfg(feature = "partial-eval")] |
| 323 | V0_AUTH_PARTIAL_OP => is_authorized_partial_json_str(input), |
| 324 | V0_VALIDATE_OP => validate_json_str(input), |
| 325 | V0_VALIDATE_ENTITIES => json_validate_entities(&input), |
| 326 | V0_VALIDATE_LEVEL_OP => validate_with_level_json_str(input), |
| 327 | V0_STATEFUL_AUTH_OP => json_stateful_is_authorized(input), |
| 328 | _ => { |
| 329 | let ires = Answer::fail_internally(format!("unsupported operation: {}", call)); |
| 330 | serde_json::to_string(&ires) |
| 331 | } |
| 332 | }; |
| 333 | result.unwrap_or_else(|err| { |
| 334 | panic!("failed to handle call {call} with input {input}\nError: {err}") |
| 335 | }) |
| 336 | } |
| 337 | |
| 338 | #[derive(Deserialize)] |
| 339 | #[serde(rename_all = "camelCase")] |