urls.py 16 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
# Copyright 2014 Budapest University of Technology and Economics (BME IK)
#
# This file is part of CIRCLE Cloud.
#
# CIRCLE is free software: you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free
# Software Foundation, either version 3 of the License, or (at your option)
# any later version.
#
# CIRCLE is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
# details.
#
# You should have received a copy of the GNU General Public License along
# with CIRCLE.  If not, see <http://www.gnu.org/licenses/>.

Kohl Krisztofer committed
18

19 20

from django.conf.urls import url
21
from django.urls import path
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55

from vm.models import Instance
from .views import (
    AclUpdateView, FavouriteView, GroupAclUpdateView, GroupDelete,
    GroupDetailView, GroupList, IndexView,
    InstanceActivityDetail, LeaseCreate, LeaseDelete, LeaseDetail,
    MyPreferencesView, NodeAddTraitView, NodeCreate, NodeDelete,
    NodeDetailView, NodeList, NodeActivityDetail,
    NotificationView, TemplateAclUpdateView, TemplateCreate,
    TemplateDelete, TemplateDetail, TemplateList,
    vm_activity, VmCreate, VmDetailView,
    VmDetailVncTokenView, VmList,
    DiskRemoveView, get_disk_download_status,
    GroupRemoveUserView,
    GroupRemoveFutureUserView,
    GroupRemoveAllUsersView,
    GroupCreate, GroupProfileUpdate,
    TemplateChoose,
    UserCreationView,
    get_vm_screenshot,
    ProfileView, toggle_use_gravatar, UnsubscribeFormView,
    UserKeyDelete, UserKeyDetail, UserKeyCreate,
    ConnectCommandDelete, ConnectCommandDetail, ConnectCommandCreate,
    StoreList, store_download, store_upload, store_get_upload_url, StoreRemove,
    store_new_directory, store_refresh_toplist,
    VmTraitsUpdate, VmRawDataUpdate,
    GroupPermissionsView,
    LeaseAclUpdateView,
    toggle_template_tutorial,
    ClientCheck, TokenLogin,
    VmGraphView, NodeGraphView, NodeListGraphView, TemplateGraphView,
    TransferInstanceOwnershipView, TransferInstanceOwnershipConfirmView,
    TransferTemplateOwnershipView, TransferTemplateOwnershipConfirmView,
    OpenSearchDescriptionView,
56
    NodeActivityView, 
57
    UserList, TemplateREST, LeaseREST, DiskRest, InstanceREST, 
58
    InterfaceREST, InstanceFromTemplateREST, InstanceFTforUsersREST,
59 60
    DownloadDiskREST, GetInstanceREST, GetInterfaceREST, ShutdownInstanceREST,
    GetLeaseREST, GetDiskRest, DeployInstanceREST, CreateDiskREST,
61
    VlanREST, ResizeDiskREST, GetVlanREST, DestroyDiskREST, InstanceFTforUsersIdREST,
62
    StorageDetail, DiskDetail, UserREST, GroupREST, CreateTemplateREST,
Karsa Zoltán István committed
63
    InstanceActivityREST, GetInstanceActivityREST, GetGroupREST, GetUserREST,
64
    SleepInstanceREST, WakeUpInstanceREST, DownloadPersistentDiskREST,
65
    CreatePersistentDiskREST, GetStorageActivityREST, GetTemplateREST,
66
    MessageList, MessageDetail, MessageCreate, MessageDelete,
Karsa Zoltán István committed
67
    SetupPortREST, RulesREST, InstanceBalancerTemplateREST,
68 69
    EnableTwoFactorView, DisableTwoFactorView,
    AclUserGroupAutocomplete, AclUserAutocomplete,
70
    RescheduleView, GroupImportView, GroupExportView,
71
    VariableREST, GetVariableREST, HotplugMemSetREST, HotplugVCPUSetREST
72
)
73
from .views.node import node_ops, NodeREST, GetNodeREST
74 75 76
from .views.vm import vm_ops, vm_mass_ops

