1use cedar_policy::{Entity, EntityUid};
2use hodei_hrn::Hrn;
3
4pub struct EntitySchemaFragment {
5 pub entity_type: &'static str,
6 pub fragment_json: &'static str,
7}
8
9pub struct ActionSchemaFragment {
10 pub name: &'static str,
11 pub fragment_json: &'static str,
12}
13
14pub trait RuntimeHodeiEntityMapper {
15 fn hodei_type_name(&self) -> &'static str;
16 fn hodei_id(&self) -> String;
17 fn hodei_hrn(&self) -> &Hrn;
18
19 fn to_cedar_euid(&self) -> EntityUid {
20 EntityUid::from_type_name_and_id(
21 self.hodei_type_name().parse().unwrap(),
22 self.hodei_hrn().to_string().parse().unwrap(),
23 )
24 }
25 fn to_cedar_entity(&self) -> Entity;
26}
27
28pub trait RuntimeHodeiActionMapper {
29 fn to_cedar_action_euid(&self) -> EntityUid;
30 fn creates_resource_from_payload(&self) -> bool;
31 fn get_payload_as_virtual_entity(&self, context: &dyn std::any::Any) -> Option<Entity>;
32}