Audit.NET.DynamoDB 30.0.1

dotnet add package Audit.NET.DynamoDB --version 30.0.1
                    
NuGet\Install-Package Audit.NET.DynamoDB -Version 30.0.1
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Audit.NET.DynamoDB" Version="30.0.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Audit.NET.DynamoDB" Version="30.0.1" />
                    
Directory.Packages.props
<PackageReference Include="Audit.NET.DynamoDB" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Audit.NET.DynamoDB --version 30.0.1
                    
#r "nuget: Audit.NET.DynamoDB, 30.0.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#addin nuget:?package=Audit.NET.DynamoDB&version=30.0.1
                    
Install Audit.NET.DynamoDB as a Cake Addin
#tool nuget:?package=Audit.NET.DynamoDB&version=30.0.1
                    
Install Audit.NET.DynamoDB as a Cake Tool

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

NuGet Status NuGet Count

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(new AmazonDynamoDBClient(new AmazonDynamoDBConfig() { ServiceURL = "http://localhost:8000" })),
    TableName = "MyTable",
    TableBuilderAction = builder  => builder.AddHashKey("Id", DynamoDBEntryType.String),
    CustomAttributes = new Dictionary<string, Setting<object>>()
    {
        { "Id", new(ev => ev.EventType + Guid.NewGuid()) }
    }
};

Or using the constructor overload that accepts a fluent API:

Audit.Core.Configuration.DataProvider = new DynamoDataProvider(config => config
    .UseUrl("http://localhost:8000")
    .Table("MyTable", table => table
        .AddHashKey("Id", DynamoDBEntryType.String))
    .SetAttribute("Id", ev => ev.EventType + Guid.NewGuid()));

Or by using the global setup extension UseDynamoDB():

Audit.Core.Configuration.Setup()
    .UseDynamoDB(config => config
        .UseUrl("http://localhost:8000")
        .Table("MyTable", table => table
            .AddHashKey("Id", DynamoDBEntryType.String))
        .SetAttribute("Id", ev => ev.EventType + Guid.NewGuid()));

You can provide the table name setting as a string or as a function of the Audit Event.

Note that you need to provide the table builder action to define the table schema, which must include the hash key and optionally a range key.

Provider Options

  • Client: The DynamoDB client AmazonDynamoDBClient. (required)
  • TableNameBuilder: A function of the audit event that returns the Table Name to use. (required)
  • TableBuilderAction: A function that receives a TableBuilder to define the table schema. This is used to define the hash key and optionally a range key. (required)
  • CustomAttributes: A dictionary with additional fields to be included in the document and as custom fields on the audit event. (optional)

Fluent API Methods

The provider options can be set with a fluent API described by the following methods:

Connection level
  • WithClient(): Uses the provided AmazonDynamoDBClient instance.
  • UseConfig(): Configures the DynamoDB client using the specified AmazonDynamoDBConfig, with optional credentials.
  • UseUrl(): Sets up the DynamoDB client using only the service URL, with optional credentials.
Table level
  • Table(): To specify the table name (as a string or a function of the audit event) and table configuration.
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 generic GetEvent(object eventId) must be of type Primitive, 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 = "MyTable",
    KeySchema = new List<KeySchemaElement>()
    {
        new KeySchemaElement("Id", KeyType.HASH),
        new KeySchemaElement("Type", KeyType.RANGE)
    },
    AttributeDefinitions = new List<AttributeDefinition>()
    {
        new AttributeDefinition("Id", ScalarAttributeType.S),
        new AttributeDefinition("Type", ScalarAttributeType.S)
    },
    ProvisionedThroughput = new ProvisionedThroughput(1, 1)
});

