//--- Constructors --- public DynamoTableTransactGetItems(DynamoTable table, TransactGetItemsRequest request) { _table = table ?? throw new ArgumentNullException(nameof(table)); _request = request ?? throw new ArgumentNullException(nameof(request)); _converters = _request.TransactItems .Select(transactItem => new DynamoRequestConverter(transactItem.Get.ExpressionAttributeNames, _table.SerializerOptions)) .ToList(); }
async Task <TransactGetItemsResponse> IAmazonDynamoDB.TransactGetItemsAsync(TransactGetItemsRequest request, CancellationToken cancellationToken) { try { var response = await _dynamoDBClient.TransactGetItemsAsync(request, cancellationToken); _callback?.Invoke(new { Action = nameof(IAmazonDynamoDB.TransactGetItemsAsync), Request = request, Response = response }); return(response); } catch (Exception e) { _callback?.Invoke(new { Action = nameof(IAmazonDynamoDB.TransactGetItemsAsync), Request = request, Exception = new { Type = e.GetType().FullName, Message = e.Message } }); throw; } }
/// <summary> /// Example that gets items in a transaction from DynamoDB /// </summary> /// <returns></returns> public static async Task TransactGetItemsExample() { var client = new AmazonDynamoDBClient(RegionEndpoint.USWest2); var request = new TransactGetItemsRequest { //Up to 25 Items to retrieve from one or more tables but from one or more indexes for a same table. TransactItems = new List <TransactGetItem> { new TransactGetItem() { Get = new Get() { TableName = "RetailDatabase", Key = new Dictionary <string, AttributeValue> { { "pk", new AttributeValue { S = "*****@*****.**" } }, { "sk", new AttributeValue { S = "metadata" } } }, ProjectionExpression = "pk,sk", //Specific attributes to retrieve from the table separated by comas if empty all will be returned } }, new TransactGetItem() { Get = new Get() { TableName = "RetailDatabase", Key = new Dictionary <string, AttributeValue> { { "pk", new AttributeValue { S = "*****@*****.**" } }, { "sk", new AttributeValue { S = "metadata" } } }, } } }, ReturnConsumedCapacity = "TOTAL" }; try { var responseTransaction = await client.TransactGetItemsAsync(request); foreach (var item in responseTransaction.Responses) { foreach (var attribute in item.Item) { Console.WriteLine($"{attribute.Key} : { attribute.Value.S}"); // For the example I'm supposing all the values are string, use the type property that corresponds } Console.WriteLine(string.Empty); } } catch (Exception e) { Console.Error.WriteLine(e.Message); } }
public TransactGetItemsHttpContent(TransactGetItemsRequest request, string?tableNamePrefix) : base("DynamoDB_20120810.TransactGetItems") { _request = request; _tableNamePrefix = tableNamePrefix; }
//--- Constructors --- public DynamoTableTransactGetItems(DynamoTable table, TransactGetItemsRequest request) { _table = table ?? throw new ArgumentNullException(nameof(table)); _request = request ?? throw new ArgumentNullException(nameof(request)); _converters = new List <DynamoRequestConverter>(); }
public Task <TransactGetItemsResponse> TransactGetItemsAsync(TransactGetItemsRequest request, CancellationToken cancellationToken = default) { throw new NotImplementedException(); }