o |nh@s0dZddlmZddlmZGdddeZdS)z3Support for "Audit"-related System Backend Methods.)utils)SystemBackendMixinc@s0eZdZddZ d ddZddZdd ZdS) AuditcCs |jdS)aVList enabled audit devices. It does not list all available audit devices. This endpoint requires sudo capability in addition to any path-specific capabilities. Supported methods: GET: /sys/audit. Produces: 200 application/json :return: JSON response of the request. :rtype: dict z /v1/sys/audit)_adapterget)selfrH/usr/local/lib/python3.10/dist-packages/hvac/api/system_backend/audit.pylist_enabled_audit_devicess z Audit.list_enabled_audit_devicesNcCsJ|dur|}d|i}|t|||dtjd|d}|jj||dS)aEnable a new audit device at the supplied path. The path can be a single word name or a more complex, nested path. Supported methods: PUT: /sys/audit/{path}. Produces: 204 (empty body) :param device_type: Specifies the type of the audit device. :type device_type: str | unicode :param description: Human-friendly description of the audit device. :type description: str | unicode :param options: Configuration options to pass to the audit device itself. This is dependent on the audit device type. :type options: str | unicode :param path: Specifies the path in which to enable the audit device. This is part of the request URL. :type path: str | unicode :param local: Specifies if the audit device is a local only. :type local: bool :return: The response of the request. :rtype: requests.Response Ntype) descriptionoptionslocal/v1/sys/audit/{path}pathurljson)updater remove_nones format_urlrpost)r device_typer r rrparamsapi_pathrrr enable_audit_devices zAudit.enable_audit_devicecCstjd|d}|jj|dS)acDisable the audit device at the given path. Supported methods: DELETE: /sys/audit/{path}. Produces: 204 (empty body) :param path: The path of the audit device to delete. This is part of the request URL. :type path: str | unicode :return: The response of the request. :rtype: requests.Response rr)r)rrrdelete)rrrrrr disable_audit_deviceCs zAudit.disable_audit_devicecCs&d|i}tjd|d}|jj||dS)aHash the given input data with the specified audit device's hash function and salt. This endpoint can be used to discover whether a given plaintext string (the input parameter) appears in the audit log in obfuscated form. Supported methods: POST: /sys/audit-hash/{path}. Produces: 204 (empty body) :param path: The path of the audit device to generate hashes for. This is part of the request URL. :type path: str | unicode :param input_to_hash: The input string to hash. :type input_to_hash: str | unicode :return: The JSON response of the request. :rtype: requests.Response inputz/v1/sys/audit-hash/{path}rr)rrrr)rr input_to_hashrrrrr calculate_hashSszAudit.calculate_hash)NNNN)__name__ __module__ __qualname__r rrr!rrrr rs  - rN)__doc__hvacr,hvac.api.system_backend.system_backend_mixinrrrrrr s