cedar_policy_validator

Enum ValidationError

Source
pub enum ValidationError {
Show 16 variants UnrecognizedEntityType(UnrecognizedEntityType), UnrecognizedActionId(UnrecognizedActionId), InvalidActionApplication(InvalidActionApplication), UnexpectedType(UnexpectedType), IncompatibleTypes(IncompatibleTypes), UnsafeAttributeAccess(UnsafeAttributeAccess), UnsafeOptionalAttributeAccess(UnsafeOptionalAttributeAccess), UnsafeTagAccess(UnsafeTagAccess), NoTagsAllowed(NoTagsAllowed), UndefinedFunction(UndefinedFunction), WrongNumberArguments(WrongNumberArguments), FunctionArgumentValidation(FunctionArgumentValidation), EmptySetForbidden(EmptySetForbidden), NonLitExtConstructor(NonLitExtConstructor), HierarchyNotRespected(HierarchyNotRespected), InternalInvariantViolation(InternalInvariantViolation),
}
Expand description

An error generated by the validator when it finds a potential problem in a policy. The error contains a enumeration that specifies the kind of problem, and provides details specific to that kind of problem. The error also records where the problem was encountered.

Variants§

§

UnrecognizedEntityType(UnrecognizedEntityType)

A policy contains an entity type that is not declared in the schema.

§

UnrecognizedActionId(UnrecognizedActionId)

A policy contains an action that is not declared in the schema.

§

InvalidActionApplication(InvalidActionApplication)

There is no action satisfying the action scope constraint that can be applied to a principal and resources that both satisfy their respective scope conditions.

§

UnexpectedType(UnexpectedType)

The typechecker expected to see a subtype of one of the types in expected, but saw actual.

§

IncompatibleTypes(IncompatibleTypes)

The typechecker could not compute a least upper bound for types.

§

UnsafeAttributeAccess(UnsafeAttributeAccess)

The typechecker detected an access to a record or entity attribute that it could not statically guarantee would be present.

§

UnsafeOptionalAttributeAccess(UnsafeOptionalAttributeAccess)

The typechecker could not conclude that an access to an optional attribute was safe.

§

UnsafeTagAccess(UnsafeTagAccess)

The typechecker could not conclude that an access to a tag was safe.

§

NoTagsAllowed(NoTagsAllowed)

.getTag() on an entity type which cannot have tags according to the schema.

§

UndefinedFunction(UndefinedFunction)

Undefined extension function.

§

WrongNumberArguments(WrongNumberArguments)

Incorrect number of arguments in an extension function application.

§

FunctionArgumentValidation(FunctionArgumentValidation)

Incorrect call style in an extension function application. Error returned by custom extension function argument validation

§

EmptySetForbidden(EmptySetForbidden)

The policy uses an empty set literal in a way that is forbidden

§

NonLitExtConstructor(NonLitExtConstructor)

The policy passes a non-literal to an extension constructor, which is forbidden in strict validation

§

HierarchyNotRespected(HierarchyNotRespected)

To pass strict validation a policy cannot contain an in expression where the entity type on the left might not be able to be a member of the entity type on the right.

§

InternalInvariantViolation(InternalInvariantViolation)

Returned when an internal invariant is violated (should not happen; if this is ever returned, please file an issue)

Trait Implementations§

Source§

impl Clone for ValidationError

Source§

fn clone(&self) -> ValidationError

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 ValidationError

Source§

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

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

impl Diagnostic for ValidationError

Source§

fn code(&self) -> Option<Box<dyn Display + '_>>

Unique diagnostic code that can be used to look up more information about this Diagnostic. Ideally also globally unique, and documented in the toplevel crate’s documentation for easy searching. Rust path format (foo::bar::baz) is recommended, but more classic codes like E0123 or enums will work just fine.
Source§

fn help(&self) -> Option<Box<dyn Display + '_>>

Additional help text related to this Diagnostic. Do you have any advice for the poor soul who’s just run into this issue?
Source§

fn severity(&self) -> Option<Severity>

