Skip to content

Commit

Permalink
Fix consumed capacity parsing
Browse files Browse the repository at this point in the history
Fixed operations:
- TransactWrite
- DeleteItem
  • Loading branch information
firenero committed Feb 5, 2024
1 parent 23d4596 commit 02a7ce2
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public static TransactWriteItemsResponse Parse(Document? response)
{
return response == null
? new TransactWriteItemsResponse(null, null)
: new TransactWriteItemsResponse(CapacityParser.ParseFullConsumedCapacity(response), ItemCollectionMetricsParser.ParseMultipleItemCollectionMetrics(response));
: new TransactWriteItemsResponse(CapacityParser.ParseFullConsumedCapacities(response), ItemCollectionMetricsParser.ParseMultipleItemCollectionMetrics(response));
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public class DeleteItemEntityResponse<TEntity> where TEntity : class
/// <summary>
/// The capacity units consumed by the <c>DeleteItem</c> operation. The data returned includes the total provisioned throughput consumed, along with statistics for the table and any indexes involved in the operation. <see cref="ConsumedCapacity"/> is only returned if the <see cref="DeleteItemRequest.ReturnConsumedCapacity"/> parameter was specified.
/// </summary>
[DynamoDbProperty("Attributes")]
[DynamoDbProperty("ConsumedCapacity")]
public FullConsumedCapacity? ConsumedCapacity { get; set; }

// /// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

namespace EfficientDynamoDb.Operations.Shared.Capacity
{
[DynamoDbConverter(typeof(JsonObjectDdbConverter<FullConsumedCapacity>))]
public class FullConsumedCapacity : ConsumedCapacity
{
[DynamoDbProperty("GlobalSecondaryIndexes", typeof(JsonIReadOnlyDictionaryDdbConverter<string, ConsumedCapacity>))]
Expand All @@ -13,6 +14,7 @@ public class FullConsumedCapacity : ConsumedCapacity
[DynamoDbProperty("LocalSecondaryIndexes", typeof(JsonIReadOnlyDictionaryDdbConverter<string, ConsumedCapacity>))]
public IReadOnlyDictionary<string, ConsumedCapacity>? LocalSecondaryIndexes { get; set; }

[DynamoDbProperty("Table", typeof(JsonObjectDdbConverter<ConsumedCapacity>))]
public ConsumedCapacity? Table { get; set; }

[DynamoDbProperty("TableName", typeof(StringDdbConverter))]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System.Collections.Generic;
using EfficientDynamoDb.Attributes;
using EfficientDynamoDb.Internal.Converters.Json;
using EfficientDynamoDb.Operations.Shared;
using EfficientDynamoDb.Operations.Shared.Capacity;

Expand All @@ -10,14 +11,14 @@ public class TransactWriteItemsResponse
/// <summary>
/// The capacity units consumed by the entire <c>TransactWriteItems</c> operation. The values of the list are ordered according to the ordering of the <see cref="TransactWriteItemsRequest.TransactItems"/> request parameter.
/// </summary>
public FullConsumedCapacity? ConsumedCapacity { get; }
public IReadOnlyList<FullConsumedCapacity>? ConsumedCapacity { get; }

/// <summary>
/// A list of tables that were processed by <c>TransactWriteItems</c> and, for each table, information about any item collections that were affected by individual <c>UpdateItem</c>, <c>PutItem</c>, or <c>DeleteItem</c> operations.
/// </summary>
public IReadOnlyDictionary<string, ItemCollectionMetrics>? ItemCollectionMetrics { get; }

public TransactWriteItemsResponse(FullConsumedCapacity? consumedCapacity, IReadOnlyDictionary<string, ItemCollectionMetrics>? itemCollectionMetrics)
public TransactWriteItemsResponse(IReadOnlyList<FullConsumedCapacity>? consumedCapacity, IReadOnlyDictionary<string, ItemCollectionMetrics>? itemCollectionMetrics)
{
ConsumedCapacity = consumedCapacity;
ItemCollectionMetrics = itemCollectionMetrics;
Expand All @@ -29,8 +30,8 @@ public class TransactWriteItemsEntityResponse
/// <summary>
/// The capacity units consumed by the entire <c>TransactWriteItems</c> operation. The values of the list are ordered according to the ordering of the <see cref="TransactWriteItemsRequest.TransactItems"/> request parameter.
/// </summary>
[DynamoDbProperty("ConsumedCapacity")]
public FullConsumedCapacity? ConsumedCapacity { get; set; }
[DynamoDbProperty("ConsumedCapacity", typeof(JsonIReadOnlyListDdbConverter<FullConsumedCapacity>))]
public IReadOnlyList<FullConsumedCapacity>? ConsumedCapacity { get; set; }

// /// <summary>
// /// A list of tables that were processed by <c>TransactWriteItems</c> and, for each table, information about any item collections that were affected by individual <c>UpdateItem</c>, <c>PutItem</c>, or <c>DeleteItem</c> operations.
Expand Down

0 comments on commit 02a7ce2

Please sign in to comment.