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<S: RequestSchema>(
principal: (EntityUID, Option<Loc>),
action: (EntityUID, Option<Loc>),
resource: (EntityUID, Option<Loc>),
context: Context,
schema: Option<&S>,
extensions: &Extensions<'_>,
) -> Result<Self, S::Error>
pub fn new<S: RequestSchema>( principal: (EntityUID, Option<Loc>), action: (EntityUID, Option<Loc>), resource: (EntityUID, Option<Loc>), context: Context, schema: Option<&S>, extensions: &Extensions<'_>, ) -> Result<Self, S::Error>
Default constructor.
If schema
is provided, this constructor validates that this Request
complies with the given schema
.
Sourcepub fn new_with_unknowns<S: RequestSchema>(
principal: EntityUIDEntry,
action: EntityUIDEntry,
resource: EntityUIDEntry,
context: Option<Context>,
schema: Option<&S>,
extensions: &Extensions<'_>,
) -> Result<Self, S::Error>
pub fn new_with_unknowns<S: RequestSchema>( principal: EntityUIDEntry, action: EntityUIDEntry, resource: EntityUIDEntry, context: Option<Context>, schema: Option<&S>, extensions: &Extensions<'_>, ) -> Result<Self, S::Error>
Create a new Request
with potentially unknown (for partial eval) variables.
If schema
is provided, this constructor validates that this Request
complies with the given schema
(at least to the extent that we can
validate with the given information)
Sourcepub fn new_unchecked(
principal: EntityUIDEntry,
action: EntityUIDEntry,
resource: EntityUIDEntry,
context: Option<Context>,
) -> Self
pub fn new_unchecked( principal: EntityUIDEntry, action: EntityUIDEntry, resource: EntityUIDEntry, context: Option<Context>, ) -> Self
Create a new Request
with potentially unknown (for partial eval) variables/context
and without schema validation.
Sourcepub fn principal(&self) -> &EntityUIDEntry
pub fn principal(&self) -> &EntityUIDEntry
Get the principal associated with the request
Sourcepub fn action(&self) -> &EntityUIDEntry
pub fn action(&self) -> &EntityUIDEntry
Get the action associated with the request
Sourcepub fn resource(&self) -> &EntityUIDEntry
pub fn resource(&self) -> &EntityUIDEntry
Get the resource associated with the request
Sourcepub fn context(&self) -> Option<&Context>
pub fn context(&self) -> Option<&Context>
Get the context associated with the request
Returning None
means the variable is unknown, and will result in a residual expression
Sourcepub fn to_request_type(&self) -> Option<RequestType>
pub fn to_request_type(&self) -> Option<RequestType>
Get the request types that correspond to this request.
This includes the types of the principal, action, and resource.
RequestType
is used by the entity manifest.
The context type is implied by the action’s type.
Returns None
if the request is not fully concrete.
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)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