@@ -24,21 +24,50 @@ public APIGatewayProxyResponse FunctionHandler(APIGatewayProxyRequest apigwProxy
24
24
}
25
25
}
26
26
27
+ namespace IdempotencyAttributeTest
28
+ {
29
+ public class Function
30
+ {
31
+ public Function ( )
32
+ {
33
+ var tableName = Environment . GetEnvironmentVariable ( "IDEMPOTENCY_TABLE_NAME" ) ;
34
+ Idempotency . Configure ( builder => builder . UseDynamoDb ( tableName ) ) ;
35
+ }
36
+
37
+ public APIGatewayProxyResponse FunctionHandler ( APIGatewayProxyRequest apigwProxyEvent , ILambdaContext context )
38
+ {
39
+ return new APIGatewayProxyResponse
40
+ {
41
+ Body = MyInternalMethod ( "dummy" , apigwProxyEvent . RequestContext . RequestId ) ,
42
+ StatusCode = 200
43
+ } ;
44
+ }
45
+
46
+ [ Idempotent ]
47
+ private string MyInternalMethod ( string argOne , [ IdempotencyKey ] string argTwo ) {
48
+ return Guid . NewGuid ( ) . ToString ( ) ;
49
+ }
50
+ }
51
+ }
27
52
28
- namespace Function2
53
+ namespace IdempotencyPayloadSubsetTest
29
54
{
30
55
public class Function
31
56
{
32
57
public Function ( )
33
58
{
34
- // var tableName = Environment.GetEnvironmentVariable("IDEMPOTENCY_TABLE_NAME");
35
- // Idempotency.Configure(builder => builder.UseDynamoDb(tableName));
59
+ var tableName = Environment . GetEnvironmentVariable ( "IDEMPOTENCY_TABLE_NAME" ) ;
60
+ Idempotency . Configure ( builder =>
61
+ builder
62
+ . WithOptions ( optionsBuilder =>
63
+ optionsBuilder . WithEventKeyJmesPath ( "powertools_json(Body).[\" user_id\" , \" product_id\" ]" ) )
64
+ . UseDynamoDb ( tableName ) ) ;
36
65
}
37
66
38
- // [Idempotent]
39
- public string FunctionHandler ( APIGatewayProxyRequest apigwProxyEvent , ILambdaContext context )
67
+ [ Idempotent ]
68
+ public APIGatewayProxyResponse FunctionHandler ( APIGatewayProxyRequest apigwProxyEvent , ILambdaContext context )
40
69
{
41
- return "Hello, World!" ;
70
+ return TestHelper . TestMethod ( apigwProxyEvent ) ;
42
71
}
43
72
}
44
73
}
0 commit comments