Thrift model for auditing updates
How to use
Scala
in build.sbt
libraryDependencies ++= Seq( "com.gu" %% "auditing-thrift-model" % "0.3.0")
somewhere in your code
import com.gu.auditing.model.v1.{App, Notification} Notification( app = App.YourAppHere, operation = "EatFruit", userEmail = "banana@email.com", date = new DateTime().toString(), resourceId = Some("apple"), message = Some("{json}"))))
node.js
You'll probably want to use thrift-serializer to handle the messages.
Sending messages
var Notification = Notification;var App = App; var message = app = AppYourAppHere operation = "EatFruit" userEmail = "banana@email.com" date = resourceId = "apple" message = JSON; serializer;
Receiving notifications
var serializer = ;var Notification = Notification; serializer;
Develop
Prerequisites
- Install
thrift
usingbrew install thrift
Add an application
The list of allowed applications is kept as an enum
, add new ones in App
.
Release
The model is used both by Scala applications and node.js lambda.
sbt release
to publish a new version on Sonatypenpm run compile
to compile the model for node.js- update the version of
package.json
it should match the one you just released on Sonatype npm publish ./
to publish the new version on npm