Allow labs to retirieve and update some host information in the api
[pharos-tools.git] / dashboard / src / api / urls.py
1 ##############################################################################
2 # Copyright (c) 2016 Max Breitenfeldt and others.
3 # Copyright (c) 2018 Sawyer Bergeron, Parker Berberian, and others
4 #
5 # All rights reserved. This program and the accompanying materials
6 # are made available under the terms of the Apache License, Version 2.0
7 # which accompanies this distribution, and is available at
8 # http://www.apache.org/licenses/LICENSE-2.0
9 ##############################################################################
10
11
12 """pharos_dashboard URL Configuration
13
14 The `urlpatterns` list routes URLs to views. For more information please see:
15     https://docs.djangoproject.com/en/1.10/topics/http/urls/
16 Examples:
17 Function views
18     1. Add an import:  from my_app import views
19     2. Add a URL to urlpatterns:  url(r'^$', views.home, name='home')
20 Class-based views
21     1. Add an import:  from other_app.views import Home
22     2. Add a URL to urlpatterns:  url(r'^$', Home.as_view(), name='home')
23 Including another URLconf
24     1. Import the include() function: from django.conf.urls import url, include
25     2. Add a URL to urlpatterns:  url(r'^blog/', include('blog.urls'))
26 """
27 from django.conf.urls import url, include
28 from django.urls import path
29 from rest_framework import routers
30
31 from api.views import (
32     BookingViewSet,
33     UserViewSet,
34     lab_profile,
35     lab_status,
36     lab_inventory,
37     specific_job,
38     specific_task,
39     new_jobs,
40     current_jobs,
41     done_jobs,
42     update_host_bmc,
43     lab_host,
44     GenerateTokenView
45 )
46
47 router = routers.DefaultRouter()
48 router.register(r'bookings', BookingViewSet)
49 router.register(r'user', UserViewSet)
50
51 urlpatterns = [
52     url(r'^', include(router.urls)),
53     path('labs/<slug:lab_name>/profile', lab_profile),
54     path('labs/<slug:lab_name>/status', lab_status),
55     path('labs/<slug:lab_name>/inventory', lab_inventory),
56     path('labs/<slug:lab_name>/hosts/<slug:host_id>', lab_host),
57     path('labs/<slug:lab_name>/hosts/<slug:host_id>/bmc', update_host_bmc),
58     path('labs/<slug:lab_name>/jobs/<int:job_id>', specific_job),
59     path('labs/<slug:lab_name>/jobs/<int:job_id>/<slug:task_id>', specific_task),
60     path('labs/<slug:lab_name>/jobs/new', new_jobs),
61     path('labs/<slug:lab_name>/jobs/current', current_jobs),
62     path('labs/<slug:lab_name>/jobs/done', done_jobs),
63     url(r'^token$', GenerateTokenView.as_view(), name='generate_token'),
64 ]