Resource Discovery
A cross-service inventory engine that answers Resource Explorer, Resource Graph, and Cloud Asset Inventory queries over your emulated resources
aws Resource Explorer 2azr Resource Graphgcp Cloud Asset Inventory
Emulates the cross-service inventory APIs — the "list everything I have, filtered by service, type, region, or tag" layer that Resource Explorer, Resource Graph, and Cloud Asset Inventory provide. An engine walks your emulated compute, networking, storage, database, serverless, and Databricks resources and answers those queries over normalized, cross-cloud records.
Reach for it in tests when your code enumerates resources, reconciles inventory, or drives tag-based automation — so you can assert on what's discoverable without a real account. Every provider auto-wires a ResourceDiscovery engine over its core drivers, so anything you create through those services is immediately discoverable, with no separate registration step.
| Provider | Service | SDK-compat | Driver |
|---|---|---|---|
| AWS | Resource Explorer 2 + Resource Groups Tagging API | ✓ Live | aws.ResourceDiscovery |
| Azure | Resource Graph (armresourcegraph, KQL) | ✓ Live | azure.ResourceDiscovery |
| GCP | Cloud Asset Inventory (cloudasset/v1) | ✓ Live | gcp.ResourceDiscovery |
Query with the real SDK#
Wire the engine into the server alongside your other drivers, then point the real Resource Explorer client at it — this is the path that exercises the actual discovery API and its query-string filters:
import (
"github.com/aws/aws-sdk-go-v2/service/resourceexplorer2"
"github.com/stackshy/cloudemu/v2"
awsserver "github.com/stackshy/cloudemu/v2/server/aws"
)
cloud := cloudemu.NewAWS()
ts := httptest.NewServer(awsserver.New(awsserver.Drivers{
EC2: cloud.EC2, VPC: cloud.VPC, S3: cloud.S3,
ResourceDiscovery: cloud.ResourceDiscovery,
AccountID: "123456789012",
Region: "us-east-1",
}))
client := resourceexplorer2.NewFromConfig(cfg, func(o *resourceexplorer2.Options) {
o.BaseEndpoint = aws.String(ts.URL)
})
client.Search(ctx, &resourceexplorer2.SearchInput{
QueryString: aws.String("service:s3 tag.env:prod"),
})Wire the engine into azureserver.Drivers{ResourceDiscovery: …, SubscriptionID: …} or gcpserver.Drivers{ResourceDiscovery: …, ProjectID: …} for the Azure and GCP equivalents.
Query with the Portable Go API#
When you don't need the SDK round-trip, query the engine directly — ListAll returns everything, List applies structured filters, and GetTagKeys surfaces the tag namespace for tag-driven tests:
import "github.com/stackshy/cloudemu/v2/services/resourcediscovery"
all, _ := aws.ResourceDiscovery.ListAll(ctx)
results, _ := aws.ResourceDiscovery.List(ctx, resourcediscovery.Query{
Services: []string{"compute"},
Type: "Instance",
Region: "us-east-1",
Tags: map[string]string{"env": "prod"},
})
keys, _ := aws.ResourceDiscovery.GetTagKeys(ctx)What it inventories#
The engine reads live state from the service drivers and emits normalized, cross-cloud resource records:
| Portable service | Resource type | AWS · Azure · GCP |
|---|---|---|
compute | Instance | EC2 · VM · Compute Engine |
networking | VPC / Subnet / SecurityGroup | VPC · VNet · Network (+ NSG / Firewall) |
storage | Bucket | S3 · Storage · GCS |
database | Table | DynamoDB · Cosmos DB · Firestore |
serverless | Function | Lambda · Functions · Cloud Functions |
databricks | Workspace | — · Databricks · — |
Behavior & fidelity#
- Live, not cached. The engine reads current driver state on every query, so a resource is discoverable the moment you create it and gone the moment you delete it — no reindex step.
- Provider-native query surfaces. Each provider maps to its own dialect: AWS query filters (
service:,tag.<key>:<value>,region:) across Resource Explorer 2 and the Resource Groups Tagging API; a KQL subset over Azure Resource Graph'sResourcestable (where type ==/in~ (…),where location ==,where tags['k'] ==,| limit/| take); and GCP Cloud Asset Inventory filters (service:,assetType:,location:,labels.<k>:<v>). - SDK-compat status — Live. Real Resource Explorer 2 + Resource Groups Tagging API clients (CreateView/DeleteView/ListViews/GetView/Search/ListResources/ListIndexes/GetIndex; GetResources/GetTagKeys/GetTagValues/TagResources/UntagResources), Azure Resource Graph (
POST /resources,/resourcesHistory,GET /operations), and GCP Cloud Asset Inventory (searchAllResources,searchAllIamPolicies,exportAssets,batchGetAssetsHistory,assets.list, feed CRUD) point at the SDK-compat server; the same queries are available through the Portable Go API above.