Skip to content

Code map

Section 3 · From docs/INVENTORY_INTERNALS.md on GitHub

3.1 Inventory package (cloudg/inventory/)

Module Responsibility
__init__.py Public exports: InventoryMapper, InventoryResult, RelationshipLinker, DependencyGraph, the three deep collectors, OrganizationTopology, discover_organization.
mapper.py InventoryMapper (orchestration, discovery, linking, findings overlay), deduplicate, add_account_hierarchy.
mapper_result.py InventoryResult (summary, analysis, export, load) and _service_of.
linker_index.py IdentifierIndex: identifier registration, scoped resolution, identifier variants, foreign-account detection.
linker.py RelationshipLinker(RuleLinksMixin, IdentifierIndex): the three linking passes, external placeholders, unresolved bookkeeping.
linker_rules.py RuleLinksMixin: the provider-aware rules of pass 2 (_link_rules).
dependencies.py AssetIndex (the asset matcher shared with the ontology and RAG export), DEPENDENCY_DIRECTION, DependencyGraph, DependencyLink, cross_account_edges, security_coverage.
aws_deep.py AWSDeepInventoryCollector, DeepInventoryOptions, network fabric collectors, Tagging API sweep, three-tier dedupe in collect().
aws_deep_tasks.py SERVICE_FAMILIES, GLOBAL_TASKS, DEEP_TASK_METHODS, select_tasks, asset_type_from_arn.
aws_services/ The AWS service collector mixins (5.6).
kubernetes.py EKS token, read-only Kubernetes client, cluster object mapper.
organization.py OrganizationTopology and its dataclasses, Organizations / Control Tower discovery, account selection.
organization_assets.py Topology → map assets (topology_assets, account_ref).
azure_deep.py AzureDeepInventoryCollector: Resource Graph path with SDK fallback.
azure_graph/ Resource Graph queries, AzureAssetBuilder, _Draft, extractor registry and per-area extractors (8).
azure_hierarchy.py Management groups, subscriptions, Azure Policy assignments / exemptions.
gcp_deep.py GCPDeepInventoryCollector: deep type map, IAM policy search.
gcp_relations/ GCP extraction framework, name normalisation, per-area extractors, IAM principals (9).
gcp_hierarchy.py Organization, folders, projects, org policies, VPC Service Controls.
catalogs/ YAML reference data and its loader (13).
_util.py image_repository(image), walk_strings(value, max_depth=12).

GCP parity modules:

Module Responsibility
gcp_sources/ API-backed GCP sources (Cloud DNS, SCC, Cloud Identity, deny / boundary policies, PAM, Monitoring, OS Config, Backup and DR ...), GCPRestClient, cross-asset passes (9.6).
gcp_tasks.py GCP service families and --services selection (gcp_family, is_selected, type_selected).

3.2 Outside the package

Module Responsibility for the inventory
cloudg/collectors/aws.py AsyncAWSCollector: lazy task registry, per-task coverage, security group and VPC containment edges.
cloudg/collectors/aws_services.py, aws_services_extended.py Base AWS service collectors the deep collector inherits (EC2, VPC, subnets, security groups, ...).
cloudg/collectors/azure.py AzureCollector (SDK path), NSG rule edges, subscription listing.
cloudg/collectors/gcp.py, gcp_assets.py GCPCollector (Cloud Asset Inventory), record → asset building, firewall evaluation, internet edges.
cloudg/collectors/multi.py MultiAccountCollector: providers × accounts × regions, role assumption, primary region, coverage.
cloudg/cli_inventory.py cloudg map and cloudg deps, registered in cloudg/cli.py.
cloudg/api.py CloudGEngine.map_inventory() / map_inventory_sync(). The engine's scanner runs live in cloudg/api_scanners.py.
cloudg/config.py InventoryConfig, AWSOrganizationConfig, Azure / GCP inventory options.
cloudg/schema/models.py AssetType, EdgeType, CloudAsset, NetworkEdge.
cloudg/coverage.py CollectionCoverage, ServiceCoverage, ServiceStatus.
cloudg/graph/builder.py NetworkX graph, D3 / GraphML export.
cloudg/graph/ontology.py, ontology_rules.py RelationType vocabulary; declared relationships feed the ontology.
docs/viewer.html Offline viewer for inventory-graph.json.