2013-03-24 02:43:11 +04:00
# (c) 2013, AnsibleWorks
#
# This file is part of Ansible Commander
#
# Ansible Commander 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.
#
# Ansible Commander 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 Ansible Commander. If not, see <http://www.gnu.org/licenses/>.
2013-03-14 01:15:00 +04:00
from django . conf import settings
from django . conf . urls import *
2013-03-20 06:26:35 +04:00
import lib . main . views as views
2013-02-28 18:10:20 +04:00
2013-03-21 23:11:47 +04:00
# organizations service
2013-03-24 23:00:01 +04:00
views_OrganizationsList = views . OrganizationsList . as_view ( )
views_OrganizationsDetail = views . OrganizationsDetail . as_view ( )
views_OrganizationsAuditTrailList = views . OrganizationsAuditTrailList . as_view ( )
views_OrganizationsUsersList = views . OrganizationsUsersList . as_view ( )
views_OrganizationsAdminsList = views . OrganizationsAdminsList . as_view ( )
views_OrganizationsProjectsList = views . OrganizationsProjectsList . as_view ( )
views_OrganizationsTagsList = views . OrganizationsTagsList . as_view ( )
2013-03-21 23:11:47 +04:00
2013-03-24 20:36:42 +04:00
# users service
2013-03-24 23:00:01 +04:00
views_UsersList = views . UsersList . as_view ( )
views_UsersDetail = views . UsersDetail . as_view ( )
views_UsersMeList = views . UsersMeList . as_view ( )
views_UsersTeamsList = views . UsersTeamsList . as_view ( )
views_UsersOrganizationsList = views . UsersOrganizationsList . as_view ( )
views_UsersAdminOrganizationsList = views . UsersAdminOrganizationsList . as_view ( )
2013-03-22 01:38:53 +04:00
# projects service
2013-04-01 04:02:56 +04:00
views_ProjectsList = views . ProjectsList . as_view ( )
views_ProjectsDetail = views . ProjectsDetail . as_view ( )
2013-04-01 06:04:52 +04:00
views_ProjectsOrganizationsList = views . ProjectsOrganizationsList . as_view ( )
2013-03-22 01:38:53 +04:00
# audit trail service
2013-03-24 20:36:42 +04:00
2013-03-22 01:38:53 +04:00
# team service
2013-03-24 20:36:42 +04:00
2013-03-22 01:38:53 +04:00
# inventory service
2013-03-26 00:41:21 +04:00
views_InventoryList = views . InventoryList . as_view ( )
views_InventoryDetail = views . InventoryDetail . as_view ( )
2013-03-27 02:18:05 +04:00
views_InventoryHostsList = views . InventoryHostsList . as_view ( )
2013-03-27 03:21:18 +04:00
views_InventoryGroupsList = views . InventoryGroupsList . as_view ( )
2013-03-24 20:36:42 +04:00
2013-03-22 01:38:53 +04:00
# group service
2013-03-27 00:57:08 +04:00
views_GroupsList = views . GroupsList . as_view ( )
views_GroupsDetail = views . GroupsDetail . as_view ( )
2013-03-27 06:24:03 +04:00
views_GroupsVariableDetail = views . GroupsVariableDetail . as_view ( )
2013-03-28 02:17:21 +04:00
views_GroupsChildrenList = views . GroupsChildrenList . as_view ( )
2013-03-24 20:36:42 +04:00
2013-03-22 01:38:53 +04:00
# host service
2013-03-26 22:44:12 +04:00
views_HostsList = views . HostsList . as_view ( )
views_HostsDetail = views . HostsDetail . as_view ( )
2013-03-27 06:24:03 +04:00
views_HostsVariableDetail = views . HostsVariableDetail . as_view ( )
2013-03-24 20:36:42 +04:00
2013-03-27 06:24:03 +04:00
# seperate variable data
views_VariableDetail = views . VariableDetail . as_view ( )
2013-03-24 20:36:42 +04:00
2013-03-22 01:38:53 +04:00
# log data services
2013-03-24 20:36:42 +04:00
2013-03-22 01:38:53 +04:00
# events services
2013-03-24 20:36:42 +04:00
2013-03-22 01:38:53 +04:00
# jobs services
2013-03-24 20:36:42 +04:00
2013-03-22 01:38:53 +04:00
# tags service
2013-03-27 06:24:03 +04:00
views_TagsDetail = views . TagsDetail . as_view ( )
2013-03-22 01:38:53 +04:00
2013-03-21 08:12:03 +04:00
2013-02-28 18:10:20 +04:00
urlpatterns = patterns ( ' ' ,
2013-03-27 06:24:03 +04:00
2013-04-01 04:02:56 +04:00
# organizations vice
2013-03-26 00:41:21 +04:00
url ( r ' ^api/v1/organizations/$ ' , views_OrganizationsList ) ,
url ( r ' ^api/v1/organizations/(?P<pk>[0-9]+)/$ ' , views_OrganizationsDetail ) ,
url ( r ' ^api/v1/organizations/(?P<pk>[0-9]+)/audit_trail/$ ' , views_OrganizationsAuditTrailList ) ,
url ( r ' ^api/v1/organizations/(?P<pk>[0-9]+)/users/$ ' , views_OrganizationsUsersList ) ,
url ( r ' ^api/v1/organizations/(?P<pk>[0-9]+)/admins/$ ' , views_OrganizationsAdminsList ) ,
url ( r ' ^api/v1/organizations/(?P<pk>[0-9]+)/projects/$ ' , views_OrganizationsProjectsList ) ,
url ( r ' ^api/v1/organizations/(?P<pk>[0-9]+)/tags/$ ' , views_OrganizationsTagsList ) ,
2013-03-21 23:11:47 +04:00
# users service
2013-03-24 23:00:01 +04:00
url ( r ' ^api/v1/users/$ ' , views_UsersList ) ,
url ( r ' ^api/v1/users/(?P<pk>[0-9]+)/$ ' , views_UsersDetail ) ,
url ( r ' ^api/v1/me/$ ' , views_UsersMeList ) ,
url ( r ' ^api/v1/users/(?P<pk>[0-9]+)/teams/$ ' , views_UsersTeamsList ) ,
url ( r ' ^api/v1/users/(?P<pk>[0-9]+)/organizations/$ ' , views_UsersOrganizationsList ) ,
url ( r ' ^api/v1/users/(?P<pk>[0-9]+)/admin_of_organizations/$ ' , views_UsersAdminOrganizationsList ) ,
2013-03-22 01:38:53 +04:00
2013-03-21 23:11:47 +04:00
# projects service
2013-04-01 04:02:56 +04:00
url ( r ' ^api/v1/projects/$ ' , views_ProjectsList ) ,
2013-03-26 00:41:21 +04:00
url ( r ' ^api/v1/projects/(?P<pk>[0-9]+)/$ ' , views_ProjectsDetail ) ,
2013-04-01 06:04:52 +04:00
url ( r ' ^api/v1/projects/(?P<pk>[0-9]+)/organizations/$ ' , views_ProjectsOrganizationsList ) ,
2013-03-22 01:38:53 +04:00
2013-03-21 23:11:47 +04:00
# audit trail service
2013-03-27 06:24:03 +04:00
# api/v1/audit_trails/
# api/v1/audit_trails/N/
# and ./audit_trails/ on all resources
2013-03-22 01:38:53 +04:00
2013-03-21 23:11:47 +04:00
# team service
2013-03-27 06:24:03 +04:00
# api/v1/teams/
# api/v1/teams/N/
# api/v1/teams/N/users/
2013-03-22 01:38:53 +04:00
2013-03-21 23:11:47 +04:00
# inventory service
2013-03-26 00:41:21 +04:00
url ( r ' ^api/v1/inventories/$ ' , views_InventoryList ) ,
url ( r ' ^api/v1/inventories/(?P<pk>[0-9]+)/$ ' , views_InventoryDetail ) ,
2013-03-27 02:18:05 +04:00
url ( r ' ^api/v1/inventories/(?P<pk>[0-9]+)/hosts/$ ' , views_InventoryHostsList ) ,
2013-03-27 03:21:18 +04:00
url ( r ' ^api/v1/inventories/(?P<pk>[0-9]+)/groups/$ ' , views_InventoryGroupsList ) ,
2013-03-22 01:38:53 +04:00
2013-03-21 23:11:47 +04:00
# host service
2013-03-26 22:44:12 +04:00
url ( r ' ^api/v1/hosts/$ ' , views_HostsList ) ,
url ( r ' ^api/v1/hosts/(?P<pk>[0-9]+)/$ ' , views_HostsDetail ) ,
# group service
2013-03-27 00:57:08 +04:00
url ( r ' ^api/v1/groups/$ ' , views_GroupsList ) ,
url ( r ' ^api/v1/groups/(?P<pk>[0-9]+)/$ ' , views_GroupsDetail ) ,
2013-03-28 02:17:21 +04:00
url ( r ' ^api/v1/groups/(?P<pk>[0-9]+)/children/$ ' , views_GroupsChildrenList ) ,
2013-03-22 01:38:53 +04:00
2013-03-27 06:24:03 +04:00
# variable data
url ( r ' ^api/v1/hosts/(?P<pk>[0-9]+)/variable_data/$ ' , views_HostsVariableDetail ) ,
url ( r ' ^api/v1/groups/(?P<pk>[0-9]+)/variable_data/$ ' , views_GroupsVariableDetail ) ,
url ( r ' ^api/v1/variable_data/(?P<pk>[0-9]+)/$ ' , views_VariableDetail ) ,
2013-03-22 01:38:53 +04:00
2013-03-27 06:24:03 +04:00
# log data (results) services
2013-03-22 01:38:53 +04:00
2013-03-27 06:24:03 +04:00
# jobs & job status services
# /jobs/
# /jobs/N/
# /job_statuses/
# /job_statuses/N/
2013-03-22 01:38:53 +04:00
2013-03-21 23:11:47 +04:00
# tags service
2013-03-27 06:24:03 +04:00
url ( r ' ^api/v1/tags/(?P<pk>[0-9]+)/$ ' , views_TagsDetail ) ,
# ... and tag relations on all resources
# credentials services
# ... users
# ... teams
# ... projects (?)
# permissions services
# ... users
# ... teams
2013-03-24 00:03:17 +04:00
2013-02-28 18:10:20 +04:00
)
2013-03-14 01:15:00 +04:00
if ' django.contrib.admin ' in settings . INSTALLED_APPS :
from django . contrib import admin
admin . autodiscover ( )
urlpatterns + = patterns ( ' ' ,
url ( r ' ^admin/ ' , include ( admin . site . urls ) ) ,
)