2016-11-16 10:12:14 +00:00
|
|
|
#!/usr/bin/env python
|
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
#
|
|
|
|
|
2019-08-31 04:07:03 +00:00
|
|
|
from django.urls import path, include, re_path
|
2018-09-07 04:40:26 +00:00
|
|
|
from rest_framework_bulk.routes import BulkRouter
|
2016-11-16 10:12:14 +00:00
|
|
|
|
2019-08-31 04:07:03 +00:00
|
|
|
from common import api as capi
|
2019-03-18 03:34:13 +00:00
|
|
|
from .. import api
|
2016-11-16 10:12:14 +00:00
|
|
|
|
2017-12-01 09:28:47 +00:00
|
|
|
app_name = 'terminal'
|
2016-11-16 10:12:14 +00:00
|
|
|
|
2018-09-07 04:40:26 +00:00
|
|
|
router = BulkRouter()
|
|
|
|
router.register(r'sessions', api.SessionViewSet, 'session')
|
2019-08-31 04:07:03 +00:00
|
|
|
router.register(r'terminals/(?P<terminal>[a-zA-Z0-9\-]{36})?/?status', api.StatusViewSet, 'terminal-status')
|
|
|
|
router.register(r'terminals/(?P<terminal>[a-zA-Z0-9\-]{36})?/?sessions', api.SessionViewSet, 'terminal-sessions')
|
|
|
|
router.register(r'terminals', api.TerminalViewSet, 'terminal')
|
2018-07-13 16:47:21 +00:00
|
|
|
router.register(r'tasks', api.TaskViewSet, 'tasks')
|
2019-08-31 04:07:03 +00:00
|
|
|
router.register(r'commands', api.CommandViewSet, 'command')
|
2018-09-07 04:40:26 +00:00
|
|
|
router.register(r'status', api.StatusViewSet, 'status')
|
2016-11-16 10:12:14 +00:00
|
|
|
|
2016-12-25 09:44:39 +00:00
|
|
|
urlpatterns = [
|
2018-07-27 10:56:40 +00:00
|
|
|
path('sessions/<uuid:pk>/replay/',
|
2018-11-23 02:25:35 +00:00
|
|
|
api.SessionReplayViewSet.as_view({'get': 'retrieve', 'post': 'create'}),
|
2018-07-27 10:56:40 +00:00
|
|
|
name='session-replay'),
|
|
|
|
path('tasks/kill-session/', api.KillSessionAPI.as_view(), name='kill-session'),
|
2019-08-31 04:07:03 +00:00
|
|
|
path('terminals/<uuid:terminal>/access-key/', api.TerminalTokenApi.as_view(),
|
2018-07-27 10:56:40 +00:00
|
|
|
name='terminal-access-key'),
|
2019-08-31 04:07:03 +00:00
|
|
|
path('terminals/config/', api.TerminalConfig.as_view(), name='terminal-config'),
|
2019-07-03 10:03:01 +00:00
|
|
|
path('commands/export/', api.CommandExportApi.as_view(), name="command-export")
|
2018-04-24 00:23:34 +00:00
|
|
|
# v2: get session's replay
|
2018-07-27 10:56:40 +00:00
|
|
|
# path('v2/sessions/<uuid:pk>/replay/',
|
2018-07-25 09:21:13 +00:00
|
|
|
# api.SessionReplayV2ViewSet.as_view({'get': 'retrieve'}),
|
|
|
|
# name='session-replay-v2'),
|
2016-12-25 09:44:39 +00:00
|
|
|
]
|
2016-11-16 10:12:14 +00:00
|
|
|
|
2019-08-31 04:07:03 +00:00
|
|
|
old_version_urlpatterns = [
|
|
|
|
re_path('(?P<resource>terminal|command)/.*', capi.redirect_plural_name_api)
|
|
|
|
]
|
|
|
|
|
|
|
|
urlpatterns += router.urls + old_version_urlpatterns
|
2018-11-23 02:25:35 +00:00
|
|
|
|
|
|
|
|
|
|
|
|