cloudg inventory internals¶
A developer guide to the inventory mapper (cloudg map, cloudg deps, cloudg.inventory):
how a mapping run flows, what every module does, how collectors declare relationships, how the
linker resolves them, how dependencies are analysed, and how to extend each part. It is written
for people changing cloudg or building on its internals.
Companion documents:
- INVENTORY_REFERENCE.md: the exact structure of every return value and exported file.
- INVENTORY_CATALOG.md: per-asset-type metadata keys, declared relations, and the relationship matrix.
- DOCUMENTATION.md: user-facing CLI, configuration and Python API.
Sections¶
-
- Declare, don't resolve. A collector knows only the identifier of what an asset talks to (a role ARN, a queue URL, an image URI, a subnet ID). It...
-
GCP parity modules:
-
4. A mapping run, step by step
InventoryMapper(config, tagging_sweep=None).map_inventory():
-
6. AWS Organizations and Control Tower
discover_organization(session, control_tower=True, home_region=None) (blocking, read-only):
-
RelationshipLinker(assets, materialize_external=True) subclasses IdentifierIndex.
-
AzureDeepInventoryCollector(credential, subscription_id, graph_client_factory=None, use_resource_graph=True):
-
GCPCollector(project_id, credentials=None, options) (GCPCollectorOptions: organization_id, scope, project_filter, skip_asset_types, page_size, include_iam,...
-
DependencyGraph turns each edge into dependent → dependency with DEPENDENCY_DIRECTION (reference table). The rule of thumb: for "uses" edges (references,...
-
Reference data lives in YAML under cloudg/inventory/catalogs/, loaded by load_catalog(name) (cached per process):
-
- Pick the package by domain (application, containers, data_ml, governance, network_ext, platform, security, serverless) and add a module, or extend one...
-
16. Security rules for collectors
These rules are enforced in review and by CodeQL; follow them in every collector:
-
The repository is checked by Codacy and CodeQL on every pull request. Code that passes them:
-
tests/conftest.py has three autouse fixtures that make moto work with the async collectors:
-
19. Public API and compatibility
Kept stable across 0.6.x (breaking them needs a minor version bump and a changelog entry):