pub struct PolicyDocument { /* private fields */ }Expand description
Parsed policy document — only the fields the evaluator needs. Any statement that fails to parse (wrong shape, unknown effect, etc.) is dropped with a warn-level log and the rest of the document is still usable, matching how AWS behaves with invalid statements (the broken statement is ignored, not the whole policy).
Implementations§
Source§impl PolicyDocument
impl PolicyDocument
Sourcepub fn parse(json: &str) -> Self
pub fn parse(json: &str) -> Self
Parse a policy document from its JSON string form. Returns an empty document on JSON errors so the caller can fall through to implicit-deny rather than panicking on malformed state.
Sourcepub fn from_value(value: &Value) -> Self
pub fn from_value(value: &Value) -> Self
Parse a policy document from a serde_json::Value. Used by both
PolicyDocument::parse and tests that build inline serde_json!
values.
Sourcepub fn statement_count(&self) -> usize
pub fn statement_count(&self) -> usize
Number of parsed statements in this document. Used by tests as a proxy for “did this statement parse successfully?” without exposing the internal representation.
Trait Implementations§
Source§impl Clone for PolicyDocument
impl Clone for PolicyDocument
Source§fn clone(&self) -> PolicyDocument
fn clone(&self) -> PolicyDocument
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more