|
| 1 | +# Agent Design (concept) |
| 2 | + |
| 3 | +Dit is een beknopt, uitvoerbaar designvoorstel voor een ITL Resource Provider. Het bevat placeholders en aannames — pas waar nodig aan na intake. |
| 4 | + |
| 5 | +**Provider namespace**: Partner.Example |
| 6 | + |
| 7 | +**Resource types** |
| 8 | +- `instances` (hoofdkernresource) |
| 9 | + - Properties: `sku` (required, object), `region` (required), `configuration` (optional), `provisioningState` (read-only) |
| 10 | + - Uniqueness: per subscription + resourceGroup |
| 11 | +- `backups` (child van `instances`) |
| 12 | + - Properties: `timestamp`, `status`, `sizeMB` |
| 13 | + |
| 14 | +**API mapping (CRUD routes)** |
| 15 | +- Create: POST /subscriptions/{sub}/resourceGroups/{rg}/providers/Partner.Example/instances |
| 16 | +- Get: GET /.../instances/{name} |
| 17 | +- List: GET /.../instances |
| 18 | +- Delete: DELETE /.../instances/{name} |
| 19 | + |
| 20 | +Samengestelde `type` antwoord: `Partner.Example/instances` |
| 21 | + |
| 22 | +**Provisioning model** |
| 23 | +- Standaard antwoord op create: 202 Accepted met `provisioningState: Creating`. |
| 24 | +- Achtergrondtask voert externe API calls uit; bij succes `provisioningState: Succeeded`, bij fout `Failed` + `error` property. |
| 25 | +- Polling model: GET resource retourneert actuele provisioningState. |
| 26 | + |
| 27 | +**Externe integratie** |
| 28 | +- Client: `httpx.AsyncClient` met configurable `base_url` en auth header. |
| 29 | +- Timeouts en retries: exponential backoff, max 5 retries voor idempotente calls. |
| 30 | + |
| 31 | +**Storage / state** |
| 32 | +- Aanbevolen: PostgreSQL (asyncpg) voor persistente metadata en provisioning state. |
| 33 | +- Alternatief: vertrouw op upstream API en bewaar alleen index/metadata lokaal. |
| 34 | + |
| 35 | +**Events / notificaties** |
| 36 | +- Optioneel: publiceer events bij create/succeed/fail naar RabbitMQ of webhook endpoint. |
| 37 | + |
| 38 | +**Errors & retry** |
| 39 | +- Map externe 4xx -> `ValidationError` / `ResourceConflictError` waar passend. |
| 40 | +- 5xx en netwerkfouten -> `ExternalServiceError` met retry. |
| 41 | + |
| 42 | +**Security** |
| 43 | +- Credentials via environment variables or mounted secret store (CONFIG: `EXTERNAL_API_KEY`, `EXTERNAL_BASE_URL`). |
| 44 | + |
| 45 | +**Tests / CI** |
| 46 | +- `pytest` async tests: create/get/list/delete happy path + failure simulation (mock client). |
| 47 | +- GH Actions: lint, unit tests, build docker image. |
| 48 | + |
| 49 | +**Acceptance criteria** |
| 50 | +- Create returns 202 and resource shows `provisioningState: Succeeded` after background task. |
| 51 | +- CRUD routes conform to expected ARM-style id and type fields. |
| 52 | +- Tests groen in CI. |
| 53 | + |
| 54 | +--- |
| 55 | +Als dit design akkoord is, scaffold ik de providercode (stap 3). Als je wilt, kan ik nu al concrete voorbeelden en bestanden genereren. |
0 commit comments