In this case, the primary key is defined as a Hash and a Range key, with Id being the hash, and Type being the range. Both must be top-level properties of the Audit Event, but since the Id is not a built-in property, you can configure it as a [Custom Field](https://github.com/thepirat000/Audit.NET#custom-fields-and-comments]:

Audit.Core.Configuration.Setup()
    .UseDynamoDB(config => config
        .UseUrl(url)
        .Table("MyTable", table => table
            .AddHashKey("Id", DynamoDBEntryType.String))
        .SetAttribute("Id", 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("Id", Guid.NewGuid());
});

ZZZ Projects - Sponsorship

Entity Framework Extensions and Dapper Plus are major sponsors and are proud to contribute to the development of Audit.NET

Combine the power of auditing with the speed of Bulk Operations to get the best of both worlds — audit and performance.

Entity Framework Extensions - Sponsor

Dapper Plus - Sponsor

Product 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.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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
30.0.1 138 8 days ago
30.0.0 137 10 days ago
29.0.1 186 a month ago
29.0.0 671 a month ago
28.0.0 150 a month ago
27.5.3 344 a month ago
27.5.2 390 2 months ago
27.5.1 121 2 months ago
27.5.0 1,009 3 months ago
27.4.1 606 4 months ago
27.4.0 6,417 4 months ago
27.3.3 3,156 4 months ago
27.3.2 3,087 6 months ago
27.3.1 117 6 months ago
27.3.0 137 6 months ago
27.2.0 8,807 6 months ago
27.1.1 296 7 months ago
27.1.0 2,789 7 months ago
27.0.3 1,764 8 months ago
27.0.2 177 9 months ago
27.0.1 1,213 9 months ago
27.0.0 127 9 months ago
26.0.1 3,088 9 months ago
26.0.0 717 7/19/2024
25.0.7 229 7/4/2024
25.0.6 284 6/24/2024
25.0.5 2,100 6/18/2024
25.0.4 12,327 3/24/2024
25.0.3 179 3/13/2024
25.0.2 130 3/12/2024
25.0.1 241 2/28/2024
25.0.0 157 2/16/2024
24.0.1 163 2/12/2024
24.0.0 127 2/12/2024
23.0.0 609 12/14/2023
22.1.0 231 12/9/2023
22.0.2 330 12/1/2023
22.0.1 246 11/16/2023
22.0.0 189 11/14/2023
21.1.0 454 10/9/2023
21.0.4 284 9/15/2023
21.0.3 146,060 7/9/2023
21.0.2 232 7/6/2023
21.0.1 2,601 5/27/2023
21.0.0 31,610 4/15/2023
20.2.4 2,656 3/27/2023
20.2.3 362 3/17/2023
20.2.2 374 3/14/2023
20.2.1 382 3/11/2023
20.2.0 358 3/7/2023
20.1.6 3,400 2/23/2023
20.1.5 732 2/9/2023
20.1.4 412 1/28/2023
20.1.3 38,418 12/21/2022
20.1.2 386 12/14/2022
20.1.1 394 12/12/2022
20.1.0 425 12/4/2022
20.0.4 866 11/30/2022
20.0.3 830 10/28/2022
20.0.2 512 10/26/2022
20.0.1 535 10/21/2022
20.0.0 1,062 10/1/2022
19.4.1 3,619 9/10/2022
19.4.0 558 9/2/2022
19.3.0 536 8/23/2022
19.2.2 1,922 8/11/2022
19.2.1 573 8/6/2022
19.2.0 747 7/24/2022
19.1.4 14,453 5/23/2022
19.1.3 573 5/22/2022
19.1.2 598 5/18/2022
19.1.1 641 4/28/2022
19.1.0 580 4/10/2022
19.0.7 623 3/13/2022
19.0.6 639 3/7/2022
19.0.5 21,070 1/28/2022
19.0.4 606 1/23/2022
19.0.3 712 12/14/2021
19.0.2 471 12/11/2021
19.0.1 1,211 11/20/2021
19.0.0 4,061 11/11/2021
19.0.0-rc.net60.2 212 9/26/2021
19.0.0-rc.net60.1 266 9/16/2021
18.1.6 1,730 9/26/2021
18.1.5 610 9/7/2021
18.1.4 506 9/6/2021
18.1.3 559 8/19/2021
18.1.2 598 8/8/2021
18.1.1 573 8/5/2021
18.1.0 636 8/1/2021
18.0.1 580 7/30/2021
18.0.0 694 7/26/2021
17.0.8 4,737 7/7/2021
17.0.7 878 6/16/2021
17.0.6 570 6/5/2021
17.0.5 1,916 5/28/2021
17.0.4 751 5/4/2021
17.0.3 589 5/1/2021
17.0.2 562 4/22/2021
17.0.1 552 4/18/2021
17.0.0 598 3/26/2021
16.5.6 572 3/25/2021
16.5.5 535 3/23/2021
16.5.4 668 3/9/2021
16.5.3 1,215 2/26/2021
16.5.2 578 2/23/2021
16.5.1 595 2/21/2021
16.5.0 569 2/17/2021
16.4.5 573 2/15/2021
16.4.4 592 2/5/2021
16.4.3 573 1/27/2021
16.4.2 586 1/22/2021
16.4.1 658 1/21/2021
16.4.0 583 1/11/2021
16.3.3 632 1/8/2021
16.3.2 601 1/3/2021
16.3.1 647 12/31/2020
16.3.0 553 12/30/2020
16.2.1 585 12/27/2020
16.2.0 1,233 10/13/2020
16.1.5 17,818 10/4/2020
16.1.4 709 9/17/2020
16.1.3 786 9/13/2020
16.1.2 690 9/9/2020
16.1.1 717 9/3/2020
16.1.0 740 8/19/2020
16.0.3 804 8/15/2020
16.0.2 780 8/9/2020
16.0.1 782 8/8/2020
16.0.0 685 8/7/2020
15.3.0 803 7/23/2020
15.2.3 853 7/14/2020
15.2.2 1,626 5/19/2020
15.2.1 751 5/12/2020
15.2.0 789 5/9/2020
15.1.1 771 5/4/2020
15.1.0 800 4/13/2020
15.0.5 891 3/18/2020
15.0.4 785 2/28/2020
15.0.3 770 2/26/2020
15.0.2 863 1/20/2020
15.0.1 820 1/10/2020
15.0.0 823 12/17/2019
14.9.1 8,443 11/30/2019
14.9.0 759 11/29/2019
14.8.1 802 11/26/2019
14.8.0 759 11/20/2019
14.7.0 24,187 10/9/2019
14.6.6 802 10/8/2019
14.6.5 821 9/27/2019
14.6.4 800 9/21/2019
14.6.3 853 8/12/2019
14.6.2 839 8/3/2019
14.6.1 856 8/3/2019
14.6.0 812 7/26/2019
14.5.7 876 7/18/2019
14.5.6 852 7/10/2019
14.5.5 836 7/1/2019
14.5.4 859 6/17/2019
14.5.3 907 6/5/2019
14.5.2 861 5/30/2019
14.5.1 881 5/28/2019
14.5.0 828 5/24/2019
14.4.0 870 5/22/2019
14.3.4 891 5/14/2019
14.3.3 884 5/9/2019
14.3.2 882 4/30/2019
14.3.1 907 4/27/2019
14.3.0 907 4/24/2019
14.2.3 873 4/17/2019
14.2.2 902 4/10/2019
14.2.1 888 4/5/2019
14.2.0 875 3/16/2019
14.1.1 925 3/8/2019
14.1.0 1,009 2/11/2019
14.0.4 1,008 1/31/2019
14.0.3 991 1/22/2019
14.0.2 1,025 12/15/2018
14.0.1 1,071 11/29/2018
14.0.0 1,046 11/19/2018
13.3.0 1,049 11/16/2018
13.2.2 1,047 11/15/2018
13.2.1 1,085 11/13/2018
13.2.0 1,060 10/31/2018
13.1.5 1,107 10/31/2018
13.1.4 1,140 10/25/2018
13.1.3 1,087 10/18/2018
13.1.2 1,175 9/12/2018
13.1.1 1,119 9/11/2018
13.1.0 1,156 9/11/2018
13.0.0 1,153 8/29/2018
12.3.6 1,142 8/29/2018