pub struct Policy { /* private fields */ }Expand description
Compiled bucket policy ready to evaluate requests.
Implementations§
Source§impl Policy
impl Policy
pub fn from_json_str(s: &str) -> Result<Self, String>
pub fn from_path(path: &Path) -> Result<Self, String>
Sourcepub fn evaluate(
&self,
action: &str,
bucket: &str,
key: Option<&str>,
principal_id: Option<&str>,
) -> Decision
pub fn evaluate( &self, action: &str, bucket: &str, key: Option<&str>, principal_id: Option<&str>, ) -> Decision
Evaluate a request against the policy.
principal_id is typically the SigV4 access key id taken from the
authenticated request. Pass None for anonymous (will only match
statements with wildcard or absent Principal).
Convenience for the common case with no Condition data; calls the
full Policy::evaluate_with with a default RequestContext.
Sourcepub fn evaluate_with(
&self,
action: &str,
bucket: &str,
key: Option<&str>,
principal_id: Option<&str>,
ctx: &RequestContext,
) -> Decision
pub fn evaluate_with( &self, action: &str, bucket: &str, key: Option<&str>, principal_id: Option<&str>, ctx: &RequestContext, ) -> Decision
Same as Policy::evaluate but lets the caller plumb a populated
RequestContext for v0.3 #13 IAM Conditions (IP allowlists,
user-agent restrictions, time windows, etc.).
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Policy
impl RefUnwindSafe for Policy
impl Send for Policy
impl Sync for Policy
impl Unpin for Policy
impl UnsafeUnpin for Policy
impl UnwindSafe for Policy
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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