pub struct TopicBuilder<T>where
T: TopicBuilderState,{ /* private fields */ }Expand description
Builder for SNS topics.
Supports both standard and FIFO topics with Lambda subscriptions. FIFO topics have additional configuration for deduplication and throughput.
§Example
use rusty_cdk_core::stack::StackBuilder;
use rusty_cdk_core::sns::{TopicBuilder, SubscriptionType};
let mut stack_builder = StackBuilder::new();
// Create a simple topic without subscriptions
let simple_topic = TopicBuilder::new("simple-topic")
.build(&mut stack_builder);
let function = unimplemented!("create a function");
// Create a topic with a Lambda subscription
let topic = TopicBuilder::new("my-topic")
.add_subscription(SubscriptionType::Lambda(&function))
.build(&mut stack_builder);
Implementations§
Source§impl TopicBuilder<StartState>
impl TopicBuilder<StartState>
Sourcepub fn new(id: &str) -> TopicBuilder<StartState>
pub fn new(id: &str) -> TopicBuilder<StartState>
Sourcepub fn add_subscription(
self,
subscription: SubscriptionType<'_>,
) -> TopicBuilder<StandardStateWithSubscriptions>
pub fn add_subscription( self, subscription: SubscriptionType<'_>, ) -> TopicBuilder<StandardStateWithSubscriptions>
Adds a subscription to the topic.
For Lambda subscriptions, automatically creates the necessary permission.
pub fn build(self, stack_builder: &mut StackBuilder) -> TopicRef
Source§impl TopicBuilder<StandardStateWithSubscriptions>
impl TopicBuilder<StandardStateWithSubscriptions>
pub fn add_subscription( self, subscription: SubscriptionType<'_>, ) -> TopicBuilder<StandardStateWithSubscriptions>
pub fn build(self, stack_builder: &mut StackBuilder) -> TopicRef
Source§impl<T> TopicBuilder<T>where
T: TopicBuilderState,
impl<T> TopicBuilder<T>where
T: TopicBuilderState,
pub fn topic_name( self, topic_name: StringWithOnlyAlphaNumericsUnderscoresAndHyphens, ) -> TopicBuilder<T>
pub fn fifo(self) -> TopicBuilder<FifoState>
Source§impl TopicBuilder<FifoState>
impl TopicBuilder<FifoState>
pub fn fifo_throughput_scope( self, scope: FifoThroughputScope, ) -> TopicBuilder<FifoState>
pub fn content_based_deduplication( self, content_based_deduplication: bool, ) -> TopicBuilder<FifoState>
pub fn add_subscription( self, subscription: SubscriptionType<'_>, ) -> TopicBuilder<FifoStateWithSubscriptions>
Sourcepub fn build(self, stack_builder: &mut StackBuilder) -> TopicRef
pub fn build(self, stack_builder: &mut StackBuilder) -> TopicRef
Builds the FIFO topic and adds it to the stack.
Automatically appends the required “.fifo” suffix to the topic name if not already present.
Source§impl TopicBuilder<FifoStateWithSubscriptions>
impl TopicBuilder<FifoStateWithSubscriptions>
pub fn fifo_throughput_scope( self, scope: FifoThroughputScope, ) -> TopicBuilder<FifoStateWithSubscriptions>
pub fn content_based_deduplication( self, content_based_deduplication: bool, ) -> TopicBuilder<FifoStateWithSubscriptions>
pub fn add_subscription( self, subscription: SubscriptionType<'_>, ) -> TopicBuilder<FifoStateWithSubscriptions>
Sourcepub fn build(self, stack_builder: &mut StackBuilder) -> TopicRef
pub fn build(self, stack_builder: &mut StackBuilder) -> TopicRef
Builds the FIFO topic with subscriptions and adds it to the stack.
Automatically appends the required “.fifo” suffix to the topic name if not already present. Creates Lambda permissions for all subscriptions.
Auto Trait Implementations§
impl<T> Freeze for TopicBuilder<T>
impl<T> RefUnwindSafe for TopicBuilder<T>where
T: RefUnwindSafe,
impl<T> Send for TopicBuilder<T>where
T: Send,
impl<T> Sync for TopicBuilder<T>where
T: Sync,
impl<T> Unpin for TopicBuilder<T>where
T: Unpin,
impl<T> UnwindSafe for TopicBuilder<T>where
T: UnwindSafe,
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.