Trait cedar_policy_core::entities::Schema
source · pub trait Schema {
type EntityTypeDescription: EntityTypeDescription;
// Required methods
fn entity_type(
&self,
entity_type: &EntityType,
) -> Option<Self::EntityTypeDescription>;
fn action(&self, action: &EntityUID) -> Option<Arc<Entity>>;
fn entity_types_with_basename<'a>(
&'a self,
basename: &'a Id,
) -> Box<dyn Iterator<Item = EntityType> + 'a>;
}
Expand description
Trait for Schema
s that can inform the parsing of Entity JSON data
Required Associated Types§
sourcetype EntityTypeDescription: EntityTypeDescription
type EntityTypeDescription: EntityTypeDescription
Type returned by entity_type()
. Must implement the EntityTypeDescription
trait
Required Methods§
sourcefn entity_type(
&self,
entity_type: &EntityType,
) -> Option<Self::EntityTypeDescription>
fn entity_type( &self, entity_type: &EntityType, ) -> Option<Self::EntityTypeDescription>
Get an EntityTypeDescription
for the given entity type, or None
if that
entity type is not declared in the schema (in which case entities of that
type should not appear in the JSON data).
sourcefn action(&self, action: &EntityUID) -> Option<Arc<Entity>>
fn action(&self, action: &EntityUID) -> Option<Arc<Entity>>
Get the entity information for the given action, or None
if that
action is not declared in the schema (in which case this action should
not appear in the JSON data).
sourcefn entity_types_with_basename<'a>(
&'a self,
basename: &'a Id,
) -> Box<dyn Iterator<Item = EntityType> + 'a>
fn entity_types_with_basename<'a>( &'a self, basename: &'a Id, ) -> Box<dyn Iterator<Item = EntityType> + 'a>
Get the names of all entity types declared in the schema that have the
given basename (in the sense of Name::basename()
).