Struct cedar_policy_validator::ValidatorSchema

source ·
pub struct ValidatorSchema { /* private fields */ }

Implementations§

source§

impl ValidatorSchema

source

pub fn empty() -> ValidatorSchema

source

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).

source

pub fn from_file(file: impl Read, extensions: Extensions<'_>) -> Result<Self>

Construct a ValidatorSchema directly from a file.

source

pub fn from_file_natural( r: impl Read, extensions: Extensions<'_> ) -> Result<(Self, impl Iterator<Item = SchemaWarning>), HumanSchemaError>

source

pub fn from_str_natural( src: &str, extensions: Extensions<'_> ) -> Result<(Self, impl Iterator<Item = SchemaWarning>), HumanSchemaError>

source

pub fn from_schema_file( schema_file: SchemaFragment, action_behavior: ActionBehavior, extensions: Extensions<'_> ) -> Result<ValidatorSchema>

source

pub fn from_schema_fragments( fragments: impl IntoIterator<Item = ValidatorSchemaFragment> ) -> Result<ValidatorSchema>

Construct a new ValidatorSchema from some number of schema fragments.

source

pub fn get_action_id(&self, action_id: &EntityUID) -> Option<&ValidatorActionId>

Lookup the ValidatorActionId object in the schema with the given name.

source

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.

source

pub fn entity_types( &self ) -> impl Iterator<Item = (&Name, &ValidatorEntityType)>

An iterator matching the entity Types to their Validator Types

source

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.

source

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

source§

fn clone(&self) -> ValidatorSchema

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for ValidatorSchema

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl FromStr for ValidatorSchema

§

type Err = SchemaError

The associated error which can be returned from parsing.
source§

fn from_str(s: &str) -> Result<Self>

Parses a string s to return a value of this type. Read more
source§

impl RequestSchema for ValidatorSchema

§

type Error = RequestValidationError

Error type returned when a request fails validation
source§

fn validate_request( &self, request: &Request, extensions: Extensions<'_> ) -> Result<(), Self::Error>

Validate the given request, returning Err if it fails validation
source§

impl Serialize for ValidatorSchema

source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
source§

impl TryFrom<SchemaFragment> for ValidatorSchema

§

type Error = SchemaError

The type returned in the event of a conversion error.
source§

fn try_from(frag: SchemaFragment) -> Result<ValidatorSchema>

Performs the conversion.

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> IntoEither for T

source§

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 more
source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.