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:
34
vultr_api/resources/os.py
Normal file
34
vultr_api/resources/os.py
Normal file
@@ -0,0 +1,34 @@
|
||||
"""
|
||||
OS Resource
|
||||
|
||||
Operating system listings
|
||||
"""
|
||||
|
||||
from typing import Dict, List
|
||||
from .base import BaseResource
|
||||
|
||||
|
||||
class OSResource(BaseResource):
|
||||
"""
|
||||
Operating system listings
|
||||
|
||||
Usage:
|
||||
# List all OS options
|
||||
os_list = client.os.list()
|
||||
"""
|
||||
|
||||
def list(self, per_page: int = 100, cursor: str = None) -> Dict:
|
||||
"""
|
||||
List available operating systems
|
||||
|
||||
Returns:
|
||||
Dict with 'os' list and 'meta' pagination
|
||||
"""
|
||||
params = {"per_page": per_page}
|
||||
if cursor:
|
||||
params["cursor"] = cursor
|
||||
return self.client.get("os", params=params)
|
||||
|
||||
def list_all(self) -> List[Dict]:
|
||||
"""List all operating systems (auto-paginate)"""
|
||||
return self.client.paginate("os", "os")
|
||||
Reference in New Issue
Block a user