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.
sourcepub fn action_entities(&self) -> Result<Entities>
pub fn action_entities(&self) -> Result<Entities>
Invert the action hierarchy to get the ancestor relation expected for
the Entity
datatype instead of descendant as stored by 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 Serialize for ValidatorSchema
impl Serialize for ValidatorSchema
source§impl TryFrom<SchemaFragment> for ValidatorSchema
impl TryFrom<SchemaFragment> for ValidatorSchema
source§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 Freeze for ValidatorSchema
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more