mirror of https://gitee.com/anolis/sysom.git
37 lines
1.6 KiB
Python
37 lines
1.6 KiB
Python
from django.urls import path, re_path
|
|
from django.urls.conf import include
|
|
|
|
from rest_framework.routers import DefaultRouter
|
|
|
|
from apps.host import views
|
|
|
|
router = DefaultRouter()
|
|
router.register('host', views.HostModelViewSet)
|
|
router.register('cluster', views.ClusterViewSet)
|
|
|
|
urlpatterns = [
|
|
path('api/v1/host/upload_file/', views.SaveUploadFile.as_view()),
|
|
path('api/v1/host/batch_add/',
|
|
views.HostModelViewSet.as_view({'post': 'batch_add_host'})),
|
|
path('api/v1/host/batch_export/',
|
|
views.HostModelViewSet.as_view({'post': 'batch_export_host'})),
|
|
path('api/v1/host/batch_del/',
|
|
views.HostModelViewSet.as_view({'post': 'batch_del_host'})),
|
|
path('api/v1/host/metrics',
|
|
views.MetricsViewSet.as_view({'get': 'host_metrics'})),
|
|
path('api/v1/host/health_check/',
|
|
views.HostModelViewSet.as_view({'get': 'health_check'})),
|
|
re_path(r'^api/v1/host/ip/(?P<host_ip>.*)/$',
|
|
views.HostModelViewSet.as_view({'get': 'get_host'})),
|
|
re_path(r'^api/v1/host/del/(?P<host_ip>.*)/$',
|
|
views.HostModelViewSet.as_view({'delete': 'del_host'})),
|
|
re_path(r'^api/v1/host/update/(?P<host_ip>.*)/$',
|
|
views.HostModelViewSet.as_view({'patch': 'patch_host'})),
|
|
path('api/v1/cluster/batch_add/',
|
|
views.ClusterViewSet.as_view({'post': 'batch_add_cluster'})),
|
|
path('api/v1/cluster/batch_del/',
|
|
views.ClusterViewSet.as_view({'post': 'batch_del_cluster'})),
|
|
path('api/v1/host/scp/', views.HostModelViewSet.as_view({'post': 'scp_file'})),
|
|
path('api/v1/', include(router.urls)),
|
|
]
|