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:
HWANG BYUNGHA
2026-01-22 01:08:17 +09:00
commit 184054c6c1
48 changed files with 6058 additions and 0 deletions

20
server/deps.py Normal file
View File

@@ -0,0 +1,20 @@
"""Dependencies for FastAPI"""
import os
from fastapi import HTTPException, Security
from fastapi.security import APIKeyHeader
from vultr_api import VultrClient
API_KEY_HEADER = APIKeyHeader(name="X-API-Key", auto_error=False)
VULTR_API_KEY = os.environ.get("VULTR_API_KEY")
def get_client(api_key: str = Security(API_KEY_HEADER)) -> VultrClient:
"""Get VultrClient instance with API key from header or environment"""
key = api_key or VULTR_API_KEY
if not key:
raise HTTPException(
status_code=401,
detail="API key required. Set X-API-Key header or VULTR_API_KEY env var"
)
return VultrClient(api_key=key)