Struct cedar_policy_validator::ValidatorSchema
source · pub struct ValidatorSchema { /* private fields */ }
Implementations§
source§impl ValidatorSchema
impl ValidatorSchema
pub fn empty() -> ValidatorSchema
sourcepub fn from_json_value(json: Value) -> Result<Self>
pub fn from_json_value(json: Value) -> Result<Self>
Construct a ValidatorSchema
from a JSON value (which should be an
object matching the SchemaFileFormat
shape).
sourcepub fn from_file(file: impl Read) -> Result<Self>
pub fn from_file(file: impl Read) -> Result<Self>
Construct a ValidatorSchema
directly from a file.
pub fn from_schema_file( schema_file: SchemaFragment, action_behavior: ActionBehavior ) -> Result<ValidatorSchema>
sourcepub fn from_schema_fragments(
fragments: impl IntoIterator<Item = ValidatorSchemaFragment>
) -> Result<ValidatorSchema>
pub fn from_schema_fragments( fragments: impl IntoIterator<Item = ValidatorSchemaFragment> ) -> Result<ValidatorSchema>
Construct a new ValidatorSchema
from some number of schema fragments.
sourcepub fn get_action_id(&self, action_id: &EntityUID) -> Option<&ValidatorActionId>
pub fn get_action_id(&self, action_id: &EntityUID) -> Option<&ValidatorActionId>
Lookup the ValidatorActionId object in the schema with the given name.
sourcepub fn get_entity_type(
&self,
entity_type_id: &Name
) -> Option<&ValidatorEntityType>
pub fn get_entity_type( &self, entity_type_id: &Name ) -> Option<&ValidatorEntityType>
Lookup the ValidatorEntityType object in the schema with the given name.
sourcepub fn entity_types(
&self
) -> impl Iterator<Item = (&Name, &ValidatorEntityType)>
pub fn entity_types( &self ) -> impl Iterator<Item = (&Name, &ValidatorEntityType)>
An iterator matching the entity Types to their Validator Types
sourcepub fn get_context_schema(
&self,
action: &EntityUID
) -> Option<impl ContextSchema>
pub fn get_context_schema( &self, action: &EntityUID ) -> Option<impl ContextSchema>
Since different Actions have different schemas for Context
, you must
specify the Action
in order to get a ContextSchema
.
Returns None
if the action is not in the schema.
pub fn action_entities(&self) -> Result<Entities>
Trait Implementations§
source§impl Clone for ValidatorSchema
impl Clone for ValidatorSchema
source§fn clone(&self) -> ValidatorSchema
fn clone(&self) -> ValidatorSchema
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for ValidatorSchema
impl Debug for ValidatorSchema
source§impl FromStr for ValidatorSchema
impl FromStr for ValidatorSchema
source§impl Schema for ValidatorSchema
impl Schema for ValidatorSchema
source§fn attr_type(&self, entity_type: &EntityType, attr: &str) -> Option<SchemaType>
fn attr_type(&self, entity_type: &EntityType, attr: &str) -> Option<SchemaType>
Do entities of the given type have the given attribute, and if so, what type? Read more
source§fn required_attrs<'s>(
&'s self,
entity_type: &EntityType
) -> Box<dyn Iterator<Item = SmolStr> + 's>
fn required_attrs<'s>( &'s self, entity_type: &EntityType ) -> Box<dyn Iterator<Item = SmolStr> + 's>
Get the names of all the required attributes for the given entity type.
source§impl Serialize for ValidatorSchema
impl Serialize for ValidatorSchema
source§impl TryFrom<SchemaFragment> for ValidatorSchema
impl TryFrom<SchemaFragment> for ValidatorSchema
§type Error = SchemaError
type Error = SchemaError
The type returned in the event of a conversion error.
source§fn try_from(frag: SchemaFragment) -> Result<ValidatorSchema>
fn try_from(frag: SchemaFragment) -> Result<ValidatorSchema>
Performs the conversion.
Auto Trait Implementations§
impl RefUnwindSafe for ValidatorSchema
impl Send for ValidatorSchema
impl Sync for ValidatorSchema
impl Unpin for ValidatorSchema
impl UnwindSafe for ValidatorSchema
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more