event_grid.py
Source: sunholo/azure/event_grid.py
Functions
process_azure_blob_event(events: list) -> tuple
Extracts message data and metadata from an Azure Blob Storage event.
Args: events (list): The list of Azure Event Grid event data.
Returns: tuple: A tuple containing the blob URL, attributes as metadata, and the vector name.
Example of Event Grid schema:
{
"topic": "/subscriptions/subscription-id/resourceGroups/resource-group/providers/Microsoft.Storage/storageAccounts/storage-account",
"subject": "/blobServices/default/containers/container/blobs/blob",
"eventType": "Microsoft.Storage.BlobCreated",
"eventTime": "2021-01-01T12:34:56.789Z",
"id": "event-id",
"data": {
"api": "PutBlob",
"clientRequestId": "client-request-id",
"requestId": "request-id",
"eTag": "etag",
"contentType": "application/octet-stream",
"contentLength": 524288,
"blobType": "BlockBlob",
"url": "https://storage-account.blob.core.windows.net/container/blob",
"sequencer": "0000000000000000000000000",
"storageDiagnostics": {
"batchId": "batch-id"
}
},
"dataVersion": "",
"metadataVersion": "1"
}