Index
Router submodule.
| MODULE | DESCRIPTION |
|---|---|
agent |
Routes GitHub events (repo + event_type) to configured agent URLs. |
health |
Health and readiness fastapi routers for the foreman app. |
| CLASS | DESCRIPTION |
|---|---|
RouteTarget |
The resolved destination for a routed event. |
Router |
Maps GitHub events to agent URLs based on the Foreman config. |
RoutingError |
Raised when a repo is not found in the Foreman config. |
Classes¶
RouteTarget
dataclass
¶
RouteTarget(url: str, agent_assignment: AgentAssignment)
The resolved destination for a routed event.
| ATTRIBUTE | DESCRIPTION |
|---|
| PARAMETER | DESCRIPTION |
|---|---|
url
|
TYPE:
|
agent_assignment
|
TYPE:
|
Router
¶
Router(config: ForemanConfig)
Maps GitHub events to agent URLs based on the Foreman config.
Initialised once at startup with the parsed config. The container
lifecycle manager calls :meth:register_url after each agent container
starts so that dynamically-assigned ports are used at dispatch time.
| PARAMETER | DESCRIPTION |
|---|---|
config
|
Validated :class:
TYPE:
|
| METHOD | DESCRIPTION |
|---|---|
register_url |
Register a runtime URL for agent_type. |
route |
Return the :class: |
Functions¶
register_url
¶
Register a runtime URL for agent_type.
Overrides any url value from the YAML config. Called by the
container lifecycle manager after a container is started.
| PARAMETER | DESCRIPTION |
|---|---|
agent_type
|
Agent type identifier (e.g.
TYPE:
|
url
|
Base URL of the running container (e.g.
TYPE:
|
route
¶
route(event_type: str, repo: str) -> RouteTarget | None
Return the :class:RouteTarget for event_type in repo, or None.
| PARAMETER | DESCRIPTION |
|---|---|
event_type
|
GitHub event type string (e.g.
TYPE:
|
repo
|
Repository in
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
A
|
class:
TYPE:
|
RouteTarget | None
|
found, or |
| RAISES | DESCRIPTION |
|---|---|
RoutingError
|
When repo is not present in the config. |