Scopes and Discovery Runs
How scopes organize discovery targets and how runs execute them on a schedule or on demand.
What is a Scope?
A scope defines a single discovery target: which plugin to use, what credentials to apply, and how often to run. Scopes are the primary unit of configuration for the discovery system.
Scope Fields
| Field | Description | Example |
|---|---|---|
name | Human-readable scope name | prod-aws-east |
plugin | Discovery plugin to use | aws, kubernetes |
config | Plugin-specific configuration | {"region": "us-east-1"} |
schedule | Cron schedule expression | 0 */6 * * * |
status | Current scope status | active, paused, error |
resource_count | Last known resource count | 342 |
Creating a Scope
curl -X POST http://localhost:8080/api/v1/discovery/scopes \
-H "Content-Type: application/json" \
-d '{
"name": "prod-aws-east",
"plugin": "aws",
"config": {
"region": "us-east-1",
"profile": "production"
},
"schedule": "0 */6 * * *"
}'Discovery Runs
A run is a single execution of a scope. Runs can be triggered manually or on a schedule. Each run records:
- Start and completion timestamps
- Status:
PENDING,RUNNING,COMPLETED,FAILED - Number of resources and relationships found
- Any errors encountered
Trigger a Run
# Manual run
curl -X POST http://localhost:8080/api/v1/discovery/run \
-H "Content-Type: application/json" \
-d '{"scope_id": "prod-aws-east"}'
# Check run status
curl http://localhost:8080/api/v1/discovery/runs/{run_id}
# List all runs for a scope
curl http://localhost:8080/api/v1/discovery/runs?scope_id=prod-aws-eastScheduling
Scopes use standard cron expressions for scheduling. The scheduler evaluates expressions and triggers runs at the configured intervals. Common patterns:
| Schedule | Meaning |
|---|---|
0 */6 * * * | Every 6 hours |
*/15 * * * * | Every 15 minutes |
0 2 * * * | Daily at 2 AM |
0 9 * * 1-5 | Weekdays at 9 AM |