uncloud-mravi/uncloud/urls.py

69 lines
2.7 KiB
Python
Raw Normal View History

"""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/
"""
2021-09-10 07:58:42 +00:00
import environ
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
from rest_framework.schemas import get_schema_view
2020-02-20 17:58:07 +00:00
#from opennebula import views as oneviews
from uncloud_net import views as netviews
from uncloud_pay import views as payviews
from uncloud_vm import views as vmviews
import notifications.urls
2020-02-20 17:58:07 +00:00
router = routers.DefaultRouter()
2021-09-10 07:58:42 +00:00
env = environ.Env()
environ.Env.read_env()
# Beta endpoints
router.register(r'beta/vm', vmviews.NicoVMProductViewSet, basename='nicovmproduct')
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
2021-06-20 09:51:27 +00:00
# Payment related for a user
2021-01-01 12:25:52 +00:00
router.register(r'v2/payment/credit-card', payviews.CreditCardViewSet, basename='stripecreditcard')
2020-12-29 00:43:33 +00:00
router.register(r'v2/payment/payment', payviews.PaymentViewSet, basename='payment')
2021-01-01 11:41:54 +00:00
router.register(r'v2/payment/balance', payviews.BalanceViewSet, basename='payment-balance')
2021-01-17 14:53:30 +00:00
router.register(r'v2/payment/address', payviews.BillingAddressViewSet, basename='billingaddress')
router.register(r'v2/orders', payviews.OrderViewSet, basename='orders')
router.register(r'v2/bill', payviews.BillViewSet, basename='bills')
2020-12-13 12:28:43 +00:00
2021-06-20 09:51:27 +00:00
# Generic helper views that are usually not needed
router.register(r'v2/generic/vat-rate', payviews.VATRateViewSet, basename='vatrate')
urlpatterns = [
2020-12-28 22:35:34 +00:00
path(r'api/', include(router.urls), name='api'),
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"
), name='openapi-schema'),
2020-12-13 12:28:43 +00:00
2020-12-29 00:43:33 +00:00
path('admin/', admin.site.urls),
path('accounts/', include('allauth.urls')),
path('pricing/<slug:name>/calculate/', payviews.PricingView.as_view(), name='pricing_calculator'),
path('cc/reg/', payviews.RegisterCard.as_view(), name="cc_register"),
path('inbox/notifications/', include(notifications.urls, namespace='notifications')),
path('payments/', include('uncloud_pay.urls', namespace='payments')),
2021-09-10 07:58:42 +00:00
#
]
2021-09-10 07:58:42 +00:00
if env('ACTIVE_APP') == 'nextcloud':
urlpatterns.append(path('', include('nextcloud.urls', namespace='nextcloud')))
elif env('ACTIVE_APP') == 'matrixhosting':
urlpatterns.append(path('', include('matrixhosting.urls', namespace='matrix')))