/// <summary> /// Checks if table for snapshots with given names exists. If not it creates it. /// </summary> /// <exception cref="System.InvalidOperationException">Thrown when DynamoDB table already exists, but with different properties OR when table is being deleted.</exception> /// <exception cref="Amazon.DynamoDBv2.AmazonDynamoDBException">Thrown when timeout occurs when getting table status from AWS.</exception> public static Task CheckCreateSnapshotsTable( this IAmazonDynamoDB dynamoDB, DynamoDBProviderOptions options, int initialReadCapacityUnits, int initialWriteCapacityUnits ) => dynamoDB.CheckCreateTable( options.SnapshotsTableName, options.SnapshotsTableHashKey, options.SnapshotsTableSortKey, initialReadCapacityUnits, initialWriteCapacityUnits );
/// <sumary> /// Checks if table for snapshots with given names exists. If not it creates it. /// </summary> /// <exception cref="System.InvalidOperationException">Thrown when DynamoDB table already exists, but with different properties OR when table is being deleted.</exception> /// <exception cref="Amazon.DynamoDBv2.AmazonDynamoDBException">Thrown when timeout occurs when getting table status from AWS.</exception> public static async Task CheckCreateSnapshotsTable( IAmazonDynamoDB dynamoDBClient, DynamoDBProviderOptions options, int initialReadCapacityUnits, int initialWriteCapacityUnits) { var instance = new DynamoDBHelper(dynamoDBClient); await instance.CheckCreateTable( options.SnapshotsTableName, options.SnapshotsTableHashKey, options.SnapshotsTableSortKey, initialReadCapacityUnits, initialWriteCapacityUnits ); }
public DynamoDBProvider(IAmazonDynamoDB dynamoDBClient, DynamoDBProviderOptions options) { if (dynamoDBClient == null) { throw new ArgumentNullException(nameof(dynamoDBClient)); } _options = options ?? throw new ArgumentNullException(nameof(options)); _dynamoDBContext = new DynamoDBContext( dynamoDBClient, new DynamoDBContextConfig { Conversion = DynamoDBEntryConversion.V2, ConsistentRead = true } ); _eventsTable = Table.LoadTable(dynamoDBClient, options.EventsTableName, DynamoDBEntryConversion.V2); _snapshotsTable = Table.LoadTable(dynamoDBClient, options.SnapshotsTableName, DynamoDBEntryConversion.V2); }