Struct cedar_policy::Request
source · pub struct Request(/* private fields */);
Expand description
Represents the request tuple <P, A, R, C> (see the Cedar design doc).
Implementations§
source§impl Request
impl Request
sourcepub fn new(
principal: Option<EntityUid>,
action: Option<EntityUid>,
resource: Option<EntityUid>,
context: Context,
) -> Self
pub fn new( principal: Option<EntityUid>, action: Option<EntityUid>, resource: Option<EntityUid>, context: Context, ) -> Self
Create a Request.
Note that you can create the EntityUid
s using .parse()
on any
string (via the FromStr
implementation for EntityUid
).
The principal, action, and resource fields are optional to support
the case where these fields do not contribute to authorization
decisions (e.g., because they are not used in your policies).
If any of the fields are None
, we will automatically generate
a unique entity UID that is not equal to any UID in the store.
sourcepub fn principal(&self) -> Option<&EntityUid>
pub fn principal(&self) -> Option<&EntityUid>
Get the principal component of the request. Returns None
if the principal is
“unspecified” (i.e., constructed by passing None
into the constructor) or
“unknown” (i.e., constructed using the partial evaluation APIs).
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Request
impl RefUnwindSafe for Request
impl Send for Request
impl Sync for Request
impl Unpin for Request
impl UnwindSafe for Request
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> 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