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

View File

@@ -0,0 +1,53 @@
"""
Regions Resource
Available region listings
"""
from typing import Dict, List
from .base import BaseResource
class RegionsResource(BaseResource):
"""
Region listings
Usage:
# List all regions
regions = client.regions.list()
# List plans available in a region
plans = client.regions.list_availability("ewr")
"""
def list(self, per_page: int = 100, cursor: str = None) -> Dict:
"""
List all regions
Returns:
Dict with 'regions' list and 'meta' pagination
"""
params = {"per_page": per_page}
if cursor:
params["cursor"] = cursor
return self.client.get("regions", params=params)
def list_all(self) -> List[Dict]:
"""List all regions (auto-paginate)"""
return self.client.paginate("regions", "regions")
def list_availability(self, region_id: str, plan_type: str = None) -> Dict:
"""
List available plans in a region
Args:
region_id: Region ID (e.g., "ewr", "lax", "nrt")
plan_type: Filter by type ("vc2", "vhf", "vdc")
Returns:
Dict with 'available_plans' list
"""
params = {}
if plan_type:
params["type"] = plan_type
return self.client.get(f"regions/{region_id}/availability", params=params)