- Created docs/ directory for better organization - Moved 35 markdown files from root to docs/ - Includes all status reports, guides, and testing documentation Co-Authored-By: Warp <agent@warp.dev>
3.6 KiB
3.6 KiB
VTL Endpoints Verification
✅ Implementation Status
The VTL endpoints ARE implemented in the codebase. The routes are registered in the router.
🔍 Verification Steps
1. Check if Server Needs Restart
The server must be restarted after code changes. Check if you're running the latest build:
# Rebuild the server
cd backend
go build -o bin/calypso-api ./cmd/calypso-api
# Restart the server (stop old process, start new one)
# If using systemd:
sudo systemctl restart calypso-api
# Or if running manually:
pkill calypso-api
./bin/calypso-api -config config.yaml.example
2. Verify Routes are Registered
The routes are defined in backend/internal/common/router/router.go lines 106-120:
// Virtual Tape Libraries
vtlHandler := tape_vtl.NewHandler(db, log)
vtlGroup := protected.Group("/tape/vtl")
vtlGroup.Use(requirePermission("tape", "read"))
{
vtlGroup.GET("/libraries", vtlHandler.ListLibraries)
vtlGroup.POST("/libraries", vtlHandler.CreateLibrary)
vtlGroup.GET("/libraries/:id", vtlHandler.GetLibrary)
vtlGroup.DELETE("/libraries/:id", vtlHandler.DeleteLibrary)
vtlGroup.GET("/libraries/:id/drives", vtlHandler.GetLibraryDrives)
vtlGroup.GET("/libraries/:id/tapes", vtlHandler.GetLibraryTapes)
vtlGroup.POST("/libraries/:id/tapes", vtlHandler.CreateTape)
vtlGroup.POST("/libraries/:id/load", vtlHandler.LoadTape)
vtlGroup.POST("/libraries/:id/unload", vtlHandler.UnloadTape)
}
3. Test Endpoint Registration
After restarting, test if routes are accessible:
# This should return 401 (unauthorized) not 404 (not found)
curl http://localhost:8080/api/v1/tape/vtl/libraries
# With auth, should return 200 with empty array
curl http://localhost:8080/api/v1/tape/vtl/libraries \
-H "Authorization: Bearer $TOKEN"
If you get 404:
- Server is running old code → Restart required
- Routes not compiled → Rebuild required
If you get 401:
- Routes are working! → Just need authentication
If you get 403:
- Routes are working! → Permission issue (check user has
tape:read)
4. Check Handler Implementation
Verify handlers exist:
- ✅
backend/internal/tape_vtl/handler.go- All handlers implemented - ✅
backend/internal/tape_vtl/service.go- All services implemented
🚀 Quick Fix
If endpoints return 404:
- Stop the current server
- Rebuild:
cd backend go build -o bin/calypso-api ./cmd/calypso-api - Restart:
./bin/calypso-api -config config.yaml.example
📋 Expected Endpoints
All these endpoints should be available after restart:
| Method | Endpoint | Handler |
|---|---|---|
| GET | /api/v1/tape/vtl/libraries |
ListLibraries |
| POST | /api/v1/tape/vtl/libraries |
CreateLibrary |
| GET | /api/v1/tape/vtl/libraries/:id |
GetLibrary |
| DELETE | /api/v1/tape/vtl/libraries/:id |
DeleteLibrary |
| GET | /api/v1/tape/vtl/libraries/:id/drives |
GetLibraryDrives |
| GET | /api/v1/tape/vtl/libraries/:id/tapes |
GetLibraryTapes |
| POST | /api/v1/tape/vtl/libraries/:id/tapes |
CreateTape |
| POST | /api/v1/tape/vtl/libraries/:id/load |
LoadTape |
| POST | /api/v1/tape/vtl/libraries/:id/unload |
UnloadTape |
🔧 Debugging
If still getting 404 after restart:
- Check server logs for route registration
- Verify compilation succeeded (no errors)
- Check router.go is being used (not cached)
- Test with curl to see exact error:
curl -v http://localhost:8080/api/v1/tape/vtl/libraries \ -H "Authorization: Bearer $TOKEN"
The -v flag will show the full HTTP response including headers.