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
impl RoleBuilder
Sourcepub fn new(id: &str, properties: IamRoleProperties) -> RoleBuilder
pub fn new(id: &str, properties: IamRoleProperties) -> RoleBuilder
Creates a new IAM role builder.
§Arguments
id- Unique identifier for the roleproperties- IAM role properties including policies and trust relationships
pub fn build(self, stack_builder: &mut StackBuilder) -> RoleRef
Auto Trait Implementations§
impl Freeze for RoleBuilder
impl RefUnwindSafe for RoleBuilder
impl Send for RoleBuilder
impl Sync for RoleBuilder
impl Unpin for RoleBuilder
impl UnwindSafe for RoleBuilder
Blanket Implementations§
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreCreates a shared type from an unshared type.