General audit client for services using DataHex based solutions.
Project description
Audit Client Library
Audit client library is a python package that allows DataHex services the ability to put events into a shared bus providing the ability to meter, log, and trace the lineage of data as it flows through the DataHex services.
The library is published into Nexus.
Usage
Setup pip to point to RoZetta's Nexus mkdir ~/.pip cat > ~/.pip/pip.conf << EOF [global] index-url= https://nexus.rozettatech.com/repository/pypi-all/simple progress_bar = off EOF
Make sure the caller of the client library has attached the correct IAM policy to perform put_events action.
Install the client library with the following command pip install dhx-audit-client==
Or Update the Requiremnts.txt boto3==1.16.8 --extra-index-url https://nexus.rozettatech.com/repository/pypi-all/simple/ dhx-audit-client==
Sample usage code
Initialise a new AuditClient instance with the required parameters: product, environment, service, component and release_version, parent_execution_id (optional), event_bus_name (optional, see rules below). The rules to get event_bus_name:
- If event_bus_name is specified in the parameter, it will be used.
- Otherwise, if a corresponding environment variable AUDIT_EVENT_BUS_NAME is set, the value of the variable will be used.
- If both are not specified, it will be derived from parameters product and environment defaulting to ${product}-${environment}-AuditEventBus.
from audit_client.audit_client import AuditClient ac = AuditClient(product='dhx', environment='devhl', service='datahex_downloader', component='ftp_downloader', release_version='datahex_downloader-v0.0.1', parent_execution_id='some-id', event_bus_name='some_event_bus_name)
Start a new AuditSession instance , every time start_audit is called, and new execution ID will be generated. If we want to keep the same execution ID, we can re-use the same AuditSession
sess = ac.start_audit()
Use AuditSession to put audit event to event bus.
action = 'SourceConnectionStartDetail' result = 'CONNECTION_REFUSED'
event_details = { "Host": "ftp://ftp.morningstar.com/", "Protcol": "FTPS" } sess.put_audit_event(action, result, event_details
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file dhx_audit_client-1.0.11b42-py3-none-any.whl.
File metadata
- Download URL: dhx_audit_client-1.0.11b42-py3-none-any.whl
- Upload date:
- Size: 8.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
969a10f78b1b764704e4b05409801b2020afc85105bc2e95ad29a925f899780d
|
|
| MD5 |
e2f673f67440dcb870f825534d88ccf3
|
|
| BLAKE2b-256 |
da305a41b9ae3b671f763df9f315c09aad483655f20014694e65d5909ac29c78
|