Skip to content

Commit

Permalink
Adds event schema based in Event Structure document (#124)
Browse files Browse the repository at this point in the history
  • Loading branch information
josejulio authored Sep 17, 2024
1 parent f40282a commit 941cf9e
Showing 1 changed file with 79 additions and 0 deletions.
79 changes: 79 additions & 0 deletions data/kafka-event-schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
{
"title": "Inventory Event Structure",
"description": "The event schema will be compatible with CloudEvents, a specification for describing event data in a common way. The following describes how the fabric will align with the CloudEvent schema.",
"type": "object",
"properties": {
"specversion": {
"description": "Specifies the version of the CloudEvents spec targeted.",
"type": "string",
"enum": [
"1.0"
]
},
"type": {
"description": "We use a string comprised of redhat.inventory.(resources|resources_relationship).{resource_type}.(created|updated|deleted)",
"type": "string",
"pattern": "^redhat\\.inventory\\.(resources|resources_relationship)\\.[a-zA-Z0-9_-]+\\.(created|updated|deleted)$",
"examples": [
"redhat.inventory.resources.k8s_cluster.created",
"redhat.inventory.resources.k8s_cluster.updated",
"redhat.inventory.resources.k8s_cluster.deleted",
"redhat.inventory.resources_relationship.k8spolicy_ispropagatedto_k8scluster.created",
"redhat.inventory.resources_relationship.k8spolicy_ispropagatedto_k8scluster.updated",
"redhat.inventory.resources_relationship.k8spolicy_ispropagatedto_k8scluster.deleted"
]
},
"source": {
"description": "Describes the source (or app) that generated the event.",
"type": "string",
"format": "uri",
"examples": [
"https://redhat.com"
]
},
"id": {
"description": "Identifies the event. Unique for this source.",
"type": "string",
"format": "uuid",
"examples": [
"afebabe-cafe-babe-cafe-babecafebabe"
]
},
"time": {
"description": "Last reported from inventory-api",
"type": "string",
"format": "date-time",
"examples": [
"2018-11-13T20:20:39+00:00"
]
},
"datacontenttype": {
"description": "Content type of data value",
"type": "string",
"pattern": "^application\\/json$"
},
"data": {
"type": "object"
},

"subject": {
"description": "Represents the updated resource: (resource|resources-relation)/{resource_type}/{resource_id}",
"type": "string",
"pattern": "^\\/(resources|resources-relationships)\\/[a-zA-Z0-9\\_-]+\\/[a-zA-Z0-9\\-]+$",
"examples": [
"/resources/k8s_cluster/A234-1234-1234",
"/resources-relationships/k8spolicy_ispropagatedto_k8scluster/A234-1234-1234"
]
}
},
"required": [
"specversion",
"type",
"source",
"id",
"time",
"datacontenttype",
"data",
"subject"
]
}

0 comments on commit 941cf9e

Please sign in to comment.