Allow to set CreationPolicy with AuditApi attribute
See original GitHub issueNow, it’s not possible to set CreationPolicy by AuditApi attribute. It would be great to allow it.
An example:
public class SomeController : ApiController
{
[AuditApi(EventTypeName = "FooCalled"]
public async IActionResult FooAction()
{
// the audit event is saved on dispose because scope's CreationPolicy is EventCreationPolicy.InsertOnEnd
}
[AuditApi(EventTypeName = "BarDone", CreationPolicy=EventCreationPolicy.Manual)] // <-- this isn't possible now
public async IActionResult BarAction()
{
// the audit event is discarded by default
...
if (done) {
// the audit event is saved
await this.GetCurrentAuditScope().Save();
}
}
}
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
CreationPolicy attribute - AWS CloudFormation
Use the CreationPolicy attribute to determine how long to wait before the status of a stack resource proceeds to create complete or create...
Read more >Cloudformation "CreationPolicy" attribute not working
The documenation uses CreationPolicy attribute and cfn-signal to notify AWS Cloudformation that Instance1 has come up. I tried the code.
Read more >Audit.WebApi
An extensible framework to audit executing operations in .NET and .NET Core. - Audit.NET/src/Audit.WebApi/README.md at master · thepirat000/Audit.NET.
Read more >AWS CloudFormation CreationPolicy vs WaitCondition
WaitCondition is a CloudFormation resource in itself, whereas CreationPolicy is an attribute associated with other resources.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
You are right actually. There won’t be the response info but there wouldn’t be anyway with the manual policy configured globally by
Configuration.Setup().WithCreationPolicy(EventCreationPolicy.Manual)
.I will leave it up to you. I think I can implement it like you mentioned that the provider will check the response status and whether there was an exception and based on this will decide about the sending.
Thank you.
ok, I can add that config. But note the webapi audit event will not have the response information at the moment of saving, with the approach you’re suggesting.
That’s why I thought it would be better to let the data provider decide which event should be sent/saved.