pub struct StackBuilder { /* private fields */ }Expand description
Builder for CloudFormation stacks.
Collects resources and manages their relationships. Might validate whether IAM roles are missing permissions for AWS services they need to access, based on Cargo.toml dependencies.
§Example
use rusty_cdk_core::stack::StackBuilder;
use rusty_cdk_core::sqs::QueueBuilder;
use rusty_cdk_core::wrappers::*;
let mut stack_builder = StackBuilder::new();
// Add resources to the stack
let queue = QueueBuilder::new("my-queue")
.standard_queue()
.build(&mut stack_builder);
// Add tags to the stack
stack_builder = stack_builder
.add_tag("Environment", "Production")
.add_tag("Owner", "Team");
// Build the stack
let stack = stack_builder.build().expect("Stack to build successfully");Implementations§
Source§impl StackBuilder
impl StackBuilder
pub fn new() -> Self
pub fn add_resource<T: Into<Resource>>(&mut self, resource: T)
pub fn add_tag<T: Into<String>>(self, key: T, value: T) -> Self
pub fn add_output<T: Into<String>>(self, name: T, value: Value) -> Self
Sourcepub fn build(self) -> Result<Stack, StackBuilderError>
pub fn build(self) -> Result<Stack, StackBuilderError>
Builds the stack and validates all resources.
Might return an error if:
- there are duplicate ids
- IAM roles are missing permissions for AWS services they need to access (only when Cargo.toml dependencies were passed in)
Trait Implementations§
Auto Trait Implementations§
impl Freeze for StackBuilder
impl RefUnwindSafe for StackBuilder
impl Send for StackBuilder
impl Sync for StackBuilder
impl Unpin for StackBuilder
impl UnwindSafe for StackBuilder
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