Make API endpoints compatible with Vultr API v2 format
- Change auth from X-API-Key header to Authorization: Bearer format - Add /v2 prefix to all endpoints to match Vultr API URL structure - Fix router paths (dns, firewall) to avoid duplicate path segments - Split VPC 2.0 into separate router at /v2/vpc2 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -8,7 +8,7 @@ from contextlib import asynccontextmanager
|
||||
from routers import (
|
||||
account, instances, dns, firewall, ssh_keys,
|
||||
startup_scripts, snapshots, block_storage, reserved_ips,
|
||||
vpc, load_balancers, bare_metal, backups, plans, regions, os_api
|
||||
vpc, vpc2, load_balancers, bare_metal, backups, plans, regions, os_api
|
||||
)
|
||||
|
||||
|
||||
@@ -27,23 +27,24 @@ app = FastAPI(
|
||||
lifespan=lifespan,
|
||||
)
|
||||
|
||||
# Include routers
|
||||
app.include_router(account.router, prefix="/account", tags=["Account"])
|
||||
app.include_router(instances.router, prefix="/instances", tags=["Instances"])
|
||||
app.include_router(dns.router, prefix="/dns", tags=["DNS"])
|
||||
app.include_router(firewall.router, prefix="/firewall", tags=["Firewall"])
|
||||
app.include_router(ssh_keys.router, prefix="/ssh-keys", tags=["SSH Keys"])
|
||||
app.include_router(startup_scripts.router, prefix="/startup-scripts", tags=["Startup Scripts"])
|
||||
app.include_router(snapshots.router, prefix="/snapshots", tags=["Snapshots"])
|
||||
app.include_router(block_storage.router, prefix="/block-storage", tags=["Block Storage"])
|
||||
app.include_router(reserved_ips.router, prefix="/reserved-ips", tags=["Reserved IPs"])
|
||||
app.include_router(vpc.router, prefix="/vpc", tags=["VPC"])
|
||||
app.include_router(load_balancers.router, prefix="/load-balancers", tags=["Load Balancers"])
|
||||
app.include_router(bare_metal.router, prefix="/bare-metal", tags=["Bare Metal"])
|
||||
app.include_router(backups.router, prefix="/backups", tags=["Backups"])
|
||||
app.include_router(plans.router, prefix="/plans", tags=["Plans"])
|
||||
app.include_router(regions.router, prefix="/regions", tags=["Regions"])
|
||||
app.include_router(os_api.router, prefix="/os", tags=["Operating Systems"])
|
||||
# Include routers with /v2 prefix to match Vultr API
|
||||
app.include_router(account.router, prefix="/v2/account", tags=["Account"])
|
||||
app.include_router(instances.router, prefix="/v2/instances", tags=["Instances"])
|
||||
app.include_router(dns.router, prefix="/v2/domains", tags=["DNS"])
|
||||
app.include_router(firewall.router, prefix="/v2/firewalls", tags=["Firewall"])
|
||||
app.include_router(ssh_keys.router, prefix="/v2/ssh-keys", tags=["SSH Keys"])
|
||||
app.include_router(startup_scripts.router, prefix="/v2/startup-scripts", tags=["Startup Scripts"])
|
||||
app.include_router(snapshots.router, prefix="/v2/snapshots", tags=["Snapshots"])
|
||||
app.include_router(block_storage.router, prefix="/v2/blocks", tags=["Block Storage"])
|
||||
app.include_router(reserved_ips.router, prefix="/v2/reserved-ips", tags=["Reserved IPs"])
|
||||
app.include_router(vpc.router, prefix="/v2/vpcs", tags=["VPC"])
|
||||
app.include_router(vpc2.router, prefix="/v2/vpc2", tags=["VPC 2.0"])
|
||||
app.include_router(load_balancers.router, prefix="/v2/load-balancers", tags=["Load Balancers"])
|
||||
app.include_router(bare_metal.router, prefix="/v2/bare-metals", tags=["Bare Metal"])
|
||||
app.include_router(backups.router, prefix="/v2/backups", tags=["Backups"])
|
||||
app.include_router(plans.router, prefix="/v2/plans", tags=["Plans"])
|
||||
app.include_router(regions.router, prefix="/v2/regions", tags=["Regions"])
|
||||
app.include_router(os_api.router, prefix="/v2/os", tags=["Operating Systems"])
|
||||
|
||||
|
||||
@app.get("/", tags=["Health"])
|
||||
|
||||
Reference in New Issue
Block a user