pub struct TableBuilder<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<T: TableBuilderState> TableBuilder<T>
impl<T: TableBuilderState> TableBuilder<T>
pub fn sort_key(self, key: Key) -> Self
pub fn table_name(self, name: StringWithOnlyAlphaNumericsAndUnderscores) -> Self
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) -> Self
pub fn max_write_capacity(self, capacity: NonZeroNumber) -> Self
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