Itential Gateway Async Client
Project description
AsyncGateway
Async Python client for the Itential Automation Gateway (IAG) 4.x API.
Overview
asyncgateway provides async/await access to IAG 4.x across two layers:
- Services (
client.services.*) — thin async wrappers, one method per API endpoint, returning raw dicts. - Resources (
client.resources.*) — declarative abstractions that compose service calls into idempotent operations (ensure,absent,run,load,dump).
Use services when you need direct API access. Use resources when you want declarative, state-based control.
Installation
pip install asyncgateway
uv add asyncgateway
Requires: Python 3.10+, ipsdk
Usage
Client initialization
import asyncio
import asyncgateway
config = {
"host": "gateway.example.com",
# "port": 3000,
# "protocol": "https",
# "username": "admin",
# "password": "secret",
}
async def main():
async with asyncgateway.client(**config) as client:
...
asyncio.run(main())
All **kwargs are passed through to ipsdk.gateway_factory().
Services layer
Direct, one-to-one wrappers around IAG API endpoints.
# Devices
devices = await client.services.devices.get_all()
device = await client.services.devices.get("router1")
await client.services.devices.create("router1", {"ansible_host": "192.168.1.1"})
await client.services.devices.patch("router1", {"ansible_user": "admin"})
await client.services.devices.delete("router1")
# Playbooks
playbooks = await client.services.playbooks.get_all()
playbook = await client.services.playbooks.get("network_config")
await client.services.playbooks.refresh()
schema = await client.services.playbooks.get_schema("network_config")
await client.services.playbooks.update_schema("network_config", schema)
await client.services.playbooks.delete_schema("network_config")
# Gateway configuration
config = await client.services.config.get()
await client.services.config.update({"max_concurrent_jobs": 10})
Resources layer
Declarative, idempotent operations that compose service calls.
from asyncgateway.services import Operation
# Ensure a device exists; create if missing, patch variables if present
device = await client.resources.devices.ensure("router1", {"ansible_host": "192.168.1.1"})
# Ensure a device does not exist (no-op if already absent)
await client.resources.devices.absent("router1")
# Bulk load devices from an in-memory list
data = [{"name": "router1", "variables": {"ansible_host": "192.168.1.1"}}]
result = await client.resources.devices.load(data, Operation.MERGE)
# Dump all devices to files
result = await client.resources.devices.dump(format_type="yaml", individual_files=True)
# Run a playbook
result = await client.resources.playbooks.run("network_config", {"target": "router1"})
# Dry run a playbook
result = await client.resources.playbooks.dry_run("network_config", {"target": "router1"})
Load operations:
| Operation | Behavior |
|---|---|
Operation.MERGE |
Add missing resources; skip existing |
Operation.OVERWRITE |
Add missing; replace existing |
Operation.REPLACE |
Delete all existing, then add from data |
Bulk file load
client.load(path, op) reads JSON/YAML files from {path}/{service_name}/ and dispatches to each service that supports load():
result = await client.load("/data", Operation.MERGE)
YAML support requires PyYAML (uv add PyYAML). Without it, YAML paths raise ValidationError.
Development
git clone https://github.com/itential/asyncgateway
cd asyncgateway
uv sync --group dev
uv run pytest # all tests pass without a live IAG instance
make ci # lint + typecheck + security + tests (full local CI)
See docs/development.md for the full contributor guide and CONTRIBUTING.md for contribution guidelines.
License
GPL-3.0-or-later. See LICENSE.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file asyncgateway-0.1.0.tar.gz.
File metadata
- Download URL: asyncgateway-0.1.0.tar.gz
- Upload date:
- Size: 151.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0ffb27b567a5928c9cab5d85e691c3ba54e0f10e8d6e215dc3d918ab8e1e5226
|
|
| MD5 |
5ab24303e37fd810ab887f75f571ff06
|
|
| BLAKE2b-256 |
17828bcd532448af3f24f6502d267c5d3126ae548b608d3b9456f3fb14317b08
|
Provenance
The following attestation bundles were made for asyncgateway-0.1.0.tar.gz:
Publisher:
release.yaml on itential/asyncgateway
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
asyncgateway-0.1.0.tar.gz -
Subject digest:
0ffb27b567a5928c9cab5d85e691c3ba54e0f10e8d6e215dc3d918ab8e1e5226 - Sigstore transparency entry: 1066039127
- Sigstore integration time:
-
Permalink:
itential/asyncgateway@3f43a21c9eebb9c05f7e6a417e014ac87b2492b6 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/itential
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yaml@3f43a21c9eebb9c05f7e6a417e014ac87b2492b6 -
Trigger Event:
push
-
Statement type:
File details
Details for the file asyncgateway-0.1.0-py3-none-any.whl.
File metadata
- Download URL: asyncgateway-0.1.0-py3-none-any.whl
- Upload date:
- Size: 75.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
26d484b90337c76be373503388737a5d750fc979076e09f062c42fdaebb6bb86
|
|
| MD5 |
5f6531f39e26b3fcdfed0e4e0674a1e9
|
|
| BLAKE2b-256 |
0172df373e074528c7fd3c7507a6415d8320f9ae9e85096fba275198a7baa309
|
Provenance
The following attestation bundles were made for asyncgateway-0.1.0-py3-none-any.whl:
Publisher:
release.yaml on itential/asyncgateway
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
asyncgateway-0.1.0-py3-none-any.whl -
Subject digest:
26d484b90337c76be373503388737a5d750fc979076e09f062c42fdaebb6bb86 - Sigstore transparency entry: 1066039130
- Sigstore integration time:
-
Permalink:
itential/asyncgateway@3f43a21c9eebb9c05f7e6a417e014ac87b2492b6 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/itential
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yaml@3f43a21c9eebb9c05f7e6a417e014ac87b2492b6 -
Trigger Event:
push
-
Statement type: