Initial commit: Vultr API v2 Python wrapper with FastAPI server
- vultr_api/: Python library wrapping Vultr API v2 - 17 resource modules (instances, dns, firewall, vpc, etc.) - Pagination support, error handling - server/: FastAPI REST server - All API endpoints exposed via HTTP - X-API-Key header authentication - Swagger docs at /docs - Podman quadlet config for systemd deployment Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
24
server/routers/os_api.py
Normal file
24
server/routers/os_api.py
Normal file
@@ -0,0 +1,24 @@
|
||||
"""Operating Systems router"""
|
||||
from fastapi import APIRouter, Depends, Query
|
||||
from typing import Optional
|
||||
|
||||
from vultr_api import VultrClient
|
||||
from deps import get_client
|
||||
|
||||
router = APIRouter()
|
||||
|
||||
|
||||
@router.get("")
|
||||
async def list_os(
|
||||
per_page: int = Query(25, le=500),
|
||||
cursor: Optional[str] = None,
|
||||
client: VultrClient = Depends(get_client)
|
||||
):
|
||||
"""List all operating systems"""
|
||||
return client.os.list(per_page=per_page, cursor=cursor)
|
||||
|
||||
|
||||
@router.get("/all")
|
||||
async def list_all_os(client: VultrClient = Depends(get_client)):
|
||||
"""List all operating systems (auto-paginated)"""
|
||||
return {"os": client.os.list_all()}
|
||||
Reference in New Issue
Block a user