Authentication
To interact with the H2O Audit Trail, you need to authenticate first. There are several options available:
Using the H2O AI Cloud
If you are using the client with H2O AI Cloud, your environment can be configured using the H2O CLI.
import h2o_audit_trail
clients = h2o_audit_trail.login()
Using the H2O CLI
On your local machine, the recommended way is to download and configure the H2O CLI. Visit the CLI & API Access section of H2O AI Cloud to get started. For more information, see Using the H2O CLI in the AI App Store documentation.
Verify your installation by running:
h2o platform token-info
With the H2O AI Cloud CLI configured, you can log in without providing any arguments.
import h2o_audit_trail
clients = h2o_audit_trail.login()
If your H2O AI Cloud CLI configuration file is in a non-standard location, you can pass the path using the config_path
argument.
You can also specify the H2O AI Cloud environment URL and a platform token directly.
import h2o_audit_trail
# Using a specific config file
clients = h2o_audit_trail.login(config_path="/path/to/h2o-cli-config.toml")
# Providing environment and platform token
clients = h2o_audit_trail.login(
environment="https://cloud.h2o.ai",
platform_token="my-platform-token"
)
For environments with custom SSL certificates, you can disable SSL verification or provide a path to a CA certificate bundle.
import h2o_audit_trail
# Disable SSL verification
clients = h2o_audit_trail.login(verify_ssl=False)
# Use a custom CA bundle
clients = h2o_audit_trail.login(ssl_ca_cert="/path/to/ca.pem")
Using the Platform Token
Log in to the H2O AI Cloud and visit the CLI & API Access section. This page allows you to generate a platform token and provides a code example for you.
Custom authentication
You can log in manually using the login_custom
function.
This approach is useful if you want to authenticate outside the H2O AI Cloud environment.
import h2o_audit_trail
clients = h2o_audit_trail.login_custom(
endpoint="https://audittrail.cloud-dev.h2o.ai",
refresh_token="my-secret-refresh-token",
client_id="oidc-app-client-id",
client_secret="oidc-app-secret",
issuer_url="https://auth.cloud-dev.h2o.ai/auth/realms/hac-dev"
)
For environments with custom SSL certificates, you can disable SSL verification or provide a path to a CA certificate bundle.
import h2o_audit_trail
# Disable SSL verification
clients = h2o_audit_trail.login_custom(
endpoint="...",
refresh_token="...",
client_id="...",
issuer_url="...",
verify_ssl=False
)
# Use a custom CA bundle
clients = h2o_audit_trail.login_custom(
endpoint="...",
refresh_token="...",
client_id="...",
issuer_url="...",
ssl_ca_cert="/path/to/ca.pem"
)
- Submit and view feedback for this page
- Send feedback about Audit Trail Documentation to cloud-feedback@h2o.ai