Haskell implementation of Azure Managed Application Notifications
- Azure ManagedApp Notifications
- Using Haskell's servant package
- Haskell types are leveraged to describe schemas and API
- Running the server
22:33 barak@berkos:~/Development/atidot/azure-managedapp-notifications (master) $ cabal new-run
Up to date
- Testing with cURL
- Test notification
22:35 barak@berkos:~ $ cat ~/notif.json
{
"eventType": "PUT",
"applicationId": "subscriptions/<subId>/resourceGroups/<rgName>/providers/Microsoft.Solutions/applications/<applicationName>",
"eventTime": "2019-08-14T19:20:08.1707163Z",
"provisioningState": "Succeeded",
"billingDetails": {
"resourceUsageId":"<resourceUsageId>"
},
"plan": {
"publisher": "publisherId",
"product": "offer",
"name": "skuName",
"version": "1.0.1"
}
}
22:35 barak@berkos:~ $ curl --header "Content-Type: application/json" --request POST --data @notif.json http://localhost:8080/resource
[]22:35 barak@berkos:~ $
- Server prints
- Source reference
22:33 barak@berkos:~/Development/atidot/azure-managedapp-notifications (master) $ cabal new-run
Up to date
"----------------------------"
"Implement your handler here"
AzureMarketplaceNotification {_eventType = PUT, _applicationId = ApplicationId {_subId = "<subId>", _rgName = "<rgName>", _applicationName = "<applicationName>"}, _eventTime = 2019-08-14 19:20:08.170716
3 UTC, _provisioningState = Succeeded, _billingDetails = BillingDetails {_resourceUsageId = "<resourceUsageId>"}, _plan = Plan {_publisher = "publisherId", _product = "offer", _name = "skuName", _versio
n = "1.0.1"}, _error = Nothing}