Skip to content

Commit 1ede7c3

Browse files
committed
Split Initialize into two overloads with separate xmldoc
1 parent 3bce1ef commit 1ede7c3

File tree

2 files changed

+22
-10
lines changed

2 files changed

+22
-10
lines changed

RELEASE_NOTES.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
### 0.10.0-beta
22
* Added `TableContext` constructor (replaces `TableContext.Create(verifyTable = false)`)
3-
* Added `TableContext.Scripting.Initialize` (replaces `TableContext.Create()`)
43
* Added `TableContext.VerifyOrCreateTableAsync` (replaces `TableContext.VerifyTableAsync(createIfNotExists = true)`)
54
* Added `TableContext.UpdateTableIfRequiredAsync` (conditional `UpdateTableAsync` to establish specified `throughput` or `streaming` only if required. Replaces `UpdateProvisionedThroughputAsync`)
6-
* Added `Throughput.OnDemand` mode (sets `BillingMode` to `PAY_PER_REQUEST` rather than attempting to configure a `ProvisionedThroughput`)
7-
* Added ability to configure DynamoDB streaming (via `Streaming` DU) to `VerifyOrCreateTableAsync` and `UpdateTableIfRequiredAsync`
5+
* Added `TableContext.Scripting.Initialize` (two overloads, replacing `TableContext.Create()` and `TableContext.Create(createIfNotExists = true)`)
6+
* Added `Throughput.OnDemand` mode (sets `BillingMode` to `PAY_PER_REQUEST`, to go with the existing support for configuring `PROVISIONED` and a `ProvisionedThroughput`)
7+
* Added ability to configure DynamoDB streaming (via a `Streaming` DU) to `VerifyOrCreateTableAsync` and `UpdateTableIfRequiredAsync`
88
* Obsoleted `TableContext.Create` (replace with `TableContext.Scripting.Initialize`, `TableContext.VerifyOrCreateTableAsync`, `TableContext.VerifyTableAsync`)
99
* Obsoleted `TableContext.UpdateProvisionedThroughputAsync` (replace with `TableContext.UpdateTableIfRequiredAsync`)
1010
* (breaking) Obsoleted `TableContext.VerifyTableAsync` optional argument to create a Table (replace with `VerifyOrCreateTableAsync`)

src/FSharp.AWS.DynamoDB/TableContext.fs

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1113,18 +1113,30 @@ type TableContext internal () =
11131113
/// </summary>
11141114
module Scripting =
11151115

1116-
/// Factory method that allows one to include auto-initialization easily for scripting scenarios
1116+
/// Factory methods for scripting scenarios
11171117
type TableContext internal () =
11181118

1119-
/// <summary>Creates a DynamoDB client instance for the specified F# record type, client and table name.</summary>
1119+
/// <summary>
1120+
/// Creates a DynamoDB client instance for the specified F# record type, client and table name.<br/>
1121+
/// Validates the table exists, and has the correct schema as per <c>VerifyTableAsync</c>.<br/>
1122+
/// See other overload for <c>VerifyOrCreateTableAsync</c> semantics.
1123+
/// </summary>
1124+
/// <param name="client">DynamoDB client instance.</param>
1125+
/// <param name="tableName">Table name to target.</param>
1126+
static member Initialize<'TRecord>(client : IAmazonDynamoDB, tableName : string) : TableContext<'TRecord> =
1127+
let context = TableContext<'TRecord>(client, tableName)
1128+
context.VerifyTableAsync() |> Async.RunSynchronously
1129+
context
1130+
1131+
/// Creates a DynamoDB client instance for the specified F# record type, client and table name.<br/>
1132+
/// Either validates the table exists and has the correct schema, or creates a fresh one, as per <c>VerifyOrCreateTableAsync</c>.<br/>
1133+
/// See other overload for <c>VerifyTableAsync</c> semantics.
11201134
/// <param name="client">DynamoDB client instance.</param>
11211135
/// <param name="tableName">Table name to target.</param>
1122-
/// <param name="throughput">Optional throughput to configure if the Table does not yet exist.</param>
1123-
static member Initialize<'TRecord>(client : IAmazonDynamoDB, tableName : string, ?throughput) : TableContext<'TRecord> =
1136+
/// <param name="throughput">Throughput to configure if the Table does not yet exist.</param>
1137+
static member Initialize<'TRecord>(client : IAmazonDynamoDB, tableName : string, throughput) : TableContext<'TRecord> =
11241138
let context = TableContext<'TRecord>(client, tableName)
1125-
match throughput with
1126-
| None -> context.VerifyTableAsync() |> Async.RunSynchronously
1127-
| Some t -> context.VerifyOrCreateTableAsync(t) |> Async.RunSynchronously
1139+
context.VerifyOrCreateTableAsync(throughput) |> Async.RunSynchronously
11281140
context
11291141

11301142
type TableContext<'TRecord> with

0 commit comments

Comments
 (0)