@@ -5,17 +5,15 @@ use crate::scenario::error::Error;
55use aws_sdk_dynamodb:: {
66 operation:: create_table:: builders:: CreateTableFluentBuilder ,
77 types:: {
8- AttributeDefinition , KeySchemaElement , KeyType , ProvisionedThroughput , ScalarAttributeType ,
9- TableStatus , WriteRequest ,
8+ AttributeDefinition , KeySchemaElement , KeyType , ScalarAttributeType , TableStatus ,
9+ WriteRequest ,
1010 } ,
1111 Client ,
1212} ;
1313use futures:: future:: join_all;
1414use std:: { collections:: HashMap , time:: Duration } ;
1515use tracing:: { debug, info, trace} ;
1616
17- const CAPACITY : i64 = 10 ;
18-
1917#[ tracing:: instrument( level = "trace" ) ]
2018pub async fn initialize ( client : & Client , table_name : & str ) -> Result < ( ) , Error > {
2119 info ! ( "Initializing Movies DynamoDB in {table_name}" ) ;
@@ -24,7 +22,7 @@ pub async fn initialize(client: &Client, table_name: &str) -> Result<(), Error>
2422 info ! ( "Found existing table {table_name}" ) ;
2523 } else {
2624 info ! ( "Table does not exist, creating {table_name}" ) ;
27- create_table ( client, table_name, "year" , "title" , CAPACITY ) ?
25+ create_table ( client, table_name, "year" , "title" ) ?
2826 . send ( )
2927 . await ?;
3028 await_table ( client, table_name) . await ?;
@@ -55,9 +53,8 @@ pub fn create_table(
5553 table_name : & str ,
5654 primary_key : & str ,
5755 sort_key : & str ,
58- capacity : i64 ,
5956) -> Result < CreateTableFluentBuilder , Error > {
60- info ! ( "Creating table: {table_name} with capacity {capacity} and key structure {primary_key}:{sort_key}" ) ;
57+ info ! ( "Creating table: {table_name} key structure {primary_key}:{sort_key}" ) ;
6158 Ok ( client
6259 . create_table ( )
6360 . table_name ( table_name)
@@ -89,13 +86,7 @@ pub fn create_table(
8986 . build ( )
9087 . expect ( "Failed to build attribute definition" ) ,
9188 )
92- . provisioned_throughput (
93- ProvisionedThroughput :: builder ( )
94- . read_capacity_units ( capacity)
95- . write_capacity_units ( capacity)
96- . build ( )
97- . expect ( "Failed to specify ProvisionedThroughput" ) ,
98- ) )
89+ . billing_mode ( aws_sdk_dynamodb:: types:: BillingMode :: PayPerRequest ) )
9990}
10091// snippet-end:[dynamodb.rust.movies-create_table_request]
10192
0 commit comments