Configuration and Management
4.2.0
Search this version
Configuration and Management
Configuration and Management
Title
Message
Create new category
What is the title of your new category?
Edit page index title
What is the title of the page index?
Edit category
What is the new title of your category?
Edit link
What is the new title and URL of your link?
Event-Based Real-Time Cloud Functions Examples
Copy Markdown
Open in ChatGPT
Open in Claude
Google Cloud Function Setup
- Configure the Cloud Run with the
google.cloud.storage.object.v1.finalizedtriggerto process newly added objects. - Python Function Example:
Python
x
import functions_frameworkimport jsonimport requestsimport os@functions_framework.cloud_eventdef hello_gcs(cloud_event): try: name = cloud_event.data['protoPayload']['request']['insertObjectSpec']['resource']['name'] except KeyError as e: print(f"Missing key in event data: {e}") return request_body = { 'storageClientId': os.getenv('STORAGECLIENTID'), 'metadata': json.dumps({'name': name}) } requests.post( os.getenv('APIENDPOINT'), headers={'ApiKey': os.getenv('APIKEY')}, json=request_body )- Requirements.txt example:
requirements.txt
functions-framework==3.*requestsAlibaba Cloud Function Setup
- Follow the official Alibaba Cloud documentation to create a compute function with an OSS trigger: https://www.alibabacloud.com/help/en/function-compute/latest/configure-an-oss-trigger
- Specify the bucket to monitor and subscribe to the
oss:ObjectCreated:*event. - Python Function Example:
Python
import oss2, json, osimport requestsdef handler(event, context): for eventRecord in json.loads(event)['events']: requests.post(os.getenv('APIENDPOINT', ""), headers={'ApiKey':os.getenv('APIKEY', "")}, json = {'metadata': json.dumps(eventRecord), 'storageClientId': os.getenv('STORAGECLIENTID', "") })Wasabi Function Setup
- Follow the official Wasabi documentation to create an event notification: https://docs.wasabi.com/v1/docs/event-notifications-bucket
- Establish a connection with a service capable of sending requests to MetaDefender Storage Security (MDSS).
- The Wasabi documentation example uses AWS SNS, which can be integrated with AWS Lambda (see Amazon S3 Lambda Function Setup: How do I configure Event Notifications on my Wasabi bucket using AWS SNS?
S3 Compatible function setup
- Event-based real-time processing configuration varies for different S3-compatible services.
- Most S3-compatible services offer event notification similar to Wasabi.
- The service must send a request to the MDSS endpoint:
http(s)://{baseurl}/api/webhook/realtimewith the appropriate request body:
JSON
{ "storageClientId": [Storage Client Id], "metadata": "{'s3': { 'object': {'key': [Object Path] }}}"}Type to search, ESC to discard
Type to search, ESC to discard
Type to search, ESC to discard
Last updated on
Was this page helpful?
Next to read:
Event-based handling for BoxDiscard Changes
Do you want to discard your current changes and overwrite with the template?
Archive Synced Block
Message
Create new Template
What is this template's title?
Delete Template
Message
