forked from uncloud/uncloud
90 lines
3.7 KiB
Python
90 lines
3.7 KiB
Python
"""uncloud URL Configuration
|
|
|
|
The `urlpatterns` list routes URLs to views. For more information please see:
|
|
https://docs.djangoproject.com/en/3.0/topics/http/urls/
|
|
Examples:
|
|
Function views
|
|
1. Add an import: from my_app import views
|
|
2. Add a URL to urlpatterns: path('', views.home, name='home')
|
|
Class-based views
|
|
1. Add an import: from other_app.views import Home
|
|
2. Add a URL to urlpatterns: path('', Home.as_view(), name='home')
|
|
Including another URLconf
|
|
1. Import the include() function: from django.urls import include, path
|
|
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
|
|
"""
|
|
|
|
from django.contrib import admin
|
|
from django.urls import path, include
|
|
from django.conf import settings
|
|
from django.conf.urls.static import static
|
|
|
|
from rest_framework import routers
|
|
from rest_framework.schemas import get_schema_view
|
|
|
|
from opennebula import views as oneviews
|
|
from uncloud_auth import views as authviews
|
|
from uncloud_net import views as netviews
|
|
from uncloud_pay import views as payviews
|
|
from uncloud_vm import views as vmviews
|
|
from uncloud_service import views as serviceviews
|
|
|
|
router = routers.DefaultRouter()
|
|
|
|
# Beta endpoints
|
|
router.register(r'beta/vm', vmviews.NicoVMProductViewSet, basename='nicovmproduct')
|
|
|
|
# VM
|
|
router.register(r'v1/vm/snapshot', vmviews.VMSnapshotProductViewSet, basename='vmsnapshotproduct')
|
|
router.register(r'v1/vm/diskimage', vmviews.VMDiskImageProductViewSet, basename='vmdiskimageproduct')
|
|
router.register(r'v1/vm/disk', vmviews.VMDiskProductViewSet, basename='vmdiskproduct')
|
|
router.register(r'v1/vm/vm', vmviews.VMProductViewSet, basename='vmproduct')
|
|
|
|
|
|
# creates VM from os image
|
|
#router.register(r'vm/ipv6onlyvm', vmviews.VMProductViewSet, basename='vmproduct')
|
|
# ... AND adds IPv4 mapping
|
|
#router.register(r'vm/dualstackvm', vmviews.VMProductViewSet, basename='vmproduct')
|
|
|
|
# Services
|
|
router.register(r'v1/service/matrix', serviceviews.MatrixServiceProductViewSet, basename='matrixserviceproduct')
|
|
router.register(r'v1/service/generic', serviceviews.GenericServiceProductViewSet, basename='genericserviceproduct')
|
|
|
|
|
|
# Net
|
|
router.register(r'v1/net/vpn', netviews.VPNNetworkViewSet, basename='vpnnet')
|
|
router.register(r'v1/admin/vpnreservation', netviews.VPNNetworkReservationViewSet, basename='vpnnetreservation')
|
|
|
|
|
|
# Pay
|
|
router.register(r'v1/my/address', payviews.BillingAddressViewSet, basename='address')
|
|
router.register(r'v1/my/bill', payviews.BillViewSet, basename='bill')
|
|
router.register(r'v1/my/order', payviews.OrderViewSet, basename='order')
|
|
router.register(r'v1/my/payment', payviews.PaymentViewSet, basename='payment')
|
|
router.register(r'v1/my/payment-method', payviews.PaymentMethodViewSet, basename='payment-method')
|
|
|
|
|
|
# admin/staff urls
|
|
router.register(r'v1/admin/bill', payviews.AdminBillViewSet, basename='admin/bill')
|
|
router.register(r'v1/admin/payment', payviews.AdminPaymentViewSet, basename='admin/payment')
|
|
router.register(r'v1/admin/order', payviews.AdminOrderViewSet, basename='admin/order')
|
|
router.register(r'v1/admin/vmhost', vmviews.VMHostViewSet)
|
|
router.register(r'v1/admin/vmcluster', vmviews.VMClusterViewSet)
|
|
router.register(r'v1/admin/vpnpool', netviews.VPNPoolViewSet)
|
|
router.register(r'v1/admin/opennebula', oneviews.VMViewSet, basename='opennebula')
|
|
|
|
# User/Account
|
|
router.register(r'v1/my/user', authviews.UserViewSet, basename='user')
|
|
router.register(r'v1/admin/user', authviews.AdminUserViewSet, basename='useradmin')
|
|
|
|
urlpatterns = [
|
|
path('', include(router.urls)),
|
|
# web/ = stuff to view in the browser
|
|
|
|
path('api-auth/', include('rest_framework.urls', namespace='rest_framework')), # for login to REST API
|
|
path('openapi', get_schema_view(
|
|
title="uncloud",
|
|
description="uncloud API",
|
|
version="1.0.0"
|
|
), name='openapi-schema'),
|
|
]
|