Skip to content

Commit 508f6dd

Browse files
rlhagermbrmur
andauthored
Go: Default to on-demand tables in DynamoDB examples. (#7277)
* Updates to billing mode for DynamoDB examples in Go. * Update README.md --------- Co-authored-by: Brian Murray <[email protected]>
1 parent 7586320 commit 508f6dd

File tree

3 files changed

+14
-19
lines changed

3 files changed

+14
-19
lines changed

gov2/dynamodb/README.md

+10-10
Original file line numberDiff line numberDiff line change
@@ -41,18 +41,18 @@ Code examples that show you how to perform the essential operations within a ser
4141
Code excerpts that show you how to call individual service functions.
4242

4343
- [BatchExecuteStatement](actions/partiql.go#L7)
44-
- [BatchWriteItem](actions/table_basics.go#L177)
44+
- [BatchWriteItem](actions/table_basics.go#L175)
4545
- [CreateTable](actions/table_basics.go#L54)
46-
- [DeleteItem](actions/table_basics.go#L332)
47-
- [DeleteTable](actions/table_basics.go#L347)
46+
- [DeleteItem](actions/table_basics.go#L330)
47+
- [DeleteTable](actions/table_basics.go#L345)
4848
- [DescribeTable](actions/table_basics.go#L31)
4949
- [ExecuteStatement](actions/partiql.go#L7)
50-
- [GetItem](actions/table_basics.go#L221)
51-
- [ListTables](actions/table_basics.go#L99)
52-
- [PutItem](actions/table_basics.go#L121)
53-
- [Query](actions/table_basics.go#L243)
54-
- [Scan](actions/table_basics.go#L285)
55-
- [UpdateItem](actions/table_basics.go#L140)
50+
- [GetItem](actions/table_basics.go#L219)
51+
- [ListTables](actions/table_basics.go#L97)
52+
- [PutItem](actions/table_basics.go#L119)
53+
- [Query](actions/table_basics.go#L241)
54+
- [Scan](actions/table_basics.go#L283)
55+
- [UpdateItem](actions/table_basics.go#L138)
5656

5757
### Scenarios
5858

@@ -160,4 +160,4 @@ in the `gov2` folder.
160160

161161
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
162162

163-
SPDX-License-Identifier: Apache-2.0
163+
SPDX-License-Identifier: Apache-2.0

gov2/dynamodb/actions/table_basics.go

+3-5
Original file line numberDiff line numberDiff line change
@@ -74,11 +74,8 @@ func (basics TableBasics) CreateMovieTable(ctx context.Context) (*types.TableDes
7474
AttributeName: aws.String("title"),
7575
KeyType: types.KeyTypeRange,
7676
}},
77-
TableName: aws.String(basics.TableName),
78-
ProvisionedThroughput: &types.ProvisionedThroughput{
79-
ReadCapacityUnits: aws.Int64(10),
80-
WriteCapacityUnits: aws.Int64(10),
81-
},
77+
TableName: aws.String(basics.TableName),
78+
BillingMode: types.BillingModePayPerRequest,
8279
})
8380
if err != nil {
8481
log.Printf("Couldn't create table %v. Here's why: %v\n", basics.TableName, err)
@@ -90,6 +87,7 @@ func (basics TableBasics) CreateMovieTable(ctx context.Context) (*types.TableDes
9087
log.Printf("Wait for table exists failed. Here's why: %v\n", err)
9188
}
9289
tableDesc = table.TableDescription
90+
log.Printf("Ccreating table test")
9391
}
9492
return tableDesc, err
9593
}

gov2/dynamodb/stubs/table_basics_stubs.go

+1-4
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,7 @@ func StubCreateTable(tableName string, raiseErr *testtools.StubError) testtools.
4545
AttributeName: aws.String("title"),
4646
KeyType: types.KeyTypeRange,
4747
}},
48-
ProvisionedThroughput: &types.ProvisionedThroughput{
49-
ReadCapacityUnits: aws.Int64(10),
50-
WriteCapacityUnits: aws.Int64(10),
51-
},
48+
BillingMode: types.BillingModePayPerRequest,
5249
},
5350
Output: &dynamodb.CreateTableOutput{TableDescription: &types.TableDescription{
5451
TableName: aws.String(tableName)}},

0 commit comments

Comments
 (0)