Skip to main content

RoleBuilder

Struct RoleBuilder 

Source
pub struct RoleBuilder { /* private fields */ }
Expand description

Builder for IAM roles.

§Example

use rusty_cdk_core::stack::StackBuilder;
use rusty_cdk_core::iam::{RoleBuilder, RolePropertiesBuilder, AssumeRolePolicyDocumentBuilder, StatementBuilder, PrincipalBuilder, Effect};
use rusty_cdk_core::stack::Resource;
use rusty_cdk_macros::iam_action;
use rusty_cdk_core::wrappers::IamAction;

let mut stack_builder = StackBuilder::new();

let assume_role_statement = StatementBuilder::new(
    vec![iam_action!("sts:AssumeRole")],
    Effect::Allow
)
.principal(PrincipalBuilder::new().service("lambda.amazonaws.com").build())
.build();

let assume_role_policy = AssumeRolePolicyDocumentBuilder::new(vec![assume_role_statement]).build();

let properties = RolePropertiesBuilder::new(assume_role_policy, vec![])
    .build();

let role = RoleBuilder::new("my-role", properties)
    .build(&mut stack_builder);

Implementations§

Source§

impl RoleBuilder

Source

pub fn new(id: &str, properties: IamRoleProperties) -> RoleBuilder

Creates a new IAM role builder.

§Arguments
  • id - Unique identifier for the role
  • properties - IAM role properties including policies and trust relationships
Source

pub fn build(self, stack_builder: &mut StackBuilder) -> RoleRef

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> 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, 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<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V