pub struct TableBuilder<T>where
T: TableBuilderState,{ /* private fields */ }Expand description
Builder for DynamoDB tables.
Supports both pay-per-request and provisioned billing modes. The builder enforces the correct configuration based on the chosen billing mode.
§Example
use rusty_cdk_core::stack::StackBuilder;
use rusty_cdk_core::dynamodb::{TableBuilder, Key, AttributeType};
use rusty_cdk_core::wrappers::*;
use rusty_cdk_macros::{string_with_only_alphanumerics_and_underscores, non_zero_number};
let mut stack_builder = StackBuilder::new();
let partition_key = Key::new(
string_with_only_alphanumerics_and_underscores!("id"),
AttributeType::String
);
let sort_key = Key::new(
string_with_only_alphanumerics_and_underscores!("timestamp"),
AttributeType::Number
);
let on_demand_table = TableBuilder::new("on-demand-table", partition_key)
.sort_key(sort_key)
.pay_per_request_billing()
.build(&mut stack_builder);Implementations§
Source§impl TableBuilder<StartState>
impl TableBuilder<StartState>
Sourcepub fn new(id: &str, key: Key) -> TableBuilder<StartState>
pub fn new(id: &str, key: Key) -> TableBuilder<StartState>
Creates a new DynamoDB table builder.
§Arguments
id- Unique identifier for the tablekey- Partition key definition for the table
Source§impl<T> TableBuilder<T>where
T: TableBuilderState,
impl<T> TableBuilder<T>where
T: TableBuilderState,
pub fn sort_key(self, key: Key) -> TableBuilder<T>
pub fn table_name( self, name: StringWithOnlyAlphaNumericsAndUnderscores, ) -> TableBuilder<T>
Sourcepub fn pay_per_request_billing(self) -> TableBuilder<PayPerRequestState>
pub fn pay_per_request_billing(self) -> TableBuilder<PayPerRequestState>
Configures the table to use pay-per-request billing.
With this mode, you pay per request and can optionally set max throughput limits.
Sourcepub fn provisioned_billing(self) -> TableBuilder<ProvisionedStateStart>
pub fn provisioned_billing(self) -> TableBuilder<ProvisionedStateStart>
Configures the table to use provisioned billing.
With this mode, you must specify read and write capacity units.
Source§impl TableBuilder<PayPerRequestState>
impl TableBuilder<PayPerRequestState>
pub fn max_read_capacity( self, capacity: NonZeroNumber, ) -> TableBuilder<PayPerRequestState>
pub fn max_write_capacity( self, capacity: NonZeroNumber, ) -> TableBuilder<PayPerRequestState>
pub fn build(self, stack_builder: &mut StackBuilder) -> TableRef
Source§impl TableBuilder<ProvisionedStateStart>
impl TableBuilder<ProvisionedStateStart>
pub fn read_capacity( self, capacity: NonZeroNumber, ) -> TableBuilder<ProvisionedStateReadSet>
Source§impl TableBuilder<ProvisionedStateReadSet>
impl TableBuilder<ProvisionedStateReadSet>
pub fn write_capacity( self, capacity: NonZeroNumber, ) -> TableBuilder<ProvisionedStateWriteSet>
Source§impl TableBuilder<ProvisionedStateWriteSet>
impl TableBuilder<ProvisionedStateWriteSet>
pub fn build(self, stack_builder: &mut StackBuilder) -> TableRef
Auto Trait Implementations§
impl<T> Freeze for TableBuilder<T>
impl<T> RefUnwindSafe for TableBuilder<T>where
T: RefUnwindSafe,
impl<T> Send for TableBuilder<T>where
T: Send,
impl<T> Sync for TableBuilder<T>where
T: Sync,
impl<T> Unpin for TableBuilder<T>where
T: Unpin,
impl<T> UnwindSafe for TableBuilder<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.