2020-02-20 15:52:50 +00:00
|
|
|
"""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/
|
|
|
|
"""
|
2020-04-03 16:41:17 +00:00
|
|
|
|
2020-02-20 15:52:50 +00:00
|
|
|
from django.contrib import admin
|
2020-02-20 17:58:07 +00:00
|
|
|
from django.urls import path, include
|
2020-04-03 16:41:17 +00:00
|
|
|
from django.conf import settings
|
|
|
|
from django.conf.urls.static import static
|
|
|
|
|
2020-02-20 17:58:07 +00:00
|
|
|
from rest_framework import routers
|
2020-04-12 20:55:22 +00:00
|
|
|
from rest_framework.schemas import get_schema_view
|
2020-02-20 17:58:07 +00:00
|
|
|
|
2020-09-28 18:59:08 +00:00
|
|
|
#from opennebula import views as oneviews
|
2020-12-25 09:31:42 +00:00
|
|
|
from uncloud import views as uncloudviews
|
2020-03-18 13:36:40 +00:00
|
|
|
from uncloud_auth import views as authviews
|
2020-04-03 17:27:49 +00:00
|
|
|
from uncloud_net import views as netviews
|
|
|
|
from uncloud_pay import views as payviews
|
|
|
|
from uncloud_vm import views as vmviews
|
2020-04-13 09:39:49 +00:00
|
|
|
from uncloud_service import views as serviceviews
|
2020-02-21 15:33:37 +00:00
|
|
|
|
2020-02-20 17:58:07 +00:00
|
|
|
router = routers.DefaultRouter()
|
2020-02-26 10:31:17 +00:00
|
|
|
|
2020-05-02 17:15:48 +00:00
|
|
|
# Beta endpoints
|
|
|
|
router.register(r'beta/vm', vmviews.NicoVMProductViewSet, basename='nicovmproduct')
|
|
|
|
|
2020-02-28 13:46:33 +00:00
|
|
|
# VM
|
2020-05-02 18:31:36 +00:00
|
|
|
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')
|
2020-02-26 10:31:17 +00:00
|
|
|
|
2020-05-02 17:15:48 +00:00
|
|
|
|
2020-03-02 06:17:04 +00:00
|
|
|
# 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')
|
|
|
|
|
2020-02-28 13:46:33 +00:00
|
|
|
# Services
|
2020-05-02 18:31:36 +00:00
|
|
|
router.register(r'v1/service/matrix', serviceviews.MatrixServiceProductViewSet, basename='matrixserviceproduct')
|
|
|
|
router.register(r'v1/service/generic', serviceviews.GenericServiceProductViewSet, basename='genericserviceproduct')
|
2020-04-17 08:08:33 +00:00
|
|
|
|
2020-02-28 13:46:33 +00:00
|
|
|
|
2020-03-03 10:23:29 +00:00
|
|
|
|
2020-03-02 06:17:04 +00:00
|
|
|
# Pay
|
2020-05-23 19:32:56 +00:00
|
|
|
router.register(r'v1/my/address', payviews.BillingAddressViewSet, basename='billingaddress')
|
2020-05-02 18:31:36 +00:00
|
|
|
router.register(r'v1/my/bill', payviews.BillViewSet, basename='bill')
|
|
|
|
router.register(r'v1/my/order', payviews.OrderViewSet, basename='order')
|
2020-12-29 00:43:33 +00:00
|
|
|
#router.register(r'v1/my/payment', payviews.PaymentViewSet, basename='payment')
|
2020-05-02 18:31:36 +00:00
|
|
|
router.register(r'v1/my/payment-method', payviews.PaymentMethodViewSet, basename='payment-method')
|
2020-02-27 10:59:28 +00:00
|
|
|
|
2020-02-26 10:31:17 +00:00
|
|
|
# admin/staff urls
|
2020-05-02 18:31:36 +00:00
|
|
|
router.register(r'v1/admin/bill', payviews.AdminBillViewSet, basename='admin/bill')
|
2020-12-29 00:43:33 +00:00
|
|
|
#router.register(r'v1/admin/payment', payviews.AdminPaymentViewSet, basename='admin/payment')
|
2020-05-02 18:31:36 +00:00
|
|
|
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)
|
2020-12-13 10:38:41 +00:00
|
|
|
#router.register(r'v1/admin/vpnpool', netviews.VPNPoolViewSet)
|
2020-09-28 18:59:08 +00:00
|
|
|
#router.register(r'v1/admin/opennebula', oneviews.VMViewSet, basename='opennebula')
|
2020-02-26 10:31:17 +00:00
|
|
|
|
2020-03-18 13:36:40 +00:00
|
|
|
# User/Account
|
2020-05-02 18:31:36 +00:00
|
|
|
router.register(r'v1/my/user', authviews.UserViewSet, basename='user')
|
|
|
|
router.register(r'v1/admin/user', authviews.AdminUserViewSet, basename='useradmin')
|
2020-11-14 09:50:43 +00:00
|
|
|
router.register(r'v1/user/register', authviews.AccountManagementViewSet, basename='user/register')
|
2020-02-20 17:58:07 +00:00
|
|
|
|
2020-12-13 12:28:43 +00:00
|
|
|
|
|
|
|
################################################################################
|
|
|
|
# v2
|
|
|
|
|
|
|
|
# Net
|
|
|
|
router.register(r'v2/net/wireguardvpn', netviews.WireGuardVPNViewSet, basename='wireguardvpnnetwork')
|
2020-12-20 20:45:47 +00:00
|
|
|
router.register(r'v2/net/wireguardvpnsizes', netviews.WireGuardVPNSizes, basename='wireguardvpnnetworksizes')
|
2020-12-13 12:28:43 +00:00
|
|
|
|
2020-12-28 22:35:34 +00:00
|
|
|
# Payment related
|
|
|
|
router.register(r'v2/payment/credit-card', payviews.CreditCardViewSet, basename='credit-card')
|
2020-12-29 00:43:33 +00:00
|
|
|
router.register(r'v2/payment/payment', payviews.PaymentViewSet, basename='payment')
|
2020-12-13 12:28:43 +00:00
|
|
|
|
|
|
|
|
2020-02-20 15:52:50 +00:00
|
|
|
urlpatterns = [
|
2020-12-28 22:35:34 +00:00
|
|
|
path(r'api/', include(router.urls), name='api'),
|
2020-04-03 17:27:49 +00:00
|
|
|
|
2020-04-12 20:55:22 +00:00
|
|
|
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",
|
2020-12-29 00:43:33 +00:00
|
|
|
version="2.0.0"
|
2020-04-12 20:55:22 +00:00
|
|
|
), name='openapi-schema'),
|
2020-12-13 12:28:43 +00:00
|
|
|
|
2020-12-29 00:43:33 +00:00
|
|
|
path('admin/', admin.site.urls),
|
2020-12-25 16:29:17 +00:00
|
|
|
|
2020-12-09 19:22:33 +00:00
|
|
|
path('login/', authviews.LoginView.as_view(), name="login"),
|
|
|
|
path('logout/', authviews.LogoutView.as_view(), name="logout"),
|
2020-12-25 09:31:42 +00:00
|
|
|
path('cc/reg/', payviews.RegisterCard.as_view(), name="cc_register"),
|
2020-12-26 10:22:51 +00:00
|
|
|
|
2020-12-25 09:31:42 +00:00
|
|
|
path('', uncloudviews.UncloudIndex.as_view(), name="uncloudindex"),
|
2020-02-20 15:52:50 +00:00
|
|
|
]
|