Diagnostic severity. This may be used by ReportHandlers to change the display format of this diagnostic. Read more
Source§

fn labels(&self) -> Option<Box<dyn Iterator<Item = LabeledSpan> + '_>>

Labels to apply to this Diagnostic’s Diagnostic::source_code
Source§

fn source_code(&self) -> Option<&dyn SourceCode>

Source code to apply this Diagnostic’s Diagnostic::labels to.
Source§

fn related(&self) -> Option<Box<dyn Iterator<Item = &dyn Diagnostic> + '_>>

Additional related Diagnostics.
Source§

fn url(&self) -> Option<Box<dyn Display + '_>>

URL to visit for a more detailed explanation/help about this Diagnostic.
Source§

fn diagnostic_source(&self) -> Option<&dyn Diagnostic>

The cause of the error.
Source§

impl Display for ValidationError

Source§

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

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

impl Error for ValidationError

Source§

fn source(&self) -> Option<&(dyn Error + 'static)>

Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§

fn description(&self) -> &str

👎Deprecated since 1.42.0: use the Display impl or to_string()
1.0.0 · Source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0: replaced by Error::source, which can support downcasting
Source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type-based access to context intended for error reports. Read more
Source§

impl From<EmptySetForbidden> for ValidationError

Source§

fn from(source: EmptySetForbidden) -> Self

Converts to this type from the input type.
Source§

impl From<FunctionArgumentValidation> for ValidationError

Source§

fn from(source: FunctionArgumentValidation) -> Self

Converts to this type from the input type.
Source§

impl From<HierarchyNotRespected> for ValidationError

Source§

fn from(source: HierarchyNotRespected) -> Self

Converts to this type from the input type.
Source§

impl From<IncompatibleTypes> for ValidationError

Source§

fn from(source: IncompatibleTypes) -> Self

Converts to this type from the input type.
Source§

impl From<InternalInvariantViolation> for ValidationError

Source§

fn from(source: InternalInvariantViolation) -> Self

Converts to this type from the input type.
Source§

impl From<InvalidActionApplication> for ValidationError

Source§

fn from(source: InvalidActionApplication) -> Self

Converts to this type from the input type.
Source§

impl From<NoTagsAllowed> for ValidationError

Source§

fn from(source: NoTagsAllowed) -> Self

Converts to this type from the input type.
Source§

impl From<NonLitExtConstructor> for ValidationError

Source§

fn from(source: NonLitExtConstructor) -> Self

Converts to this type from the input type.
Source§

impl From<UndefinedFunction> for ValidationError

Source§

fn from(source: UndefinedFunction) -> Self

Converts to this type from the input type.
Source§

impl From<UnexpectedType> for ValidationError

Source§

fn from(source: UnexpectedType) -> Self

Converts to this type from the input type.
Source§

impl From<UnrecognizedActionId> for ValidationError

Source§

fn from(source: UnrecognizedActionId) -> Self

Converts to this type from the input type.
Source§

impl From<UnrecognizedEntityType> for ValidationError

Source§

fn from(source: UnrecognizedEntityType) -> Self

Converts to this type from the input type.
Source§

impl From<UnsafeAttributeAccess> for ValidationError

Source§

fn from(source: UnsafeAttributeAccess) -> Self

Converts to this type from the input type.
Source§

impl From<UnsafeOptionalAttributeAccess> for ValidationError

Source§

fn from(source: UnsafeOptionalAttributeAccess) -> Self

Converts to this type from the input type.
Source§

impl From<UnsafeTagAccess> for ValidationError

Source§

fn from(source: UnsafeTagAccess) -> Self

Converts to this type from the input type.
Source§

impl From<WrongNumberArguments> for ValidationError

Source§

fn from(source: WrongNumberArguments) -> Self

Converts to this type from the input type.
Source§

impl Hash for ValidationError

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for ValidationError

Source§

fn eq(&self, other: &ValidationError) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Eq for ValidationError

Source§

impl StructuralPartialEq for ValidationError

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
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,

Source§

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> ToSmolStr for T
where T: Display + ?Sized,

Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

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

Source§

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>,

Source§

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.