Skip to main content

Shared utilities for Kibana operations, authentication, and workflows

Project description

kb-dashboard-tools

Shared utilities for Kibana operations, authentication, and workflows. This package provides common functionality used across the kb-yaml-to-lens ecosystem, including CLI tools, Language Server Protocol (LSP) servers, and future MCP servers.

Features

  • KibanaClient: HTTP client for interacting with Kibana's Saved Objects API and Elasticsearch APIs
  • Authentication utilities: Credential normalization and URL redaction for safe logging
  • Result pattern: Type-safe error handling without exceptions
  • ES|QL support: Models for ES|QL query execution and results

Installation

pip install kb-dashboard-tools

Usage

Kibana Client

from kb_dashboard_tools import KibanaClient

# Note: ssl_verify=False is only for local development with self-signed certificates.
# Always use ssl_verify=True (the default) in production environments.
async with KibanaClient(
    url='https://localhost:5601',
    username='elastic',
    password='changeme',
    ssl_verify=False,  # Only for local dev with self-signed certs
) as client:
    # Upload a dashboard
    result = await client.upload_ndjson('dashboard.ndjson')

    # Execute ES|QL query
    esql_result = await client.execute_esql('FROM logs | LIMIT 10')
    print(f'Found {esql_result.row_count} rows')

Authentication Utilities

from kb_dashboard_tools import normalize_credentials, redact_url

# Normalize credentials (converts empty strings to None)
api_key = normalize_credentials(user_input)

# Redact credentials from URLs for safe logging
safe_url = redact_url('https://user:pass@example.com:9200/path')
# Returns: 'https://example.com:9200/path'

Result Pattern

from kb_dashboard_tools import Result

def divide(a: int, b: int) -> Result[float]:
    if b == 0:
        return Result.fail('Division by zero')
    return Result.ok(a / b)

result = divide(10, 2)
if result.success:
    print(f'Result: {result.unwrap()}')
else:
    print(f'Error: {result.error}')

Development

See the main repository's DEVELOPING.md for development setup.

# Install dependencies
just install

# Run CI checks
just ci

# Run tests
just test

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

kb_dashboard_tools-0.3.2.tar.gz (31.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

kb_dashboard_tools-0.3.2-py3-none-any.whl (37.4 kB view details)

Uploaded Python 3

File details

Details for the file kb_dashboard_tools-0.3.2.tar.gz.

File metadata

  • Download URL: kb_dashboard_tools-0.3.2.tar.gz
  • Upload date:
  • Size: 31.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.10.11 {"installer":{"name":"uv","version":"0.10.11","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for kb_dashboard_tools-0.3.2.tar.gz
Algorithm Hash digest
SHA256 a876a571594f247635d5fd9dc20907a7b9a47dd89b686d641de61137dd15621b
MD5 e6beac238fa9c1dee1fa153af8b77b41
BLAKE2b-256 10875a8910d94ad9436703a3a795df66cc42c3d1d0a4b864d2a28d8d27e4d903

See more details on using hashes here.

File details

Details for the file kb_dashboard_tools-0.3.2-py3-none-any.whl.

File metadata

  • Download URL: kb_dashboard_tools-0.3.2-py3-none-any.whl
  • Upload date:
  • Size: 37.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.10.11 {"installer":{"name":"uv","version":"0.10.11","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for kb_dashboard_tools-0.3.2-py3-none-any.whl
Algorithm Hash digest
SHA256 4701acb5b2facc37b1a61c4e8f6116ba58af5ce88edb1a4bba8f9870b7d9162c
MD5 125ecec49a7b537a0e38f6f19275433c
BLAKE2b-256 14318edea73bd5347e6ef05058feed77d83da602396fe0db88268e5cc8efbf0b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page