1 6
from django.conf.urls import include, url
2 6
from rest_framework_simplejwt import views as jwt_views
3

4 6
from cyborgbackup.api.swagger import SwaggerSchemaView
5

6 6
from cyborgbackup.api.views import (
7
    UserList,
8
    UserDetail,
9
    ClientList,
10
    ClientDetail,
11
    ScheduleList,
12
    ScheduleDetail,
13
    RepositoryList,
14
    RepositoryDetail,
15
    CatalogList,
16
    CatalogDetail,
17
    PolicyList,
18
    PolicyDetail,
19
    PolicyLaunch,
20
    PolicyCalendar,
21
    PolicyModule,
22
    PolicyVMModule,
23
    Stats,
24
    JobEventList,
25
    JobEventDetail,
26
    JobList,
27
    JobDetail,
28
    JobStart,
29
    JobCancel,
30
    JobRelaunch,
31
    JobJobEventsList,
32
    JobStdout,
33
    SettingList,
34
    SettingDetail,
35
    ApiRootView,
36
    ApiV1RootView,
37
    ApiV1PingView,
38
    ApiV1ConfigView,
39
    AuthView,
40
    UserMeList,
41
    CyborgTokenObtainPairView,
42
    RestoreLaunch
43
)
44

45 6
from cyborgbackup.elasticsearch.views import ESCatalogViewSet
46

47 6
from cyborgbackup.api.generics import (
48
    LoggedLoginView,
49
    LoggedLogoutView,
50
)
51

52

53 6
user_urls = [
54
    url(r'^$', UserList.as_view(), name='user_list'),
55
    url(r'^(?P<pk>[0-9]+)/$', UserDetail.as_view(), name='user_detail'),
56
]
57

58 6
client_urls = [
59
    url(r'^$', ClientList.as_view(), name='client_list'),
60
    url(r'^(?P<pk>[0-9]+)/$', ClientDetail.as_view(), name='client_detail'),
61
]
62

63 6
schedule_urls = [
64
    url(r'^$', ScheduleList.as_view(), name='schedule_list'),
65
    url(r'^(?P<pk>[0-9]+)/$', ScheduleDetail.as_view(), name='schedule_detail'),
66
]
67

68 6
repository_urls = [
69
    url(r'^$', RepositoryList.as_view(), name='repository_list'),
70
    url(r'^(?P<pk>[0-9]+)/$', RepositoryDetail.as_view(), name='repository_detail'),
71
]
72

73 6
catalog_urls = [
74
    url(r'^$', CatalogList.as_view(), name='catalog_list'),
75
    url(r'^(?P<pk>[0-9]+)/$', CatalogDetail.as_view(), name='catalog_detail'),
76
]
77

78 6
policy_urls = [
79
    url(r'^$', PolicyList.as_view(), name='policy_list'),
80
    url(r'^(?P<pk>[0-9]+)/$', PolicyDetail.as_view(), name='policy_detail'),
81
    url(r'^(?P<pk>[0-9]+)/launch/$', PolicyLaunch.as_view(), name='policy_launch'),
82
    url(r'^(?P<pk>[0-9]+)/calendar/$', PolicyCalendar.as_view(), name='policy_calendar'),
83
    url(r'^vmmodule/$', PolicyVMModule.as_view(), name='policy_vmmodule'),
84
    url(r'^module/(?P<module>[\w-]+)/(?P<client>[0-9]+)/$', PolicyModule.as_view(), name='policy_module'),
85
]
86

87 6
stats_urls = [
88
    url(r'^$', Stats.as_view(), name='stats'),
89
]
90

91 6
job_events_urls = [
92
    url(r'^$', JobEventList.as_view(), name='job_event_list'),
93
    url(r'^(?P<pk>[0-9]+)/$', JobEventDetail.as_view(), name='job_event_detail'),
94
]
95

96 6
job_urls = [
97
    url(r'^$', JobList.as_view(), name='job_list'),
98
    url(r'^(?P<pk>[0-9]+)/$', JobDetail.as_view(), name='job_detail'),
99
    url(r'^(?P<pk>[0-9]+)/start/$', JobStart.as_view(), name='job_start'),
100
    url(r'^(?P<pk>[0-9]+)/cancel/$', JobCancel.as_view(), name='job_cancel'),
101
    url(r'^(?P<pk>[0-9]+)/relaunch/$', JobRelaunch.as_view(), name='job_relaunch'),
102
    url(r'^(?P<pk>[0-9]+)/job_events/$', JobJobEventsList.as_view(), name='job_job_events_list'),
103
    url(r'^(?P<pk>[0-9]+)/stdout/$', JobStdout.as_view(), name='job_stdout'),
104
]
105

106 6
setting_urls = [
107
    url(r'^$', SettingList.as_view(), name='setting_list'),
108
    url(r'^(?P<pk>[0-9]+)/$', SettingDetail.as_view(), name='setting_detail'),
109
]
110

111 6
restore_urls = [
112
    url(r'^$', RestoreLaunch.as_view(), name='restore_launch'),
113
]
114

115 6
app_name = 'api'
116

117 6
v1_urls = [
118
    url(r'^$', ApiV1RootView.as_view(), name='api_v1_root_view'),
119
    url(r'^ping/$', ApiV1PingView.as_view(), name='api_v1_ping_view'),
120
    url(r'^config/$', ApiV1ConfigView.as_view(), name='api_v1_config_view'),
121
    url(r'^auth/$', AuthView.as_view(), name="auth"),
122
    url(r'^me/$', UserMeList.as_view(), name='user_me_list'),
123
    url(r'^users/', include(user_urls)),
124
    url(r'^jobs/', include(job_urls)),
125
    url(r'^job_events/', include(job_events_urls)),
126
    url(r'^settings/', include(setting_urls)),
127
    url(r'^clients/', include(client_urls)),
128
    url(r'^schedules/', include(schedule_urls)),
129
    url(r'^repositories/', include(repository_urls)),
130
    url(r'^policies/', include(policy_urls)),
131
    url(r'^restore/', include(restore_urls)),
132
    url(r'^catalogs/', include(catalog_urls)),
133
    url(r'^stats/', include(stats_urls)),
134
    url(r'^escatalogs/', ESCatalogViewSet.as_view({'get': 'list'}), name='escatalog_list')
135
]
136

137 6
urlpatterns = [
138
    url(r'^$', ApiRootView.as_view(), name='api_root_view'),
139
    url(r'^(?P<version>(v1))/', include(v1_urls)),
140
    url(r'^token/obtain/$', CyborgTokenObtainPairView.as_view(), name='token_create'),  # override sjwt stock token
141
    url(r'^token/refresh/$', jwt_views.TokenRefreshView.as_view(), name='token_refresh'),
142
    url(r'^password_reset/', include('django_rest_passwordreset.urls', namespace='password_reset')),
143
    url(r'^login/$', LoggedLoginView.as_view(
144
        template_name='rest_framework/login.html',
145
        extra_context={'inside_login_context': True}
146
    ), name='login'),
147
    url(r'^logout/$', LoggedLogoutView.as_view(
148
        next_page='/api/', redirect_field_name='next'
149
    ), name='logout'),
150
    url(r'^swagger/$', SwaggerSchemaView.as_view(), name='swagger_view'),
151
]

Read our documentation on viewing source code .

Loading