Organize documentation: move all markdown files to docs/ directory
- 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>
This commit is contained in:
123
docs/VTL-ENDPOINTS-VERIFICATION.md
Normal file
123
docs/VTL-ENDPOINTS-VERIFICATION.md
Normal file
@@ -0,0 +1,123 @@
|
||||
# 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:
|
||||
|
||||
```bash
|
||||
# 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:
|
||||
|
||||
```go
|
||||
// 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:
|
||||
|
||||
```bash
|
||||
# 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:
|
||||
|
||||
1. **Stop the current server**
|
||||
2. **Rebuild**:
|
||||
```bash
|
||||
cd backend
|
||||
go build -o bin/calypso-api ./cmd/calypso-api
|
||||
```
|
||||
3. **Restart**:
|
||||
```bash
|
||||
./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:
|
||||
|
||||
1. **Check server logs** for route registration
|
||||
2. **Verify compilation** succeeded (no errors)
|
||||
3. **Check router.go** is being used (not cached)
|
||||
4. **Test with curl** to see exact error:
|
||||
```bash
|
||||
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.
|
||||
|
||||
Reference in New Issue
Block a user