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 |
Sapan Bhatia | dea3943 | 2014-06-13 03:10:36 -0400 | [diff] [blame] | 14 | |
Scott Baker | f0480fb | 2014-12-23 11:12:07 -0800 | [diff] [blame] | 15 | if hasattr(serializers, "ReadOnlyField"): |
| 16 | # rest_framework 3.x |
| 17 | IdField = serializers.ReadOnlyField |
| 18 | else: |
| 19 | # rest_framework 2.x |
| 20 | IdField = serializers.Field |
| 21 | |
Sapan Bhatia | dea3943 | 2014-06-13 03:10:36 -0400 | [diff] [blame] | 22 | """ |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 23 | Schema of the generator object: |
| 24 | all: Set of all Model objects |
| 25 | all_if(regex): Set of Model objects that match regex |
Scott Baker | 57c725c | 2014-11-12 01:13:53 -0800 | [diff] [blame] | 26 | |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 27 | Model object: |
| 28 | plural: English plural of object name |
| 29 | camel: CamelCase version of object name |
| 30 | refs: list of references to other Model objects |
| 31 | props: list of properties minus refs |
Sapan Bhatia | dea3943 | 2014-06-13 03:10:36 -0400 | [diff] [blame] | 32 | |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 33 | TODO: Deal with subnets |
Sapan Bhatia | dea3943 | 2014-06-13 03:10:36 -0400 | [diff] [blame] | 34 | """ |
| 35 | |
Scott Baker | d51d0bd | 2014-11-10 16:31:15 -0800 | [diff] [blame] | 36 | def get_REST_patterns(): |
| 37 | return patterns('', |
Scott Baker | 1faefd3 | 2015-02-02 15:53:37 -0800 | [diff] [blame] | 38 | url(r'^xos/$', api_root), |
Scott Baker | d51d0bd | 2014-11-10 16:31:15 -0800 | [diff] [blame] | 39 | |
Scott Baker | 1faefd3 | 2015-02-02 15:53:37 -0800 | [diff] [blame] | 40 | url(r'xos/serviceattributes/$', ServiceAttributeList.as_view(), name='serviceattribute-list'), |
| 41 | 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] | 42 | |
Scott Baker | 1faefd3 | 2015-02-02 15:53:37 -0800 | [diff] [blame] | 43 | url(r'xos/controllerimages/$', ControllerImagesList.as_view(), name='controllerimages-list'), |
| 44 | 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] | 45 | |
Scott Baker | 1faefd3 | 2015-02-02 15:53:37 -0800 | [diff] [blame] | 46 | url(r'xos/controllersiteprivileges/$', ControllerSitePrivilegeList.as_view(), name='controllersiteprivilege-list'), |
| 47 | 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] | 48 | |
Scott Baker | 1faefd3 | 2015-02-02 15:53:37 -0800 | [diff] [blame] | 49 | url(r'xos/images/$', ImageList.as_view(), name='image-list'), |
| 50 | 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] | 51 | |
Scott Baker | 1faefd3 | 2015-02-02 15:53:37 -0800 | [diff] [blame] | 52 | url(r'xos/networkparameters/$', NetworkParameterList.as_view(), name='networkparameter-list'), |
| 53 | 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] | 54 | |
Scott Baker | 1faefd3 | 2015-02-02 15:53:37 -0800 | [diff] [blame] | 55 | url(r'xos/sites/$', SiteList.as_view(), name='site-list'), |
| 56 | 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] | 57 | |
Scott Baker | 1faefd3 | 2015-02-02 15:53:37 -0800 | [diff] [blame] | 58 | url(r'xos/slice_roles/$', SliceRoleList.as_view(), name='slicerole-list'), |
| 59 | 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] | 60 | |
Scott Baker | 1faefd3 | 2015-02-02 15:53:37 -0800 | [diff] [blame] | 61 | url(r'xos/tags/$', TagList.as_view(), name='tag-list'), |
| 62 | 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] | 63 | |
Scott Baker | 1faefd3 | 2015-02-02 15:53:37 -0800 | [diff] [blame] | 64 | url(r'xos/invoices/$', InvoiceList.as_view(), name='invoice-list'), |
| 65 | 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] | 66 | |
Scott Baker | 1faefd3 | 2015-02-02 15:53:37 -0800 | [diff] [blame] | 67 | url(r'xos/slice_privileges/$', SlicePrivilegeList.as_view(), name='sliceprivilege-list'), |
| 68 | 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] | 69 | |
Scott Baker | 1faefd3 | 2015-02-02 15:53:37 -0800 | [diff] [blame] | 70 | url(r'xos/planetstackroles/$', PlanetStackRoleList.as_view(), name='planetstackrole-list'), |
| 71 | 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] | 72 | |
Scott Baker | 1faefd3 | 2015-02-02 15:53:37 -0800 | [diff] [blame] | 73 | url(r'xos/networkslivers/$', NetworkSliverList.as_view(), name='networksliver-list'), |
| 74 | 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] | 75 | |
Scott Baker | 1faefd3 | 2015-02-02 15:53:37 -0800 | [diff] [blame] | 76 | url(r'xos/flavors/$', FlavorList.as_view(), name='flavor-list'), |
| 77 | 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] | 78 | |
Scott Baker | 1faefd3 | 2015-02-02 15:53:37 -0800 | [diff] [blame] | 79 | url(r'xos/controllersites/$', ControllerSiteList.as_view(), name='controllersite-list'), |
| 80 | 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] | 81 | |
Scott Baker | 1faefd3 | 2015-02-02 15:53:37 -0800 | [diff] [blame] | 82 | url(r'xos/projects/$', ProjectList.as_view(), name='project-list'), |
| 83 | 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] | 84 | |
Scott Baker | 1faefd3 | 2015-02-02 15:53:37 -0800 | [diff] [blame] | 85 | url(r'xos/slices/$', SliceList.as_view(), name='slice-list'), |
| 86 | 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] | 87 | |
Scott Baker | 1faefd3 | 2015-02-02 15:53:37 -0800 | [diff] [blame] | 88 | url(r'xos/networks/$', NetworkList.as_view(), name='network-list'), |
| 89 | 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] | 90 | |
Scott Baker | 1faefd3 | 2015-02-02 15:53:37 -0800 | [diff] [blame] | 91 | url(r'xos/services/$', ServiceList.as_view(), name='service-list'), |
| 92 | 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] | 93 | |
Scott Baker | 1faefd3 | 2015-02-02 15:53:37 -0800 | [diff] [blame] | 94 | url(r'xos/serviceclasses/$', ServiceClassList.as_view(), name='serviceclass-list'), |
| 95 | 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] | 96 | |
Scott Baker | 1faefd3 | 2015-02-02 15:53:37 -0800 | [diff] [blame] | 97 | url(r'xos/planetstacks/$', PlanetStackList.as_view(), name='planetstack-list'), |
| 98 | 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] | 99 | |
Scott Baker | 1faefd3 | 2015-02-02 15:53:37 -0800 | [diff] [blame] | 100 | url(r'xos/charges/$', ChargeList.as_view(), name='charge-list'), |
| 101 | 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] | 102 | |
Scott Baker | 1faefd3 | 2015-02-02 15:53:37 -0800 | [diff] [blame] | 103 | url(r'xos/roles/$', RoleList.as_view(), name='role-list'), |
| 104 | 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] | 105 | |
Scott Baker | 1faefd3 | 2015-02-02 15:53:37 -0800 | [diff] [blame] | 106 | url(r'xos/usableobjects/$', UsableObjectList.as_view(), name='usableobject-list'), |
| 107 | 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] | 108 | |
Scott Baker | 1faefd3 | 2015-02-02 15:53:37 -0800 | [diff] [blame] | 109 | url(r'xos/site_roles/$', SiteRoleList.as_view(), name='siterole-list'), |
| 110 | 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] | 111 | |
Scott Baker | 1faefd3 | 2015-02-02 15:53:37 -0800 | [diff] [blame] | 112 | url(r'xos/slicecredentials/$', SliceCredentialList.as_view(), name='slicecredential-list'), |
| 113 | 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] | 114 | |
Scott Baker | 1faefd3 | 2015-02-02 15:53:37 -0800 | [diff] [blame] | 115 | url(r'xos/slivers/$', SliverList.as_view(), name='sliver-list'), |
| 116 | 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] | 117 | |
Scott Baker | 1faefd3 | 2015-02-02 15:53:37 -0800 | [diff] [blame] | 118 | url(r'xos/nodes/$', NodeList.as_view(), name='node-list'), |
| 119 | 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] | 120 | |
Scott Baker | 1faefd3 | 2015-02-02 15:53:37 -0800 | [diff] [blame] | 121 | url(r'xos/dashboardviews/$', DashboardViewList.as_view(), name='dashboardview-list'), |
| 122 | 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] | 123 | |
Scott Baker | 1faefd3 | 2015-02-02 15:53:37 -0800 | [diff] [blame] | 124 | url(r'xos/controllernetworks/$', ControllerNetworkList.as_view(), name='controllernetwork-list'), |
| 125 | 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] | 126 | |
Scott Baker | 1faefd3 | 2015-02-02 15:53:37 -0800 | [diff] [blame] | 127 | url(r'xos/imagedeploymentses/$', ImageDeploymentsList.as_view(), name='imagedeployments-list'), |
| 128 | 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] | 129 | |
Scott Baker | 1faefd3 | 2015-02-02 15:53:37 -0800 | [diff] [blame] | 130 | url(r'xos/controllerusers/$', ControllerUserList.as_view(), name='controlleruser-list'), |
| 131 | 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] | 132 | |
Scott Baker | 1faefd3 | 2015-02-02 15:53:37 -0800 | [diff] [blame] | 133 | url(r'xos/reservedresources/$', ReservedResourceList.as_view(), name='reservedresource-list'), |
| 134 | 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] | 135 | |
Scott Baker | 1faefd3 | 2015-02-02 15:53:37 -0800 | [diff] [blame] | 136 | url(r'xos/payments/$', PaymentList.as_view(), name='payment-list'), |
| 137 | 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] | 138 | |
Scott Baker | 1faefd3 | 2015-02-02 15:53:37 -0800 | [diff] [blame] | 139 | url(r'xos/networkslices/$', NetworkSliceList.as_view(), name='networkslice-list'), |
| 140 | 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] | 141 | |
Scott Baker | 1faefd3 | 2015-02-02 15:53:37 -0800 | [diff] [blame] | 142 | url(r'xos/userdashboardviews/$', UserDashboardViewList.as_view(), name='userdashboardview-list'), |
| 143 | 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] | 144 | |
Scott Baker | 1faefd3 | 2015-02-02 15:53:37 -0800 | [diff] [blame] | 145 | url(r'xos/controllers/$', ControllerList.as_view(), name='controller-list'), |
| 146 | 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] | 147 | |
Scott Baker | 1faefd3 | 2015-02-02 15:53:37 -0800 | [diff] [blame] | 148 | url(r'xos/planetstackprivileges/$', PlanetStackPrivilegeList.as_view(), name='planetstackprivilege-list'), |
| 149 | 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] | 150 | |
Scott Baker | 1faefd3 | 2015-02-02 15:53:37 -0800 | [diff] [blame] | 151 | url(r'xos/users/$', UserList.as_view(), name='user-list'), |
| 152 | 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] | 153 | |
Scott Baker | 1faefd3 | 2015-02-02 15:53:37 -0800 | [diff] [blame] | 154 | url(r'xos/deployments/$', DeploymentList.as_view(), name='deployment-list'), |
| 155 | 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] | 156 | |
Scott Baker | 1faefd3 | 2015-02-02 15:53:37 -0800 | [diff] [blame] | 157 | url(r'xos/reservations/$', ReservationList.as_view(), name='reservation-list'), |
| 158 | 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] | 159 | |
Scott Baker | 1faefd3 | 2015-02-02 15:53:37 -0800 | [diff] [blame] | 160 | url(r'xos/siteprivileges/$', SitePrivilegeList.as_view(), name='siteprivilege-list'), |
| 161 | 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] | 162 | |
Scott Baker | 1faefd3 | 2015-02-02 15:53:37 -0800 | [diff] [blame] | 163 | url(r'xos/controllerslices/$', ControllerSliceList.as_view(), name='controllerslice-list'), |
| 164 | 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] | 165 | |
Scott Baker | 1faefd3 | 2015-02-02 15:53:37 -0800 | [diff] [blame] | 166 | url(r'xos/controllerdashboardviews/$', ControllerDashboardViewList.as_view(), name='controllerdashboardview-list'), |
| 167 | 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] | 168 | |
Scott Baker | 1faefd3 | 2015-02-02 15:53:37 -0800 | [diff] [blame] | 169 | url(r'xos/accounts/$', AccountList.as_view(), name='account-list'), |
| 170 | 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] | 171 | |
Scott Baker | 1faefd3 | 2015-02-02 15:53:37 -0800 | [diff] [blame] | 172 | url(r'xos/controllerroles/$', ControllerRoleList.as_view(), name='controllerrole-list'), |
| 173 | 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] | 174 | |
Scott Baker | 1faefd3 | 2015-02-02 15:53:37 -0800 | [diff] [blame] | 175 | url(r'xos/networkparametertypes/$', NetworkParameterTypeList.as_view(), name='networkparametertype-list'), |
| 176 | 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] | 177 | |
Scott Baker | 1faefd3 | 2015-02-02 15:53:37 -0800 | [diff] [blame] | 178 | url(r'xos/sitecredentials/$', SiteCredentialList.as_view(), name='sitecredential-list'), |
| 179 | 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] | 180 | |
Scott Baker | 1faefd3 | 2015-02-02 15:53:37 -0800 | [diff] [blame] | 181 | url(r'xos/deploymentprivileges/$', DeploymentPrivilegeList.as_view(), name='deploymentprivilege-list'), |
| 182 | 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] | 183 | |
Scott Baker | 1faefd3 | 2015-02-02 15:53:37 -0800 | [diff] [blame] | 184 | url(r'xos/controllersliceprivileges/$', ControllerSlicePrivilegeList.as_view(), name='controllersliceprivilege-list'), |
| 185 | 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] | 186 | |
Scott Baker | 1faefd3 | 2015-02-02 15:53:37 -0800 | [diff] [blame] | 187 | url(r'xos/sitedeployments/$', SiteDeploymentList.as_view(), name='sitedeployment-list'), |
| 188 | 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] | 189 | |
Scott Baker | 1faefd3 | 2015-02-02 15:53:37 -0800 | [diff] [blame] | 190 | url(r'xos/deploymentroles/$', DeploymentRoleList.as_view(), name='deploymentrole-list'), |
| 191 | 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] | 192 | |
Scott Baker | 1faefd3 | 2015-02-02 15:53:37 -0800 | [diff] [blame] | 193 | url(r'xos/usercredentials/$', UserCredentialList.as_view(), name='usercredential-list'), |
| 194 | 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] | 195 | |
Scott Baker | 1faefd3 | 2015-02-02 15:53:37 -0800 | [diff] [blame] | 196 | url(r'xos/slicetags/$', SliceTagList.as_view(), name='slicetag-list'), |
| 197 | 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] | 198 | |
Scott Baker | 1faefd3 | 2015-02-02 15:53:37 -0800 | [diff] [blame] | 199 | url(r'xos/networktemplates/$', NetworkTemplateList.as_view(), name='networktemplate-list'), |
| 200 | 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] | 201 | |
Scott Baker | 1faefd3 | 2015-02-02 15:53:37 -0800 | [diff] [blame] | 202 | url(r'xos/routers/$', RouterList.as_view(), name='router-list'), |
| 203 | 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] | 204 | |
Scott Baker | 1faefd3 | 2015-02-02 15:53:37 -0800 | [diff] [blame] | 205 | url(r'xos/serviceresources/$', ServiceResourceList.as_view(), name='serviceresource-list'), |
| 206 | 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] | 207 | |
| 208 | ) |
Sapan Bhatia | dea3943 | 2014-06-13 03:10:36 -0400 | [diff] [blame] | 209 | |
| 210 | @api_view(['GET']) |
| 211 | def api_root(request, format=None): |
| 212 | return Response({ |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 213 | 'serviceattributes': reverse('serviceattribute-list', request=request, format=format), |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 214 | 'controllerimageses': reverse('controllerimages-list', request=request, format=format), |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 215 | 'controllersiteprivileges': reverse('controllersiteprivilege-list', request=request, format=format), |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 216 | 'images': reverse('image-list', request=request, format=format), |
| 217 | 'networkparameters': reverse('networkparameter-list', request=request, format=format), |
| 218 | 'sites': reverse('site-list', request=request, format=format), |
| 219 | 'sliceroles': reverse('slicerole-list', request=request, format=format), |
| 220 | 'tags': reverse('tag-list', request=request, format=format), |
| 221 | 'invoices': reverse('invoice-list', request=request, format=format), |
| 222 | 'sliceprivileges': reverse('sliceprivilege-list', request=request, format=format), |
| 223 | 'planetstackroles': reverse('planetstackrole-list', request=request, format=format), |
| 224 | 'networkslivers': reverse('networksliver-list', request=request, format=format), |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 225 | 'flavors': reverse('flavor-list', request=request, format=format), |
| 226 | 'controllersites': reverse('controllersite-list', request=request, format=format), |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 227 | 'projects': reverse('project-list', request=request, format=format), |
| 228 | 'slices': reverse('slice-list', request=request, format=format), |
| 229 | 'networks': reverse('network-list', request=request, format=format), |
| 230 | 'services': reverse('service-list', request=request, format=format), |
| 231 | 'serviceclasses': reverse('serviceclass-list', request=request, format=format), |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 232 | 'planetstacks': reverse('planetstack-list', request=request, format=format), |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 233 | 'charges': reverse('charge-list', request=request, format=format), |
| 234 | 'roles': reverse('role-list', request=request, format=format), |
| 235 | 'usableobjects': reverse('usableobject-list', request=request, format=format), |
| 236 | 'siteroles': reverse('siterole-list', request=request, format=format), |
| 237 | 'slicecredentials': reverse('slicecredential-list', request=request, format=format), |
| 238 | 'slivers': reverse('sliver-list', request=request, format=format), |
| 239 | 'nodes': reverse('node-list', request=request, format=format), |
| 240 | 'dashboardviews': reverse('dashboardview-list', request=request, format=format), |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 241 | 'controllernetworks': reverse('controllernetwork-list', request=request, format=format), |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 242 | 'imagedeploymentses': reverse('imagedeployments-list', request=request, format=format), |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 243 | 'controllerusers': reverse('controlleruser-list', request=request, format=format), |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 244 | 'reservedresources': reverse('reservedresource-list', request=request, format=format), |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 245 | 'payments': reverse('payment-list', request=request, format=format), |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 246 | 'networkslices': reverse('networkslice-list', request=request, format=format), |
| 247 | 'userdashboardviews': reverse('userdashboardview-list', request=request, format=format), |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 248 | 'controllers': reverse('controller-list', request=request, format=format), |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 249 | 'planetstackprivileges': reverse('planetstackprivilege-list', request=request, format=format), |
| 250 | 'users': reverse('user-list', request=request, format=format), |
| 251 | 'deployments': reverse('deployment-list', request=request, format=format), |
| 252 | 'reservations': reverse('reservation-list', request=request, format=format), |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 253 | 'siteprivileges': reverse('siteprivilege-list', request=request, format=format), |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 254 | 'controllerslices': reverse('controllerslice-list', request=request, format=format), |
Scott Baker | f2c0c51 | 2014-12-22 17:35:34 -0800 | [diff] [blame] | 255 | 'controllerdashboardviews': reverse('controllerdashboardview-list', request=request, format=format), |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 256 | 'accounts': reverse('account-list', request=request, format=format), |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 257 | 'controllerroles': reverse('controllerrole-list', request=request, format=format), |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 258 | 'networkparametertypes': reverse('networkparametertype-list', request=request, format=format), |
| 259 | 'sitecredentials': reverse('sitecredential-list', request=request, format=format), |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 260 | 'deploymentprivileges': reverse('deploymentprivilege-list', request=request, format=format), |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 261 | 'controllersliceprivileges': reverse('controllersliceprivilege-list', request=request, format=format), |
| 262 | 'sitedeployments': reverse('sitedeployment-list', request=request, format=format), |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 263 | 'deploymentroles': reverse('deploymentrole-list', request=request, format=format), |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 264 | 'usercredentials': reverse('usercredential-list', request=request, format=format), |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 265 | 'slicetags': reverse('slicetag-list', request=request, format=format), |
Scott Baker | f2c0c51 | 2014-12-22 17:35:34 -0800 | [diff] [blame] | 266 | 'networktemplates': reverse('networktemplate-list', request=request, format=format), |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 267 | 'routers': reverse('router-list', request=request, format=format), |
| 268 | 'serviceresources': reverse('serviceresource-list', request=request, format=format), |
| 269 | |
Sapan Bhatia | dea3943 | 2014-06-13 03:10:36 -0400 | [diff] [blame] | 270 | }) |
| 271 | |
| 272 | # Based on serializers.py |
| 273 | |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 274 | class XOSModelSerializer(serializers.ModelSerializer): |
| 275 | def save_object(self, obj, **kwargs): |
| 276 | |
| 277 | """ rest_framework can't deal with ManyToMany relations that have a |
Scott Baker | 1faefd3 | 2015-02-02 15:53:37 -0800 | [diff] [blame] | 278 | through table. In xos, most of the through tables we have |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 279 | use defaults or blank fields, so there's no reason why we shouldn't |
| 280 | be able to save these objects. |
| 281 | |
| 282 | So, let's strip out these m2m relations, and deal with them ourself. |
| 283 | """ |
| 284 | obj._complex_m2m_data={};
|
| 285 | if getattr(obj, '_m2m_data', None):
|
| 286 | for relatedObject in obj._meta.get_all_related_many_to_many_objects():
|
| 287 | if (relatedObject.field.rel.through._meta.auto_created):
|
| 288 | # These are non-trough ManyToMany relations and
|
| 289 | # can be updated just fine
|
| 290 | continue
|
| 291 | fieldName = relatedObject.get_accessor_name()
|
| 292 | if fieldName in obj._m2m_data.keys():
|
| 293 | obj._complex_m2m_data[fieldName] = (relatedObject, obj._m2m_data[fieldName])
|
| 294 | del obj._m2m_data[fieldName]
|
| 295 |
|
| 296 | serializers.ModelSerializer.save_object(self, obj, **kwargs); |
| 297 | |
| 298 | for (accessor, stuff) in obj._complex_m2m_data.items(): |
| 299 | (relatedObject, data) = stuff |
| 300 | through = relatedObject.field.rel.through |
| 301 | local_fieldName = relatedObject.field.m2m_reverse_field_name() |
| 302 | remote_fieldName = relatedObject.field.m2m_field_name() |
| 303 | |
| 304 | # get the current set of existing relations |
| 305 | existing = through.objects.filter(**{local_fieldName: obj}); |
| 306 | |
| 307 | data_ids = [item.id for item in data] |
| 308 | existing_ids = [getattr(item,remote_fieldName).id for item in existing] |
| 309 | |
| 310 | #print "data_ids", data_ids |
| 311 | #print "existing_ids", existing_ids |
| 312 | |
| 313 | # remove relations that are in 'existing' but not in 'data' |
| 314 | for item in list(existing): |
| 315 | if (getattr(item,remote_fieldName).id not in data_ids): |
| 316 | print "delete", getattr(item,remote_fieldName) |
| 317 | item.delete() #(purge=True) |
| 318 | |
| 319 | # add relations that are in 'data' but not in 'existing' |
| 320 | for item in data: |
| 321 | if (item.id not in existing_ids): |
| 322 | #print "add", item |
| 323 | newModel = through(**{local_fieldName: obj, remote_fieldName: item}) |
| 324 | newModel.save() |
| 325 | |
| 326 | |
| 327 | |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 328 | class ServiceAttributeSerializer(serializers.HyperlinkedModelSerializer): |
Scott Baker | f0480fb | 2014-12-23 11:12:07 -0800 | [diff] [blame] | 329 | id = IdField() |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 330 | |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 331 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 332 | validators = serializers.SerializerMethodField("getValidators") |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 333 | def getHumanReadableName(self, obj):
|
| 334 | return str(obj) |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 335 | def getValidators(self, obj): |
| 336 | try: |
| 337 | return obj.getValidators() |
| 338 | except: |
| 339 | return None |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 340 | class Meta: |
| 341 | model = ServiceAttribute |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 342 | 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] | 343 | |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 344 | class ServiceAttributeIdSerializer(XOSModelSerializer): |
Scott Baker | f0480fb | 2014-12-23 11:12:07 -0800 | [diff] [blame] | 345 | id = IdField() |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 346 | |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 347 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 348 | validators = serializers.SerializerMethodField("getValidators") |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 349 | def getHumanReadableName(self, obj):
|
| 350 | return str(obj)
|
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 351 | def getValidators(self, obj):
|
| 352 | try: |
| 353 | return obj.getValidators() |
| 354 | except: |
| 355 | return None
|
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 356 | class Meta:
|
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 357 | model = ServiceAttribute |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 358 | 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] | 359 | |
| 360 | |
Sapan Bhatia | dea3943 | 2014-06-13 03:10:36 -0400 | [diff] [blame] | 361 | |
| 362 | |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 363 | class ControllerImagesSerializer(serializers.HyperlinkedModelSerializer): |
Scott Baker | f0480fb | 2014-12-23 11:12:07 -0800 | [diff] [blame] | 364 | id = IdField() |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 365 | |
| 366 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
| 367 | validators = serializers.SerializerMethodField("getValidators") |
| 368 | def getHumanReadableName(self, obj):
|
| 369 | return str(obj) |
| 370 | def getValidators(self, obj): |
| 371 | try: |
| 372 | return obj.getValidators() |
| 373 | except: |
| 374 | return None |
| 375 | class Meta: |
| 376 | model = ControllerImages |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 377 | 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] | 378 | |
| 379 | class ControllerImagesIdSerializer(XOSModelSerializer): |
Scott Baker | f0480fb | 2014-12-23 11:12:07 -0800 | [diff] [blame] | 380 | id = IdField() |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 381 | |
| 382 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
| 383 | validators = serializers.SerializerMethodField("getValidators") |
| 384 | def getHumanReadableName(self, obj):
|
| 385 | return str(obj)
|
| 386 | def getValidators(self, obj):
|
| 387 | try: |
| 388 | return obj.getValidators() |
| 389 | except: |
| 390 | return None
|
| 391 | class Meta:
|
| 392 | model = ControllerImages |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 393 | 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] | 394 | |
| 395 | |
| 396 | |
| 397 | |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 398 | class ControllerSitePrivilegeSerializer(serializers.HyperlinkedModelSerializer): |
| 399 | id = IdField() |
| 400 | |
| 401 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
| 402 | validators = serializers.SerializerMethodField("getValidators") |
| 403 | def getHumanReadableName(self, obj):
|
| 404 | return str(obj) |
| 405 | def getValidators(self, obj): |
| 406 | try: |
| 407 | return obj.getValidators() |
| 408 | except: |
| 409 | return None |
| 410 | class Meta: |
| 411 | model = ControllerSitePrivilege |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 412 | 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] | 413 | |
| 414 | class ControllerSitePrivilegeIdSerializer(XOSModelSerializer): |
| 415 | id = IdField() |
| 416 | |
| 417 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
| 418 | validators = serializers.SerializerMethodField("getValidators") |
| 419 | def getHumanReadableName(self, obj):
|
| 420 | return str(obj)
|
| 421 | def getValidators(self, obj):
|
| 422 | try: |
| 423 | return obj.getValidators() |
| 424 | except: |
| 425 | return None
|
| 426 | class Meta:
|
| 427 | model = ControllerSitePrivilege |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 428 | 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] | 429 | |
| 430 | |
| 431 | |
| 432 | |
Sapan Bhatia | dea3943 | 2014-06-13 03:10:36 -0400 | [diff] [blame] | 433 | class ImageSerializer(serializers.HyperlinkedModelSerializer): |
Scott Baker | f0480fb | 2014-12-23 11:12:07 -0800 | [diff] [blame] | 434 | id = IdField() |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 435 | |
Scott Baker | bf4ef6d | 2014-12-22 15:59:33 -0800 | [diff] [blame] | 436 | |
| 437 | deployments = serializers.HyperlinkedRelatedField(many=True, read_only=True, view_name='deployment-detail') |
| 438 | |
| 439 | |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 440 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 441 | validators = serializers.SerializerMethodField("getValidators") |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 442 | def getHumanReadableName(self, obj):
|
| 443 | return str(obj) |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 444 | def getValidators(self, obj): |
| 445 | try: |
| 446 | return obj.getValidators() |
| 447 | except: |
| 448 | return None |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 449 | class Meta: |
| 450 | model = Image |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 451 | 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] | 452 | |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 453 | class ImageIdSerializer(XOSModelSerializer): |
Scott Baker | f0480fb | 2014-12-23 11:12:07 -0800 | [diff] [blame] | 454 | id = IdField() |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 455 | |
Scott Baker | bf4ef6d | 2014-12-22 15:59:33 -0800 | [diff] [blame] | 456 | |
Scott Baker | 201f7da | 2014-12-23 10:56:06 -0800 | [diff] [blame] | 457 | deployments = serializers.PrimaryKeyRelatedField(many=True, queryset = Deployment.objects.all()) |
Scott Baker | bf4ef6d | 2014-12-22 15:59:33 -0800 | [diff] [blame] | 458 | |
| 459 | |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 460 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 461 | validators = serializers.SerializerMethodField("getValidators") |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 462 | def getHumanReadableName(self, obj):
|
| 463 | return str(obj)
|
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 464 | def getValidators(self, obj):
|
| 465 | try: |
| 466 | return obj.getValidators() |
| 467 | except: |
| 468 | return None
|
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 469 | class Meta:
|
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 470 | model = Image |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 471 | 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] | 472 | |
| 473 | |
Sapan Bhatia | dea3943 | 2014-06-13 03:10:36 -0400 | [diff] [blame] | 474 | |
| 475 | |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 476 | class NetworkParameterSerializer(serializers.HyperlinkedModelSerializer): |
Scott Baker | f0480fb | 2014-12-23 11:12:07 -0800 | [diff] [blame] | 477 | id = IdField() |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 478 | |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 479 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 480 | validators = serializers.SerializerMethodField("getValidators") |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 481 | def getHumanReadableName(self, obj):
|
| 482 | return str(obj) |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 483 | def getValidators(self, obj): |
| 484 | try: |
| 485 | return obj.getValidators() |
| 486 | except: |
| 487 | return None |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 488 | class Meta: |
| 489 | model = NetworkParameter |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 490 | 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] | 491 | |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 492 | class NetworkParameterIdSerializer(XOSModelSerializer): |
Scott Baker | f0480fb | 2014-12-23 11:12:07 -0800 | [diff] [blame] | 493 | id = IdField() |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 494 | |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 495 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 496 | validators = serializers.SerializerMethodField("getValidators") |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 497 | def getHumanReadableName(self, obj):
|
| 498 | return str(obj)
|
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 499 | def getValidators(self, obj):
|
| 500 | try: |
| 501 | return obj.getValidators() |
| 502 | except: |
| 503 | return None
|
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 504 | class Meta:
|
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 505 | model = NetworkParameter |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 506 | 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] | 507 | |
| 508 | |
Sapan Bhatia | dea3943 | 2014-06-13 03:10:36 -0400 | [diff] [blame] | 509 | |
| 510 | |
| 511 | class SiteSerializer(serializers.HyperlinkedModelSerializer): |
Scott Baker | f0480fb | 2014-12-23 11:12:07 -0800 | [diff] [blame] | 512 | id = IdField() |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 513 | |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 514 | |
| 515 | deployments = serializers.HyperlinkedRelatedField(many=True, read_only=True, view_name='deployment-detail') |
| 516 | |
| 517 | |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 518 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 519 | validators = serializers.SerializerMethodField("getValidators") |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 520 | def getHumanReadableName(self, obj):
|
| 521 | return str(obj) |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 522 | def getValidators(self, obj): |
| 523 | try: |
| 524 | return obj.getValidators() |
| 525 | except: |
| 526 | return None |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 527 | class Meta: |
| 528 | model = Site |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 529 | 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] | 530 | |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 531 | class SiteIdSerializer(XOSModelSerializer): |
Scott Baker | f0480fb | 2014-12-23 11:12:07 -0800 | [diff] [blame] | 532 | id = IdField() |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 533 | |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 534 | |
Scott Baker | 201f7da | 2014-12-23 10:56:06 -0800 | [diff] [blame] | 535 | deployments = serializers.PrimaryKeyRelatedField(many=True, queryset = Deployment.objects.all()) |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 536 | |
| 537 | |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 538 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 539 | validators = serializers.SerializerMethodField("getValidators") |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 540 | def getHumanReadableName(self, obj):
|
| 541 | return str(obj)
|
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 542 | def getValidators(self, obj):
|
| 543 | try: |
| 544 | return obj.getValidators() |
| 545 | except: |
| 546 | return None
|
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 547 | class Meta:
|
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 548 | model = Site |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 549 | 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] | 550 | |
| 551 | |
Sapan Bhatia | dea3943 | 2014-06-13 03:10:36 -0400 | [diff] [blame] | 552 | |
| 553 | |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 554 | class SliceRoleSerializer(serializers.HyperlinkedModelSerializer): |
Scott Baker | f0480fb | 2014-12-23 11:12:07 -0800 | [diff] [blame] | 555 | id = IdField() |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 556 | |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 557 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 558 | validators = serializers.SerializerMethodField("getValidators") |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 559 | def getHumanReadableName(self, obj):
|
| 560 | return str(obj) |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 561 | def getValidators(self, obj): |
| 562 | try: |
| 563 | return obj.getValidators() |
| 564 | except: |
| 565 | return None |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 566 | class Meta: |
| 567 | model = SliceRole |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 568 | 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] | 569 | |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 570 | class SliceRoleIdSerializer(XOSModelSerializer): |
Scott Baker | f0480fb | 2014-12-23 11:12:07 -0800 | [diff] [blame] | 571 | id = IdField() |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 572 | |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 573 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 574 | validators = serializers.SerializerMethodField("getValidators") |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 575 | def getHumanReadableName(self, obj):
|
| 576 | return str(obj)
|
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 577 | def getValidators(self, obj):
|
| 578 | try: |
| 579 | return obj.getValidators() |
| 580 | except: |
| 581 | return None
|
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 582 | class Meta:
|
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 583 | model = SliceRole |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 584 | 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] | 585 | |
| 586 | |
Sapan Bhatia | dea3943 | 2014-06-13 03:10:36 -0400 | [diff] [blame] | 587 | |
| 588 | |
| 589 | class TagSerializer(serializers.HyperlinkedModelSerializer): |
Scott Baker | f0480fb | 2014-12-23 11:12:07 -0800 | [diff] [blame] | 590 | id = IdField() |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 591 | |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 592 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 593 | validators = serializers.SerializerMethodField("getValidators") |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 594 | def getHumanReadableName(self, obj):
|
| 595 | return str(obj) |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 596 | def getValidators(self, obj): |
| 597 | try: |
| 598 | return obj.getValidators() |
| 599 | except: |
| 600 | return None |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 601 | class Meta: |
| 602 | model = Tag |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 603 | 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] | 604 | |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 605 | class TagIdSerializer(XOSModelSerializer): |
Scott Baker | f0480fb | 2014-12-23 11:12:07 -0800 | [diff] [blame] | 606 | id = IdField() |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 607 | |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 608 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 609 | validators = serializers.SerializerMethodField("getValidators") |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 610 | def getHumanReadableName(self, obj):
|
| 611 | return str(obj)
|
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 612 | def getValidators(self, obj):
|
| 613 | try: |
| 614 | return obj.getValidators() |
| 615 | except: |
| 616 | return None
|
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 617 | class Meta:
|
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 618 | model = Tag |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 619 | 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] | 620 | |
| 621 | |
Sapan Bhatia | dea3943 | 2014-06-13 03:10:36 -0400 | [diff] [blame] | 622 | |
| 623 | |
| 624 | class InvoiceSerializer(serializers.HyperlinkedModelSerializer): |
Scott Baker | f0480fb | 2014-12-23 11:12:07 -0800 | [diff] [blame] | 625 | id = IdField() |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 626 | |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 627 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 628 | validators = serializers.SerializerMethodField("getValidators") |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 629 | def getHumanReadableName(self, obj):
|
| 630 | return str(obj) |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 631 | def getValidators(self, obj): |
| 632 | try: |
| 633 | return obj.getValidators() |
| 634 | except: |
| 635 | return None |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 636 | class Meta: |
| 637 | model = Invoice |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 638 | 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] | 639 | |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 640 | class InvoiceIdSerializer(XOSModelSerializer): |
Scott Baker | f0480fb | 2014-12-23 11:12:07 -0800 | [diff] [blame] | 641 | id = IdField() |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 642 | |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 643 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 644 | validators = serializers.SerializerMethodField("getValidators") |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 645 | def getHumanReadableName(self, obj):
|
| 646 | return str(obj)
|
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 647 | def getValidators(self, obj):
|
| 648 | try: |
| 649 | return obj.getValidators() |
| 650 | except: |
| 651 | return None
|
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 652 | class Meta:
|
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 653 | model = Invoice |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 654 | 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] | 655 | |
| 656 | |
Sapan Bhatia | dea3943 | 2014-06-13 03:10:36 -0400 | [diff] [blame] | 657 | |
| 658 | |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 659 | class SlicePrivilegeSerializer(serializers.HyperlinkedModelSerializer): |
Scott Baker | f0480fb | 2014-12-23 11:12:07 -0800 | [diff] [blame] | 660 | id = IdField() |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 661 | |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 662 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 663 | validators = serializers.SerializerMethodField("getValidators") |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 664 | def getHumanReadableName(self, obj):
|
| 665 | return str(obj) |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 666 | def getValidators(self, obj): |
| 667 | try: |
| 668 | return obj.getValidators() |
| 669 | except: |
| 670 | return None |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 671 | class Meta: |
| 672 | model = SlicePrivilege |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 673 | 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] | 674 | |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 675 | class SlicePrivilegeIdSerializer(XOSModelSerializer): |
Scott Baker | f0480fb | 2014-12-23 11:12:07 -0800 | [diff] [blame] | 676 | id = IdField() |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 677 | |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 678 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 679 | validators = serializers.SerializerMethodField("getValidators") |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 680 | def getHumanReadableName(self, obj):
|
| 681 | return str(obj)
|
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 682 | def getValidators(self, obj):
|
| 683 | try: |
| 684 | return obj.getValidators() |
| 685 | except: |
| 686 | return None
|
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 687 | class Meta:
|
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 688 | model = SlicePrivilege |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 689 | 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] | 690 | |
| 691 | |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 692 | |
| 693 | |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 694 | class PlanetStackRoleSerializer(serializers.HyperlinkedModelSerializer): |
Scott Baker | f0480fb | 2014-12-23 11:12:07 -0800 | [diff] [blame] | 695 | id = IdField() |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 696 | |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 697 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 698 | validators = serializers.SerializerMethodField("getValidators") |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 699 | def getHumanReadableName(self, obj):
|
| 700 | return str(obj) |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 701 | def getValidators(self, obj): |
| 702 | try: |
| 703 | return obj.getValidators() |
| 704 | except: |
| 705 | return None |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 706 | class Meta: |
| 707 | model = PlanetStackRole |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 708 | 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] | 709 | |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 710 | class PlanetStackRoleIdSerializer(XOSModelSerializer): |
Scott Baker | f0480fb | 2014-12-23 11:12:07 -0800 | [diff] [blame] | 711 | id = IdField() |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 712 | |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 713 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 714 | validators = serializers.SerializerMethodField("getValidators") |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 715 | def getHumanReadableName(self, obj):
|
| 716 | return str(obj)
|
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 717 | def getValidators(self, obj):
|
| 718 | try: |
| 719 | return obj.getValidators() |
| 720 | except: |
| 721 | return None
|
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 722 | class Meta:
|
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 723 | model = PlanetStackRole |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 724 | 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] | 725 | |
| 726 | |
| 727 | |
| 728 | |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 729 | class NetworkSliverSerializer(serializers.HyperlinkedModelSerializer): |
Scott Baker | f0480fb | 2014-12-23 11:12:07 -0800 | [diff] [blame] | 730 | id = IdField() |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 731 | |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 732 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 733 | validators = serializers.SerializerMethodField("getValidators") |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 734 | def getHumanReadableName(self, obj):
|
| 735 | return str(obj) |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 736 | def getValidators(self, obj): |
| 737 | try: |
| 738 | return obj.getValidators() |
| 739 | except: |
| 740 | return None |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 741 | class Meta: |
| 742 | model = NetworkSliver |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 743 | 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] | 744 | |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 745 | class NetworkSliverIdSerializer(XOSModelSerializer): |
Scott Baker | f0480fb | 2014-12-23 11:12:07 -0800 | [diff] [blame] | 746 | id = IdField() |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 747 | |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 748 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 749 | validators = serializers.SerializerMethodField("getValidators") |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 750 | def getHumanReadableName(self, obj):
|
| 751 | return str(obj)
|
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 752 | def getValidators(self, obj):
|
| 753 | try: |
| 754 | return obj.getValidators() |
| 755 | except: |
| 756 | return None
|
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 757 | class Meta:
|
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 758 | model = NetworkSliver |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 759 | 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] | 760 | |
| 761 | |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 762 | |
| 763 | |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 764 | class FlavorSerializer(serializers.HyperlinkedModelSerializer): |
| 765 | id = IdField() |
| 766 | |
| 767 | |
| 768 | deployments = serializers.HyperlinkedRelatedField(many=True, read_only=True, view_name='deployment-detail') |
| 769 | |
| 770 | |
| 771 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
| 772 | validators = serializers.SerializerMethodField("getValidators") |
| 773 | def getHumanReadableName(self, obj):
|
| 774 | return str(obj) |
| 775 | def getValidators(self, obj): |
| 776 | try: |
| 777 | return obj.getValidators() |
| 778 | except: |
| 779 | return None |
| 780 | class Meta: |
| 781 | model = Flavor |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 782 | 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] | 783 | |
| 784 | class FlavorIdSerializer(XOSModelSerializer): |
| 785 | id = IdField() |
| 786 | |
| 787 | |
| 788 | deployments = serializers.PrimaryKeyRelatedField(many=True, queryset = Deployment.objects.all()) |
| 789 | |
| 790 | |
| 791 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
| 792 | validators = serializers.SerializerMethodField("getValidators") |
| 793 | def getHumanReadableName(self, obj):
|
| 794 | return str(obj)
|
| 795 | def getValidators(self, obj):
|
| 796 | try: |
| 797 | return obj.getValidators() |
| 798 | except: |
| 799 | return None
|
| 800 | class Meta:
|
| 801 | model = Flavor |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 802 | 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] | 803 | |
| 804 | |
| 805 | |
| 806 | |
| 807 | class ControllerSiteSerializer(serializers.HyperlinkedModelSerializer): |
| 808 | id = IdField() |
| 809 | |
| 810 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
| 811 | validators = serializers.SerializerMethodField("getValidators") |
| 812 | def getHumanReadableName(self, obj):
|
| 813 | return str(obj) |
| 814 | def getValidators(self, obj): |
| 815 | try: |
| 816 | return obj.getValidators() |
| 817 | except: |
| 818 | return None |
| 819 | class Meta: |
| 820 | model = ControllerSite |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 821 | 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] | 822 | |
| 823 | class ControllerSiteIdSerializer(XOSModelSerializer): |
| 824 | id = IdField() |
| 825 | |
| 826 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
| 827 | validators = serializers.SerializerMethodField("getValidators") |
| 828 | def getHumanReadableName(self, obj):
|
| 829 | return str(obj)
|
| 830 | def getValidators(self, obj):
|
| 831 | try: |
| 832 | return obj.getValidators() |
| 833 | except: |
| 834 | return None
|
| 835 | class Meta:
|
| 836 | model = ControllerSite |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 837 | 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] | 838 | |
| 839 | |
| 840 | |
| 841 | |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 842 | class ProjectSerializer(serializers.HyperlinkedModelSerializer): |
Scott Baker | f0480fb | 2014-12-23 11:12:07 -0800 | [diff] [blame] | 843 | id = IdField() |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 844 | |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 845 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 846 | validators = serializers.SerializerMethodField("getValidators") |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 847 | def getHumanReadableName(self, obj):
|
| 848 | return str(obj) |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 849 | def getValidators(self, obj): |
| 850 | try: |
| 851 | return obj.getValidators() |
| 852 | except: |
| 853 | return None |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 854 | class Meta: |
| 855 | model = Project |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 856 | 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] | 857 | |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 858 | class ProjectIdSerializer(XOSModelSerializer): |
Scott Baker | f0480fb | 2014-12-23 11:12:07 -0800 | [diff] [blame] | 859 | id = IdField() |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 860 | |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 861 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 862 | validators = serializers.SerializerMethodField("getValidators") |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 863 | def getHumanReadableName(self, obj):
|
| 864 | return str(obj)
|
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 865 | def getValidators(self, obj):
|
| 866 | try: |
| 867 | return obj.getValidators() |
| 868 | except: |
| 869 | return None
|
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 870 | class Meta:
|
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 871 | model = Project |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 872 | 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] | 873 | |
| 874 | |
| 875 | |
| 876 | |
Sapan Bhatia | dea3943 | 2014-06-13 03:10:36 -0400 | [diff] [blame] | 877 | class SliceSerializer(serializers.HyperlinkedModelSerializer): |
Scott Baker | f0480fb | 2014-12-23 11:12:07 -0800 | [diff] [blame] | 878 | id = IdField() |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 879 | |
| 880 | |
| 881 | networks = serializers.HyperlinkedRelatedField(many=True, read_only=True, view_name='network-detail') |
| 882 | |
| 883 | |
| 884 | |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 885 | networks = serializers.HyperlinkedRelatedField(many=True, read_only=True, view_name='network-detail') |
| 886 | |
| 887 | |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 888 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 889 | validators = serializers.SerializerMethodField("getValidators") |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 890 | def getHumanReadableName(self, obj):
|
| 891 | return str(obj) |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 892 | def getValidators(self, obj): |
| 893 | try: |
| 894 | return obj.getValidators() |
| 895 | except: |
| 896 | return None |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 897 | class Meta: |
| 898 | model = Slice |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 899 | 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] | 900 | |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 901 | class SliceIdSerializer(XOSModelSerializer): |
Scott Baker | f0480fb | 2014-12-23 11:12:07 -0800 | [diff] [blame] | 902 | id = IdField() |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 903 | |
| 904 | |
Scott Baker | 201f7da | 2014-12-23 10:56:06 -0800 | [diff] [blame] | 905 | networks = serializers.PrimaryKeyRelatedField(many=True, queryset = Network.objects.all()) |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 906 | |
| 907 | |
| 908 | |
Scott Baker | 201f7da | 2014-12-23 10:56:06 -0800 | [diff] [blame] | 909 | networks = serializers.PrimaryKeyRelatedField(many=True, queryset = Network.objects.all()) |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 910 | |
| 911 | |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 912 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 913 | validators = serializers.SerializerMethodField("getValidators") |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 914 | def getHumanReadableName(self, obj):
|
| 915 | return str(obj)
|
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 916 | def getValidators(self, obj):
|
| 917 | try: |
| 918 | return obj.getValidators() |
| 919 | except: |
| 920 | return None
|
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 921 | class Meta:
|
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 922 | model = Slice |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 923 | 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] | 924 | |
| 925 | |
Sapan Bhatia | dea3943 | 2014-06-13 03:10:36 -0400 | [diff] [blame] | 926 | |
| 927 | |
| 928 | class NetworkSerializer(serializers.HyperlinkedModelSerializer): |
Scott Baker | f0480fb | 2014-12-23 11:12:07 -0800 | [diff] [blame] | 929 | id = IdField() |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 930 | |
| 931 | |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 932 | slices = serializers.HyperlinkedRelatedField(many=True, read_only=True, view_name='slice-detail') |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 933 | |
| 934 | |
| 935 | |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 936 | slices = serializers.HyperlinkedRelatedField(many=True, read_only=True, view_name='slice-detail') |
| 937 | |
| 938 | |
| 939 | |
| 940 | slivers = serializers.HyperlinkedRelatedField(many=True, read_only=True, view_name='sliver-detail') |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 941 | |
| 942 | |
| 943 | |
| 944 | routers = serializers.HyperlinkedRelatedField(many=True, read_only=True, view_name='router-detail') |
| 945 | |
| 946 | |
| 947 | |
| 948 | routers = serializers.HyperlinkedRelatedField(many=True, read_only=True, view_name='router-detail') |
| 949 | |
| 950 | |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 951 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 952 | validators = serializers.SerializerMethodField("getValidators") |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 953 | def getHumanReadableName(self, obj):
|
| 954 | return str(obj) |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 955 | def getValidators(self, obj): |
| 956 | try: |
| 957 | return obj.getValidators() |
| 958 | except: |
| 959 | return None |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 960 | class Meta: |
| 961 | model = Network |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 962 | 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] | 963 | |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 964 | class NetworkIdSerializer(XOSModelSerializer): |
Scott Baker | f0480fb | 2014-12-23 11:12:07 -0800 | [diff] [blame] | 965 | id = IdField() |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 966 | |
| 967 | |
Scott Baker | 201f7da | 2014-12-23 10:56:06 -0800 | [diff] [blame] | 968 | slices = serializers.PrimaryKeyRelatedField(many=True, queryset = Slice.objects.all()) |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 969 | |
| 970 | |
| 971 | |
Scott Baker | 201f7da | 2014-12-23 10:56:06 -0800 | [diff] [blame] | 972 | slices = serializers.PrimaryKeyRelatedField(many=True, queryset = Slice.objects.all()) |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 973 | |
| 974 | |
| 975 | |
Scott Baker | 201f7da | 2014-12-23 10:56:06 -0800 | [diff] [blame] | 976 | slivers = serializers.PrimaryKeyRelatedField(many=True, queryset = Sliver.objects.all()) |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 977 | |
| 978 | |
| 979 | |
Scott Baker | 201f7da | 2014-12-23 10:56:06 -0800 | [diff] [blame] | 980 | routers = serializers.PrimaryKeyRelatedField(many=True, queryset = Router.objects.all()) |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 981 | |
| 982 | |
| 983 | |
Scott Baker | 201f7da | 2014-12-23 10:56:06 -0800 | [diff] [blame] | 984 | routers = serializers.PrimaryKeyRelatedField(many=True, queryset = Router.objects.all()) |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 985 | |
| 986 | |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 987 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 988 | validators = serializers.SerializerMethodField("getValidators") |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 989 | def getHumanReadableName(self, obj):
|
| 990 | return str(obj)
|
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 991 | def getValidators(self, obj):
|
| 992 | try: |
| 993 | return obj.getValidators() |
| 994 | except: |
| 995 | return None
|
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 996 | class Meta:
|
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 997 | model = Network |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 998 | 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] | 999 | |
| 1000 | |
Sapan Bhatia | dea3943 | 2014-06-13 03:10:36 -0400 | [diff] [blame] | 1001 | |
| 1002 | |
| 1003 | class ServiceSerializer(serializers.HyperlinkedModelSerializer): |
Scott Baker | f0480fb | 2014-12-23 11:12:07 -0800 | [diff] [blame] | 1004 | id = IdField() |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 1005 | |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 1006 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 1007 | validators = serializers.SerializerMethodField("getValidators") |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 1008 | def getHumanReadableName(self, obj):
|
| 1009 | return str(obj) |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 1010 | def getValidators(self, obj): |
| 1011 | try: |
| 1012 | return obj.getValidators() |
| 1013 | except: |
| 1014 | return None |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 1015 | class Meta: |
| 1016 | model = Service |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 1017 | 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] | 1018 | |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 1019 | class ServiceIdSerializer(XOSModelSerializer): |
Scott Baker | f0480fb | 2014-12-23 11:12:07 -0800 | [diff] [blame] | 1020 | id = IdField() |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 1021 | |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 1022 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 1023 | validators = serializers.SerializerMethodField("getValidators") |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 1024 | def getHumanReadableName(self, obj):
|
| 1025 | return str(obj)
|
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 1026 | def getValidators(self, obj):
|
| 1027 | try: |
| 1028 | return obj.getValidators() |
| 1029 | except: |
| 1030 | return None
|
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 1031 | class Meta:
|
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 1032 | model = Service |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 1033 | 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] | 1034 | |
| 1035 | |
Sapan Bhatia | dea3943 | 2014-06-13 03:10:36 -0400 | [diff] [blame] | 1036 | |
| 1037 | |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 1038 | class ServiceClassSerializer(serializers.HyperlinkedModelSerializer): |
Scott Baker | f0480fb | 2014-12-23 11:12:07 -0800 | [diff] [blame] | 1039 | id = IdField() |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 1040 | |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 1041 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 1042 | validators = serializers.SerializerMethodField("getValidators") |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 1043 | def getHumanReadableName(self, obj):
|
| 1044 | return str(obj) |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 1045 | def getValidators(self, obj): |
| 1046 | try: |
| 1047 | return obj.getValidators() |
| 1048 | except: |
| 1049 | return None |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 1050 | class Meta: |
| 1051 | model = ServiceClass |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 1052 | 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] | 1053 | |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 1054 | class ServiceClassIdSerializer(XOSModelSerializer): |
Scott Baker | f0480fb | 2014-12-23 11:12:07 -0800 | [diff] [blame] | 1055 | id = IdField() |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 1056 | |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 1057 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 1058 | validators = serializers.SerializerMethodField("getValidators") |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 1059 | def getHumanReadableName(self, obj):
|
| 1060 | return str(obj)
|
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 1061 | def getValidators(self, obj):
|
| 1062 | try: |
| 1063 | return obj.getValidators() |
| 1064 | except: |
| 1065 | return None
|
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 1066 | class Meta:
|
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 1067 | model = ServiceClass |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 1068 | 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] | 1069 | |
| 1070 | |
Sapan Bhatia | dea3943 | 2014-06-13 03:10:36 -0400 | [diff] [blame] | 1071 | |
| 1072 | |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 1073 | class PlanetStackSerializer(serializers.HyperlinkedModelSerializer): |
Scott Baker | f0480fb | 2014-12-23 11:12:07 -0800 | [diff] [blame] | 1074 | id = IdField() |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 1075 | |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 1076 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 1077 | validators = serializers.SerializerMethodField("getValidators") |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 1078 | def getHumanReadableName(self, obj):
|
| 1079 | return str(obj) |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 1080 | def getValidators(self, obj): |
| 1081 | try: |
| 1082 | return obj.getValidators() |
| 1083 | except: |
| 1084 | return None |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 1085 | class Meta: |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 1086 | model = PlanetStack |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 1087 | 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] | 1088 | |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 1089 | class PlanetStackIdSerializer(XOSModelSerializer): |
Scott Baker | f0480fb | 2014-12-23 11:12:07 -0800 | [diff] [blame] | 1090 | id = IdField() |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 1091 | |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 1092 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 1093 | validators = serializers.SerializerMethodField("getValidators") |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 1094 | def getHumanReadableName(self, obj):
|
| 1095 | return str(obj)
|
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 1096 | def getValidators(self, obj):
|
| 1097 | try: |
| 1098 | return obj.getValidators() |
| 1099 | except: |
| 1100 | return None
|
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 1101 | class Meta:
|
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 1102 | model = PlanetStack |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 1103 | 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] | 1104 | |
| 1105 | |
Sapan Bhatia | dea3943 | 2014-06-13 03:10:36 -0400 | [diff] [blame] | 1106 | |
| 1107 | |
| 1108 | class ChargeSerializer(serializers.HyperlinkedModelSerializer): |
Scott Baker | f0480fb | 2014-12-23 11:12:07 -0800 | [diff] [blame] | 1109 | id = IdField() |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 1110 | |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 1111 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 1112 | validators = serializers.SerializerMethodField("getValidators") |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 1113 | def getHumanReadableName(self, obj):
|
| 1114 | return str(obj) |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 1115 | def getValidators(self, obj): |
| 1116 | try: |
| 1117 | return obj.getValidators() |
| 1118 | except: |
| 1119 | return None |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 1120 | class Meta: |
| 1121 | model = Charge |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 1122 | 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] | 1123 | |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 1124 | class ChargeIdSerializer(XOSModelSerializer): |
Scott Baker | f0480fb | 2014-12-23 11:12:07 -0800 | [diff] [blame] | 1125 | id = IdField() |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 1126 | |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 1127 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 1128 | validators = serializers.SerializerMethodField("getValidators") |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 1129 | def getHumanReadableName(self, obj):
|
| 1130 | return str(obj)
|
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 1131 | def getValidators(self, obj):
|
| 1132 | try: |
| 1133 | return obj.getValidators() |
| 1134 | except: |
| 1135 | return None
|
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 1136 | class Meta:
|
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 1137 | model = Charge |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 1138 | 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] | 1139 | |
| 1140 | |
Sapan Bhatia | dea3943 | 2014-06-13 03:10:36 -0400 | [diff] [blame] | 1141 | |
| 1142 | |
| 1143 | class RoleSerializer(serializers.HyperlinkedModelSerializer): |
Scott Baker | f0480fb | 2014-12-23 11:12:07 -0800 | [diff] [blame] | 1144 | id = IdField() |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 1145 | |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 1146 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 1147 | validators = serializers.SerializerMethodField("getValidators") |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 1148 | def getHumanReadableName(self, obj):
|
| 1149 | return str(obj) |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 1150 | def getValidators(self, obj): |
| 1151 | try: |
| 1152 | return obj.getValidators() |
| 1153 | except: |
| 1154 | return None |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 1155 | class Meta: |
| 1156 | model = Role |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 1157 | 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] | 1158 | |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 1159 | class RoleIdSerializer(XOSModelSerializer): |
Scott Baker | f0480fb | 2014-12-23 11:12:07 -0800 | [diff] [blame] | 1160 | id = IdField() |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 1161 | |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 1162 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 1163 | validators = serializers.SerializerMethodField("getValidators") |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 1164 | def getHumanReadableName(self, obj):
|
| 1165 | return str(obj)
|
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 1166 | def getValidators(self, obj):
|
| 1167 | try: |
| 1168 | return obj.getValidators() |
| 1169 | except: |
| 1170 | return None
|
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 1171 | class Meta:
|
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 1172 | model = Role |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 1173 | 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] | 1174 | |
| 1175 | |
Sapan Bhatia | dea3943 | 2014-06-13 03:10:36 -0400 | [diff] [blame] | 1176 | |
| 1177 | |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 1178 | class UsableObjectSerializer(serializers.HyperlinkedModelSerializer): |
Scott Baker | f0480fb | 2014-12-23 11:12:07 -0800 | [diff] [blame] | 1179 | id = IdField() |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 1180 | |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 1181 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 1182 | validators = serializers.SerializerMethodField("getValidators") |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 1183 | def getHumanReadableName(self, obj):
|
| 1184 | return str(obj) |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 1185 | def getValidators(self, obj): |
| 1186 | try: |
| 1187 | return obj.getValidators() |
| 1188 | except: |
| 1189 | return None |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 1190 | class Meta: |
| 1191 | model = UsableObject |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 1192 | 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] | 1193 | |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 1194 | class UsableObjectIdSerializer(XOSModelSerializer): |
Scott Baker | f0480fb | 2014-12-23 11:12:07 -0800 | [diff] [blame] | 1195 | id = IdField() |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 1196 | |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 1197 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 1198 | validators = serializers.SerializerMethodField("getValidators") |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 1199 | def getHumanReadableName(self, obj):
|
| 1200 | return str(obj)
|
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 1201 | def getValidators(self, obj):
|
| 1202 | try: |
| 1203 | return obj.getValidators() |
| 1204 | except: |
| 1205 | return None
|
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 1206 | class Meta:
|
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 1207 | model = UsableObject |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 1208 | 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] | 1209 | |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 1210 | |
| 1211 | |
| 1212 | |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 1213 | class SiteRoleSerializer(serializers.HyperlinkedModelSerializer): |
Scott Baker | f0480fb | 2014-12-23 11:12:07 -0800 | [diff] [blame] | 1214 | id = IdField() |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 1215 | |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 1216 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 1217 | validators = serializers.SerializerMethodField("getValidators") |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 1218 | def getHumanReadableName(self, obj):
|
| 1219 | return str(obj) |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 1220 | def getValidators(self, obj): |
| 1221 | try: |
| 1222 | return obj.getValidators() |
| 1223 | except: |
| 1224 | return None |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 1225 | class Meta: |
| 1226 | model = SiteRole |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 1227 | 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] | 1228 | |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 1229 | class SiteRoleIdSerializer(XOSModelSerializer): |
Scott Baker | f0480fb | 2014-12-23 11:12:07 -0800 | [diff] [blame] | 1230 | id = IdField() |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 1231 | |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 1232 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 1233 | validators = serializers.SerializerMethodField("getValidators") |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 1234 | def getHumanReadableName(self, obj):
|
| 1235 | return str(obj)
|
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 1236 | def getValidators(self, obj):
|
| 1237 | try: |
| 1238 | return obj.getValidators() |
| 1239 | except: |
| 1240 | return None
|
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 1241 | class Meta:
|
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 1242 | model = SiteRole |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 1243 | 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] | 1244 | |
| 1245 | |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 1246 | |
| 1247 | |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 1248 | class SliceCredentialSerializer(serializers.HyperlinkedModelSerializer): |
Scott Baker | f0480fb | 2014-12-23 11:12:07 -0800 | [diff] [blame] | 1249 | id = IdField() |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 1250 | |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 1251 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 1252 | validators = serializers.SerializerMethodField("getValidators") |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 1253 | def getHumanReadableName(self, obj):
|
| 1254 | return str(obj) |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 1255 | def getValidators(self, obj): |
| 1256 | try: |
| 1257 | return obj.getValidators() |
| 1258 | except: |
| 1259 | return None |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 1260 | class Meta: |
| 1261 | model = SliceCredential |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 1262 | 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] | 1263 | |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 1264 | class SliceCredentialIdSerializer(XOSModelSerializer): |
Scott Baker | f0480fb | 2014-12-23 11:12:07 -0800 | [diff] [blame] | 1265 | id = IdField() |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 1266 | |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 1267 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 1268 | validators = serializers.SerializerMethodField("getValidators") |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 1269 | def getHumanReadableName(self, obj):
|
| 1270 | return str(obj)
|
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 1271 | def getValidators(self, obj):
|
| 1272 | try: |
| 1273 | return obj.getValidators() |
| 1274 | except: |
| 1275 | return None
|
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 1276 | class Meta:
|
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 1277 | model = SliceCredential |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 1278 | 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] | 1279 | |
| 1280 | |
| 1281 | |
| 1282 | |
Sapan Bhatia | dea3943 | 2014-06-13 03:10:36 -0400 | [diff] [blame] | 1283 | class SliverSerializer(serializers.HyperlinkedModelSerializer): |
Scott Baker | f0480fb | 2014-12-23 11:12:07 -0800 | [diff] [blame] | 1284 | id = IdField() |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 1285 | |
| 1286 | |
| 1287 | networks = serializers.HyperlinkedRelatedField(many=True, read_only=True, view_name='network-detail') |
| 1288 | |
| 1289 | |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 1290 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 1291 | validators = serializers.SerializerMethodField("getValidators") |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 1292 | def getHumanReadableName(self, obj):
|
| 1293 | return str(obj) |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 1294 | def getValidators(self, obj): |
| 1295 | try: |
| 1296 | return obj.getValidators() |
| 1297 | except: |
| 1298 | return None |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 1299 | class Meta: |
| 1300 | model = Sliver |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 1301 | 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] | 1302 | |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 1303 | class SliverIdSerializer(XOSModelSerializer): |
Scott Baker | f0480fb | 2014-12-23 11:12:07 -0800 | [diff] [blame] | 1304 | id = IdField() |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 1305 | |
| 1306 | |
Scott Baker | 201f7da | 2014-12-23 10:56:06 -0800 | [diff] [blame] | 1307 | networks = serializers.PrimaryKeyRelatedField(many=True, queryset = Network.objects.all()) |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 1308 | |
| 1309 | |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 1310 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 1311 | validators = serializers.SerializerMethodField("getValidators") |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 1312 | def getHumanReadableName(self, obj):
|
| 1313 | return str(obj)
|
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 1314 | def getValidators(self, obj):
|
| 1315 | try: |
| 1316 | return obj.getValidators() |
| 1317 | except: |
| 1318 | return None
|
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 1319 | class Meta:
|
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 1320 | model = Sliver |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 1321 | 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] | 1322 | |
| 1323 | |
Sapan Bhatia | dea3943 | 2014-06-13 03:10:36 -0400 | [diff] [blame] | 1324 | |
| 1325 | |
| 1326 | class NodeSerializer(serializers.HyperlinkedModelSerializer): |
Scott Baker | f0480fb | 2014-12-23 11:12:07 -0800 | [diff] [blame] | 1327 | id = IdField() |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 1328 | |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 1329 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 1330 | validators = serializers.SerializerMethodField("getValidators") |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 1331 | def getHumanReadableName(self, obj):
|
| 1332 | return str(obj) |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 1333 | def getValidators(self, obj): |
| 1334 | try: |
| 1335 | return obj.getValidators() |
| 1336 | except: |
| 1337 | return None |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 1338 | class Meta: |
| 1339 | model = Node |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 1340 | 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] | 1341 | |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 1342 | class NodeIdSerializer(XOSModelSerializer): |
Scott Baker | f0480fb | 2014-12-23 11:12:07 -0800 | [diff] [blame] | 1343 | id = IdField() |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 1344 | |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 1345 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 1346 | validators = serializers.SerializerMethodField("getValidators") |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 1347 | def getHumanReadableName(self, obj):
|
| 1348 | return str(obj)
|
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 1349 | def getValidators(self, obj):
|
| 1350 | try: |
| 1351 | return obj.getValidators() |
| 1352 | except: |
| 1353 | return None
|
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 1354 | class Meta:
|
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 1355 | model = Node |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 1356 | 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] | 1357 | |
| 1358 | |
Sapan Bhatia | dea3943 | 2014-06-13 03:10:36 -0400 | [diff] [blame] | 1359 | |
| 1360 | |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 1361 | class DashboardViewSerializer(serializers.HyperlinkedModelSerializer): |
Scott Baker | f0480fb | 2014-12-23 11:12:07 -0800 | [diff] [blame] | 1362 | id = IdField() |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 1363 | |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 1364 | |
| 1365 | controllers = serializers.HyperlinkedRelatedField(many=True, read_only=True, view_name='controller-detail') |
| 1366 | |
| 1367 | |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 1368 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 1369 | validators = serializers.SerializerMethodField("getValidators") |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 1370 | def getHumanReadableName(self, obj):
|
| 1371 | return str(obj) |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 1372 | def getValidators(self, obj): |
| 1373 | try: |
| 1374 | return obj.getValidators() |
| 1375 | except: |
| 1376 | return None |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 1377 | class Meta: |
| 1378 | model = DashboardView |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 1379 | 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] | 1380 | |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 1381 | class DashboardViewIdSerializer(XOSModelSerializer): |
Scott Baker | f0480fb | 2014-12-23 11:12:07 -0800 | [diff] [blame] | 1382 | id = IdField() |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 1383 | |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 1384 | |
Scott Baker | 201f7da | 2014-12-23 10:56:06 -0800 | [diff] [blame] | 1385 | controllers = serializers.PrimaryKeyRelatedField(many=True, queryset = Controller.objects.all()) |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 1386 | |
| 1387 | |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 1388 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 1389 | validators = serializers.SerializerMethodField("getValidators") |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 1390 | def getHumanReadableName(self, obj):
|
| 1391 | return str(obj)
|
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 1392 | def getValidators(self, obj):
|
| 1393 | try: |
| 1394 | return obj.getValidators() |
| 1395 | except: |
| 1396 | return None
|
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 1397 | class Meta:
|
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 1398 | model = DashboardView |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 1399 | 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] | 1400 | |
| 1401 | |
| 1402 | |
| 1403 | |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 1404 | class ControllerNetworkSerializer(serializers.HyperlinkedModelSerializer): |
| 1405 | id = IdField() |
| 1406 | |
| 1407 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
| 1408 | validators = serializers.SerializerMethodField("getValidators") |
| 1409 | def getHumanReadableName(self, obj):
|
| 1410 | return str(obj) |
| 1411 | def getValidators(self, obj): |
| 1412 | try: |
| 1413 | return obj.getValidators() |
| 1414 | except: |
| 1415 | return None |
| 1416 | class Meta: |
| 1417 | model = ControllerNetwork |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 1418 | 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] | 1419 | |
| 1420 | class ControllerNetworkIdSerializer(XOSModelSerializer): |
| 1421 | id = IdField() |
| 1422 | |
| 1423 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
| 1424 | validators = serializers.SerializerMethodField("getValidators") |
| 1425 | def getHumanReadableName(self, obj):
|
| 1426 | return str(obj)
|
| 1427 | def getValidators(self, obj):
|
| 1428 | try: |
| 1429 | return obj.getValidators() |
| 1430 | except: |
| 1431 | return None
|
| 1432 | class Meta:
|
| 1433 | model = ControllerNetwork |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 1434 | 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] | 1435 | |
| 1436 | |
| 1437 | |
| 1438 | |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 1439 | class ImageDeploymentsSerializer(serializers.HyperlinkedModelSerializer): |
Scott Baker | f0480fb | 2014-12-23 11:12:07 -0800 | [diff] [blame] | 1440 | id = IdField() |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 1441 | |
| 1442 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 1443 | validators = serializers.SerializerMethodField("getValidators") |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 1444 | def getHumanReadableName(self, obj):
|
| 1445 | return str(obj) |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 1446 | def getValidators(self, obj): |
| 1447 | try: |
| 1448 | return obj.getValidators() |
| 1449 | except: |
| 1450 | return None |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 1451 | class Meta: |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 1452 | model = ImageDeployments |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 1453 | 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] | 1454 | |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 1455 | class ImageDeploymentsIdSerializer(XOSModelSerializer): |
Scott Baker | f0480fb | 2014-12-23 11:12:07 -0800 | [diff] [blame] | 1456 | id = IdField() |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 1457 | |
| 1458 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 1459 | validators = serializers.SerializerMethodField("getValidators") |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 1460 | def getHumanReadableName(self, obj):
|
| 1461 | return str(obj)
|
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 1462 | def getValidators(self, obj):
|
| 1463 | try: |
| 1464 | return obj.getValidators() |
| 1465 | except: |
| 1466 | return None
|
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 1467 | class Meta:
|
| 1468 | model = ImageDeployments |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 1469 | 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] | 1470 | |
| 1471 | |
Sapan Bhatia | dea3943 | 2014-06-13 03:10:36 -0400 | [diff] [blame] | 1472 | |
| 1473 | |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 1474 | class ControllerUserSerializer(serializers.HyperlinkedModelSerializer): |
| 1475 | id = IdField() |
| 1476 | |
| 1477 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
| 1478 | validators = serializers.SerializerMethodField("getValidators") |
| 1479 | def getHumanReadableName(self, obj):
|
| 1480 | return str(obj) |
| 1481 | def getValidators(self, obj): |
| 1482 | try: |
| 1483 | return obj.getValidators() |
| 1484 | except: |
| 1485 | return None |
| 1486 | class Meta: |
| 1487 | model = ControllerUser |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 1488 | 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] | 1489 | |
| 1490 | class ControllerUserIdSerializer(XOSModelSerializer): |
| 1491 | id = IdField() |
| 1492 | |
| 1493 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
| 1494 | validators = serializers.SerializerMethodField("getValidators") |
| 1495 | def getHumanReadableName(self, obj):
|
| 1496 | return str(obj)
|
| 1497 | def getValidators(self, obj):
|
| 1498 | try: |
| 1499 | return obj.getValidators() |
| 1500 | except: |
| 1501 | return None
|
| 1502 | class Meta:
|
| 1503 | model = ControllerUser |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 1504 | 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] | 1505 | |
| 1506 | |
| 1507 | |
| 1508 | |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 1509 | class ReservedResourceSerializer(serializers.HyperlinkedModelSerializer): |
Scott Baker | f0480fb | 2014-12-23 11:12:07 -0800 | [diff] [blame] | 1510 | id = IdField() |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 1511 | |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 1512 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 1513 | validators = serializers.SerializerMethodField("getValidators") |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 1514 | def getHumanReadableName(self, obj):
|
| 1515 | return str(obj) |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 1516 | def getValidators(self, obj): |
| 1517 | try: |
| 1518 | return obj.getValidators() |
| 1519 | except: |
| 1520 | return None |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 1521 | class Meta: |
| 1522 | model = ReservedResource |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 1523 | 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] | 1524 | |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 1525 | class ReservedResourceIdSerializer(XOSModelSerializer): |
Scott Baker | f0480fb | 2014-12-23 11:12:07 -0800 | [diff] [blame] | 1526 | id = IdField() |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 1527 | |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 1528 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 1529 | validators = serializers.SerializerMethodField("getValidators") |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 1530 | def getHumanReadableName(self, obj):
|
| 1531 | return str(obj)
|
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 1532 | def getValidators(self, obj):
|
| 1533 | try: |
| 1534 | return obj.getValidators() |
| 1535 | except: |
| 1536 | return None
|
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 1537 | class Meta:
|
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 1538 | model = ReservedResource |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 1539 | 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] | 1540 | |
| 1541 | |
| 1542 | |
| 1543 | |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 1544 | class PaymentSerializer(serializers.HyperlinkedModelSerializer): |
Scott Baker | f0480fb | 2014-12-23 11:12:07 -0800 | [diff] [blame] | 1545 | id = IdField() |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 1546 | |
| 1547 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
| 1548 | validators = serializers.SerializerMethodField("getValidators") |
| 1549 | def getHumanReadableName(self, obj):
|
| 1550 | return str(obj) |
| 1551 | def getValidators(self, obj): |
| 1552 | try: |
| 1553 | return obj.getValidators() |
| 1554 | except: |
| 1555 | return None |
| 1556 | class Meta: |
| 1557 | model = Payment |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 1558 | 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] | 1559 | |
| 1560 | class PaymentIdSerializer(XOSModelSerializer): |
Scott Baker | f0480fb | 2014-12-23 11:12:07 -0800 | [diff] [blame] | 1561 | id = IdField() |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 1562 | |
| 1563 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
| 1564 | validators = serializers.SerializerMethodField("getValidators") |
| 1565 | def getHumanReadableName(self, obj):
|
| 1566 | return str(obj)
|
| 1567 | def getValidators(self, obj):
|
| 1568 | try: |
| 1569 | return obj.getValidators() |
| 1570 | except: |
| 1571 | return None
|
| 1572 | class Meta:
|
| 1573 | model = Payment |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 1574 | 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] | 1575 | |
| 1576 | |
| 1577 | |
| 1578 | |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 1579 | class NetworkSliceSerializer(serializers.HyperlinkedModelSerializer): |
Scott Baker | f0480fb | 2014-12-23 11:12:07 -0800 | [diff] [blame] | 1580 | id = IdField() |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 1581 | |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 1582 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 1583 | validators = serializers.SerializerMethodField("getValidators") |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 1584 | def getHumanReadableName(self, obj):
|
| 1585 | return str(obj) |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 1586 | def getValidators(self, obj): |
| 1587 | try: |
| 1588 | return obj.getValidators() |
| 1589 | except: |
| 1590 | return None |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 1591 | class Meta: |
| 1592 | model = NetworkSlice |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 1593 | 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] | 1594 | |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 1595 | class NetworkSliceIdSerializer(XOSModelSerializer): |
Scott Baker | f0480fb | 2014-12-23 11:12:07 -0800 | [diff] [blame] | 1596 | id = IdField() |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 1597 | |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 1598 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 1599 | validators = serializers.SerializerMethodField("getValidators") |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 1600 | def getHumanReadableName(self, obj):
|
| 1601 | return str(obj)
|
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 1602 | def getValidators(self, obj):
|
| 1603 | try: |
| 1604 | return obj.getValidators() |
| 1605 | except: |
| 1606 | return None
|
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 1607 | class Meta:
|
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 1608 | model = NetworkSlice |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 1609 | 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] | 1610 | |
| 1611 | |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 1612 | |
| 1613 | |
| 1614 | class UserDashboardViewSerializer(serializers.HyperlinkedModelSerializer): |
Scott Baker | f0480fb | 2014-12-23 11:12:07 -0800 | [diff] [blame] | 1615 | id = IdField() |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 1616 | |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 1617 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 1618 | validators = serializers.SerializerMethodField("getValidators") |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 1619 | def getHumanReadableName(self, obj):
|
| 1620 | return str(obj) |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 1621 | def getValidators(self, obj): |
| 1622 | try: |
| 1623 | return obj.getValidators() |
| 1624 | except: |
| 1625 | return None |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 1626 | class Meta: |
| 1627 | model = UserDashboardView |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 1628 | 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] | 1629 | |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 1630 | class UserDashboardViewIdSerializer(XOSModelSerializer): |
Scott Baker | f0480fb | 2014-12-23 11:12:07 -0800 | [diff] [blame] | 1631 | id = IdField() |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 1632 | |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 1633 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 1634 | validators = serializers.SerializerMethodField("getValidators") |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 1635 | def getHumanReadableName(self, obj):
|
| 1636 | return str(obj)
|
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 1637 | def getValidators(self, obj):
|
| 1638 | try: |
| 1639 | return obj.getValidators() |
| 1640 | except: |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 1641 | return None
|
| 1642 | class Meta:
|
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 1643 | model = UserDashboardView |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 1644 | 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] | 1645 | |
| 1646 | |
| 1647 | |
| 1648 | |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 1649 | class ControllerSerializer(serializers.HyperlinkedModelSerializer): |
Scott Baker | f0480fb | 2014-12-23 11:12:07 -0800 | [diff] [blame] | 1650 | id = IdField() |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 1651 | |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 1652 | |
| 1653 | dashboardviews = serializers.HyperlinkedRelatedField(many=True, read_only=True, view_name='dashboardview-detail') |
| 1654 | |
| 1655 | |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 1656 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 1657 | validators = serializers.SerializerMethodField("getValidators") |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 1658 | def getHumanReadableName(self, obj):
|
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 1659 | return str(obj) |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 1660 | def getValidators(self, obj): |
| 1661 | try: |
| 1662 | return obj.getValidators() |
| 1663 | except: |
| 1664 | return None |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 1665 | class Meta: |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 1666 | model = Controller |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 1667 | 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] | 1668 | |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 1669 | class ControllerIdSerializer(XOSModelSerializer): |
Scott Baker | f0480fb | 2014-12-23 11:12:07 -0800 | [diff] [blame] | 1670 | id = IdField() |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 1671 | |
| 1672 | |
Scott Baker | 201f7da | 2014-12-23 10:56:06 -0800 | [diff] [blame] | 1673 | dashboardviews = serializers.PrimaryKeyRelatedField(many=True, queryset = DashboardView.objects.all()) |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 1674 | |
| 1675 | |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 1676 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 1677 | validators = serializers.SerializerMethodField("getValidators") |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 1678 | def getHumanReadableName(self, obj):
|
| 1679 | return str(obj)
|
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 1680 | def getValidators(self, obj):
|
| 1681 | try: |
| 1682 | return obj.getValidators() |
| 1683 | except: |
| 1684 | return None
|
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 1685 | class Meta:
|
| 1686 | model = Controller |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 1687 | 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] | 1688 | |
| 1689 | |
| 1690 | |
| 1691 | |
| 1692 | class PlanetStackPrivilegeSerializer(serializers.HyperlinkedModelSerializer): |
Scott Baker | f0480fb | 2014-12-23 11:12:07 -0800 | [diff] [blame] | 1693 | id = IdField() |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 1694 | |
| 1695 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
| 1696 | validators = serializers.SerializerMethodField("getValidators") |
| 1697 | def getHumanReadableName(self, obj):
|
| 1698 | return str(obj) |
| 1699 | def getValidators(self, obj): |
| 1700 | try: |
| 1701 | return obj.getValidators() |
| 1702 | except: |
| 1703 | return None |
| 1704 | class Meta: |
| 1705 | model = PlanetStackPrivilege |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 1706 | 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] | 1707 | |
| 1708 | class PlanetStackPrivilegeIdSerializer(XOSModelSerializer): |
Scott Baker | f0480fb | 2014-12-23 11:12:07 -0800 | [diff] [blame] | 1709 | id = IdField() |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 1710 | |
| 1711 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
| 1712 | validators = serializers.SerializerMethodField("getValidators") |
| 1713 | def getHumanReadableName(self, obj):
|
| 1714 | return str(obj)
|
| 1715 | def getValidators(self, obj):
|
| 1716 | try: |
| 1717 | return obj.getValidators() |
| 1718 | except: |
| 1719 | return None
|
| 1720 | class Meta:
|
| 1721 | model = PlanetStackPrivilege |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 1722 | 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] | 1723 | |
| 1724 | |
| 1725 | |
| 1726 | |
| 1727 | class UserSerializer(serializers.HyperlinkedModelSerializer): |
Scott Baker | f0480fb | 2014-12-23 11:12:07 -0800 | [diff] [blame] | 1728 | id = IdField() |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 1729 | |
| 1730 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
| 1731 | validators = serializers.SerializerMethodField("getValidators") |
| 1732 | def getHumanReadableName(self, obj):
|
| 1733 | return str(obj) |
| 1734 | def getValidators(self, obj): |
| 1735 | try: |
| 1736 | return obj.getValidators() |
| 1737 | except: |
| 1738 | return None |
| 1739 | class Meta: |
| 1740 | model = User |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 1741 | 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] | 1742 | |
| 1743 | class UserIdSerializer(XOSModelSerializer): |
Scott Baker | f0480fb | 2014-12-23 11:12:07 -0800 | [diff] [blame] | 1744 | id = IdField() |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 1745 | |
| 1746 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
| 1747 | validators = serializers.SerializerMethodField("getValidators") |
| 1748 | def getHumanReadableName(self, obj):
|
| 1749 | return str(obj)
|
| 1750 | def getValidators(self, obj):
|
| 1751 | try: |
| 1752 | return obj.getValidators() |
| 1753 | except: |
| 1754 | return None
|
| 1755 | class Meta:
|
| 1756 | model = User |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 1757 | 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] | 1758 | |
| 1759 | |
| 1760 | |
| 1761 | |
| 1762 | class DeploymentSerializer(serializers.HyperlinkedModelSerializer): |
Scott Baker | f0480fb | 2014-12-23 11:12:07 -0800 | [diff] [blame] | 1763 | id = IdField() |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 1764 | |
| 1765 | |
Scott Baker | bf4ef6d | 2014-12-22 15:59:33 -0800 | [diff] [blame] | 1766 | images = serializers.HyperlinkedRelatedField(many=True, read_only=True, view_name='image-detail') |
| 1767 | |
| 1768 | |
| 1769 | |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 1770 | sites = serializers.HyperlinkedRelatedField(many=True, read_only=True, view_name='site-detail') |
| 1771 | |
| 1772 | |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 1773 | |
| 1774 | flavors = serializers.HyperlinkedRelatedField(many=True, read_only=True, view_name='flavor-detail') |
| 1775 | |
| 1776 | |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 1777 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
| 1778 | validators = serializers.SerializerMethodField("getValidators") |
| 1779 | def getHumanReadableName(self, obj):
|
| 1780 | return str(obj) |
| 1781 | def getValidators(self, obj): |
| 1782 | try: |
| 1783 | return obj.getValidators() |
| 1784 | except: |
| 1785 | return None |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 1786 | class Meta: |
| 1787 | model = Deployment |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 1788 | 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] | 1789 | |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 1790 | class DeploymentIdSerializer(XOSModelSerializer): |
Scott Baker | f0480fb | 2014-12-23 11:12:07 -0800 | [diff] [blame] | 1791 | id = IdField() |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 1792 | |
| 1793 | |
Scott Baker | 201f7da | 2014-12-23 10:56:06 -0800 | [diff] [blame] | 1794 | images = serializers.PrimaryKeyRelatedField(many=True, queryset = Image.objects.all()) |
Scott Baker | bf4ef6d | 2014-12-22 15:59:33 -0800 | [diff] [blame] | 1795 | |
| 1796 | |
| 1797 | |
Scott Baker | 201f7da | 2014-12-23 10:56:06 -0800 | [diff] [blame] | 1798 | sites = serializers.PrimaryKeyRelatedField(many=True, queryset = Site.objects.all()) |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 1799 | |
| 1800 | |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 1801 | |
| 1802 | flavors = serializers.PrimaryKeyRelatedField(many=True, queryset = Flavor.objects.all()) |
| 1803 | |
| 1804 | |
Tony Mack | 06c8e47 | 2014-11-30 15:53:08 -0500 | [diff] [blame] | 1805 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
| 1806 | validators = serializers.SerializerMethodField("getValidators") |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 1807 | def getHumanReadableName(self, obj):
|
| 1808 | return str(obj)
|
| 1809 | def getValidators(self, obj):
|
Tony Mack | 06c8e47 | 2014-11-30 15:53:08 -0500 | [diff] [blame] | 1810 | try: |
| 1811 | return obj.getValidators() |
| 1812 | except: |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 1813 | return None
|
| 1814 | class Meta:
|
| 1815 | model = Deployment |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 1816 | 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] | 1817 | |
| 1818 | |
Sapan Bhatia | dea3943 | 2014-06-13 03:10:36 -0400 | [diff] [blame] | 1819 | |
| 1820 | |
| 1821 | class ReservationSerializer(serializers.HyperlinkedModelSerializer): |
Scott Baker | f0480fb | 2014-12-23 11:12:07 -0800 | [diff] [blame] | 1822 | id = IdField() |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 1823 | |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 1824 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 1825 | validators = serializers.SerializerMethodField("getValidators") |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 1826 | def getHumanReadableName(self, obj):
|
| 1827 | return str(obj) |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 1828 | def getValidators(self, obj): |
| 1829 | try: |
| 1830 | return obj.getValidators() |
| 1831 | except: |
| 1832 | return None |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 1833 | class Meta: |
| 1834 | model = Reservation |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 1835 | 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] | 1836 | |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 1837 | class ReservationIdSerializer(XOSModelSerializer): |
Scott Baker | f0480fb | 2014-12-23 11:12:07 -0800 | [diff] [blame] | 1838 | id = IdField() |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 1839 | |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 1840 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 1841 | validators = serializers.SerializerMethodField("getValidators") |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 1842 | def getHumanReadableName(self, obj):
|
| 1843 | return str(obj)
|
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 1844 | def getValidators(self, obj):
|
| 1845 | try: |
| 1846 | return obj.getValidators() |
| 1847 | except: |
| 1848 | return None
|
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 1849 | class Meta:
|
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 1850 | model = Reservation |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 1851 | 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] | 1852 | |
| 1853 | |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 1854 | |
| 1855 | |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 1856 | class SitePrivilegeSerializer(serializers.HyperlinkedModelSerializer): |
Scott Baker | f0480fb | 2014-12-23 11:12:07 -0800 | [diff] [blame] | 1857 | id = IdField() |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 1858 | |
| 1859 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 1860 | validators = serializers.SerializerMethodField("getValidators") |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 1861 | def getHumanReadableName(self, obj):
|
| 1862 | return str(obj) |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 1863 | def getValidators(self, obj): |
| 1864 | try: |
| 1865 | return obj.getValidators() |
| 1866 | except: |
| 1867 | return None |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 1868 | class Meta: |
| 1869 | model = SitePrivilege |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 1870 | 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] | 1871 | |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 1872 | class SitePrivilegeIdSerializer(XOSModelSerializer): |
Scott Baker | f0480fb | 2014-12-23 11:12:07 -0800 | [diff] [blame] | 1873 | id = IdField() |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 1874 | |
| 1875 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 1876 | validators = serializers.SerializerMethodField("getValidators") |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 1877 | def getHumanReadableName(self, obj):
|
| 1878 | return str(obj)
|
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 1879 | def getValidators(self, obj):
|
| 1880 | try: |
| 1881 | return obj.getValidators() |
| 1882 | except: |
| 1883 | return None
|
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 1884 | class Meta:
|
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 1885 | model = SitePrivilege |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 1886 | 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] | 1887 | |
| 1888 | |
| 1889 | |
| 1890 | |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 1891 | class ControllerSliceSerializer(serializers.HyperlinkedModelSerializer): |
Scott Baker | f0480fb | 2014-12-23 11:12:07 -0800 | [diff] [blame] | 1892 | id = IdField() |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 1893 | |
| 1894 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 1895 | validators = serializers.SerializerMethodField("getValidators") |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 1896 | def getHumanReadableName(self, obj):
|
| 1897 | return str(obj) |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 1898 | def getValidators(self, obj): |
| 1899 | try: |
| 1900 | return obj.getValidators() |
| 1901 | except: |
| 1902 | return None |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 1903 | class Meta: |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 1904 | model = ControllerSlice |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 1905 | 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] | 1906 | |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 1907 | class ControllerSliceIdSerializer(XOSModelSerializer): |
Scott Baker | f0480fb | 2014-12-23 11:12:07 -0800 | [diff] [blame] | 1908 | id = IdField() |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 1909 | |
| 1910 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 1911 | validators = serializers.SerializerMethodField("getValidators") |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 1912 | def getHumanReadableName(self, obj):
|
| 1913 | return str(obj)
|
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 1914 | def getValidators(self, obj):
|
| 1915 | try: |
| 1916 | return obj.getValidators() |
| 1917 | except: |
| 1918 | return None
|
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 1919 | class Meta:
|
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 1920 | model = ControllerSlice |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 1921 | 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] | 1922 | |
| 1923 | |
Sapan Bhatia | dea3943 | 2014-06-13 03:10:36 -0400 | [diff] [blame] | 1924 | |
| 1925 | |
Scott Baker | f2c0c51 | 2014-12-22 17:35:34 -0800 | [diff] [blame] | 1926 | class ControllerDashboardViewSerializer(serializers.HyperlinkedModelSerializer): |
Scott Baker | f0480fb | 2014-12-23 11:12:07 -0800 | [diff] [blame] | 1927 | id = IdField() |
Scott Baker | f2c0c51 | 2014-12-22 17:35:34 -0800 | [diff] [blame] | 1928 | |
| 1929 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
| 1930 | validators = serializers.SerializerMethodField("getValidators") |
| 1931 | def getHumanReadableName(self, obj):
|
| 1932 | return str(obj) |
| 1933 | def getValidators(self, obj): |
| 1934 | try: |
| 1935 | return obj.getValidators() |
| 1936 | except: |
| 1937 | return None |
| 1938 | class Meta: |
| 1939 | model = ControllerDashboardView |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 1940 | 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] | 1941 | |
| 1942 | class ControllerDashboardViewIdSerializer(XOSModelSerializer): |
Scott Baker | f0480fb | 2014-12-23 11:12:07 -0800 | [diff] [blame] | 1943 | id = IdField() |
Scott Baker | f2c0c51 | 2014-12-22 17:35:34 -0800 | [diff] [blame] | 1944 | |
| 1945 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
| 1946 | validators = serializers.SerializerMethodField("getValidators") |
| 1947 | def getHumanReadableName(self, obj):
|
| 1948 | return str(obj)
|
| 1949 | def getValidators(self, obj):
|
| 1950 | try: |
| 1951 | return obj.getValidators() |
| 1952 | except: |
| 1953 | return None
|
| 1954 | class Meta:
|
| 1955 | model = ControllerDashboardView |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 1956 | 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] | 1957 | |
| 1958 | |
| 1959 | |
| 1960 | |
Sapan Bhatia | dea3943 | 2014-06-13 03:10:36 -0400 | [diff] [blame] | 1961 | class AccountSerializer(serializers.HyperlinkedModelSerializer): |
Scott Baker | f0480fb | 2014-12-23 11:12:07 -0800 | [diff] [blame] | 1962 | id = IdField() |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 1963 | |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 1964 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 1965 | validators = serializers.SerializerMethodField("getValidators") |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 1966 | def getHumanReadableName(self, obj):
|
| 1967 | return str(obj) |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 1968 | def getValidators(self, obj): |
| 1969 | try: |
| 1970 | return obj.getValidators() |
| 1971 | except: |
| 1972 | return None |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 1973 | class Meta: |
| 1974 | model = Account |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 1975 | 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] | 1976 | |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 1977 | class AccountIdSerializer(XOSModelSerializer): |
Scott Baker | f0480fb | 2014-12-23 11:12:07 -0800 | [diff] [blame] | 1978 | id = IdField() |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 1979 | |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 1980 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 1981 | validators = serializers.SerializerMethodField("getValidators") |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 1982 | def getHumanReadableName(self, obj):
|
| 1983 | return str(obj)
|
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 1984 | def getValidators(self, obj):
|
| 1985 | try: |
| 1986 | return obj.getValidators() |
| 1987 | except: |
| 1988 | return None
|
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 1989 | class Meta:
|
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 1990 | model = Account |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 1991 | 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] | 1992 | |
| 1993 | |
Sapan Bhatia | dea3943 | 2014-06-13 03:10:36 -0400 | [diff] [blame] | 1994 | |
| 1995 | |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 1996 | class ControllerRoleSerializer(serializers.HyperlinkedModelSerializer): |
Scott Baker | f0480fb | 2014-12-23 11:12:07 -0800 | [diff] [blame] | 1997 | id = IdField() |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 1998 | |
| 1999 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
| 2000 | validators = serializers.SerializerMethodField("getValidators") |
| 2001 | def getHumanReadableName(self, obj):
|
| 2002 | return str(obj) |
| 2003 | def getValidators(self, obj): |
| 2004 | try: |
| 2005 | return obj.getValidators() |
| 2006 | except: |
| 2007 | return None |
| 2008 | class Meta: |
| 2009 | model = ControllerRole |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 2010 | 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] | 2011 | |
| 2012 | class ControllerRoleIdSerializer(XOSModelSerializer): |
Scott Baker | f0480fb | 2014-12-23 11:12:07 -0800 | [diff] [blame] | 2013 | id = IdField() |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 2014 | |
| 2015 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
| 2016 | validators = serializers.SerializerMethodField("getValidators") |
| 2017 | def getHumanReadableName(self, obj):
|
| 2018 | return str(obj)
|
| 2019 | def getValidators(self, obj):
|
| 2020 | try: |
| 2021 | return obj.getValidators() |
| 2022 | except: |
| 2023 | return None
|
| 2024 | class Meta:
|
| 2025 | model = ControllerRole |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 2026 | 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] | 2027 | |
| 2028 | |
| 2029 | |
| 2030 | |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 2031 | class NetworkParameterTypeSerializer(serializers.HyperlinkedModelSerializer): |
Scott Baker | f0480fb | 2014-12-23 11:12:07 -0800 | [diff] [blame] | 2032 | id = IdField() |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 2033 | |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 2034 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 2035 | validators = serializers.SerializerMethodField("getValidators") |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 2036 | def getHumanReadableName(self, obj):
|
| 2037 | return str(obj) |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 2038 | def getValidators(self, obj): |
| 2039 | try: |
| 2040 | return obj.getValidators() |
| 2041 | except: |
| 2042 | return None |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 2043 | class Meta: |
| 2044 | model = NetworkParameterType |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 2045 | 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] | 2046 | |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 2047 | class NetworkParameterTypeIdSerializer(XOSModelSerializer): |
Scott Baker | f0480fb | 2014-12-23 11:12:07 -0800 | [diff] [blame] | 2048 | id = IdField() |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 2049 | |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 2050 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 2051 | validators = serializers.SerializerMethodField("getValidators") |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 2052 | def getHumanReadableName(self, obj):
|
| 2053 | return str(obj)
|
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 2054 | def getValidators(self, obj):
|
| 2055 | try: |
| 2056 | return obj.getValidators() |
| 2057 | except: |
| 2058 | return None
|
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 2059 | class Meta:
|
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 2060 | model = NetworkParameterType |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 2061 | 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] | 2062 | |
| 2063 | |
Sapan Bhatia | dea3943 | 2014-06-13 03:10:36 -0400 | [diff] [blame] | 2064 | |
| 2065 | |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 2066 | class SiteCredentialSerializer(serializers.HyperlinkedModelSerializer): |
Scott Baker | f0480fb | 2014-12-23 11:12:07 -0800 | [diff] [blame] | 2067 | id = IdField() |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 2068 | |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 2069 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 2070 | validators = serializers.SerializerMethodField("getValidators") |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 2071 | def getHumanReadableName(self, obj):
|
| 2072 | return str(obj) |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 2073 | def getValidators(self, obj): |
| 2074 | try: |
| 2075 | return obj.getValidators() |
| 2076 | except: |
| 2077 | return None |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 2078 | class Meta: |
| 2079 | model = SiteCredential |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 2080 | 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] | 2081 | |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 2082 | class SiteCredentialIdSerializer(XOSModelSerializer): |
Scott Baker | f0480fb | 2014-12-23 11:12:07 -0800 | [diff] [blame] | 2083 | id = IdField() |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 2084 | |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 2085 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 2086 | validators = serializers.SerializerMethodField("getValidators") |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 2087 | def getHumanReadableName(self, obj):
|
| 2088 | return str(obj)
|
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 2089 | def getValidators(self, obj):
|
| 2090 | try: |
| 2091 | return obj.getValidators() |
| 2092 | except: |
| 2093 | return None
|
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 2094 | class Meta:
|
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 2095 | model = SiteCredential |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 2096 | 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] | 2097 | |
| 2098 | |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 2099 | |
| 2100 | |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 2101 | class DeploymentPrivilegeSerializer(serializers.HyperlinkedModelSerializer): |
Scott Baker | f0480fb | 2014-12-23 11:12:07 -0800 | [diff] [blame] | 2102 | id = IdField() |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 2103 | |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 2104 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 2105 | validators = serializers.SerializerMethodField("getValidators") |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 2106 | def getHumanReadableName(self, obj):
|
| 2107 | return str(obj) |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 2108 | def getValidators(self, obj): |
| 2109 | try: |
| 2110 | return obj.getValidators() |
| 2111 | except: |
| 2112 | return None |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 2113 | class Meta: |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 2114 | model = DeploymentPrivilege |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 2115 | 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] | 2116 | |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 2117 | class DeploymentPrivilegeIdSerializer(XOSModelSerializer): |
Scott Baker | f0480fb | 2014-12-23 11:12:07 -0800 | [diff] [blame] | 2118 | id = IdField() |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 2119 | |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 2120 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 2121 | validators = serializers.SerializerMethodField("getValidators") |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 2122 | def getHumanReadableName(self, obj):
|
| 2123 | return str(obj)
|
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 2124 | def getValidators(self, obj):
|
| 2125 | try: |
| 2126 | return obj.getValidators() |
| 2127 | except: |
| 2128 | return None
|
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 2129 | class Meta:
|
| 2130 | model = DeploymentPrivilege |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 2131 | 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] | 2132 | |
| 2133 | |
| 2134 | |
| 2135 | |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 2136 | class ControllerSlicePrivilegeSerializer(serializers.HyperlinkedModelSerializer): |
Scott Baker | f0480fb | 2014-12-23 11:12:07 -0800 | [diff] [blame] | 2137 | id = IdField() |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 2138 | |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 2139 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 2140 | validators = serializers.SerializerMethodField("getValidators") |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 2141 | def getHumanReadableName(self, obj):
|
| 2142 | return str(obj) |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 2143 | def getValidators(self, obj): |
| 2144 | try: |
| 2145 | return obj.getValidators() |
| 2146 | except: |
| 2147 | return None |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 2148 | class Meta: |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 2149 | model = ControllerSlicePrivilege |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 2150 | 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] | 2151 | |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 2152 | class ControllerSlicePrivilegeIdSerializer(XOSModelSerializer): |
Scott Baker | f0480fb | 2014-12-23 11:12:07 -0800 | [diff] [blame] | 2153 | id = IdField() |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 2154 | |
| 2155 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
| 2156 | validators = serializers.SerializerMethodField("getValidators") |
| 2157 | def getHumanReadableName(self, obj):
|
| 2158 | return str(obj)
|
| 2159 | def getValidators(self, obj):
|
| 2160 | try: |
| 2161 | return obj.getValidators() |
| 2162 | except: |
| 2163 | return None
|
| 2164 | class Meta:
|
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 2165 | model = ControllerSlicePrivilege |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 2166 | 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] | 2167 | |
| 2168 | |
| 2169 | |
| 2170 | |
| 2171 | class SiteDeploymentSerializer(serializers.HyperlinkedModelSerializer): |
| 2172 | id = IdField() |
| 2173 | |
| 2174 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
| 2175 | validators = serializers.SerializerMethodField("getValidators") |
| 2176 | def getHumanReadableName(self, obj):
|
| 2177 | return str(obj) |
| 2178 | def getValidators(self, obj): |
| 2179 | try: |
| 2180 | return obj.getValidators() |
| 2181 | except: |
| 2182 | return None |
| 2183 | class Meta: |
| 2184 | model = SiteDeployment |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 2185 | 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] | 2186 | |
| 2187 | class SiteDeploymentIdSerializer(XOSModelSerializer): |
| 2188 | id = IdField() |
| 2189 | |
| 2190 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
| 2191 | validators = serializers.SerializerMethodField("getValidators") |
| 2192 | def getHumanReadableName(self, obj):
|
| 2193 | return str(obj)
|
| 2194 | def getValidators(self, obj):
|
| 2195 | try: |
| 2196 | return obj.getValidators() |
| 2197 | except: |
| 2198 | return None
|
| 2199 | class Meta:
|
| 2200 | model = SiteDeployment |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 2201 | 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] | 2202 | |
| 2203 | |
| 2204 | |
| 2205 | |
| 2206 | class DeploymentRoleSerializer(serializers.HyperlinkedModelSerializer): |
Scott Baker | f0480fb | 2014-12-23 11:12:07 -0800 | [diff] [blame] | 2207 | id = IdField() |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 2208 | |
| 2209 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
| 2210 | validators = serializers.SerializerMethodField("getValidators") |
| 2211 | def getHumanReadableName(self, obj):
|
| 2212 | return str(obj) |
| 2213 | def getValidators(self, obj): |
| 2214 | try: |
| 2215 | return obj.getValidators() |
| 2216 | except: |
| 2217 | return None |
| 2218 | class Meta: |
| 2219 | model = DeploymentRole |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 2220 | 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] | 2221 | |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 2222 | class DeploymentRoleIdSerializer(XOSModelSerializer): |
Scott Baker | f0480fb | 2014-12-23 11:12:07 -0800 | [diff] [blame] | 2223 | id = IdField() |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 2224 | |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 2225 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 2226 | validators = serializers.SerializerMethodField("getValidators") |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 2227 | def getHumanReadableName(self, obj):
|
| 2228 | return str(obj)
|
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 2229 | def getValidators(self, obj):
|
| 2230 | try: |
| 2231 | return obj.getValidators() |
| 2232 | except: |
| 2233 | return None
|
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 2234 | class Meta:
|
| 2235 | model = DeploymentRole |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 2236 | 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] | 2237 | |
| 2238 | |
Sapan Bhatia | dea3943 | 2014-06-13 03:10:36 -0400 | [diff] [blame] | 2239 | |
| 2240 | |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 2241 | class UserCredentialSerializer(serializers.HyperlinkedModelSerializer): |
Scott Baker | f0480fb | 2014-12-23 11:12:07 -0800 | [diff] [blame] | 2242 | id = IdField() |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 2243 | |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 2244 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 2245 | validators = serializers.SerializerMethodField("getValidators") |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 2246 | def getHumanReadableName(self, obj):
|
| 2247 | return str(obj) |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 2248 | def getValidators(self, obj): |
| 2249 | try: |
| 2250 | return obj.getValidators() |
| 2251 | except: |
| 2252 | return None |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 2253 | class Meta: |
| 2254 | model = UserCredential |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 2255 | 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] | 2256 | |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 2257 | class UserCredentialIdSerializer(XOSModelSerializer): |
Scott Baker | f0480fb | 2014-12-23 11:12:07 -0800 | [diff] [blame] | 2258 | id = IdField() |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 2259 | |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 2260 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 2261 | validators = serializers.SerializerMethodField("getValidators") |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 2262 | def getHumanReadableName(self, obj):
|
| 2263 | return str(obj)
|
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 2264 | def getValidators(self, obj):
|
| 2265 | try: |
| 2266 | return obj.getValidators() |
| 2267 | except: |
| 2268 | return None
|
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 2269 | class Meta:
|
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 2270 | model = UserCredential |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 2271 | 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] | 2272 | |
| 2273 | |
| 2274 | |
| 2275 | |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 2276 | class SliceTagSerializer(serializers.HyperlinkedModelSerializer): |
Scott Baker | f0480fb | 2014-12-23 11:12:07 -0800 | [diff] [blame] | 2277 | id = IdField() |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 2278 | |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 2279 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 2280 | validators = serializers.SerializerMethodField("getValidators") |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 2281 | def getHumanReadableName(self, obj):
|
| 2282 | return str(obj) |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 2283 | def getValidators(self, obj): |
| 2284 | try: |
| 2285 | return obj.getValidators() |
| 2286 | except: |
| 2287 | return None |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 2288 | class Meta: |
| 2289 | model = SliceTag |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 2290 | 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] | 2291 | |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 2292 | class SliceTagIdSerializer(XOSModelSerializer): |
Scott Baker | f0480fb | 2014-12-23 11:12:07 -0800 | [diff] [blame] | 2293 | id = IdField() |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 2294 | |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 2295 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 2296 | validators = serializers.SerializerMethodField("getValidators") |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 2297 | def getHumanReadableName(self, obj):
|
| 2298 | return str(obj)
|
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 2299 | def getValidators(self, obj):
|
| 2300 | try: |
| 2301 | return obj.getValidators() |
| 2302 | except: |
| 2303 | return None
|
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 2304 | class Meta:
|
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 2305 | model = SliceTag |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 2306 | 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] | 2307 | |
| 2308 | |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 2309 | |
| 2310 | |
Scott Baker | f2c0c51 | 2014-12-22 17:35:34 -0800 | [diff] [blame] | 2311 | class NetworkTemplateSerializer(serializers.HyperlinkedModelSerializer): |
Scott Baker | f0480fb | 2014-12-23 11:12:07 -0800 | [diff] [blame] | 2312 | id = IdField() |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 2313 | |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 2314 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 2315 | validators = serializers.SerializerMethodField("getValidators") |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 2316 | def getHumanReadableName(self, obj):
|
| 2317 | return str(obj) |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 2318 | def getValidators(self, obj): |
| 2319 | try: |
| 2320 | return obj.getValidators() |
| 2321 | except: |
| 2322 | return None |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 2323 | class Meta: |
Scott Baker | f2c0c51 | 2014-12-22 17:35:34 -0800 | [diff] [blame] | 2324 | model = NetworkTemplate |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 2325 | 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] | 2326 | |
Scott Baker | f2c0c51 | 2014-12-22 17:35:34 -0800 | [diff] [blame] | 2327 | class NetworkTemplateIdSerializer(XOSModelSerializer): |
Scott Baker | f0480fb | 2014-12-23 11:12:07 -0800 | [diff] [blame] | 2328 | id = IdField() |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 2329 | |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 2330 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 2331 | validators = serializers.SerializerMethodField("getValidators") |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 2332 | def getHumanReadableName(self, obj):
|
| 2333 | return str(obj)
|
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 2334 | def getValidators(self, obj):
|
| 2335 | try: |
| 2336 | return obj.getValidators() |
| 2337 | except: |
| 2338 | return None
|
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 2339 | class Meta:
|
Scott Baker | f2c0c51 | 2014-12-22 17:35:34 -0800 | [diff] [blame] | 2340 | model = NetworkTemplate |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 2341 | 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] | 2342 | |
| 2343 | |
Sapan Bhatia | dea3943 | 2014-06-13 03:10:36 -0400 | [diff] [blame] | 2344 | |
| 2345 | |
| 2346 | class RouterSerializer(serializers.HyperlinkedModelSerializer): |
Scott Baker | f0480fb | 2014-12-23 11:12:07 -0800 | [diff] [blame] | 2347 | id = IdField() |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 2348 | |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 2349 | |
| 2350 | networks = serializers.HyperlinkedRelatedField(many=True, read_only=True, view_name='network-detail') |
| 2351 | |
| 2352 | |
| 2353 | |
| 2354 | networks = serializers.HyperlinkedRelatedField(many=True, read_only=True, view_name='network-detail') |
| 2355 | |
| 2356 | |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 2357 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 2358 | validators = serializers.SerializerMethodField("getValidators") |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 2359 | def getHumanReadableName(self, obj):
|
| 2360 | return str(obj) |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 2361 | def getValidators(self, obj): |
| 2362 | try: |
| 2363 | return obj.getValidators() |
| 2364 | except: |
| 2365 | return None |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 2366 | class Meta: |
| 2367 | model = Router |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 2368 | 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] | 2369 | |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 2370 | class RouterIdSerializer(XOSModelSerializer): |
Scott Baker | f0480fb | 2014-12-23 11:12:07 -0800 | [diff] [blame] | 2371 | id = IdField() |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 2372 | |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 2373 | |
Scott Baker | 201f7da | 2014-12-23 10:56:06 -0800 | [diff] [blame] | 2374 | networks = serializers.PrimaryKeyRelatedField(many=True, queryset = Network.objects.all()) |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 2375 | |
| 2376 | |
| 2377 | |
Scott Baker | 201f7da | 2014-12-23 10:56:06 -0800 | [diff] [blame] | 2378 | networks = serializers.PrimaryKeyRelatedField(many=True, queryset = Network.objects.all()) |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 2379 | |
| 2380 | |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 2381 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 2382 | validators = serializers.SerializerMethodField("getValidators") |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 2383 | def getHumanReadableName(self, obj):
|
| 2384 | return str(obj)
|
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 2385 | def getValidators(self, obj):
|
| 2386 | try: |
| 2387 | return obj.getValidators() |
| 2388 | except: |
| 2389 | return None
|
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 2390 | class Meta:
|
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 2391 | model = Router |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 2392 | 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] | 2393 | |
| 2394 | |
Sapan Bhatia | dea3943 | 2014-06-13 03:10:36 -0400 | [diff] [blame] | 2395 | |
| 2396 | |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 2397 | class ServiceResourceSerializer(serializers.HyperlinkedModelSerializer): |
Scott Baker | f0480fb | 2014-12-23 11:12:07 -0800 | [diff] [blame] | 2398 | id = IdField() |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 2399 | |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 2400 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 2401 | validators = serializers.SerializerMethodField("getValidators") |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 2402 | def getHumanReadableName(self, obj):
|
| 2403 | return str(obj) |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 2404 | def getValidators(self, obj): |
| 2405 | try: |
| 2406 | return obj.getValidators() |
| 2407 | except: |
| 2408 | return None |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 2409 | class Meta: |
| 2410 | model = ServiceResource |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 2411 | 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] | 2412 | |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 2413 | class ServiceResourceIdSerializer(XOSModelSerializer): |
Scott Baker | f0480fb | 2014-12-23 11:12:07 -0800 | [diff] [blame] | 2414 | id = IdField() |
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 2415 | |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 2416 | humanReadableName = serializers.SerializerMethodField("getHumanReadableName") |
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 2417 | validators = serializers.SerializerMethodField("getValidators") |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 2418 | def getHumanReadableName(self, obj):
|
| 2419 | return str(obj)
|
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 2420 | def getValidators(self, obj):
|
| 2421 | try: |
| 2422 | return obj.getValidators() |
| 2423 | except: |
| 2424 | return None
|
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 2425 | class Meta:
|
Scott Baker | 2bcbf37 | 2014-10-29 23:41:11 -0700 | [diff] [blame] | 2426 | model = ServiceResource |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 2427 | 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] | 2428 | |
| 2429 | |
Sapan Bhatia | dea3943 | 2014-06-13 03:10:36 -0400 | [diff] [blame] | 2430 | |
| 2431 | |
| 2432 | serializerLookUp = { |
| 2433 | |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 2434 | ServiceAttribute: ServiceAttributeSerializer, |
Sapan Bhatia | dea3943 | 2014-06-13 03:10:36 -0400 | [diff] [blame] | 2435 | |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 2436 | ControllerImages: ControllerImagesSerializer, |
| 2437 | |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 2438 | ControllerSitePrivilege: ControllerSitePrivilegeSerializer, |
| 2439 | |
Sapan Bhatia | dea3943 | 2014-06-13 03:10:36 -0400 | [diff] [blame] | 2440 | Image: ImageSerializer, |
| 2441 | |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 2442 | NetworkParameter: NetworkParameterSerializer, |
Sapan Bhatia | dea3943 | 2014-06-13 03:10:36 -0400 | [diff] [blame] | 2443 | |
| 2444 | Site: SiteSerializer, |
| 2445 | |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 2446 | SliceRole: SliceRoleSerializer, |
Sapan Bhatia | dea3943 | 2014-06-13 03:10:36 -0400 | [diff] [blame] | 2447 | |
| 2448 | Tag: TagSerializer, |
| 2449 | |
| 2450 | Invoice: InvoiceSerializer, |
| 2451 | |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 2452 | SlicePrivilege: SlicePrivilegeSerializer, |
Sapan Bhatia | dea3943 | 2014-06-13 03:10:36 -0400 | [diff] [blame] | 2453 | |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 2454 | PlanetStackRole: PlanetStackRoleSerializer, |
| 2455 | |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 2456 | NetworkSliver: NetworkSliverSerializer, |
Sapan Bhatia | dea3943 | 2014-06-13 03:10:36 -0400 | [diff] [blame] | 2457 | |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 2458 | Flavor: FlavorSerializer, |
| 2459 | |
| 2460 | ControllerSite: ControllerSiteSerializer, |
| 2461 | |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 2462 | Project: ProjectSerializer, |
| 2463 | |
Sapan Bhatia | dea3943 | 2014-06-13 03:10:36 -0400 | [diff] [blame] | 2464 | Slice: SliceSerializer, |
| 2465 | |
| 2466 | Network: NetworkSerializer, |
| 2467 | |
| 2468 | Service: ServiceSerializer, |
| 2469 | |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 2470 | ServiceClass: ServiceClassSerializer, |
Sapan Bhatia | dea3943 | 2014-06-13 03:10:36 -0400 | [diff] [blame] | 2471 | |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 2472 | PlanetStack: PlanetStackSerializer, |
Sapan Bhatia | dea3943 | 2014-06-13 03:10:36 -0400 | [diff] [blame] | 2473 | |
| 2474 | Charge: ChargeSerializer, |
| 2475 | |
| 2476 | Role: RoleSerializer, |
| 2477 | |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 2478 | UsableObject: UsableObjectSerializer, |
| 2479 | |
| 2480 | SiteRole: SiteRoleSerializer, |
Sapan Bhatia | dea3943 | 2014-06-13 03:10:36 -0400 | [diff] [blame] | 2481 | |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 2482 | SliceCredential: SliceCredentialSerializer, |
| 2483 | |
Sapan Bhatia | dea3943 | 2014-06-13 03:10:36 -0400 | [diff] [blame] | 2484 | Sliver: SliverSerializer, |
| 2485 | |
| 2486 | Node: NodeSerializer, |
| 2487 | |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 2488 | DashboardView: DashboardViewSerializer, |
Sapan Bhatia | dea3943 | 2014-06-13 03:10:36 -0400 | [diff] [blame] | 2489 | |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 2490 | ControllerNetwork: ControllerNetworkSerializer, |
| 2491 | |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 2492 | ImageDeployments: ImageDeploymentsSerializer, |
Sapan Bhatia | dea3943 | 2014-06-13 03:10:36 -0400 | [diff] [blame] | 2493 | |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 2494 | ControllerUser: ControllerUserSerializer, |
| 2495 | |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 2496 | ReservedResource: ReservedResourceSerializer, |
Scott Baker | 8b53319 | 2014-11-17 22:32:19 -0800 | [diff] [blame] | 2497 | |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 2498 | Payment: PaymentSerializer, |
| 2499 | |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 2500 | NetworkSlice: NetworkSliceSerializer, |
| 2501 | |
| 2502 | UserDashboardView: UserDashboardViewSerializer, |
| 2503 | |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 2504 | Controller: ControllerSerializer, |
| 2505 | |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 2506 | PlanetStackPrivilege: PlanetStackPrivilegeSerializer, |
Sapan Bhatia | dea3943 | 2014-06-13 03:10:36 -0400 | [diff] [blame] | 2507 | |
| 2508 | User: UserSerializer, |
| 2509 | |
| 2510 | Deployment: DeploymentSerializer, |
| 2511 | |
| 2512 | Reservation: ReservationSerializer, |
| 2513 | |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 2514 | SitePrivilege: SitePrivilegeSerializer, |
Sapan Bhatia | dea3943 | 2014-06-13 03:10:36 -0400 | [diff] [blame] | 2515 | |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 2516 | ControllerSlice: ControllerSliceSerializer, |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 2517 | |
Scott Baker | f2c0c51 | 2014-12-22 17:35:34 -0800 | [diff] [blame] | 2518 | ControllerDashboardView: ControllerDashboardViewSerializer, |
| 2519 | |
Sapan Bhatia | dea3943 | 2014-06-13 03:10:36 -0400 | [diff] [blame] | 2520 | Account: AccountSerializer, |
| 2521 | |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 2522 | ControllerRole: ControllerRoleSerializer, |
| 2523 | |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 2524 | NetworkParameterType: NetworkParameterTypeSerializer, |
Sapan Bhatia | dea3943 | 2014-06-13 03:10:36 -0400 | [diff] [blame] | 2525 | |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 2526 | SiteCredential: SiteCredentialSerializer, |
Sapan Bhatia | dea3943 | 2014-06-13 03:10:36 -0400 | [diff] [blame] | 2527 | |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 2528 | DeploymentPrivilege: DeploymentPrivilegeSerializer, |
Sapan Bhatia | dea3943 | 2014-06-13 03:10:36 -0400 | [diff] [blame] | 2529 | |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 2530 | ControllerSlicePrivilege: ControllerSlicePrivilegeSerializer, |
| 2531 | |
| 2532 | SiteDeployment: SiteDeploymentSerializer, |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 2533 | |
| 2534 | DeploymentRole: DeploymentRoleSerializer, |
Sapan Bhatia | dea3943 | 2014-06-13 03:10:36 -0400 | [diff] [blame] | 2535 | |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 2536 | UserCredential: UserCredentialSerializer, |
| 2537 | |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 2538 | SliceTag: SliceTagSerializer, |
Sapan Bhatia | dea3943 | 2014-06-13 03:10:36 -0400 | [diff] [blame] | 2539 | |
Scott Baker | f2c0c51 | 2014-12-22 17:35:34 -0800 | [diff] [blame] | 2540 | NetworkTemplate: NetworkTemplateSerializer, |
Sapan Bhatia | dea3943 | 2014-06-13 03:10:36 -0400 | [diff] [blame] | 2541 | |
| 2542 | Router: RouterSerializer, |
| 2543 | |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 2544 | ServiceResource: ServiceResourceSerializer, |
Sapan Bhatia | dea3943 | 2014-06-13 03:10:36 -0400 | [diff] [blame] | 2545 | |
| 2546 | None: None, |
| 2547 | } |
| 2548 | |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 2549 | class PlanetStackRetrieveUpdateDestroyAPIView(generics.RetrieveUpdateDestroyAPIView): |
| 2550 | |
| 2551 | # To handle fine-grained field permissions, we have to check can_update |
| 2552 | # the object has been updated but before it has been saved. |
| 2553 | |
| 2554 | def update(self, request, *args, **kwargs):
|
| 2555 | partial = kwargs.pop('partial', False)
|
| 2556 | self.object = self.get_object_or_none()
|
| 2557 |
|
| 2558 | serializer = self.get_serializer(self.object, data=request.DATA,
|
| 2559 | files=request.FILES, partial=partial)
|
| 2560 |
|
| 2561 | if not serializer.is_valid():
|
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 2562 | response = {"error": "validation",
|
| 2563 | "specific_error": "not serializer.is_valid()",
|
| 2564 | "reasons": serializer.errors}
|
| 2565 | return Response(response, status=status.HTTP_400_BAD_REQUEST)
|
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 2566 |
|
| 2567 | try:
|
| 2568 | self.pre_save(serializer.object)
|
| 2569 | except ValidationError as err:
|
| 2570 | # full_clean on model instance may be called in pre_save,
|
| 2571 | # so we have to handle eventual errors.
|
Scott Baker | 96eb3fd | 2014-11-25 00:53:25 -0800 | [diff] [blame] | 2572 | response = {"error": "validation",
|
| 2573 | "specific_error": "ValidationError in pre_save",
|
| 2574 | "reasons": err.message_dict}
|
| 2575 | return Response(response, status=status.HTTP_400_BAD_REQUEST)
|
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 2576 |
|
| 2577 | if serializer.object is not None:
|
| 2578 | if not serializer.object.can_update(request.user):
|
| 2579 | return Response(status=status.HTTP_400_BAD_REQUEST)
|
| 2580 |
|
| 2581 | if self.object is None:
|
Scott Baker | bd46a92 | 2015-02-03 15:02:17 -0800 | [diff] [blame] | 2582 | raise Exception("Use the List API for creating objects")
|
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 2583 |
|
| 2584 | self.object = serializer.save(force_update=True)
|
| 2585 | self.post_save(self.object, created=False)
|
| 2586 | return Response(serializer.data, status=status.HTTP_200_OK) |
| 2587 | |
| 2588 | def destroy(self, request, *args, **kwargs): |
| 2589 | obj = self.get_object() |
| 2590 | if obj.can_update(request.user): |
Scott Baker | 15af565 | 2015-02-02 14:33:08 -0800 | [diff] [blame] | 2591 | return super(PlanetStackRetrieveUpdateDestroyAPIView, self).destroy(request, *args, **kwargs) |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 2592 | else: |
| 2593 | return Response(status=status.HTTP_400_BAD_REQUEST) |
| 2594 | |
Scott Baker | 15af565 | 2015-02-02 14:33:08 -0800 | [diff] [blame] | 2595 | def handle_exception(self, exc): |
| 2596 | # REST API drops the string attached to Django's PermissionDenied |
| 2597 | # exception, and replaces it with a generic "Permission Denied" |
| 2598 | if isinstance(exc, DjangoPermissionDenied): |
| 2599 | response=Response({'detail': str(exc)}, status=status.HTTP_403_FORBIDDEN) |
| 2600 | response.exception=True |
| 2601 | return response |
| 2602 | else: |
| 2603 | return super(PlanetStackRetrieveUpdateDestroyAPIView, self).handle_exception(exc) |
| 2604 | |
| 2605 | class PlanetStackListCreateAPIView(generics.ListCreateAPIView): |
| 2606 | def handle_exception(self, exc): |
| 2607 | # REST API drops the string attached to Django's PermissionDenied |
| 2608 | # exception, and replaces it with a generic "Permission Denied" |
| 2609 | if isinstance(exc, DjangoPermissionDenied): |
| 2610 | response=Response({'detail': str(exc)}, status=status.HTTP_403_FORBIDDEN) |
| 2611 | response.exception=True |
| 2612 | return response |
| 2613 | else: |
| 2614 | return super(PlanetStackListCreateAPIView, self).handle_exception(exc) |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 2615 | |
Scott Baker | bd46a92 | 2015-02-03 15:02:17 -0800 | [diff] [blame] | 2616 | def create(self, request, *args, **kwargs): |
| 2617 | serializer = self.get_serializer(data=request.DATA, files=request.FILES) |
| 2618 | if not (serializer.is_valid()): |
| 2619 | response = {"error": "validation", |
| 2620 | "specific_error": "not serializer.is_valid()",
|
| 2621 | "reasons": serializer.errors}
|
| 2622 | return Response(response, status=status.HTTP_400_BAD_REQUEST) |
| 2623 | |
| 2624 | # now do XOS can_update permission checking |
| 2625 | |
| 2626 | obj = serializer.object |
| 2627 | obj.caller = request.user |
| 2628 | if not obj.can_update(request.user): |
| 2629 | response = {"error": "validation", |
| 2630 | "specific_error": "failed can_update",
|
| 2631 | "reasons": []}
|
| 2632 | return Response(response, status=status.HTTP_400_BAD_REQUEST) |
| 2633 | |
| 2634 | # stuff below is from generics.ListCreateAPIView |
| 2635 | |
| 2636 | if (hasattr(self, "pre_save")): |
| 2637 | # rest_framework 2.x |
| 2638 | self.pre_save(serializer.object) |
| 2639 | self.object = serializer.save(force_insert=True) |
| 2640 | self.post_save(self.object, created=True) |
| 2641 | else: |
| 2642 | # rest_framework 3.x |
| 2643 | self.perform_create(serializer) |
| 2644 | |
| 2645 | headers = self.get_success_headers(serializer.data) |
| 2646 | return Response(serializer.data, status=status.HTTP_201_CREATED,
|
| 2647 | headers=headers) |
| 2648 | |
Sapan Bhatia | dea3943 | 2014-06-13 03:10:36 -0400 | [diff] [blame] | 2649 | # Based on core/views/*.py |
| 2650 | |
| 2651 | |
Scott Baker | 15af565 | 2015-02-02 14:33:08 -0800 | [diff] [blame] | 2652 | class ServiceAttributeList(PlanetStackListCreateAPIView): |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 2653 | queryset = ServiceAttribute.objects.select_related().all() |
| 2654 | serializer_class = ServiceAttributeSerializer |
Scott Baker | 46b5854 | 2014-08-11 17:26:12 -0700 | [diff] [blame] | 2655 | id_serializer_class = ServiceAttributeIdSerializer |
| 2656 | filter_backends = (filters.DjangoFilterBackend,) |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 2657 | 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] | 2658 | |
| 2659 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 2660 | no_hyperlinks=False |
| 2661 | if hasattr(self.request,"QUERY_PARAMS"): |
| 2662 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 46b5854 | 2014-08-11 17:26:12 -0700 | [diff] [blame] | 2663 | if (no_hyperlinks): |
| 2664 | return self.id_serializer_class |
| 2665 | else: |
| 2666 | return self.serializer_class |
| 2667 | |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 2668 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 2669 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 2670 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 2671 | return ServiceAttribute.select_by_user(self.request.user) |
Sapan Bhatia | dea3943 | 2014-06-13 03:10:36 -0400 | [diff] [blame] | 2672 | |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 2673 | |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 2674 | class ServiceAttributeDetail(PlanetStackRetrieveUpdateDestroyAPIView): |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 2675 | queryset = ServiceAttribute.objects.select_related().all() |
| 2676 | serializer_class = ServiceAttributeSerializer |
Scott Baker | 46b5854 | 2014-08-11 17:26:12 -0700 | [diff] [blame] | 2677 | id_serializer_class = ServiceAttributeIdSerializer |
| 2678 | |
| 2679 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 2680 | no_hyperlinks=False |
| 2681 | if hasattr(self.request,"QUERY_PARAMS"): |
| 2682 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 46b5854 | 2014-08-11 17:26:12 -0700 | [diff] [blame] | 2683 | if (no_hyperlinks): |
| 2684 | return self.id_serializer_class |
| 2685 | else: |
| 2686 | return self.serializer_class |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 2687 | |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 2688 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 2689 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 2690 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 2691 | return ServiceAttribute.select_by_user(self.request.user) |
| 2692 | |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 2693 | # update() is handled by PlanetStackRetrieveUpdateDestroyAPIView |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 2694 | |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 2695 | # destroy() is handled by PlanetStackRetrieveUpdateDestroyAPIView |
Sapan Bhatia | dea3943 | 2014-06-13 03:10:36 -0400 | [diff] [blame] | 2696 | |
| 2697 | |
| 2698 | |
Scott Baker | 15af565 | 2015-02-02 14:33:08 -0800 | [diff] [blame] | 2699 | class ControllerImagesList(PlanetStackListCreateAPIView): |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 2700 | queryset = ControllerImages.objects.select_related().all() |
| 2701 | serializer_class = ControllerImagesSerializer |
| 2702 | id_serializer_class = ControllerImagesIdSerializer |
| 2703 | filter_backends = (filters.DjangoFilterBackend,) |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 2704 | 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] | 2705 | |
| 2706 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 2707 | no_hyperlinks=False |
| 2708 | if hasattr(self.request,"QUERY_PARAMS"): |
| 2709 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 2710 | if (no_hyperlinks): |
| 2711 | return self.id_serializer_class |
| 2712 | else: |
| 2713 | return self.serializer_class |
| 2714 | |
| 2715 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 2716 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 2717 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 2718 | return ControllerImages.select_by_user(self.request.user) |
| 2719 | |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 2720 | |
| 2721 | class ControllerImagesDetail(PlanetStackRetrieveUpdateDestroyAPIView): |
| 2722 | queryset = ControllerImages.objects.select_related().all() |
| 2723 | serializer_class = ControllerImagesSerializer |
| 2724 | id_serializer_class = ControllerImagesIdSerializer |
| 2725 | |
| 2726 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 2727 | no_hyperlinks=False |
| 2728 | if hasattr(self.request,"QUERY_PARAMS"): |
| 2729 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 2730 | if (no_hyperlinks): |
| 2731 | return self.id_serializer_class |
| 2732 | else: |
| 2733 | return self.serializer_class |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 2734 | |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 2735 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 2736 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 2737 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 2738 | return ControllerImages.select_by_user(self.request.user) |
| 2739 | |
| 2740 | # update() is handled by PlanetStackRetrieveUpdateDestroyAPIView |
| 2741 | |
| 2742 | # destroy() is handled by PlanetStackRetrieveUpdateDestroyAPIView |
| 2743 | |
| 2744 | |
| 2745 | |
Scott Baker | 15af565 | 2015-02-02 14:33:08 -0800 | [diff] [blame] | 2746 | class ControllerSitePrivilegeList(PlanetStackListCreateAPIView): |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 2747 | queryset = ControllerSitePrivilege.objects.select_related().all() |
| 2748 | serializer_class = ControllerSitePrivilegeSerializer |
| 2749 | id_serializer_class = ControllerSitePrivilegeIdSerializer |
| 2750 | filter_backends = (filters.DjangoFilterBackend,) |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 2751 | 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] | 2752 | |
| 2753 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 2754 | no_hyperlinks=False |
| 2755 | if hasattr(self.request,"QUERY_PARAMS"): |
| 2756 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 2757 | if (no_hyperlinks): |
| 2758 | return self.id_serializer_class |
| 2759 | else: |
| 2760 | return self.serializer_class |
| 2761 | |
| 2762 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 2763 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 2764 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 2765 | return ControllerSitePrivilege.select_by_user(self.request.user) |
| 2766 | |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 2767 | |
| 2768 | class ControllerSitePrivilegeDetail(PlanetStackRetrieveUpdateDestroyAPIView): |
| 2769 | queryset = ControllerSitePrivilege.objects.select_related().all() |
| 2770 | serializer_class = ControllerSitePrivilegeSerializer |
| 2771 | id_serializer_class = ControllerSitePrivilegeIdSerializer |
| 2772 | |
| 2773 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 2774 | no_hyperlinks=False |
| 2775 | if hasattr(self.request,"QUERY_PARAMS"): |
| 2776 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 2777 | if (no_hyperlinks): |
| 2778 | return self.id_serializer_class |
| 2779 | else: |
| 2780 | return self.serializer_class |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 2781 | |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 2782 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 2783 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 2784 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 2785 | return ControllerSitePrivilege.select_by_user(self.request.user) |
| 2786 | |
| 2787 | # update() is handled by PlanetStackRetrieveUpdateDestroyAPIView |
| 2788 | |
| 2789 | # destroy() is handled by PlanetStackRetrieveUpdateDestroyAPIView |
| 2790 | |
| 2791 | |
| 2792 | |
Scott Baker | 15af565 | 2015-02-02 14:33:08 -0800 | [diff] [blame] | 2793 | class ImageList(PlanetStackListCreateAPIView): |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 2794 | queryset = Image.objects.select_related().all() |
Sapan Bhatia | dea3943 | 2014-06-13 03:10:36 -0400 | [diff] [blame] | 2795 | serializer_class = ImageSerializer |
Scott Baker | 46b5854 | 2014-08-11 17:26:12 -0700 | [diff] [blame] | 2796 | id_serializer_class = ImageIdSerializer |
| 2797 | filter_backends = (filters.DjangoFilterBackend,) |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 2798 | 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] | 2799 | |
| 2800 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 2801 | no_hyperlinks=False |
| 2802 | if hasattr(self.request,"QUERY_PARAMS"): |
| 2803 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 46b5854 | 2014-08-11 17:26:12 -0700 | [diff] [blame] | 2804 | if (no_hyperlinks): |
| 2805 | return self.id_serializer_class |
| 2806 | else: |
| 2807 | return self.serializer_class |
| 2808 | |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 2809 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 2810 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 2811 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 2812 | return Image.select_by_user(self.request.user) |
| 2813 | |
Sapan Bhatia | dea3943 | 2014-06-13 03:10:36 -0400 | [diff] [blame] | 2814 | |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 2815 | class ImageDetail(PlanetStackRetrieveUpdateDestroyAPIView): |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 2816 | queryset = Image.objects.select_related().all() |
Sapan Bhatia | dea3943 | 2014-06-13 03:10:36 -0400 | [diff] [blame] | 2817 | serializer_class = ImageSerializer |
Scott Baker | 46b5854 | 2014-08-11 17:26:12 -0700 | [diff] [blame] | 2818 | id_serializer_class = ImageIdSerializer |
| 2819 | |
| 2820 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 2821 | no_hyperlinks=False |
| 2822 | if hasattr(self.request,"QUERY_PARAMS"): |
| 2823 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 46b5854 | 2014-08-11 17:26:12 -0700 | [diff] [blame] | 2824 | if (no_hyperlinks): |
| 2825 | return self.id_serializer_class |
| 2826 | else: |
| 2827 | return self.serializer_class |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 2828 | |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 2829 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 2830 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 2831 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 2832 | return Image.select_by_user(self.request.user) |
| 2833 | |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 2834 | # update() is handled by PlanetStackRetrieveUpdateDestroyAPIView |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 2835 | |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 2836 | # destroy() is handled by PlanetStackRetrieveUpdateDestroyAPIView |
Sapan Bhatia | dea3943 | 2014-06-13 03:10:36 -0400 | [diff] [blame] | 2837 | |
| 2838 | |
| 2839 | |
Scott Baker | 15af565 | 2015-02-02 14:33:08 -0800 | [diff] [blame] | 2840 | class NetworkParameterList(PlanetStackListCreateAPIView): |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 2841 | queryset = NetworkParameter.objects.select_related().all() |
| 2842 | serializer_class = NetworkParameterSerializer |
Scott Baker | 46b5854 | 2014-08-11 17:26:12 -0700 | [diff] [blame] | 2843 | id_serializer_class = NetworkParameterIdSerializer |
| 2844 | filter_backends = (filters.DjangoFilterBackend,) |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 2845 | 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] | 2846 | |
| 2847 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 2848 | no_hyperlinks=False |
| 2849 | if hasattr(self.request,"QUERY_PARAMS"): |
| 2850 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 46b5854 | 2014-08-11 17:26:12 -0700 | [diff] [blame] | 2851 | if (no_hyperlinks): |
| 2852 | return self.id_serializer_class |
| 2853 | else: |
| 2854 | return self.serializer_class |
| 2855 | |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 2856 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 2857 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 2858 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 2859 | return NetworkParameter.select_by_user(self.request.user) |
Sapan Bhatia | dea3943 | 2014-06-13 03:10:36 -0400 | [diff] [blame] | 2860 | |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 2861 | |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 2862 | class NetworkParameterDetail(PlanetStackRetrieveUpdateDestroyAPIView): |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 2863 | queryset = NetworkParameter.objects.select_related().all() |
| 2864 | serializer_class = NetworkParameterSerializer |
Scott Baker | 46b5854 | 2014-08-11 17:26:12 -0700 | [diff] [blame] | 2865 | id_serializer_class = NetworkParameterIdSerializer |
| 2866 | |
| 2867 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 2868 | no_hyperlinks=False |
| 2869 | if hasattr(self.request,"QUERY_PARAMS"): |
| 2870 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 46b5854 | 2014-08-11 17:26:12 -0700 | [diff] [blame] | 2871 | if (no_hyperlinks): |
| 2872 | return self.id_serializer_class |
| 2873 | else: |
| 2874 | return self.serializer_class |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 2875 | |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 2876 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 2877 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 2878 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 2879 | return NetworkParameter.select_by_user(self.request.user) |
| 2880 | |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 2881 | # update() is handled by PlanetStackRetrieveUpdateDestroyAPIView |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 2882 | |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 2883 | # destroy() is handled by PlanetStackRetrieveUpdateDestroyAPIView |
Sapan Bhatia | dea3943 | 2014-06-13 03:10:36 -0400 | [diff] [blame] | 2884 | |
| 2885 | |
| 2886 | |
Scott Baker | 15af565 | 2015-02-02 14:33:08 -0800 | [diff] [blame] | 2887 | class SiteList(PlanetStackListCreateAPIView): |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 2888 | queryset = Site.objects.select_related().all() |
Sapan Bhatia | dea3943 | 2014-06-13 03:10:36 -0400 | [diff] [blame] | 2889 | serializer_class = SiteSerializer |
Scott Baker | 46b5854 | 2014-08-11 17:26:12 -0700 | [diff] [blame] | 2890 | id_serializer_class = SiteIdSerializer |
| 2891 | filter_backends = (filters.DjangoFilterBackend,) |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 2892 | 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] | 2893 | |
| 2894 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 2895 | no_hyperlinks=False |
| 2896 | if hasattr(self.request,"QUERY_PARAMS"): |
| 2897 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 46b5854 | 2014-08-11 17:26:12 -0700 | [diff] [blame] | 2898 | if (no_hyperlinks): |
| 2899 | return self.id_serializer_class |
| 2900 | else: |
| 2901 | return self.serializer_class |
| 2902 | |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 2903 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 2904 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 2905 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 2906 | return Site.select_by_user(self.request.user) |
| 2907 | |
Sapan Bhatia | dea3943 | 2014-06-13 03:10:36 -0400 | [diff] [blame] | 2908 | |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 2909 | class SiteDetail(PlanetStackRetrieveUpdateDestroyAPIView): |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 2910 | queryset = Site.objects.select_related().all() |
Sapan Bhatia | dea3943 | 2014-06-13 03:10:36 -0400 | [diff] [blame] | 2911 | serializer_class = SiteSerializer |
Scott Baker | 46b5854 | 2014-08-11 17:26:12 -0700 | [diff] [blame] | 2912 | id_serializer_class = SiteIdSerializer |
| 2913 | |
| 2914 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 2915 | no_hyperlinks=False |
| 2916 | if hasattr(self.request,"QUERY_PARAMS"): |
| 2917 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 46b5854 | 2014-08-11 17:26:12 -0700 | [diff] [blame] | 2918 | if (no_hyperlinks): |
| 2919 | return self.id_serializer_class |
| 2920 | else: |
| 2921 | return self.serializer_class |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 2922 | |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 2923 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 2924 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 2925 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 2926 | return Site.select_by_user(self.request.user) |
Sapan Bhatia | dea3943 | 2014-06-13 03:10:36 -0400 | [diff] [blame] | 2927 | |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 2928 | # update() is handled by PlanetStackRetrieveUpdateDestroyAPIView |
Sapan Bhatia | dea3943 | 2014-06-13 03:10:36 -0400 | [diff] [blame] | 2929 | |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 2930 | # destroy() is handled by PlanetStackRetrieveUpdateDestroyAPIView |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 2931 | |
| 2932 | |
| 2933 | |
Scott Baker | 15af565 | 2015-02-02 14:33:08 -0800 | [diff] [blame] | 2934 | class SliceRoleList(PlanetStackListCreateAPIView): |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 2935 | queryset = SliceRole.objects.select_related().all() |
| 2936 | serializer_class = SliceRoleSerializer |
Scott Baker | 46b5854 | 2014-08-11 17:26:12 -0700 | [diff] [blame] | 2937 | id_serializer_class = SliceRoleIdSerializer |
| 2938 | filter_backends = (filters.DjangoFilterBackend,) |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 2939 | 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] | 2940 | |
| 2941 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 2942 | no_hyperlinks=False |
| 2943 | if hasattr(self.request,"QUERY_PARAMS"): |
| 2944 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 46b5854 | 2014-08-11 17:26:12 -0700 | [diff] [blame] | 2945 | if (no_hyperlinks): |
| 2946 | return self.id_serializer_class |
| 2947 | else: |
| 2948 | return self.serializer_class |
| 2949 | |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 2950 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 2951 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 2952 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 2953 | return SliceRole.select_by_user(self.request.user) |
| 2954 | |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 2955 | |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 2956 | class SliceRoleDetail(PlanetStackRetrieveUpdateDestroyAPIView): |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 2957 | queryset = SliceRole.objects.select_related().all() |
| 2958 | serializer_class = SliceRoleSerializer |
Scott Baker | 46b5854 | 2014-08-11 17:26:12 -0700 | [diff] [blame] | 2959 | id_serializer_class = SliceRoleIdSerializer |
| 2960 | |
| 2961 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 2962 | no_hyperlinks=False |
| 2963 | if hasattr(self.request,"QUERY_PARAMS"): |
| 2964 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 46b5854 | 2014-08-11 17:26:12 -0700 | [diff] [blame] | 2965 | if (no_hyperlinks): |
| 2966 | return self.id_serializer_class |
| 2967 | else: |
| 2968 | return self.serializer_class |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 2969 | |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 2970 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 2971 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 2972 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 2973 | return SliceRole.select_by_user(self.request.user) |
| 2974 | |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 2975 | # update() is handled by PlanetStackRetrieveUpdateDestroyAPIView |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 2976 | |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 2977 | # destroy() is handled by PlanetStackRetrieveUpdateDestroyAPIView |
Sapan Bhatia | dea3943 | 2014-06-13 03:10:36 -0400 | [diff] [blame] | 2978 | |
| 2979 | |
| 2980 | |
Scott Baker | 15af565 | 2015-02-02 14:33:08 -0800 | [diff] [blame] | 2981 | class TagList(PlanetStackListCreateAPIView): |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 2982 | queryset = Tag.objects.select_related().all() |
Sapan Bhatia | dea3943 | 2014-06-13 03:10:36 -0400 | [diff] [blame] | 2983 | serializer_class = TagSerializer |
Scott Baker | 46b5854 | 2014-08-11 17:26:12 -0700 | [diff] [blame] | 2984 | id_serializer_class = TagIdSerializer |
| 2985 | filter_backends = (filters.DjangoFilterBackend,) |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 2986 | 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] | 2987 | |
| 2988 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 2989 | no_hyperlinks=False |
| 2990 | if hasattr(self.request,"QUERY_PARAMS"): |
| 2991 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 46b5854 | 2014-08-11 17:26:12 -0700 | [diff] [blame] | 2992 | if (no_hyperlinks): |
| 2993 | return self.id_serializer_class |
| 2994 | else: |
| 2995 | return self.serializer_class |
| 2996 | |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 2997 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 2998 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 2999 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 3000 | return Tag.select_by_user(self.request.user) |
| 3001 | |
Sapan Bhatia | dea3943 | 2014-06-13 03:10:36 -0400 | [diff] [blame] | 3002 | |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3003 | class TagDetail(PlanetStackRetrieveUpdateDestroyAPIView): |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 3004 | queryset = Tag.objects.select_related().all() |
Sapan Bhatia | dea3943 | 2014-06-13 03:10:36 -0400 | [diff] [blame] | 3005 | serializer_class = TagSerializer |
Scott Baker | 46b5854 | 2014-08-11 17:26:12 -0700 | [diff] [blame] | 3006 | id_serializer_class = TagIdSerializer |
| 3007 | |
| 3008 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 3009 | no_hyperlinks=False |
| 3010 | if hasattr(self.request,"QUERY_PARAMS"): |
| 3011 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 46b5854 | 2014-08-11 17:26:12 -0700 | [diff] [blame] | 3012 | if (no_hyperlinks): |
| 3013 | return self.id_serializer_class |
| 3014 | else: |
| 3015 | return self.serializer_class |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 3016 | |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 3017 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 3018 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 3019 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 3020 | return Tag.select_by_user(self.request.user) |
| 3021 | |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3022 | # update() is handled by PlanetStackRetrieveUpdateDestroyAPIView |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 3023 | |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3024 | # destroy() is handled by PlanetStackRetrieveUpdateDestroyAPIView |
Sapan Bhatia | dea3943 | 2014-06-13 03:10:36 -0400 | [diff] [blame] | 3025 | |
| 3026 | |
| 3027 | |
Scott Baker | 15af565 | 2015-02-02 14:33:08 -0800 | [diff] [blame] | 3028 | class InvoiceList(PlanetStackListCreateAPIView): |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 3029 | queryset = Invoice.objects.select_related().all() |
Sapan Bhatia | dea3943 | 2014-06-13 03:10:36 -0400 | [diff] [blame] | 3030 | serializer_class = InvoiceSerializer |
Scott Baker | 46b5854 | 2014-08-11 17:26:12 -0700 | [diff] [blame] | 3031 | id_serializer_class = InvoiceIdSerializer |
| 3032 | filter_backends = (filters.DjangoFilterBackend,) |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 3033 | 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] | 3034 | |
| 3035 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 3036 | no_hyperlinks=False |
| 3037 | if hasattr(self.request,"QUERY_PARAMS"): |
| 3038 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 46b5854 | 2014-08-11 17:26:12 -0700 | [diff] [blame] | 3039 | if (no_hyperlinks): |
| 3040 | return self.id_serializer_class |
| 3041 | else: |
| 3042 | return self.serializer_class |
| 3043 | |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 3044 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 3045 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 3046 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 3047 | return Invoice.select_by_user(self.request.user) |
| 3048 | |
Sapan Bhatia | dea3943 | 2014-06-13 03:10:36 -0400 | [diff] [blame] | 3049 | |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3050 | class InvoiceDetail(PlanetStackRetrieveUpdateDestroyAPIView): |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 3051 | queryset = Invoice.objects.select_related().all() |
Sapan Bhatia | dea3943 | 2014-06-13 03:10:36 -0400 | [diff] [blame] | 3052 | serializer_class = InvoiceSerializer |
Scott Baker | 46b5854 | 2014-08-11 17:26:12 -0700 | [diff] [blame] | 3053 | id_serializer_class = InvoiceIdSerializer |
| 3054 | |
| 3055 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 3056 | no_hyperlinks=False |
| 3057 | if hasattr(self.request,"QUERY_PARAMS"): |
| 3058 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 46b5854 | 2014-08-11 17:26:12 -0700 | [diff] [blame] | 3059 | if (no_hyperlinks): |
| 3060 | return self.id_serializer_class |
| 3061 | else: |
| 3062 | return self.serializer_class |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 3063 | |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 3064 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 3065 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 3066 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 3067 | return Invoice.select_by_user(self.request.user) |
| 3068 | |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3069 | # update() is handled by PlanetStackRetrieveUpdateDestroyAPIView |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 3070 | |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3071 | # destroy() is handled by PlanetStackRetrieveUpdateDestroyAPIView |
Sapan Bhatia | dea3943 | 2014-06-13 03:10:36 -0400 | [diff] [blame] | 3072 | |
| 3073 | |
| 3074 | |
Scott Baker | 15af565 | 2015-02-02 14:33:08 -0800 | [diff] [blame] | 3075 | class SlicePrivilegeList(PlanetStackListCreateAPIView): |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 3076 | queryset = SlicePrivilege.objects.select_related().all() |
| 3077 | serializer_class = SlicePrivilegeSerializer |
Scott Baker | 46b5854 | 2014-08-11 17:26:12 -0700 | [diff] [blame] | 3078 | id_serializer_class = SlicePrivilegeIdSerializer |
| 3079 | filter_backends = (filters.DjangoFilterBackend,) |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 3080 | 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] | 3081 | |
| 3082 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 3083 | no_hyperlinks=False |
| 3084 | if hasattr(self.request,"QUERY_PARAMS"): |
| 3085 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 46b5854 | 2014-08-11 17:26:12 -0700 | [diff] [blame] | 3086 | if (no_hyperlinks): |
| 3087 | return self.id_serializer_class |
| 3088 | else: |
| 3089 | return self.serializer_class |
| 3090 | |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 3091 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 3092 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 3093 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 3094 | return SlicePrivilege.select_by_user(self.request.user) |
Sapan Bhatia | dea3943 | 2014-06-13 03:10:36 -0400 | [diff] [blame] | 3095 | |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 3096 | |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3097 | class SlicePrivilegeDetail(PlanetStackRetrieveUpdateDestroyAPIView): |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 3098 | queryset = SlicePrivilege.objects.select_related().all() |
| 3099 | serializer_class = SlicePrivilegeSerializer |
Scott Baker | 46b5854 | 2014-08-11 17:26:12 -0700 | [diff] [blame] | 3100 | id_serializer_class = SlicePrivilegeIdSerializer |
| 3101 | |
| 3102 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 3103 | no_hyperlinks=False |
| 3104 | if hasattr(self.request,"QUERY_PARAMS"): |
| 3105 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 46b5854 | 2014-08-11 17:26:12 -0700 | [diff] [blame] | 3106 | if (no_hyperlinks): |
| 3107 | return self.id_serializer_class |
| 3108 | else: |
| 3109 | return self.serializer_class |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 3110 | |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 3111 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 3112 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 3113 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 3114 | return SlicePrivilege.select_by_user(self.request.user) |
| 3115 | |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3116 | # update() is handled by PlanetStackRetrieveUpdateDestroyAPIView |
| 3117 | |
| 3118 | # destroy() is handled by PlanetStackRetrieveUpdateDestroyAPIView |
| 3119 | |
| 3120 | |
| 3121 | |
Scott Baker | 15af565 | 2015-02-02 14:33:08 -0800 | [diff] [blame] | 3122 | class PlanetStackRoleList(PlanetStackListCreateAPIView): |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3123 | queryset = PlanetStackRole.objects.select_related().all() |
| 3124 | serializer_class = PlanetStackRoleSerializer |
| 3125 | id_serializer_class = PlanetStackRoleIdSerializer |
| 3126 | filter_backends = (filters.DjangoFilterBackend,) |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 3127 | 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] | 3128 | |
| 3129 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 3130 | no_hyperlinks=False |
| 3131 | if hasattr(self.request,"QUERY_PARAMS"): |
| 3132 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3133 | if (no_hyperlinks): |
| 3134 | return self.id_serializer_class |
| 3135 | else: |
| 3136 | return self.serializer_class |
| 3137 | |
| 3138 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 3139 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 3140 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3141 | return PlanetStackRole.select_by_user(self.request.user) |
| 3142 | |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 3143 | |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3144 | class PlanetStackRoleDetail(PlanetStackRetrieveUpdateDestroyAPIView): |
| 3145 | queryset = PlanetStackRole.objects.select_related().all() |
| 3146 | serializer_class = PlanetStackRoleSerializer |
| 3147 | id_serializer_class = PlanetStackRoleIdSerializer |
| 3148 | |
| 3149 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 3150 | no_hyperlinks=False |
| 3151 | if hasattr(self.request,"QUERY_PARAMS"): |
| 3152 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3153 | if (no_hyperlinks): |
| 3154 | return self.id_serializer_class |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 3155 | else: |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3156 | return self.serializer_class |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 3157 | |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3158 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 3159 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 3160 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3161 | return PlanetStackRole.select_by_user(self.request.user) |
| 3162 | |
| 3163 | # update() is handled by PlanetStackRetrieveUpdateDestroyAPIView |
| 3164 | |
| 3165 | # destroy() is handled by PlanetStackRetrieveUpdateDestroyAPIView |
Sapan Bhatia | dea3943 | 2014-06-13 03:10:36 -0400 | [diff] [blame] | 3166 | |
| 3167 | |
| 3168 | |
Scott Baker | 15af565 | 2015-02-02 14:33:08 -0800 | [diff] [blame] | 3169 | class NetworkSliverList(PlanetStackListCreateAPIView): |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 3170 | queryset = NetworkSliver.objects.select_related().all() |
| 3171 | serializer_class = NetworkSliverSerializer |
Scott Baker | 46b5854 | 2014-08-11 17:26:12 -0700 | [diff] [blame] | 3172 | id_serializer_class = NetworkSliverIdSerializer |
| 3173 | filter_backends = (filters.DjangoFilterBackend,) |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 3174 | 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] | 3175 | |
| 3176 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 3177 | no_hyperlinks=False |
| 3178 | if hasattr(self.request,"QUERY_PARAMS"): |
| 3179 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 46b5854 | 2014-08-11 17:26:12 -0700 | [diff] [blame] | 3180 | if (no_hyperlinks): |
| 3181 | return self.id_serializer_class |
| 3182 | else: |
| 3183 | return self.serializer_class |
| 3184 | |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 3185 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 3186 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 3187 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 3188 | return NetworkSliver.select_by_user(self.request.user) |
Sapan Bhatia | dea3943 | 2014-06-13 03:10:36 -0400 | [diff] [blame] | 3189 | |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 3190 | |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3191 | class NetworkSliverDetail(PlanetStackRetrieveUpdateDestroyAPIView): |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 3192 | queryset = NetworkSliver.objects.select_related().all() |
| 3193 | serializer_class = NetworkSliverSerializer |
Scott Baker | 46b5854 | 2014-08-11 17:26:12 -0700 | [diff] [blame] | 3194 | id_serializer_class = NetworkSliverIdSerializer |
| 3195 | |
| 3196 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 3197 | no_hyperlinks=False |
| 3198 | if hasattr(self.request,"QUERY_PARAMS"): |
| 3199 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 46b5854 | 2014-08-11 17:26:12 -0700 | [diff] [blame] | 3200 | if (no_hyperlinks): |
| 3201 | return self.id_serializer_class |
| 3202 | else: |
| 3203 | return self.serializer_class |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 3204 | |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 3205 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 3206 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 3207 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 3208 | return NetworkSliver.select_by_user(self.request.user) |
| 3209 | |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3210 | # update() is handled by PlanetStackRetrieveUpdateDestroyAPIView |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 3211 | |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3212 | # destroy() is handled by PlanetStackRetrieveUpdateDestroyAPIView |
Sapan Bhatia | dea3943 | 2014-06-13 03:10:36 -0400 | [diff] [blame] | 3213 | |
| 3214 | |
| 3215 | |
Scott Baker | 15af565 | 2015-02-02 14:33:08 -0800 | [diff] [blame] | 3216 | class FlavorList(PlanetStackListCreateAPIView): |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 3217 | queryset = Flavor.objects.select_related().all() |
| 3218 | serializer_class = FlavorSerializer |
| 3219 | id_serializer_class = FlavorIdSerializer |
| 3220 | filter_backends = (filters.DjangoFilterBackend,) |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 3221 | 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] | 3222 | |
| 3223 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 3224 | no_hyperlinks=False |
| 3225 | if hasattr(self.request,"QUERY_PARAMS"): |
| 3226 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 3227 | if (no_hyperlinks): |
| 3228 | return self.id_serializer_class |
| 3229 | else: |
| 3230 | return self.serializer_class |
| 3231 | |
| 3232 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 3233 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 3234 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 3235 | return Flavor.select_by_user(self.request.user) |
| 3236 | |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 3237 | |
| 3238 | class FlavorDetail(PlanetStackRetrieveUpdateDestroyAPIView): |
| 3239 | queryset = Flavor.objects.select_related().all() |
| 3240 | serializer_class = FlavorSerializer |
| 3241 | id_serializer_class = FlavorIdSerializer |
| 3242 | |
| 3243 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 3244 | no_hyperlinks=False |
| 3245 | if hasattr(self.request,"QUERY_PARAMS"): |
| 3246 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 3247 | if (no_hyperlinks): |
| 3248 | return self.id_serializer_class |
| 3249 | else: |
| 3250 | return self.serializer_class |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 3251 | |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 3252 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 3253 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 3254 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 3255 | return Flavor.select_by_user(self.request.user) |
| 3256 | |
| 3257 | # update() is handled by PlanetStackRetrieveUpdateDestroyAPIView |
| 3258 | |
| 3259 | # destroy() is handled by PlanetStackRetrieveUpdateDestroyAPIView |
| 3260 | |
| 3261 | |
| 3262 | |
Scott Baker | 15af565 | 2015-02-02 14:33:08 -0800 | [diff] [blame] | 3263 | class ControllerSiteList(PlanetStackListCreateAPIView): |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 3264 | queryset = ControllerSite.objects.select_related().all() |
| 3265 | serializer_class = ControllerSiteSerializer |
| 3266 | id_serializer_class = ControllerSiteIdSerializer |
| 3267 | filter_backends = (filters.DjangoFilterBackend,) |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 3268 | 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] | 3269 | |
| 3270 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 3271 | no_hyperlinks=False |
| 3272 | if hasattr(self.request,"QUERY_PARAMS"): |
| 3273 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 3274 | if (no_hyperlinks): |
| 3275 | return self.id_serializer_class |
| 3276 | else: |
| 3277 | return self.serializer_class |
| 3278 | |
| 3279 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 3280 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 3281 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 3282 | return ControllerSite.select_by_user(self.request.user) |
| 3283 | |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 3284 | |
| 3285 | class ControllerSiteDetail(PlanetStackRetrieveUpdateDestroyAPIView): |
| 3286 | queryset = ControllerSite.objects.select_related().all() |
| 3287 | serializer_class = ControllerSiteSerializer |
| 3288 | id_serializer_class = ControllerSiteIdSerializer |
| 3289 | |
| 3290 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 3291 | no_hyperlinks=False |
| 3292 | if hasattr(self.request,"QUERY_PARAMS"): |
| 3293 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 3294 | if (no_hyperlinks): |
| 3295 | return self.id_serializer_class |
| 3296 | else: |
| 3297 | return self.serializer_class |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 3298 | |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 3299 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 3300 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 3301 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 3302 | return ControllerSite.select_by_user(self.request.user) |
| 3303 | |
| 3304 | # update() is handled by PlanetStackRetrieveUpdateDestroyAPIView |
| 3305 | |
| 3306 | # destroy() is handled by PlanetStackRetrieveUpdateDestroyAPIView |
| 3307 | |
| 3308 | |
| 3309 | |
Scott Baker | 15af565 | 2015-02-02 14:33:08 -0800 | [diff] [blame] | 3310 | class ProjectList(PlanetStackListCreateAPIView): |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 3311 | queryset = Project.objects.select_related().all() |
| 3312 | serializer_class = ProjectSerializer |
Scott Baker | 46b5854 | 2014-08-11 17:26:12 -0700 | [diff] [blame] | 3313 | id_serializer_class = ProjectIdSerializer |
| 3314 | filter_backends = (filters.DjangoFilterBackend,) |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 3315 | 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] | 3316 | |
| 3317 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 3318 | no_hyperlinks=False |
| 3319 | if hasattr(self.request,"QUERY_PARAMS"): |
| 3320 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 46b5854 | 2014-08-11 17:26:12 -0700 | [diff] [blame] | 3321 | if (no_hyperlinks): |
| 3322 | return self.id_serializer_class |
| 3323 | else: |
| 3324 | return self.serializer_class |
| 3325 | |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 3326 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 3327 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 3328 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 3329 | return Project.select_by_user(self.request.user) |
Sapan Bhatia | dea3943 | 2014-06-13 03:10:36 -0400 | [diff] [blame] | 3330 | |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 3331 | |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3332 | class ProjectDetail(PlanetStackRetrieveUpdateDestroyAPIView): |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 3333 | queryset = Project.objects.select_related().all() |
| 3334 | serializer_class = ProjectSerializer |
Scott Baker | 46b5854 | 2014-08-11 17:26:12 -0700 | [diff] [blame] | 3335 | id_serializer_class = ProjectIdSerializer |
| 3336 | |
| 3337 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 3338 | no_hyperlinks=False |
| 3339 | if hasattr(self.request,"QUERY_PARAMS"): |
| 3340 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 46b5854 | 2014-08-11 17:26:12 -0700 | [diff] [blame] | 3341 | if (no_hyperlinks): |
| 3342 | return self.id_serializer_class |
| 3343 | else: |
| 3344 | return self.serializer_class |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 3345 | |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 3346 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 3347 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 3348 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 3349 | return Project.select_by_user(self.request.user) |
| 3350 | |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3351 | # update() is handled by PlanetStackRetrieveUpdateDestroyAPIView |
| 3352 | |
| 3353 | # destroy() is handled by PlanetStackRetrieveUpdateDestroyAPIView |
| 3354 | |
| 3355 | |
| 3356 | |
Scott Baker | 15af565 | 2015-02-02 14:33:08 -0800 | [diff] [blame] | 3357 | class SliceList(PlanetStackListCreateAPIView): |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3358 | queryset = Slice.objects.select_related().all() |
| 3359 | serializer_class = SliceSerializer |
| 3360 | id_serializer_class = SliceIdSerializer |
| 3361 | filter_backends = (filters.DjangoFilterBackend,) |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 3362 | 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] | 3363 | |
| 3364 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 3365 | no_hyperlinks=False |
| 3366 | if hasattr(self.request,"QUERY_PARAMS"): |
| 3367 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3368 | if (no_hyperlinks): |
| 3369 | return self.id_serializer_class |
| 3370 | else: |
| 3371 | return self.serializer_class |
| 3372 | |
| 3373 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 3374 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 3375 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3376 | return Slice.select_by_user(self.request.user) |
| 3377 | |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 3378 | |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3379 | class SliceDetail(PlanetStackRetrieveUpdateDestroyAPIView): |
| 3380 | queryset = Slice.objects.select_related().all() |
| 3381 | serializer_class = SliceSerializer |
| 3382 | id_serializer_class = SliceIdSerializer |
| 3383 | |
| 3384 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 3385 | no_hyperlinks=False |
| 3386 | if hasattr(self.request,"QUERY_PARAMS"): |
| 3387 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3388 | if (no_hyperlinks): |
| 3389 | return self.id_serializer_class |
| 3390 | else: |
| 3391 | return self.serializer_class |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 3392 | |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3393 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 3394 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 3395 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3396 | return Slice.select_by_user(self.request.user) |
| 3397 | |
| 3398 | # update() is handled by PlanetStackRetrieveUpdateDestroyAPIView |
| 3399 | |
| 3400 | # destroy() is handled by PlanetStackRetrieveUpdateDestroyAPIView |
| 3401 | |
| 3402 | |
| 3403 | |
Scott Baker | 15af565 | 2015-02-02 14:33:08 -0800 | [diff] [blame] | 3404 | class NetworkList(PlanetStackListCreateAPIView): |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3405 | queryset = Network.objects.select_related().all() |
| 3406 | serializer_class = NetworkSerializer |
| 3407 | id_serializer_class = NetworkIdSerializer |
| 3408 | filter_backends = (filters.DjangoFilterBackend,) |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 3409 | 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] | 3410 | |
| 3411 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 3412 | no_hyperlinks=False |
| 3413 | if hasattr(self.request,"QUERY_PARAMS"): |
| 3414 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3415 | if (no_hyperlinks): |
| 3416 | return self.id_serializer_class |
| 3417 | else: |
| 3418 | return self.serializer_class |
| 3419 | |
| 3420 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 3421 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 3422 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3423 | return Network.select_by_user(self.request.user) |
| 3424 | |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3425 | |
| 3426 | class NetworkDetail(PlanetStackRetrieveUpdateDestroyAPIView): |
| 3427 | queryset = Network.objects.select_related().all() |
| 3428 | serializer_class = NetworkSerializer |
| 3429 | id_serializer_class = NetworkIdSerializer |
| 3430 | |
| 3431 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 3432 | no_hyperlinks=False |
| 3433 | if hasattr(self.request,"QUERY_PARAMS"): |
| 3434 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3435 | if (no_hyperlinks): |
| 3436 | return self.id_serializer_class |
| 3437 | else: |
| 3438 | return self.serializer_class |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 3439 | |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3440 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 3441 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 3442 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3443 | return Network.select_by_user(self.request.user) |
| 3444 | |
| 3445 | # update() is handled by PlanetStackRetrieveUpdateDestroyAPIView |
| 3446 | |
| 3447 | # destroy() is handled by PlanetStackRetrieveUpdateDestroyAPIView |
| 3448 | |
| 3449 | |
| 3450 | |
Scott Baker | 15af565 | 2015-02-02 14:33:08 -0800 | [diff] [blame] | 3451 | class ServiceList(PlanetStackListCreateAPIView): |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3452 | queryset = Service.objects.select_related().all() |
| 3453 | serializer_class = ServiceSerializer |
| 3454 | id_serializer_class = ServiceIdSerializer |
| 3455 | filter_backends = (filters.DjangoFilterBackend,) |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 3456 | 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] | 3457 | |
| 3458 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 3459 | no_hyperlinks=False |
| 3460 | if hasattr(self.request,"QUERY_PARAMS"): |
| 3461 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3462 | if (no_hyperlinks): |
| 3463 | return self.id_serializer_class |
| 3464 | else: |
| 3465 | return self.serializer_class |
| 3466 | |
| 3467 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 3468 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 3469 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3470 | return Service.select_by_user(self.request.user) |
| 3471 | |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3472 | |
| 3473 | class ServiceDetail(PlanetStackRetrieveUpdateDestroyAPIView): |
| 3474 | queryset = Service.objects.select_related().all() |
| 3475 | serializer_class = ServiceSerializer |
| 3476 | id_serializer_class = ServiceIdSerializer |
| 3477 | |
| 3478 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 3479 | no_hyperlinks=False |
| 3480 | if hasattr(self.request,"QUERY_PARAMS"): |
| 3481 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3482 | if (no_hyperlinks): |
| 3483 | return self.id_serializer_class |
| 3484 | else: |
| 3485 | return self.serializer_class |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 3486 | |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3487 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 3488 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 3489 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3490 | return Service.select_by_user(self.request.user) |
| 3491 | |
| 3492 | # update() is handled by PlanetStackRetrieveUpdateDestroyAPIView |
| 3493 | |
| 3494 | # destroy() is handled by PlanetStackRetrieveUpdateDestroyAPIView |
| 3495 | |
| 3496 | |
| 3497 | |
Scott Baker | 15af565 | 2015-02-02 14:33:08 -0800 | [diff] [blame] | 3498 | class ServiceClassList(PlanetStackListCreateAPIView): |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3499 | queryset = ServiceClass.objects.select_related().all() |
| 3500 | serializer_class = ServiceClassSerializer |
| 3501 | id_serializer_class = ServiceClassIdSerializer |
| 3502 | filter_backends = (filters.DjangoFilterBackend,) |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 3503 | 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] | 3504 | |
| 3505 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 3506 | no_hyperlinks=False |
| 3507 | if hasattr(self.request,"QUERY_PARAMS"): |
| 3508 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3509 | if (no_hyperlinks): |
| 3510 | return self.id_serializer_class |
| 3511 | else: |
| 3512 | return self.serializer_class |
| 3513 | |
| 3514 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 3515 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 3516 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3517 | return ServiceClass.select_by_user(self.request.user) |
| 3518 | |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3519 | |
| 3520 | class ServiceClassDetail(PlanetStackRetrieveUpdateDestroyAPIView): |
| 3521 | queryset = ServiceClass.objects.select_related().all() |
| 3522 | serializer_class = ServiceClassSerializer |
| 3523 | id_serializer_class = ServiceClassIdSerializer |
| 3524 | |
| 3525 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 3526 | no_hyperlinks=False |
| 3527 | if hasattr(self.request,"QUERY_PARAMS"): |
| 3528 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3529 | if (no_hyperlinks): |
| 3530 | return self.id_serializer_class |
| 3531 | else: |
| 3532 | return self.serializer_class |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 3533 | |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3534 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 3535 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 3536 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3537 | return ServiceClass.select_by_user(self.request.user) |
| 3538 | |
| 3539 | # update() is handled by PlanetStackRetrieveUpdateDestroyAPIView |
| 3540 | |
| 3541 | # destroy() is handled by PlanetStackRetrieveUpdateDestroyAPIView |
| 3542 | |
| 3543 | |
| 3544 | |
Scott Baker | 15af565 | 2015-02-02 14:33:08 -0800 | [diff] [blame] | 3545 | class PlanetStackList(PlanetStackListCreateAPIView): |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 3546 | queryset = PlanetStack.objects.select_related().all() |
| 3547 | serializer_class = PlanetStackSerializer |
| 3548 | id_serializer_class = PlanetStackIdSerializer |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3549 | filter_backends = (filters.DjangoFilterBackend,) |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 3550 | 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] | 3551 | |
| 3552 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 3553 | no_hyperlinks=False |
| 3554 | if hasattr(self.request,"QUERY_PARAMS"): |
| 3555 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3556 | if (no_hyperlinks): |
| 3557 | return self.id_serializer_class |
| 3558 | else: |
| 3559 | return self.serializer_class |
| 3560 | |
| 3561 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 3562 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 3563 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 3564 | return PlanetStack.select_by_user(self.request.user) |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3565 | |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3566 | |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 3567 | class PlanetStackDetail(PlanetStackRetrieveUpdateDestroyAPIView): |
| 3568 | queryset = PlanetStack.objects.select_related().all() |
| 3569 | serializer_class = PlanetStackSerializer |
| 3570 | id_serializer_class = PlanetStackIdSerializer |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3571 | |
| 3572 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 3573 | no_hyperlinks=False |
| 3574 | if hasattr(self.request,"QUERY_PARAMS"): |
| 3575 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3576 | if (no_hyperlinks): |
| 3577 | return self.id_serializer_class |
| 3578 | else: |
| 3579 | return self.serializer_class |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 3580 | |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3581 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 3582 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 3583 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 3584 | return PlanetStack.select_by_user(self.request.user) |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3585 | |
| 3586 | # update() is handled by PlanetStackRetrieveUpdateDestroyAPIView |
| 3587 | |
| 3588 | # destroy() is handled by PlanetStackRetrieveUpdateDestroyAPIView |
| 3589 | |
| 3590 | |
| 3591 | |
Scott Baker | 15af565 | 2015-02-02 14:33:08 -0800 | [diff] [blame] | 3592 | class ChargeList(PlanetStackListCreateAPIView): |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3593 | queryset = Charge.objects.select_related().all() |
| 3594 | serializer_class = ChargeSerializer |
| 3595 | id_serializer_class = ChargeIdSerializer |
| 3596 | filter_backends = (filters.DjangoFilterBackend,) |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 3597 | 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] | 3598 | |
| 3599 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 3600 | no_hyperlinks=False |
| 3601 | if hasattr(self.request,"QUERY_PARAMS"): |
| 3602 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3603 | if (no_hyperlinks): |
| 3604 | return self.id_serializer_class |
| 3605 | else: |
| 3606 | return self.serializer_class |
| 3607 | |
| 3608 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 3609 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 3610 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3611 | return Charge.select_by_user(self.request.user) |
| 3612 | |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3613 | |
| 3614 | class ChargeDetail(PlanetStackRetrieveUpdateDestroyAPIView): |
| 3615 | queryset = Charge.objects.select_related().all() |
| 3616 | serializer_class = ChargeSerializer |
| 3617 | id_serializer_class = ChargeIdSerializer |
| 3618 | |
| 3619 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 3620 | no_hyperlinks=False |
| 3621 | if hasattr(self.request,"QUERY_PARAMS"): |
| 3622 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3623 | if (no_hyperlinks): |
| 3624 | return self.id_serializer_class |
| 3625 | else: |
| 3626 | return self.serializer_class |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 3627 | |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3628 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 3629 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 3630 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3631 | return Charge.select_by_user(self.request.user) |
| 3632 | |
| 3633 | # update() is handled by PlanetStackRetrieveUpdateDestroyAPIView |
| 3634 | |
| 3635 | # destroy() is handled by PlanetStackRetrieveUpdateDestroyAPIView |
| 3636 | |
| 3637 | |
| 3638 | |
Scott Baker | 15af565 | 2015-02-02 14:33:08 -0800 | [diff] [blame] | 3639 | class RoleList(PlanetStackListCreateAPIView): |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3640 | queryset = Role.objects.select_related().all() |
| 3641 | serializer_class = RoleSerializer |
| 3642 | id_serializer_class = RoleIdSerializer |
| 3643 | filter_backends = (filters.DjangoFilterBackend,) |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 3644 | 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] | 3645 | |
| 3646 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 3647 | no_hyperlinks=False |
| 3648 | if hasattr(self.request,"QUERY_PARAMS"): |
| 3649 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3650 | if (no_hyperlinks): |
| 3651 | return self.id_serializer_class |
| 3652 | else: |
| 3653 | return self.serializer_class |
| 3654 | |
| 3655 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 3656 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 3657 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3658 | return Role.select_by_user(self.request.user) |
| 3659 | |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3660 | |
| 3661 | class RoleDetail(PlanetStackRetrieveUpdateDestroyAPIView): |
| 3662 | queryset = Role.objects.select_related().all() |
| 3663 | serializer_class = RoleSerializer |
| 3664 | id_serializer_class = RoleIdSerializer |
| 3665 | |
| 3666 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 3667 | no_hyperlinks=False |
| 3668 | if hasattr(self.request,"QUERY_PARAMS"): |
| 3669 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3670 | if (no_hyperlinks): |
| 3671 | return self.id_serializer_class |
| 3672 | else: |
| 3673 | return self.serializer_class |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 3674 | |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3675 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 3676 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 3677 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3678 | return Role.select_by_user(self.request.user) |
| 3679 | |
| 3680 | # update() is handled by PlanetStackRetrieveUpdateDestroyAPIView |
| 3681 | |
| 3682 | # destroy() is handled by PlanetStackRetrieveUpdateDestroyAPIView |
| 3683 | |
| 3684 | |
| 3685 | |
Scott Baker | 15af565 | 2015-02-02 14:33:08 -0800 | [diff] [blame] | 3686 | class UsableObjectList(PlanetStackListCreateAPIView): |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3687 | queryset = UsableObject.objects.select_related().all() |
| 3688 | serializer_class = UsableObjectSerializer |
| 3689 | id_serializer_class = UsableObjectIdSerializer |
| 3690 | filter_backends = (filters.DjangoFilterBackend,) |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 3691 | 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] | 3692 | |
| 3693 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 3694 | no_hyperlinks=False |
| 3695 | if hasattr(self.request,"QUERY_PARAMS"): |
| 3696 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3697 | if (no_hyperlinks): |
| 3698 | return self.id_serializer_class |
| 3699 | else: |
| 3700 | return self.serializer_class |
| 3701 | |
| 3702 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 3703 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 3704 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3705 | return UsableObject.select_by_user(self.request.user) |
| 3706 | |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3707 | |
| 3708 | class UsableObjectDetail(PlanetStackRetrieveUpdateDestroyAPIView): |
| 3709 | queryset = UsableObject.objects.select_related().all() |
| 3710 | serializer_class = UsableObjectSerializer |
| 3711 | id_serializer_class = UsableObjectIdSerializer |
| 3712 | |
| 3713 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 3714 | no_hyperlinks=False |
| 3715 | if hasattr(self.request,"QUERY_PARAMS"): |
| 3716 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3717 | if (no_hyperlinks): |
| 3718 | return self.id_serializer_class |
| 3719 | else: |
| 3720 | return self.serializer_class |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 3721 | |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3722 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 3723 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 3724 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3725 | return UsableObject.select_by_user(self.request.user) |
| 3726 | |
| 3727 | # update() is handled by PlanetStackRetrieveUpdateDestroyAPIView |
| 3728 | |
| 3729 | # destroy() is handled by PlanetStackRetrieveUpdateDestroyAPIView |
| 3730 | |
| 3731 | |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 3732 | |
Scott Baker | 15af565 | 2015-02-02 14:33:08 -0800 | [diff] [blame] | 3733 | class SiteRoleList(PlanetStackListCreateAPIView): |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3734 | queryset = SiteRole.objects.select_related().all() |
| 3735 | serializer_class = SiteRoleSerializer |
| 3736 | id_serializer_class = SiteRoleIdSerializer |
| 3737 | filter_backends = (filters.DjangoFilterBackend,) |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 3738 | 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] | 3739 | |
| 3740 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 3741 | no_hyperlinks=False |
| 3742 | if hasattr(self.request,"QUERY_PARAMS"): |
| 3743 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3744 | if (no_hyperlinks): |
| 3745 | return self.id_serializer_class |
| 3746 | else: |
| 3747 | return self.serializer_class |
| 3748 | |
| 3749 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 3750 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 3751 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3752 | return SiteRole.select_by_user(self.request.user) |
| 3753 | |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3754 | |
| 3755 | class SiteRoleDetail(PlanetStackRetrieveUpdateDestroyAPIView): |
| 3756 | queryset = SiteRole.objects.select_related().all() |
| 3757 | serializer_class = SiteRoleSerializer |
| 3758 | id_serializer_class = SiteRoleIdSerializer |
| 3759 | |
| 3760 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 3761 | no_hyperlinks=False |
| 3762 | if hasattr(self.request,"QUERY_PARAMS"): |
| 3763 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3764 | if (no_hyperlinks): |
| 3765 | return self.id_serializer_class |
| 3766 | else: |
| 3767 | return self.serializer_class |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 3768 | |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3769 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 3770 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 3771 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3772 | return SiteRole.select_by_user(self.request.user) |
| 3773 | |
| 3774 | # update() is handled by PlanetStackRetrieveUpdateDestroyAPIView |
| 3775 | |
| 3776 | # destroy() is handled by PlanetStackRetrieveUpdateDestroyAPIView |
| 3777 | |
| 3778 | |
| 3779 | |
Scott Baker | 15af565 | 2015-02-02 14:33:08 -0800 | [diff] [blame] | 3780 | class SliceCredentialList(PlanetStackListCreateAPIView): |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3781 | queryset = SliceCredential.objects.select_related().all() |
| 3782 | serializer_class = SliceCredentialSerializer |
| 3783 | id_serializer_class = SliceCredentialIdSerializer |
| 3784 | filter_backends = (filters.DjangoFilterBackend,) |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 3785 | 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] | 3786 | |
| 3787 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 3788 | no_hyperlinks=False |
| 3789 | if hasattr(self.request,"QUERY_PARAMS"): |
| 3790 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3791 | if (no_hyperlinks): |
| 3792 | return self.id_serializer_class |
| 3793 | else: |
| 3794 | return self.serializer_class |
| 3795 | |
| 3796 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 3797 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 3798 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3799 | return SliceCredential.select_by_user(self.request.user) |
| 3800 | |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3801 | |
| 3802 | class SliceCredentialDetail(PlanetStackRetrieveUpdateDestroyAPIView): |
| 3803 | queryset = SliceCredential.objects.select_related().all() |
| 3804 | serializer_class = SliceCredentialSerializer |
| 3805 | id_serializer_class = SliceCredentialIdSerializer |
| 3806 | |
| 3807 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 3808 | no_hyperlinks=False |
| 3809 | if hasattr(self.request,"QUERY_PARAMS"): |
| 3810 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3811 | if (no_hyperlinks): |
| 3812 | return self.id_serializer_class |
| 3813 | else: |
| 3814 | return self.serializer_class |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 3815 | |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3816 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 3817 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 3818 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3819 | return SliceCredential.select_by_user(self.request.user) |
| 3820 | |
| 3821 | # update() is handled by PlanetStackRetrieveUpdateDestroyAPIView |
| 3822 | |
| 3823 | # destroy() is handled by PlanetStackRetrieveUpdateDestroyAPIView |
| 3824 | |
| 3825 | |
| 3826 | |
Scott Baker | 15af565 | 2015-02-02 14:33:08 -0800 | [diff] [blame] | 3827 | class SliverList(PlanetStackListCreateAPIView): |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3828 | queryset = Sliver.objects.select_related().all() |
| 3829 | serializer_class = SliverSerializer |
| 3830 | id_serializer_class = SliverIdSerializer |
| 3831 | filter_backends = (filters.DjangoFilterBackend,) |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 3832 | 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] | 3833 | |
| 3834 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 3835 | no_hyperlinks=False |
| 3836 | if hasattr(self.request,"QUERY_PARAMS"): |
| 3837 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3838 | if (no_hyperlinks): |
| 3839 | return self.id_serializer_class |
| 3840 | else: |
| 3841 | return self.serializer_class |
| 3842 | |
| 3843 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 3844 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 3845 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3846 | return Sliver.select_by_user(self.request.user) |
| 3847 | |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3848 | |
| 3849 | class SliverDetail(PlanetStackRetrieveUpdateDestroyAPIView): |
| 3850 | queryset = Sliver.objects.select_related().all() |
| 3851 | serializer_class = SliverSerializer |
| 3852 | id_serializer_class = SliverIdSerializer |
| 3853 | |
| 3854 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 3855 | no_hyperlinks=False |
| 3856 | if hasattr(self.request,"QUERY_PARAMS"): |
| 3857 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3858 | if (no_hyperlinks): |
| 3859 | return self.id_serializer_class |
| 3860 | else: |
| 3861 | return self.serializer_class |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 3862 | |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3863 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 3864 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 3865 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3866 | return Sliver.select_by_user(self.request.user) |
| 3867 | |
| 3868 | # update() is handled by PlanetStackRetrieveUpdateDestroyAPIView |
| 3869 | |
| 3870 | # destroy() is handled by PlanetStackRetrieveUpdateDestroyAPIView |
| 3871 | |
| 3872 | |
| 3873 | |
Scott Baker | 15af565 | 2015-02-02 14:33:08 -0800 | [diff] [blame] | 3874 | class NodeList(PlanetStackListCreateAPIView): |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3875 | queryset = Node.objects.select_related().all() |
| 3876 | serializer_class = NodeSerializer |
| 3877 | id_serializer_class = NodeIdSerializer |
| 3878 | filter_backends = (filters.DjangoFilterBackend,) |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 3879 | 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] | 3880 | |
| 3881 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 3882 | no_hyperlinks=False |
| 3883 | if hasattr(self.request,"QUERY_PARAMS"): |
| 3884 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3885 | if (no_hyperlinks): |
| 3886 | return self.id_serializer_class |
| 3887 | else: |
| 3888 | return self.serializer_class |
| 3889 | |
| 3890 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 3891 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 3892 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3893 | return Node.select_by_user(self.request.user) |
| 3894 | |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3895 | |
| 3896 | class NodeDetail(PlanetStackRetrieveUpdateDestroyAPIView): |
| 3897 | queryset = Node.objects.select_related().all() |
| 3898 | serializer_class = NodeSerializer |
| 3899 | id_serializer_class = NodeIdSerializer |
| 3900 | |
| 3901 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 3902 | no_hyperlinks=False |
| 3903 | if hasattr(self.request,"QUERY_PARAMS"): |
| 3904 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3905 | if (no_hyperlinks): |
| 3906 | return self.id_serializer_class |
| 3907 | else: |
| 3908 | return self.serializer_class |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 3909 | |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3910 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 3911 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 3912 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3913 | return Node.select_by_user(self.request.user) |
| 3914 | |
| 3915 | # update() is handled by PlanetStackRetrieveUpdateDestroyAPIView |
| 3916 | |
| 3917 | # destroy() is handled by PlanetStackRetrieveUpdateDestroyAPIView |
| 3918 | |
| 3919 | |
| 3920 | |
Scott Baker | 15af565 | 2015-02-02 14:33:08 -0800 | [diff] [blame] | 3921 | class DashboardViewList(PlanetStackListCreateAPIView): |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3922 | queryset = DashboardView.objects.select_related().all() |
| 3923 | serializer_class = DashboardViewSerializer |
| 3924 | id_serializer_class = DashboardViewIdSerializer |
| 3925 | filter_backends = (filters.DjangoFilterBackend,) |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 3926 | 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] | 3927 | |
| 3928 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 3929 | no_hyperlinks=False |
| 3930 | if hasattr(self.request,"QUERY_PARAMS"): |
| 3931 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3932 | if (no_hyperlinks): |
| 3933 | return self.id_serializer_class |
| 3934 | else: |
| 3935 | return self.serializer_class |
| 3936 | |
| 3937 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 3938 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 3939 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3940 | return DashboardView.select_by_user(self.request.user) |
| 3941 | |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3942 | |
| 3943 | class DashboardViewDetail(PlanetStackRetrieveUpdateDestroyAPIView): |
| 3944 | queryset = DashboardView.objects.select_related().all() |
| 3945 | serializer_class = DashboardViewSerializer |
| 3946 | id_serializer_class = DashboardViewIdSerializer |
| 3947 | |
| 3948 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 3949 | no_hyperlinks=False |
| 3950 | if hasattr(self.request,"QUERY_PARAMS"): |
| 3951 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3952 | if (no_hyperlinks): |
| 3953 | return self.id_serializer_class |
| 3954 | else: |
| 3955 | return self.serializer_class |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 3956 | |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3957 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 3958 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 3959 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3960 | return DashboardView.select_by_user(self.request.user) |
| 3961 | |
| 3962 | # update() is handled by PlanetStackRetrieveUpdateDestroyAPIView |
| 3963 | |
| 3964 | # destroy() is handled by PlanetStackRetrieveUpdateDestroyAPIView |
| 3965 | |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 3966 | |
Scott Baker | 57c725c | 2014-11-12 01:13:53 -0800 | [diff] [blame] | 3967 | |
Scott Baker | 15af565 | 2015-02-02 14:33:08 -0800 | [diff] [blame] | 3968 | class ControllerNetworkList(PlanetStackListCreateAPIView): |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 3969 | queryset = ControllerNetwork.objects.select_related().all() |
| 3970 | serializer_class = ControllerNetworkSerializer |
| 3971 | id_serializer_class = ControllerNetworkIdSerializer |
| 3972 | filter_backends = (filters.DjangoFilterBackend,) |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 3973 | 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] | 3974 | |
| 3975 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 3976 | no_hyperlinks=False |
| 3977 | if hasattr(self.request,"QUERY_PARAMS"): |
| 3978 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 3979 | if (no_hyperlinks): |
| 3980 | return self.id_serializer_class |
| 3981 | else: |
| 3982 | return self.serializer_class |
| 3983 | |
| 3984 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 3985 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 3986 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 3987 | return ControllerNetwork.select_by_user(self.request.user) |
| 3988 | |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 3989 | |
| 3990 | class ControllerNetworkDetail(PlanetStackRetrieveUpdateDestroyAPIView): |
| 3991 | queryset = ControllerNetwork.objects.select_related().all() |
| 3992 | serializer_class = ControllerNetworkSerializer |
| 3993 | id_serializer_class = ControllerNetworkIdSerializer |
| 3994 | |
| 3995 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 3996 | no_hyperlinks=False |
| 3997 | if hasattr(self.request,"QUERY_PARAMS"): |
| 3998 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 3999 | if (no_hyperlinks): |
| 4000 | return self.id_serializer_class |
| 4001 | else: |
| 4002 | return self.serializer_class |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 4003 | |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 4004 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 4005 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 4006 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 4007 | return ControllerNetwork.select_by_user(self.request.user) |
| 4008 | |
| 4009 | # update() is handled by PlanetStackRetrieveUpdateDestroyAPIView |
| 4010 | |
| 4011 | # destroy() is handled by PlanetStackRetrieveUpdateDestroyAPIView |
| 4012 | |
| 4013 | |
| 4014 | |
Scott Baker | 15af565 | 2015-02-02 14:33:08 -0800 | [diff] [blame] | 4015 | class ImageDeploymentsList(PlanetStackListCreateAPIView): |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 4016 | queryset = ImageDeployments.objects.select_related().all() |
| 4017 | serializer_class = ImageDeploymentsSerializer |
| 4018 | id_serializer_class = ImageDeploymentsIdSerializer |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 4019 | filter_backends = (filters.DjangoFilterBackend,) |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 4020 | 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] | 4021 | |
| 4022 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 4023 | no_hyperlinks=False |
| 4024 | if hasattr(self.request,"QUERY_PARAMS"): |
| 4025 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 4026 | if (no_hyperlinks): |
| 4027 | return self.id_serializer_class |
| 4028 | else: |
| 4029 | return self.serializer_class |
| 4030 | |
| 4031 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 4032 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 4033 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 4034 | return ImageDeployments.select_by_user(self.request.user) |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 4035 | |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 4036 | |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 4037 | class ImageDeploymentsDetail(PlanetStackRetrieveUpdateDestroyAPIView): |
| 4038 | queryset = ImageDeployments.objects.select_related().all() |
| 4039 | serializer_class = ImageDeploymentsSerializer |
| 4040 | id_serializer_class = ImageDeploymentsIdSerializer |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 4041 | |
| 4042 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 4043 | no_hyperlinks=False |
| 4044 | if hasattr(self.request,"QUERY_PARAMS"): |
| 4045 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 4046 | if (no_hyperlinks): |
| 4047 | return self.id_serializer_class |
| 4048 | else: |
| 4049 | return self.serializer_class |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 4050 | |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 4051 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 4052 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 4053 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 4054 | return ImageDeployments.select_by_user(self.request.user) |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 4055 | |
| 4056 | # update() is handled by PlanetStackRetrieveUpdateDestroyAPIView |
| 4057 | |
| 4058 | # destroy() is handled by PlanetStackRetrieveUpdateDestroyAPIView |
| 4059 | |
Scott Baker | b744f1c | 2014-11-21 11:32:24 -0800 | [diff] [blame] | 4060 | |
| 4061 | |
Scott Baker | 15af565 | 2015-02-02 14:33:08 -0800 | [diff] [blame] | 4062 | class ControllerUserList(PlanetStackListCreateAPIView): |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 4063 | queryset = ControllerUser.objects.select_related().all() |
| 4064 | serializer_class = ControllerUserSerializer |
| 4065 | id_serializer_class = ControllerUserIdSerializer |
| 4066 | filter_backends = (filters.DjangoFilterBackend,) |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 4067 | 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] | 4068 | |
| 4069 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 4070 | no_hyperlinks=False |
| 4071 | if hasattr(self.request,"QUERY_PARAMS"): |
| 4072 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 4073 | if (no_hyperlinks): |
| 4074 | return self.id_serializer_class |
| 4075 | else: |
| 4076 | return self.serializer_class |
| 4077 | |
| 4078 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 4079 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 4080 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 4081 | return ControllerUser.select_by_user(self.request.user) |
| 4082 | |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 4083 | |
| 4084 | class ControllerUserDetail(PlanetStackRetrieveUpdateDestroyAPIView): |
| 4085 | queryset = ControllerUser.objects.select_related().all() |
| 4086 | serializer_class = ControllerUserSerializer |
| 4087 | id_serializer_class = ControllerUserIdSerializer |
| 4088 | |
| 4089 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 4090 | no_hyperlinks=False |
| 4091 | if hasattr(self.request,"QUERY_PARAMS"): |
| 4092 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 4093 | if (no_hyperlinks): |
| 4094 | return self.id_serializer_class |
| 4095 | else: |
| 4096 | return self.serializer_class |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 4097 | |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 4098 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 4099 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 4100 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 4101 | return ControllerUser.select_by_user(self.request.user) |
| 4102 | |
| 4103 | # update() is handled by PlanetStackRetrieveUpdateDestroyAPIView |
| 4104 | |
| 4105 | # destroy() is handled by PlanetStackRetrieveUpdateDestroyAPIView |
| 4106 | |
| 4107 | |
| 4108 | |
Scott Baker | 15af565 | 2015-02-02 14:33:08 -0800 | [diff] [blame] | 4109 | class ReservedResourceList(PlanetStackListCreateAPIView): |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4110 | queryset = ReservedResource.objects.select_related().all() |
| 4111 | serializer_class = ReservedResourceSerializer |
| 4112 | id_serializer_class = ReservedResourceIdSerializer |
| 4113 | filter_backends = (filters.DjangoFilterBackend,) |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 4114 | 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] | 4115 | |
| 4116 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 4117 | no_hyperlinks=False |
| 4118 | if hasattr(self.request,"QUERY_PARAMS"): |
| 4119 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4120 | if (no_hyperlinks): |
| 4121 | return self.id_serializer_class |
| 4122 | else: |
| 4123 | return self.serializer_class |
| 4124 | |
| 4125 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 4126 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 4127 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4128 | return ReservedResource.select_by_user(self.request.user) |
| 4129 | |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4130 | |
| 4131 | class ReservedResourceDetail(PlanetStackRetrieveUpdateDestroyAPIView): |
| 4132 | queryset = ReservedResource.objects.select_related().all() |
| 4133 | serializer_class = ReservedResourceSerializer |
| 4134 | id_serializer_class = ReservedResourceIdSerializer |
| 4135 | |
| 4136 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 4137 | no_hyperlinks=False |
| 4138 | if hasattr(self.request,"QUERY_PARAMS"): |
| 4139 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4140 | if (no_hyperlinks): |
| 4141 | return self.id_serializer_class |
| 4142 | else: |
| 4143 | return self.serializer_class |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 4144 | |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4145 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 4146 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 4147 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4148 | return ReservedResource.select_by_user(self.request.user) |
| 4149 | |
| 4150 | # update() is handled by PlanetStackRetrieveUpdateDestroyAPIView |
| 4151 | |
| 4152 | # destroy() is handled by PlanetStackRetrieveUpdateDestroyAPIView |
| 4153 | |
| 4154 | |
| 4155 | |
Scott Baker | 15af565 | 2015-02-02 14:33:08 -0800 | [diff] [blame] | 4156 | class PaymentList(PlanetStackListCreateAPIView): |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 4157 | queryset = Payment.objects.select_related().all() |
| 4158 | serializer_class = PaymentSerializer |
| 4159 | id_serializer_class = PaymentIdSerializer |
| 4160 | filter_backends = (filters.DjangoFilterBackend,) |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 4161 | 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] | 4162 | |
| 4163 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 4164 | no_hyperlinks=False |
| 4165 | if hasattr(self.request,"QUERY_PARAMS"): |
| 4166 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 4167 | if (no_hyperlinks): |
| 4168 | return self.id_serializer_class |
| 4169 | else: |
| 4170 | return self.serializer_class |
| 4171 | |
| 4172 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 4173 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 4174 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 4175 | return Payment.select_by_user(self.request.user) |
| 4176 | |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 4177 | |
| 4178 | class PaymentDetail(PlanetStackRetrieveUpdateDestroyAPIView): |
| 4179 | queryset = Payment.objects.select_related().all() |
| 4180 | serializer_class = PaymentSerializer |
| 4181 | id_serializer_class = PaymentIdSerializer |
| 4182 | |
| 4183 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 4184 | no_hyperlinks=False |
| 4185 | if hasattr(self.request,"QUERY_PARAMS"): |
| 4186 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 4187 | if (no_hyperlinks): |
| 4188 | return self.id_serializer_class |
| 4189 | else: |
| 4190 | return self.serializer_class |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 4191 | |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 4192 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 4193 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 4194 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 4195 | return Payment.select_by_user(self.request.user) |
| 4196 | |
| 4197 | # update() is handled by PlanetStackRetrieveUpdateDestroyAPIView |
| 4198 | |
| 4199 | # destroy() is handled by PlanetStackRetrieveUpdateDestroyAPIView |
| 4200 | |
| 4201 | |
| 4202 | |
Scott Baker | 15af565 | 2015-02-02 14:33:08 -0800 | [diff] [blame] | 4203 | class NetworkSliceList(PlanetStackListCreateAPIView): |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4204 | queryset = NetworkSlice.objects.select_related().all() |
| 4205 | serializer_class = NetworkSliceSerializer |
| 4206 | id_serializer_class = NetworkSliceIdSerializer |
| 4207 | filter_backends = (filters.DjangoFilterBackend,) |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 4208 | 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] | 4209 | |
| 4210 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 4211 | no_hyperlinks=False |
| 4212 | if hasattr(self.request,"QUERY_PARAMS"): |
| 4213 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4214 | if (no_hyperlinks): |
| 4215 | return self.id_serializer_class |
| 4216 | else: |
| 4217 | return self.serializer_class |
| 4218 | |
| 4219 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 4220 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 4221 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4222 | return NetworkSlice.select_by_user(self.request.user) |
| 4223 | |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4224 | |
| 4225 | class NetworkSliceDetail(PlanetStackRetrieveUpdateDestroyAPIView): |
| 4226 | queryset = NetworkSlice.objects.select_related().all() |
| 4227 | serializer_class = NetworkSliceSerializer |
| 4228 | id_serializer_class = NetworkSliceIdSerializer |
| 4229 | |
| 4230 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 4231 | no_hyperlinks=False |
| 4232 | if hasattr(self.request,"QUERY_PARAMS"): |
| 4233 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4234 | if (no_hyperlinks): |
| 4235 | return self.id_serializer_class |
| 4236 | else: |
| 4237 | return self.serializer_class |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 4238 | |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4239 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 4240 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 4241 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4242 | return NetworkSlice.select_by_user(self.request.user) |
| 4243 | |
| 4244 | # update() is handled by PlanetStackRetrieveUpdateDestroyAPIView |
| 4245 | |
| 4246 | # destroy() is handled by PlanetStackRetrieveUpdateDestroyAPIView |
| 4247 | |
| 4248 | |
| 4249 | |
Scott Baker | 15af565 | 2015-02-02 14:33:08 -0800 | [diff] [blame] | 4250 | class UserDashboardViewList(PlanetStackListCreateAPIView): |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4251 | queryset = UserDashboardView.objects.select_related().all() |
| 4252 | serializer_class = UserDashboardViewSerializer |
| 4253 | id_serializer_class = UserDashboardViewIdSerializer |
| 4254 | filter_backends = (filters.DjangoFilterBackend,) |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 4255 | 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] | 4256 | |
| 4257 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 4258 | no_hyperlinks=False |
| 4259 | if hasattr(self.request,"QUERY_PARAMS"): |
| 4260 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4261 | if (no_hyperlinks): |
| 4262 | return self.id_serializer_class |
| 4263 | else: |
| 4264 | return self.serializer_class |
| 4265 | |
| 4266 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 4267 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 4268 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4269 | return UserDashboardView.select_by_user(self.request.user) |
| 4270 | |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4271 | |
| 4272 | class UserDashboardViewDetail(PlanetStackRetrieveUpdateDestroyAPIView): |
| 4273 | queryset = UserDashboardView.objects.select_related().all() |
| 4274 | serializer_class = UserDashboardViewSerializer |
| 4275 | id_serializer_class = UserDashboardViewIdSerializer |
| 4276 | |
| 4277 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 4278 | no_hyperlinks=False |
| 4279 | if hasattr(self.request,"QUERY_PARAMS"): |
| 4280 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4281 | if (no_hyperlinks): |
| 4282 | return self.id_serializer_class |
| 4283 | else: |
| 4284 | return self.serializer_class |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 4285 | |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4286 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 4287 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 4288 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4289 | return UserDashboardView.select_by_user(self.request.user) |
| 4290 | |
| 4291 | # update() is handled by PlanetStackRetrieveUpdateDestroyAPIView |
| 4292 | |
| 4293 | # destroy() is handled by PlanetStackRetrieveUpdateDestroyAPIView |
| 4294 | |
| 4295 | |
| 4296 | |
Scott Baker | 15af565 | 2015-02-02 14:33:08 -0800 | [diff] [blame] | 4297 | class ControllerList(PlanetStackListCreateAPIView): |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 4298 | queryset = Controller.objects.select_related().all() |
| 4299 | serializer_class = ControllerSerializer |
| 4300 | id_serializer_class = ControllerIdSerializer |
| 4301 | filter_backends = (filters.DjangoFilterBackend,) |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 4302 | 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] | 4303 | |
| 4304 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 4305 | no_hyperlinks=False |
| 4306 | if hasattr(self.request,"QUERY_PARAMS"): |
| 4307 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 4308 | if (no_hyperlinks): |
| 4309 | return self.id_serializer_class |
| 4310 | else: |
| 4311 | return self.serializer_class |
| 4312 | |
| 4313 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 4314 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 4315 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 4316 | return Controller.select_by_user(self.request.user) |
| 4317 | |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 4318 | |
| 4319 | class ControllerDetail(PlanetStackRetrieveUpdateDestroyAPIView): |
| 4320 | queryset = Controller.objects.select_related().all() |
| 4321 | serializer_class = ControllerSerializer |
| 4322 | id_serializer_class = ControllerIdSerializer |
| 4323 | |
| 4324 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 4325 | no_hyperlinks=False |
| 4326 | if hasattr(self.request,"QUERY_PARAMS"): |
| 4327 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 4328 | if (no_hyperlinks): |
| 4329 | return self.id_serializer_class |
| 4330 | else: |
| 4331 | return self.serializer_class |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 4332 | |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 4333 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 4334 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 4335 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 4336 | return Controller.select_by_user(self.request.user) |
| 4337 | |
| 4338 | # update() is handled by PlanetStackRetrieveUpdateDestroyAPIView |
| 4339 | |
| 4340 | # destroy() is handled by PlanetStackRetrieveUpdateDestroyAPIView |
| 4341 | |
| 4342 | |
| 4343 | |
Scott Baker | 15af565 | 2015-02-02 14:33:08 -0800 | [diff] [blame] | 4344 | class PlanetStackPrivilegeList(PlanetStackListCreateAPIView): |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4345 | queryset = PlanetStackPrivilege.objects.select_related().all() |
| 4346 | serializer_class = PlanetStackPrivilegeSerializer |
| 4347 | id_serializer_class = PlanetStackPrivilegeIdSerializer |
| 4348 | filter_backends = (filters.DjangoFilterBackend,) |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 4349 | 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] | 4350 | |
| 4351 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 4352 | no_hyperlinks=False |
| 4353 | if hasattr(self.request,"QUERY_PARAMS"): |
| 4354 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4355 | if (no_hyperlinks): |
| 4356 | return self.id_serializer_class |
| 4357 | else: |
| 4358 | return self.serializer_class |
| 4359 | |
| 4360 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 4361 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 4362 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4363 | return PlanetStackPrivilege.select_by_user(self.request.user) |
| 4364 | |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4365 | |
| 4366 | class PlanetStackPrivilegeDetail(PlanetStackRetrieveUpdateDestroyAPIView): |
| 4367 | queryset = PlanetStackPrivilege.objects.select_related().all() |
| 4368 | serializer_class = PlanetStackPrivilegeSerializer |
| 4369 | id_serializer_class = PlanetStackPrivilegeIdSerializer |
| 4370 | |
| 4371 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 4372 | no_hyperlinks=False |
| 4373 | if hasattr(self.request,"QUERY_PARAMS"): |
| 4374 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4375 | if (no_hyperlinks): |
| 4376 | return self.id_serializer_class |
| 4377 | else: |
| 4378 | return self.serializer_class |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 4379 | |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4380 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 4381 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 4382 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4383 | return PlanetStackPrivilege.select_by_user(self.request.user) |
| 4384 | |
| 4385 | # update() is handled by PlanetStackRetrieveUpdateDestroyAPIView |
| 4386 | |
| 4387 | # destroy() is handled by PlanetStackRetrieveUpdateDestroyAPIView |
| 4388 | |
| 4389 | |
| 4390 | |
Scott Baker | 15af565 | 2015-02-02 14:33:08 -0800 | [diff] [blame] | 4391 | class UserList(PlanetStackListCreateAPIView): |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4392 | queryset = User.objects.select_related().all() |
| 4393 | serializer_class = UserSerializer |
| 4394 | id_serializer_class = UserIdSerializer |
| 4395 | filter_backends = (filters.DjangoFilterBackend,) |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 4396 | 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] | 4397 | |
| 4398 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 4399 | no_hyperlinks=False |
| 4400 | if hasattr(self.request,"QUERY_PARAMS"): |
| 4401 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4402 | if (no_hyperlinks): |
| 4403 | return self.id_serializer_class |
| 4404 | else: |
| 4405 | return self.serializer_class |
| 4406 | |
| 4407 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 4408 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 4409 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4410 | return User.select_by_user(self.request.user) |
| 4411 | |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4412 | |
| 4413 | class UserDetail(PlanetStackRetrieveUpdateDestroyAPIView): |
| 4414 | queryset = User.objects.select_related().all() |
| 4415 | serializer_class = UserSerializer |
| 4416 | id_serializer_class = UserIdSerializer |
| 4417 | |
| 4418 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 4419 | no_hyperlinks=False |
| 4420 | if hasattr(self.request,"QUERY_PARAMS"): |
| 4421 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4422 | if (no_hyperlinks): |
| 4423 | return self.id_serializer_class |
| 4424 | else: |
| 4425 | return self.serializer_class |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 4426 | |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4427 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 4428 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 4429 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4430 | return User.select_by_user(self.request.user) |
| 4431 | |
| 4432 | # update() is handled by PlanetStackRetrieveUpdateDestroyAPIView |
| 4433 | |
| 4434 | # destroy() is handled by PlanetStackRetrieveUpdateDestroyAPIView |
| 4435 | |
| 4436 | |
| 4437 | |
Scott Baker | 15af565 | 2015-02-02 14:33:08 -0800 | [diff] [blame] | 4438 | class DeploymentList(PlanetStackListCreateAPIView): |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4439 | queryset = Deployment.objects.select_related().all() |
| 4440 | serializer_class = DeploymentSerializer |
| 4441 | id_serializer_class = DeploymentIdSerializer |
| 4442 | filter_backends = (filters.DjangoFilterBackend,) |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 4443 | 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] | 4444 | |
| 4445 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 4446 | no_hyperlinks=False |
| 4447 | if hasattr(self.request,"QUERY_PARAMS"): |
| 4448 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4449 | if (no_hyperlinks): |
| 4450 | return self.id_serializer_class |
| 4451 | else: |
| 4452 | return self.serializer_class |
| 4453 | |
| 4454 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 4455 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 4456 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4457 | return Deployment.select_by_user(self.request.user) |
| 4458 | |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4459 | |
| 4460 | class DeploymentDetail(PlanetStackRetrieveUpdateDestroyAPIView): |
| 4461 | queryset = Deployment.objects.select_related().all() |
| 4462 | serializer_class = DeploymentSerializer |
| 4463 | id_serializer_class = DeploymentIdSerializer |
| 4464 | |
| 4465 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 4466 | no_hyperlinks=False |
| 4467 | if hasattr(self.request,"QUERY_PARAMS"): |
| 4468 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4469 | if (no_hyperlinks): |
| 4470 | return self.id_serializer_class |
| 4471 | else: |
| 4472 | return self.serializer_class |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 4473 | |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4474 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 4475 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 4476 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4477 | return Deployment.select_by_user(self.request.user) |
| 4478 | |
| 4479 | # update() is handled by PlanetStackRetrieveUpdateDestroyAPIView |
| 4480 | |
| 4481 | # destroy() is handled by PlanetStackRetrieveUpdateDestroyAPIView |
| 4482 | |
| 4483 | |
| 4484 | |
Scott Baker | 15af565 | 2015-02-02 14:33:08 -0800 | [diff] [blame] | 4485 | class ReservationList(PlanetStackListCreateAPIView): |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4486 | queryset = Reservation.objects.select_related().all() |
| 4487 | serializer_class = ReservationSerializer |
| 4488 | id_serializer_class = ReservationIdSerializer |
| 4489 | filter_backends = (filters.DjangoFilterBackend,) |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 4490 | 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] | 4491 | |
| 4492 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 4493 | no_hyperlinks=False |
| 4494 | if hasattr(self.request,"QUERY_PARAMS"): |
| 4495 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4496 | if (no_hyperlinks): |
| 4497 | return self.id_serializer_class |
| 4498 | else: |
| 4499 | return self.serializer_class |
| 4500 | |
| 4501 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 4502 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 4503 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4504 | return Reservation.select_by_user(self.request.user) |
| 4505 | |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4506 | |
| 4507 | class ReservationDetail(PlanetStackRetrieveUpdateDestroyAPIView): |
| 4508 | queryset = Reservation.objects.select_related().all() |
| 4509 | serializer_class = ReservationSerializer |
| 4510 | id_serializer_class = ReservationIdSerializer |
| 4511 | |
| 4512 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 4513 | no_hyperlinks=False |
| 4514 | if hasattr(self.request,"QUERY_PARAMS"): |
| 4515 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4516 | if (no_hyperlinks): |
| 4517 | return self.id_serializer_class |
| 4518 | else: |
| 4519 | return self.serializer_class |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 4520 | |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4521 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 4522 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 4523 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4524 | return Reservation.select_by_user(self.request.user) |
| 4525 | |
| 4526 | # update() is handled by PlanetStackRetrieveUpdateDestroyAPIView |
| 4527 | |
| 4528 | # destroy() is handled by PlanetStackRetrieveUpdateDestroyAPIView |
| 4529 | |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4530 | |
Scott Baker | 57c725c | 2014-11-12 01:13:53 -0800 | [diff] [blame] | 4531 | |
Scott Baker | 15af565 | 2015-02-02 14:33:08 -0800 | [diff] [blame] | 4532 | class SitePrivilegeList(PlanetStackListCreateAPIView): |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4533 | queryset = SitePrivilege.objects.select_related().all() |
| 4534 | serializer_class = SitePrivilegeSerializer |
| 4535 | id_serializer_class = SitePrivilegeIdSerializer |
| 4536 | filter_backends = (filters.DjangoFilterBackend,) |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 4537 | 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] | 4538 | |
| 4539 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 4540 | no_hyperlinks=False |
| 4541 | if hasattr(self.request,"QUERY_PARAMS"): |
| 4542 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4543 | if (no_hyperlinks): |
| 4544 | return self.id_serializer_class |
| 4545 | else: |
| 4546 | return self.serializer_class |
| 4547 | |
| 4548 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 4549 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 4550 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4551 | return SitePrivilege.select_by_user(self.request.user) |
| 4552 | |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4553 | |
| 4554 | class SitePrivilegeDetail(PlanetStackRetrieveUpdateDestroyAPIView): |
| 4555 | queryset = SitePrivilege.objects.select_related().all() |
| 4556 | serializer_class = SitePrivilegeSerializer |
| 4557 | id_serializer_class = SitePrivilegeIdSerializer |
| 4558 | |
| 4559 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 4560 | no_hyperlinks=False |
| 4561 | if hasattr(self.request,"QUERY_PARAMS"): |
| 4562 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4563 | if (no_hyperlinks): |
| 4564 | return self.id_serializer_class |
| 4565 | else: |
| 4566 | return self.serializer_class |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 4567 | |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4568 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 4569 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 4570 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4571 | return SitePrivilege.select_by_user(self.request.user) |
| 4572 | |
| 4573 | # update() is handled by PlanetStackRetrieveUpdateDestroyAPIView |
| 4574 | |
| 4575 | # destroy() is handled by PlanetStackRetrieveUpdateDestroyAPIView |
| 4576 | |
| 4577 | |
| 4578 | |
Scott Baker | 15af565 | 2015-02-02 14:33:08 -0800 | [diff] [blame] | 4579 | class ControllerSliceList(PlanetStackListCreateAPIView): |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 4580 | queryset = ControllerSlice.objects.select_related().all() |
| 4581 | serializer_class = ControllerSliceSerializer |
| 4582 | id_serializer_class = ControllerSliceIdSerializer |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4583 | filter_backends = (filters.DjangoFilterBackend,) |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 4584 | 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] | 4585 | |
| 4586 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 4587 | no_hyperlinks=False |
| 4588 | if hasattr(self.request,"QUERY_PARAMS"): |
| 4589 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4590 | if (no_hyperlinks): |
| 4591 | return self.id_serializer_class |
| 4592 | else: |
| 4593 | return self.serializer_class |
| 4594 | |
| 4595 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 4596 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 4597 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 4598 | return ControllerSlice.select_by_user(self.request.user) |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4599 | |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4600 | |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 4601 | class ControllerSliceDetail(PlanetStackRetrieveUpdateDestroyAPIView): |
| 4602 | queryset = ControllerSlice.objects.select_related().all() |
| 4603 | serializer_class = ControllerSliceSerializer |
| 4604 | id_serializer_class = ControllerSliceIdSerializer |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4605 | |
| 4606 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 4607 | no_hyperlinks=False |
| 4608 | if hasattr(self.request,"QUERY_PARAMS"): |
| 4609 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4610 | if (no_hyperlinks): |
| 4611 | return self.id_serializer_class |
| 4612 | else: |
| 4613 | return self.serializer_class |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 4614 | |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4615 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 4616 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 4617 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 4618 | return ControllerSlice.select_by_user(self.request.user) |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4619 | |
| 4620 | # update() is handled by PlanetStackRetrieveUpdateDestroyAPIView |
| 4621 | |
| 4622 | # destroy() is handled by PlanetStackRetrieveUpdateDestroyAPIView |
| 4623 | |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4624 | |
Scott Baker | 57c725c | 2014-11-12 01:13:53 -0800 | [diff] [blame] | 4625 | |
Scott Baker | 15af565 | 2015-02-02 14:33:08 -0800 | [diff] [blame] | 4626 | class ControllerDashboardViewList(PlanetStackListCreateAPIView): |
Scott Baker | f2c0c51 | 2014-12-22 17:35:34 -0800 | [diff] [blame] | 4627 | queryset = ControllerDashboardView.objects.select_related().all() |
| 4628 | serializer_class = ControllerDashboardViewSerializer |
| 4629 | id_serializer_class = ControllerDashboardViewIdSerializer |
| 4630 | filter_backends = (filters.DjangoFilterBackend,) |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 4631 | 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] | 4632 | |
| 4633 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 4634 | no_hyperlinks=False |
| 4635 | if hasattr(self.request,"QUERY_PARAMS"): |
| 4636 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | f2c0c51 | 2014-12-22 17:35:34 -0800 | [diff] [blame] | 4637 | if (no_hyperlinks): |
| 4638 | return self.id_serializer_class |
| 4639 | else: |
| 4640 | return self.serializer_class |
| 4641 | |
| 4642 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 4643 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 4644 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | f2c0c51 | 2014-12-22 17:35:34 -0800 | [diff] [blame] | 4645 | return ControllerDashboardView.select_by_user(self.request.user) |
| 4646 | |
Scott Baker | f2c0c51 | 2014-12-22 17:35:34 -0800 | [diff] [blame] | 4647 | |
| 4648 | class ControllerDashboardViewDetail(PlanetStackRetrieveUpdateDestroyAPIView): |
| 4649 | queryset = ControllerDashboardView.objects.select_related().all() |
| 4650 | serializer_class = ControllerDashboardViewSerializer |
| 4651 | id_serializer_class = ControllerDashboardViewIdSerializer |
| 4652 | |
| 4653 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 4654 | no_hyperlinks=False |
| 4655 | if hasattr(self.request,"QUERY_PARAMS"): |
| 4656 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | f2c0c51 | 2014-12-22 17:35:34 -0800 | [diff] [blame] | 4657 | if (no_hyperlinks): |
| 4658 | return self.id_serializer_class |
| 4659 | else: |
| 4660 | return self.serializer_class |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 4661 | |
Scott Baker | f2c0c51 | 2014-12-22 17:35:34 -0800 | [diff] [blame] | 4662 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 4663 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 4664 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | f2c0c51 | 2014-12-22 17:35:34 -0800 | [diff] [blame] | 4665 | return ControllerDashboardView.select_by_user(self.request.user) |
| 4666 | |
| 4667 | # update() is handled by PlanetStackRetrieveUpdateDestroyAPIView |
| 4668 | |
| 4669 | # destroy() is handled by PlanetStackRetrieveUpdateDestroyAPIView |
| 4670 | |
| 4671 | |
| 4672 | |
Scott Baker | 15af565 | 2015-02-02 14:33:08 -0800 | [diff] [blame] | 4673 | class AccountList(PlanetStackListCreateAPIView): |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4674 | queryset = Account.objects.select_related().all() |
| 4675 | serializer_class = AccountSerializer |
| 4676 | id_serializer_class = AccountIdSerializer |
| 4677 | filter_backends = (filters.DjangoFilterBackend,) |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 4678 | 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] | 4679 | |
| 4680 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 4681 | no_hyperlinks=False |
| 4682 | if hasattr(self.request,"QUERY_PARAMS"): |
| 4683 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4684 | if (no_hyperlinks): |
| 4685 | return self.id_serializer_class |
| 4686 | else: |
| 4687 | return self.serializer_class |
| 4688 | |
| 4689 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 4690 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 4691 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4692 | return Account.select_by_user(self.request.user) |
| 4693 | |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4694 | |
| 4695 | class AccountDetail(PlanetStackRetrieveUpdateDestroyAPIView): |
| 4696 | queryset = Account.objects.select_related().all() |
| 4697 | serializer_class = AccountSerializer |
| 4698 | id_serializer_class = AccountIdSerializer |
| 4699 | |
| 4700 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 4701 | no_hyperlinks=False |
| 4702 | if hasattr(self.request,"QUERY_PARAMS"): |
| 4703 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4704 | if (no_hyperlinks): |
| 4705 | return self.id_serializer_class |
| 4706 | else: |
| 4707 | return self.serializer_class |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 4708 | |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4709 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 4710 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 4711 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4712 | return Account.select_by_user(self.request.user) |
| 4713 | |
| 4714 | # update() is handled by PlanetStackRetrieveUpdateDestroyAPIView |
| 4715 | |
| 4716 | # destroy() is handled by PlanetStackRetrieveUpdateDestroyAPIView |
| 4717 | |
| 4718 | |
| 4719 | |
Scott Baker | 15af565 | 2015-02-02 14:33:08 -0800 | [diff] [blame] | 4720 | class ControllerRoleList(PlanetStackListCreateAPIView): |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 4721 | queryset = ControllerRole.objects.select_related().all() |
| 4722 | serializer_class = ControllerRoleSerializer |
| 4723 | id_serializer_class = ControllerRoleIdSerializer |
| 4724 | filter_backends = (filters.DjangoFilterBackend,) |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 4725 | 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] | 4726 | |
| 4727 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 4728 | no_hyperlinks=False |
| 4729 | if hasattr(self.request,"QUERY_PARAMS"): |
| 4730 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 4731 | if (no_hyperlinks): |
| 4732 | return self.id_serializer_class |
| 4733 | else: |
| 4734 | return self.serializer_class |
| 4735 | |
| 4736 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 4737 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 4738 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 4739 | return ControllerRole.select_by_user(self.request.user) |
| 4740 | |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 4741 | |
| 4742 | class ControllerRoleDetail(PlanetStackRetrieveUpdateDestroyAPIView): |
| 4743 | queryset = ControllerRole.objects.select_related().all() |
| 4744 | serializer_class = ControllerRoleSerializer |
| 4745 | id_serializer_class = ControllerRoleIdSerializer |
| 4746 | |
| 4747 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 4748 | no_hyperlinks=False |
| 4749 | if hasattr(self.request,"QUERY_PARAMS"): |
| 4750 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 4751 | if (no_hyperlinks): |
| 4752 | return self.id_serializer_class |
| 4753 | else: |
| 4754 | return self.serializer_class |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 4755 | |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 4756 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 4757 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 4758 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 4759 | return ControllerRole.select_by_user(self.request.user) |
| 4760 | |
| 4761 | # update() is handled by PlanetStackRetrieveUpdateDestroyAPIView |
| 4762 | |
| 4763 | # destroy() is handled by PlanetStackRetrieveUpdateDestroyAPIView |
| 4764 | |
| 4765 | |
| 4766 | |
Scott Baker | 15af565 | 2015-02-02 14:33:08 -0800 | [diff] [blame] | 4767 | class NetworkParameterTypeList(PlanetStackListCreateAPIView): |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4768 | queryset = NetworkParameterType.objects.select_related().all() |
| 4769 | serializer_class = NetworkParameterTypeSerializer |
| 4770 | id_serializer_class = NetworkParameterTypeIdSerializer |
| 4771 | filter_backends = (filters.DjangoFilterBackend,) |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 4772 | 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] | 4773 | |
| 4774 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 4775 | no_hyperlinks=False |
| 4776 | if hasattr(self.request,"QUERY_PARAMS"): |
| 4777 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4778 | if (no_hyperlinks): |
| 4779 | return self.id_serializer_class |
| 4780 | else: |
| 4781 | return self.serializer_class |
| 4782 | |
| 4783 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 4784 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 4785 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4786 | return NetworkParameterType.select_by_user(self.request.user) |
| 4787 | |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4788 | |
| 4789 | class NetworkParameterTypeDetail(PlanetStackRetrieveUpdateDestroyAPIView): |
| 4790 | queryset = NetworkParameterType.objects.select_related().all() |
| 4791 | serializer_class = NetworkParameterTypeSerializer |
| 4792 | id_serializer_class = NetworkParameterTypeIdSerializer |
| 4793 | |
| 4794 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 4795 | no_hyperlinks=False |
| 4796 | if hasattr(self.request,"QUERY_PARAMS"): |
| 4797 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4798 | if (no_hyperlinks): |
| 4799 | return self.id_serializer_class |
| 4800 | else: |
| 4801 | return self.serializer_class |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 4802 | |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4803 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 4804 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 4805 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4806 | return NetworkParameterType.select_by_user(self.request.user) |
| 4807 | |
| 4808 | # update() is handled by PlanetStackRetrieveUpdateDestroyAPIView |
| 4809 | |
| 4810 | # destroy() is handled by PlanetStackRetrieveUpdateDestroyAPIView |
| 4811 | |
| 4812 | |
| 4813 | |
Scott Baker | 15af565 | 2015-02-02 14:33:08 -0800 | [diff] [blame] | 4814 | class SiteCredentialList(PlanetStackListCreateAPIView): |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4815 | queryset = SiteCredential.objects.select_related().all() |
| 4816 | serializer_class = SiteCredentialSerializer |
| 4817 | id_serializer_class = SiteCredentialIdSerializer |
| 4818 | filter_backends = (filters.DjangoFilterBackend,) |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 4819 | 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] | 4820 | |
| 4821 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 4822 | no_hyperlinks=False |
| 4823 | if hasattr(self.request,"QUERY_PARAMS"): |
| 4824 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4825 | if (no_hyperlinks): |
| 4826 | return self.id_serializer_class |
| 4827 | else: |
| 4828 | return self.serializer_class |
| 4829 | |
| 4830 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 4831 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 4832 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4833 | return SiteCredential.select_by_user(self.request.user) |
| 4834 | |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4835 | |
| 4836 | class SiteCredentialDetail(PlanetStackRetrieveUpdateDestroyAPIView): |
| 4837 | queryset = SiteCredential.objects.select_related().all() |
| 4838 | serializer_class = SiteCredentialSerializer |
| 4839 | id_serializer_class = SiteCredentialIdSerializer |
| 4840 | |
| 4841 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 4842 | no_hyperlinks=False |
| 4843 | if hasattr(self.request,"QUERY_PARAMS"): |
| 4844 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4845 | if (no_hyperlinks): |
| 4846 | return self.id_serializer_class |
| 4847 | else: |
| 4848 | return self.serializer_class |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 4849 | |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4850 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 4851 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 4852 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4853 | return SiteCredential.select_by_user(self.request.user) |
| 4854 | |
| 4855 | # update() is handled by PlanetStackRetrieveUpdateDestroyAPIView |
| 4856 | |
| 4857 | # destroy() is handled by PlanetStackRetrieveUpdateDestroyAPIView |
| 4858 | |
| 4859 | |
| 4860 | |
Scott Baker | 15af565 | 2015-02-02 14:33:08 -0800 | [diff] [blame] | 4861 | class DeploymentPrivilegeList(PlanetStackListCreateAPIView): |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 4862 | queryset = DeploymentPrivilege.objects.select_related().all() |
| 4863 | serializer_class = DeploymentPrivilegeSerializer |
| 4864 | id_serializer_class = DeploymentPrivilegeIdSerializer |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4865 | filter_backends = (filters.DjangoFilterBackend,) |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 4866 | 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] | 4867 | |
| 4868 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 4869 | no_hyperlinks=False |
| 4870 | if hasattr(self.request,"QUERY_PARAMS"): |
| 4871 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4872 | if (no_hyperlinks): |
| 4873 | return self.id_serializer_class |
| 4874 | else: |
| 4875 | return self.serializer_class |
| 4876 | |
| 4877 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 4878 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 4879 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 4880 | return DeploymentPrivilege.select_by_user(self.request.user) |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4881 | |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4882 | |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 4883 | class DeploymentPrivilegeDetail(PlanetStackRetrieveUpdateDestroyAPIView): |
| 4884 | queryset = DeploymentPrivilege.objects.select_related().all() |
| 4885 | serializer_class = DeploymentPrivilegeSerializer |
| 4886 | id_serializer_class = DeploymentPrivilegeIdSerializer |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4887 | |
| 4888 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 4889 | no_hyperlinks=False |
| 4890 | if hasattr(self.request,"QUERY_PARAMS"): |
| 4891 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4892 | if (no_hyperlinks): |
| 4893 | return self.id_serializer_class |
| 4894 | else: |
| 4895 | return self.serializer_class |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 4896 | |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4897 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 4898 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 4899 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 4900 | return DeploymentPrivilege.select_by_user(self.request.user) |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 4901 | |
| 4902 | # update() is handled by PlanetStackRetrieveUpdateDestroyAPIView |
| 4903 | |
| 4904 | # destroy() is handled by PlanetStackRetrieveUpdateDestroyAPIView |
| 4905 | |
| 4906 | |
| 4907 | |
Scott Baker | 15af565 | 2015-02-02 14:33:08 -0800 | [diff] [blame] | 4908 | class ControllerSlicePrivilegeList(PlanetStackListCreateAPIView): |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 4909 | queryset = ControllerSlicePrivilege.objects.select_related().all() |
| 4910 | serializer_class = ControllerSlicePrivilegeSerializer |
| 4911 | id_serializer_class = ControllerSlicePrivilegeIdSerializer |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 4912 | filter_backends = (filters.DjangoFilterBackend,) |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 4913 | 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] | 4914 | |
| 4915 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 4916 | no_hyperlinks=False |
| 4917 | if hasattr(self.request,"QUERY_PARAMS"): |
| 4918 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 4919 | if (no_hyperlinks): |
| 4920 | return self.id_serializer_class |
| 4921 | else: |
| 4922 | return self.serializer_class |
| 4923 | |
| 4924 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 4925 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 4926 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 4927 | return ControllerSlicePrivilege.select_by_user(self.request.user) |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 4928 | |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 4929 | |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 4930 | class ControllerSlicePrivilegeDetail(PlanetStackRetrieveUpdateDestroyAPIView): |
| 4931 | queryset = ControllerSlicePrivilege.objects.select_related().all() |
| 4932 | serializer_class = ControllerSlicePrivilegeSerializer |
| 4933 | id_serializer_class = ControllerSlicePrivilegeIdSerializer |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 4934 | |
| 4935 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 4936 | no_hyperlinks=False |
| 4937 | if hasattr(self.request,"QUERY_PARAMS"): |
| 4938 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 4939 | if (no_hyperlinks): |
| 4940 | return self.id_serializer_class |
| 4941 | else: |
| 4942 | return self.serializer_class |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 4943 | |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 4944 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 4945 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 4946 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 4947 | return ControllerSlicePrivilege.select_by_user(self.request.user) |
| 4948 | |
| 4949 | # update() is handled by PlanetStackRetrieveUpdateDestroyAPIView |
| 4950 | |
| 4951 | # destroy() is handled by PlanetStackRetrieveUpdateDestroyAPIView |
| 4952 | |
| 4953 | |
| 4954 | |
Scott Baker | 15af565 | 2015-02-02 14:33:08 -0800 | [diff] [blame] | 4955 | class SiteDeploymentList(PlanetStackListCreateAPIView): |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 4956 | queryset = SiteDeployment.objects.select_related().all() |
| 4957 | serializer_class = SiteDeploymentSerializer |
| 4958 | id_serializer_class = SiteDeploymentIdSerializer |
| 4959 | filter_backends = (filters.DjangoFilterBackend,) |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 4960 | 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] | 4961 | |
| 4962 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 4963 | no_hyperlinks=False |
| 4964 | if hasattr(self.request,"QUERY_PARAMS"): |
| 4965 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 4966 | if (no_hyperlinks): |
| 4967 | return self.id_serializer_class |
| 4968 | else: |
| 4969 | return self.serializer_class |
| 4970 | |
| 4971 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 4972 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 4973 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 4974 | return SiteDeployment.select_by_user(self.request.user) |
| 4975 | |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 4976 | |
| 4977 | class SiteDeploymentDetail(PlanetStackRetrieveUpdateDestroyAPIView): |
| 4978 | queryset = SiteDeployment.objects.select_related().all() |
| 4979 | serializer_class = SiteDeploymentSerializer |
| 4980 | id_serializer_class = SiteDeploymentIdSerializer |
| 4981 | |
| 4982 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 4983 | no_hyperlinks=False |
| 4984 | if hasattr(self.request,"QUERY_PARAMS"): |
| 4985 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 4986 | if (no_hyperlinks): |
| 4987 | return self.id_serializer_class |
| 4988 | else: |
| 4989 | return self.serializer_class |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 4990 | |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 4991 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 4992 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 4993 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 191f9b2 | 2015-01-12 13:16:39 -0800 | [diff] [blame] | 4994 | return SiteDeployment.select_by_user(self.request.user) |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 4995 | |
| 4996 | # update() is handled by PlanetStackRetrieveUpdateDestroyAPIView |
| 4997 | |
| 4998 | # destroy() is handled by PlanetStackRetrieveUpdateDestroyAPIView |
| 4999 | |
| 5000 | |
| 5001 | |
Scott Baker | 15af565 | 2015-02-02 14:33:08 -0800 | [diff] [blame] | 5002 | class DeploymentRoleList(PlanetStackListCreateAPIView): |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 5003 | queryset = DeploymentRole.objects.select_related().all() |
| 5004 | serializer_class = DeploymentRoleSerializer |
| 5005 | id_serializer_class = DeploymentRoleIdSerializer |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 5006 | filter_backends = (filters.DjangoFilterBackend,) |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 5007 | 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] | 5008 | |
| 5009 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 5010 | no_hyperlinks=False |
| 5011 | if hasattr(self.request,"QUERY_PARAMS"): |
| 5012 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 5013 | if (no_hyperlinks): |
| 5014 | return self.id_serializer_class |
| 5015 | else: |
| 5016 | return self.serializer_class |
| 5017 | |
| 5018 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 5019 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 5020 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 5021 | return DeploymentRole.select_by_user(self.request.user) |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 5022 | |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 5023 | |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 5024 | class DeploymentRoleDetail(PlanetStackRetrieveUpdateDestroyAPIView): |
| 5025 | queryset = DeploymentRole.objects.select_related().all() |
| 5026 | serializer_class = DeploymentRoleSerializer |
| 5027 | id_serializer_class = DeploymentRoleIdSerializer |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 5028 | |
| 5029 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 5030 | no_hyperlinks=False |
| 5031 | if hasattr(self.request,"QUERY_PARAMS"): |
| 5032 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 5033 | if (no_hyperlinks): |
| 5034 | return self.id_serializer_class |
| 5035 | else: |
| 5036 | return self.serializer_class |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 5037 | |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 5038 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 5039 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 5040 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 515dc9e | 2014-12-22 09:29:05 -0800 | [diff] [blame] | 5041 | return DeploymentRole.select_by_user(self.request.user) |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 5042 | |
| 5043 | # update() is handled by PlanetStackRetrieveUpdateDestroyAPIView |
| 5044 | |
| 5045 | # destroy() is handled by PlanetStackRetrieveUpdateDestroyAPIView |
| 5046 | |
| 5047 | |
| 5048 | |
Scott Baker | 15af565 | 2015-02-02 14:33:08 -0800 | [diff] [blame] | 5049 | class UserCredentialList(PlanetStackListCreateAPIView): |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 5050 | queryset = UserCredential.objects.select_related().all() |
| 5051 | serializer_class = UserCredentialSerializer |
| 5052 | id_serializer_class = UserCredentialIdSerializer |
| 5053 | filter_backends = (filters.DjangoFilterBackend,) |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 5054 | 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] | 5055 | |
| 5056 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 5057 | no_hyperlinks=False |
| 5058 | if hasattr(self.request,"QUERY_PARAMS"): |
| 5059 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 5060 | if (no_hyperlinks): |
| 5061 | return self.id_serializer_class |
| 5062 | else: |
| 5063 | return self.serializer_class |
| 5064 | |
| 5065 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 5066 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 5067 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 5068 | return UserCredential.select_by_user(self.request.user) |
| 5069 | |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 5070 | |
| 5071 | class UserCredentialDetail(PlanetStackRetrieveUpdateDestroyAPIView): |
| 5072 | queryset = UserCredential.objects.select_related().all() |
| 5073 | serializer_class = UserCredentialSerializer |
| 5074 | id_serializer_class = UserCredentialIdSerializer |
| 5075 | |
| 5076 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 5077 | no_hyperlinks=False |
| 5078 | if hasattr(self.request,"QUERY_PARAMS"): |
| 5079 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 5080 | if (no_hyperlinks): |
| 5081 | return self.id_serializer_class |
| 5082 | else: |
| 5083 | return self.serializer_class |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 5084 | |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 5085 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 5086 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 5087 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 5088 | return UserCredential.select_by_user(self.request.user) |
| 5089 | |
| 5090 | # update() is handled by PlanetStackRetrieveUpdateDestroyAPIView |
| 5091 | |
| 5092 | # destroy() is handled by PlanetStackRetrieveUpdateDestroyAPIView |
| 5093 | |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 5094 | |
Scott Baker | 57c725c | 2014-11-12 01:13:53 -0800 | [diff] [blame] | 5095 | |
Scott Baker | 15af565 | 2015-02-02 14:33:08 -0800 | [diff] [blame] | 5096 | class SliceTagList(PlanetStackListCreateAPIView): |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 5097 | queryset = SliceTag.objects.select_related().all() |
| 5098 | serializer_class = SliceTagSerializer |
Scott Baker | 46b5854 | 2014-08-11 17:26:12 -0700 | [diff] [blame] | 5099 | id_serializer_class = SliceTagIdSerializer |
| 5100 | filter_backends = (filters.DjangoFilterBackend,) |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 5101 | 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] | 5102 | |
| 5103 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 5104 | no_hyperlinks=False |
| 5105 | if hasattr(self.request,"QUERY_PARAMS"): |
| 5106 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 46b5854 | 2014-08-11 17:26:12 -0700 | [diff] [blame] | 5107 | if (no_hyperlinks): |
| 5108 | return self.id_serializer_class |
| 5109 | else: |
| 5110 | return self.serializer_class |
| 5111 | |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 5112 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 5113 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 5114 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 5115 | return SliceTag.select_by_user(self.request.user) |
Sapan Bhatia | dea3943 | 2014-06-13 03:10:36 -0400 | [diff] [blame] | 5116 | |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 5117 | |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 5118 | class SliceTagDetail(PlanetStackRetrieveUpdateDestroyAPIView): |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 5119 | queryset = SliceTag.objects.select_related().all() |
| 5120 | serializer_class = SliceTagSerializer |
Scott Baker | 46b5854 | 2014-08-11 17:26:12 -0700 | [diff] [blame] | 5121 | id_serializer_class = SliceTagIdSerializer |
| 5122 | |
| 5123 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 5124 | no_hyperlinks=False |
| 5125 | if hasattr(self.request,"QUERY_PARAMS"): |
| 5126 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 46b5854 | 2014-08-11 17:26:12 -0700 | [diff] [blame] | 5127 | if (no_hyperlinks): |
| 5128 | return self.id_serializer_class |
| 5129 | else: |
| 5130 | return self.serializer_class |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 5131 | |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 5132 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 5133 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 5134 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 5135 | return SliceTag.select_by_user(self.request.user) |
| 5136 | |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 5137 | # update() is handled by PlanetStackRetrieveUpdateDestroyAPIView |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 5138 | |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 5139 | # destroy() is handled by PlanetStackRetrieveUpdateDestroyAPIView |
Sapan Bhatia | dea3943 | 2014-06-13 03:10:36 -0400 | [diff] [blame] | 5140 | |
| 5141 | |
| 5142 | |
Scott Baker | 15af565 | 2015-02-02 14:33:08 -0800 | [diff] [blame] | 5143 | class NetworkTemplateList(PlanetStackListCreateAPIView): |
Scott Baker | f2c0c51 | 2014-12-22 17:35:34 -0800 | [diff] [blame] | 5144 | queryset = NetworkTemplate.objects.select_related().all() |
| 5145 | serializer_class = NetworkTemplateSerializer |
| 5146 | id_serializer_class = NetworkTemplateIdSerializer |
Scott Baker | 46b5854 | 2014-08-11 17:26:12 -0700 | [diff] [blame] | 5147 | filter_backends = (filters.DjangoFilterBackend,) |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 5148 | 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] | 5149 | |
| 5150 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 5151 | no_hyperlinks=False |
| 5152 | if hasattr(self.request,"QUERY_PARAMS"): |
| 5153 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 46b5854 | 2014-08-11 17:26:12 -0700 | [diff] [blame] | 5154 | if (no_hyperlinks): |
| 5155 | return self.id_serializer_class |
| 5156 | else: |
| 5157 | return self.serializer_class |
| 5158 | |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 5159 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 5160 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 5161 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | f2c0c51 | 2014-12-22 17:35:34 -0800 | [diff] [blame] | 5162 | return NetworkTemplate.select_by_user(self.request.user) |
Sapan Bhatia | dea3943 | 2014-06-13 03:10:36 -0400 | [diff] [blame] | 5163 | |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 5164 | |
Scott Baker | f2c0c51 | 2014-12-22 17:35:34 -0800 | [diff] [blame] | 5165 | class NetworkTemplateDetail(PlanetStackRetrieveUpdateDestroyAPIView): |
| 5166 | queryset = NetworkTemplate.objects.select_related().all() |
| 5167 | serializer_class = NetworkTemplateSerializer |
| 5168 | id_serializer_class = NetworkTemplateIdSerializer |
Scott Baker | 46b5854 | 2014-08-11 17:26:12 -0700 | [diff] [blame] | 5169 | |
| 5170 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 5171 | no_hyperlinks=False |
| 5172 | if hasattr(self.request,"QUERY_PARAMS"): |
| 5173 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 46b5854 | 2014-08-11 17:26:12 -0700 | [diff] [blame] | 5174 | if (no_hyperlinks): |
| 5175 | return self.id_serializer_class |
| 5176 | else: |
| 5177 | return self.serializer_class |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 5178 | |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 5179 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 5180 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 5181 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | f2c0c51 | 2014-12-22 17:35:34 -0800 | [diff] [blame] | 5182 | return NetworkTemplate.select_by_user(self.request.user) |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 5183 | |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 5184 | # update() is handled by PlanetStackRetrieveUpdateDestroyAPIView |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 5185 | |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 5186 | # destroy() is handled by PlanetStackRetrieveUpdateDestroyAPIView |
Sapan Bhatia | dea3943 | 2014-06-13 03:10:36 -0400 | [diff] [blame] | 5187 | |
| 5188 | |
| 5189 | |
Scott Baker | 15af565 | 2015-02-02 14:33:08 -0800 | [diff] [blame] | 5190 | class RouterList(PlanetStackListCreateAPIView): |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 5191 | queryset = Router.objects.select_related().all() |
Sapan Bhatia | dea3943 | 2014-06-13 03:10:36 -0400 | [diff] [blame] | 5192 | serializer_class = RouterSerializer |
Scott Baker | 46b5854 | 2014-08-11 17:26:12 -0700 | [diff] [blame] | 5193 | id_serializer_class = RouterIdSerializer |
| 5194 | filter_backends = (filters.DjangoFilterBackend,) |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 5195 | 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] | 5196 | |
| 5197 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 5198 | no_hyperlinks=False |
| 5199 | if hasattr(self.request,"QUERY_PARAMS"): |
| 5200 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 46b5854 | 2014-08-11 17:26:12 -0700 | [diff] [blame] | 5201 | if (no_hyperlinks): |
| 5202 | return self.id_serializer_class |
| 5203 | else: |
| 5204 | return self.serializer_class |
| 5205 | |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 5206 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 5207 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 5208 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 5209 | return Router.select_by_user(self.request.user) |
| 5210 | |
Sapan Bhatia | dea3943 | 2014-06-13 03:10:36 -0400 | [diff] [blame] | 5211 | |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 5212 | class RouterDetail(PlanetStackRetrieveUpdateDestroyAPIView): |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 5213 | queryset = Router.objects.select_related().all() |
Sapan Bhatia | dea3943 | 2014-06-13 03:10:36 -0400 | [diff] [blame] | 5214 | serializer_class = RouterSerializer |
Scott Baker | 46b5854 | 2014-08-11 17:26:12 -0700 | [diff] [blame] | 5215 | id_serializer_class = RouterIdSerializer |
| 5216 | |
| 5217 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 5218 | no_hyperlinks=False |
| 5219 | if hasattr(self.request,"QUERY_PARAMS"): |
| 5220 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 46b5854 | 2014-08-11 17:26:12 -0700 | [diff] [blame] | 5221 | if (no_hyperlinks): |
| 5222 | return self.id_serializer_class |
| 5223 | else: |
| 5224 | return self.serializer_class |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 5225 | |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 5226 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 5227 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 5228 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 5229 | return Router.select_by_user(self.request.user) |
| 5230 | |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 5231 | # update() is handled by PlanetStackRetrieveUpdateDestroyAPIView |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 5232 | |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 5233 | # destroy() is handled by PlanetStackRetrieveUpdateDestroyAPIView |
Sapan Bhatia | dea3943 | 2014-06-13 03:10:36 -0400 | [diff] [blame] | 5234 | |
| 5235 | |
| 5236 | |
Scott Baker | 15af565 | 2015-02-02 14:33:08 -0800 | [diff] [blame] | 5237 | class ServiceResourceList(PlanetStackListCreateAPIView): |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 5238 | queryset = ServiceResource.objects.select_related().all() |
| 5239 | serializer_class = ServiceResourceSerializer |
Scott Baker | 46b5854 | 2014-08-11 17:26:12 -0700 | [diff] [blame] | 5240 | id_serializer_class = ServiceResourceIdSerializer |
| 5241 | filter_backends = (filters.DjangoFilterBackend,) |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 5242 | 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] | 5243 | |
| 5244 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 5245 | no_hyperlinks=False |
| 5246 | if hasattr(self.request,"QUERY_PARAMS"): |
| 5247 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 46b5854 | 2014-08-11 17:26:12 -0700 | [diff] [blame] | 5248 | if (no_hyperlinks): |
| 5249 | return self.id_serializer_class |
| 5250 | else: |
| 5251 | return self.serializer_class |
| 5252 | |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 5253 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 5254 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 5255 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 5256 | return ServiceResource.select_by_user(self.request.user) |
Sapan Bhatia | dea3943 | 2014-06-13 03:10:36 -0400 | [diff] [blame] | 5257 | |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 5258 | |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 5259 | class ServiceResourceDetail(PlanetStackRetrieveUpdateDestroyAPIView): |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 5260 | queryset = ServiceResource.objects.select_related().all() |
| 5261 | serializer_class = ServiceResourceSerializer |
Scott Baker | 46b5854 | 2014-08-11 17:26:12 -0700 | [diff] [blame] | 5262 | id_serializer_class = ServiceResourceIdSerializer |
| 5263 | |
| 5264 | def get_serializer_class(self): |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 5265 | no_hyperlinks=False |
| 5266 | if hasattr(self.request,"QUERY_PARAMS"): |
| 5267 | no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False) |
Scott Baker | 46b5854 | 2014-08-11 17:26:12 -0700 | [diff] [blame] | 5268 | if (no_hyperlinks): |
| 5269 | return self.id_serializer_class |
| 5270 | else: |
| 5271 | return self.serializer_class |
Scott Baker | 84cf39e | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 5272 | |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 5273 | def get_queryset(self): |
Scott Baker | 20101af | 2015-02-02 10:41:12 -0800 | [diff] [blame] | 5274 | if (not self.request.user.is_authenticated()): |
Scott Baker | 4af864e | 2015-02-02 13:53:46 -0800 | [diff] [blame] | 5275 | raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API") |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 5276 | return ServiceResource.select_by_user(self.request.user) |
| 5277 | |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 5278 | # update() is handled by PlanetStackRetrieveUpdateDestroyAPIView |
Scott Baker | 0caeaf0 | 2014-06-19 11:12:55 -0700 | [diff] [blame] | 5279 | |
Scott Baker | 89a7b7c | 2014-10-07 00:10:17 -0700 | [diff] [blame] | 5280 | # destroy() is handled by PlanetStackRetrieveUpdateDestroyAPIView |
Sapan Bhatia | dea3943 | 2014-06-13 03:10:36 -0400 | [diff] [blame] | 5281 | |
Sapan Bhatia | dea3943 | 2014-06-13 03:10:36 -0400 | [diff] [blame] | 5282 | |
| 5283 | |