urlpatterns = [
77 78 79
    path('acpi/stact/<int:pk>/', GetStorageActivityREST.as_view()),
    path('acpi/pddisk/', DownloadPersistentDiskREST.as_view()),
    path('acpi/pcdisk/', CreatePersistentDiskREST.as_view()),
80 81
    path('acpi/vmact/', InstanceActivityREST.as_view()),
    path('acpi/vmact/<int:pk>/', GetInstanceActivityREST.as_view()),
82
    path('acpi/user/', UserREST.as_view()),
Karsa Zoltán István committed
83
    path('acpi/user/<int:pk>/', GetUserREST.as_view()),
84
    path('acpi/group/', GroupREST.as_view()),
Karsa Zoltán István committed
85
    path('acpi/group/<int:pk>/', GetGroupREST.as_view()),
86
    path('acpi/vm/', InstanceREST.as_view()),
Karsa Zoltán István committed
87 88
    path('acpi/var/', VariableREST.as_view()),
    path('acpi/var/<int:pk>/', GetVariableREST.as_view(), name='variable-detail'),
89 90
    path('acpi/node/', NodeREST.as_view()),
    path('acpi/node/<int:pk>/', GetNodeREST.as_view()),
91
    path('acpi/vm/<int:pk>/', GetInstanceREST.as_view()),
92
    path('acpi/template/<int:pk>/', GetTemplateREST.as_view()),
93
    path('acpi/template/', TemplateREST.as_view()),
Karsa Zoltán István committed
94
    path('acpi/bvm/', InstanceBalancerTemplateREST.as_view()),
95
    path('acpi/ft/', InstanceFromTemplateREST.as_view()),
96
    path('acpi/lease/', LeaseREST.as_view()),
97
    path('acpi/lease/<int:pk>/', GetLeaseREST.as_view()),
98
    path('acpi/disk/', DiskRest.as_view()),
99
    path('acpi/disk/<int:pk>/', GetDiskRest.as_view()),
100
    path('acpi/interface/', InterfaceREST.as_view()),
101 102
    path('acpi/vlan/', VlanREST.as_view()),
    path('acpi/vlan/<int:pk>/', GetVlanREST.as_view()),
103
    path('acpi/interface/<int:pk>/', GetInterfaceREST.as_view()),
104
    path('acpi/ftusers/', InstanceFTforUsersREST.as_view()),
105
    path('acpi/ftusersid/', InstanceFTforUsersIdREST.as_view()),
Karsa Zoltán István committed
106 107
    path('acpi/vm/<int:pk>/hotplugmem/', HotplugMemSetREST.as_view()),
    path('acpi/vm/<int:pk>/hotplugvcpu/', HotplugVCPUSetREST.as_view()),
108
    path('acpi/vm/<int:pk>/downloaddisk/', DownloadDiskREST.as_view()),
109
    path('acpi/vm/<int:vm_id>/port/<int:vlan_id>/', SetupPortREST.as_view()),
110
    path('acpi/vm/<int:vm_id>/rules/<int:vlan_id>/', RulesREST.as_view()),
111 112 113
    path('acpi/vm/<int:pk>/createdisk/', CreateDiskREST.as_view()),
    path('acpi/vm/<int:pk>/deploy/', DeployInstanceREST.as_view()),
    path('acpi/vm/<int:pk>/shutdown/', ShutdownInstanceREST.as_view()),
114 115
    path('acpi/vm/<int:pk>/sleep/', SleepInstanceREST.as_view()),
    path('acpi/vm/<int:pk>/wakeup/', WakeUpInstanceREST.as_view()),
116
    path('acpi/vm/<int:pk>/resizedisk/', ResizeDiskREST.as_view()),
117
    path('acpi/vm/<int:pk>/destroydisk/', DestroyDiskREST.as_view()),
118
    path('acpi/vm/<int:pk>/saveastemplate/', CreateTemplateREST.as_view()),
119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170
    url(r'^$', IndexView.as_view(), name="dashboard.index"),
    url(r"^profile/list/$", UserList.as_view(),
        name="dashboard.views.user-list"),
    url(r'^profile/create/$',
        UserCreationView.as_view(),
        name="dashboard.views.user-create"),
    url(r'^lease/(?P<pk>\d+)/$', LeaseDetail.as_view(),
        name="dashboard.views.lease-detail"),
    url(r'^lease/create/$', LeaseCreate.as_view(),
        name="dashboard.views.lease-create"),
    url(r'^lease/delete/(?P<pk>\d+)/$', LeaseDelete.as_view(),
        name="dashboard.views.lease-delete"),
    url(r'^lease/(?P<pk>\d+)/acl/$', LeaseAclUpdateView.as_view(),
        name="dashboard.views.lease-acl"),

    url(r'^template/create/$', TemplateCreate.as_view(),
        name="dashboard.views.template-create"),
    url(r'^template/choose/$', TemplateChoose.as_view(),
        name="dashboard.views.template-choose"),
    url(r'template/(?P<pk>\d+)/acl/$', TemplateAclUpdateView.as_view(),
        name='dashboard.views.template-acl'),
    url(r'^template/(?P<pk>\d+)/$', TemplateDetail.as_view(),
        name='dashboard.views.template-detail'),
    url(r"^template/list/$", TemplateList.as_view(),
        name="dashboard.views.template-list"),
    url(r"^template/delete/(?P<pk>\d+)/$", TemplateDelete.as_view(),
        name="dashboard.views.template-delete"),
    url(r'^template/(?P<pk>\d+)/tx/$', TransferTemplateOwnershipView.as_view(),
        name='dashboard.views.template-transfer-ownership'),
    url(r'^vm/(?P<pk>\d+)/$', VmDetailView.as_view(),
        name='dashboard.views.detail'),
    url(r'^vm/(?P<pk>\d+)/vnctoken/$', VmDetailVncTokenView.as_view(),
        name='dashboard.views.detail-vnc'),
    url(r'^vm/(?P<pk>\d+)/acl/$', AclUpdateView.as_view(model=Instance),
        name='dashboard.views.vm-acl'),
    url(r'^vm/(?P<pk>\d+)/tx/$', TransferInstanceOwnershipView.as_view(),
        name='dashboard.views.vm-transfer-ownership'),
    url(r'^vm/list/$', VmList.as_view(), name='dashboard.views.vm-list'),
    url(r'^vm/create/$', VmCreate.as_view(),
        name='dashboard.views.vm-create'),
    url(r'^vm/(?P<pk>\d+)/activity/$', vm_activity,
        name='dashboard.views.vm-activity-list'),
    url(r'^vm/activity/(?P<pk>\d+)/$', InstanceActivityDetail.as_view(),
        name='dashboard.views.vm-activity'),
    url(r'^vm/(?P<pk>\d+)/screenshot/$', get_vm_screenshot,
        name='dashboard.views.vm-get-screenshot'),
    url(r'^vm/(?P<pk>\d+)/traits/$', VmTraitsUpdate.as_view(),
        name='dashboard.views.vm-traits'),
    url(r'^vm/(?P<pk>\d+)/raw_data/$', VmRawDataUpdate.as_view(),
        name='dashboard.views.vm-raw-data'),
    url(r'^vm/(?P<pk>\d+)/toggle_tutorial/$', toggle_template_tutorial,
        name='dashboard.views.vm-toggle-tutorial'),
171 172
    #url(r'^vm/(?P<pk>\d+)/cloud_init/$', CIDataUpdate.as_view(),
    #    name='dashboard.views.cloud-init'),
173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302
    url(r'^node/list/$', NodeList.as_view(), name='dashboard.views.node-list'),
    url(r'^node/(?P<pk>\d+)/$', NodeDetailView.as_view(),
        name='dashboard.views.node-detail'),
    url(r'^node/(?P<pk>\d+)/add-trait/$', NodeAddTraitView.as_view(),
        name='dashboard.views.node-addtrait'),
    url(r'^vm/tx/(?P<key>.*)/?$',
        TransferInstanceOwnershipConfirmView.as_view(),
        name='dashboard.views.vm-transfer-ownership-confirm'),
    url(r'^template/tx/(?P<key>.*)/?$',
        TransferTemplateOwnershipConfirmView.as_view(),
        name='dashboard.views.template-transfer-ownership-confirm'),
    url(r'^node/delete/(?P<pk>\d+)/$', NodeDelete.as_view(),
        name="dashboard.views.delete-node"),
    url(r'^node/(?P<pk>\d+)/activity/$', NodeActivityView.as_view(),
        name='dashboard.views.node-activity-list'),
    url(r'^node/create/$', NodeCreate.as_view(),
        name='dashboard.views.node-create'),
    url(r'^node/activity/(?P<pk>\d+)/$', NodeActivityDetail.as_view(),
        name='dashboard.views.node-activity'),

    url(r'^favourite/$', FavouriteView.as_view(),
        name='dashboard.views.favourite'),
    url(r'^group/delete/(?P<pk>\d+)/$', GroupDelete.as_view(),
        name="dashboard.views.delete-group"),
    url(r'^group/list/$', GroupList.as_view(),
        name='dashboard.views.group-list'),
    url((r'^vm/(?P<pk>\d+)/graph/(?P<metric>[a-z]+)/'
         r'(?P<time>[0-9]{1,2}[hdwy])$'),
        VmGraphView.as_view(),
        name='dashboard.views.vm-graph'),
    url((r'^node/(?P<pk>\d+)/graph/(?P<metric>[a-z]+)/'
         r'(?P<time>[0-9]{1,2}[hdwy])$'),
        NodeGraphView.as_view(),
        name='dashboard.views.node-graph'),
    url((r'^node/graph/(?P<metric>[a-z]+)/'
         r'(?P<time>[0-9]{1,2}[hdwy])$'),
        NodeListGraphView.as_view(),
        name='dashboard.views.node-list-graph'),
    url(r'^node/reschedule/$', RescheduleView.as_view(),
        name="dashboard.views.reschedule"),
    url((r'^template/(?P<pk>\d+)/graph/(?P<metric>[a-z]+)/'
         r'(?P<time>[0-9]{1,2}[hdwy])$'),
        TemplateGraphView.as_view(),
        name='dashboard.views.template-graph'),
    url(r'^group/(?P<pk>\d+)/$', GroupDetailView.as_view(),
        name='dashboard.views.group-detail'),
    url(r'^group/(?P<pk>\d+)/update/$', GroupProfileUpdate.as_view(),
        name='dashboard.views.group-update'),
    url(r'^group/(?P<pk>\d+)/acl/$', GroupAclUpdateView.as_view(),
        name='dashboard.views.group-acl'),
    url(r'^notifications/$', NotificationView.as_view(),
        name="dashboard.views.notifications"),

    url(r'^disk/(?P<pk>\d+)/remove/$', DiskRemoveView.as_view(),
        name="dashboard.views.disk-remove"),
    url(r'^disk/(?P<pk>\d+)/status/$', get_disk_download_status,
        name="dashboard.views.disk-status"),

    url(r'^profile/$', MyPreferencesView.as_view(),
        name="dashboard.views.profile-preferences"),
    url(r'^subscribe/(?P<token>.*)/$', UnsubscribeFormView.as_view(),
        name="dashboard.views.unsubscribe"),
    url(r'^profile/(?P<username>[^/]+)/$', ProfileView.as_view(),
        name="dashboard.views.profile"),
    url(r'^profile/(?P<username>[^/]+)/use_gravatar/$', toggle_use_gravatar),
    url(r'^profile/two-factor/enable/$', EnableTwoFactorView.as_view(),
        name="dashboard.views.profile-enable-two-factor"),
    url(r'^profile/two-factor/disable/$', DisableTwoFactorView.as_view(),
        name="dashboard.views.profile-disable-two-factor"),

    url(r'^group/(?P<group_pk>\d+)/remove/user/(?P<member_pk>\d+)/$',
        GroupRemoveUserView.as_view(),
        name="dashboard.views.remove-user"),
    url(r'^group/(?P<group_pk>\d+)/remove/futureuser/(?P<member_org_id>.+)/$',
        GroupRemoveFutureUserView.as_view(),
        name="dashboard.views.remove-future-user"),
    url(r'^group/(?P<group_pk>\d+)/remove/user/all/$',
        GroupRemoveAllUsersView.as_view(),
        name="dashboard.views.remove-all-users"),
    url(r'^group/create/$', GroupCreate.as_view(),
        name='dashboard.views.group-create'),
    url(r'^group/import/$', GroupImportView.as_view(),
        name="dashboard.views.group-import"),
    url(r'^group/(?P<group_pk>\d+)/export/$',
        GroupExportView.as_view(),
        name="dashboard.views.group-export"),
    url(r'^group/(?P<group_pk>\d+)/permissions/$',
        GroupPermissionsView.as_view(),
        name="dashboard.views.group-permissions"),

    url(r'^sshkey/delete/(?P<pk>\d+)/$',
        UserKeyDelete.as_view(),
        name="dashboard.views.userkey-delete"),
    url(r'^sshkey/(?P<pk>\d+)/$',
        UserKeyDetail.as_view(),
        name="dashboard.views.userkey-detail"),
    url(r'^sshkey/create/$',
        UserKeyCreate.as_view(),
        name="dashboard.views.userkey-create"),

    url(r'^conncmd/delete/(?P<pk>\d+)/$',
        ConnectCommandDelete.as_view(),
        name="dashboard.views.connect-command-delete"),
    url(r'^conncmd/(?P<pk>\d+)/$',
        ConnectCommandDetail.as_view(),
        name="dashboard.views.connect-command-detail"),
    url(r'^conncmd/create/$',
        ConnectCommandCreate.as_view(),
        name="dashboard.views.connect-command-create"),

    url(r"^store/list/$", StoreList.as_view(),
        name="dashboard.views.store-list"),
    url(r"^store/download/$", store_download,
        name="dashboard.views.store-download"),
    url(r"^store/upload/url$", store_get_upload_url,
        name="dashboard.views.store-upload-url"),
    url(r"^store/upload/$", store_upload,
        name="dashboard.views.store-upload"),
    url(r"^store/remove/$", StoreRemove.as_view(),
        name="dashboard.views.store-remove"),
    url(r"^store/new_directory/$", store_new_directory,
        name="dashboard.views.store-new-directory"),
    url(r"^store/refresh_toplist$", store_refresh_toplist,
        name="dashboard.views.store-refresh-toplist"),
    url(r"^client/check$", ClientCheck.as_view(),
        name="dashboard.views.client-check"),
    url(r'^token-login/(?P<token>.*)/$', TokenLogin.as_view(),
        name="dashboard.views.token-login"),
    url(r'^vm/opensearch.xml$', OpenSearchDescriptionView.as_view(),
        name="dashboard.views.vm-opensearch"),
Karsa Zoltán István committed
303
    url(r'^storage/(?P<name>[^/]+)/$', StorageDetail.as_view(),
304
        name="dashboard.views.storage.name"),
Karsa Zoltán István committed
305
    url(r'^storage/', StorageDetail.as_view(),
306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328
        name="dashboard.views.storage"),
    url(r'^disk/(?P<pk>\d+)/$', DiskDetail.as_view(),
        name="dashboard.views.disk-detail"),

    url(r'^message/list/$', MessageList.as_view(),
        name="dashboard.views.message-list"),
    url(r'^message/(?P<pk>\d+)/$', MessageDetail.as_view(),
        name="dashboard.views.message-detail"),
    url(r'^message/create/$', MessageCreate.as_view(),
        name="dashboard.views.message-create"),
    url(r'^message/delete/(?P<pk>\d+)/$', MessageDelete.as_view(),
        name="dashboard.views.message-delete"),

    url(r'^autocomplete/acl/user-group/$',
        AclUserGroupAutocomplete.as_view(),
        name='autocomplete.acl.user-group'),
    url(r'^autocomplete/acl/user/$',
        AclUserAutocomplete.as_view(),
        name='autocomplete.acl.user'),
]

urlpatterns += [
    url(r'^vm/(?P<pk>\d+)/op/%s/$' % op, v.as_view(), name=v.get_urlname())
Kohl Krisztofer committed
329
    for op, v in list(vm_ops.items())
330 331 332 333
]

urlpatterns += [
    url(r'^vm/mass_op/%s/$' % op, v.as_view(), name=v.get_urlname())
Kohl Krisztofer committed
334
    for op, v in list(vm_mass_ops.items())
335 336 337 338
]

urlpatterns += [
    url(r'^node/(?P<pk>\d+)/op/%s/$' % op, v.as_view(), name=v.get_urlname())
Kohl Krisztofer committed
339
    for op, v in list(node_ops.items())
340
]