inventory-map.json¶
The self-contained map. Written by export(), read by load() and cloudg deps.
| Key | Type | Content |
|---|---|---|
summary |
object |
Section 9. |
providers |
list[str] |
InventoryResult.providers. |
regions |
object |
InventoryResult.regions. |
assets |
list[object] |
CloudAsset.model_dump(mode="json") for every asset (section 3), including display_id, excluding raw_data. |
edges |
list[object] |
NetworkEdge.model_dump(mode="json") for every edge (section 5). |
unresolved_references |
list[object] |
Section 11. |
coverage |
list[object] |
CollectionCoverage.model_dump(mode="json") for every coverage record (section 10). |
throttling |
object |
Only when a cloud API throttled the run: the full InventoryResult.throttling block. |
Skeleton:
{
"summary": {"total_assets": 2459, "total_edges": 2547, "…": "…"},
"providers": ["aws"],
"regions": {"aws": ["us-east-1"]},
"assets": [
{"id": "…", "arn": "…", "name": "…", "asset_type": "…", "provider": "AWS", "region": "…",
"account_id": "…", "tags": {}, "metadata": {}, "collected_at": "…",
"is_internet_exposed": false, "display_id": "…"}
],
"edges": [
{"id": "…", "source_id": "…", "target_id": "…", "edge_type": "…", "ports": [],
"port_range": null, "protocol": null, "cidr": null, "direction": "ingress",
"description": null, "relationship": null, "properties": {}}
],
"unresolved_references": [
{"source": "…", "source_name": "…", "target": "…", "edge_type": "…"}
],
"coverage": [
{"provider": "aws", "region": "us-east-1", "account_id": "…", "started_at": "…",
"completed_at": null, "services": [{"service": "ec2", "status": "SUCCESS",
"asset_count": 0, "error": null, "duration_ms": 0}]}
]
}
Working with it from code without cloudg:
import json
m = json.load(open("reports/inventory-map.json"))
by_id = {a["id"]: a for a in m["assets"]}
# every function and the role it runs as
for e in m["edges"]:
if e["edge_type"] == "ASSUMES_ROLE":
src, dst = by_id.get(e["source_id"]), by_id.get(e["target_id"])
if src and dst and src["asset_type"] == "LAMBDA_FUNCTION":
print(src["arn"], "->", dst["arn"])
Always look endpoints up with .get(): collector network edges can have endpoints that are not
asset IDs (5.3).