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, extensions: Extensions<'_>) -> Result<Self>
pub fn from_json_value(json: Value, extensions: Extensions<'_>) -> 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, extensions: Extensions<'_>) -> Result<Self>
pub fn from_file(file: impl Read, extensions: Extensions<'_>) -> Result<Self>
Construct a ValidatorSchema
directly from a file.
pub fn from_schema_file( schema_file: SchemaFragment, action_behavior: ActionBehavior, extensions: Extensions<'_> ) -> 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<'a>(
&'a self,
entity_type_id: &Name
) -> Option<&'a ValidatorEntityType>
pub fn get_entity_type<'a>( &'a self, entity_type_id: &Name ) -> Option<&'a 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 context_type(&self, action: &EntityUID) -> Option<Type>
pub fn context_type(&self, action: &EntityUID) -> Option<Type>
Get the Type
of context expected for the given action
.
This always reutrns a closed record type.
Returns None
if the action is not in the schema.
sourcepub fn action_entities(&self) -> Result<Entities, EntitiesError>
pub fn action_entities(&self) -> Result<Entities, EntitiesError>
Construct an Entity
object for each action in the schema
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 RequestSchema for ValidatorSchema
impl RequestSchema for ValidatorSchema
§type Error = RequestValidationError
type Error = RequestValidationError
Error type returned when a request fails validation
source§fn validate_request(
&self,
request: &Request,
extensions: Extensions<'_>
) -> Result<(), Self::Error>
fn validate_request( &self, request: &Request, extensions: Extensions<'_> ) -> Result<(), Self::Error>
Validate the given
request
, returning Err
if it fails validationsource§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