Librairie d'envoi des changements d'inventaire.
Pour chaque changement enregistré, un message peut être envoyé vers une ou plusieurs Queues de type SQS ou un WebService.
En cours...
- AWS SQS
- Azure Queue Storage
- Webhook
- GCP ?
- Redis
Pour un évènement de type CREATE, le champs new_object contient l'ensemble des données de la ressoure qui a été créée.
{
"id": 1,
"created": "2019-01-01T00:00:00Z",
"action": "create",
"changes": [],
"old_object": {},
"new_object": {
"id": 1,
"resource_id": "1",
"slug": "1",
"name": "myname",
"provider": "aws",
"resource_type": "aws.ec2.instance",
"company": "my-company",
"metas": {},
"locked": false,
"active": true,
"tags": [
{
"id": 1,
"name": "1",
"value": "1",
"provider": "aws"
},
{
"id": 2,
"name": "2",
"value": "2",
"provider": "aws"
},
{
"id": 3,
"name": "3",
"value": "3",
"provider": "aws"
}
]
},
"diff": null,
"content_type": {
"app_label": "mce_django_app",
"model": "resource",
"name": "resource",
"id": 1
}
}
Pour l'évènement DELETE, l'objet avant la suppression est stocké dans le champs old_object
{
"id": 1,
"created": "2019-01-01T00:00:00Z",
"action": "delete",
"changes": [],
"old_object": {
"id": 1,
"resource_id": "1",
"slug": "1",
"name": "myname",
"provider": "aws",
"resource_type": "aws.ec2.instance",
"company": "my-company",
"metas": {},
"locked": false,
"active": true,
"tags": [
{
"id": 1,
"name": "1",
"value": "1",
"provider": "aws"
},
{
"id": 2,
"name": "2",
"value": "2",
"provider": "aws"
},
{
"id": 3,
"name": "3",
"value": "3",
"provider": "aws"
}
]
},
"new_object": {},
"diff": null,
"content_type": {
"app_label": "mce_django_app",
"model": "resource",
"name": "resource",
"id": 1
}
}
Pour l'évènement UPDATE, l'objet avant modification se trouve dans "old_object", après modification, dans "new_object".
Le champs "changes" contient la différence au format JSON Patch.
{
"id": 1,
"created": "2019-01-01T00:00:00Z",
"action": "update",
"changes": [
{
"op": "replace",
"path": "/name",
"value": "new-myname"
}
],
"old_object": {
"id": 1,
"resource_id": "1",
"slug": "1",
"name": "myname",
"provider": "aws",
"resource_type": "aws.ec2.instance",
"company": "my-company",
"metas": {},
"locked": false,
"active": true,
"tags": [
{
"id": 1,
"name": "1",
"value": "1",
"provider": "aws"
},
{
"id": 2,
"name": "2",
"value": "2",
"provider": "aws"
},
{
"id": 3,
"name": "3",
"value": "3",
"provider": "aws"
}
]
},
"new_object": {
"id": 1,
"resource_id": "1",
"slug": "1",
"name": "new-myname",
"provider": "aws",
"resource_type": "aws.ec2.instance",
"company": "my-company",
"metas": {},
"locked": false,
"active": true,
"tags": [
{
"id": 1,
"name": "1",
"value": "1",
"provider": "aws"
},
{
"id": 2,
"name": "2",
"value": "2",
"provider": "aws"
},
{
"id": 3,
"name": "3",
"value": "3",
"provider": "aws"
}
]
},
"diff": null,
"content_type": {
"app_label": "mce_django_app",
"model": "resource",
"name": "resource",
"id": 1
}
}