pub struct Statement {
pub sid: Option<String>,
pub principal: Option<Principal>,
pub effect: Effect,
pub action: Action,
pub resource: Resource,
pub condition: Option<HashMap<ConditionOperator, HashMap<QString, OneOrAll<ConditionValue>>>>,
}
Expand description
The Statement element is the main element for a policy. This element is required. It can
include multiple elements (see the subsequent sections in this page). The Statement element
contains an array of individual statements. Each individual statement is a JSON block
enclosed in braces { }
.
Fields§
§sid: Option<String>
The Sid (statement ID) is an optional identifier that you provide for the policy statement. You can assign a Sid value to each statement in a statement array. In services that let you specify an ID element, such as SQS and SNS, the Sid value is just a sub-ID of the policy document’s ID. In IAM, the Sid value must be unique within a JSON policy
In IAM, the Sid is not exposed in the IAM API. You can’t retrieve a particular statement based on this ID.
principal: Option<Principal>
The principals, or not-principals to match as part of this statement.
effect: Effect
The effect, outcome, if this statement is matched.
action: Action
The actions, or not-actions to match as part of this statement.
resource: Resource
The resources, or not-resources to match as part of this statement.
condition: Option<HashMap<ConditionOperator, HashMap<QString, OneOrAll<ConditionValue>>>>
Any condition(s) attached to this statement.
Implementations§
Source§impl Statement
impl Statement
Sourcepub fn new(effect: Effect, action: Action, resource: Resource) -> Self
pub fn new(effect: Effect, action: Action, resource: Resource) -> Self
Create a minimal Statement
with only required fields.
§Example
use aws_iam::model::*;
use aws_iam::model::builder::*;
use std::str::FromStr;
let statement = Statement::new(
Effect::Allow,
Action::Action(OneOrAny::One("s3:ListBucket".parse().unwrap())),
Resource::this("arn:aws:s3:::example_bucket".to_string()),
);