CDD-CMDB

A Configuration Management Database defined entirely as a test suite

View the Project on GitHub syndicalt/cdd-cmdb

API Contract

The full API surface is defined by the OpenAPI spec at specs/openapi/cmdb.yaml and extended by the test suites. This document summarizes the contract.

Data Model

Configuration Item (CI)

A CI represents any managed resource: servers, applications, databases, network devices, certificates, containers, etc.

{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "name": "prod-web-1",
  "type": "server",
  "attributes": {
    "env": "production",
    "region": "us-east-1",
    "owner": "platform-team",
    "port": 443
  },
  "created_at": "2026-01-15T10:30:00Z",
  "updated_at": "2026-03-01T14:22:00Z"
}

Relationship

A directed, typed edge between two CIs.

{
  "id": "660e8400-e29b-41d4-a716-446655440000",
  "source_id": "550e8400-...",
  "target_id": "770e8400-...",
  "type": "hosts",
  "attributes": {},
  "created_at": "2026-02-10T08:00:00Z"
}

Common relationship types: hosts, depends_on, connects_to, monitors, backs_up, load_balances, contains, replicates_to, managed_by.

Policy

A runtime validation rule applied to CIs of a specific type.

{
  "id": "880e8400-...",
  "ci_type": "server",
  "rules": {
    "required_attributes": ["owner", "env"],
    "allowed_values": {
      "env": ["prod", "staging", "dev"]
    }
  },
  "created_at": "2026-03-10T12:00:00Z"
}

Audit Entry

An immutable record of a change to a CI.

{
  "id": "990e8400-...",
  "ci_id": "550e8400-...",
  "action": "updated",
  "changes": {"name": {"old": "web-1", "new": "web-1-v2"}},
  "timestamp": "2026-03-01T14:22:00Z",
  "actor": "api-key-abc123"
}

Endpoints

Health

Method Path Response
GET /health {"status": "ok"}

Configuration Items

Method Path Request Response Notes
POST /cis CIInput 201 CI Enforces active policies
GET /cis query: type, name, limit, offset {"items": [CI], "total": int}  
GET /cis/{id} — 200 CI or 404  
PUT /cis/{id} CIInput 200 CI or 404 Full replacement
DELETE /cis/{id} — 204 or 404 or 409 409 if relationships exist
POST /cis/bulk {"items": [CIInput]} {"items": [CI]} Batch creation
GET /cis/{id}/history — {"items": [AuditEntry]} Chronological, immutable
GET /cis/{id}/relationships query: direction, type {"items": [Relationship]} direction: outbound/inbound/both
GET /cis/{id}/impact query: depth, relationship_types {"items": [CI]} Transitive outbound traversal
GET /cis/{id}/dependencies query: depth, relationship_types {"items": [CI]} Transitive inbound traversal

Relationships

Method Path Request Response Notes
POST /relationships RelationshipInput 201 Relationship Both CIs must exist
GET /relationships/{id} — 200 Relationship or 404  
DELETE /relationships/{id} — 204 or 404  

Policies

Method Path Request Response
POST /policies {"ci_type": str, "rules": {...}} 201 Policy
GET /policies — {"items": [Policy]}
DELETE /policies/{id} — 204 or 404

Behavioral Invariants

These are enforced by the test suites and must hold for any compliant implementation:

Core

Relationships

Schema Validation

Graph Traversal

Audit

Governance

Security

Performance