Skip to main content

ConditionError

Enum ConditionError 

Source
pub enum ConditionError {
    UnknownOperator(String),
    TypeMismatch {
        expected: String,
        actual: String,
    },
    InvalidBooleanValue,
    InvalidDate {
        error: String,
    },
    MissingContextKey(String),
    InvalidConditionStructure(String),
    InvalidConditionValue {
        operator: String,
        key: String,
        position: Option<usize>,
        expected: String,
    },
    OperatorWithoutKey {
        operator: String,
    },
    OperatorKeyMismatch {
        operator: String,
        key: String,
        key_type: String,
    },
}
Expand description

Error types for condition evaluation

An error names what the policy’s author wrote and must fix — the operator, the key, the position of an element — and the KIND of a value, never the value itself, neither the policy’s nor the request’s: a caller logging the error must not echo text it has not checked (wami 001).

Variants§

§

UnknownOperator(String)

§

TypeMismatch

Fields

§expected: String
§actual: String
§

InvalidBooleanValue

A string that is neither true nor false where a boolean is read.

§

InvalidDate

A string that is not an RFC 3339 date where a date is read.

Fields

§error: String

What the date parser objected to — never the input.

§

MissingContextKey(String)

§

InvalidConditionStructure(String)

§

InvalidConditionValue

A value its operator cannot read, refused when the condition is parsed.

It names where the value sits — operator, key, and the element when the value is a list — and what the operator reads, but never the value itself.

Fields

§operator: String

The operator as written in the condition.

§key: String

The condition key the value is compared with.

§position: Option<usize>

The offending element’s index, when the value is a list.

§expected: String

What the operator reads.

§

OperatorWithoutKey

An operator no key can feed: the ForAllValues/ForAnyValue forms of Numeric*, Date* and IpAddress compare a LIST of numbers, dates or addresses, and no declared key holds one (keys::KeyType has no such type; custom keys are compared as strings). Refused at parse rather than kept as a path no parsed policy reaches (wami 001).

Fields

§operator: String

The operator as written in the condition.

§

OperatorKeyMismatch

An operator that cannot compare the type of the key it is given — a string operator on the Boolean aws:SecureTransport, a numeric one on a key nobody declared (compared as a string). Refused at parse: it used to evaluate to false, so a Deny carrying it vanished.

Fields

§operator: String

The operator as written in the condition.

§key: String

The condition key.

§key_type: String

The key’s declared type, or that it is undeclared.

Trait Implementations§

Source§

impl Clone for ConditionError

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for ConditionError

Source§

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

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

impl Display for ConditionError

Source§

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

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

impl Eq for ConditionError

Source§

impl Error for ConditionError

1.30.0 · 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<ConditionError> for AmiError

Source§

fn from(err: ConditionError) -> Self

Converts to this type from the input type.
Source§

impl PartialEq for ConditionError

Source§

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

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for ConditionError

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, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> 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> ToString for T
where T: Display + ?Sized,

Source§

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 = !

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

fn try_from(value: U) -> Result<T, !>

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.