Struct Statement

Source
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 { }.

From IAM JSON Policy Elements: Statement.

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.

From IAM JSON Policy Elements: Sid.

§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

Source

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()),
);
Source

pub fn new_sid() -> String

Construct a new, random, unique, ID for a Statement.

Trait Implementations§

Source§

impl Clone for Statement

Source§

fn clone(&self) -> Statement

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Statement

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for Statement

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl From<&mut StatementBuilder> for Statement

Source§

fn from(sb: &mut StatementBuilder) -> Self

Converts to this type from the input type.
Source§

impl Serialize for Statement

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,