Audit.NET.DynamoDB
27.3.2
dotnet add package Audit.NET.DynamoDB --version 27.3.2
NuGet\Install-Package Audit.NET.DynamoDB -Version 27.3.2
<PackageReference Include="Audit.NET.DynamoDB" Version="27.3.2" />
paket add Audit.NET.DynamoDB --version 27.3.2
#r "nuget: Audit.NET.DynamoDB, 27.3.2"
// Install Audit.NET.DynamoDB as a Cake Addin #addin nuget:?package=Audit.NET.DynamoDB&version=27.3.2 // Install Audit.NET.DynamoDB as a Cake Tool #tool nuget:?package=Audit.NET.DynamoDB&version=27.3.2
Audit.NET.DynamoDB
Amazon Dynamo DB provider for Audit.NET library (An extensible framework to audit executing operations in .NET).
Store the audit events in Dynamo DB tables using the AWSSDK.DynamoDBv2 library.
Install
NuGet Package To install the package run the following command on the Package Manager Console:
PM> Install-Package Audit.NET.DynamoDB
Usage
Please see the Audit.NET Readme
Configuration
Set the static Audit.Core.Configuration.DataProvider
property to set the Dynamo DB data provider, or call the UseDynamoDB
method on the fluent configuration. This should be done before any AuditScope
creation, i.e. during application startup.
For example:
Audit.Core.Configuration.DataProvider = new DynamoDataProvider()
{
Client = new Lazy<IAmazonDynamoDB>(() => new AmazonDynamoDBClient(new AmazonDynamoDBConfig()
{
ServiceURL = "http://localhost:8000"
})),
TableNameBuilder = ev => "MyTable"
};
Or even shorter using the constructor overload that accepts a fluent API:
Audit.Core.Configuration.DataProvider = new DynamoDataProvider(config => config
.UseUrl("http://localhost:8000")
.Table("MyTable"));
Or by using the global setup extension UseDynamoDB()
:
Audit.Core.Configuration.Setup()
.UseDynamoDB(config => config
.UseUrl("http://localhost:8000")
.Table(ev => ev.EventType));
You can provide the table name setting as a string or as a function of the Audit Event.
Provider Options
- Client: The DynamoDB client creator
AmazonDynamoDBClient
. - TableNameBuilder: A function of the audit event that returns the Table Name to use.
- CustomAttributes: A dictionary with additional fields to be included in the document and as custom fields on the audit event.
Fluent API Methods
The provider options can be set with a fluent API described by the following methods:
Connection level
- WithClient(): Use the given DynamoDB client instance (
AmazonDynamoDBClient
). - UseConfig(): Alternative to
WithClient()
, to use a DynamoDB client with the given settings (AmazonDynamoDBConfig
). - UseUrl(): Alternative to use a DynamoDB client only specifying the service URL.
Table level
- Table(): To specify the table name (as a string or a function of the audit event).
Attributes level
- SetAttribute(): To specify additional top-level attributes on the document before saving.
Query events
This provider implements GetEvent
and GetEventAsync
methods to obtain an audit event by id:
var event = dynamoDataProvider.GetEvent((Primitive)1234);
The
eventId
parameter on the genericGetEvent(object eventId)
must be of typePrimitive
,DynamoDBEntry
or an array of any of these two types. The first (or only) element must be the Hash key, and the second element should be the range key (or NULL if not using a range).
There are more convenient overloads of the GetEvent
/GetEventAsync
methods that accepts the Primitives without needing to cast the parameters:
// Get event with the given HASH and RANGE
var event = dynamoDataProvider.GetEvent("A001-005283", 2018);
// Get event with the given HASH
var event = dynamoDataProvider.GetEvent("A001-005283");
Constraints
This provider has the following constraints:
- The table to store the audit events must exists on DynamoDB.
- Its indexes must consist of top-level properties of the audit event.
(Note you can add properties to the AuditEvent as Custom Fields with the
SetAttribute()
method on the provider configuration)
The following is an example of a table creation using the AWSSDK.DynamoDBv2 library:
var config = new AmazonDynamoDBConfig() { ServiceURL = "http://localhost:8000" };
var client = new AmazonDynamoDBClient(config);
await client.CreateTableAsync(new CreateTableRequest()
{
TableName = "AuditEvents",
KeySchema = new List<KeySchemaElement>()
{
new KeySchemaElement("EventId", KeyType.HASH),
new KeySchemaElement("EventType", KeyType.RANGE)
},
AttributeDefinitions = new List<AttributeDefinition>()
{
new AttributeDefinition("EventId", ScalarAttributeType.S),
new AttributeDefinition("EventType", ScalarAttributeType.S)
},
ProvisionedThroughput = new ProvisionedThroughput(1, 1)
});
In this case, the primary key is defined as a Hash and a Range key, with EventId
being the hash, and EventType
being the range.
Both must be top-level properties of the Audit Event,
but since the EventId
is not a built-in property, you can configure it as a Custom Field:
Audit.Core.Configuration.Setup()
.UseDynamoDB(config => config
.UseUrl(url)
.Table("AuditEvents")
.SetAttribute("EventId", ev => Guid.NewGuid()));
Or you can use a global Custom Action instead with the same outcome:
Audit.Core.Configuration.AddCustomAction(ActionType.OnScopeCreated, scope =>
{
scope.SetCustomField("EventId", Guid.NewGuid());
});
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net461 was computed. net462 is compatible. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETFramework 4.6.2
- Audit.NET (>= 27.3.2)
- AWSSDK.DynamoDBv2 (>= 3.7.300.17)
-
.NETStandard 2.0
- Audit.NET (>= 27.3.2)
- AWSSDK.DynamoDBv2 (>= 3.7.300.17)
-
net6.0
- Audit.NET (>= 27.3.2)
- AWSSDK.DynamoDBv2 (>= 3.7.300.17)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
27.3.2 | 182 | 12/11/2024 |
27.3.1 | 75 | 12/10/2024 |
27.3.0 | 101 | 12/8/2024 |
27.2.0 | 1,583 | 11/23/2024 |
27.1.1 | 235 | 10/28/2024 |
27.1.0 | 2,190 | 10/24/2024 |
27.0.3 | 1,626 | 9/25/2024 |
27.0.2 | 150 | 9/19/2024 |
27.0.1 | 1,188 | 9/4/2024 |
27.0.0 | 102 | 9/3/2024 |
26.0.1 | 2,930 | 8/22/2024 |
26.0.0 | 692 | 7/19/2024 |
25.0.7 | 208 | 7/4/2024 |
25.0.6 | 191 | 6/24/2024 |
25.0.5 | 1,231 | 6/18/2024 |
25.0.4 | 7,417 | 3/24/2024 |
25.0.3 | 166 | 3/13/2024 |
25.0.2 | 117 | 3/12/2024 |
25.0.1 | 229 | 2/28/2024 |
25.0.0 | 144 | 2/16/2024 |
24.0.1 | 148 | 2/12/2024 |
24.0.0 | 118 | 2/12/2024 |
23.0.0 | 596 | 12/14/2023 |
22.1.0 | 220 | 12/9/2023 |
22.0.2 | 320 | 12/1/2023 |
22.0.1 | 231 | 11/16/2023 |
22.0.0 | 181 | 11/14/2023 |
21.1.0 | 447 | 10/9/2023 |
21.0.4 | 276 | 9/15/2023 |
21.0.3 | 126,565 | 7/9/2023 |
21.0.2 | 217 | 7/6/2023 |
21.0.1 | 2,582 | 5/27/2023 |
21.0.0 | 31,584 | 4/15/2023 |
20.2.4 | 2,635 | 3/27/2023 |
20.2.3 | 344 | 3/17/2023 |
20.2.2 | 354 | 3/14/2023 |
20.2.1 | 361 | 3/11/2023 |
20.2.0 | 339 | 3/7/2023 |
20.1.6 | 3,372 | 2/23/2023 |
20.1.5 | 712 | 2/9/2023 |
20.1.4 | 392 | 1/28/2023 |
20.1.3 | 36,036 | 12/21/2022 |
20.1.2 | 361 | 12/14/2022 |
20.1.1 | 371 | 12/12/2022 |
20.1.0 | 398 | 12/4/2022 |
20.0.4 | 840 | 11/30/2022 |
20.0.3 | 807 | 10/28/2022 |
20.0.2 | 487 | 10/26/2022 |
20.0.1 | 510 | 10/21/2022 |
20.0.0 | 1,033 | 10/1/2022 |
19.4.1 | 3,595 | 9/10/2022 |
19.4.0 | 534 | 9/2/2022 |
19.3.0 | 511 | 8/23/2022 |
19.2.2 | 1,825 | 8/11/2022 |
19.2.1 | 547 | 8/6/2022 |
19.2.0 | 719 | 7/24/2022 |
19.1.4 | 14,426 | 5/23/2022 |
19.1.3 | 542 | 5/22/2022 |
19.1.2 | 569 | 5/18/2022 |
19.1.1 | 609 | 4/28/2022 |
19.1.0 | 548 | 4/10/2022 |
19.0.7 | 590 | 3/13/2022 |
19.0.6 | 605 | 3/7/2022 |
19.0.5 | 19,475 | 1/28/2022 |
19.0.4 | 572 | 1/23/2022 |
19.0.3 | 677 | 12/14/2021 |
19.0.2 | 433 | 12/11/2021 |
19.0.1 | 1,174 | 11/20/2021 |
19.0.0 | 3,362 | 11/11/2021 |
19.0.0-rc.net60.2 | 170 | 9/26/2021 |
19.0.0-rc.net60.1 | 225 | 9/16/2021 |
18.1.6 | 1,693 | 9/26/2021 |
18.1.5 | 575 | 9/7/2021 |
18.1.4 | 469 | 9/6/2021 |
18.1.3 | 520 | 8/19/2021 |
18.1.2 | 565 | 8/8/2021 |
18.1.1 | 531 | 8/5/2021 |
18.1.0 | 600 | 8/1/2021 |
18.0.1 | 544 | 7/30/2021 |
18.0.0 | 655 | 7/26/2021 |
17.0.8 | 4,699 | 7/7/2021 |
17.0.7 | 843 | 6/16/2021 |
17.0.6 | 530 | 6/5/2021 |
17.0.5 | 1,877 | 5/28/2021 |
17.0.4 | 689 | 5/4/2021 |
17.0.3 | 548 | 5/1/2021 |
17.0.2 | 522 | 4/22/2021 |
17.0.1 | 510 | 4/18/2021 |
17.0.0 | 556 | 3/26/2021 |
16.5.6 | 532 | 3/25/2021 |
16.5.5 | 493 | 3/23/2021 |
16.5.4 | 621 | 3/9/2021 |
16.5.3 | 1,171 | 2/26/2021 |
16.5.2 | 533 | 2/23/2021 |
16.5.1 | 553 | 2/21/2021 |
16.5.0 | 525 | 2/17/2021 |
16.4.5 | 527 | 2/15/2021 |
16.4.4 | 544 | 2/5/2021 |
16.4.3 | 531 | 1/27/2021 |
16.4.2 | 542 | 1/22/2021 |
16.4.1 | 612 | 1/21/2021 |
16.4.0 | 538 | 1/11/2021 |
16.3.3 | 587 | 1/8/2021 |
16.3.2 | 547 | 1/3/2021 |
16.3.1 | 604 | 12/31/2020 |
16.3.0 | 508 | 12/30/2020 |
16.2.1 | 538 | 12/27/2020 |
16.2.0 | 1,159 | 10/13/2020 |
16.1.5 | 17,358 | 10/4/2020 |
16.1.4 | 665 | 9/17/2020 |
16.1.3 | 741 | 9/13/2020 |
16.1.2 | 643 | 9/9/2020 |
16.1.1 | 671 | 9/3/2020 |
16.1.0 | 696 | 8/19/2020 |
16.0.3 | 756 | 8/15/2020 |
16.0.2 | 733 | 8/9/2020 |
16.0.1 | 735 | 8/8/2020 |
16.0.0 | 635 | 8/7/2020 |
15.3.0 | 756 | 7/23/2020 |
15.2.3 | 805 | 7/14/2020 |
15.2.2 | 1,564 | 5/19/2020 |
15.2.1 | 699 | 5/12/2020 |
15.2.0 | 734 | 5/9/2020 |
15.1.1 | 720 | 5/4/2020 |
15.1.0 | 751 | 4/13/2020 |
15.0.5 | 838 | 3/18/2020 |
15.0.4 | 735 | 2/28/2020 |
15.0.3 | 717 | 2/26/2020 |
15.0.2 | 812 | 1/20/2020 |
15.0.1 | 767 | 1/10/2020 |
15.0.0 | 770 | 12/17/2019 |
14.9.1 | 7,858 | 11/30/2019 |
14.9.0 | 708 | 11/29/2019 |
14.8.1 | 751 | 11/26/2019 |
14.8.0 | 707 | 11/20/2019 |
14.7.0 | 23,546 | 10/9/2019 |
14.6.6 | 750 | 10/8/2019 |
14.6.5 | 768 | 9/27/2019 |
14.6.4 | 747 | 9/21/2019 |
14.6.3 | 800 | 8/12/2019 |
14.6.2 | 785 | 8/3/2019 |
14.6.1 | 805 | 8/3/2019 |
14.6.0 | 758 | 7/26/2019 |
14.5.7 | 821 | 7/18/2019 |
14.5.6 | 799 | 7/10/2019 |
14.5.5 | 784 | 7/1/2019 |
14.5.4 | 804 | 6/17/2019 |
14.5.3 | 850 | 6/5/2019 |
14.5.2 | 808 | 5/30/2019 |
14.5.1 | 828 | 5/28/2019 |
14.5.0 | 773 | 5/24/2019 |
14.4.0 | 816 | 5/22/2019 |
14.3.4 | 837 | 5/14/2019 |
14.3.3 | 827 | 5/9/2019 |
14.3.2 | 826 | 4/30/2019 |
14.3.1 | 853 | 4/27/2019 |
14.3.0 | 845 | 4/24/2019 |
14.2.3 | 818 | 4/17/2019 |
14.2.2 | 844 | 4/10/2019 |
14.2.1 | 829 | 4/5/2019 |
14.2.0 | 818 | 3/16/2019 |
14.1.1 | 867 | 3/8/2019 |
14.1.0 | 949 | 2/11/2019 |
14.0.4 | 947 | 1/31/2019 |
14.0.3 | 931 | 1/22/2019 |
14.0.2 | 965 | 12/15/2018 |
14.0.1 | 1,010 | 11/29/2018 |
14.0.0 | 981 | 11/19/2018 |
13.3.0 | 983 | 11/16/2018 |
13.2.2 | 978 | 11/15/2018 |
13.2.1 | 1,015 | 11/13/2018 |
13.2.0 | 985 | 10/31/2018 |
13.1.5 | 1,040 | 10/31/2018 |
13.1.4 | 1,070 | 10/25/2018 |
13.1.3 | 1,019 | 10/18/2018 |
13.1.2 | 1,104 | 9/12/2018 |
13.1.1 | 1,049 | 9/11/2018 |
13.1.0 | 1,086 | 9/11/2018 |
13.0.0 | 1,075 | 8/29/2018 |
12.3.6 | 1,074 | 8/29/2018 |