Project Name: OpenStack VM Lifecycle Management REST API Objective: Design and implement REST API endpoints for managing OpenStack VM lifecycle operations Timebox: 2-4 hours Type: Proof-of-Concept / Technical Assessment
- REST API endpoints for VM lifecycle operations (CRUD + lifecycle management)
- Mock OpenStack integration for demonstration purposes
- Comprehensive documentation and architecture design
- Unit and integration tests
- Best practices implementation (error handling, logging, validation)
- API versioning strategy
- Working prototype with FastAPI
- Real OpenStack cloud integration
- Authentication and authorization
- Database persistence
- Containerization (Docker)
- CI/CD pipeline
- Production deployment configuration
- Rate limiting and API throttling
- Monitoring and observability tools
- Create directory structure (
/app,/tests,/docs) - Set up Python virtual environment
- Configure dependencies in
requirements.txt - Create
.gitignorefor Python project - Create
.env.examplefor configuration template
- PROJECT_PLAN.md - This document (10 min)
- ARCHITECTURE.md - System design and decisions (10 min)
- API_SPECIFICATION.md - Complete API documentation (10 min)
- FEATURE_TRACKER.md - Implementation checklist (5 min)
- README.md - Project overview and setup (7 min)
- BACKLOG.md - Future enhancements (3 min)
- Create
app/models/vm.py- VMCreateRequest schema
- VMResponse schema
- VMStatus enum
- VMListResponse schema
- Create
app/repositories/vm_repository.py- Mock in-memory VM storage
- CRUD operations
- Lifecycle state management
- UUID generation
- Create
app/services/vm_service.py- Business logic for VM operations
- Validation rules
- State transition logic
- Create
app/config.py- Environment configuration - Create
app/exceptions.py- Custom exception classes - Create
app/__init__.py- Module initialization
- Create
app/routes/vm_routes.pyPOST /api/v1/vms- Create new VM (8 min)GET /api/v1/vms- List all VMs with pagination (7 min)GET /api/v1/vms/{vm_id}- Get VM details (5 min)DELETE /api/v1/vms/{vm_id}- Delete VM (5 min)
-
POST /api/v1/vms/{vm_id}/start- Start VM (5 min) -
POST /api/v1/vms/{vm_id}/stop- Stop VM (5 min) -
POST /api/v1/vms/{vm_id}/restart- Restart VM (5 min) -
POST /api/v1/vms/{vm_id}/pause- Pause VM (5 min) -
POST /api/v1/vms/{vm_id}/resume- Resume VM (5 min)
-
GET /api/v1/vms/{vm_id}/status- Get VM status (5 min) -
GET /api/v1/health- API health check (5 min)
- Create
tests/test_vm_service.py- Test VM creation logic
- Test lifecycle transitions
- Test validation rules
- Create
tests/test_vm_routes.py- Test all API endpoints
- Test error scenarios
- Test edge cases
- Add type hints throughout
- Add docstrings
- Format code with black
- Update main.py with final application structure
- Verify all documentation is complete
- Test API with sample requests
- Final git commit with clean history
- Verify README instructions work
| Phase | Duration | Percentage |
|---|---|---|
| Foundation & Documentation | 45 min | 22.5% |
| Core Architecture | 45 min | 22.5% |
| API Implementation | 60 min | 30% |
| Testing & Quality | 45 min | 22.5% |
| Polish & Finalization | 15 min | 7.5% |
| Total | 210 min | 100% |
| Equivalent | 3.5 hours | (within timebox) |
- FastAPI - Modern, fast web framework with automatic API documentation
- Uvicorn - ASGI server for running FastAPI
- Python 3.11+ - Latest Python features and performance
- Pydantic v2 - Data validation and settings management
- pytest - Testing framework
- httpx - Async HTTP client for testing FastAPI
- python-dotenv - Environment variable management
- black - Code formatter
- mypy - Static type checker
- Custom mock implementation (real OpenStack SDK would be
openstacksdk)
- Time Constraint - 2-4 hour timebox is aggressive
- Mitigation: Focus on core features, mock OpenStack integration
- OpenStack Complexity - Real OpenStack integration requires infrastructure
- Mitigation: Use mock repository pattern for demonstration
- API Design - Well-understood REST patterns
- Technology Choice - FastAPI is well-documented and stable
- ✅ All core CRUD endpoints functional
- ✅ All lifecycle management endpoints functional
- ✅ Comprehensive documentation (6 documents)
- ✅ Unit and integration tests with >80% coverage
- ✅ Working prototype that can be run locally
- ✅ Clear README with setup instructions
- ✅ Proper error handling with meaningful messages
- ✅ Request/response validation
- ✅ API versioning strategy
- ✅ Structured logging
- ✅ Type hints throughout
- Code formatting with black
- Static type checking with mypy
- OpenAPI documentation (auto-generated by FastAPI)
- Mock vs Real OpenStack: Using mock implementation to avoid infrastructure requirements
- In-Memory Storage: No database for simplicity and timebox constraints
- Layered Architecture: Separation of concerns (routes → services → repositories)
- FastAPI Choice: Modern framework with excellent async support and auto-docs
- API Versioning: URL-based versioning (
/api/v1/) for future compatibility
- Public GitHub repository with complete code
- README.md with setup and usage instructions
- Complete set of documentation (6 files)
- Working API prototype
- Unit and integration tests
- requirements.txt with pinned versions
- .gitignore for Python
- Example API requests (test_main.http or similar)
See BACKLOG.md for detailed future enhancements including:
- Real OpenStack SDK integration
- Database persistence (PostgreSQL)
- Authentication & authorization (OAuth2/JWT)
- Containerization (Docker + Docker Compose)
- CI/CD pipeline (GitHub Actions)
- Production readiness features
Last Updated: 2026-02-25 Status: In Progress Version: 1.0