Sapan Bhatia | dea3943 | 2014-06-13 03:10:36 -0400 | [diff] [blame] | 1 | from rest_framework.decorators import api_view |
| 2 | from rest_framework.response import Response |
| 3 | from rest_framework.reverse import reverse |
| 4 | from rest_framework import serializers |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 5 | from rest_framework import generics |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 6 | from rest_framework import status |
Scott Baker | 57c725c | 2014-11-12 01:13:53 -0800 | [diff] [blame] | 7 | from rest_framework.generics import GenericAPIView |
Sapan Bhatia | dea3943 | 2014-06-13 03:10:36 -0400 | [diff] [blame] | 8 | from core.models import * |
| 9 | from django.forms import widgets |
Scott Baker | 46b5854 | 2014-08-11 17:26:12 -0700 | [diff] [blame] | 10 | from rest_framework import filters |
Scott Baker | d51d0bd | 2014-11-10 16:31:15 -0800 | [diff] [blame] | 11 | from django.conf.urls import patterns, url |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 12 | from rest_framework.exceptions import PermissionDenied as RestFrameworkPermissionDenied |
Scott Baker | 15af565 | 2015-02-02 14:33:08 -0800 | [diff] [blame] | 13 | from django.core.exceptions import PermissionDenied as DjangoPermissionDenied |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 14 | from xosapibase import XOSRetrieveUpdateDestroyAPIView, XOSListCreateAPIView |
Sapan Bhatia | dea3943 | 2014-06-13 03:10:36 -0400 | [diff] [blame] | 15 | |
Scott Baker | f0480fb | 2014-12-23 11:12:07 -0800 | [diff] [blame] | 16 | if hasattr(serializers, "ReadOnlyField"): |
| 17 | # rest_framework 3.x |
| 18 | IdField = serializers.ReadOnlyField |
| 19 | else: |
| 20 | # rest_framework 2.x |
| 21 | IdField = serializers.Field |
| 22 | |
Sapan Bhatia | dea3943 | 2014-06-13 03:10:36 -0400 | [diff] [blame] | 23 | """ |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 24 | Schema of the generator object: |
| 25 | all: Set of all Model objects |
| 26 | all_if(regex): Set of Model objects that match regex |
Scott Baker | 57c725c | 2014-11-12 01:13:53 -0800 | [diff] [blame] | 27 | |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 28 | Model object: |
| 29 | plural: English plural of object name |
| 30 | camel: CamelCase version of object name |
| 31 | refs: list of references to other Model objects |
| 32 | props: list of properties minus refs |
Sapan Bhatia | dea3943 | 2014-06-13 03:10:36 -0400 | [diff] [blame] | 33 | |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 34 | TODO: Deal with subnets |
Sapan Bhatia | dea3943 | 2014-06-13 03:10:36 -0400 | [diff] [blame] | 35 | """ |
| 36 | |
Scott Baker | d51d0bd | 2014-11-10 16:31:15 -0800 | [diff] [blame] | 37 | def get_REST_patterns(): |
| 38 | return patterns('', |
Scott Baker | 1faefd3 | 2015-02-02 15:53:37 -0800 | [diff] [blame] | 39 | url(r'^xos/$', api_root), |
Scott Baker | d51d0bd | 2014-11-10 16:31:15 -0800 | [diff] [blame] | 40 | |
Scott Baker | 1faefd3 | 2015-02-02 15:53:37 -0800 | [diff] [blame] | 41 | url(r'xos/serviceattributes/$', ServiceAttributeList.as_view(), name='serviceattribute-list'), |
| 42 | url(r'xos/serviceattributes/(?P<pk>[a-zA-Z0-9\-]+)/$', ServiceAttributeDetail.as_view(), name ='serviceattribute-detail'), |
Scott Baker | d51d0bd | 2014-11-10 16:31:15 -0800 | [diff] [blame] | 43 | |
Scott Baker | 1faefd3 | 2015-02-02 15:53:37 -0800 | [diff] [blame] | 44 | url(r'xos/controllerimages/$', ControllerImagesList.as_view(), name='controllerimages-list'), |
| 45 | url(r'xos/controllerimages/(?P<pk>[a-zA-Z0-9\-]+)/$', ControllerImagesDetail.as_view(), name ='controllerimages-detail'), |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 46 | |
Scott Baker | 1faefd3 | 2015-02-02 15:53:37 -0800 | [diff] [blame] | 47 | url(r'xos/controllersiteprivileges/$', ControllerSitePrivilegeList.as_view(), name='controllersiteprivilege-list'), |
| 48 | url(r'xos/controllersiteprivileges/(?P<pk>[a-zA-Z0-9\-]+)/$', ControllerSitePrivilegeDetail.as_view(), name ='controllersiteprivilege-detail'), |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 49 | |
Scott Baker | 1faefd3 | 2015-02-02 15:53:37 -0800 | [diff] [blame] | 50 | url(r'xos/images/$', ImageList.as_view(), name='image-list'), |
| 51 | url(r'xos/images/(?P<pk>[a-zA-Z0-9\-]+)/$', ImageDetail.as_view(), name ='image-detail'), |
Scott Baker | d51d0bd | 2014-11-10 16:31:15 -0800 | [diff] [blame] | 52 | |
Scott Baker | 1faefd3 | 2015-02-02 15:53:37 -0800 | [diff] [blame] | 53 | url(r'xos/networkparameters/$', NetworkParameterList.as_view(), name='networkparameter-list'), |
| 54 | url(r'xos/networkparameters/(?P<pk>[a-zA-Z0-9\-]+)/$', NetworkParameterDetail.as_view(), name ='networkparameter-detail'), |
Scott Baker | d51d0bd | 2014-11-10 16:31:15 -0800 | [diff] [blame] | 55 | |
Scott Baker | 1faefd3 | 2015-02-02 15:53:37 -0800 | [diff] [blame] | 56 | url(r'xos/sites/$', SiteList.as_view(), name='site-list'), |
| 57 | url(r'xos/sites/(?P<pk>[a-zA-Z0-9\-]+)/$', SiteDetail.as_view(), name ='site-detail'), |
Scott Baker | d51d0bd | 2014-11-10 16:31:15 -0800 | [diff] [blame] | 58 | |
Scott Baker | 1faefd3 | 2015-02-02 15:53:37 -0800 | [diff] [blame] | 59 | url(r'xos/slice_roles/$', SliceRoleList.as_view(), name='slicerole-list'), |
| 60 | url(r'xos/slice_roles/(?P<pk>[a-zA-Z0-9\-]+)/$', SliceRoleDetail.as_view(), name ='slicerole-detail'), |
Scott Baker | d51d0bd | 2014-11-10 16:31:15 -0800 | [diff] [blame] | 61 | |
Scott Baker | 1faefd3 | 2015-02-02 15:53:37 -0800 | [diff] [blame] | 62 | url(r'xos/tags/$', TagList.as_view(), name='tag-list'), |
| 63 | url(r'xos/tags/(?P<pk>[a-zA-Z0-9\-]+)/$', TagDetail.as_view(), name ='tag-detail'), |
Scott Baker | d51d0bd | 2014-11-10 16:31:15 -0800 | [diff] [blame] | 64 | |
Scott Baker | 1faefd3 | 2015-02-02 15:53:37 -0800 | [diff] [blame] | 65 | url(r'xos/invoices/$', InvoiceList.as_view(), name='invoice-list'), |
| 66 | url(r'xos/invoices/(?P<pk>[a-zA-Z0-9\-]+)/$', InvoiceDetail.as_view(), name ='invoice-detail'), |
Scott Baker | d51d0bd | 2014-11-10 16:31:15 -0800 | [diff] [blame] | 67 | |
Scott Baker | 1faefd3 | 2015-02-02 15:53:37 -0800 | [diff] [blame] | 68 | url(r'xos/slice_privileges/$', SlicePrivilegeList.as_view(), name='sliceprivilege-list'), |
| 69 | url(r'xos/slice_privileges/(?P<pk>[a-zA-Z0-9\-]+)/$', SlicePrivilegeDetail.as_view(), name ='sliceprivilege-detail'), |
Scott Baker | d51d0bd | 2014-11-10 16:31:15 -0800 | [diff] [blame] | 70 | |
Scott Baker | 1faefd3 | 2015-02-02 15:53:37 -0800 | [diff] [blame] | 71 | url(r'xos/planetstackroles/$', PlanetStackRoleList.as_view(), name='planetstackrole-list'), |
| 72 | url(r'xos/planetstackroles/(?P<pk>[a-zA-Z0-9\-]+)/$', PlanetStackRoleDetail.as_view(), name ='planetstackrole-detail'), |
Scott Baker | d51d0bd | 2014-11-10 16:31:15 -0800 | [diff] [blame] | 73 | |
Scott Baker | 1faefd3 | 2015-02-02 15:53:37 -0800 | [diff] [blame] | 74 | url(r'xos/networkslivers/$', NetworkSliverList.as_view(), name='networksliver-list'), |
| 75 | url(r'xos/networkslivers/(?P<pk>[a-zA-Z0-9\-]+)/$', NetworkSliverDetail.as_view(), name ='networksliver-detail'), |
Scott Baker | d51d0bd | 2014-11-10 16:31:15 -0800 | [diff] [blame] | 76 | |
Scott Baker | 1faefd3 | 2015-02-02 15:53:37 -0800 | [diff] [blame] | 77 | url(r'xos/flavors/$', FlavorList.as_view(), name='flavor-list'), |
| 78 | url(r'xos/flavors/(?P<pk>[a-zA-Z0-9\-]+)/$', FlavorDetail.as_view(), name ='flavor-detail'), |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 79 | |
Scott Baker | 1faefd3 | 2015-02-02 15:53:37 -0800 | [diff] [blame] | 80 | url(r'xos/controllersites/$', ControllerSiteList.as_view(), name='controllersite-list'), |
| 81 | url(r'xos/controllersites/(?P<pk>[a-zA-Z0-9\-]+)/$', ControllerSiteDetail.as_view(), name ='controllersite-detail'), |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 82 | |
Scott Baker | 1faefd3 | 2015-02-02 15:53:37 -0800 | [diff] [blame] | 83 | url(r'xos/projects/$', ProjectList.as_view(), name='project-list'), |
| 84 | url(r'xos/projects/(?P<pk>[a-zA-Z0-9\-]+)/$', ProjectDetail.as_view(), name ='project-detail'), |
Scott Baker | d51d0bd | 2014-11-10 16:31:15 -0800 | [diff] [blame] | 85 | |
Scott Baker | 1faefd3 | 2015-02-02 15:53:37 -0800 | [diff] [blame] | 86 | url(r'xos/slices/$', SliceList.as_view(), name='slice-list'), |
| 87 | url(r'xos/slices/(?P<pk>[a-zA-Z0-9\-]+)/$', SliceDetail.as_view(), name ='slice-detail'), |
Scott Baker | d51d0bd | 2014-11-10 16:31:15 -0800 | [diff] [blame] | 88 | |
Scott Baker | 1faefd3 | 2015-02-02 15:53:37 -0800 | [diff] [blame] | 89 | url(r'xos/networks/$', NetworkList.as_view(), name='network-list'), |
| 90 | url(r'xos/networks/(?P<pk>[a-zA-Z0-9\-]+)/$', NetworkDetail.as_view(), name ='network-detail'), |
Scott Baker | d51d0bd | 2014-11-10 16:31:15 -0800 | [diff] [blame] | 91 | |
Scott Baker | 1faefd3 | 2015-02-02 15:53:37 -0800 | [diff] [blame] | 92 | url(r'xos/services/$', ServiceList.as_view(), name='service-list'), |
| 93 | url(r'xos/services/(?P<pk>[a-zA-Z0-9\-]+)/$', ServiceDetail.as_view(), name ='service-detail'), |
Scott Baker | d51d0bd | 2014-11-10 16:31:15 -0800 | [diff] [blame] | 94 | |
Scott Baker | 1faefd3 | 2015-02-02 15:53:37 -0800 | [diff] [blame] | 95 | url(r'xos/serviceclasses/$', ServiceClassList.as_view(), name='serviceclass-list'), |
| 96 | url(r'xos/serviceclasses/(?P<pk>[a-zA-Z0-9\-]+)/$', ServiceClassDetail.as_view(), name ='serviceclass-detail'), |
Scott Baker | d51d0bd | 2014-11-10 16:31:15 -0800 | [diff] [blame] | 97 | |
Scott Baker | 1faefd3 | 2015-02-02 15:53:37 -0800 | [diff] [blame] | 98 | url(r'xos/planetstacks/$', PlanetStackList.as_view(), name='planetstack-list'), |
| 99 | url(r'xos/planetstacks/(?P<pk>[a-zA-Z0-9\-]+)/$', PlanetStackDetail.as_view(), name ='planetstack-detail'), |
Scott Baker | d51d0bd | 2014-11-10 16:31:15 -0800 | [diff] [blame] | 100 | |
Scott Baker | 1faefd3 | 2015-02-02 15:53:37 -0800 | [diff] [blame] | 101 | url(r'xos/charges/$', ChargeList.as_view(), name='charge-list'), |
| 102 | url(r'xos/charges/(?P<pk>[a-zA-Z0-9\-]+)/$', ChargeDetail.as_view(), name ='charge-detail'), |
Scott Baker | d51d0bd | 2014-11-10 16:31:15 -0800 | [diff] [blame] | 103 | |
Scott Baker | 1faefd3 | 2015-02-02 15:53:37 -0800 | [diff] [blame] | 104 | url(r'xos/roles/$', RoleList.as_view(), name='role-list'), |
| 105 | url(r'xos/roles/(?P<pk>[a-zA-Z0-9\-]+)/$', RoleDetail.as_view(), name ='role-detail'), |
Scott Baker | d51d0bd | 2014-11-10 16:31:15 -0800 | [diff] [blame] | 106 | |
Scott Baker | 1faefd3 | 2015-02-02 15:53:37 -0800 | [diff] [blame] | 107 | url(r'xos/usableobjects/$', UsableObjectList.as_view(), name='usableobject-list'), |
| 108 | url(r'xos/usableobjects/(?P<pk>[a-zA-Z0-9\-]+)/$', UsableObjectDetail.as_view(), name ='usableobject-detail'), |
Scott Baker | d51d0bd | 2014-11-10 16:31:15 -0800 | [diff] [blame] | 109 | |
Scott Baker | 1faefd3 | 2015-02-02 15:53:37 -0800 | [diff] [blame] | 110 | url(r'xos/site_roles/$', SiteRoleList.as_view(), name='siterole-list'), |
| 111 | url(r'xos/site_roles/(?P<pk>[a-zA-Z0-9\-]+)/$', SiteRoleDetail.as_view(), name ='siterole-detail'), |
Scott Baker | d51d0bd | 2014-11-10 16:31:15 -0800 | [diff] [blame] | 112 | |
Scott Baker | 1faefd3 | 2015-02-02 15:53:37 -0800 | [diff] [blame] | 113 | url(r'xos/slicecredentials/$', SliceCredentialList.as_view(), name='slicecredential-list'), |
| 114 | url(r'xos/slicecredentials/(?P<pk>[a-zA-Z0-9\-]+)/$', SliceCredentialDetail.as_view(), name ='slicecredential-detail'), |
Scott Baker | d51d0bd | 2014-11-10 16:31:15 -0800 | [diff] [blame] | 115 | |
Scott Baker | 1faefd3 | 2015-02-02 15:53:37 -0800 | [diff] [blame] | 116 | url(r'xos/slivers/$', SliverList.as_view(), name='sliver-list'), |
| 117 | url(r'xos/slivers/(?P<pk>[a-zA-Z0-9\-]+)/$', SliverDetail.as_view(), name ='sliver-detail'), |
Scott Baker | d51d0bd | 2014-11-10 16:31:15 -0800 | [diff] [blame] | 118 | |
Scott Baker | 1faefd3 | 2015-02-02 15:53:37 -0800 | [diff] [blame] | 119 | url(r'xos/nodes/$', NodeList.as_view(), name='node-list'), |
| 120 | url(r'xos/nodes/(?P<pk>[a-zA-Z0-9\-]+)/$', NodeDetail.as_view(), name ='node-detail'), |
Scott Baker | d51d0bd | 2014-11-10 16:31:15 -0800 | [diff] [blame] | 121 | |
Scott Baker | 1faefd3 | 2015-02-02 15:53:37 -0800 | [diff] [blame] | 122 | url(r'xos/dashboardviews/$', DashboardViewList.as_view(), name='dashboardview-list'), |
| 123 | url(r'xos/dashboardviews/(?P<pk>[a-zA-Z0-9\-]+)/$', DashboardViewDetail.as_view(), name ='dashboardview-detail'), |
Scott Baker | d51d0bd | 2014-11-10 16:31:15 -0800 | [diff] [blame] | 124 | |
Scott Baker | 1faefd3 | 2015-02-02 15:53:37 -0800 | [diff] [blame] | 125 | url(r'xos/controllernetworks/$', ControllerNetworkList.as_view(), name='controllernetwork-list'), |
| 126 | url(r'xos/controllernetworks/(?P<pk>[a-zA-Z0-9\-]+)/$', ControllerNetworkDetail.as_view(), name ='controllernetwork-detail'), |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 127 | |
Scott Baker | 1faefd3 | 2015-02-02 15:53:37 -0800 | [diff] [blame] | 128 | url(r'xos/imagedeploymentses/$', ImageDeploymentsList.as_view(), name='imagedeployments-list'), |
| 129 | url(r'xos/imagedeploymentses/(?P<pk>[a-zA-Z0-9\-]+)/$', ImageDeploymentsDetail.as_view(), name ='imagedeployments-detail'), |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 130 | |
Scott Baker | 1faefd3 | 2015-02-02 15:53:37 -0800 | [diff] [blame] | 131 | url(r'xos/controllerusers/$', ControllerUserList.as_view(), name='controlleruser-list'), |
| 132 | url(r'xos/controllerusers/(?P<pk>[a-zA-Z0-9\-]+)/$', ControllerUserDetail.as_view(), name ='controlleruser-detail'), |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 133 | |
Scott Baker | 1faefd3 | 2015-02-02 15:53:37 -0800 | [diff] [blame] | 134 | url(r'xos/reservedresources/$', ReservedResourceList.as_view(), name='reservedresource-list'), |
| 135 | url(r'xos/reservedresources/(?P<pk>[a-zA-Z0-9\-]+)/$', ReservedResourceDetail.as_view(), name ='reservedresource-detail'), |
Scott Baker | d51d0bd | 2014-11-10 16:31:15 -0800 | [diff] [blame] | 136 | |
Scott Baker | 1faefd3 | 2015-02-02 15:53:37 -0800 | [diff] [blame] | 137 | url(r'xos/payments/$', PaymentList.as_view(), name='payment-list'), |
| 138 | url(r'xos/payments/(?P<pk>[a-zA-Z0-9\-]+)/$', PaymentDetail.as_view(), name ='payment-detail'), |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 139 | |
Scott Baker | 1faefd3 | 2015-02-02 15:53:37 -0800 | [diff] [blame] | 140 | url(r'xos/networkslices/$', NetworkSliceList.as_view(), name='networkslice-list'), |
| 141 | url(r'xos/networkslices/(?P<pk>[a-zA-Z0-9\-]+)/$', NetworkSliceDetail.as_view(), name ='networkslice-detail'), |
Scott Baker | d51d0bd | 2014-11-10 16:31:15 -0800 | [diff] [blame] | 142 | |
Scott Baker | 1faefd3 | 2015-02-02 15:53:37 -0800 | [diff] [blame] | 143 | url(r'xos/userdashboardviews/$', UserDashboardViewList.as_view(), name='userdashboardview-list'), |
| 144 | url(r'xos/userdashboardviews/(?P<pk>[a-zA-Z0-9\-]+)/$', UserDashboardViewDetail.as_view(), name ='userdashboardview-detail'), |
Scott Baker | d51d0bd | 2014-11-10 16:31:15 -0800 | [diff] [blame] | 145 | |
Scott Baker | 1faefd3 | 2015-02-02 15:53:37 -0800 | [diff] [blame] | 146 | url(r'xos/controllers/$', ControllerList.as_view(), name='controller-list'), |
| 147 | url(r'xos/controllers/(?P<pk>[a-zA-Z0-9\-]+)/$', ControllerDetail.as_view(), name ='controller-detail'), |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 148 | |
Scott Baker | 1faefd3 | 2015-02-02 15:53:37 -0800 | [diff] [blame] | 149 | url(r'xos/planetstackprivileges/$', PlanetStackPrivilegeList.as_view(), name='planetstackprivilege-list'), |
| 150 | url(r'xos/planetstackprivileges/(?P<pk>[a-zA-Z0-9\-]+)/$', PlanetStackPrivilegeDetail.as_view(), name ='planetstackprivilege-detail'), |
Scott Baker | d51d0bd | 2014-11-10 16:31:15 -0800 | [diff] [blame] | 151 | |
Scott Baker | 1faefd3 | 2015-02-02 15:53:37 -0800 | [diff] [blame] | 152 | url(r'xos/users/$', UserList.as_view(), name='user-list'), |
| 153 | url(r'xos/users/(?P<pk>[a-zA-Z0-9\-]+)/$', UserDetail.as_view(), name ='user-detail'), |
Scott Baker | d51d0bd | 2014-11-10 16:31:15 -0800 | [diff] [blame] | 154 | |
Scott Baker | 1faefd3 | 2015-02-02 15:53:37 -0800 | [diff] [blame] | 155 | url(r'xos/deployments/$', DeploymentList.as_view(), name='deployment-list'), |
| 156 | url(r'xos/deployments/(?P<pk>[a-zA-Z0-9\-]+)/$', DeploymentDetail.as_view(), name ='deployment-detail'), |
Scott Baker | d51d0bd | 2014-11-10 16:31:15 -0800 | [diff] [blame] | 157 | |
Scott Baker | 1faefd3 | 2015-02-02 15:53:37 -0800 | [diff] [blame] | 158 | url(r'xos/reservations/$', ReservationList.as_view(), name='reservation-list'), |
| 159 | url(r'xos/reservations/(?P<pk>[a-zA-Z0-9\-]+)/$', ReservationDetail.as_view(), name ='reservation-detail'), |
Scott Baker | d51d0bd | 2014-11-10 16:31:15 -0800 | [diff] [blame] | 160 | |
Scott Baker | 1faefd3 | 2015-02-02 15:53:37 -0800 | [diff] [blame] | 161 | url(r'xos/siteprivileges/$', SitePrivilegeList.as_view(), name='siteprivilege-list'), |
| 162 | url(r'xos/siteprivileges/(?P<pk>[a-zA-Z0-9\-]+)/$', SitePrivilegeDetail.as_view(), name ='siteprivilege-detail'), |
Scott Baker | d51d0bd | 2014-11-10 16:31:15 -0800 | [diff] [blame] | 163 | |
Scott Baker | 1faefd3 | 2015-02-02 15:53:37 -0800 | [diff] [blame] | 164 | url(r'xos/controllerslices/$', ControllerSliceList.as_view(), name='controllerslice-list'), |
| 165 | url(r'xos/controllerslices/(?P<pk>[a-zA-Z0-9\-]+)/$', ControllerSliceDetail.as_view(), name ='controllerslice-detail'), |
Scott Baker | d51d0bd | 2014-11-10 16:31:15 -0800 | [diff] [blame] | 166 | |
Scott Baker | 1faefd3 | 2015-02-02 15:53:37 -0800 | [diff] [blame] | 167 | url(r'xos/controllerdashboardviews/$', ControllerDashboardViewList.as_view(), name='controllerdashboardview-list'), |
| 168 | url(r'xos/controllerdashboardviews/(?P<pk>[a-zA-Z0-9\-]+)/$', ControllerDashboardViewDetail.as_view(), name ='controllerdashboardview-detail'), |
Scott Baker | f2c0c51 | 2014-12-22 17:35:34 -0800 | [diff] [blame] | 169 | |
Scott Baker | 1faefd3 | 2015-02-02 15:53:37 -0800 | [diff] [blame] | 170 | url(r'xos/accounts/$', AccountList.as_view(), name='account-list'), |
| 171 | url(r'xos/accounts/(?P<pk>[a-zA-Z0-9\-]+)/$', AccountDetail.as_view(), name ='account-detail'), |
Scott Baker | d51d0bd | 2014-11-10 16:31:15 -0800 | [diff] [blame] | 172 | |
Scott Baker | 1faefd3 | 2015-02-02 15:53:37 -0800 | [diff] [blame] | 173 | url(r'xos/controllerroles/$', ControllerRoleList.as_view(), name='controllerrole-list'), |
| 174 | url(r'xos/controllerroles/(?P<pk>[a-zA-Z0-9\-]+)/$', ControllerRoleDetail.as_view(), name ='controllerrole-detail'), |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 175 | |
Scott Baker | 1faefd3 | 2015-02-02 15:53:37 -0800 | [diff] [blame] | 176 | url(r'xos/networkparametertypes/$', NetworkParameterTypeList.as_view(), name='networkparametertype-list'), |
| 177 | url(r'xos/networkparametertypes/(?P<pk>[a-zA-Z0-9\-]+)/$', NetworkParameterTypeDetail.as_view(), name ='networkparametertype-detail'), |
Scott Baker | d51d0bd | 2014-11-10 16:31:15 -0800 | [diff] [blame] | 178 | |
Scott Baker | 1faefd3 | 2015-02-02 15:53:37 -0800 | [diff] [blame] | 179 | url(r'xos/sitecredentials/$', SiteCredentialList.as_view(), name='sitecredential-list'), |
| 180 | url(r'xos/sitecredentials/(?P<pk>[a-zA-Z0-9\-]+)/$', SiteCredentialDetail.as_view(), name ='sitecredential-detail'), |
Scott Baker | d51d0bd | 2014-11-10 16:31:15 -0800 | [diff] [blame] | 181 | |
Scott Baker | 1faefd3 | 2015-02-02 15:53:37 -0800 | [diff] [blame] | 182 | url(r'xos/deploymentprivileges/$', DeploymentPrivilegeList.as_view(), name='deploymentprivilege-list'), |
| 183 | url(r'xos/deploymentprivileges/(?P<pk>[a-zA-Z0-9\-]+)/$', DeploymentPrivilegeDetail.as_view(), name ='deploymentprivilege-detail'), |
Scott Baker | d51d0bd | 2014-11-10 16:31:15 -0800 | [diff] [blame] | 184 | |
Scott Baker | 1faefd3 | 2015-02-02 15:53:37 -0800 | [diff] [blame] | 185 | url(r'xos/controllersliceprivileges/$', ControllerSlicePrivilegeList.as_view(), name='controllersliceprivilege-list'), |
| 186 | url(r'xos/controllersliceprivileges/(?P<pk>[a-zA-Z0-9\-]+)/$', ControllerSlicePrivilegeDetail.as_view(), name ='controllersliceprivilege-detail'), |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 187 | |
Scott Baker | 1faefd3 | 2015-02-02 15:53:37 -0800 | [diff] [blame] | 188 | url(r'xos/sitedeployments/$', SiteDeploymentList.as_view(), name='sitedeployment-list'), |
| 189 | url(r'xos/sitedeployments/(?P<pk>[a-zA-Z0-9\-]+)/$', SiteDeploymentDetail.as_view(), name ='sitedeployment-detail'), |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 190 | |
Scott Baker | 1faefd3 | 2015-02-02 15:53:37 -0800 | [diff] [blame] | 191 | url(r'xos/deploymentroles/$', DeploymentRoleList.as_view(), name='deploymentrole-list'), |
| 192 | url(r'xos/deploymentroles/(?P<pk>[a-zA-Z0-9\-]+)/$', DeploymentRoleDetail.as_view(), name ='deploymentrole-detail'), |
Scott Baker | d51d0bd | 2014-11-10 16:31:15 -0800 | [diff] [blame] | 193 | |
Scott Baker | 1faefd3 | 2015-02-02 15:53:37 -0800 | [diff] [blame] | 194 | url(r'xos/usercredentials/$', UserCredentialList.as_view(), name='usercredential-list'), |
| 195 | url(r'xos/usercredentials/(?P<pk>[a-zA-Z0-9\-]+)/$', UserCredentialDetail.as_view(), name ='usercredential-detail'), |
Scott Baker | d51d0bd | 2014-11-10 16:31:15 -0800 | [diff] [blame] | 196 | |
Scott Baker | 1faefd3 | 2015-02-02 15:53:37 -0800 | [diff] [blame] | 197 | url(r'xos/slicetags/$', SliceTagList.as_view(), name='slicetag-list'), |
| 198 | url(r'xos/slicetags/(?P<pk>[a-zA-Z0-9\-]+)/$', SliceTagDetail.as_view(), name ='slicetag-detail'), |
Scott Baker | d51d0bd | 2014-11-10 16:31:15 -0800 | [diff] [blame] | 199 | |
Scott Baker | 1faefd3 | 2015-02-02 15:53:37 -0800 | [diff] [blame] | 200 | url(r'xos/networktemplates/$', NetworkTemplateList.as_view(), name='networktemplate-list'), |
| 201 | url(r'xos/networktemplates/(?P<pk>[a-zA-Z0-9\-]+)/$', NetworkTemplateDetail.as_view(), name ='networktemplate-detail'), |
Scott Baker | d51d0bd | 2014-11-10 16:31:15 -0800 | [diff] [blame] | 202 | |
Scott Baker | 1faefd3 | 2015-02-02 15:53:37 -0800 | [diff] [blame] | 203 | url(r'xos/routers/$', RouterList.as_view(), name='router-list'), |
| 204 | url(r'xos/routers/(?P<pk>[a-zA-Z0-9\-]+)/$', RouterDetail.as_view(), name ='router-detail'), |
Scott Baker | d51d0bd | 2014-11-10 16:31:15 -0800 | [diff] [blame] | 205 | |
Scott Baker | 1faefd3 | 2015-02-02 15:53:37 -0800 | [diff] [blame] | 206 | url(r'xos/serviceresources/$', ServiceResourceList.as_view(), name='serviceresource-list'), |
| 207 | url(r'xos/serviceresources/(?P<pk>[a-zA-Z0-9\-]+)/$', ServiceResourceDetail.as_view(), name ='serviceresource-detail'), |
Scott Baker | d51d0bd | 2014-11-10 16:31:15 -0800 | [diff] [blame] | 208 | |
| 209 | ) |
Sapan Bhatia | dea3943 | 2014-06-13 03:10:36 -0400 | [diff] [blame] | 210 | |
| 211 | @api_view(['GET']) |
| 212 | def api_root(request, format=None): |
| 213 | return Response({ |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 214 | 'serviceattributes': reverse('serviceattribute-list', request=request, format=format), |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 215 | 'controllerimageses': reverse('controllerimages-list', request=request, format=format), |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 216 | 'controllersiteprivileges': reverse('controllersiteprivilege-list', request=request, format=format), |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 217 | 'images': reverse('image-list', request=request, format=format), |
| 218 | 'networkparameters': reverse('networkparameter-list', request=request, format=format), |
| 219 | 'sites': reverse('site-list', request=request, format=format), |
| 220 | 'sliceroles': reverse('slicerole-list', request=request, format=format), |
| 221 | 'tags': reverse('tag-list', request=request, format=format), |
| 222 | 'invoices': reverse('invoice-list', request=request, format=format), |
| 223 | 'sliceprivileges': reverse('sliceprivilege-list', request=request, format=format), |
| 224 | 'planetstackroles': reverse('planetstackrole-list', request=request, format=format), |
| 225 | 'networkslivers': reverse('networksliver-list', request=request, format=format), |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 226 | 'flavors': reverse('flavor-list', request=request, format=format), |
| 227 | 'controllersites': reverse('controllersite-list', request=request, format=format), |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 228 | 'projects': reverse('project-list', request=request, format=format), |
| 229 | 'slices': reverse('slice-list', request=request, format=format), |
| 230 | 'networks': reverse('network-list', request=request, format=format), |
| 231 | 'services': reverse('service-list', request=request, format=format), |
| 232 | 'serviceclasses': reverse('serviceclass-list', request=request, format=format), |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 233 | 'planetstacks': reverse('planetstack-list', request=request, format=format), |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 234 | 'charges': reverse('charge-list', request=request, format=format), |
| 235 | 'roles': reverse('role-list', request=request, format=format), |
| 236 | 'usableobjects': reverse('usableobject-list', request=request, format=format), |
| 237 | 'siteroles': reverse('siterole-list', request=request, format=format), |
| 238 | 'slicecredentials': reverse('slicecredential-list', request=request, format=format), |
| 239 | 'slivers': reverse('sliver-list', request=request, format=format), |
| 240 | 'nodes': reverse('node-list', request=request, format=format), |
| 241 | 'dashboardviews': reverse('dashboardview-list', request=request, format=format), |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 242 | 'controllernetworks': reverse('controllernetwork-list', request=request, format=format), |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 243 | 'imagedeploymentses': reverse('imagedeployments-list', request=request, format=format), |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 244 | 'controllerusers': reverse('controlleruser-list', request=request, format=format), |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 245 | 'reservedresources': reverse('reservedresource-list', request=request, format=format), |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 246 | 'payments': reverse('payment-list', request=request, format=format), |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 247 | 'networkslices': reverse('networkslice-list', request=request, format=format), |
| 248 | 'userdashboardviews': reverse('userdashboardview-list', request=request, format=format), |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 249 | 'controllers': reverse('controller-list', request=request, format=format), |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 250 | 'planetstackprivileges': reverse('planetstackprivilege-list', request=request, format=format), |
| 251 | 'users': reverse('user-list', request=request, format=format), |
| 252 | 'deployments': reverse('deployment-list', request=request, format=format), |
| 253 | 'reservations': reverse('reservation-list', request=request, format=format), |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 254 | 'siteprivileges': reverse('siteprivilege-list', request=request, format=format), |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 255 | 'controllerslices': reverse('controllerslice-list', request=request, format=format), |
Scott Baker | f2c0c51 | 2014-12-22 17:35:34 -0800 | [diff] [blame] | 256 | 'controllerdashboardviews': reverse('controllerdashboardview-list', request=request, format=format), |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 257 | 'accounts': reverse('account-list', request=request, format=format), |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 258 | 'controllerroles': reverse('controllerrole-list', request=request, format=format), |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 259 | 'networkparametertypes': reverse('networkparametertype-list', request=request, format=format), |
| 260 | 'sitecredentials': reverse('sitecredential-list', request=request, format=format), |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 261 | 'deploymentprivileges': reverse('deploymentprivilege-list', request=request, format=format), |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 262 | 'controllersliceprivileges': reverse('controllersliceprivilege-list', request=request, format=format), |
| 263 | 'sitedeployments': reverse('sitedeployment-list', request=request, format=format), |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 264 | 'deploymentroles': reverse('deploymentrole-list', request=request, format=format), |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 265 | 'usercredentials': reverse('usercredential-list', request=request, format=format), |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 266 | 'slicetags': reverse('slicetag-list', request=request, format=format), |
Scott Baker | f2c0c51 | 2014-12-22 17:35:34 -0800 | [diff] [blame] | 267 | 'networktemplates': reverse('networktemplate-list', request=request, format=format), |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 268 | 'routers': reverse('router-list', request=request, format=format), |
| 269 | 'serviceresources': reverse('serviceresource-list', request=request, format=format), |
| 270 | |
Sapan Bhatia | dea3943 | 2014-06-13 03:10:36 -0400 | [diff] [blame] | 271 | }) |
| 272 | |
| 273 | # Based on serializers.py |
| 274 | |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 275 | class XOSModelSerializer(serializers.ModelSerializer): |
| 276 | def save_object(self, obj, **kwargs): |
| 277 | |
| 278 | """ rest_framework can't deal with ManyToMany relations that have a |
Scott Baker | 1faefd3 | 2015-02-02 15:53:37 -0800 | [diff] [blame] | 279 | through table. In xos, most of the through tables we have |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 280 | use defaults or blank fields, so there's no reason why we shouldn't |
| 281 | be able to save these objects. |
| 282 | |
| 283 | So, let's strip out these m2m relations, and deal with them ourself. |
| 284 | """ |
| 285 | obj._complex_m2m_data={};
|
| 286 | if getattr(obj, '_m2m_data', None):
|
| 287 | for relatedObject in obj._meta.get_all_related_many_to_many_objects():
|
| 288 | if (relatedObject.field.rel.through._meta.auto_created):
|
| 289 | # These are non-trough ManyToMany relations and
|
| 290 | # can be updated just fine
|
| 291 | continue
|
| 292 | fieldName = relatedObject.get_accessor_name()
|
| 293 | if fieldName in obj._m2m_data.keys():
|
| 294 | obj._complex_m2m_data[fieldName] = (relatedObject, obj._m2m_data[fieldName])
|
| 295 | del obj._m2m_data[fieldName]
|
| 296 |
|
| 297 | serializers.ModelSerializer.save_object(self, obj, **kwargs); |
| 298 | |
| 299 | for (accessor, stuff) in obj._complex_m2m_data.items(): |
| 300 | (relatedObject, data) = stuff |
| 301 | through = relatedObject.field.rel.through |
| 302 | local_fieldName = relatedObject.field.m2m_reverse_field_name() |
| 303 | remote_fieldName = relatedObject.field.m2m_field_name() |
| 304 | |
| 305 | # get the current set of existing relations |
| 306 | existing = through.objects.filter(**{local_fieldName: obj}); |
| 307 | |
| 308 | data_ids = [item.id for item in data] |
| 309 | existing_ids = [getattr(item,remote_fieldName).id for item in existing] |
| 310 | |
| 311 | #print "data_ids", data_ids |
| 312 | #print "existing_ids", existing_ids |
| 313 | |
| 314 | # remove relations that are in 'existing' but not in 'data' |
| 315 | for item in list(existing): |
| 316 | if (getattr(item,remote_fieldName).id not in data_ids): |
| 317 | print "delete", getattr(item,remote_fieldName) |
| 318 | item.delete() #(purge=True) |
| 319 | |
| 320 | # add relations that are in 'data' but not in 'existing' |
| 321 | for item in data: |
| 322 | if (item.id not in existing_ids): |
| 323 | #print "add", item |
| 324 | newModel = through(**{local_fieldName: obj, remote_fieldName: item}) |
| 325 | newModel.save() |
| 326 | |
| 327 | |
| 328 | |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 329 | class ServiceAttributeSerializer(serializers.HyperlinkedModelSerializer): |
Scott Baker | f0480fb | 2014-12-23 11:12:07 -0800 | [diff] [blame] | 330 | id = IdField() |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 331 | |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 332 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 333 | validators = serializers.SerializerMethodField("getValidators") |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 334 | def getHumanReadableName(self, obj):
|
| 335 | return str(obj) |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 336 | def getValidators(self, obj): |
| 337 | try: |
| 338 | return obj.getValidators() |
| 339 | except: |
| 340 | return None |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 341 | class Meta: |
| 342 | model = ServiceAttribute |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 343 | fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','name','value','service',) |
Scott Baker | 46b5854 | 2014-08-11 17:26:12 -0700 | [diff] [blame] | 344 | |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 345 | class ServiceAttributeIdSerializer(XOSModelSerializer): |
Scott Baker | f0480fb | 2014-12-23 11:12:07 -0800 | [diff] [blame] | 346 | id = IdField() |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 347 | |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 348 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 349 | validators = serializers.SerializerMethodField("getValidators") |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 350 | def getHumanReadableName(self, obj):
|
| 351 | return str(obj)
|
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 352 | def getValidators(self, obj):
|
| 353 | try: |
| 354 | return obj.getValidators() |
| 355 | except: |
| 356 | return None
|
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 357 | class Meta:
|
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 358 | model = ServiceAttribute |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 359 | fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','name','value','service',) |
Scott Baker | 46b5854 | 2014-08-11 17:26:12 -0700 | [diff] [blame] | 360 | |
| 361 | |
Sapan Bhatia | dea3943 | 2014-06-13 03:10:36 -0400 | [diff] [blame] | 362 | |
| 363 | |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 364 | class ControllerImagesSerializer(serializers.HyperlinkedModelSerializer): |
Scott Baker | f0480fb | 2014-12-23 11:12:07 -0800 | [diff] [blame] | 365 | id = IdField() |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 366 | |
| 367 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
| 368 | validators = serializers.SerializerMethodField("getValidators") |
| 369 | def getHumanReadableName(self, obj):
|
| 370 | return str(obj) |
| 371 | def getValidators(self, obj): |
| 372 | try: |
| 373 | return obj.getValidators() |
| 374 | except: |
| 375 | return None |
| 376 | class Meta: |
| 377 | model = ControllerImages |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 378 | fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','image','controller','glance_image_id',) |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 379 | |
| 380 | class ControllerImagesIdSerializer(XOSModelSerializer): |
Scott Baker | f0480fb | 2014-12-23 11:12:07 -0800 | [diff] [blame] | 381 | id = IdField() |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 382 | |
| 383 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
| 384 | validators = serializers.SerializerMethodField("getValidators") |
| 385 | def getHumanReadableName(self, obj):
|
| 386 | return str(obj)
|
| 387 | def getValidators(self, obj):
|
| 388 | try: |
| 389 | return obj.getValidators() |
| 390 | except: |
| 391 | return None
|
| 392 | class Meta:
|
| 393 | model = ControllerImages |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 394 | fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','image','controller','glance_image_id',) |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 395 | |
| 396 | |
| 397 | |
| 398 | |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 399 | class ControllerSitePrivilegeSerializer(serializers.HyperlinkedModelSerializer): |
| 400 | id = IdField() |
| 401 | |
| 402 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
| 403 | validators = serializers.SerializerMethodField("getValidators") |
| 404 | def getHumanReadableName(self, obj):
|
| 405 | return str(obj) |
| 406 | def getValidators(self, obj): |
| 407 | try: |
| 408 | return obj.getValidators() |
| 409 | except: |
| 410 | return None |
| 411 | class Meta: |
| 412 | model = ControllerSitePrivilege |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 413 | fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','controller','site_privilege','role_id',) |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 414 | |
| 415 | class ControllerSitePrivilegeIdSerializer(XOSModelSerializer): |
| 416 | id = IdField() |
| 417 | |
| 418 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
| 419 | validators = serializers.SerializerMethodField("getValidators") |
| 420 | def getHumanReadableName(self, obj):
|
| 421 | return str(obj)
|
| 422 | def getValidators(self, obj):
|
| 423 | try: |
| 424 | return obj.getValidators() |
| 425 | except: |
| 426 | return None
|
| 427 | class Meta:
|
| 428 | model = ControllerSitePrivilege |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 429 | fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','controller','site_privilege','role_id',) |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 430 | |
| 431 | |
| 432 | |
| 433 | |
Sapan Bhatia | dea3943 | 2014-06-13 03:10:36 -0400 | [diff] [blame] | 434 | class ImageSerializer(serializers.HyperlinkedModelSerializer): |
Scott Baker | f0480fb | 2014-12-23 11:12:07 -0800 | [diff] [blame] | 435 | id = IdField() |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 436 | |
Scott Baker | bf4ef6d | 2014-12-22 15:59:33 -0800 | [diff] [blame] | 437 | |
| 438 | deployments = serializers.HyperlinkedRelatedField(many=True, read_only=True, view_name='deployment-detail') |
| 439 | |
| 440 | |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 441 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 442 | validators = serializers.SerializerMethodField("getValidators") |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 443 | def getHumanReadableName(self, obj):
|
| 444 | return str(obj) |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 445 | def getValidators(self, obj): |
| 446 | try: |
| 447 | return obj.getValidators() |
| 448 | except: |
| 449 | return None |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 450 | class Meta: |
| 451 | model = Image |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 452 | fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','name','disk_format','container_format','path','deployments',) |
Scott Baker | 46b5854 | 2014-08-11 17:26:12 -0700 | [diff] [blame] | 453 | |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 454 | class ImageIdSerializer(XOSModelSerializer): |
Scott Baker | f0480fb | 2014-12-23 11:12:07 -0800 | [diff] [blame] | 455 | id = IdField() |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 456 | |
Scott Baker | bf4ef6d | 2014-12-22 15:59:33 -0800 | [diff] [blame] | 457 | |
Scott Baker | 201f7da | 2014-12-23 10:56:06 -0800 | [diff] [blame] | 458 | deployments = serializers.PrimaryKeyRelatedField(many=True, queryset = Deployment.objects.all()) |
Scott Baker | bf4ef6d | 2014-12-22 15:59:33 -0800 | [diff] [blame] | 459 | |
| 460 | |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 461 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 462 | validators = serializers.SerializerMethodField("getValidators") |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 463 | def getHumanReadableName(self, obj):
|
| 464 | return str(obj)
|
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 465 | def getValidators(self, obj):
|
| 466 | try: |
| 467 | return obj.getValidators() |
| 468 | except: |
| 469 | return None
|
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 470 | class Meta:
|
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 471 | model = Image |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 472 | fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','name','disk_format','container_format','path','deployments',) |
Scott Baker | 46b5854 | 2014-08-11 17:26:12 -0700 | [diff] [blame] | 473 | |
| 474 | |
Sapan Bhatia | dea3943 | 2014-06-13 03:10:36 -0400 | [diff] [blame] | 475 | |
| 476 | |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 477 | class NetworkParameterSerializer(serializers.HyperlinkedModelSerializer): |
Scott Baker | f0480fb | 2014-12-23 11:12:07 -0800 | [diff] [blame] | 478 | id = IdField() |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 479 | |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 480 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 481 | validators = serializers.SerializerMethodField("getValidators") |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 482 | def getHumanReadableName(self, obj):
|
| 483 | return str(obj) |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 484 | def getValidators(self, obj): |
| 485 | try: |
| 486 | return obj.getValidators() |
| 487 | except: |
| 488 | return None |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 489 | class Meta: |
| 490 | model = NetworkParameter |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 491 | fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','parameter','value','content_type','object_id',) |
Scott Baker | 46b5854 | 2014-08-11 17:26:12 -0700 | [diff] [blame] | 492 | |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 493 | class NetworkParameterIdSerializer(XOSModelSerializer): |
Scott Baker | f0480fb | 2014-12-23 11:12:07 -0800 | [diff] [blame] | 494 | id = IdField() |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 495 | |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 496 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 497 | validators = serializers.SerializerMethodField("getValidators") |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 498 | def getHumanReadableName(self, obj):
|
| 499 | return str(obj)
|
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 500 | def getValidators(self, obj):
|
| 501 | try: |
| 502 | return obj.getValidators() |
| 503 | except: |
| 504 | return None
|
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 505 | class Meta:
|
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 506 | model = NetworkParameter |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 507 | fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','parameter','value','content_type','object_id',) |
Scott Baker | 46b5854 | 2014-08-11 17:26:12 -0700 | [diff] [blame] | 508 | |
| 509 | |
Sapan Bhatia | dea3943 | 2014-06-13 03:10:36 -0400 | [diff] [blame] | 510 | |
| 511 | |
| 512 | class SiteSerializer(serializers.HyperlinkedModelSerializer): |
Scott Baker | f0480fb | 2014-12-23 11:12:07 -0800 | [diff] [blame] | 513 | id = IdField() |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 514 | |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 515 | |
| 516 | deployments = serializers.HyperlinkedRelatedField(many=True, read_only=True, view_name='deployment-detail') |
| 517 | |
| 518 | |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 519 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 520 | validators = serializers.SerializerMethodField("getValidators") |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 521 | def getHumanReadableName(self, obj):
|
| 522 | return str(obj) |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 523 | def getValidators(self, obj): |
| 524 | try: |
| 525 | return obj.getValidators() |
| 526 | except: |
| 527 | return None |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 528 | class Meta: |
| 529 | model = Site |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 530 | fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','name','site_url','enabled','location','longitude','latitude','login_base','is_public','abbreviated_name','deployments',) |
Scott Baker | 46b5854 | 2014-08-11 17:26:12 -0700 | [diff] [blame] | 531 | |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 532 | class SiteIdSerializer(XOSModelSerializer): |
Scott Baker | f0480fb | 2014-12-23 11:12:07 -0800 | [diff] [blame] | 533 | id = IdField() |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 534 | |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 535 | |
Scott Baker | 201f7da | 2014-12-23 10:56:06 -0800 | [diff] [blame] | 536 | deployments = serializers.PrimaryKeyRelatedField(many=True, queryset = Deployment.objects.all()) |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 537 | |
| 538 | |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 539 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 540 | validators = serializers.SerializerMethodField("getValidators") |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 541 | def getHumanReadableName(self, obj):
|
| 542 | return str(obj)
|
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 543 | def getValidators(self, obj):
|
| 544 | try: |
| 545 | return obj.getValidators() |
| 546 | except: |
| 547 | return None
|
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 548 | class Meta:
|
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 549 | model = Site |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 550 | fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','name','site_url','enabled','location','longitude','latitude','login_base','is_public','abbreviated_name','deployments',) |
Scott Baker | 46b5854 | 2014-08-11 17:26:12 -0700 | [diff] [blame] | 551 | |
| 552 | |
Sapan Bhatia | dea3943 | 2014-06-13 03:10:36 -0400 | [diff] [blame] | 553 | |
| 554 | |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 555 | class SliceRoleSerializer(serializers.HyperlinkedModelSerializer): |
Scott Baker | f0480fb | 2014-12-23 11:12:07 -0800 | [diff] [blame] | 556 | id = IdField() |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 557 | |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 558 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 559 | validators = serializers.SerializerMethodField("getValidators") |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 560 | def getHumanReadableName(self, obj):
|
| 561 | return str(obj) |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 562 | def getValidators(self, obj): |
| 563 | try: |
| 564 | return obj.getValidators() |
| 565 | except: |
| 566 | return None |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 567 | class Meta: |
| 568 | model = SliceRole |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 569 | fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','role',) |
Scott Baker | 46b5854 | 2014-08-11 17:26:12 -0700 | [diff] [blame] | 570 | |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 571 | class SliceRoleIdSerializer(XOSModelSerializer): |
Scott Baker | f0480fb | 2014-12-23 11:12:07 -0800 | [diff] [blame] | 572 | id = IdField() |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 573 | |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 574 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 575 | validators = serializers.SerializerMethodField("getValidators") |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 576 | def getHumanReadableName(self, obj):
|
| 577 | return str(obj)
|
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 578 | def getValidators(self, obj):
|
| 579 | try: |
| 580 | return obj.getValidators() |
| 581 | except: |
| 582 | return None
|
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 583 | class Meta:
|
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 584 | model = SliceRole |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 585 | fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','role',) |
Scott Baker | 46b5854 | 2014-08-11 17:26:12 -0700 | [diff] [blame] | 586 | |
| 587 | |
Sapan Bhatia | dea3943 | 2014-06-13 03:10:36 -0400 | [diff] [blame] | 588 | |
| 589 | |
| 590 | class TagSerializer(serializers.HyperlinkedModelSerializer): |
Scott Baker | f0480fb | 2014-12-23 11:12:07 -0800 | [diff] [blame] | 591 | id = IdField() |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 592 | |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 593 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 594 | validators = serializers.SerializerMethodField("getValidators") |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 595 | def getHumanReadableName(self, obj):
|
| 596 | return str(obj) |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 597 | def getValidators(self, obj): |
| 598 | try: |
| 599 | return obj.getValidators() |
| 600 | except: |
| 601 | return None |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 602 | class Meta: |
| 603 | model = Tag |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 604 | fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','service','name','value','content_type','object_id',) |
Scott Baker | 46b5854 | 2014-08-11 17:26:12 -0700 | [diff] [blame] | 605 | |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 606 | class TagIdSerializer(XOSModelSerializer): |
Scott Baker | f0480fb | 2014-12-23 11:12:07 -0800 | [diff] [blame] | 607 | id = IdField() |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 608 | |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 609 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 610 | validators = serializers.SerializerMethodField("getValidators") |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 611 | def getHumanReadableName(self, obj):
|
| 612 | return str(obj)
|
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 613 | def getValidators(self, obj):
|
| 614 | try: |
| 615 | return obj.getValidators() |
| 616 | except: |
| 617 | return None
|
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 618 | class Meta:
|
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 619 | model = Tag |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 620 | fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','service','name','value','content_type','object_id',) |
Scott Baker | 46b5854 | 2014-08-11 17:26:12 -0700 | [diff] [blame] | 621 | |
| 622 | |
Sapan Bhatia | dea3943 | 2014-06-13 03:10:36 -0400 | [diff] [blame] | 623 | |
| 624 | |
| 625 | class InvoiceSerializer(serializers.HyperlinkedModelSerializer): |
Scott Baker | f0480fb | 2014-12-23 11:12:07 -0800 | [diff] [blame] | 626 | id = IdField() |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 627 | |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 628 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 629 | validators = serializers.SerializerMethodField("getValidators") |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 630 | def getHumanReadableName(self, obj):
|
| 631 | return str(obj) |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 632 | def getValidators(self, obj): |
| 633 | try: |
| 634 | return obj.getValidators() |
| 635 | except: |
| 636 | return None |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 637 | class Meta: |
| 638 | model = Invoice |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 639 | fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','date','account',) |
Scott Baker | 46b5854 | 2014-08-11 17:26:12 -0700 | [diff] [blame] | 640 | |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 641 | class InvoiceIdSerializer(XOSModelSerializer): |
Scott Baker | f0480fb | 2014-12-23 11:12:07 -0800 | [diff] [blame] | 642 | id = IdField() |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 643 | |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 644 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 645 | validators = serializers.SerializerMethodField("getValidators") |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 646 | def getHumanReadableName(self, obj):
|
| 647 | return str(obj)
|
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 648 | def getValidators(self, obj):
|
| 649 | try: |
| 650 | return obj.getValidators() |
| 651 | except: |
| 652 | return None
|
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 653 | class Meta:
|
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 654 | model = Invoice |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 655 | fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','date','account',) |
Scott Baker | 46b5854 | 2014-08-11 17:26:12 -0700 | [diff] [blame] | 656 | |
| 657 | |
Sapan Bhatia | dea3943 | 2014-06-13 03:10:36 -0400 | [diff] [blame] | 658 | |
| 659 | |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 660 | class SlicePrivilegeSerializer(serializers.HyperlinkedModelSerializer): |
Scott Baker | f0480fb | 2014-12-23 11:12:07 -0800 | [diff] [blame] | 661 | id = IdField() |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 662 | |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 663 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 664 | validators = serializers.SerializerMethodField("getValidators") |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 665 | def getHumanReadableName(self, obj):
|
| 666 | return str(obj) |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 667 | def getValidators(self, obj): |
| 668 | try: |
| 669 | return obj.getValidators() |
| 670 | except: |
| 671 | return None |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 672 | class Meta: |
| 673 | model = SlicePrivilege |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 674 | fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','user','slice','role',) |
Scott Baker | 46b5854 | 2014-08-11 17:26:12 -0700 | [diff] [blame] | 675 | |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 676 | class SlicePrivilegeIdSerializer(XOSModelSerializer): |
Scott Baker | f0480fb | 2014-12-23 11:12:07 -0800 | [diff] [blame] | 677 | id = IdField() |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 678 | |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 679 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 680 | validators = serializers.SerializerMethodField("getValidators") |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 681 | def getHumanReadableName(self, obj):
|
| 682 | return str(obj)
|
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 683 | def getValidators(self, obj):
|
| 684 | try: |
| 685 | return obj.getValidators() |
| 686 | except: |
| 687 | return None
|
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 688 | class Meta:
|
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 689 | model = SlicePrivilege |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 690 | fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','user','slice','role',) |
Scott Baker | 46b5854 | 2014-08-11 17:26:12 -0700 | [diff] [blame] | 691 | |
| 692 | |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 693 | |
| 694 | |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 695 | class PlanetStackRoleSerializer(serializers.HyperlinkedModelSerializer): |
Scott Baker | f0480fb | 2014-12-23 11:12:07 -0800 | [diff] [blame] | 696 | id = IdField() |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 697 | |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 698 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 699 | validators = serializers.SerializerMethodField("getValidators") |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 700 | def getHumanReadableName(self, obj):
|
| 701 | return str(obj) |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 702 | def getValidators(self, obj): |
| 703 | try: |
| 704 | return obj.getValidators() |
| 705 | except: |
| 706 | return None |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 707 | class Meta: |
| 708 | model = PlanetStackRole |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 709 | fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','role',) |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 710 | |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 711 | class PlanetStackRoleIdSerializer(XOSModelSerializer): |
Scott Baker | f0480fb | 2014-12-23 11:12:07 -0800 | [diff] [blame] | 712 | id = IdField() |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 713 | |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 714 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 715 | validators = serializers.SerializerMethodField("getValidators") |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 716 | def getHumanReadableName(self, obj):
|
| 717 | return str(obj)
|
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 718 | def getValidators(self, obj):
|
| 719 | try: |
| 720 | return obj.getValidators() |
| 721 | except: |
| 722 | return None
|
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 723 | class Meta:
|
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 724 | model = PlanetStackRole |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 725 | fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','role',) |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 726 | |
| 727 | |
| 728 | |
| 729 | |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 730 | class NetworkSliverSerializer(serializers.HyperlinkedModelSerializer): |
Scott Baker | f0480fb | 2014-12-23 11:12:07 -0800 | [diff] [blame] | 731 | id = IdField() |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 732 | |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 733 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 734 | validators = serializers.SerializerMethodField("getValidators") |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 735 | def getHumanReadableName(self, obj):
|
| 736 | return str(obj) |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 737 | def getValidators(self, obj): |
| 738 | try: |
| 739 | return obj.getValidators() |
| 740 | except: |
| 741 | return None |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 742 | class Meta: |
| 743 | model = NetworkSliver |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 744 | fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','network','sliver','ip','port_id',) |
Scott Baker | 46b5854 | 2014-08-11 17:26:12 -0700 | [diff] [blame] | 745 | |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 746 | class NetworkSliverIdSerializer(XOSModelSerializer): |
Scott Baker | f0480fb | 2014-12-23 11:12:07 -0800 | [diff] [blame] | 747 | id = IdField() |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 748 | |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 749 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 750 | validators = serializers.SerializerMethodField("getValidators") |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 751 | def getHumanReadableName(self, obj):
|
| 752 | return str(obj)
|
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 753 | def getValidators(self, obj):
|
| 754 | try: |
| 755 | return obj.getValidators() |
| 756 | except: |
| 757 | return None
|
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 758 | class Meta:
|
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 759 | model = NetworkSliver |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 760 | fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','network','sliver','ip','port_id',) |
Scott Baker | 46b5854 | 2014-08-11 17:26:12 -0700 | [diff] [blame] | 761 | |
| 762 | |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 763 | |
| 764 | |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 765 | class FlavorSerializer(serializers.HyperlinkedModelSerializer): |
| 766 | id = IdField() |
| 767 | |
| 768 | |
| 769 | deployments = serializers.HyperlinkedRelatedField(many=True, read_only=True, view_name='deployment-detail') |
| 770 | |
| 771 | |
| 772 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
| 773 | validators = serializers.SerializerMethodField("getValidators") |
| 774 | def getHumanReadableName(self, obj):
|
| 775 | return str(obj) |
| 776 | def getValidators(self, obj): |
| 777 | try: |
| 778 | return obj.getValidators() |
| 779 | except: |
| 780 | return None |
| 781 | class Meta: |
| 782 | model = Flavor |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 783 | fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','name','description','flavor','order','default','deployments',) |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 784 | |
| 785 | class FlavorIdSerializer(XOSModelSerializer): |
| 786 | id = IdField() |
| 787 | |
| 788 | |
| 789 | deployments = serializers.PrimaryKeyRelatedField(many=True, queryset = Deployment.objects.all()) |
| 790 | |
| 791 | |
| 792 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
| 793 | validators = serializers.SerializerMethodField("getValidators") |
| 794 | def getHumanReadableName(self, obj):
|
| 795 | return str(obj)
|
| 796 | def getValidators(self, obj):
|
| 797 | try: |
| 798 | return obj.getValidators() |
| 799 | except: |
| 800 | return None
|
| 801 | class Meta:
|
| 802 | model = Flavor |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 803 | fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','name','description','flavor','order','default','deployments',) |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 804 | |
| 805 | |
| 806 | |
| 807 | |
| 808 | class ControllerSiteSerializer(serializers.HyperlinkedModelSerializer): |
| 809 | id = IdField() |
| 810 | |
| 811 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
| 812 | validators = serializers.SerializerMethodField("getValidators") |
| 813 | def getHumanReadableName(self, obj):
|
| 814 | return str(obj) |
| 815 | def getValidators(self, obj): |
| 816 | try: |
| 817 | return obj.getValidators() |
| 818 | except: |
| 819 | return None |
| 820 | class Meta: |
| 821 | model = ControllerSite |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 822 | fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','site','controller','tenant_id',) |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 823 | |
| 824 | class ControllerSiteIdSerializer(XOSModelSerializer): |
| 825 | id = IdField() |
| 826 | |
| 827 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
| 828 | validators = serializers.SerializerMethodField("getValidators") |
| 829 | def getHumanReadableName(self, obj):
|
| 830 | return str(obj)
|
| 831 | def getValidators(self, obj):
|
| 832 | try: |
| 833 | return obj.getValidators() |
| 834 | except: |
| 835 | return None
|
| 836 | class Meta:
|
| 837 | model = ControllerSite |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 838 | fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','site','controller','tenant_id',) |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 839 | |
| 840 | |
| 841 | |
| 842 | |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 843 | class ProjectSerializer(serializers.HyperlinkedModelSerializer): |
Scott Baker | f0480fb | 2014-12-23 11:12:07 -0800 | [diff] [blame] | 844 | id = IdField() |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 845 | |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 846 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 847 | validators = serializers.SerializerMethodField("getValidators") |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 848 | def getHumanReadableName(self, obj):
|
| 849 | return str(obj) |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 850 | def getValidators(self, obj): |
| 851 | try: |
| 852 | return obj.getValidators() |
| 853 | except: |
| 854 | return None |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 855 | class Meta: |
| 856 | model = Project |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 857 | fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','name',) |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 858 | |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 859 | class ProjectIdSerializer(XOSModelSerializer): |
Scott Baker | f0480fb | 2014-12-23 11:12:07 -0800 | [diff] [blame] | 860 | id = IdField() |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 861 | |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 862 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 863 | validators = serializers.SerializerMethodField("getValidators") |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 864 | def getHumanReadableName(self, obj):
|
| 865 | return str(obj)
|
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 866 | def getValidators(self, obj):
|
| 867 | try: |
| 868 | return obj.getValidators() |
| 869 | except: |
| 870 | return None
|
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 871 | class Meta:
|
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 872 | model = Project |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 873 | fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','name',) |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 874 | |
| 875 | |
| 876 | |
| 877 | |
Sapan Bhatia | dea3943 | 2014-06-13 03:10:36 -0400 | [diff] [blame] | 878 | class SliceSerializer(serializers.HyperlinkedModelSerializer): |
Scott Baker | f0480fb | 2014-12-23 11:12:07 -0800 | [diff] [blame] | 879 | id = IdField() |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 880 | |
| 881 | |
| 882 | networks = serializers.HyperlinkedRelatedField(many=True, read_only=True, view_name='network-detail') |
| 883 | |
| 884 | |
| 885 | |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 886 | networks = serializers.HyperlinkedRelatedField(many=True, read_only=True, view_name='network-detail') |
| 887 | |
| 888 | |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 889 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 890 | validators = serializers.SerializerMethodField("getValidators") |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 891 | def getHumanReadableName(self, obj):
|
| 892 | return str(obj) |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 893 | def getValidators(self, obj): |
| 894 | try: |
| 895 | return obj.getValidators() |
| 896 | except: |
| 897 | return None |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 898 | class Meta: |
| 899 | model = Slice |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 900 | fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','name','enabled','omf_friendly','description','slice_url','site','max_slivers','service','network','serviceClass','creator','default_flavor','default_image','mount_data_sets','networks','networks',) |
Scott Baker | 46b5854 | 2014-08-11 17:26:12 -0700 | [diff] [blame] | 901 | |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 902 | class SliceIdSerializer(XOSModelSerializer): |
Scott Baker | f0480fb | 2014-12-23 11:12:07 -0800 | [diff] [blame] | 903 | id = IdField() |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 904 | |
| 905 | |
Scott Baker | 201f7da | 2014-12-23 10:56:06 -0800 | [diff] [blame] | 906 | networks = serializers.PrimaryKeyRelatedField(many=True, queryset = Network.objects.all()) |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 907 | |
| 908 | |
| 909 | |
Scott Baker | 201f7da | 2014-12-23 10:56:06 -0800 | [diff] [blame] | 910 | networks = serializers.PrimaryKeyRelatedField(many=True, queryset = Network.objects.all()) |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 911 | |
| 912 | |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 913 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 914 | validators = serializers.SerializerMethodField("getValidators") |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 915 | def getHumanReadableName(self, obj):
|
| 916 | return str(obj)
|
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 917 | def getValidators(self, obj):
|
| 918 | try: |
| 919 | return obj.getValidators() |
| 920 | except: |
| 921 | return None
|
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 922 | class Meta:
|
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 923 | model = Slice |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 924 | fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','name','enabled','omf_friendly','description','slice_url','site','max_slivers','service','network','serviceClass','creator','default_flavor','default_image','mount_data_sets','networks','networks',) |
Scott Baker | 46b5854 | 2014-08-11 17:26:12 -0700 | [diff] [blame] | 925 | |
| 926 | |
Sapan Bhatia | dea3943 | 2014-06-13 03:10:36 -0400 | [diff] [blame] | 927 | |
| 928 | |
| 929 | class NetworkSerializer(serializers.HyperlinkedModelSerializer): |
Scott Baker | f0480fb | 2014-12-23 11:12:07 -0800 | [diff] [blame] | 930 | id = IdField() |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 931 | |
| 932 | |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 933 | slices = serializers.HyperlinkedRelatedField(many=True, read_only=True, view_name='slice-detail') |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 934 | |
| 935 | |
| 936 | |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 937 | slices = serializers.HyperlinkedRelatedField(many=True, read_only=True, view_name='slice-detail') |
| 938 | |
| 939 | |
| 940 | |
| 941 | slivers = serializers.HyperlinkedRelatedField(many=True, read_only=True, view_name='sliver-detail') |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 942 | |
| 943 | |
| 944 | |
| 945 | routers = serializers.HyperlinkedRelatedField(many=True, read_only=True, view_name='router-detail') |
| 946 | |
| 947 | |
| 948 | |
| 949 | routers = serializers.HyperlinkedRelatedField(many=True, read_only=True, view_name='router-detail') |
| 950 | |
| 951 | |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 952 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 953 | validators = serializers.SerializerMethodField("getValidators") |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 954 | def getHumanReadableName(self, obj):
|
| 955 | return str(obj) |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 956 | def getValidators(self, obj): |
| 957 | try: |
| 958 | return obj.getValidators() |
| 959 | except: |
| 960 | return None |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 961 | class Meta: |
| 962 | model = Network |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 963 | fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','name','template','subnet','ports','labels','owner','guaranteed_bandwidth','permit_all_slices','topology_parameters','controller_url','controller_parameters','network_id','router_id','subnet_id','slices','slices','slivers','routers','routers',) |
Scott Baker | 46b5854 | 2014-08-11 17:26:12 -0700 | [diff] [blame] | 964 | |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 965 | class NetworkIdSerializer(XOSModelSerializer): |
Scott Baker | f0480fb | 2014-12-23 11:12:07 -0800 | [diff] [blame] | 966 | id = IdField() |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 967 | |
| 968 | |
Scott Baker | 201f7da | 2014-12-23 10:56:06 -0800 | [diff] [blame] | 969 | slices = serializers.PrimaryKeyRelatedField(many=True, queryset = Slice.objects.all()) |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 970 | |
| 971 | |
| 972 | |
Scott Baker | 201f7da | 2014-12-23 10:56:06 -0800 | [diff] [blame] | 973 | slices = serializers.PrimaryKeyRelatedField(many=True, queryset = Slice.objects.all()) |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 974 | |
| 975 | |
| 976 | |
Scott Baker | 201f7da | 2014-12-23 10:56:06 -0800 | [diff] [blame] | 977 | slivers = serializers.PrimaryKeyRelatedField(many=True, queryset = Sliver.objects.all()) |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 978 | |
| 979 | |
| 980 | |
Scott Baker | 201f7da | 2014-12-23 10:56:06 -0800 | [diff] [blame] | 981 | routers = serializers.PrimaryKeyRelatedField(many=True, queryset = Router.objects.all()) |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 982 | |
| 983 | |
| 984 | |
Scott Baker | 201f7da | 2014-12-23 10:56:06 -0800 | [diff] [blame] | 985 | routers = serializers.PrimaryKeyRelatedField(many=True, queryset = Router.objects.all()) |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 986 | |
| 987 | |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 988 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 989 | validators = serializers.SerializerMethodField("getValidators") |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 990 | def getHumanReadableName(self, obj):
|
| 991 | return str(obj)
|
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 992 | def getValidators(self, obj):
|
| 993 | try: |
| 994 | return obj.getValidators() |
| 995 | except: |
| 996 | return None
|
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 997 | class Meta:
|
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 998 | model = Network |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 999 | fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','name','template','subnet','ports','labels','owner','guaranteed_bandwidth','permit_all_slices','topology_parameters','controller_url','controller_parameters','network_id','router_id','subnet_id','slices','slices','slivers','routers','routers',) |
Scott Baker | 46b5854 | 2014-08-11 17:26:12 -0700 | [diff] [blame] | 1000 | |
| 1001 | |
Sapan Bhatia | dea3943 | 2014-06-13 03:10:36 -0400 | [diff] [blame] | 1002 | |
| 1003 | |
| 1004 | class ServiceSerializer(serializers.HyperlinkedModelSerializer): |
Scott Baker | f0480fb | 2014-12-23 11:12:07 -0800 | [diff] [blame] | 1005 | id = IdField() |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 1006 | |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 1007 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 1008 | validators = serializers.SerializerMethodField("getValidators") |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 1009 | def getHumanReadableName(self, obj):
|
| 1010 | return str(obj) |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 1011 | def getValidators(self, obj): |
| 1012 | try: |
| 1013 | return obj.getValidators() |
| 1014 | except: |
| 1015 | return None |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 1016 | class Meta: |
| 1017 | model = Service |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 1018 | fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','description','enabled','name','versionNumber','published',) |
Scott Baker | 46b5854 | 2014-08-11 17:26:12 -0700 | [diff] [blame] | 1019 | |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 1020 | class ServiceIdSerializer(XOSModelSerializer): |
Scott Baker | f0480fb | 2014-12-23 11:12:07 -0800 | [diff] [blame] | 1021 | id = IdField() |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 1022 | |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 1023 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 1024 | validators = serializers.SerializerMethodField("getValidators") |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 1025 | def getHumanReadableName(self, obj):
|
| 1026 | return str(obj)
|
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 1027 | def getValidators(self, obj):
|
| 1028 | try: |
| 1029 | return obj.getValidators() |
| 1030 | except: |
| 1031 | return None
|
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 1032 | class Meta:
|
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 1033 | model = Service |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 1034 | fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','description','enabled','name','versionNumber','published',) |
Scott Baker | 46b5854 | 2014-08-11 17:26:12 -0700 | [diff] [blame] | 1035 | |
| 1036 | |
Sapan Bhatia | dea3943 | 2014-06-13 03:10:36 -0400 | [diff] [blame] | 1037 | |
| 1038 | |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 1039 | class ServiceClassSerializer(serializers.HyperlinkedModelSerializer): |
Scott Baker | f0480fb | 2014-12-23 11:12:07 -0800 | [diff] [blame] | 1040 | id = IdField() |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 1041 | |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 1042 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 1043 | validators = serializers.SerializerMethodField("getValidators") |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 1044 | def getHumanReadableName(self, obj):
|
| 1045 | return str(obj) |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 1046 | def getValidators(self, obj): |
| 1047 | try: |
| 1048 | return obj.getValidators() |
| 1049 | except: |
| 1050 | return None |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 1051 | class Meta: |
| 1052 | model = ServiceClass |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 1053 | fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','name','description','commitment','membershipFee','membershipFeeMonths','upgradeRequiresApproval',) |
Scott Baker | 46b5854 | 2014-08-11 17:26:12 -0700 | [diff] [blame] | 1054 | |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 1055 | class ServiceClassIdSerializer(XOSModelSerializer): |
Scott Baker | f0480fb | 2014-12-23 11:12:07 -0800 | [diff] [blame] | 1056 | id = IdField() |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 1057 | |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 1058 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 1059 | validators = serializers.SerializerMethodField("getValidators") |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 1060 | def getHumanReadableName(self, obj):
|
| 1061 | return str(obj)
|
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 1062 | def getValidators(self, obj):
|
| 1063 | try: |
| 1064 | return obj.getValidators() |
| 1065 | except: |
| 1066 | return None
|
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 1067 | class Meta:
|
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 1068 | model = ServiceClass |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 1069 | fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','name','description','commitment','membershipFee','membershipFeeMonths','upgradeRequiresApproval',) |
Scott Baker | 46b5854 | 2014-08-11 17:26:12 -0700 | [diff] [blame] | 1070 | |
| 1071 | |
Sapan Bhatia | dea3943 | 2014-06-13 03:10:36 -0400 | [diff] [blame] | 1072 | |
| 1073 | |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 1074 | class PlanetStackSerializer(serializers.HyperlinkedModelSerializer): |
Scott Baker | f0480fb | 2014-12-23 11:12:07 -0800 | [diff] [blame] | 1075 | id = IdField() |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 1076 | |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 1077 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 1078 | validators = serializers.SerializerMethodField("getValidators") |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 1079 | def getHumanReadableName(self, obj):
|
| 1080 | return str(obj) |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 1081 | def getValidators(self, obj): |
| 1082 | try: |
| 1083 | return obj.getValidators() |
| 1084 | except: |
| 1085 | return None |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 1086 | class Meta: |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 1087 | model = PlanetStack |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 1088 | fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','description',) |
Scott Baker | 46b5854 | 2014-08-11 17:26:12 -0700 | [diff] [blame] | 1089 | |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 1090 | class PlanetStackIdSerializer(XOSModelSerializer): |
Scott Baker | f0480fb | 2014-12-23 11:12:07 -0800 | [diff] [blame] | 1091 | id = IdField() |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 1092 | |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 1093 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 1094 | validators = serializers.SerializerMethodField("getValidators") |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 1095 | def getHumanReadableName(self, obj):
|
| 1096 | return str(obj)
|
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 1097 | def getValidators(self, obj):
|
| 1098 | try: |
| 1099 | return obj.getValidators() |
| 1100 | except: |
| 1101 | return None
|
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 1102 | class Meta:
|
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 1103 | model = PlanetStack |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 1104 | fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','description',) |
Scott Baker | 46b5854 | 2014-08-11 17:26:12 -0700 | [diff] [blame] | 1105 | |
| 1106 | |
Sapan Bhatia | dea3943 | 2014-06-13 03:10:36 -0400 | [diff] [blame] | 1107 | |
| 1108 | |
| 1109 | class ChargeSerializer(serializers.HyperlinkedModelSerializer): |
Scott Baker | f0480fb | 2014-12-23 11:12:07 -0800 | [diff] [blame] | 1110 | id = IdField() |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 1111 | |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 1112 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 1113 | validators = serializers.SerializerMethodField("getValidators") |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 1114 | def getHumanReadableName(self, obj):
|
| 1115 | return str(obj) |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 1116 | def getValidators(self, obj): |
| 1117 | try: |
| 1118 | return obj.getValidators() |
| 1119 | except: |
| 1120 | return None |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 1121 | class Meta: |
| 1122 | model = Charge |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 1123 | fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','account','slice','kind','state','date','object','amount','coreHours','invoice',) |
Scott Baker | 46b5854 | 2014-08-11 17:26:12 -0700 | [diff] [blame] | 1124 | |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 1125 | class ChargeIdSerializer(XOSModelSerializer): |
Scott Baker | f0480fb | 2014-12-23 11:12:07 -0800 | [diff] [blame] | 1126 | id = IdField() |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 1127 | |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 1128 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 1129 | validators = serializers.SerializerMethodField("getValidators") |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 1130 | def getHumanReadableName(self, obj):
|
| 1131 | return str(obj)
|
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 1132 | def getValidators(self, obj):
|
| 1133 | try: |
| 1134 | return obj.getValidators() |
| 1135 | except: |
| 1136 | return None
|
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 1137 | class Meta:
|
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 1138 | model = Charge |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 1139 | fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','account','slice','kind','state','date','object','amount','coreHours','invoice',) |
Scott Baker | 46b5854 | 2014-08-11 17:26:12 -0700 | [diff] [blame] | 1140 | |
| 1141 | |
Sapan Bhatia | dea3943 | 2014-06-13 03:10:36 -0400 | [diff] [blame] | 1142 | |
| 1143 | |
| 1144 | class RoleSerializer(serializers.HyperlinkedModelSerializer): |
Scott Baker | f0480fb | 2014-12-23 11:12:07 -0800 | [diff] [blame] | 1145 | id = IdField() |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 1146 | |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 1147 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 1148 | validators = serializers.SerializerMethodField("getValidators") |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 1149 | def getHumanReadableName(self, obj):
|
| 1150 | return str(obj) |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 1151 | def getValidators(self, obj): |
| 1152 | try: |
| 1153 | return obj.getValidators() |
| 1154 | except: |
| 1155 | return None |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 1156 | class Meta: |
| 1157 | model = Role |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 1158 | fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','role_type','role','description','content_type',) |
Scott Baker | 46b5854 | 2014-08-11 17:26:12 -0700 | [diff] [blame] | 1159 | |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 1160 | class RoleIdSerializer(XOSModelSerializer): |
Scott Baker | f0480fb | 2014-12-23 11:12:07 -0800 | [diff] [blame] | 1161 | id = IdField() |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 1162 | |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 1163 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 1164 | validators = serializers.SerializerMethodField("getValidators") |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 1165 | def getHumanReadableName(self, obj):
|
| 1166 | return str(obj)
|
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 1167 | def getValidators(self, obj):
|
| 1168 | try: |
| 1169 | return obj.getValidators() |
| 1170 | except: |
| 1171 | return None
|
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 1172 | class Meta:
|
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 1173 | model = Role |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 1174 | fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','role_type','role','description','content_type',) |
Scott Baker | 46b5854 | 2014-08-11 17:26:12 -0700 | [diff] [blame] | 1175 | |
| 1176 | |
Sapan Bhatia | dea3943 | 2014-06-13 03:10:36 -0400 | [diff] [blame] | 1177 | |
| 1178 | |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 1179 | class UsableObjectSerializer(serializers.HyperlinkedModelSerializer): |
Scott Baker | f0480fb | 2014-12-23 11:12:07 -0800 | [diff] [blame] | 1180 | id = IdField() |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 1181 | |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 1182 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 1183 | validators = serializers.SerializerMethodField("getValidators") |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 1184 | def getHumanReadableName(self, obj):
|
| 1185 | return str(obj) |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 1186 | def getValidators(self, obj): |
| 1187 | try: |
| 1188 | return obj.getValidators() |
| 1189 | except: |
| 1190 | return None |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 1191 | class Meta: |
| 1192 | model = UsableObject |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 1193 | fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','name',) |
Scott Baker | 46b5854 | 2014-08-11 17:26:12 -0700 | [diff] [blame] | 1194 | |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 1195 | class UsableObjectIdSerializer(XOSModelSerializer): |
Scott Baker | f0480fb | 2014-12-23 11:12:07 -0800 | [diff] [blame] | 1196 | id = IdField() |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 1197 | |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 1198 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 1199 | validators = serializers.SerializerMethodField("getValidators") |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 1200 | def getHumanReadableName(self, obj):
|
| 1201 | return str(obj)
|
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 1202 | def getValidators(self, obj):
|
| 1203 | try: |
| 1204 | return obj.getValidators() |
| 1205 | except: |
| 1206 | return None
|
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 1207 | class Meta:
|
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 1208 | model = UsableObject |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 1209 | fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','name',) |
Scott Baker | 46b5854 | 2014-08-11 17:26:12 -0700 | [diff] [blame] | 1210 | |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 1211 | |
| 1212 | |
| 1213 | |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 1214 | class SiteRoleSerializer(serializers.HyperlinkedModelSerializer): |
Scott Baker | f0480fb | 2014-12-23 11:12:07 -0800 | [diff] [blame] | 1215 | id = IdField() |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 1216 | |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 1217 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 1218 | validators = serializers.SerializerMethodField("getValidators") |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 1219 | def getHumanReadableName(self, obj):
|
| 1220 | return str(obj) |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 1221 | def getValidators(self, obj): |
| 1222 | try: |
| 1223 | return obj.getValidators() |
| 1224 | except: |
| 1225 | return None |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 1226 | class Meta: |
| 1227 | model = SiteRole |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 1228 | fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','role',) |
Scott Baker | 46b5854 | 2014-08-11 17:26:12 -0700 | [diff] [blame] | 1229 | |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 1230 | class SiteRoleIdSerializer(XOSModelSerializer): |
Scott Baker | f0480fb | 2014-12-23 11:12:07 -0800 | [diff] [blame] | 1231 | id = IdField() |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 1232 | |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 1233 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 1234 | validators = serializers.SerializerMethodField("getValidators") |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 1235 | def getHumanReadableName(self, obj):
|
| 1236 | return str(obj)
|
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 1237 | def getValidators(self, obj):
|
| 1238 | try: |
| 1239 | return obj.getValidators() |
| 1240 | except: |
| 1241 | return None
|
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 1242 | class Meta:
|
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 1243 | model = SiteRole |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 1244 | fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','role',) |
Scott Baker | 46b5854 | 2014-08-11 17:26:12 -0700 | [diff] [blame] | 1245 | |
| 1246 | |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 1247 | |
| 1248 | |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 1249 | class SliceCredentialSerializer(serializers.HyperlinkedModelSerializer): |
Scott Baker | f0480fb | 2014-12-23 11:12:07 -0800 | [diff] [blame] | 1250 | id = IdField() |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 1251 | |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 1252 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 1253 | validators = serializers.SerializerMethodField("getValidators") |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 1254 | def getHumanReadableName(self, obj):
|
| 1255 | return str(obj) |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 1256 | def getValidators(self, obj): |
| 1257 | try: |
| 1258 | return obj.getValidators() |
| 1259 | except: |
| 1260 | return None |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 1261 | class Meta: |
| 1262 | model = SliceCredential |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 1263 | fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','slice','name','key_id','enc_value',) |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 1264 | |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 1265 | class SliceCredentialIdSerializer(XOSModelSerializer): |
Scott Baker | f0480fb | 2014-12-23 11:12:07 -0800 | [diff] [blame] | 1266 | id = IdField() |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 1267 | |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 1268 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 1269 | validators = serializers.SerializerMethodField("getValidators") |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 1270 | def getHumanReadableName(self, obj):
|
| 1271 | return str(obj)
|
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 1272 | def getValidators(self, obj):
|
| 1273 | try: |
| 1274 | return obj.getValidators() |
| 1275 | except: |
| 1276 | return None
|
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 1277 | class Meta:
|
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 1278 | model = SliceCredential |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 1279 | fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','slice','name','key_id','enc_value',) |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 1280 | |
| 1281 | |
| 1282 | |
| 1283 | |
Sapan Bhatia | dea3943 | 2014-06-13 03:10:36 -0400 | [diff] [blame] | 1284 | class SliverSerializer(serializers.HyperlinkedModelSerializer): |
Scott Baker | f0480fb | 2014-12-23 11:12:07 -0800 | [diff] [blame] | 1285 | id = IdField() |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 1286 | |
| 1287 | |
| 1288 | networks = serializers.HyperlinkedRelatedField(many=True, read_only=True, view_name='network-detail') |
| 1289 | |
| 1290 | |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 1291 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 1292 | validators = serializers.SerializerMethodField("getValidators") |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 1293 | def getHumanReadableName(self, obj):
|
| 1294 | return str(obj) |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 1295 | def getValidators(self, obj): |
| 1296 | try: |
| 1297 | return obj.getValidators() |
| 1298 | except: |
| 1299 | return None |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 1300 | class Meta: |
| 1301 | model = Sliver |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 1302 | fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','instance_id','instance_uuid','name','instance_name','ip','image','creator','slice','deployment','node','numberCores','flavor','userData','networks',) |
Scott Baker | 46b5854 | 2014-08-11 17:26:12 -0700 | [diff] [blame] | 1303 | |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 1304 | class SliverIdSerializer(XOSModelSerializer): |
Scott Baker | f0480fb | 2014-12-23 11:12:07 -0800 | [diff] [blame] | 1305 | id = IdField() |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 1306 | |
| 1307 | |
Scott Baker | 201f7da | 2014-12-23 10:56:06 -0800 | [diff] [blame] | 1308 | networks = serializers.PrimaryKeyRelatedField(many=True, queryset = Network.objects.all()) |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 1309 | |
| 1310 | |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 1311 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 1312 | validators = serializers.SerializerMethodField("getValidators") |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 1313 | def getHumanReadableName(self, obj):
|
| 1314 | return str(obj)
|
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 1315 | def getValidators(self, obj):
|
| 1316 | try: |
| 1317 | return obj.getValidators() |
| 1318 | except: |
| 1319 | return None
|
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 1320 | class Meta:
|
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 1321 | model = Sliver |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 1322 | fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','instance_id','instance_uuid','name','instance_name','ip','image','creator','slice','deployment','node','numberCores','flavor','userData','networks',) |
Scott Baker | 46b5854 | 2014-08-11 17:26:12 -0700 | [diff] [blame] | 1323 | |
| 1324 | |
Sapan Bhatia | dea3943 | 2014-06-13 03:10:36 -0400 | [diff] [blame] | 1325 | |
| 1326 | |
| 1327 | class NodeSerializer(serializers.HyperlinkedModelSerializer): |
Scott Baker | f0480fb | 2014-12-23 11:12:07 -0800 | [diff] [blame] | 1328 | id = IdField() |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 1329 | |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 1330 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 1331 | validators = serializers.SerializerMethodField("getValidators") |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 1332 | def getHumanReadableName(self, obj):
|
| 1333 | return str(obj) |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 1334 | def getValidators(self, obj): |
| 1335 | try: |
| 1336 | return obj.getValidators() |
| 1337 | except: |
| 1338 | return None |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 1339 | class Meta: |
| 1340 | model = Node |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 1341 | fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','name','site_deployment','site',) |
Scott Baker | 46b5854 | 2014-08-11 17:26:12 -0700 | [diff] [blame] | 1342 | |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 1343 | class NodeIdSerializer(XOSModelSerializer): |
Scott Baker | f0480fb | 2014-12-23 11:12:07 -0800 | [diff] [blame] | 1344 | id = IdField() |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 1345 | |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 1346 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 1347 | validators = serializers.SerializerMethodField("getValidators") |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 1348 | def getHumanReadableName(self, obj):
|
| 1349 | return str(obj)
|
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 1350 | def getValidators(self, obj):
|
| 1351 | try: |
| 1352 | return obj.getValidators() |
| 1353 | except: |
| 1354 | return None
|
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 1355 | class Meta:
|
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 1356 | model = Node |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 1357 | fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','name','site_deployment','site',) |
Scott Baker | 46b5854 | 2014-08-11 17:26:12 -0700 | [diff] [blame] | 1358 | |
| 1359 | |
Sapan Bhatia | dea3943 | 2014-06-13 03:10:36 -0400 | [diff] [blame] | 1360 | |
| 1361 | |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 1362 | class DashboardViewSerializer(serializers.HyperlinkedModelSerializer): |
Scott Baker | f0480fb | 2014-12-23 11:12:07 -0800 | [diff] [blame] | 1363 | id = IdField() |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 1364 | |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 1365 | |
| 1366 | controllers = serializers.HyperlinkedRelatedField(many=True, read_only=True, view_name='controller-detail') |
| 1367 | |
| 1368 | |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 1369 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 1370 | validators = serializers.SerializerMethodField("getValidators") |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 1371 | def getHumanReadableName(self, obj):
|
| 1372 | return str(obj) |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 1373 | def getValidators(self, obj): |
| 1374 | try: |
| 1375 | return obj.getValidators() |
| 1376 | except: |
| 1377 | return None |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 1378 | class Meta: |
| 1379 | model = DashboardView |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 1380 | fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','name','url','enabled','controllers',) |
Scott Baker | 46b5854 | 2014-08-11 17:26:12 -0700 | [diff] [blame] | 1381 | |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 1382 | class DashboardViewIdSerializer(XOSModelSerializer): |
Scott Baker | f0480fb | 2014-12-23 11:12:07 -0800 | [diff] [blame] | 1383 | id = IdField() |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 1384 | |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 1385 | |
Scott Baker | 201f7da | 2014-12-23 10:56:06 -0800 | [diff] [blame] | 1386 | controllers = serializers.PrimaryKeyRelatedField(many=True, queryset = Controller.objects.all()) |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 1387 | |
| 1388 | |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 1389 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 1390 | validators = serializers.SerializerMethodField("getValidators") |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 1391 | def getHumanReadableName(self, obj):
|
| 1392 | return str(obj)
|
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 1393 | def getValidators(self, obj):
|
| 1394 | try: |
| 1395 | return obj.getValidators() |
| 1396 | except: |
| 1397 | return None
|
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 1398 | class Meta:
|
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 1399 | model = DashboardView |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 1400 | fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','name','url','enabled','controllers',) |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 1401 | |
| 1402 | |
| 1403 | |
| 1404 | |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 1405 | class ControllerNetworkSerializer(serializers.HyperlinkedModelSerializer): |
| 1406 | id = IdField() |
| 1407 | |
| 1408 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
| 1409 | validators = serializers.SerializerMethodField("getValidators") |
| 1410 | def getHumanReadableName(self, obj):
|
| 1411 | return str(obj) |
| 1412 | def getValidators(self, obj): |
| 1413 | try: |
| 1414 | return obj.getValidators() |
| 1415 | except: |
| 1416 | return None |
| 1417 | class Meta: |
| 1418 | model = ControllerNetwork |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 1419 | fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','network','controller','net_id','router_id','subnet_id','subnet',) |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 1420 | |
| 1421 | class ControllerNetworkIdSerializer(XOSModelSerializer): |
| 1422 | id = IdField() |
| 1423 | |
| 1424 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
| 1425 | validators = serializers.SerializerMethodField("getValidators") |
| 1426 | def getHumanReadableName(self, obj):
|
| 1427 | return str(obj)
|
| 1428 | def getValidators(self, obj):
|
| 1429 | try: |
| 1430 | return obj.getValidators() |
| 1431 | except: |
| 1432 | return None
|
| 1433 | class Meta:
|
| 1434 | model = ControllerNetwork |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 1435 | fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','network','controller','net_id','router_id','subnet_id','subnet',) |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 1436 | |
| 1437 | |
| 1438 | |
| 1439 | |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 1440 | class ImageDeploymentsSerializer(serializers.HyperlinkedModelSerializer): |
Scott Baker | f0480fb | 2014-12-23 11:12:07 -0800 | [diff] [blame] | 1441 | id = IdField() |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 1442 | |
| 1443 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 1444 | validators = serializers.SerializerMethodField("getValidators") |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 1445 | def getHumanReadableName(self, obj):
|
| 1446 | return str(obj) |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 1447 | def getValidators(self, obj): |
| 1448 | try: |
| 1449 | return obj.getValidators() |
| 1450 | except: |
| 1451 | return None |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 1452 | class Meta: |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 1453 | model = ImageDeployments |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 1454 | fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','image','deployment',) |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 1455 | |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 1456 | class ImageDeploymentsIdSerializer(XOSModelSerializer): |
Scott Baker | f0480fb | 2014-12-23 11:12:07 -0800 | [diff] [blame] | 1457 | id = IdField() |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 1458 | |
| 1459 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 1460 | validators = serializers.SerializerMethodField("getValidators") |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 1461 | def getHumanReadableName(self, obj):
|
| 1462 | return str(obj)
|
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 1463 | def getValidators(self, obj):
|
| 1464 | try: |
| 1465 | return obj.getValidators() |
| 1466 | except: |
| 1467 | return None
|
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 1468 | class Meta:
|
| 1469 | model = ImageDeployments |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 1470 | fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','image','deployment',) |
Scott Baker | 46b5854 | 2014-08-11 17:26:12 -0700 | [diff] [blame] | 1471 | |
| 1472 | |
Sapan Bhatia | dea3943 | 2014-06-13 03:10:36 -0400 | [diff] [blame] | 1473 | |
| 1474 | |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 1475 | class ControllerUserSerializer(serializers.HyperlinkedModelSerializer): |
| 1476 | id = IdField() |
| 1477 | |
| 1478 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
| 1479 | validators = serializers.SerializerMethodField("getValidators") |
| 1480 | def getHumanReadableName(self, obj):
|
| 1481 | return str(obj) |
| 1482 | def getValidators(self, obj): |
| 1483 | try: |
| 1484 | return obj.getValidators() |
| 1485 | except: |
| 1486 | return None |
| 1487 | class Meta: |
| 1488 | model = ControllerUser |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 1489 | fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','user','controller','kuser_id',) |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 1490 | |
| 1491 | class ControllerUserIdSerializer(XOSModelSerializer): |
| 1492 | id = IdField() |
| 1493 | |
| 1494 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
| 1495 | validators = serializers.SerializerMethodField("getValidators") |
| 1496 | def getHumanReadableName(self, obj):
|
| 1497 | return str(obj)
|
| 1498 | def getValidators(self, obj):
|
| 1499 | try: |
| 1500 | return obj.getValidators() |
| 1501 | except: |
| 1502 | return None
|
| 1503 | class Meta:
|
| 1504 | model = ControllerUser |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 1505 | fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','user','controller','kuser_id',) |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 1506 | |
| 1507 | |
| 1508 | |
| 1509 | |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 1510 | class ReservedResourceSerializer(serializers.HyperlinkedModelSerializer): |
Scott Baker | f0480fb | 2014-12-23 11:12:07 -0800 | [diff] [blame] | 1511 | id = IdField() |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 1512 | |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 1513 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 1514 | validators = serializers.SerializerMethodField("getValidators") |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 1515 | def getHumanReadableName(self, obj):
|
| 1516 | return str(obj) |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 1517 | def getValidators(self, obj): |
| 1518 | try: |
| 1519 | return obj.getValidators() |
| 1520 | except: |
| 1521 | return None |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 1522 | class Meta: |
| 1523 | model = ReservedResource |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 1524 | fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','sliver','resource','quantity','reservationSet',) |
Scott Baker | 46b5854 | 2014-08-11 17:26:12 -0700 | [diff] [blame] | 1525 | |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 1526 | class ReservedResourceIdSerializer(XOSModelSerializer): |
Scott Baker | f0480fb | 2014-12-23 11:12:07 -0800 | [diff] [blame] | 1527 | id = IdField() |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 1528 | |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 1529 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 1530 | validators = serializers.SerializerMethodField("getValidators") |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 1531 | def getHumanReadableName(self, obj):
|
| 1532 | return str(obj)
|
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 1533 | def getValidators(self, obj):
|
| 1534 | try: |
| 1535 | return obj.getValidators() |
| 1536 | except: |
| 1537 | return None
|
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 1538 | class Meta:
|
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 1539 | model = ReservedResource |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 1540 | fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','sliver','resource','quantity','reservationSet',) |
Scott Baker | 8b53319 | 2014-11-17 22:32:19 -0800 | [diff] [blame] | 1541 | |
| 1542 | |
| 1543 | |
| 1544 | |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 1545 | class PaymentSerializer(serializers.HyperlinkedModelSerializer): |
Scott Baker | f0480fb | 2014-12-23 11:12:07 -0800 | [diff] [blame] | 1546 | id = IdField() |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 1547 | |
| 1548 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
| 1549 | validators = serializers.SerializerMethodField("getValidators") |
| 1550 | def getHumanReadableName(self, obj):
|
| 1551 | return str(obj) |
| 1552 | def getValidators(self, obj): |
| 1553 | try: |
| 1554 | return obj.getValidators() |
| 1555 | except: |
| 1556 | return None |
| 1557 | class Meta: |
| 1558 | model = Payment |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 1559 | fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','account','amount','date',) |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 1560 | |
| 1561 | class PaymentIdSerializer(XOSModelSerializer): |
Scott Baker | f0480fb | 2014-12-23 11:12:07 -0800 | [diff] [blame] | 1562 | id = IdField() |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 1563 | |
| 1564 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
| 1565 | validators = serializers.SerializerMethodField("getValidators") |
| 1566 | def getHumanReadableName(self, obj):
|
| 1567 | return str(obj)
|
| 1568 | def getValidators(self, obj):
|
| 1569 | try: |
| 1570 | return obj.getValidators() |
| 1571 | except: |
| 1572 | return None
|
| 1573 | class Meta:
|
| 1574 | model = Payment |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 1575 | fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','account','amount','date',) |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 1576 | |
| 1577 | |
| 1578 | |
| 1579 | |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 1580 | class NetworkSliceSerializer(serializers.HyperlinkedModelSerializer): |
Scott Baker | f0480fb | 2014-12-23 11:12:07 -0800 | [diff] [blame] | 1581 | id = IdField() |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 1582 | |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 1583 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 1584 | validators = serializers.SerializerMethodField("getValidators") |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 1585 | def getHumanReadableName(self, obj):
|
| 1586 | return str(obj) |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 1587 | def getValidators(self, obj): |
| 1588 | try: |
| 1589 | return obj.getValidators() |
| 1590 | except: |
| 1591 | return None |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 1592 | class Meta: |
| 1593 | model = NetworkSlice |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 1594 | fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','network','slice',) |
Scott Baker | 46b5854 | 2014-08-11 17:26:12 -0700 | [diff] [blame] | 1595 | |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 1596 | class NetworkSliceIdSerializer(XOSModelSerializer): |
Scott Baker | f0480fb | 2014-12-23 11:12:07 -0800 | [diff] [blame] | 1597 | id = IdField() |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 1598 | |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 1599 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 1600 | validators = serializers.SerializerMethodField("getValidators") |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 1601 | def getHumanReadableName(self, obj):
|
| 1602 | return str(obj)
|
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 1603 | def getValidators(self, obj):
|
| 1604 | try: |
| 1605 | return obj.getValidators() |
| 1606 | except: |
| 1607 | return None
|
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 1608 | class Meta:
|
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 1609 | model = NetworkSlice |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 1610 | fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','network','slice',) |
Scott Baker | 46b5854 | 2014-08-11 17:26:12 -0700 | [diff] [blame] | 1611 | |
| 1612 | |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 1613 | |
| 1614 | |
| 1615 | class UserDashboardViewSerializer(serializers.HyperlinkedModelSerializer): |
Scott Baker | f0480fb | 2014-12-23 11:12:07 -0800 | [diff] [blame] | 1616 | id = IdField() |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 1617 | |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 1618 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 1619 | validators = serializers.SerializerMethodField("getValidators") |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 1620 | def getHumanReadableName(self, obj):
|
| 1621 | return str(obj) |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 1622 | def getValidators(self, obj): |
| 1623 | try: |
| 1624 | return obj.getValidators() |
| 1625 | except: |
| 1626 | return None |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 1627 | class Meta: |
| 1628 | model = UserDashboardView |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 1629 | fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','user','dashboardView','order',) |
Scott Baker | 46b5854 | 2014-08-11 17:26:12 -0700 | [diff] [blame] | 1630 | |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 1631 | class UserDashboardViewIdSerializer(XOSModelSerializer): |
Scott Baker | f0480fb | 2014-12-23 11:12:07 -0800 | [diff] [blame] | 1632 | id = IdField() |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 1633 | |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 1634 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 1635 | validators = serializers.SerializerMethodField("getValidators") |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 1636 | def getHumanReadableName(self, obj):
|
| 1637 | return str(obj)
|
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 1638 | def getValidators(self, obj):
|
| 1639 | try: |
| 1640 | return obj.getValidators() |
| 1641 | except: |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 1642 | return None
|
| 1643 | class Meta:
|
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 1644 | model = UserDashboardView |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 1645 | fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','user','dashboardView','order',) |
Scott Baker | 8b53319 | 2014-11-17 22:32:19 -0800 | [diff] [blame] | 1646 | |
| 1647 | |
| 1648 | |
| 1649 | |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 1650 | class ControllerSerializer(serializers.HyperlinkedModelSerializer): |
Scott Baker | f0480fb | 2014-12-23 11:12:07 -0800 | [diff] [blame] | 1651 | id = IdField() |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 1652 | |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 1653 | |
| 1654 | dashboardviews = serializers.HyperlinkedRelatedField(many=True, read_only=True, view_name='dashboardview-detail') |
| 1655 | |
| 1656 | |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 1657 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 1658 | validators = serializers.SerializerMethodField("getValidators") |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 1659 | def getHumanReadableName(self, obj):
|
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 1660 | return str(obj) |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 1661 | def getValidators(self, obj): |
| 1662 | try: |
| 1663 | return obj.getValidators() |
| 1664 | except: |
| 1665 | return None |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 1666 | class Meta: |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 1667 | model = Controller |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 1668 | fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','name','backend_type','version','auth_url','admin_user','admin_password','admin_tenant','dashboardviews',) |
Scott Baker | 46b5854 | 2014-08-11 17:26:12 -0700 | [diff] [blame] | 1669 | |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 1670 | class ControllerIdSerializer(XOSModelSerializer): |
Scott Baker | f0480fb | 2014-12-23 11:12:07 -0800 | [diff] [blame] | 1671 | id = IdField() |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 1672 | |
| 1673 | |
Scott Baker | 201f7da | 2014-12-23 10:56:06 -0800 | [diff] [blame] | 1674 | dashboardviews = serializers.PrimaryKeyRelatedField(many=True, queryset = DashboardView.objects.all()) |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 1675 | |
| 1676 | |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 1677 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 1678 | validators = serializers.SerializerMethodField("getValidators") |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 1679 | def getHumanReadableName(self, obj):
|
| 1680 | return str(obj)
|
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 1681 | def getValidators(self, obj):
|
| 1682 | try: |
| 1683 | return obj.getValidators() |
| 1684 | except: |
| 1685 | return None
|
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 1686 | class Meta:
|
| 1687 | model = Controller |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 1688 | fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','name','backend_type','version','auth_url','admin_user','admin_password','admin_tenant','dashboardviews',) |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 1689 | |
| 1690 | |
| 1691 | |
| 1692 | |
| 1693 | class PlanetStackPrivilegeSerializer(serializers.HyperlinkedModelSerializer): |
Scott Baker | f0480fb | 2014-12-23 11:12:07 -0800 | [diff] [blame] | 1694 | id = IdField() |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 1695 | |
| 1696 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
| 1697 | validators = serializers.SerializerMethodField("getValidators") |
| 1698 | def getHumanReadableName(self, obj):
|
| 1699 | return str(obj) |
| 1700 | def getValidators(self, obj): |
| 1701 | try: |
| 1702 | return obj.getValidators() |
| 1703 | except: |
| 1704 | return None |
| 1705 | class Meta: |
| 1706 | model = PlanetStackPrivilege |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 1707 | fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','user','planetstack','role',) |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 1708 | |
| 1709 | class PlanetStackPrivilegeIdSerializer(XOSModelSerializer): |
Scott Baker | f0480fb | 2014-12-23 11:12:07 -0800 | [diff] [blame] | 1710 | id = IdField() |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 1711 | |
| 1712 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
| 1713 | validators = serializers.SerializerMethodField("getValidators") |
| 1714 | def getHumanReadableName(self, obj):
|
| 1715 | return str(obj)
|
| 1716 | def getValidators(self, obj):
|
| 1717 | try: |
| 1718 | return obj.getValidators() |
| 1719 | except: |
| 1720 | return None
|
| 1721 | class Meta:
|
| 1722 | model = PlanetStackPrivilege |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 1723 | fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','user','planetstack','role',) |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 1724 | |
| 1725 | |
| 1726 | |
| 1727 | |
| 1728 | class UserSerializer(serializers.HyperlinkedModelSerializer): |
Scott Baker | f0480fb | 2014-12-23 11:12:07 -0800 | [diff] [blame] | 1729 | id = IdField() |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 1730 | |
| 1731 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
| 1732 | validators = serializers.SerializerMethodField("getValidators") |
| 1733 | def getHumanReadableName(self, obj):
|
| 1734 | return str(obj) |
| 1735 | def getValidators(self, obj): |
| 1736 | try: |
| 1737 | return obj.getValidators() |
| 1738 | except: |
| 1739 | return None |
| 1740 | class Meta: |
| 1741 | model = User |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 1742 | fields = ('humanReadableName', 'validators', 'id','password','last_login','email','username','firstname','lastname','phone','user_url','site','public_key','is_active','is_admin','is_staff','is_readonly','is_registering','created','updated','enacted','policed','backend_status','deleted','timezone',) |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 1743 | |
| 1744 | class UserIdSerializer(XOSModelSerializer): |
Scott Baker | f0480fb | 2014-12-23 11:12:07 -0800 | [diff] [blame] | 1745 | id = IdField() |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 1746 | |
| 1747 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
| 1748 | validators = serializers.SerializerMethodField("getValidators") |
| 1749 | def getHumanReadableName(self, obj):
|
| 1750 | return str(obj)
|
| 1751 | def getValidators(self, obj):
|
| 1752 | try: |
| 1753 | return obj.getValidators() |
| 1754 | except: |
| 1755 | return None
|
| 1756 | class Meta:
|
| 1757 | model = User |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 1758 | fields = ('humanReadableName', 'validators', 'id','password','last_login','email','username','firstname','lastname','phone','user_url','site','public_key','is_active','is_admin','is_staff','is_readonly','is_registering','created','updated','enacted','policed','backend_status','deleted','timezone',) |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 1759 | |
| 1760 | |
| 1761 | |
| 1762 | |
| 1763 | class DeploymentSerializer(serializers.HyperlinkedModelSerializer): |
Scott Baker | f0480fb | 2014-12-23 11:12:07 -0800 | [diff] [blame] | 1764 | id = IdField() |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 1765 | |
| 1766 | |
Scott Baker | bf4ef6d | 2014-12-22 15:59:33 -0800 | [diff] [blame] | 1767 | images = serializers.HyperlinkedRelatedField(many=True, read_only=True, view_name='image-detail') |
| 1768 | |
| 1769 | |
| 1770 | |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 1771 | sites = serializers.HyperlinkedRelatedField(many=True, read_only=True, view_name='site-detail') |
| 1772 | |
| 1773 | |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 1774 | |
| 1775 | flavors = serializers.HyperlinkedRelatedField(many=True, read_only=True, view_name='flavor-detail') |
| 1776 | |
| 1777 | |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 1778 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
| 1779 | validators = serializers.SerializerMethodField("getValidators") |
| 1780 | def getHumanReadableName(self, obj):
|
| 1781 | return str(obj) |
| 1782 | def getValidators(self, obj): |
| 1783 | try: |
| 1784 | return obj.getValidators() |
| 1785 | except: |
| 1786 | return None |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 1787 | class Meta: |
| 1788 | model = Deployment |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 1789 | fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','name','accessControl','images','sites','flavors',) |
Scott Baker | 46b5854 | 2014-08-11 17:26:12 -0700 | [diff] [blame] | 1790 | |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 1791 | class DeploymentIdSerializer(XOSModelSerializer): |
Scott Baker | f0480fb | 2014-12-23 11:12:07 -0800 | [diff] [blame] | 1792 | id = IdField() |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 1793 | |
| 1794 | |
Scott Baker | 201f7da | 2014-12-23 10:56:06 -0800 | [diff] [blame] | 1795 | images = serializers.PrimaryKeyRelatedField(many=True, queryset = Image.objects.all()) |
Scott Baker | bf4ef6d | 2014-12-22 15:59:33 -0800 | [diff] [blame] | 1796 | |
| 1797 | |
| 1798 | |
Scott Baker | 201f7da | 2014-12-23 10:56:06 -0800 | [diff] [blame] | 1799 | sites = serializers.PrimaryKeyRelatedField(many=True, queryset = Site.objects.all()) |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 1800 | |
| 1801 | |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 1802 | |
| 1803 | flavors = serializers.PrimaryKeyRelatedField(many=True, queryset = Flavor.objects.all()) |
| 1804 | |
| 1805 | |
Tony Mack | 06c8e47 | 2014-11-30 15:53:08 -0500 | [diff] [blame] | 1806 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
| 1807 | validators = serializers.SerializerMethodField("getValidators") |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 1808 | def getHumanReadableName(self, obj):
|
| 1809 | return str(obj)
|
| 1810 | def getValidators(self, obj):
|
Tony Mack | 06c8e47 | 2014-11-30 15:53:08 -0500 | [diff] [blame] | 1811 | try: |
| 1812 | return obj.getValidators() |
| 1813 | except: |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 1814 | return None
|
| 1815 | class Meta:
|
| 1816 | model = Deployment |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 1817 | fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','name','accessControl','images','sites','flavors',) |
Tony Mack | 06c8e47 | 2014-11-30 15:53:08 -0500 | [diff] [blame] | 1818 | |
| 1819 | |
Sapan Bhatia | dea3943 | 2014-06-13 03:10:36 -0400 | [diff] [blame] | 1820 | |
| 1821 | |
| 1822 | class ReservationSerializer(serializers.HyperlinkedModelSerializer): |
Scott Baker | f0480fb | 2014-12-23 11:12:07 -0800 | [diff] [blame] | 1823 | id = IdField() |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 1824 | |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 1825 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 1826 | validators = serializers.SerializerMethodField("getValidators") |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 1827 | def getHumanReadableName(self, obj):
|
| 1828 | return str(obj) |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 1829 | def getValidators(self, obj): |
| 1830 | try: |
| 1831 | return obj.getValidators() |
| 1832 | except: |
| 1833 | return None |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 1834 | class Meta: |
| 1835 | model = Reservation |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 1836 | fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','startTime','slice','duration',) |
Scott Baker | 46b5854 | 2014-08-11 17:26:12 -0700 | [diff] [blame] | 1837 | |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 1838 | class ReservationIdSerializer(XOSModelSerializer): |
Scott Baker | f0480fb | 2014-12-23 11:12:07 -0800 | [diff] [blame] | 1839 | id = IdField() |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 1840 | |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 1841 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 1842 | validators = serializers.SerializerMethodField("getValidators") |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 1843 | def getHumanReadableName(self, obj):
|
| 1844 | return str(obj)
|
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 1845 | def getValidators(self, obj):
|
| 1846 | try: |
| 1847 | return obj.getValidators() |
| 1848 | except: |
| 1849 | return None
|
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 1850 | class Meta:
|
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 1851 | model = Reservation |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 1852 | fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','startTime','slice','duration',) |
Scott Baker | 46b5854 | 2014-08-11 17:26:12 -0700 | [diff] [blame] | 1853 | |
| 1854 | |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 1855 | |
| 1856 | |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 1857 | class SitePrivilegeSerializer(serializers.HyperlinkedModelSerializer): |
Scott Baker | f0480fb | 2014-12-23 11:12:07 -0800 | [diff] [blame] | 1858 | id = IdField() |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 1859 | |
| 1860 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 1861 | validators = serializers.SerializerMethodField("getValidators") |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 1862 | def getHumanReadableName(self, obj):
|
| 1863 | return str(obj) |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 1864 | def getValidators(self, obj): |
| 1865 | try: |
| 1866 | return obj.getValidators() |
| 1867 | except: |
| 1868 | return None |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 1869 | class Meta: |
| 1870 | model = SitePrivilege |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 1871 | fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','user','site','role',) |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 1872 | |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 1873 | class SitePrivilegeIdSerializer(XOSModelSerializer): |
Scott Baker | f0480fb | 2014-12-23 11:12:07 -0800 | [diff] [blame] | 1874 | id = IdField() |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 1875 | |
| 1876 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 1877 | validators = serializers.SerializerMethodField("getValidators") |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 1878 | def getHumanReadableName(self, obj):
|
| 1879 | return str(obj)
|
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 1880 | def getValidators(self, obj):
|
| 1881 | try: |
| 1882 | return obj.getValidators() |
| 1883 | except: |
| 1884 | return None
|
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 1885 | class Meta:
|
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 1886 | model = SitePrivilege |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 1887 | fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','user','site','role',) |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 1888 | |
| 1889 | |
| 1890 | |
| 1891 | |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 1892 | class ControllerSliceSerializer(serializers.HyperlinkedModelSerializer): |
Scott Baker | f0480fb | 2014-12-23 11:12:07 -0800 | [diff] [blame] | 1893 | id = IdField() |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 1894 | |
| 1895 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 1896 | validators = serializers.SerializerMethodField("getValidators") |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 1897 | def getHumanReadableName(self, obj):
|
| 1898 | return str(obj) |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 1899 | def getValidators(self, obj): |
| 1900 | try: |
| 1901 | return obj.getValidators() |
| 1902 | except: |
| 1903 | return None |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 1904 | class Meta: |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 1905 | model = ControllerSlice |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 1906 | fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','controller','slice','tenant_id',) |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 1907 | |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 1908 | class ControllerSliceIdSerializer(XOSModelSerializer): |
Scott Baker | f0480fb | 2014-12-23 11:12:07 -0800 | [diff] [blame] | 1909 | id = IdField() |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 1910 | |
| 1911 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 1912 | validators = serializers.SerializerMethodField("getValidators") |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 1913 | def getHumanReadableName(self, obj):
|
| 1914 | return str(obj)
|
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 1915 | def getValidators(self, obj):
|
| 1916 | try: |
| 1917 | return obj.getValidators() |
| 1918 | except: |
| 1919 | return None
|
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 1920 | class Meta:
|
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 1921 | model = ControllerSlice |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 1922 | fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','controller','slice','tenant_id',) |
Scott Baker | 46b5854 | 2014-08-11 17:26:12 -0700 | [diff] [blame] | 1923 | |
| 1924 | |
Sapan Bhatia | dea3943 | 2014-06-13 03:10:36 -0400 | [diff] [blame] | 1925 | |
| 1926 | |
Scott Baker | f2c0c51 | 2014-12-22 17:35:34 -0800 | [diff] [blame] | 1927 | class ControllerDashboardViewSerializer(serializers.HyperlinkedModelSerializer): |
Scott Baker | f0480fb | 2014-12-23 11:12:07 -0800 | [diff] [blame] | 1928 | id = IdField() |
Scott Baker | f2c0c51 | 2014-12-22 17:35:34 -0800 | [diff] [blame] | 1929 | |
| 1930 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
| 1931 | validators = serializers.SerializerMethodField("getValidators") |
| 1932 | def getHumanReadableName(self, obj):
|
| 1933 | return str(obj) |
| 1934 | def getValidators(self, obj): |
| 1935 | try: |
| 1936 | return obj.getValidators() |
| 1937 | except: |
| 1938 | return None |
| 1939 | class Meta: |
| 1940 | model = ControllerDashboardView |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 1941 | fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','controller','dashboardView','enabled','url',) |
Scott Baker | f2c0c51 | 2014-12-22 17:35:34 -0800 | [diff] [blame] | 1942 | |
| 1943 | class ControllerDashboardViewIdSerializer(XOSModelSerializer): |
Scott Baker | f0480fb | 2014-12-23 11:12:07 -0800 | [diff] [blame] | 1944 | id = IdField() |
Scott Baker | f2c0c51 | 2014-12-22 17:35:34 -0800 | [diff] [blame] | 1945 | |
| 1946 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
| 1947 | validators = serializers.SerializerMethodField("getValidators") |
| 1948 | def getHumanReadableName(self, obj):
|
| 1949 | return str(obj)
|
| 1950 | def getValidators(self, obj):
|
| 1951 | try: |
| 1952 | return obj.getValidators() |
| 1953 | except: |
| 1954 | return None
|
| 1955 | class Meta:
|
| 1956 | model = ControllerDashboardView |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 1957 | fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','controller','dashboardView','enabled','url',) |
Scott Baker | f2c0c51 | 2014-12-22 17:35:34 -0800 | [diff] [blame] | 1958 | |
| 1959 | |
| 1960 | |
| 1961 | |
Sapan Bhatia | dea3943 | 2014-06-13 03:10:36 -0400 | [diff] [blame] | 1962 | class AccountSerializer(serializers.HyperlinkedModelSerializer): |
Scott Baker | f0480fb | 2014-12-23 11:12:07 -0800 | [diff] [blame] | 1963 | id = IdField() |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 1964 | |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 1965 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 1966 | validators = serializers.SerializerMethodField("getValidators") |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 1967 | def getHumanReadableName(self, obj):
|
| 1968 | return str(obj) |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 1969 | def getValidators(self, obj): |
| 1970 | try: |
| 1971 | return obj.getValidators() |
| 1972 | except: |
| 1973 | return None |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 1974 | class Meta: |
| 1975 | model = Account |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 1976 | fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','site',) |
Scott Baker | 46b5854 | 2014-08-11 17:26:12 -0700 | [diff] [blame] | 1977 | |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 1978 | class AccountIdSerializer(XOSModelSerializer): |
Scott Baker | f0480fb | 2014-12-23 11:12:07 -0800 | [diff] [blame] | 1979 | id = IdField() |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 1980 | |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 1981 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 1982 | validators = serializers.SerializerMethodField("getValidators") |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 1983 | def getHumanReadableName(self, obj):
|
| 1984 | return str(obj)
|
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 1985 | def getValidators(self, obj):
|
| 1986 | try: |
| 1987 | return obj.getValidators() |
| 1988 | except: |
| 1989 | return None
|
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 1990 | class Meta:
|
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 1991 | model = Account |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 1992 | fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','site',) |
Scott Baker | 46b5854 | 2014-08-11 17:26:12 -0700 | [diff] [blame] | 1993 | |
| 1994 | |
Sapan Bhatia | dea3943 | 2014-06-13 03:10:36 -0400 | [diff] [blame] | 1995 | |
| 1996 | |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 1997 | class ControllerRoleSerializer(serializers.HyperlinkedModelSerializer): |
Scott Baker | f0480fb | 2014-12-23 11:12:07 -0800 | [diff] [blame] | 1998 | id = IdField() |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 1999 | |
| 2000 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
| 2001 | validators = serializers.SerializerMethodField("getValidators") |
| 2002 | def getHumanReadableName(self, obj):
|
| 2003 | return str(obj) |
| 2004 | def getValidators(self, obj): |
| 2005 | try: |
| 2006 | return obj.getValidators() |
| 2007 | except: |
| 2008 | return None |
| 2009 | class Meta: |
| 2010 | model = ControllerRole |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 2011 | fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','role',) |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 2012 | |
| 2013 | class ControllerRoleIdSerializer(XOSModelSerializer): |
Scott Baker | f0480fb | 2014-12-23 11:12:07 -0800 | [diff] [blame] | 2014 | id = IdField() |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 2015 | |
| 2016 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
| 2017 | validators = serializers.SerializerMethodField("getValidators") |
| 2018 | def getHumanReadableName(self, obj):
|
| 2019 | return str(obj)
|
| 2020 | def getValidators(self, obj):
|
| 2021 | try: |
| 2022 | return obj.getValidators() |
| 2023 | except: |
| 2024 | return None
|
| 2025 | class Meta:
|
| 2026 | model = ControllerRole |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 2027 | fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','role',) |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 2028 | |
| 2029 | |
| 2030 | |
| 2031 | |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 2032 | class NetworkParameterTypeSerializer(serializers.HyperlinkedModelSerializer): |
Scott Baker | f0480fb | 2014-12-23 11:12:07 -0800 | [diff] [blame] | 2033 | id = IdField() |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 2034 | |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 2035 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 2036 | validators = serializers.SerializerMethodField("getValidators") |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 2037 | def getHumanReadableName(self, obj):
|
| 2038 | return str(obj) |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 2039 | def getValidators(self, obj): |
| 2040 | try: |
| 2041 | return obj.getValidators() |
| 2042 | except: |
| 2043 | return None |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 2044 | class Meta: |
| 2045 | model = NetworkParameterType |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 2046 | fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','name','description',) |
Scott Baker | 46b5854 | 2014-08-11 17:26:12 -0700 | [diff] [blame] | 2047 | |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 2048 | class NetworkParameterTypeIdSerializer(XOSModelSerializer): |
Scott Baker | f0480fb | 2014-12-23 11:12:07 -0800 | [diff] [blame] | 2049 | id = IdField() |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 2050 | |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 2051 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 2052 | validators = serializers.SerializerMethodField("getValidators") |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 2053 | def getHumanReadableName(self, obj):
|
| 2054 | return str(obj)
|
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 2055 | def getValidators(self, obj):
|
| 2056 | try: |
| 2057 | return obj.getValidators() |
| 2058 | except: |
| 2059 | return None
|
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 2060 | class Meta:
|
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 2061 | model = NetworkParameterType |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 2062 | fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','name','description',) |
Scott Baker | 46b5854 | 2014-08-11 17:26:12 -0700 | [diff] [blame] | 2063 | |
| 2064 | |
Sapan Bhatia | dea3943 | 2014-06-13 03:10:36 -0400 | [diff] [blame] | 2065 | |
| 2066 | |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 2067 | class SiteCredentialSerializer(serializers.HyperlinkedModelSerializer): |
Scott Baker | f0480fb | 2014-12-23 11:12:07 -0800 | [diff] [blame] | 2068 | id = IdField() |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 2069 | |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 2070 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 2071 | validators = serializers.SerializerMethodField("getValidators") |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 2072 | def getHumanReadableName(self, obj):
|
| 2073 | return str(obj) |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 2074 | def getValidators(self, obj): |
| 2075 | try: |
| 2076 | return obj.getValidators() |
| 2077 | except: |
| 2078 | return None |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 2079 | class Meta: |
| 2080 | model = SiteCredential |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 2081 | fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','site','name','key_id','enc_value',) |
Scott Baker | 46b5854 | 2014-08-11 17:26:12 -0700 | [diff] [blame] | 2082 | |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 2083 | class SiteCredentialIdSerializer(XOSModelSerializer): |
Scott Baker | f0480fb | 2014-12-23 11:12:07 -0800 | [diff] [blame] | 2084 | id = IdField() |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 2085 | |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 2086 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 2087 | validators = serializers.SerializerMethodField("getValidators") |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 2088 | def getHumanReadableName(self, obj):
|
| 2089 | return str(obj)
|
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 2090 | def getValidators(self, obj):
|
| 2091 | try: |
| 2092 | return obj.getValidators() |
| 2093 | except: |
| 2094 | return None
|
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 2095 | class Meta:
|
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 2096 | model = SiteCredential |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 2097 | fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','site','name','key_id','enc_value',) |
Scott Baker | 46b5854 | 2014-08-11 17:26:12 -0700 | [diff] [blame] | 2098 | |
| 2099 | |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 2100 | |
| 2101 | |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 2102 | class DeploymentPrivilegeSerializer(serializers.HyperlinkedModelSerializer): |
Scott Baker | f0480fb | 2014-12-23 11:12:07 -0800 | [diff] [blame] | 2103 | id = IdField() |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 2104 | |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 2105 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 2106 | validators = serializers.SerializerMethodField("getValidators") |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 2107 | def getHumanReadableName(self, obj):
|
| 2108 | return str(obj) |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 2109 | def getValidators(self, obj): |
| 2110 | try: |
| 2111 | return obj.getValidators() |
| 2112 | except: |
| 2113 | return None |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 2114 | class Meta: |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 2115 | model = DeploymentPrivilege |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 2116 | fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','user','deployment','role',) |
Scott Baker | 46b5854 | 2014-08-11 17:26:12 -0700 | [diff] [blame] | 2117 | |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 2118 | class DeploymentPrivilegeIdSerializer(XOSModelSerializer): |
Scott Baker | f0480fb | 2014-12-23 11:12:07 -0800 | [diff] [blame] | 2119 | id = IdField() |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 2120 | |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 2121 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 2122 | validators = serializers.SerializerMethodField("getValidators") |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 2123 | def getHumanReadableName(self, obj):
|
| 2124 | return str(obj)
|
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 2125 | def getValidators(self, obj):
|
| 2126 | try: |
| 2127 | return obj.getValidators() |
| 2128 | except: |
| 2129 | return None
|
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 2130 | class Meta:
|
| 2131 | model = DeploymentPrivilege |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 2132 | fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','user','deployment','role',) |
Scott Baker | 8b53319 | 2014-11-17 22:32:19 -0800 | [diff] [blame] | 2133 | |
| 2134 | |
| 2135 | |
| 2136 | |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 2137 | class ControllerSlicePrivilegeSerializer(serializers.HyperlinkedModelSerializer): |
Scott Baker | f0480fb | 2014-12-23 11:12:07 -0800 | [diff] [blame] | 2138 | id = IdField() |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 2139 | |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 2140 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 2141 | validators = serializers.SerializerMethodField("getValidators") |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 2142 | def getHumanReadableName(self, obj):
|
| 2143 | return str(obj) |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 2144 | def getValidators(self, obj): |
| 2145 | try: |
| 2146 | return obj.getValidators() |
| 2147 | except: |
| 2148 | return None |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 2149 | class Meta: |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 2150 | model = ControllerSlicePrivilege |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 2151 | fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','controller','slice_privilege','role_id',) |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 2152 | |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 2153 | class ControllerSlicePrivilegeIdSerializer(XOSModelSerializer): |
Scott Baker | f0480fb | 2014-12-23 11:12:07 -0800 | [diff] [blame] | 2154 | id = IdField() |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 2155 | |
| 2156 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
| 2157 | validators = serializers.SerializerMethodField("getValidators") |
| 2158 | def getHumanReadableName(self, obj):
|
| 2159 | return str(obj)
|
| 2160 | def getValidators(self, obj):
|
| 2161 | try: |
| 2162 | return obj.getValidators() |
| 2163 | except: |
| 2164 | return None
|
| 2165 | class Meta:
|
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 2166 | model = ControllerSlicePrivilege |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 2167 | fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','controller','slice_privilege','role_id',) |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 2168 | |
| 2169 | |
| 2170 | |
| 2171 | |
| 2172 | class SiteDeploymentSerializer(serializers.HyperlinkedModelSerializer): |
| 2173 | id = IdField() |
| 2174 | |
| 2175 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
| 2176 | validators = serializers.SerializerMethodField("getValidators") |
| 2177 | def getHumanReadableName(self, obj):
|
| 2178 | return str(obj) |
| 2179 | def getValidators(self, obj): |
| 2180 | try: |
| 2181 | return obj.getValidators() |
| 2182 | except: |
| 2183 | return None |
| 2184 | class Meta: |
| 2185 | model = SiteDeployment |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 2186 | fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','site','deployment','controller','availability_zone',) |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 2187 | |
| 2188 | class SiteDeploymentIdSerializer(XOSModelSerializer): |
| 2189 | id = IdField() |
| 2190 | |
| 2191 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
| 2192 | validators = serializers.SerializerMethodField("getValidators") |
| 2193 | def getHumanReadableName(self, obj):
|
| 2194 | return str(obj)
|
| 2195 | def getValidators(self, obj):
|
| 2196 | try: |
| 2197 | return obj.getValidators() |
| 2198 | except: |
| 2199 | return None
|
| 2200 | class Meta:
|
| 2201 | model = SiteDeployment |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 2202 | fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','site','deployment','controller','availability_zone',) |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 2203 | |
| 2204 | |
| 2205 | |
| 2206 | |
| 2207 | class DeploymentRoleSerializer(serializers.HyperlinkedModelSerializer): |
Scott Baker | f0480fb | 2014-12-23 11:12:07 -0800 | [diff] [blame] | 2208 | id = IdField() |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 2209 | |
| 2210 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
| 2211 | validators = serializers.SerializerMethodField("getValidators") |
| 2212 | def getHumanReadableName(self, obj):
|
| 2213 | return str(obj) |
| 2214 | def getValidators(self, obj): |
| 2215 | try: |
| 2216 | return obj.getValidators() |
| 2217 | except: |
| 2218 | return None |
| 2219 | class Meta: |
| 2220 | model = DeploymentRole |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 2221 | fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','role',) |
Scott Baker | 46b5854 | 2014-08-11 17:26:12 -0700 | [diff] [blame] | 2222 | |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 2223 | class DeploymentRoleIdSerializer(XOSModelSerializer): |
Scott Baker | f0480fb | 2014-12-23 11:12:07 -0800 | [diff] [blame] | 2224 | id = IdField() |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 2225 | |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 2226 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 2227 | validators = serializers.SerializerMethodField("getValidators") |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 2228 | def getHumanReadableName(self, obj):
|
| 2229 | return str(obj)
|
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 2230 | def getValidators(self, obj):
|
| 2231 | try: |
| 2232 | return obj.getValidators() |
| 2233 | except: |
| 2234 | return None
|
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 2235 | class Meta:
|
| 2236 | model = DeploymentRole |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 2237 | fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','role',) |
Scott Baker | 46b5854 | 2014-08-11 17:26:12 -0700 | [diff] [blame] | 2238 | |
| 2239 | |
Sapan Bhatia | dea3943 | 2014-06-13 03:10:36 -0400 | [diff] [blame] | 2240 | |
| 2241 | |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 2242 | class UserCredentialSerializer(serializers.HyperlinkedModelSerializer): |
Scott Baker | f0480fb | 2014-12-23 11:12:07 -0800 | [diff] [blame] | 2243 | id = IdField() |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 2244 | |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 2245 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 2246 | validators = serializers.SerializerMethodField("getValidators") |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 2247 | def getHumanReadableName(self, obj):
|
| 2248 | return str(obj) |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 2249 | def getValidators(self, obj): |
| 2250 | try: |
| 2251 | return obj.getValidators() |
| 2252 | except: |
| 2253 | return None |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 2254 | class Meta: |
| 2255 | model = UserCredential |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 2256 | fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','user','name','key_id','enc_value',) |
Scott Baker | 46b5854 | 2014-08-11 17:26:12 -0700 | [diff] [blame] | 2257 | |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 2258 | class UserCredentialIdSerializer(XOSModelSerializer): |
Scott Baker | f0480fb | 2014-12-23 11:12:07 -0800 | [diff] [blame] | 2259 | id = IdField() |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 2260 | |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 2261 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 2262 | validators = serializers.SerializerMethodField("getValidators") |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 2263 | def getHumanReadableName(self, obj):
|
| 2264 | return str(obj)
|
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 2265 | def getValidators(self, obj):
|
| 2266 | try: |
| 2267 | return obj.getValidators() |
| 2268 | except: |
| 2269 | return None
|
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 2270 | class Meta:
|
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 2271 | model = UserCredential |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 2272 | fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','user','name','key_id','enc_value',) |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 2273 | |
| 2274 | |
| 2275 | |
| 2276 | |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 2277 | class SliceTagSerializer(serializers.HyperlinkedModelSerializer): |
Scott Baker | f0480fb | 2014-12-23 11:12:07 -0800 | [diff] [blame] | 2278 | id = IdField() |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 2279 | |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 2280 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 2281 | validators = serializers.SerializerMethodField("getValidators") |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 2282 | def getHumanReadableName(self, obj):
|
| 2283 | return str(obj) |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 2284 | def getValidators(self, obj): |
| 2285 | try: |
| 2286 | return obj.getValidators() |
| 2287 | except: |
| 2288 | return None |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 2289 | class Meta: |
| 2290 | model = SliceTag |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 2291 | fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','slice','name','value',) |
Scott Baker | 46b5854 | 2014-08-11 17:26:12 -0700 | [diff] [blame] | 2292 | |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 2293 | class SliceTagIdSerializer(XOSModelSerializer): |
Scott Baker | f0480fb | 2014-12-23 11:12:07 -0800 | [diff] [blame] | 2294 | id = IdField() |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 2295 | |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 2296 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 2297 | validators = serializers.SerializerMethodField("getValidators") |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 2298 | def getHumanReadableName(self, obj):
|
| 2299 | return str(obj)
|
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 2300 | def getValidators(self, obj):
|
| 2301 | try: |
| 2302 | return obj.getValidators() |
| 2303 | except: |
| 2304 | return None
|
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 2305 | class Meta:
|
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 2306 | model = SliceTag |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 2307 | fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','slice','name','value',) |
Scott Baker | 46b5854 | 2014-08-11 17:26:12 -0700 | [diff] [blame] | 2308 | |
| 2309 | |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 2310 | |
| 2311 | |
Scott Baker | f2c0c51 | 2014-12-22 17:35:34 -0800 | [diff] [blame] | 2312 | class NetworkTemplateSerializer(serializers.HyperlinkedModelSerializer): |
Scott Baker | f0480fb | 2014-12-23 11:12:07 -0800 | [diff] [blame] | 2313 | id = IdField() |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 2314 | |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 2315 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 2316 | validators = serializers.SerializerMethodField("getValidators") |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 2317 | def getHumanReadableName(self, obj):
|
| 2318 | return str(obj) |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 2319 | def getValidators(self, obj): |
| 2320 | try: |
| 2321 | return obj.getValidators() |
| 2322 | except: |
| 2323 | return None |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 2324 | class Meta: |
Scott Baker | f2c0c51 | 2014-12-22 17:35:34 -0800 | [diff] [blame] | 2325 | model = NetworkTemplate |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 2326 | fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','name','description','guaranteed_bandwidth','visibility','translation','shared_network_name','shared_network_id','topology_kind','controller_kind',) |
Scott Baker | 46b5854 | 2014-08-11 17:26:12 -0700 | [diff] [blame] | 2327 | |
Scott Baker | f2c0c51 | 2014-12-22 17:35:34 -0800 | [diff] [blame] | 2328 | class NetworkTemplateIdSerializer(XOSModelSerializer): |
Scott Baker | f0480fb | 2014-12-23 11:12:07 -0800 | [diff] [blame] | 2329 | id = IdField() |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 2330 | |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 2331 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 2332 | validators = serializers.SerializerMethodField("getValidators") |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 2333 | def getHumanReadableName(self, obj):
|
| 2334 | return str(obj)
|
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 2335 | def getValidators(self, obj):
|
| 2336 | try: |
| 2337 | return obj.getValidators() |
| 2338 | except: |
| 2339 | return None
|
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 2340 | class Meta:
|
Scott Baker | f2c0c51 | 2014-12-22 17:35:34 -0800 | [diff] [blame] | 2341 | model = NetworkTemplate |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 2342 | fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','name','description','guaranteed_bandwidth','visibility','translation','shared_network_name','shared_network_id','topology_kind','controller_kind',) |
Scott Baker | 46b5854 | 2014-08-11 17:26:12 -0700 | [diff] [blame] | 2343 | |
| 2344 | |
Sapan Bhatia | dea3943 | 2014-06-13 03:10:36 -0400 | [diff] [blame] | 2345 | |
| 2346 | |
| 2347 | class RouterSerializer(serializers.HyperlinkedModelSerializer): |
Scott Baker | f0480fb | 2014-12-23 11:12:07 -0800 | [diff] [blame] | 2348 | id = IdField() |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 2349 | |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 2350 | |
| 2351 | networks = serializers.HyperlinkedRelatedField(many=True, read_only=True, view_name='network-detail') |
| 2352 | |
| 2353 | |
| 2354 | |
| 2355 | networks = serializers.HyperlinkedRelatedField(many=True, read_only=True, view_name='network-detail') |
| 2356 | |
| 2357 | |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 2358 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 2359 | validators = serializers.SerializerMethodField("getValidators") |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 2360 | def getHumanReadableName(self, obj):
|
| 2361 | return str(obj) |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 2362 | def getValidators(self, obj): |
| 2363 | try: |
| 2364 | return obj.getValidators() |
| 2365 | except: |
| 2366 | return None |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 2367 | class Meta: |
| 2368 | model = Router |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 2369 | fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','name','owner','networks','networks',) |
Scott Baker | 46b5854 | 2014-08-11 17:26:12 -0700 | [diff] [blame] | 2370 | |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 2371 | class RouterIdSerializer(XOSModelSerializer): |
Scott Baker | f0480fb | 2014-12-23 11:12:07 -0800 | [diff] [blame] | 2372 | id = IdField() |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 2373 | |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 2374 | |
Scott Baker | 201f7da | 2014-12-23 10:56:06 -0800 | [diff] [blame] | 2375 | networks = serializers.PrimaryKeyRelatedField(many=True, queryset = Network.objects.all()) |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 2376 | |
| 2377 | |
| 2378 | |
Scott Baker | 201f7da | 2014-12-23 10:56:06 -0800 | [diff] [blame] | 2379 | networks = serializers.PrimaryKeyRelatedField(many=True, queryset = Network.objects.all()) |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 2380 | |
| 2381 | |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 2382 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 2383 | validators = serializers.SerializerMethodField("getValidators") |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 2384 | def getHumanReadableName(self, obj):
|
| 2385 | return str(obj)
|
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 2386 | def getValidators(self, obj):
|
| 2387 | try: |
| 2388 | return obj.getValidators() |
| 2389 | except: |
| 2390 | return None
|
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 2391 | class Meta:
|
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 2392 | model = Router |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 2393 | fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','name','owner','networks','networks',) |
Scott Baker | 46b5854 | 2014-08-11 17:26:12 -0700 | [diff] [blame] | 2394 | |
| 2395 | |
Sapan Bhatia | dea3943 | 2014-06-13 03:10:36 -0400 | [diff] [blame] | 2396 | |
| 2397 | |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 2398 | class ServiceResourceSerializer(serializers.HyperlinkedModelSerializer): |
Scott Baker | f0480fb | 2014-12-23 11:12:07 -0800 | [diff] [blame] | 2399 | id = IdField() |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 2400 | |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 2401 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 2402 | validators = serializers.SerializerMethodField("getValidators") |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 2403 | def getHumanReadableName(self, obj):
|
| 2404 | return str(obj) |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 2405 | def getValidators(self, obj): |
| 2406 | try: |
| 2407 | return obj.getValidators() |
| 2408 | except: |
| 2409 | return None |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 2410 | class Meta: |
| 2411 | model = ServiceResource |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 2412 | fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','serviceClass','name','maxUnitsDeployment','maxUnitsNode','maxDuration','bucketInRate','bucketMaxSize','cost','calendarReservable',) |
Scott Baker | 46b5854 | 2014-08-11 17:26:12 -0700 | [diff] [blame] | 2413 | |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 2414 | class ServiceResourceIdSerializer(XOSModelSerializer): |
Scott Baker | f0480fb | 2014-12-23 11:12:07 -0800 | [diff] [blame] | 2415 | id = IdField() |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 2416 | |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 2417 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 2418 | validators = serializers.SerializerMethodField("getValidators") |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 2419 | def getHumanReadableName(self, obj):
|
| 2420 | return str(obj)
|
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 2421 | def getValidators(self, obj):
|
| 2422 | try: |
| 2423 | return obj.getValidators() |
| 2424 | except: |
| 2425 | return None
|
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 2426 | class Meta:
|
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 2427 | model = ServiceResource |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 2428 | fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','serviceClass','name','maxUnitsDeployment','maxUnitsNode','maxDuration','bucketInRate','bucketMaxSize','cost','calendarReservable',) |
Scott Baker | 46b5854 | 2014-08-11 17:26:12 -0700 | [diff] [blame] | 2429 | |
| 2430 | |
Sapan Bhatia | dea3943 | 2014-06-13 03:10:36 -0400 | [diff] [blame] | 2431 | |
| 2432 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 2433 | serializerLookUp = { |
Sapan Bhatia | dea3943 | 2014-06-13 03:10:36 -0400 | [diff] [blame] | 2434 | |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 2435 | ServiceAttribute: ServiceAttributeSerializer, |
Sapan Bhatia | dea3943 | 2014-06-13 03:10:36 -0400 | [diff] [blame] | 2436 | |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 2437 | ControllerImages: ControllerImagesSerializer, |
| 2438 | |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 2439 | ControllerSitePrivilege: ControllerSitePrivilegeSerializer, |
| 2440 | |
Sapan Bhatia | dea3943 | 2014-06-13 03:10:36 -0400 | [diff] [blame] | 2441 | Image: ImageSerializer, |
| 2442 | |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 2443 | NetworkParameter: NetworkParameterSerializer, |
Sapan Bhatia | dea3943 | 2014-06-13 03:10:36 -0400 | [diff] [blame] | 2444 | |
| 2445 | Site: SiteSerializer, |
| 2446 | |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 2447 | SliceRole: SliceRoleSerializer, |
Sapan Bhatia | dea3943 | 2014-06-13 03:10:36 -0400 | [diff] [blame] | 2448 | |
| 2449 | Tag: TagSerializer, |
| 2450 | |
| 2451 | Invoice: InvoiceSerializer, |
| 2452 | |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 2453 | SlicePrivilege: SlicePrivilegeSerializer, |
Sapan Bhatia | dea3943 | 2014-06-13 03:10:36 -0400 | [diff] [blame] | 2454 | |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 2455 | PlanetStackRole: PlanetStackRoleSerializer, |
| 2456 | |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 2457 | NetworkSliver: NetworkSliverSerializer, |
Sapan Bhatia | dea3943 | 2014-06-13 03:10:36 -0400 | [diff] [blame] | 2458 | |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 2459 | Flavor: FlavorSerializer, |
| 2460 | |
| 2461 | ControllerSite: ControllerSiteSerializer, |
| 2462 | |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 2463 | Project: ProjectSerializer, |
| 2464 | |
Sapan Bhatia | dea3943 | 2014-06-13 03:10:36 -0400 | [diff] [blame] | 2465 | Slice: SliceSerializer, |
| 2466 | |
| 2467 | Network: NetworkSerializer, |
| 2468 | |
| 2469 | Service: ServiceSerializer, |
| 2470 | |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 2471 | ServiceClass: ServiceClassSerializer, |
Sapan Bhatia | dea3943 | 2014-06-13 03:10:36 -0400 | [diff] [blame] | 2472 | |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 2473 | PlanetStack: PlanetStackSerializer, |
Sapan Bhatia | dea3943 | 2014-06-13 03:10:36 -0400 | [diff] [blame] | 2474 | |
| 2475 | Charge: ChargeSerializer, |
| 2476 | |
| 2477 | Role: RoleSerializer, |
| 2478 | |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 2479 | UsableObject: UsableObjectSerializer, |
| 2480 | |
| 2481 | SiteRole: SiteRoleSerializer, |
Sapan Bhatia | dea3943 | 2014-06-13 03:10:36 -0400 | [diff] [blame] | 2482 | |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 2483 | SliceCredential: SliceCredentialSerializer, |
| 2484 | |
Sapan Bhatia | dea3943 | 2014-06-13 03:10:36 -0400 | [diff] [blame] | 2485 | Sliver: SliverSerializer, |
| 2486 | |
| 2487 | Node: NodeSerializer, |
| 2488 | |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 2489 | DashboardView: DashboardViewSerializer, |
Sapan Bhatia | dea3943 | 2014-06-13 03:10:36 -0400 | [diff] [blame] | 2490 | |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 2491 | ControllerNetwork: ControllerNetworkSerializer, |
| 2492 | |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 2493 | ImageDeployments: ImageDeploymentsSerializer, |
Sapan Bhatia | dea3943 | 2014-06-13 03:10:36 -0400 | [diff] [blame] | 2494 | |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 2495 | ControllerUser: ControllerUserSerializer, |
| 2496 | |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 2497 | ReservedResource: ReservedResourceSerializer, |
Scott Baker | 8b53319 | 2014-11-17 22:32:19 -0800 | [diff] [blame] | 2498 | |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 2499 | Payment: PaymentSerializer, |
| 2500 | |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 2501 | NetworkSlice: NetworkSliceSerializer, |
| 2502 | |
| 2503 | UserDashboardView: UserDashboardViewSerializer, |
| 2504 | |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 2505 | Controller: ControllerSerializer, |
| 2506 | |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 2507 | PlanetStackPrivilege: PlanetStackPrivilegeSerializer, |
Sapan Bhatia | dea3943 | 2014-06-13 03:10:36 -0400 | [diff] [blame] | 2508 | |
| 2509 | User: UserSerializer, |
| 2510 | |
| 2511 | Deployment: DeploymentSerializer, |
| 2512 | |
| 2513 | Reservation: ReservationSerializer, |
| 2514 | |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 2515 | SitePrivilege: SitePrivilegeSerializer, |
Sapan Bhatia | dea3943 | 2014-06-13 03:10:36 -0400 | [diff] [blame] | 2516 | |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 2517 | ControllerSlice: ControllerSliceSerializer, |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 2518 | |
Scott Baker | f2c0c51 | 2014-12-22 17:35:34 -0800 | [diff] [blame] | 2519 | ControllerDashboardView: ControllerDashboardViewSerializer, |
| 2520 | |
Sapan Bhatia | dea3943 | 2014-06-13 03:10:36 -0400 | [diff] [blame] | 2521 | Account: AccountSerializer, |
| 2522 | |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 2523 | ControllerRole: ControllerRoleSerializer, |
| 2524 | |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 2525 | NetworkParameterType: NetworkParameterTypeSerializer, |
Sapan Bhatia | dea3943 | 2014-06-13 03:10:36 -0400 | [diff] [blame] | 2526 | |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 2527 | SiteCredential: SiteCredentialSerializer, |
Sapan Bhatia | dea3943 | 2014-06-13 03:10:36 -0400 | [diff] [blame] | 2528 | |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 2529 | DeploymentPrivilege: DeploymentPrivilegeSerializer, |
Sapan Bhatia | dea3943 | 2014-06-13 03:10:36 -0400 | [diff] [blame] | 2530 | |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 2531 | ControllerSlicePrivilege: ControllerSlicePrivilegeSerializer, |
| 2532 | |
| 2533 | SiteDeployment: SiteDeploymentSerializer, |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 2534 | |
| 2535 | DeploymentRole: DeploymentRoleSerializer, |
Sapan Bhatia | dea3943 | 2014-06-13 03:10:36 -0400 | [diff] [blame] | 2536 | |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 2537 | UserCredential: UserCredentialSerializer, |
| 2538 | |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 2539 | SliceTag: SliceTagSerializer, |
Sapan Bhatia | dea3943 | 2014-06-13 03:10:36 -0400 | [diff] [blame] | 2540 | |
Scott Baker | f2c0c51 | 2014-12-22 17:35:34 -0800 | [diff] [blame] | 2541 | NetworkTemplate: NetworkTemplateSerializer, |
Sapan Bhatia | dea3943 | 2014-06-13 03:10:36 -0400 | [diff] [blame] | 2542 | |
| 2543 | Router: RouterSerializer, |
| 2544 | |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 2545 | ServiceResource: ServiceResourceSerializer, |
Sapan Bhatia | dea3943 | 2014-06-13 03:10:36 -0400 | [diff] [blame] | 2546 | |
| 2547 | None: None, |
| 2548 | } |
| 2549 | |
| 2550 | # Based on core/views/*.py |
| 2551 | |
| 2552 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 2553 | class ServiceAttributeList(XOSListCreateAPIView): |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 2554 | queryset = ServiceAttribute.objects.select_related().all() |
| 2555 | serializer_class = ServiceAttributeSerializer |
Scott Baker | 46b5854 | 2014-08-11 17:26:12 -0700 | [diff] [blame] | 2556 | id_serializer_class = ServiceAttributeIdSerializer |
| 2557 | filter_backends = (filters.DjangoFilterBackend,) |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 2558 | filter_fields = ('id','created','updated','enacted','policed','backend_register','backend_status','deleted','name','value','service',) |
Scott Baker | 46b5854 | 2014-08-11 17:26:12 -0700 | [diff] [blame] | 2559 | |
| 2560 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 2561 | no_hyperlinks=False |
| 2562 | if hasattr(self.request,"QUERY_PARAMS"): |
| 2563 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 46b5854 | 2014-08-11 17:26:12 -0700 | [diff] [blame] | 2564 | if (no_hyperlinks): |
| 2565 | return self.id_serializer_class |
| 2566 | else: |
| 2567 | return self.serializer_class |
| 2568 | |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 2569 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 2570 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 2571 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 2572 | return ServiceAttribute.select_by_user(self.request.user) |
Sapan Bhatia | dea3943 | 2014-06-13 03:10:36 -0400 | [diff] [blame] | 2573 | |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 2574 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 2575 | class ServiceAttributeDetail(XOSRetrieveUpdateDestroyAPIView): |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 2576 | queryset = ServiceAttribute.objects.select_related().all() |
| 2577 | serializer_class = ServiceAttributeSerializer |
Scott Baker | 46b5854 | 2014-08-11 17:26:12 -0700 | [diff] [blame] | 2578 | id_serializer_class = ServiceAttributeIdSerializer |
| 2579 | |
| 2580 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 2581 | no_hyperlinks=False |
| 2582 | if hasattr(self.request,"QUERY_PARAMS"): |
| 2583 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 46b5854 | 2014-08-11 17:26:12 -0700 | [diff] [blame] | 2584 | if (no_hyperlinks): |
| 2585 | return self.id_serializer_class |
| 2586 | else: |
| 2587 | return self.serializer_class |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 2588 | |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 2589 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 2590 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 2591 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 2592 | return ServiceAttribute.select_by_user(self.request.user) |
| 2593 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 2594 | # update() is handled by XOSRetrieveUpdateDestroyAPIView |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 2595 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 2596 | # destroy() is handled by XOSRetrieveUpdateDestroyAPIView |
Sapan Bhatia | dea3943 | 2014-06-13 03:10:36 -0400 | [diff] [blame] | 2597 | |
| 2598 | |
| 2599 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 2600 | class ControllerImagesList(XOSListCreateAPIView): |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 2601 | queryset = ControllerImages.objects.select_related().all() |
| 2602 | serializer_class = ControllerImagesSerializer |
| 2603 | id_serializer_class = ControllerImagesIdSerializer |
| 2604 | filter_backends = (filters.DjangoFilterBackend,) |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 2605 | filter_fields = ('id','created','updated','enacted','policed','backend_register','backend_status','deleted','image','controller','glance_image_id',) |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 2606 | |
| 2607 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 2608 | no_hyperlinks=False |
| 2609 | if hasattr(self.request,"QUERY_PARAMS"): |
| 2610 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 2611 | if (no_hyperlinks): |
| 2612 | return self.id_serializer_class |
| 2613 | else: |
| 2614 | return self.serializer_class |
| 2615 | |
| 2616 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 2617 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 2618 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 2619 | return ControllerImages.select_by_user(self.request.user) |
| 2620 | |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 2621 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 2622 | class ControllerImagesDetail(XOSRetrieveUpdateDestroyAPIView): |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 2623 | queryset = ControllerImages.objects.select_related().all() |
| 2624 | serializer_class = ControllerImagesSerializer |
| 2625 | id_serializer_class = ControllerImagesIdSerializer |
| 2626 | |
| 2627 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 2628 | no_hyperlinks=False |
| 2629 | if hasattr(self.request,"QUERY_PARAMS"): |
| 2630 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 2631 | if (no_hyperlinks): |
| 2632 | return self.id_serializer_class |
| 2633 | else: |
| 2634 | return self.serializer_class |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 2635 | |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 2636 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 2637 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 2638 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 2639 | return ControllerImages.select_by_user(self.request.user) |
| 2640 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 2641 | # update() is handled by XOSRetrieveUpdateDestroyAPIView |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 2642 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 2643 | # destroy() is handled by XOSRetrieveUpdateDestroyAPIView |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 2644 | |
| 2645 | |
| 2646 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 2647 | class ControllerSitePrivilegeList(XOSListCreateAPIView): |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 2648 | queryset = ControllerSitePrivilege.objects.select_related().all() |
| 2649 | serializer_class = ControllerSitePrivilegeSerializer |
| 2650 | id_serializer_class = ControllerSitePrivilegeIdSerializer |
| 2651 | filter_backends = (filters.DjangoFilterBackend,) |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 2652 | filter_fields = ('id','created','updated','enacted','policed','backend_register','backend_status','deleted','controller','site_privilege','role_id',) |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 2653 | |
| 2654 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 2655 | no_hyperlinks=False |
| 2656 | if hasattr(self.request,"QUERY_PARAMS"): |
| 2657 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 2658 | if (no_hyperlinks): |
| 2659 | return self.id_serializer_class |
| 2660 | else: |
| 2661 | return self.serializer_class |
| 2662 | |
| 2663 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 2664 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 2665 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 2666 | return ControllerSitePrivilege.select_by_user(self.request.user) |
| 2667 | |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 2668 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 2669 | class ControllerSitePrivilegeDetail(XOSRetrieveUpdateDestroyAPIView): |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 2670 | queryset = ControllerSitePrivilege.objects.select_related().all() |
| 2671 | serializer_class = ControllerSitePrivilegeSerializer |
| 2672 | id_serializer_class = ControllerSitePrivilegeIdSerializer |
| 2673 | |
| 2674 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 2675 | no_hyperlinks=False |
| 2676 | if hasattr(self.request,"QUERY_PARAMS"): |
| 2677 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 2678 | if (no_hyperlinks): |
| 2679 | return self.id_serializer_class |
| 2680 | else: |
| 2681 | return self.serializer_class |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 2682 | |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 2683 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 2684 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 2685 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 2686 | return ControllerSitePrivilege.select_by_user(self.request.user) |
| 2687 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 2688 | # update() is handled by XOSRetrieveUpdateDestroyAPIView |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 2689 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 2690 | # destroy() is handled by XOSRetrieveUpdateDestroyAPIView |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 2691 | |
| 2692 | |
| 2693 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 2694 | class ImageList(XOSListCreateAPIView): |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 2695 | queryset = Image.objects.select_related().all() |
Sapan Bhatia | dea3943 | 2014-06-13 03:10:36 -0400 | [diff] [blame] | 2696 | serializer_class = ImageSerializer |
Scott Baker | 46b5854 | 2014-08-11 17:26:12 -0700 | [diff] [blame] | 2697 | id_serializer_class = ImageIdSerializer |
| 2698 | filter_backends = (filters.DjangoFilterBackend,) |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 2699 | filter_fields = ('id','created','updated','enacted','policed','backend_register','backend_status','deleted','name','disk_format','container_format','path','deployments',) |
Scott Baker | 46b5854 | 2014-08-11 17:26:12 -0700 | [diff] [blame] | 2700 | |
| 2701 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 2702 | no_hyperlinks=False |
| 2703 | if hasattr(self.request,"QUERY_PARAMS"): |
| 2704 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 46b5854 | 2014-08-11 17:26:12 -0700 | [diff] [blame] | 2705 | if (no_hyperlinks): |
| 2706 | return self.id_serializer_class |
| 2707 | else: |
| 2708 | return self.serializer_class |
| 2709 | |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 2710 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 2711 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 2712 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 2713 | return Image.select_by_user(self.request.user) |
| 2714 | |
Sapan Bhatia | dea3943 | 2014-06-13 03:10:36 -0400 | [diff] [blame] | 2715 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 2716 | class ImageDetail(XOSRetrieveUpdateDestroyAPIView): |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 2717 | queryset = Image.objects.select_related().all() |
Sapan Bhatia | dea3943 | 2014-06-13 03:10:36 -0400 | [diff] [blame] | 2718 | serializer_class = ImageSerializer |
Scott Baker | 46b5854 | 2014-08-11 17:26:12 -0700 | [diff] [blame] | 2719 | id_serializer_class = ImageIdSerializer |
| 2720 | |
| 2721 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 2722 | no_hyperlinks=False |
| 2723 | if hasattr(self.request,"QUERY_PARAMS"): |
| 2724 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 46b5854 | 2014-08-11 17:26:12 -0700 | [diff] [blame] | 2725 | if (no_hyperlinks): |
| 2726 | return self.id_serializer_class |
| 2727 | else: |
| 2728 | return self.serializer_class |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 2729 | |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 2730 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 2731 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 2732 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 2733 | return Image.select_by_user(self.request.user) |
| 2734 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 2735 | # update() is handled by XOSRetrieveUpdateDestroyAPIView |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 2736 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 2737 | # destroy() is handled by XOSRetrieveUpdateDestroyAPIView |
Sapan Bhatia | dea3943 | 2014-06-13 03:10:36 -0400 | [diff] [blame] | 2738 | |
| 2739 | |
| 2740 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 2741 | class NetworkParameterList(XOSListCreateAPIView): |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 2742 | queryset = NetworkParameter.objects.select_related().all() |
| 2743 | serializer_class = NetworkParameterSerializer |
Scott Baker | 46b5854 | 2014-08-11 17:26:12 -0700 | [diff] [blame] | 2744 | id_serializer_class = NetworkParameterIdSerializer |
| 2745 | filter_backends = (filters.DjangoFilterBackend,) |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 2746 | filter_fields = ('id','created','updated','enacted','policed','backend_register','backend_status','deleted','parameter','value','content_type','object_id',) |
Scott Baker | 46b5854 | 2014-08-11 17:26:12 -0700 | [diff] [blame] | 2747 | |
| 2748 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 2749 | no_hyperlinks=False |
| 2750 | if hasattr(self.request,"QUERY_PARAMS"): |
| 2751 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 46b5854 | 2014-08-11 17:26:12 -0700 | [diff] [blame] | 2752 | if (no_hyperlinks): |
| 2753 | return self.id_serializer_class |
| 2754 | else: |
| 2755 | return self.serializer_class |
| 2756 | |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 2757 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 2758 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 2759 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 2760 | return NetworkParameter.select_by_user(self.request.user) |
Sapan Bhatia | dea3943 | 2014-06-13 03:10:36 -0400 | [diff] [blame] | 2761 | |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 2762 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 2763 | class NetworkParameterDetail(XOSRetrieveUpdateDestroyAPIView): |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 2764 | queryset = NetworkParameter.objects.select_related().all() |
| 2765 | serializer_class = NetworkParameterSerializer |
Scott Baker | 46b5854 | 2014-08-11 17:26:12 -0700 | [diff] [blame] | 2766 | id_serializer_class = NetworkParameterIdSerializer |
| 2767 | |
| 2768 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 2769 | no_hyperlinks=False |
| 2770 | if hasattr(self.request,"QUERY_PARAMS"): |
| 2771 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 46b5854 | 2014-08-11 17:26:12 -0700 | [diff] [blame] | 2772 | if (no_hyperlinks): |
| 2773 | return self.id_serializer_class |
| 2774 | else: |
| 2775 | return self.serializer_class |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 2776 | |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 2777 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 2778 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 2779 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 2780 | return NetworkParameter.select_by_user(self.request.user) |
| 2781 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 2782 | # update() is handled by XOSRetrieveUpdateDestroyAPIView |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 2783 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 2784 | # destroy() is handled by XOSRetrieveUpdateDestroyAPIView |
Sapan Bhatia | dea3943 | 2014-06-13 03:10:36 -0400 | [diff] [blame] | 2785 | |
| 2786 | |
| 2787 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 2788 | class SiteList(XOSListCreateAPIView): |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 2789 | queryset = Site.objects.select_related().all() |
Sapan Bhatia | dea3943 | 2014-06-13 03:10:36 -0400 | [diff] [blame] | 2790 | serializer_class = SiteSerializer |
Scott Baker | 46b5854 | 2014-08-11 17:26:12 -0700 | [diff] [blame] | 2791 | id_serializer_class = SiteIdSerializer |
| 2792 | filter_backends = (filters.DjangoFilterBackend,) |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 2793 | filter_fields = ('id','created','updated','enacted','policed','backend_register','backend_status','deleted','name','site_url','enabled','location','longitude','latitude','login_base','is_public','abbreviated_name','deployments',) |
Scott Baker | 46b5854 | 2014-08-11 17:26:12 -0700 | [diff] [blame] | 2794 | |
| 2795 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 2796 | no_hyperlinks=False |
| 2797 | if hasattr(self.request,"QUERY_PARAMS"): |
| 2798 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 46b5854 | 2014-08-11 17:26:12 -0700 | [diff] [blame] | 2799 | if (no_hyperlinks): |
| 2800 | return self.id_serializer_class |
| 2801 | else: |
| 2802 | return self.serializer_class |
| 2803 | |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 2804 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 2805 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 2806 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 2807 | return Site.select_by_user(self.request.user) |
| 2808 | |
Sapan Bhatia | dea3943 | 2014-06-13 03:10:36 -0400 | [diff] [blame] | 2809 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 2810 | class SiteDetail(XOSRetrieveUpdateDestroyAPIView): |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 2811 | queryset = Site.objects.select_related().all() |
Sapan Bhatia | dea3943 | 2014-06-13 03:10:36 -0400 | [diff] [blame] | 2812 | serializer_class = SiteSerializer |
Scott Baker | 46b5854 | 2014-08-11 17:26:12 -0700 | [diff] [blame] | 2813 | id_serializer_class = SiteIdSerializer |
| 2814 | |
| 2815 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 2816 | no_hyperlinks=False |
| 2817 | if hasattr(self.request,"QUERY_PARAMS"): |
| 2818 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 46b5854 | 2014-08-11 17:26:12 -0700 | [diff] [blame] | 2819 | if (no_hyperlinks): |
| 2820 | return self.id_serializer_class |
| 2821 | else: |
| 2822 | return self.serializer_class |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 2823 | |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 2824 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 2825 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 2826 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 2827 | return Site.select_by_user(self.request.user) |
Sapan Bhatia | dea3943 | 2014-06-13 03:10:36 -0400 | [diff] [blame] | 2828 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 2829 | # update() is handled by XOSRetrieveUpdateDestroyAPIView |
Sapan Bhatia | dea3943 | 2014-06-13 03:10:36 -0400 | [diff] [blame] | 2830 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 2831 | # destroy() is handled by XOSRetrieveUpdateDestroyAPIView |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 2832 | |
| 2833 | |
| 2834 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 2835 | class SliceRoleList(XOSListCreateAPIView): |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 2836 | queryset = SliceRole.objects.select_related().all() |
| 2837 | serializer_class = SliceRoleSerializer |
Scott Baker | 46b5854 | 2014-08-11 17:26:12 -0700 | [diff] [blame] | 2838 | id_serializer_class = SliceRoleIdSerializer |
| 2839 | filter_backends = (filters.DjangoFilterBackend,) |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 2840 | filter_fields = ('id','created','updated','enacted','policed','backend_register','backend_status','deleted','role',) |
Scott Baker | 46b5854 | 2014-08-11 17:26:12 -0700 | [diff] [blame] | 2841 | |
| 2842 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 2843 | no_hyperlinks=False |
| 2844 | if hasattr(self.request,"QUERY_PARAMS"): |
| 2845 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 46b5854 | 2014-08-11 17:26:12 -0700 | [diff] [blame] | 2846 | if (no_hyperlinks): |
| 2847 | return self.id_serializer_class |
| 2848 | else: |
| 2849 | return self.serializer_class |
| 2850 | |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 2851 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 2852 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 2853 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 2854 | return SliceRole.select_by_user(self.request.user) |
| 2855 | |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 2856 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 2857 | class SliceRoleDetail(XOSRetrieveUpdateDestroyAPIView): |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 2858 | queryset = SliceRole.objects.select_related().all() |
| 2859 | serializer_class = SliceRoleSerializer |
Scott Baker | 46b5854 | 2014-08-11 17:26:12 -0700 | [diff] [blame] | 2860 | id_serializer_class = SliceRoleIdSerializer |
| 2861 | |
| 2862 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 2863 | no_hyperlinks=False |
| 2864 | if hasattr(self.request,"QUERY_PARAMS"): |
| 2865 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 46b5854 | 2014-08-11 17:26:12 -0700 | [diff] [blame] | 2866 | if (no_hyperlinks): |
| 2867 | return self.id_serializer_class |
| 2868 | else: |
| 2869 | return self.serializer_class |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 2870 | |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 2871 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 2872 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 2873 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 2874 | return SliceRole.select_by_user(self.request.user) |
| 2875 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 2876 | # update() is handled by XOSRetrieveUpdateDestroyAPIView |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 2877 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 2878 | # destroy() is handled by XOSRetrieveUpdateDestroyAPIView |
Sapan Bhatia | dea3943 | 2014-06-13 03:10:36 -0400 | [diff] [blame] | 2879 | |
| 2880 | |
| 2881 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 2882 | class TagList(XOSListCreateAPIView): |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 2883 | queryset = Tag.objects.select_related().all() |
Sapan Bhatia | dea3943 | 2014-06-13 03:10:36 -0400 | [diff] [blame] | 2884 | serializer_class = TagSerializer |
Scott Baker | 46b5854 | 2014-08-11 17:26:12 -0700 | [diff] [blame] | 2885 | id_serializer_class = TagIdSerializer |
| 2886 | filter_backends = (filters.DjangoFilterBackend,) |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 2887 | filter_fields = ('id','created','updated','enacted','policed','backend_register','backend_status','deleted','service','name','value','content_type','object_id',) |
Scott Baker | 46b5854 | 2014-08-11 17:26:12 -0700 | [diff] [blame] | 2888 | |
| 2889 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 2890 | no_hyperlinks=False |
| 2891 | if hasattr(self.request,"QUERY_PARAMS"): |
| 2892 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 46b5854 | 2014-08-11 17:26:12 -0700 | [diff] [blame] | 2893 | if (no_hyperlinks): |
| 2894 | return self.id_serializer_class |
| 2895 | else: |
| 2896 | return self.serializer_class |
| 2897 | |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 2898 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 2899 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 2900 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 2901 | return Tag.select_by_user(self.request.user) |
| 2902 | |
Sapan Bhatia | dea3943 | 2014-06-13 03:10:36 -0400 | [diff] [blame] | 2903 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 2904 | class TagDetail(XOSRetrieveUpdateDestroyAPIView): |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 2905 | queryset = Tag.objects.select_related().all() |
Sapan Bhatia | dea3943 | 2014-06-13 03:10:36 -0400 | [diff] [blame] | 2906 | serializer_class = TagSerializer |
Scott Baker | 46b5854 | 2014-08-11 17:26:12 -0700 | [diff] [blame] | 2907 | id_serializer_class = TagIdSerializer |
| 2908 | |
| 2909 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 2910 | no_hyperlinks=False |
| 2911 | if hasattr(self.request,"QUERY_PARAMS"): |
| 2912 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 46b5854 | 2014-08-11 17:26:12 -0700 | [diff] [blame] | 2913 | if (no_hyperlinks): |
| 2914 | return self.id_serializer_class |
| 2915 | else: |
| 2916 | return self.serializer_class |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 2917 | |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 2918 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 2919 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 2920 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 2921 | return Tag.select_by_user(self.request.user) |
| 2922 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 2923 | # update() is handled by XOSRetrieveUpdateDestroyAPIView |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 2924 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 2925 | # destroy() is handled by XOSRetrieveUpdateDestroyAPIView |
Sapan Bhatia | dea3943 | 2014-06-13 03:10:36 -0400 | [diff] [blame] | 2926 | |
| 2927 | |
| 2928 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 2929 | class InvoiceList(XOSListCreateAPIView): |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 2930 | queryset = Invoice.objects.select_related().all() |
Sapan Bhatia | dea3943 | 2014-06-13 03:10:36 -0400 | [diff] [blame] | 2931 | serializer_class = InvoiceSerializer |
Scott Baker | 46b5854 | 2014-08-11 17:26:12 -0700 | [diff] [blame] | 2932 | id_serializer_class = InvoiceIdSerializer |
| 2933 | filter_backends = (filters.DjangoFilterBackend,) |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 2934 | filter_fields = ('id','created','updated','enacted','policed','backend_register','backend_status','deleted','date','account',) |
Scott Baker | 46b5854 | 2014-08-11 17:26:12 -0700 | [diff] [blame] | 2935 | |
| 2936 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 2937 | no_hyperlinks=False |
| 2938 | if hasattr(self.request,"QUERY_PARAMS"): |
| 2939 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 46b5854 | 2014-08-11 17:26:12 -0700 | [diff] [blame] | 2940 | if (no_hyperlinks): |
| 2941 | return self.id_serializer_class |
| 2942 | else: |
| 2943 | return self.serializer_class |
| 2944 | |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 2945 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 2946 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 2947 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 2948 | return Invoice.select_by_user(self.request.user) |
| 2949 | |
Sapan Bhatia | dea3943 | 2014-06-13 03:10:36 -0400 | [diff] [blame] | 2950 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 2951 | class InvoiceDetail(XOSRetrieveUpdateDestroyAPIView): |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 2952 | queryset = Invoice.objects.select_related().all() |
Sapan Bhatia | dea3943 | 2014-06-13 03:10:36 -0400 | [diff] [blame] | 2953 | serializer_class = InvoiceSerializer |
Scott Baker | 46b5854 | 2014-08-11 17:26:12 -0700 | [diff] [blame] | 2954 | id_serializer_class = InvoiceIdSerializer |
| 2955 | |
| 2956 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 2957 | no_hyperlinks=False |
| 2958 | if hasattr(self.request,"QUERY_PARAMS"): |
| 2959 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 46b5854 | 2014-08-11 17:26:12 -0700 | [diff] [blame] | 2960 | if (no_hyperlinks): |
| 2961 | return self.id_serializer_class |
| 2962 | else: |
| 2963 | return self.serializer_class |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 2964 | |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 2965 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 2966 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 2967 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 2968 | return Invoice.select_by_user(self.request.user) |
| 2969 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 2970 | # update() is handled by XOSRetrieveUpdateDestroyAPIView |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 2971 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 2972 | # destroy() is handled by XOSRetrieveUpdateDestroyAPIView |
Sapan Bhatia | dea3943 | 2014-06-13 03:10:36 -0400 | [diff] [blame] | 2973 | |
| 2974 | |
| 2975 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 2976 | class SlicePrivilegeList(XOSListCreateAPIView): |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 2977 | queryset = SlicePrivilege.objects.select_related().all() |
| 2978 | serializer_class = SlicePrivilegeSerializer |
Scott Baker | 46b5854 | 2014-08-11 17:26:12 -0700 | [diff] [blame] | 2979 | id_serializer_class = SlicePrivilegeIdSerializer |
| 2980 | filter_backends = (filters.DjangoFilterBackend,) |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 2981 | filter_fields = ('id','created','updated','enacted','policed','backend_register','backend_status','deleted','user','slice','role',) |
Scott Baker | 46b5854 | 2014-08-11 17:26:12 -0700 | [diff] [blame] | 2982 | |
| 2983 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 2984 | no_hyperlinks=False |
| 2985 | if hasattr(self.request,"QUERY_PARAMS"): |
| 2986 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 46b5854 | 2014-08-11 17:26:12 -0700 | [diff] [blame] | 2987 | if (no_hyperlinks): |
| 2988 | return self.id_serializer_class |
| 2989 | else: |
| 2990 | return self.serializer_class |
| 2991 | |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 2992 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 2993 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 2994 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 2995 | return SlicePrivilege.select_by_user(self.request.user) |
Sapan Bhatia | dea3943 | 2014-06-13 03:10:36 -0400 | [diff] [blame] | 2996 | |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 2997 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 2998 | class SlicePrivilegeDetail(XOSRetrieveUpdateDestroyAPIView): |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 2999 | queryset = SlicePrivilege.objects.select_related().all() |
| 3000 | serializer_class = SlicePrivilegeSerializer |
Scott Baker | 46b5854 | 2014-08-11 17:26:12 -0700 | [diff] [blame] | 3001 | id_serializer_class = SlicePrivilegeIdSerializer |
| 3002 | |
| 3003 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 3004 | no_hyperlinks=False |
| 3005 | if hasattr(self.request,"QUERY_PARAMS"): |
| 3006 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 46b5854 | 2014-08-11 17:26:12 -0700 | [diff] [blame] | 3007 | if (no_hyperlinks): |
| 3008 | return self.id_serializer_class |
| 3009 | else: |
| 3010 | return self.serializer_class |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 3011 | |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 3012 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 3013 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 3014 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 3015 | return SlicePrivilege.select_by_user(self.request.user) |
| 3016 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 3017 | # update() is handled by XOSRetrieveUpdateDestroyAPIView |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3018 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 3019 | # destroy() is handled by XOSRetrieveUpdateDestroyAPIView |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3020 | |
| 3021 | |
| 3022 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 3023 | class PlanetStackRoleList(XOSListCreateAPIView): |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3024 | queryset = PlanetStackRole.objects.select_related().all() |
| 3025 | serializer_class = PlanetStackRoleSerializer |
| 3026 | id_serializer_class = PlanetStackRoleIdSerializer |
| 3027 | filter_backends = (filters.DjangoFilterBackend,) |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 3028 | filter_fields = ('id','created','updated','enacted','policed','backend_register','backend_status','deleted','role',) |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3029 | |
| 3030 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 3031 | no_hyperlinks=False |
| 3032 | if hasattr(self.request,"QUERY_PARAMS"): |
| 3033 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3034 | if (no_hyperlinks): |
| 3035 | return self.id_serializer_class |
| 3036 | else: |
| 3037 | return self.serializer_class |
| 3038 | |
| 3039 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 3040 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 3041 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3042 | return PlanetStackRole.select_by_user(self.request.user) |
| 3043 | |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 3044 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 3045 | class PlanetStackRoleDetail(XOSRetrieveUpdateDestroyAPIView): |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3046 | queryset = PlanetStackRole.objects.select_related().all() |
| 3047 | serializer_class = PlanetStackRoleSerializer |
| 3048 | id_serializer_class = PlanetStackRoleIdSerializer |
| 3049 | |
| 3050 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 3051 | no_hyperlinks=False |
| 3052 | if hasattr(self.request,"QUERY_PARAMS"): |
| 3053 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3054 | if (no_hyperlinks): |
| 3055 | return self.id_serializer_class |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 3056 | else: |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3057 | return self.serializer_class |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 3058 | |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3059 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 3060 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 3061 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3062 | return PlanetStackRole.select_by_user(self.request.user) |
| 3063 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 3064 | # update() is handled by XOSRetrieveUpdateDestroyAPIView |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3065 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 3066 | # destroy() is handled by XOSRetrieveUpdateDestroyAPIView |
Sapan Bhatia | dea3943 | 2014-06-13 03:10:36 -0400 | [diff] [blame] | 3067 | |
| 3068 | |
| 3069 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 3070 | class NetworkSliverList(XOSListCreateAPIView): |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 3071 | queryset = NetworkSliver.objects.select_related().all() |
| 3072 | serializer_class = NetworkSliverSerializer |
Scott Baker | 46b5854 | 2014-08-11 17:26:12 -0700 | [diff] [blame] | 3073 | id_serializer_class = NetworkSliverIdSerializer |
| 3074 | filter_backends = (filters.DjangoFilterBackend,) |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 3075 | filter_fields = ('id','created','updated','enacted','policed','backend_register','backend_status','deleted','network','sliver','ip','port_id',) |
Scott Baker | 46b5854 | 2014-08-11 17:26:12 -0700 | [diff] [blame] | 3076 | |
| 3077 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 3078 | no_hyperlinks=False |
| 3079 | if hasattr(self.request,"QUERY_PARAMS"): |
| 3080 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 46b5854 | 2014-08-11 17:26:12 -0700 | [diff] [blame] | 3081 | if (no_hyperlinks): |
| 3082 | return self.id_serializer_class |
| 3083 | else: |
| 3084 | return self.serializer_class |
| 3085 | |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 3086 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 3087 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 3088 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 3089 | return NetworkSliver.select_by_user(self.request.user) |
Sapan Bhatia | dea3943 | 2014-06-13 03:10:36 -0400 | [diff] [blame] | 3090 | |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 3091 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 3092 | class NetworkSliverDetail(XOSRetrieveUpdateDestroyAPIView): |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 3093 | queryset = NetworkSliver.objects.select_related().all() |
| 3094 | serializer_class = NetworkSliverSerializer |
Scott Baker | 46b5854 | 2014-08-11 17:26:12 -0700 | [diff] [blame] | 3095 | id_serializer_class = NetworkSliverIdSerializer |
| 3096 | |
| 3097 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 3098 | no_hyperlinks=False |
| 3099 | if hasattr(self.request,"QUERY_PARAMS"): |
| 3100 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 46b5854 | 2014-08-11 17:26:12 -0700 | [diff] [blame] | 3101 | if (no_hyperlinks): |
| 3102 | return self.id_serializer_class |
| 3103 | else: |
| 3104 | return self.serializer_class |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 3105 | |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 3106 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 3107 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 3108 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 3109 | return NetworkSliver.select_by_user(self.request.user) |
| 3110 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 3111 | # update() is handled by XOSRetrieveUpdateDestroyAPIView |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 3112 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 3113 | # destroy() is handled by XOSRetrieveUpdateDestroyAPIView |
Sapan Bhatia | dea3943 | 2014-06-13 03:10:36 -0400 | [diff] [blame] | 3114 | |
| 3115 | |
| 3116 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 3117 | class FlavorList(XOSListCreateAPIView): |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 3118 | queryset = Flavor.objects.select_related().all() |
| 3119 | serializer_class = FlavorSerializer |
| 3120 | id_serializer_class = FlavorIdSerializer |
| 3121 | filter_backends = (filters.DjangoFilterBackend,) |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 3122 | filter_fields = ('id','created','updated','enacted','policed','backend_register','backend_status','deleted','name','description','flavor','order','default','deployments',) |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 3123 | |
| 3124 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 3125 | no_hyperlinks=False |
| 3126 | if hasattr(self.request,"QUERY_PARAMS"): |
| 3127 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 3128 | if (no_hyperlinks): |
| 3129 | return self.id_serializer_class |
| 3130 | else: |
| 3131 | return self.serializer_class |
| 3132 | |
| 3133 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 3134 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 3135 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 3136 | return Flavor.select_by_user(self.request.user) |
| 3137 | |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 3138 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 3139 | class FlavorDetail(XOSRetrieveUpdateDestroyAPIView): |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 3140 | queryset = Flavor.objects.select_related().all() |
| 3141 | serializer_class = FlavorSerializer |
| 3142 | id_serializer_class = FlavorIdSerializer |
| 3143 | |
| 3144 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 3145 | no_hyperlinks=False |
| 3146 | if hasattr(self.request,"QUERY_PARAMS"): |
| 3147 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 3148 | if (no_hyperlinks): |
| 3149 | return self.id_serializer_class |
| 3150 | else: |
| 3151 | return self.serializer_class |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 3152 | |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 3153 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 3154 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 3155 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 3156 | return Flavor.select_by_user(self.request.user) |
| 3157 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 3158 | # update() is handled by XOSRetrieveUpdateDestroyAPIView |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 3159 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 3160 | # destroy() is handled by XOSRetrieveUpdateDestroyAPIView |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 3161 | |
| 3162 | |
| 3163 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 3164 | class ControllerSiteList(XOSListCreateAPIView): |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 3165 | queryset = ControllerSite.objects.select_related().all() |
| 3166 | serializer_class = ControllerSiteSerializer |
| 3167 | id_serializer_class = ControllerSiteIdSerializer |
| 3168 | filter_backends = (filters.DjangoFilterBackend,) |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 3169 | filter_fields = ('id','created','updated','enacted','policed','backend_register','backend_status','deleted','site','controller','tenant_id',) |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 3170 | |
| 3171 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 3172 | no_hyperlinks=False |
| 3173 | if hasattr(self.request,"QUERY_PARAMS"): |
| 3174 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 3175 | if (no_hyperlinks): |
| 3176 | return self.id_serializer_class |
| 3177 | else: |
| 3178 | return self.serializer_class |
| 3179 | |
| 3180 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 3181 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 3182 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 3183 | return ControllerSite.select_by_user(self.request.user) |
| 3184 | |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 3185 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 3186 | class ControllerSiteDetail(XOSRetrieveUpdateDestroyAPIView): |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 3187 | queryset = ControllerSite.objects.select_related().all() |
| 3188 | serializer_class = ControllerSiteSerializer |
| 3189 | id_serializer_class = ControllerSiteIdSerializer |
| 3190 | |
| 3191 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 3192 | no_hyperlinks=False |
| 3193 | if hasattr(self.request,"QUERY_PARAMS"): |
| 3194 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 3195 | if (no_hyperlinks): |
| 3196 | return self.id_serializer_class |
| 3197 | else: |
| 3198 | return self.serializer_class |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 3199 | |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 3200 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 3201 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 3202 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 3203 | return ControllerSite.select_by_user(self.request.user) |
| 3204 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 3205 | # update() is handled by XOSRetrieveUpdateDestroyAPIView |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 3206 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 3207 | # destroy() is handled by XOSRetrieveUpdateDestroyAPIView |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 3208 | |
| 3209 | |
| 3210 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 3211 | class ProjectList(XOSListCreateAPIView): |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 3212 | queryset = Project.objects.select_related().all() |
| 3213 | serializer_class = ProjectSerializer |
Scott Baker | 46b5854 | 2014-08-11 17:26:12 -0700 | [diff] [blame] | 3214 | id_serializer_class = ProjectIdSerializer |
| 3215 | filter_backends = (filters.DjangoFilterBackend,) |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 3216 | filter_fields = ('id','created','updated','enacted','policed','backend_register','backend_status','deleted','name',) |
Scott Baker | 46b5854 | 2014-08-11 17:26:12 -0700 | [diff] [blame] | 3217 | |
| 3218 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 3219 | no_hyperlinks=False |
| 3220 | if hasattr(self.request,"QUERY_PARAMS"): |
| 3221 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 46b5854 | 2014-08-11 17:26:12 -0700 | [diff] [blame] | 3222 | if (no_hyperlinks): |
| 3223 | return self.id_serializer_class |
| 3224 | else: |
| 3225 | return self.serializer_class |
| 3226 | |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 3227 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 3228 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 3229 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 3230 | return Project.select_by_user(self.request.user) |
Sapan Bhatia | dea3943 | 2014-06-13 03:10:36 -0400 | [diff] [blame] | 3231 | |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 3232 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 3233 | class ProjectDetail(XOSRetrieveUpdateDestroyAPIView): |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 3234 | queryset = Project.objects.select_related().all() |
| 3235 | serializer_class = ProjectSerializer |
Scott Baker | 46b5854 | 2014-08-11 17:26:12 -0700 | [diff] [blame] | 3236 | id_serializer_class = ProjectIdSerializer |
| 3237 | |
| 3238 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 3239 | no_hyperlinks=False |
| 3240 | if hasattr(self.request,"QUERY_PARAMS"): |
| 3241 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 46b5854 | 2014-08-11 17:26:12 -0700 | [diff] [blame] | 3242 | if (no_hyperlinks): |
| 3243 | return self.id_serializer_class |
| 3244 | else: |
| 3245 | return self.serializer_class |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 3246 | |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 3247 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 3248 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 3249 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 3250 | return Project.select_by_user(self.request.user) |
| 3251 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 3252 | # update() is handled by XOSRetrieveUpdateDestroyAPIView |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3253 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 3254 | # destroy() is handled by XOSRetrieveUpdateDestroyAPIView |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3255 | |
| 3256 | |
| 3257 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 3258 | class SliceList(XOSListCreateAPIView): |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3259 | queryset = Slice.objects.select_related().all() |
| 3260 | serializer_class = SliceSerializer |
| 3261 | id_serializer_class = SliceIdSerializer |
| 3262 | filter_backends = (filters.DjangoFilterBackend,) |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 3263 | filter_fields = ('id','created','updated','enacted','policed','backend_register','backend_status','deleted','name','enabled','omf_friendly','description','slice_url','site','max_slivers','service','network','serviceClass','creator','default_flavor','default_image','mount_data_sets','networks','networks',) |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3264 | |
| 3265 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 3266 | no_hyperlinks=False |
| 3267 | if hasattr(self.request,"QUERY_PARAMS"): |
| 3268 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3269 | if (no_hyperlinks): |
| 3270 | return self.id_serializer_class |
| 3271 | else: |
| 3272 | return self.serializer_class |
| 3273 | |
| 3274 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 3275 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 3276 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3277 | return Slice.select_by_user(self.request.user) |
| 3278 | |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 3279 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 3280 | class SliceDetail(XOSRetrieveUpdateDestroyAPIView): |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3281 | queryset = Slice.objects.select_related().all() |
| 3282 | serializer_class = SliceSerializer |
| 3283 | id_serializer_class = SliceIdSerializer |
| 3284 | |
| 3285 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 3286 | no_hyperlinks=False |
| 3287 | if hasattr(self.request,"QUERY_PARAMS"): |
| 3288 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3289 | if (no_hyperlinks): |
| 3290 | return self.id_serializer_class |
| 3291 | else: |
| 3292 | return self.serializer_class |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 3293 | |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3294 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 3295 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 3296 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3297 | return Slice.select_by_user(self.request.user) |
| 3298 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 3299 | # update() is handled by XOSRetrieveUpdateDestroyAPIView |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3300 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 3301 | # destroy() is handled by XOSRetrieveUpdateDestroyAPIView |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3302 | |
| 3303 | |
| 3304 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 3305 | class NetworkList(XOSListCreateAPIView): |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3306 | queryset = Network.objects.select_related().all() |
| 3307 | serializer_class = NetworkSerializer |
| 3308 | id_serializer_class = NetworkIdSerializer |
| 3309 | filter_backends = (filters.DjangoFilterBackend,) |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 3310 | filter_fields = ('id','created','updated','enacted','policed','backend_register','backend_status','deleted','name','template','subnet','ports','labels','owner','guaranteed_bandwidth','permit_all_slices','topology_parameters','controller_url','controller_parameters','network_id','router_id','subnet_id','slices','slices','slivers','routers','routers',) |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3311 | |
| 3312 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 3313 | no_hyperlinks=False |
| 3314 | if hasattr(self.request,"QUERY_PARAMS"): |
| 3315 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3316 | if (no_hyperlinks): |
| 3317 | return self.id_serializer_class |
| 3318 | else: |
| 3319 | return self.serializer_class |
| 3320 | |
| 3321 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 3322 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 3323 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3324 | return Network.select_by_user(self.request.user) |
| 3325 | |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3326 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 3327 | class NetworkDetail(XOSRetrieveUpdateDestroyAPIView): |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3328 | queryset = Network.objects.select_related().all() |
| 3329 | serializer_class = NetworkSerializer |
| 3330 | id_serializer_class = NetworkIdSerializer |
| 3331 | |
| 3332 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 3333 | no_hyperlinks=False |
| 3334 | if hasattr(self.request,"QUERY_PARAMS"): |
| 3335 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3336 | if (no_hyperlinks): |
| 3337 | return self.id_serializer_class |
| 3338 | else: |
| 3339 | return self.serializer_class |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 3340 | |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3341 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 3342 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 3343 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3344 | return Network.select_by_user(self.request.user) |
| 3345 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 3346 | # update() is handled by XOSRetrieveUpdateDestroyAPIView |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3347 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 3348 | # destroy() is handled by XOSRetrieveUpdateDestroyAPIView |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3349 | |
| 3350 | |
| 3351 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 3352 | class ServiceList(XOSListCreateAPIView): |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3353 | queryset = Service.objects.select_related().all() |
| 3354 | serializer_class = ServiceSerializer |
| 3355 | id_serializer_class = ServiceIdSerializer |
| 3356 | filter_backends = (filters.DjangoFilterBackend,) |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 3357 | filter_fields = ('id','created','updated','enacted','policed','backend_register','backend_status','deleted','description','enabled','name','versionNumber','published',) |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3358 | |
| 3359 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 3360 | no_hyperlinks=False |
| 3361 | if hasattr(self.request,"QUERY_PARAMS"): |
| 3362 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3363 | if (no_hyperlinks): |
| 3364 | return self.id_serializer_class |
| 3365 | else: |
| 3366 | return self.serializer_class |
| 3367 | |
| 3368 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 3369 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 3370 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3371 | return Service.select_by_user(self.request.user) |
| 3372 | |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3373 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 3374 | class ServiceDetail(XOSRetrieveUpdateDestroyAPIView): |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3375 | queryset = Service.objects.select_related().all() |
| 3376 | serializer_class = ServiceSerializer |
| 3377 | id_serializer_class = ServiceIdSerializer |
| 3378 | |
| 3379 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 3380 | no_hyperlinks=False |
| 3381 | if hasattr(self.request,"QUERY_PARAMS"): |
| 3382 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3383 | if (no_hyperlinks): |
| 3384 | return self.id_serializer_class |
| 3385 | else: |
| 3386 | return self.serializer_class |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 3387 | |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3388 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 3389 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 3390 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3391 | return Service.select_by_user(self.request.user) |
| 3392 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 3393 | # update() is handled by XOSRetrieveUpdateDestroyAPIView |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3394 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 3395 | # destroy() is handled by XOSRetrieveUpdateDestroyAPIView |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3396 | |
| 3397 | |
| 3398 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 3399 | class ServiceClassList(XOSListCreateAPIView): |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3400 | queryset = ServiceClass.objects.select_related().all() |
| 3401 | serializer_class = ServiceClassSerializer |
| 3402 | id_serializer_class = ServiceClassIdSerializer |
| 3403 | filter_backends = (filters.DjangoFilterBackend,) |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 3404 | filter_fields = ('id','created','updated','enacted','policed','backend_register','backend_status','deleted','name','description','commitment','membershipFee','membershipFeeMonths','upgradeRequiresApproval',) |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3405 | |
| 3406 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 3407 | no_hyperlinks=False |
| 3408 | if hasattr(self.request,"QUERY_PARAMS"): |
| 3409 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3410 | if (no_hyperlinks): |
| 3411 | return self.id_serializer_class |
| 3412 | else: |
| 3413 | return self.serializer_class |
| 3414 | |
| 3415 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 3416 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 3417 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3418 | return ServiceClass.select_by_user(self.request.user) |
| 3419 | |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3420 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 3421 | class ServiceClassDetail(XOSRetrieveUpdateDestroyAPIView): |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3422 | queryset = ServiceClass.objects.select_related().all() |
| 3423 | serializer_class = ServiceClassSerializer |
| 3424 | id_serializer_class = ServiceClassIdSerializer |
| 3425 | |
| 3426 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 3427 | no_hyperlinks=False |
| 3428 | if hasattr(self.request,"QUERY_PARAMS"): |
| 3429 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3430 | if (no_hyperlinks): |
| 3431 | return self.id_serializer_class |
| 3432 | else: |
| 3433 | return self.serializer_class |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 3434 | |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3435 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 3436 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 3437 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3438 | return ServiceClass.select_by_user(self.request.user) |
| 3439 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 3440 | # update() is handled by XOSRetrieveUpdateDestroyAPIView |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3441 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 3442 | # destroy() is handled by XOSRetrieveUpdateDestroyAPIView |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3443 | |
| 3444 | |
| 3445 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 3446 | class PlanetStackList(XOSListCreateAPIView): |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 3447 | queryset = PlanetStack.objects.select_related().all() |
| 3448 | serializer_class = PlanetStackSerializer |
| 3449 | id_serializer_class = PlanetStackIdSerializer |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3450 | filter_backends = (filters.DjangoFilterBackend,) |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 3451 | filter_fields = ('id','created','updated','enacted','policed','backend_register','backend_status','deleted','description',) |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3452 | |
| 3453 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 3454 | no_hyperlinks=False |
| 3455 | if hasattr(self.request,"QUERY_PARAMS"): |
| 3456 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3457 | if (no_hyperlinks): |
| 3458 | return self.id_serializer_class |
| 3459 | else: |
| 3460 | return self.serializer_class |
| 3461 | |
| 3462 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 3463 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 3464 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 3465 | return PlanetStack.select_by_user(self.request.user) |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3466 | |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3467 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 3468 | class PlanetStackDetail(XOSRetrieveUpdateDestroyAPIView): |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 3469 | queryset = PlanetStack.objects.select_related().all() |
| 3470 | serializer_class = PlanetStackSerializer |
| 3471 | id_serializer_class = PlanetStackIdSerializer |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3472 | |
| 3473 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 3474 | no_hyperlinks=False |
| 3475 | if hasattr(self.request,"QUERY_PARAMS"): |
| 3476 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3477 | if (no_hyperlinks): |
| 3478 | return self.id_serializer_class |
| 3479 | else: |
| 3480 | return self.serializer_class |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 3481 | |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3482 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 3483 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 3484 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 3485 | return PlanetStack.select_by_user(self.request.user) |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3486 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 3487 | # update() is handled by XOSRetrieveUpdateDestroyAPIView |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3488 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 3489 | # destroy() is handled by XOSRetrieveUpdateDestroyAPIView |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3490 | |
| 3491 | |
| 3492 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 3493 | class ChargeList(XOSListCreateAPIView): |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3494 | queryset = Charge.objects.select_related().all() |
| 3495 | serializer_class = ChargeSerializer |
| 3496 | id_serializer_class = ChargeIdSerializer |
| 3497 | filter_backends = (filters.DjangoFilterBackend,) |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 3498 | filter_fields = ('id','created','updated','enacted','policed','backend_register','backend_status','deleted','account','slice','kind','state','date','object','amount','coreHours','invoice',) |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3499 | |
| 3500 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 3501 | no_hyperlinks=False |
| 3502 | if hasattr(self.request,"QUERY_PARAMS"): |
| 3503 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3504 | if (no_hyperlinks): |
| 3505 | return self.id_serializer_class |
| 3506 | else: |
| 3507 | return self.serializer_class |
| 3508 | |
| 3509 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 3510 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 3511 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3512 | return Charge.select_by_user(self.request.user) |
| 3513 | |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3514 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 3515 | class ChargeDetail(XOSRetrieveUpdateDestroyAPIView): |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3516 | queryset = Charge.objects.select_related().all() |
| 3517 | serializer_class = ChargeSerializer |
| 3518 | id_serializer_class = ChargeIdSerializer |
| 3519 | |
| 3520 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 3521 | no_hyperlinks=False |
| 3522 | if hasattr(self.request,"QUERY_PARAMS"): |
| 3523 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3524 | if (no_hyperlinks): |
| 3525 | return self.id_serializer_class |
| 3526 | else: |
| 3527 | return self.serializer_class |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 3528 | |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3529 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 3530 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 3531 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3532 | return Charge.select_by_user(self.request.user) |
| 3533 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 3534 | # update() is handled by XOSRetrieveUpdateDestroyAPIView |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3535 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 3536 | # destroy() is handled by XOSRetrieveUpdateDestroyAPIView |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3537 | |
| 3538 | |
| 3539 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 3540 | class RoleList(XOSListCreateAPIView): |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3541 | queryset = Role.objects.select_related().all() |
| 3542 | serializer_class = RoleSerializer |
| 3543 | id_serializer_class = RoleIdSerializer |
| 3544 | filter_backends = (filters.DjangoFilterBackend,) |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 3545 | filter_fields = ('id','created','updated','enacted','policed','backend_register','backend_status','deleted','role_type','role','description','content_type',) |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3546 | |
| 3547 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 3548 | no_hyperlinks=False |
| 3549 | if hasattr(self.request,"QUERY_PARAMS"): |
| 3550 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3551 | if (no_hyperlinks): |
| 3552 | return self.id_serializer_class |
| 3553 | else: |
| 3554 | return self.serializer_class |
| 3555 | |
| 3556 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 3557 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 3558 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3559 | return Role.select_by_user(self.request.user) |
| 3560 | |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3561 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 3562 | class RoleDetail(XOSRetrieveUpdateDestroyAPIView): |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3563 | queryset = Role.objects.select_related().all() |
| 3564 | serializer_class = RoleSerializer |
| 3565 | id_serializer_class = RoleIdSerializer |
| 3566 | |
| 3567 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 3568 | no_hyperlinks=False |
| 3569 | if hasattr(self.request,"QUERY_PARAMS"): |
| 3570 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3571 | if (no_hyperlinks): |
| 3572 | return self.id_serializer_class |
| 3573 | else: |
| 3574 | return self.serializer_class |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 3575 | |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3576 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 3577 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 3578 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3579 | return Role.select_by_user(self.request.user) |
| 3580 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 3581 | # update() is handled by XOSRetrieveUpdateDestroyAPIView |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3582 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 3583 | # destroy() is handled by XOSRetrieveUpdateDestroyAPIView |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3584 | |
| 3585 | |
| 3586 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 3587 | class UsableObjectList(XOSListCreateAPIView): |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3588 | queryset = UsableObject.objects.select_related().all() |
| 3589 | serializer_class = UsableObjectSerializer |
| 3590 | id_serializer_class = UsableObjectIdSerializer |
| 3591 | filter_backends = (filters.DjangoFilterBackend,) |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 3592 | filter_fields = ('id','created','updated','enacted','policed','backend_register','backend_status','deleted','name',) |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3593 | |
| 3594 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 3595 | no_hyperlinks=False |
| 3596 | if hasattr(self.request,"QUERY_PARAMS"): |
| 3597 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3598 | if (no_hyperlinks): |
| 3599 | return self.id_serializer_class |
| 3600 | else: |
| 3601 | return self.serializer_class |
| 3602 | |
| 3603 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 3604 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 3605 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3606 | return UsableObject.select_by_user(self.request.user) |
| 3607 | |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3608 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 3609 | class UsableObjectDetail(XOSRetrieveUpdateDestroyAPIView): |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3610 | queryset = UsableObject.objects.select_related().all() |
| 3611 | serializer_class = UsableObjectSerializer |
| 3612 | id_serializer_class = UsableObjectIdSerializer |
| 3613 | |
| 3614 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 3615 | no_hyperlinks=False |
| 3616 | if hasattr(self.request,"QUERY_PARAMS"): |
| 3617 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3618 | if (no_hyperlinks): |
| 3619 | return self.id_serializer_class |
| 3620 | else: |
| 3621 | return self.serializer_class |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 3622 | |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3623 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 3624 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 3625 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3626 | return UsableObject.select_by_user(self.request.user) |
| 3627 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 3628 | # update() is handled by XOSRetrieveUpdateDestroyAPIView |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3629 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 3630 | # destroy() is handled by XOSRetrieveUpdateDestroyAPIView |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3631 | |
| 3632 | |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 3633 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 3634 | class SiteRoleList(XOSListCreateAPIView): |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3635 | queryset = SiteRole.objects.select_related().all() |
| 3636 | serializer_class = SiteRoleSerializer |
| 3637 | id_serializer_class = SiteRoleIdSerializer |
| 3638 | filter_backends = (filters.DjangoFilterBackend,) |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 3639 | filter_fields = ('id','created','updated','enacted','policed','backend_register','backend_status','deleted','role',) |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3640 | |
| 3641 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 3642 | no_hyperlinks=False |
| 3643 | if hasattr(self.request,"QUERY_PARAMS"): |
| 3644 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3645 | if (no_hyperlinks): |
| 3646 | return self.id_serializer_class |
| 3647 | else: |
| 3648 | return self.serializer_class |
| 3649 | |
| 3650 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 3651 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 3652 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3653 | return SiteRole.select_by_user(self.request.user) |
| 3654 | |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3655 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 3656 | class SiteRoleDetail(XOSRetrieveUpdateDestroyAPIView): |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3657 | queryset = SiteRole.objects.select_related().all() |
| 3658 | serializer_class = SiteRoleSerializer |
| 3659 | id_serializer_class = SiteRoleIdSerializer |
| 3660 | |
| 3661 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 3662 | no_hyperlinks=False |
| 3663 | if hasattr(self.request,"QUERY_PARAMS"): |
| 3664 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3665 | if (no_hyperlinks): |
| 3666 | return self.id_serializer_class |
| 3667 | else: |
| 3668 | return self.serializer_class |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 3669 | |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3670 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 3671 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 3672 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3673 | return SiteRole.select_by_user(self.request.user) |
| 3674 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 3675 | # update() is handled by XOSRetrieveUpdateDestroyAPIView |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3676 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 3677 | # destroy() is handled by XOSRetrieveUpdateDestroyAPIView |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3678 | |
| 3679 | |
| 3680 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 3681 | class SliceCredentialList(XOSListCreateAPIView): |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3682 | queryset = SliceCredential.objects.select_related().all() |
| 3683 | serializer_class = SliceCredentialSerializer |
| 3684 | id_serializer_class = SliceCredentialIdSerializer |
| 3685 | filter_backends = (filters.DjangoFilterBackend,) |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 3686 | filter_fields = ('id','created','updated','enacted','policed','backend_register','backend_status','deleted','slice','name','key_id','enc_value',) |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3687 | |
| 3688 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 3689 | no_hyperlinks=False |
| 3690 | if hasattr(self.request,"QUERY_PARAMS"): |
| 3691 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3692 | if (no_hyperlinks): |
| 3693 | return self.id_serializer_class |
| 3694 | else: |
| 3695 | return self.serializer_class |
| 3696 | |
| 3697 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 3698 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 3699 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3700 | return SliceCredential.select_by_user(self.request.user) |
| 3701 | |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3702 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 3703 | class SliceCredentialDetail(XOSRetrieveUpdateDestroyAPIView): |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3704 | queryset = SliceCredential.objects.select_related().all() |
| 3705 | serializer_class = SliceCredentialSerializer |
| 3706 | id_serializer_class = SliceCredentialIdSerializer |
| 3707 | |
| 3708 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 3709 | no_hyperlinks=False |
| 3710 | if hasattr(self.request,"QUERY_PARAMS"): |
| 3711 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3712 | if (no_hyperlinks): |
| 3713 | return self.id_serializer_class |
| 3714 | else: |
| 3715 | return self.serializer_class |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 3716 | |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3717 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 3718 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 3719 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3720 | return SliceCredential.select_by_user(self.request.user) |
| 3721 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 3722 | # update() is handled by XOSRetrieveUpdateDestroyAPIView |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3723 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 3724 | # destroy() is handled by XOSRetrieveUpdateDestroyAPIView |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3725 | |
| 3726 | |
| 3727 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 3728 | class SliverList(XOSListCreateAPIView): |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3729 | queryset = Sliver.objects.select_related().all() |
| 3730 | serializer_class = SliverSerializer |
| 3731 | id_serializer_class = SliverIdSerializer |
| 3732 | filter_backends = (filters.DjangoFilterBackend,) |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 3733 | filter_fields = ('id','created','updated','enacted','policed','backend_register','backend_status','deleted','instance_id','instance_uuid','name','instance_name','ip','image','creator','slice','deployment','node','numberCores','flavor','userData','networks',) |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3734 | |
| 3735 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 3736 | no_hyperlinks=False |
| 3737 | if hasattr(self.request,"QUERY_PARAMS"): |
| 3738 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3739 | if (no_hyperlinks): |
| 3740 | return self.id_serializer_class |
| 3741 | else: |
| 3742 | return self.serializer_class |
| 3743 | |
| 3744 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 3745 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 3746 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3747 | return Sliver.select_by_user(self.request.user) |
| 3748 | |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3749 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 3750 | class SliverDetail(XOSRetrieveUpdateDestroyAPIView): |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3751 | queryset = Sliver.objects.select_related().all() |
| 3752 | serializer_class = SliverSerializer |
| 3753 | id_serializer_class = SliverIdSerializer |
| 3754 | |
| 3755 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 3756 | no_hyperlinks=False |
| 3757 | if hasattr(self.request,"QUERY_PARAMS"): |
| 3758 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3759 | if (no_hyperlinks): |
| 3760 | return self.id_serializer_class |
| 3761 | else: |
| 3762 | return self.serializer_class |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 3763 | |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3764 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 3765 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 3766 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3767 | return Sliver.select_by_user(self.request.user) |
| 3768 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 3769 | # update() is handled by XOSRetrieveUpdateDestroyAPIView |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3770 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 3771 | # destroy() is handled by XOSRetrieveUpdateDestroyAPIView |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3772 | |
| 3773 | |
| 3774 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 3775 | class NodeList(XOSListCreateAPIView): |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3776 | queryset = Node.objects.select_related().all() |
| 3777 | serializer_class = NodeSerializer |
| 3778 | id_serializer_class = NodeIdSerializer |
| 3779 | filter_backends = (filters.DjangoFilterBackend,) |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 3780 | filter_fields = ('id','created','updated','enacted','policed','backend_register','backend_status','deleted','name','site_deployment','site',) |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3781 | |
| 3782 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 3783 | no_hyperlinks=False |
| 3784 | if hasattr(self.request,"QUERY_PARAMS"): |
| 3785 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3786 | if (no_hyperlinks): |
| 3787 | return self.id_serializer_class |
| 3788 | else: |
| 3789 | return self.serializer_class |
| 3790 | |
| 3791 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 3792 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 3793 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3794 | return Node.select_by_user(self.request.user) |
| 3795 | |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3796 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 3797 | class NodeDetail(XOSRetrieveUpdateDestroyAPIView): |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3798 | queryset = Node.objects.select_related().all() |
| 3799 | serializer_class = NodeSerializer |
| 3800 | id_serializer_class = NodeIdSerializer |
| 3801 | |
| 3802 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 3803 | no_hyperlinks=False |
| 3804 | if hasattr(self.request,"QUERY_PARAMS"): |
| 3805 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3806 | if (no_hyperlinks): |
| 3807 | return self.id_serializer_class |
| 3808 | else: |
| 3809 | return self.serializer_class |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 3810 | |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3811 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 3812 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 3813 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3814 | return Node.select_by_user(self.request.user) |
| 3815 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 3816 | # update() is handled by XOSRetrieveUpdateDestroyAPIView |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3817 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 3818 | # destroy() is handled by XOSRetrieveUpdateDestroyAPIView |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3819 | |
| 3820 | |
| 3821 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 3822 | class DashboardViewList(XOSListCreateAPIView): |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3823 | queryset = DashboardView.objects.select_related().all() |
| 3824 | serializer_class = DashboardViewSerializer |
| 3825 | id_serializer_class = DashboardViewIdSerializer |
| 3826 | filter_backends = (filters.DjangoFilterBackend,) |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 3827 | filter_fields = ('id','created','updated','enacted','policed','backend_register','backend_status','deleted','name','url','enabled','controllers',) |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3828 | |
| 3829 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 3830 | no_hyperlinks=False |
| 3831 | if hasattr(self.request,"QUERY_PARAMS"): |
| 3832 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3833 | if (no_hyperlinks): |
| 3834 | return self.id_serializer_class |
| 3835 | else: |
| 3836 | return self.serializer_class |
| 3837 | |
| 3838 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 3839 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 3840 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3841 | return DashboardView.select_by_user(self.request.user) |
| 3842 | |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3843 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 3844 | class DashboardViewDetail(XOSRetrieveUpdateDestroyAPIView): |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3845 | queryset = DashboardView.objects.select_related().all() |
| 3846 | serializer_class = DashboardViewSerializer |
| 3847 | id_serializer_class = DashboardViewIdSerializer |
| 3848 | |
| 3849 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 3850 | no_hyperlinks=False |
| 3851 | if hasattr(self.request,"QUERY_PARAMS"): |
| 3852 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3853 | if (no_hyperlinks): |
| 3854 | return self.id_serializer_class |
| 3855 | else: |
| 3856 | return self.serializer_class |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 3857 | |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3858 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 3859 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 3860 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3861 | return DashboardView.select_by_user(self.request.user) |
| 3862 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 3863 | # update() is handled by XOSRetrieveUpdateDestroyAPIView |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3864 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 3865 | # destroy() is handled by XOSRetrieveUpdateDestroyAPIView |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3866 | |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3867 | |
Scott Baker | 57c725c | 2014-11-12 01:13:53 -0800 | [diff] [blame] | 3868 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 3869 | class ControllerNetworkList(XOSListCreateAPIView): |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 3870 | queryset = ControllerNetwork.objects.select_related().all() |
| 3871 | serializer_class = ControllerNetworkSerializer |
| 3872 | id_serializer_class = ControllerNetworkIdSerializer |
| 3873 | filter_backends = (filters.DjangoFilterBackend,) |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 3874 | filter_fields = ('id','created','updated','enacted','policed','backend_register','backend_status','deleted','network','controller','net_id','router_id','subnet_id','subnet',) |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 3875 | |
| 3876 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 3877 | no_hyperlinks=False |
| 3878 | if hasattr(self.request,"QUERY_PARAMS"): |
| 3879 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 3880 | if (no_hyperlinks): |
| 3881 | return self.id_serializer_class |
| 3882 | else: |
| 3883 | return self.serializer_class |
| 3884 | |
| 3885 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 3886 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 3887 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 3888 | return ControllerNetwork.select_by_user(self.request.user) |
| 3889 | |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 3890 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 3891 | class ControllerNetworkDetail(XOSRetrieveUpdateDestroyAPIView): |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 3892 | queryset = ControllerNetwork.objects.select_related().all() |
| 3893 | serializer_class = ControllerNetworkSerializer |
| 3894 | id_serializer_class = ControllerNetworkIdSerializer |
| 3895 | |
| 3896 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 3897 | no_hyperlinks=False |
| 3898 | if hasattr(self.request,"QUERY_PARAMS"): |
| 3899 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 3900 | if (no_hyperlinks): |
| 3901 | return self.id_serializer_class |
| 3902 | else: |
| 3903 | return self.serializer_class |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 3904 | |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 3905 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 3906 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 3907 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 3908 | return ControllerNetwork.select_by_user(self.request.user) |
| 3909 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 3910 | # update() is handled by XOSRetrieveUpdateDestroyAPIView |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 3911 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 3912 | # destroy() is handled by XOSRetrieveUpdateDestroyAPIView |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 3913 | |
| 3914 | |
| 3915 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 3916 | class ImageDeploymentsList(XOSListCreateAPIView): |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 3917 | queryset = ImageDeployments.objects.select_related().all() |
| 3918 | serializer_class = ImageDeploymentsSerializer |
| 3919 | id_serializer_class = ImageDeploymentsIdSerializer |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 3920 | filter_backends = (filters.DjangoFilterBackend,) |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 3921 | filter_fields = ('id','created','updated','enacted','policed','backend_register','backend_status','deleted','image','deployment',) |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 3922 | |
| 3923 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 3924 | no_hyperlinks=False |
| 3925 | if hasattr(self.request,"QUERY_PARAMS"): |
| 3926 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 3927 | if (no_hyperlinks): |
| 3928 | return self.id_serializer_class |
| 3929 | else: |
| 3930 | return self.serializer_class |
| 3931 | |
| 3932 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 3933 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 3934 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 3935 | return ImageDeployments.select_by_user(self.request.user) |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 3936 | |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 3937 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 3938 | class ImageDeploymentsDetail(XOSRetrieveUpdateDestroyAPIView): |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 3939 | queryset = ImageDeployments.objects.select_related().all() |
| 3940 | serializer_class = ImageDeploymentsSerializer |
| 3941 | id_serializer_class = ImageDeploymentsIdSerializer |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 3942 | |
| 3943 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 3944 | no_hyperlinks=False |
| 3945 | if hasattr(self.request,"QUERY_PARAMS"): |
| 3946 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 3947 | if (no_hyperlinks): |
| 3948 | return self.id_serializer_class |
| 3949 | else: |
| 3950 | return self.serializer_class |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 3951 | |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 3952 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 3953 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 3954 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 3955 | return ImageDeployments.select_by_user(self.request.user) |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 3956 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 3957 | # update() is handled by XOSRetrieveUpdateDestroyAPIView |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 3958 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 3959 | # destroy() is handled by XOSRetrieveUpdateDestroyAPIView |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 3960 | |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 3961 | |
| 3962 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 3963 | class ControllerUserList(XOSListCreateAPIView): |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 3964 | queryset = ControllerUser.objects.select_related().all() |
| 3965 | serializer_class = ControllerUserSerializer |
| 3966 | id_serializer_class = ControllerUserIdSerializer |
| 3967 | filter_backends = (filters.DjangoFilterBackend,) |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 3968 | filter_fields = ('id','created','updated','enacted','policed','backend_register','backend_status','deleted','user','controller','kuser_id',) |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 3969 | |
| 3970 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 3971 | no_hyperlinks=False |
| 3972 | if hasattr(self.request,"QUERY_PARAMS"): |
| 3973 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 3974 | if (no_hyperlinks): |
| 3975 | return self.id_serializer_class |
| 3976 | else: |
| 3977 | return self.serializer_class |
| 3978 | |
| 3979 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 3980 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 3981 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 3982 | return ControllerUser.select_by_user(self.request.user) |
| 3983 | |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 3984 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 3985 | class ControllerUserDetail(XOSRetrieveUpdateDestroyAPIView): |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 3986 | queryset = ControllerUser.objects.select_related().all() |
| 3987 | serializer_class = ControllerUserSerializer |
| 3988 | id_serializer_class = ControllerUserIdSerializer |
| 3989 | |
| 3990 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 3991 | no_hyperlinks=False |
| 3992 | if hasattr(self.request,"QUERY_PARAMS"): |
| 3993 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 3994 | if (no_hyperlinks): |
| 3995 | return self.id_serializer_class |
| 3996 | else: |
| 3997 | return self.serializer_class |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 3998 | |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 3999 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 4000 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 4001 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 4002 | return ControllerUser.select_by_user(self.request.user) |
| 4003 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 4004 | # update() is handled by XOSRetrieveUpdateDestroyAPIView |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 4005 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 4006 | # destroy() is handled by XOSRetrieveUpdateDestroyAPIView |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 4007 | |
| 4008 | |
| 4009 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 4010 | class ReservedResourceList(XOSListCreateAPIView): |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4011 | queryset = ReservedResource.objects.select_related().all() |
| 4012 | serializer_class = ReservedResourceSerializer |
| 4013 | id_serializer_class = ReservedResourceIdSerializer |
| 4014 | filter_backends = (filters.DjangoFilterBackend,) |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 4015 | filter_fields = ('id','created','updated','enacted','policed','backend_register','backend_status','deleted','sliver','resource','quantity','reservationSet',) |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4016 | |
| 4017 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 4018 | no_hyperlinks=False |
| 4019 | if hasattr(self.request,"QUERY_PARAMS"): |
| 4020 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4021 | if (no_hyperlinks): |
| 4022 | return self.id_serializer_class |
| 4023 | else: |
| 4024 | return self.serializer_class |
| 4025 | |
| 4026 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 4027 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 4028 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4029 | return ReservedResource.select_by_user(self.request.user) |
| 4030 | |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4031 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 4032 | class ReservedResourceDetail(XOSRetrieveUpdateDestroyAPIView): |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4033 | queryset = ReservedResource.objects.select_related().all() |
| 4034 | serializer_class = ReservedResourceSerializer |
| 4035 | id_serializer_class = ReservedResourceIdSerializer |
| 4036 | |
| 4037 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 4038 | no_hyperlinks=False |
| 4039 | if hasattr(self.request,"QUERY_PARAMS"): |
| 4040 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4041 | if (no_hyperlinks): |
| 4042 | return self.id_serializer_class |
| 4043 | else: |
| 4044 | return self.serializer_class |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 4045 | |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4046 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 4047 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 4048 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4049 | return ReservedResource.select_by_user(self.request.user) |
| 4050 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 4051 | # update() is handled by XOSRetrieveUpdateDestroyAPIView |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4052 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 4053 | # destroy() is handled by XOSRetrieveUpdateDestroyAPIView |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4054 | |
| 4055 | |
| 4056 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 4057 | class PaymentList(XOSListCreateAPIView): |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 4058 | queryset = Payment.objects.select_related().all() |
| 4059 | serializer_class = PaymentSerializer |
| 4060 | id_serializer_class = PaymentIdSerializer |
| 4061 | filter_backends = (filters.DjangoFilterBackend,) |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 4062 | filter_fields = ('id','created','updated','enacted','policed','backend_register','backend_status','deleted','account','amount','date',) |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 4063 | |
| 4064 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 4065 | no_hyperlinks=False |
| 4066 | if hasattr(self.request,"QUERY_PARAMS"): |
| 4067 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 4068 | if (no_hyperlinks): |
| 4069 | return self.id_serializer_class |
| 4070 | else: |
| 4071 | return self.serializer_class |
| 4072 | |
| 4073 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 4074 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 4075 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 4076 | return Payment.select_by_user(self.request.user) |
| 4077 | |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 4078 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 4079 | class PaymentDetail(XOSRetrieveUpdateDestroyAPIView): |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 4080 | queryset = Payment.objects.select_related().all() |
| 4081 | serializer_class = PaymentSerializer |
| 4082 | id_serializer_class = PaymentIdSerializer |
| 4083 | |
| 4084 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 4085 | no_hyperlinks=False |
| 4086 | if hasattr(self.request,"QUERY_PARAMS"): |
| 4087 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 4088 | if (no_hyperlinks): |
| 4089 | return self.id_serializer_class |
| 4090 | else: |
| 4091 | return self.serializer_class |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 4092 | |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 4093 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 4094 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 4095 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 4096 | return Payment.select_by_user(self.request.user) |
| 4097 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 4098 | # update() is handled by XOSRetrieveUpdateDestroyAPIView |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 4099 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 4100 | # destroy() is handled by XOSRetrieveUpdateDestroyAPIView |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 4101 | |
| 4102 | |
| 4103 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 4104 | class NetworkSliceList(XOSListCreateAPIView): |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4105 | queryset = NetworkSlice.objects.select_related().all() |
| 4106 | serializer_class = NetworkSliceSerializer |
| 4107 | id_serializer_class = NetworkSliceIdSerializer |
| 4108 | filter_backends = (filters.DjangoFilterBackend,) |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 4109 | filter_fields = ('id','created','updated','enacted','policed','backend_register','backend_status','deleted','network','slice',) |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4110 | |
| 4111 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 4112 | no_hyperlinks=False |
| 4113 | if hasattr(self.request,"QUERY_PARAMS"): |
| 4114 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4115 | if (no_hyperlinks): |
| 4116 | return self.id_serializer_class |
| 4117 | else: |
| 4118 | return self.serializer_class |
| 4119 | |
| 4120 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 4121 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 4122 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4123 | return NetworkSlice.select_by_user(self.request.user) |
| 4124 | |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4125 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 4126 | class NetworkSliceDetail(XOSRetrieveUpdateDestroyAPIView): |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4127 | queryset = NetworkSlice.objects.select_related().all() |
| 4128 | serializer_class = NetworkSliceSerializer |
| 4129 | id_serializer_class = NetworkSliceIdSerializer |
| 4130 | |
| 4131 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 4132 | no_hyperlinks=False |
| 4133 | if hasattr(self.request,"QUERY_PARAMS"): |
| 4134 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4135 | if (no_hyperlinks): |
| 4136 | return self.id_serializer_class |
| 4137 | else: |
| 4138 | return self.serializer_class |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 4139 | |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4140 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 4141 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 4142 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4143 | return NetworkSlice.select_by_user(self.request.user) |
| 4144 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 4145 | # update() is handled by XOSRetrieveUpdateDestroyAPIView |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4146 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 4147 | # destroy() is handled by XOSRetrieveUpdateDestroyAPIView |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4148 | |
| 4149 | |
| 4150 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 4151 | class UserDashboardViewList(XOSListCreateAPIView): |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4152 | queryset = UserDashboardView.objects.select_related().all() |
| 4153 | serializer_class = UserDashboardViewSerializer |
| 4154 | id_serializer_class = UserDashboardViewIdSerializer |
| 4155 | filter_backends = (filters.DjangoFilterBackend,) |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 4156 | filter_fields = ('id','created','updated','enacted','policed','backend_register','backend_status','deleted','user','dashboardView','order',) |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4157 | |
| 4158 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 4159 | no_hyperlinks=False |
| 4160 | if hasattr(self.request,"QUERY_PARAMS"): |
| 4161 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4162 | if (no_hyperlinks): |
| 4163 | return self.id_serializer_class |
| 4164 | else: |
| 4165 | return self.serializer_class |
| 4166 | |
| 4167 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 4168 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 4169 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4170 | return UserDashboardView.select_by_user(self.request.user) |
| 4171 | |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4172 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 4173 | class UserDashboardViewDetail(XOSRetrieveUpdateDestroyAPIView): |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4174 | queryset = UserDashboardView.objects.select_related().all() |
| 4175 | serializer_class = UserDashboardViewSerializer |
| 4176 | id_serializer_class = UserDashboardViewIdSerializer |
| 4177 | |
| 4178 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 4179 | no_hyperlinks=False |
| 4180 | if hasattr(self.request,"QUERY_PARAMS"): |
| 4181 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4182 | if (no_hyperlinks): |
| 4183 | return self.id_serializer_class |
| 4184 | else: |
| 4185 | return self.serializer_class |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 4186 | |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4187 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 4188 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 4189 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4190 | return UserDashboardView.select_by_user(self.request.user) |
| 4191 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 4192 | # update() is handled by XOSRetrieveUpdateDestroyAPIView |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4193 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 4194 | # destroy() is handled by XOSRetrieveUpdateDestroyAPIView |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4195 | |
| 4196 | |
| 4197 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 4198 | class ControllerList(XOSListCreateAPIView): |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 4199 | queryset = Controller.objects.select_related().all() |
| 4200 | serializer_class = ControllerSerializer |
| 4201 | id_serializer_class = ControllerIdSerializer |
| 4202 | filter_backends = (filters.DjangoFilterBackend,) |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 4203 | filter_fields = ('id','created','updated','enacted','policed','backend_register','backend_status','deleted','name','backend_type','version','auth_url','admin_user','admin_password','admin_tenant','dashboardviews',) |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 4204 | |
| 4205 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 4206 | no_hyperlinks=False |
| 4207 | if hasattr(self.request,"QUERY_PARAMS"): |
| 4208 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 4209 | if (no_hyperlinks): |
| 4210 | return self.id_serializer_class |
| 4211 | else: |
| 4212 | return self.serializer_class |
| 4213 | |
| 4214 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 4215 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 4216 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 4217 | return Controller.select_by_user(self.request.user) |
| 4218 | |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 4219 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 4220 | class ControllerDetail(XOSRetrieveUpdateDestroyAPIView): |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 4221 | queryset = Controller.objects.select_related().all() |
| 4222 | serializer_class = ControllerSerializer |
| 4223 | id_serializer_class = ControllerIdSerializer |
| 4224 | |
| 4225 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 4226 | no_hyperlinks=False |
| 4227 | if hasattr(self.request,"QUERY_PARAMS"): |
| 4228 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 4229 | if (no_hyperlinks): |
| 4230 | return self.id_serializer_class |
| 4231 | else: |
| 4232 | return self.serializer_class |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 4233 | |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 4234 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 4235 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 4236 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 4237 | return Controller.select_by_user(self.request.user) |
| 4238 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 4239 | # update() is handled by XOSRetrieveUpdateDestroyAPIView |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 4240 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 4241 | # destroy() is handled by XOSRetrieveUpdateDestroyAPIView |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 4242 | |
| 4243 | |
| 4244 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 4245 | class PlanetStackPrivilegeList(XOSListCreateAPIView): |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4246 | queryset = PlanetStackPrivilege.objects.select_related().all() |
| 4247 | serializer_class = PlanetStackPrivilegeSerializer |
| 4248 | id_serializer_class = PlanetStackPrivilegeIdSerializer |
| 4249 | filter_backends = (filters.DjangoFilterBackend,) |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 4250 | filter_fields = ('id','created','updated','enacted','policed','backend_register','backend_status','deleted','user','planetstack','role',) |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4251 | |
| 4252 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 4253 | no_hyperlinks=False |
| 4254 | if hasattr(self.request,"QUERY_PARAMS"): |
| 4255 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4256 | if (no_hyperlinks): |
| 4257 | return self.id_serializer_class |
| 4258 | else: |
| 4259 | return self.serializer_class |
| 4260 | |
| 4261 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 4262 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 4263 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4264 | return PlanetStackPrivilege.select_by_user(self.request.user) |
| 4265 | |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4266 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 4267 | class PlanetStackPrivilegeDetail(XOSRetrieveUpdateDestroyAPIView): |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4268 | queryset = PlanetStackPrivilege.objects.select_related().all() |
| 4269 | serializer_class = PlanetStackPrivilegeSerializer |
| 4270 | id_serializer_class = PlanetStackPrivilegeIdSerializer |
| 4271 | |
| 4272 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 4273 | no_hyperlinks=False |
| 4274 | if hasattr(self.request,"QUERY_PARAMS"): |
| 4275 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4276 | if (no_hyperlinks): |
| 4277 | return self.id_serializer_class |
| 4278 | else: |
| 4279 | return self.serializer_class |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 4280 | |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4281 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 4282 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 4283 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4284 | return PlanetStackPrivilege.select_by_user(self.request.user) |
| 4285 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 4286 | # update() is handled by XOSRetrieveUpdateDestroyAPIView |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4287 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 4288 | # destroy() is handled by XOSRetrieveUpdateDestroyAPIView |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4289 | |
| 4290 | |
| 4291 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 4292 | class UserList(XOSListCreateAPIView): |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4293 | queryset = User.objects.select_related().all() |
| 4294 | serializer_class = UserSerializer |
| 4295 | id_serializer_class = UserIdSerializer |
| 4296 | filter_backends = (filters.DjangoFilterBackend,) |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 4297 | filter_fields = ('id','password','last_login','email','username','firstname','lastname','phone','user_url','site','public_key','is_active','is_admin','is_staff','is_readonly','is_registering','created','updated','enacted','policed','backend_status','deleted','timezone',) |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4298 | |
| 4299 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 4300 | no_hyperlinks=False |
| 4301 | if hasattr(self.request,"QUERY_PARAMS"): |
| 4302 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4303 | if (no_hyperlinks): |
| 4304 | return self.id_serializer_class |
| 4305 | else: |
| 4306 | return self.serializer_class |
| 4307 | |
| 4308 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 4309 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 4310 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4311 | return User.select_by_user(self.request.user) |
| 4312 | |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4313 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 4314 | class UserDetail(XOSRetrieveUpdateDestroyAPIView): |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4315 | queryset = User.objects.select_related().all() |
| 4316 | serializer_class = UserSerializer |
| 4317 | id_serializer_class = UserIdSerializer |
| 4318 | |
| 4319 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 4320 | no_hyperlinks=False |
| 4321 | if hasattr(self.request,"QUERY_PARAMS"): |
| 4322 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4323 | if (no_hyperlinks): |
| 4324 | return self.id_serializer_class |
| 4325 | else: |
| 4326 | return self.serializer_class |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 4327 | |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4328 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 4329 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 4330 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4331 | return User.select_by_user(self.request.user) |
| 4332 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 4333 | # update() is handled by XOSRetrieveUpdateDestroyAPIView |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4334 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 4335 | # destroy() is handled by XOSRetrieveUpdateDestroyAPIView |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4336 | |
| 4337 | |
| 4338 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 4339 | class DeploymentList(XOSListCreateAPIView): |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4340 | queryset = Deployment.objects.select_related().all() |
| 4341 | serializer_class = DeploymentSerializer |
| 4342 | id_serializer_class = DeploymentIdSerializer |
| 4343 | filter_backends = (filters.DjangoFilterBackend,) |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 4344 | filter_fields = ('id','created','updated','enacted','policed','backend_register','backend_status','deleted','name','accessControl','images','sites','flavors',) |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4345 | |
| 4346 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 4347 | no_hyperlinks=False |
| 4348 | if hasattr(self.request,"QUERY_PARAMS"): |
| 4349 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4350 | if (no_hyperlinks): |
| 4351 | return self.id_serializer_class |
| 4352 | else: |
| 4353 | return self.serializer_class |
| 4354 | |
| 4355 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 4356 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 4357 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4358 | return Deployment.select_by_user(self.request.user) |
| 4359 | |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4360 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 4361 | class DeploymentDetail(XOSRetrieveUpdateDestroyAPIView): |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4362 | queryset = Deployment.objects.select_related().all() |
| 4363 | serializer_class = DeploymentSerializer |
| 4364 | id_serializer_class = DeploymentIdSerializer |
| 4365 | |
| 4366 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 4367 | no_hyperlinks=False |
| 4368 | if hasattr(self.request,"QUERY_PARAMS"): |
| 4369 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4370 | if (no_hyperlinks): |
| 4371 | return self.id_serializer_class |
| 4372 | else: |
| 4373 | return self.serializer_class |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 4374 | |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4375 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 4376 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 4377 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4378 | return Deployment.select_by_user(self.request.user) |
| 4379 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 4380 | # update() is handled by XOSRetrieveUpdateDestroyAPIView |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4381 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 4382 | # destroy() is handled by XOSRetrieveUpdateDestroyAPIView |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4383 | |
| 4384 | |
| 4385 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 4386 | class ReservationList(XOSListCreateAPIView): |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4387 | queryset = Reservation.objects.select_related().all() |
| 4388 | serializer_class = ReservationSerializer |
| 4389 | id_serializer_class = ReservationIdSerializer |
| 4390 | filter_backends = (filters.DjangoFilterBackend,) |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 4391 | filter_fields = ('id','created','updated','enacted','policed','backend_register','backend_status','deleted','startTime','slice','duration',) |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4392 | |
| 4393 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 4394 | no_hyperlinks=False |
| 4395 | if hasattr(self.request,"QUERY_PARAMS"): |
| 4396 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4397 | if (no_hyperlinks): |
| 4398 | return self.id_serializer_class |
| 4399 | else: |
| 4400 | return self.serializer_class |
| 4401 | |
| 4402 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 4403 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 4404 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4405 | return Reservation.select_by_user(self.request.user) |
| 4406 | |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4407 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 4408 | class ReservationDetail(XOSRetrieveUpdateDestroyAPIView): |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4409 | queryset = Reservation.objects.select_related().all() |
| 4410 | serializer_class = ReservationSerializer |
| 4411 | id_serializer_class = ReservationIdSerializer |
| 4412 | |
| 4413 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 4414 | no_hyperlinks=False |
| 4415 | if hasattr(self.request,"QUERY_PARAMS"): |
| 4416 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4417 | if (no_hyperlinks): |
| 4418 | return self.id_serializer_class |
| 4419 | else: |
| 4420 | return self.serializer_class |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 4421 | |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4422 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 4423 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 4424 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4425 | return Reservation.select_by_user(self.request.user) |
| 4426 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 4427 | # update() is handled by XOSRetrieveUpdateDestroyAPIView |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4428 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 4429 | # destroy() is handled by XOSRetrieveUpdateDestroyAPIView |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4430 | |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4431 | |
Scott Baker | 57c725c | 2014-11-12 01:13:53 -0800 | [diff] [blame] | 4432 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 4433 | class SitePrivilegeList(XOSListCreateAPIView): |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4434 | queryset = SitePrivilege.objects.select_related().all() |
| 4435 | serializer_class = SitePrivilegeSerializer |
| 4436 | id_serializer_class = SitePrivilegeIdSerializer |
| 4437 | filter_backends = (filters.DjangoFilterBackend,) |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 4438 | filter_fields = ('id','created','updated','enacted','policed','backend_register','backend_status','deleted','user','site','role',) |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4439 | |
| 4440 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 4441 | no_hyperlinks=False |
| 4442 | if hasattr(self.request,"QUERY_PARAMS"): |
| 4443 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4444 | if (no_hyperlinks): |
| 4445 | return self.id_serializer_class |
| 4446 | else: |
| 4447 | return self.serializer_class |
| 4448 | |
| 4449 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 4450 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 4451 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4452 | return SitePrivilege.select_by_user(self.request.user) |
| 4453 | |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4454 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 4455 | class SitePrivilegeDetail(XOSRetrieveUpdateDestroyAPIView): |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4456 | queryset = SitePrivilege.objects.select_related().all() |
| 4457 | serializer_class = SitePrivilegeSerializer |
| 4458 | id_serializer_class = SitePrivilegeIdSerializer |
| 4459 | |
| 4460 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 4461 | no_hyperlinks=False |
| 4462 | if hasattr(self.request,"QUERY_PARAMS"): |
| 4463 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4464 | if (no_hyperlinks): |
| 4465 | return self.id_serializer_class |
| 4466 | else: |
| 4467 | return self.serializer_class |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 4468 | |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4469 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 4470 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 4471 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4472 | return SitePrivilege.select_by_user(self.request.user) |
| 4473 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 4474 | # update() is handled by XOSRetrieveUpdateDestroyAPIView |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4475 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 4476 | # destroy() is handled by XOSRetrieveUpdateDestroyAPIView |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4477 | |
| 4478 | |
| 4479 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 4480 | class ControllerSliceList(XOSListCreateAPIView): |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 4481 | queryset = ControllerSlice.objects.select_related().all() |
| 4482 | serializer_class = ControllerSliceSerializer |
| 4483 | id_serializer_class = ControllerSliceIdSerializer |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4484 | filter_backends = (filters.DjangoFilterBackend,) |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 4485 | filter_fields = ('id','created','updated','enacted','policed','backend_register','backend_status','deleted','controller','slice','tenant_id',) |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4486 | |
| 4487 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 4488 | no_hyperlinks=False |
| 4489 | if hasattr(self.request,"QUERY_PARAMS"): |
| 4490 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4491 | if (no_hyperlinks): |
| 4492 | return self.id_serializer_class |
| 4493 | else: |
| 4494 | return self.serializer_class |
| 4495 | |
| 4496 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 4497 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 4498 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 4499 | return ControllerSlice.select_by_user(self.request.user) |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4500 | |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4501 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 4502 | class ControllerSliceDetail(XOSRetrieveUpdateDestroyAPIView): |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 4503 | queryset = ControllerSlice.objects.select_related().all() |
| 4504 | serializer_class = ControllerSliceSerializer |
| 4505 | id_serializer_class = ControllerSliceIdSerializer |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4506 | |
| 4507 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 4508 | no_hyperlinks=False |
| 4509 | if hasattr(self.request,"QUERY_PARAMS"): |
| 4510 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4511 | if (no_hyperlinks): |
| 4512 | return self.id_serializer_class |
| 4513 | else: |
| 4514 | return self.serializer_class |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 4515 | |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4516 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 4517 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 4518 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 4519 | return ControllerSlice.select_by_user(self.request.user) |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4520 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 4521 | # update() is handled by XOSRetrieveUpdateDestroyAPIView |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4522 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 4523 | # destroy() is handled by XOSRetrieveUpdateDestroyAPIView |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4524 | |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4525 | |
Scott Baker | 57c725c | 2014-11-12 01:13:53 -0800 | [diff] [blame] | 4526 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 4527 | class ControllerDashboardViewList(XOSListCreateAPIView): |
Scott Baker | f2c0c51 | 2014-12-22 17:35:34 -0800 | [diff] [blame] | 4528 | queryset = ControllerDashboardView.objects.select_related().all() |
| 4529 | serializer_class = ControllerDashboardViewSerializer |
| 4530 | id_serializer_class = ControllerDashboardViewIdSerializer |
| 4531 | filter_backends = (filters.DjangoFilterBackend,) |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 4532 | filter_fields = ('id','created','updated','enacted','policed','backend_register','backend_status','deleted','controller','dashboardView','enabled','url',) |
Scott Baker | f2c0c51 | 2014-12-22 17:35:34 -0800 | [diff] [blame] | 4533 | |
| 4534 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 4535 | no_hyperlinks=False |
| 4536 | if hasattr(self.request,"QUERY_PARAMS"): |
| 4537 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | f2c0c51 | 2014-12-22 17:35:34 -0800 | [diff] [blame] | 4538 | if (no_hyperlinks): |
| 4539 | return self.id_serializer_class |
| 4540 | else: |
| 4541 | return self.serializer_class |
| 4542 | |
| 4543 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 4544 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 4545 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | f2c0c51 | 2014-12-22 17:35:34 -0800 | [diff] [blame] | 4546 | return ControllerDashboardView.select_by_user(self.request.user) |
| 4547 | |
Scott Baker | f2c0c51 | 2014-12-22 17:35:34 -0800 | [diff] [blame] | 4548 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 4549 | class ControllerDashboardViewDetail(XOSRetrieveUpdateDestroyAPIView): |
Scott Baker | f2c0c51 | 2014-12-22 17:35:34 -0800 | [diff] [blame] | 4550 | queryset = ControllerDashboardView.objects.select_related().all() |
| 4551 | serializer_class = ControllerDashboardViewSerializer |
| 4552 | id_serializer_class = ControllerDashboardViewIdSerializer |
| 4553 | |
| 4554 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 4555 | no_hyperlinks=False |
| 4556 | if hasattr(self.request,"QUERY_PARAMS"): |
| 4557 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | f2c0c51 | 2014-12-22 17:35:34 -0800 | [diff] [blame] | 4558 | if (no_hyperlinks): |
| 4559 | return self.id_serializer_class |
| 4560 | else: |
| 4561 | return self.serializer_class |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 4562 | |
Scott Baker | f2c0c51 | 2014-12-22 17:35:34 -0800 | [diff] [blame] | 4563 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 4564 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 4565 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | f2c0c51 | 2014-12-22 17:35:34 -0800 | [diff] [blame] | 4566 | return ControllerDashboardView.select_by_user(self.request.user) |
| 4567 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 4568 | # update() is handled by XOSRetrieveUpdateDestroyAPIView |
Scott Baker | f2c0c51 | 2014-12-22 17:35:34 -0800 | [diff] [blame] | 4569 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 4570 | # destroy() is handled by XOSRetrieveUpdateDestroyAPIView |
Scott Baker | f2c0c51 | 2014-12-22 17:35:34 -0800 | [diff] [blame] | 4571 | |
| 4572 | |
| 4573 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 4574 | class AccountList(XOSListCreateAPIView): |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4575 | queryset = Account.objects.select_related().all() |
| 4576 | serializer_class = AccountSerializer |
| 4577 | id_serializer_class = AccountIdSerializer |
| 4578 | filter_backends = (filters.DjangoFilterBackend,) |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 4579 | filter_fields = ('id','created','updated','enacted','policed','backend_register','backend_status','deleted','site',) |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4580 | |
| 4581 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 4582 | no_hyperlinks=False |
| 4583 | if hasattr(self.request,"QUERY_PARAMS"): |
| 4584 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4585 | if (no_hyperlinks): |
| 4586 | return self.id_serializer_class |
| 4587 | else: |
| 4588 | return self.serializer_class |
| 4589 | |
| 4590 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 4591 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 4592 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4593 | return Account.select_by_user(self.request.user) |
| 4594 | |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4595 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 4596 | class AccountDetail(XOSRetrieveUpdateDestroyAPIView): |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4597 | queryset = Account.objects.select_related().all() |
| 4598 | serializer_class = AccountSerializer |
| 4599 | id_serializer_class = AccountIdSerializer |
| 4600 | |
| 4601 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 4602 | no_hyperlinks=False |
| 4603 | if hasattr(self.request,"QUERY_PARAMS"): |
| 4604 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4605 | if (no_hyperlinks): |
| 4606 | return self.id_serializer_class |
| 4607 | else: |
| 4608 | return self.serializer_class |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 4609 | |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4610 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 4611 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 4612 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4613 | return Account.select_by_user(self.request.user) |
| 4614 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 4615 | # update() is handled by XOSRetrieveUpdateDestroyAPIView |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4616 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 4617 | # destroy() is handled by XOSRetrieveUpdateDestroyAPIView |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4618 | |
| 4619 | |
| 4620 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 4621 | class ControllerRoleList(XOSListCreateAPIView): |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 4622 | queryset = ControllerRole.objects.select_related().all() |
| 4623 | serializer_class = ControllerRoleSerializer |
| 4624 | id_serializer_class = ControllerRoleIdSerializer |
| 4625 | filter_backends = (filters.DjangoFilterBackend,) |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 4626 | filter_fields = ('id','created','updated','enacted','policed','backend_register','backend_status','deleted','role',) |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 4627 | |
| 4628 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 4629 | no_hyperlinks=False |
| 4630 | if hasattr(self.request,"QUERY_PARAMS"): |
| 4631 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 4632 | if (no_hyperlinks): |
| 4633 | return self.id_serializer_class |
| 4634 | else: |
| 4635 | return self.serializer_class |
| 4636 | |
| 4637 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 4638 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 4639 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 4640 | return ControllerRole.select_by_user(self.request.user) |
| 4641 | |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 4642 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 4643 | class ControllerRoleDetail(XOSRetrieveUpdateDestroyAPIView): |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 4644 | queryset = ControllerRole.objects.select_related().all() |
| 4645 | serializer_class = ControllerRoleSerializer |
| 4646 | id_serializer_class = ControllerRoleIdSerializer |
| 4647 | |
| 4648 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 4649 | no_hyperlinks=False |
| 4650 | if hasattr(self.request,"QUERY_PARAMS"): |
| 4651 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 4652 | if (no_hyperlinks): |
| 4653 | return self.id_serializer_class |
| 4654 | else: |
| 4655 | return self.serializer_class |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 4656 | |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 4657 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 4658 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 4659 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 4660 | return ControllerRole.select_by_user(self.request.user) |
| 4661 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 4662 | # update() is handled by XOSRetrieveUpdateDestroyAPIView |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 4663 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 4664 | # destroy() is handled by XOSRetrieveUpdateDestroyAPIView |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 4665 | |
| 4666 | |
| 4667 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 4668 | class NetworkParameterTypeList(XOSListCreateAPIView): |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4669 | queryset = NetworkParameterType.objects.select_related().all() |
| 4670 | serializer_class = NetworkParameterTypeSerializer |
| 4671 | id_serializer_class = NetworkParameterTypeIdSerializer |
| 4672 | filter_backends = (filters.DjangoFilterBackend,) |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 4673 | filter_fields = ('id','created','updated','enacted','policed','backend_register','backend_status','deleted','name','description',) |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4674 | |
| 4675 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 4676 | no_hyperlinks=False |
| 4677 | if hasattr(self.request,"QUERY_PARAMS"): |
| 4678 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4679 | if (no_hyperlinks): |
| 4680 | return self.id_serializer_class |
| 4681 | else: |
| 4682 | return self.serializer_class |
| 4683 | |
| 4684 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 4685 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 4686 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4687 | return NetworkParameterType.select_by_user(self.request.user) |
| 4688 | |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4689 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 4690 | class NetworkParameterTypeDetail(XOSRetrieveUpdateDestroyAPIView): |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4691 | queryset = NetworkParameterType.objects.select_related().all() |
| 4692 | serializer_class = NetworkParameterTypeSerializer |
| 4693 | id_serializer_class = NetworkParameterTypeIdSerializer |
| 4694 | |
| 4695 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 4696 | no_hyperlinks=False |
| 4697 | if hasattr(self.request,"QUERY_PARAMS"): |
| 4698 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4699 | if (no_hyperlinks): |
| 4700 | return self.id_serializer_class |
| 4701 | else: |
| 4702 | return self.serializer_class |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 4703 | |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4704 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 4705 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 4706 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4707 | return NetworkParameterType.select_by_user(self.request.user) |
| 4708 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 4709 | # update() is handled by XOSRetrieveUpdateDestroyAPIView |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4710 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 4711 | # destroy() is handled by XOSRetrieveUpdateDestroyAPIView |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4712 | |
| 4713 | |
| 4714 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 4715 | class SiteCredentialList(XOSListCreateAPIView): |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4716 | queryset = SiteCredential.objects.select_related().all() |
| 4717 | serializer_class = SiteCredentialSerializer |
| 4718 | id_serializer_class = SiteCredentialIdSerializer |
| 4719 | filter_backends = (filters.DjangoFilterBackend,) |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 4720 | filter_fields = ('id','created','updated','enacted','policed','backend_register','backend_status','deleted','site','name','key_id','enc_value',) |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4721 | |
| 4722 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 4723 | no_hyperlinks=False |
| 4724 | if hasattr(self.request,"QUERY_PARAMS"): |
| 4725 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4726 | if (no_hyperlinks): |
| 4727 | return self.id_serializer_class |
| 4728 | else: |
| 4729 | return self.serializer_class |
| 4730 | |
| 4731 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 4732 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 4733 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4734 | return SiteCredential.select_by_user(self.request.user) |
| 4735 | |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4736 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 4737 | class SiteCredentialDetail(XOSRetrieveUpdateDestroyAPIView): |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4738 | queryset = SiteCredential.objects.select_related().all() |
| 4739 | serializer_class = SiteCredentialSerializer |
| 4740 | id_serializer_class = SiteCredentialIdSerializer |
| 4741 | |
| 4742 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 4743 | no_hyperlinks=False |
| 4744 | if hasattr(self.request,"QUERY_PARAMS"): |
| 4745 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4746 | if (no_hyperlinks): |
| 4747 | return self.id_serializer_class |
| 4748 | else: |
| 4749 | return self.serializer_class |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 4750 | |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4751 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 4752 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 4753 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4754 | return SiteCredential.select_by_user(self.request.user) |
| 4755 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 4756 | # update() is handled by XOSRetrieveUpdateDestroyAPIView |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4757 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 4758 | # destroy() is handled by XOSRetrieveUpdateDestroyAPIView |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4759 | |
| 4760 | |
| 4761 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 4762 | class DeploymentPrivilegeList(XOSListCreateAPIView): |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 4763 | queryset = DeploymentPrivilege.objects.select_related().all() |
| 4764 | serializer_class = DeploymentPrivilegeSerializer |
| 4765 | id_serializer_class = DeploymentPrivilegeIdSerializer |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4766 | filter_backends = (filters.DjangoFilterBackend,) |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 4767 | filter_fields = ('id','created','updated','enacted','policed','backend_register','backend_status','deleted','user','deployment','role',) |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4768 | |
| 4769 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 4770 | no_hyperlinks=False |
| 4771 | if hasattr(self.request,"QUERY_PARAMS"): |
| 4772 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4773 | if (no_hyperlinks): |
| 4774 | return self.id_serializer_class |
| 4775 | else: |
| 4776 | return self.serializer_class |
| 4777 | |
| 4778 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 4779 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 4780 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 4781 | return DeploymentPrivilege.select_by_user(self.request.user) |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4782 | |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4783 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 4784 | class DeploymentPrivilegeDetail(XOSRetrieveUpdateDestroyAPIView): |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 4785 | queryset = DeploymentPrivilege.objects.select_related().all() |
| 4786 | serializer_class = DeploymentPrivilegeSerializer |
| 4787 | id_serializer_class = DeploymentPrivilegeIdSerializer |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4788 | |
| 4789 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 4790 | no_hyperlinks=False |
| 4791 | if hasattr(self.request,"QUERY_PARAMS"): |
| 4792 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4793 | if (no_hyperlinks): |
| 4794 | return self.id_serializer_class |
| 4795 | else: |
| 4796 | return self.serializer_class |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 4797 | |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4798 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 4799 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 4800 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 4801 | return DeploymentPrivilege.select_by_user(self.request.user) |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4802 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 4803 | # update() is handled by XOSRetrieveUpdateDestroyAPIView |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4804 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 4805 | # destroy() is handled by XOSRetrieveUpdateDestroyAPIView |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4806 | |
| 4807 | |
| 4808 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 4809 | class ControllerSlicePrivilegeList(XOSListCreateAPIView): |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 4810 | queryset = ControllerSlicePrivilege.objects.select_related().all() |
| 4811 | serializer_class = ControllerSlicePrivilegeSerializer |
| 4812 | id_serializer_class = ControllerSlicePrivilegeIdSerializer |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 4813 | filter_backends = (filters.DjangoFilterBackend,) |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 4814 | filter_fields = ('id','created','updated','enacted','policed','backend_register','backend_status','deleted','controller','slice_privilege','role_id',) |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 4815 | |
| 4816 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 4817 | no_hyperlinks=False |
| 4818 | if hasattr(self.request,"QUERY_PARAMS"): |
| 4819 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 4820 | if (no_hyperlinks): |
| 4821 | return self.id_serializer_class |
| 4822 | else: |
| 4823 | return self.serializer_class |
| 4824 | |
| 4825 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 4826 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 4827 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 4828 | return ControllerSlicePrivilege.select_by_user(self.request.user) |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 4829 | |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 4830 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 4831 | class ControllerSlicePrivilegeDetail(XOSRetrieveUpdateDestroyAPIView): |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 4832 | queryset = ControllerSlicePrivilege.objects.select_related().all() |
| 4833 | serializer_class = ControllerSlicePrivilegeSerializer |
| 4834 | id_serializer_class = ControllerSlicePrivilegeIdSerializer |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 4835 | |
| 4836 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 4837 | no_hyperlinks=False |
| 4838 | if hasattr(self.request,"QUERY_PARAMS"): |
| 4839 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 4840 | if (no_hyperlinks): |
| 4841 | return self.id_serializer_class |
| 4842 | else: |
| 4843 | return self.serializer_class |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 4844 | |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 4845 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 4846 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 4847 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 4848 | return ControllerSlicePrivilege.select_by_user(self.request.user) |
| 4849 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 4850 | # update() is handled by XOSRetrieveUpdateDestroyAPIView |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 4851 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 4852 | # destroy() is handled by XOSRetrieveUpdateDestroyAPIView |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 4853 | |
| 4854 | |
| 4855 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 4856 | class SiteDeploymentList(XOSListCreateAPIView): |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 4857 | queryset = SiteDeployment.objects.select_related().all() |
| 4858 | serializer_class = SiteDeploymentSerializer |
| 4859 | id_serializer_class = SiteDeploymentIdSerializer |
| 4860 | filter_backends = (filters.DjangoFilterBackend,) |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 4861 | filter_fields = ('id','created','updated','enacted','policed','backend_register','backend_status','deleted','site','deployment','controller','availability_zone',) |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 4862 | |
| 4863 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 4864 | no_hyperlinks=False |
| 4865 | if hasattr(self.request,"QUERY_PARAMS"): |
| 4866 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 4867 | if (no_hyperlinks): |
| 4868 | return self.id_serializer_class |
| 4869 | else: |
| 4870 | return self.serializer_class |
| 4871 | |
| 4872 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 4873 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 4874 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 4875 | return SiteDeployment.select_by_user(self.request.user) |
| 4876 | |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 4877 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 4878 | class SiteDeploymentDetail(XOSRetrieveUpdateDestroyAPIView): |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 4879 | queryset = SiteDeployment.objects.select_related().all() |
| 4880 | serializer_class = SiteDeploymentSerializer |
| 4881 | id_serializer_class = SiteDeploymentIdSerializer |
| 4882 | |
| 4883 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 4884 | no_hyperlinks=False |
| 4885 | if hasattr(self.request,"QUERY_PARAMS"): |
| 4886 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 4887 | if (no_hyperlinks): |
| 4888 | return self.id_serializer_class |
| 4889 | else: |
| 4890 | return self.serializer_class |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 4891 | |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 4892 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 4893 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 4894 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 4895 | return SiteDeployment.select_by_user(self.request.user) |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 4896 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 4897 | # update() is handled by XOSRetrieveUpdateDestroyAPIView |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 4898 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 4899 | # destroy() is handled by XOSRetrieveUpdateDestroyAPIView |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 4900 | |
| 4901 | |
| 4902 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 4903 | class DeploymentRoleList(XOSListCreateAPIView): |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 4904 | queryset = DeploymentRole.objects.select_related().all() |
| 4905 | serializer_class = DeploymentRoleSerializer |
| 4906 | id_serializer_class = DeploymentRoleIdSerializer |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4907 | filter_backends = (filters.DjangoFilterBackend,) |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 4908 | filter_fields = ('id','created','updated','enacted','policed','backend_register','backend_status','deleted','role',) |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4909 | |
| 4910 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 4911 | no_hyperlinks=False |
| 4912 | if hasattr(self.request,"QUERY_PARAMS"): |
| 4913 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4914 | if (no_hyperlinks): |
| 4915 | return self.id_serializer_class |
| 4916 | else: |
| 4917 | return self.serializer_class |
| 4918 | |
| 4919 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 4920 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 4921 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 4922 | return DeploymentRole.select_by_user(self.request.user) |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4923 | |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4924 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 4925 | class DeploymentRoleDetail(XOSRetrieveUpdateDestroyAPIView): |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 4926 | queryset = DeploymentRole.objects.select_related().all() |
| 4927 | serializer_class = DeploymentRoleSerializer |
| 4928 | id_serializer_class = DeploymentRoleIdSerializer |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4929 | |
| 4930 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 4931 | no_hyperlinks=False |
| 4932 | if hasattr(self.request,"QUERY_PARAMS"): |
| 4933 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4934 | if (no_hyperlinks): |
| 4935 | return self.id_serializer_class |
| 4936 | else: |
| 4937 | return self.serializer_class |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 4938 | |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4939 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 4940 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 4941 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 4942 | return DeploymentRole.select_by_user(self.request.user) |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4943 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 4944 | # update() is handled by XOSRetrieveUpdateDestroyAPIView |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4945 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 4946 | # destroy() is handled by XOSRetrieveUpdateDestroyAPIView |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4947 | |
| 4948 | |
| 4949 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 4950 | class UserCredentialList(XOSListCreateAPIView): |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4951 | queryset = UserCredential.objects.select_related().all() |
| 4952 | serializer_class = UserCredentialSerializer |
| 4953 | id_serializer_class = UserCredentialIdSerializer |
| 4954 | filter_backends = (filters.DjangoFilterBackend,) |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 4955 | filter_fields = ('id','created','updated','enacted','policed','backend_register','backend_status','deleted','user','name','key_id','enc_value',) |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4956 | |
| 4957 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 4958 | no_hyperlinks=False |
| 4959 | if hasattr(self.request,"QUERY_PARAMS"): |
| 4960 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4961 | if (no_hyperlinks): |
| 4962 | return self.id_serializer_class |
| 4963 | else: |
| 4964 | return self.serializer_class |
| 4965 | |
| 4966 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 4967 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 4968 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4969 | return UserCredential.select_by_user(self.request.user) |
| 4970 | |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4971 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 4972 | class UserCredentialDetail(XOSRetrieveUpdateDestroyAPIView): |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4973 | queryset = UserCredential.objects.select_related().all() |
| 4974 | serializer_class = UserCredentialSerializer |
| 4975 | id_serializer_class = UserCredentialIdSerializer |
| 4976 | |
| 4977 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 4978 | no_hyperlinks=False |
| 4979 | if hasattr(self.request,"QUERY_PARAMS"): |
| 4980 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4981 | if (no_hyperlinks): |
| 4982 | return self.id_serializer_class |
| 4983 | else: |
| 4984 | return self.serializer_class |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 4985 | |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4986 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 4987 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 4988 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4989 | return UserCredential.select_by_user(self.request.user) |
| 4990 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 4991 | # update() is handled by XOSRetrieveUpdateDestroyAPIView |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4992 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 4993 | # destroy() is handled by XOSRetrieveUpdateDestroyAPIView |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4994 | |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4995 | |
Scott Baker | 57c725c | 2014-11-12 01:13:53 -0800 | [diff] [blame] | 4996 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 4997 | class SliceTagList(XOSListCreateAPIView): |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 4998 | queryset = SliceTag.objects.select_related().all() |
| 4999 | serializer_class = SliceTagSerializer |
Scott Baker | 46b5854 | 2014-08-11 17:26:12 -0700 | [diff] [blame] | 5000 | id_serializer_class = SliceTagIdSerializer |
| 5001 | filter_backends = (filters.DjangoFilterBackend,) |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 5002 | filter_fields = ('id','created','updated','enacted','policed','backend_register','backend_status','deleted','slice','name','value',) |
Scott Baker | 46b5854 | 2014-08-11 17:26:12 -0700 | [diff] [blame] | 5003 | |
| 5004 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 5005 | no_hyperlinks=False |
| 5006 | if hasattr(self.request,"QUERY_PARAMS"): |
| 5007 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 46b5854 | 2014-08-11 17:26:12 -0700 | [diff] [blame] | 5008 | if (no_hyperlinks): |
| 5009 | return self.id_serializer_class |
| 5010 | else: |
| 5011 | return self.serializer_class |
| 5012 | |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 5013 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 5014 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 5015 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 5016 | return SliceTag.select_by_user(self.request.user) |
Sapan Bhatia | dea3943 | 2014-06-13 03:10:36 -0400 | [diff] [blame] | 5017 | |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 5018 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 5019 | class SliceTagDetail(XOSRetrieveUpdateDestroyAPIView): |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 5020 | queryset = SliceTag.objects.select_related().all() |
| 5021 | serializer_class = SliceTagSerializer |
Scott Baker | 46b5854 | 2014-08-11 17:26:12 -0700 | [diff] [blame] | 5022 | id_serializer_class = SliceTagIdSerializer |
| 5023 | |
| 5024 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 5025 | no_hyperlinks=False |
| 5026 | if hasattr(self.request,"QUERY_PARAMS"): |
| 5027 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 46b5854 | 2014-08-11 17:26:12 -0700 | [diff] [blame] | 5028 | if (no_hyperlinks): |
| 5029 | return self.id_serializer_class |
| 5030 | else: |
| 5031 | return self.serializer_class |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 5032 | |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 5033 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 5034 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 5035 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 5036 | return SliceTag.select_by_user(self.request.user) |
| 5037 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 5038 | # update() is handled by XOSRetrieveUpdateDestroyAPIView |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 5039 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 5040 | # destroy() is handled by XOSRetrieveUpdateDestroyAPIView |
Sapan Bhatia | dea3943 | 2014-06-13 03:10:36 -0400 | [diff] [blame] | 5041 | |
| 5042 | |
| 5043 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 5044 | class NetworkTemplateList(XOSListCreateAPIView): |
Scott Baker | f2c0c51 | 2014-12-22 17:35:34 -0800 | [diff] [blame] | 5045 | queryset = NetworkTemplate.objects.select_related().all() |
| 5046 | serializer_class = NetworkTemplateSerializer |
| 5047 | id_serializer_class = NetworkTemplateIdSerializer |
Scott Baker | 46b5854 | 2014-08-11 17:26:12 -0700 | [diff] [blame] | 5048 | filter_backends = (filters.DjangoFilterBackend,) |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 5049 | filter_fields = ('id','created','updated','enacted','policed','backend_register','backend_status','deleted','name','description','guaranteed_bandwidth','visibility','translation','shared_network_name','shared_network_id','topology_kind','controller_kind',) |
Scott Baker | 46b5854 | 2014-08-11 17:26:12 -0700 | [diff] [blame] | 5050 | |
| 5051 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 5052 | no_hyperlinks=False |
| 5053 | if hasattr(self.request,"QUERY_PARAMS"): |
| 5054 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 46b5854 | 2014-08-11 17:26:12 -0700 | [diff] [blame] | 5055 | if (no_hyperlinks): |
| 5056 | return self.id_serializer_class |
| 5057 | else: |
| 5058 | return self.serializer_class |
| 5059 | |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 5060 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 5061 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 5062 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | f2c0c51 | 2014-12-22 17:35:34 -0800 | [diff] [blame] | 5063 | return NetworkTemplate.select_by_user(self.request.user) |
Sapan Bhatia | dea3943 | 2014-06-13 03:10:36 -0400 | [diff] [blame] | 5064 | |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 5065 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 5066 | class NetworkTemplateDetail(XOSRetrieveUpdateDestroyAPIView): |
Scott Baker | f2c0c51 | 2014-12-22 17:35:34 -0800 | [diff] [blame] | 5067 | queryset = NetworkTemplate.objects.select_related().all() |
| 5068 | serializer_class = NetworkTemplateSerializer |
| 5069 | id_serializer_class = NetworkTemplateIdSerializer |
Scott Baker | 46b5854 | 2014-08-11 17:26:12 -0700 | [diff] [blame] | 5070 | |
| 5071 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 5072 | no_hyperlinks=False |
| 5073 | if hasattr(self.request,"QUERY_PARAMS"): |
| 5074 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 46b5854 | 2014-08-11 17:26:12 -0700 | [diff] [blame] | 5075 | if (no_hyperlinks): |
| 5076 | return self.id_serializer_class |
| 5077 | else: |
| 5078 | return self.serializer_class |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 5079 | |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 5080 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 5081 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 5082 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | f2c0c51 | 2014-12-22 17:35:34 -0800 | [diff] [blame] | 5083 | return NetworkTemplate.select_by_user(self.request.user) |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 5084 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 5085 | # update() is handled by XOSRetrieveUpdateDestroyAPIView |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 5086 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 5087 | # destroy() is handled by XOSRetrieveUpdateDestroyAPIView |
Sapan Bhatia | dea3943 | 2014-06-13 03:10:36 -0400 | [diff] [blame] | 5088 | |
| 5089 | |
| 5090 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 5091 | class RouterList(XOSListCreateAPIView): |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 5092 | queryset = Router.objects.select_related().all() |
Sapan Bhatia | dea3943 | 2014-06-13 03:10:36 -0400 | [diff] [blame] | 5093 | serializer_class = RouterSerializer |
Scott Baker | 46b5854 | 2014-08-11 17:26:12 -0700 | [diff] [blame] | 5094 | id_serializer_class = RouterIdSerializer |
| 5095 | filter_backends = (filters.DjangoFilterBackend,) |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 5096 | filter_fields = ('id','created','updated','enacted','policed','backend_register','backend_status','deleted','name','owner','networks','networks',) |
Scott Baker | 46b5854 | 2014-08-11 17:26:12 -0700 | [diff] [blame] | 5097 | |
| 5098 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 5099 | no_hyperlinks=False |
| 5100 | if hasattr(self.request,"QUERY_PARAMS"): |
| 5101 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 46b5854 | 2014-08-11 17:26:12 -0700 | [diff] [blame] | 5102 | if (no_hyperlinks): |
| 5103 | return self.id_serializer_class |
| 5104 | else: |
| 5105 | return self.serializer_class |
| 5106 | |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 5107 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 5108 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 5109 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 5110 | return Router.select_by_user(self.request.user) |
| 5111 | |
Sapan Bhatia | dea3943 | 2014-06-13 03:10:36 -0400 | [diff] [blame] | 5112 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 5113 | class RouterDetail(XOSRetrieveUpdateDestroyAPIView): |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 5114 | queryset = Router.objects.select_related().all() |
Sapan Bhatia | dea3943 | 2014-06-13 03:10:36 -0400 | [diff] [blame] | 5115 | serializer_class = RouterSerializer |
Scott Baker | 46b5854 | 2014-08-11 17:26:12 -0700 | [diff] [blame] | 5116 | id_serializer_class = RouterIdSerializer |
| 5117 | |
| 5118 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 5119 | no_hyperlinks=False |
| 5120 | if hasattr(self.request,"QUERY_PARAMS"): |
| 5121 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 46b5854 | 2014-08-11 17:26:12 -0700 | [diff] [blame] | 5122 | if (no_hyperlinks): |
| 5123 | return self.id_serializer_class |
| 5124 | else: |
| 5125 | return self.serializer_class |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 5126 | |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 5127 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 5128 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 5129 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 5130 | return Router.select_by_user(self.request.user) |
| 5131 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 5132 | # update() is handled by XOSRetrieveUpdateDestroyAPIView |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 5133 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 5134 | # destroy() is handled by XOSRetrieveUpdateDestroyAPIView |
Sapan Bhatia | dea3943 | 2014-06-13 03:10:36 -0400 | [diff] [blame] | 5135 | |
| 5136 | |
| 5137 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 5138 | class ServiceResourceList(XOSListCreateAPIView): |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 5139 | queryset = ServiceResource.objects.select_related().all() |
| 5140 | serializer_class = ServiceResourceSerializer |
Scott Baker | 46b5854 | 2014-08-11 17:26:12 -0700 | [diff] [blame] | 5141 | id_serializer_class = ServiceResourceIdSerializer |
| 5142 | filter_backends = (filters.DjangoFilterBackend,) |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 5143 | filter_fields = ('id','created','updated','enacted','policed','backend_register','backend_status','deleted','serviceClass','name','maxUnitsDeployment','maxUnitsNode','maxDuration','bucketInRate','bucketMaxSize','cost','calendarReservable',) |
Scott Baker | 46b5854 | 2014-08-11 17:26:12 -0700 | [diff] [blame] | 5144 | |
| 5145 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 5146 | no_hyperlinks=False |
| 5147 | if hasattr(self.request,"QUERY_PARAMS"): |
| 5148 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 46b5854 | 2014-08-11 17:26:12 -0700 | [diff] [blame] | 5149 | if (no_hyperlinks): |
| 5150 | return self.id_serializer_class |
| 5151 | else: |
| 5152 | return self.serializer_class |
| 5153 | |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 5154 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 5155 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 5156 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 5157 | return ServiceResource.select_by_user(self.request.user) |
Sapan Bhatia | dea3943 | 2014-06-13 03:10:36 -0400 | [diff] [blame] | 5158 | |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 5159 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 5160 | class ServiceResourceDetail(XOSRetrieveUpdateDestroyAPIView): |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 5161 | queryset = ServiceResource.objects.select_related().all() |
| 5162 | serializer_class = ServiceResourceSerializer |
Scott Baker | 46b5854 | 2014-08-11 17:26:12 -0700 | [diff] [blame] | 5163 | id_serializer_class = ServiceResourceIdSerializer |
| 5164 | |
| 5165 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 5166 | no_hyperlinks=False |
| 5167 | if hasattr(self.request,"QUERY_PARAMS"): |
| 5168 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 46b5854 | 2014-08-11 17:26:12 -0700 | [diff] [blame] | 5169 | if (no_hyperlinks): |
| 5170 | return self.id_serializer_class |
| 5171 | else: |
| 5172 | return self.serializer_class |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 5173 | |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 5174 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 5175 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 5176 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 5177 | return ServiceResource.select_by_user(self.request.user) |
| 5178 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 5179 | # update() is handled by XOSRetrieveUpdateDestroyAPIView |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 5180 | |
Scott Baker | 72758c7 | 2015-02-10 19:26:35 -0800 | [diff] [blame] | 5181 | # destroy() is handled by XOSRetrieveUpdateDestroyAPIView |
Sapan Bhatia | dea3943 | 2014-06-13 03:10:36 -0400 | [diff] [blame] | 5182 | |
Sapan Bhatia | dea3943 | 2014-06-13 03:10:36 -0400 | [diff] [blame] | 5183 | |
| 5184 | |