How datadog/datadog-sync-cli works
datadog-sync-cli copies Datadog configuration resources between organizations, using persisted resource state as the handoff between import and sync. The main workflow is import from the source organization, review diffs, then apply to the destination; migrate combines import and sync. Reset, prune, schema discovery, metadata, completions, filtering, and machine-readable events are supporting product capabilities. The tree and excerpts establish the resource, client, storage, and worker layers; command-to-handler wiring is represented only where documented, since command implementations were not sampled.
Main entry points: cli.py Command interface · resources_handler.py Resource orchestration · _import.py Import · sync.py Sync
Components 22
CLI commands
- Command interface
datadog_sync/cli.py - Import
datadog_sync/commands/_import.py - Sync
datadog_sync/commands/sync.py - Migrate
datadog_sync/commands/migrate.py - Diff preview
datadog_sync/commands/diffs.py - Reset
datadog_sync/commands/reset.py - Prune state
datadog_sync/commands/prune.py - Schema and metadata
datadog_sync/commands/metadata.py - Shell completions
datadog_sync/commands/completions.py
Sync engine
- Configuration
datadog_sync/utils/configuration.py - Resource orchestration
datadog_sync/utils/resources_handler.py - Async workers
datadog_sync/utils/workers.py - Resource models
datadog_sync/model - HTTP client
datadog_sync/utils/custom_client.py
Resource state
- State handling
datadog_sync/utils/state.py - Storage backends
datadog_sync/utils/storage - Source resource files
- Destination resource files
Datadog APIs
- Source organization
- Destination organization
Other components
- Operator
- Structured events
datadog_sync/cli_events.py
Connections 29
- Operator → Command interface: invokes
- Command interface → Import: dispatches
- Command interface → Sync: dispatches
- Command interface → Migrate: dispatches
- Command interface → Diff preview: dispatches
- Command interface → Reset: dispatches
- Command interface → Prune state: dispatches
- Command interface → Schema and metadata: dispatches
- Command interface → Shell completions: dispatches
- Import → Configuration: configures
- Sync → Configuration: configures
- Migrate → Import: runs
- Migrate → Sync: runs
- Import → Resource orchestration: imports resources
- Sync → Resource orchestration: applies resources
- Diff preview → Resource orchestration: compares state
- Reset → Resource orchestration: deletes resources
- Prune state → Storage backends: deletes stale files
- Resource orchestration → Async workers: schedules work
- Resource orchestration → Resource models: dispatches actions
- Resource models → HTTP client: calls API
- HTTP client → Source organization: reads
- HTTP client → Destination organization: reads and writes
- Resource orchestration → State handling: loads and compares
- State handling → Storage backends: loads and saves
- Storage backends → Source resource files: stores source
- Storage backends → Destination resource files: stores destination
- Import → Structured events: emits events
- Sync → Structured events: emits events