This section includes the new Python API wrappers for the Audit Data Export and Audit Data Retention APIs in BlueCat Gateway.
configure_audit_log_export(audit_log_settings:dict)
Configure the audit data export service to an external database, either a Splunk server or an HTTP endpoint.
-
When configuring an HTTP endpoint, if you enter an HTTPS address in the “uri” or “healthCheckUri” field, you must enter the TLS configuration that is used by the HTTP endpoint server. When configuring a Splunk endpoint, if you enter an HTTPS address in the “host” field, you must enter the TLS configuration that is used by the Splunk endpoint.
Parameters | Description |
---|---|
audit_log_settings(dict) | The data for Audit data settings. |
Example:
from bluecat_libraries.address_manager.api import Client
audit_log_settings = {
"sinks": [{
"healthCheck": False,
"type": "http",
"uri": "https://example.com:9900",
"tls": {
"caCert":"-----BEGIN CERTIFICATE-----\n<certificate_content>\n-----END CERTIFICATE-----",
"verifyCertificate": True,
"verifyHostname": True
}
}],
"enable": True
}
with Client(<bam_host_url>) as client:
client.login(<username>, <password>)
client.configure_audit_log_export(audit_log_settings)
New in version 21.5.1.
get_audit_log_export_settings
() → dict
Return the audit data export settings that were set using the
configure_audit_log_export
API method.
Returns: The current audit data export settings in Address Manager.
Return type: dict
Example:from bluecat_libraries.address_manager.api import Client
with Client.from_url(<bam_host_url>) as client:
client.login(<username>, <password>)
settings = client.get_audit_log_export_settings()
for k, v in settings.items():
print(f"{k}: {v}")
New in version 21.5.1
update_retention_settings
(settings:
typing.Union[bluecat_libraries.address_manager.api.models.RetentionSettings,
NoneType] = None) →
bluecat_libraries.address_manager.api.models.RetentionSettings
Set the new value for history retention settings or return the existing retention settings.
Parameter | Description |
---|---|
settings (RetentionSettings, optional) | The history retention settings |
Returns: RetentionSettings
Return type: RetentionSettings
Example:from bluecat_libraries.address_manager.api import Client
from bluecat_libraries.address_manager.api.models import RetentionSettings
# To get existing retention settings value
with Client.from_url(<bam_host_url>) as client:
client.login(<username>, <password>)
retention_settings = client.update_retention_settings()
# To update history retention settings which administrative history is 1(day),
session event history is 3(days), DDNS history is 2(days) and DHCP history is 2(days)
with Client.from_url(<bam_host_url>) as client:
client.login(<username>, <password>)
retention_settings = client.update_retention_settings(
RetentionSettings(admin=1, sessionEvent=3, ddns=2, dhcp=2)
)
print('Administrative retention history: %s'%retention_settings.get('admin'))
New in version 21.5.1