pub enum FromJsonError {
JsonDeserializationError(JsonDeserializationError),
TemplateToPolicy(ExpectedStaticPolicy),
PolicyToTemplate(ExpectedTemplate),
InvalidSlotName,
ActionSlot,
SlotsInConditionClause(SlotsInConditionClause),
MissingOperator,
MultipleOperators {
ops: Vec<SmolStr>,
},
UnescapeError(NonEmpty<UnescapeError>),
InvalidEntityType(ParseErrors),
UnknownExtensionFunction(Name),
InvalidActionType(InvalidActionType),
}
Expand description
Errors arising while converting a policy from its JSON representation (aka EST) into an AST
Variants§
JsonDeserializationError(JsonDeserializationError)
Error while deserializing JSON
TemplateToPolicy(ExpectedStaticPolicy)
Tried to convert an EST representing a template to an AST representing a static policy
PolicyToTemplate(ExpectedTemplate)
Tried to convert an EST representing a static policy to an AST representing a template
InvalidSlotName
Slot name was not valid for the position it was used in. (Currently, principal slots must
be named ?principal
, and resource slots must be named ?resource
.)
ActionSlot
EST contained a template slot for action
. This is not currently allowed
SlotsInConditionClause(SlotsInConditionClause)
EST contained a template slot in policy condition
MissingOperator
EST contained the empty JSON object {}
where a key (operator) was expected
MultipleOperators
EST contained an object with multiple keys (operators) where a single operator was expected
UnescapeError(NonEmpty<UnescapeError>)
Error thrown while processing string escapes
InvalidEntityType(ParseErrors)
Error reported when the entity type tested by an is
expression cannot be parsed.
UnknownExtensionFunction(Name)
Error reported when the extension function name is unknown. Note that unlike the Cedar policy format, the JSON format has no way to distinguish between function-style and method-style calls.
InvalidActionType(InvalidActionType)
Returned when an entity uid used as an action does not have the type Action
Trait Implementations§
Source§impl Debug for FromJsonError
impl Debug for FromJsonError
Source§impl Diagnostic for FromJsonError
impl Diagnostic for FromJsonError
Source§fn code(&self) -> Option<Box<dyn Display + '_>>
fn code(&self) -> Option<Box<dyn Display + '_>>
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 + '_>>
fn help(&self) -> Option<Box<dyn Display + '_>>
Diagnostic
. Do you have any
advice for the poor soul who’s just run into this issue?Source§fn severity(&self) -> Option<Severity>
fn severity(&self) -> Option<Severity>
ReportHandler
s to change the display format
of this diagnostic. Read moreSource§fn labels(&self) -> Option<Box<dyn Iterator<Item = LabeledSpan> + '_>>
fn labels(&self) -> Option<Box<dyn Iterator<Item = LabeledSpan> + '_>>
Diagnostic
’s Diagnostic::source_code
Source§fn source_code(&self) -> Option<&dyn SourceCode>
fn source_code(&self) -> Option<&dyn SourceCode>
Diagnostic
’s Diagnostic::labels
to.Diagnostic
s.Source§fn url(&self) -> Option<Box<dyn Display + '_>>
fn url(&self) -> Option<Box<dyn Display + '_>>
Diagnostic
.Source§fn diagnostic_source(&self) -> Option<&dyn Diagnostic>
fn diagnostic_source(&self) -> Option<&dyn Diagnostic>
Source§impl Display for FromJsonError
impl Display for FromJsonError
Source§impl Error for FromJsonError
impl Error for FromJsonError
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
Source§impl From<ExpectedStaticPolicy> for FromJsonError
impl From<ExpectedStaticPolicy> for FromJsonError
Source§fn from(source: ExpectedStaticPolicy) -> Self
fn from(source: ExpectedStaticPolicy) -> Self
Source§impl From<ExpectedTemplate> for FromJsonError
impl From<ExpectedTemplate> for FromJsonError
Source§fn from(source: ExpectedTemplate) -> Self
fn from(source: ExpectedTemplate) -> Self
Source§impl From<FromJsonError> for PolicySetFromJsonError
impl From<FromJsonError> for PolicySetFromJsonError
Source§fn from(source: FromJsonError) -> Self
fn from(source: FromJsonError) -> Self
Source§impl From<InvalidActionType> for FromJsonError
impl From<InvalidActionType> for FromJsonError
Source§fn from(source: InvalidActionType) -> Self
fn from(source: InvalidActionType) -> Self
Source§impl From<JsonDeserializationError> for FromJsonError
impl From<JsonDeserializationError> for FromJsonError
Source§fn from(source: JsonDeserializationError) -> Self
fn from(source: JsonDeserializationError) -> Self
Source§impl From<SlotsInConditionClause> for FromJsonError
impl From<SlotsInConditionClause> for FromJsonError
Source§fn from(source: SlotsInConditionClause) -> Self
fn from(source: SlotsInConditionClause) -> Self
Source§impl From<UnexpectedSlotError> for FromJsonError
impl From<UnexpectedSlotError> for FromJsonError
Source§fn from(err: UnexpectedSlotError) -> Self
fn from(err: UnexpectedSlotError) -> Self
Auto Trait Implementations§
impl Freeze for FromJsonError
impl !RefUnwindSafe for FromJsonError
impl Send for FromJsonError
impl Sync for FromJsonError
impl Unpin for FromJsonError
impl !UnwindSafe for FromJsonError
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
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>
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>
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