Skip to main content

Async helpers that wrap Argo CD, Git providers, and Vault APIs.

Project description

infra-connectors

infra-connectors bundles asynchronous helpers that wrap the HTTP APIs exposed by Argo CD, Git providers that implement the GitHub API, and HashiCorp Vault. The utilities were extracted from the Backstage provisioning service so other projects can reuse the same integration layer.

Features

  • Async clients that validate responses and raise typed exceptions.
  • High-level helpers for synchronising Argo CD applications, manipulating Git repository contents, and managing Vault secrets.
  • Shared logging configuration built on Loguru for consistent observability across services.
  • Minimal dependency footprint so the utilities stay framework agnostic.

Installation

pip install horizon-infra-connectors

Usage

from horizon_infra_connectors import ArgoCD, Git, Vault

argo = ArgoCD(
    base_url="https://argo.example.com",
    api_key="token",
    application_set_timeout=30,
)

git = Git(
    base_url="https://api.bitbucket.org/2.0",
    token="token",
    username_or_email="kingjohnny@example.com or kingJohnny",
    workspace="workspace",
    repo_slug="repo",
)

vault = Vault(
    base_url="https://vault.example.com",
    token="token",
)

Bitbucket is the default Git provider. To target GitHub instead, supply the provider argument:

from horizon_infra_connectors import Git

github = Git(
    base_url="https://api.github.com/repos/org/repo",
    token="github-token",
    provider="github",
)

GitHub usage example

import asyncio
from horizon_infra_connectors import Git

async def main() -> None:
    github = Git(
        base_url="https://api.github.com/repos/org/repo",
        token="github-token",
        provider="github",
    )
    await github.async_init()
    readme_text = await github.get_file_content("README.md")
    print(readme_text.splitlines()[0])

asyncio.run(main())

Each service exposes an underlying API client when you need lower-level control:

import asyncio
from horizon_infra_connectors.argocd import ArgoCDAPI

async def main() -> None:
    api = ArgoCDAPI(base_url="https://argo.example.com", api_key="token")
    app = await api.get_application("example")
    print(app["metadata"]["name"])

asyncio.run(main())

The package raises rich exceptions that inherit from infra_connectors.errors.ExternalServiceError, making it simple to map failures to HTTP responses or retry logic.

See the module docstrings for additional usage examples.

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

horizon_infra_connectors-0.0.0.1.dev1.tar.gz (14.4 kB view details)

Uploaded Source

Built Distribution

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

File details

Details for the file horizon_infra_connectors-0.0.0.1.dev1.tar.gz.

File metadata

File hashes

Hashes for horizon_infra_connectors-0.0.0.1.dev1.tar.gz
Algorithm Hash digest
SHA256 e2ea5949adbf5d297ebf2373e1cf8a4b89a1d8ef376f6800556d9f956206aa46
MD5 bd6169f9ac75408bb879eb45bcb5c3b3
BLAKE2b-256 eb8d354d21b10be5cb9b26c3a0355c4e3aba9ee31565d894e78977d11757dd8d

See more details on using hashes here.

Provenance

The following attestation bundles were made for horizon_infra_connectors-0.0.0.1.dev1.tar.gz:

Publisher: python-publish.yml on SavageAxe/infra-connectors

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file horizon_infra_connectors-0.0.0.1.dev1-py3-none-any.whl.

File metadata

File hashes

Hashes for horizon_infra_connectors-0.0.0.1.dev1-py3-none-any.whl
Algorithm Hash digest
SHA256 73f0140300ea68fd78970ba46f3df874b2cb6824df5030304180ebc0ad050135
MD5 f440064d6bacd75c3969ed89227e819d
BLAKE2b-256 a7cf7bc980364d99cccf154efbbdc5ee059a61a46272ac1b4400eca4cf22df94

See more details on using hashes here.

Provenance

The following attestation bundles were made for horizon_infra_connectors-0.0.0.1.dev1-py3-none-any.whl:

Publisher: python-publish.yml on SavageAxe/infra-connectors

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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