blob: 0d35c780df5084ba2dd53b82fe38e13ddfc3116a [file] [log] [blame]
Sapan Bhatiadea39432014-06-13 03:10:36 -04001from rest_framework.decorators import api_view
2from rest_framework.response import Response
3from rest_framework.reverse import reverse
4from rest_framework import serializers
Scott Baker0caeaf02014-06-19 11:12:55 -07005from rest_framework import generics
Scott Baker89a7b7c2014-10-07 00:10:17 -07006from rest_framework import status
Scott Baker57c725c2014-11-12 01:13:53 -08007from rest_framework.generics import GenericAPIView
Sapan Bhatiadea39432014-06-13 03:10:36 -04008from core.models import *
9from django.forms import widgets
Scott Baker46b58542014-08-11 17:26:12 -070010from rest_framework import filters
Scott Bakerd51d0bd2014-11-10 16:31:15 -080011from django.conf.urls import patterns, url
Scott Baker4af864e2015-02-02 13:53:46 -080012from rest_framework.exceptions import PermissionDenied as RestFrameworkPermissionDenied
Scott Baker15af5652015-02-02 14:33:08 -080013from django.core.exceptions import PermissionDenied as DjangoPermissionDenied
Scott Baker72758c72015-02-10 19:26:35 -080014from xosapibase import XOSRetrieveUpdateDestroyAPIView, XOSListCreateAPIView
Sapan Bhatiadea39432014-06-13 03:10:36 -040015
Scott Bakerf0480fb2014-12-23 11:12:07 -080016if hasattr(serializers, "ReadOnlyField"):
17 # rest_framework 3.x
18 IdField = serializers.ReadOnlyField
19else:
20 # rest_framework 2.x
21 IdField = serializers.Field
22
Sapan Bhatiadea39432014-06-13 03:10:36 -040023"""
Scott Baker2bcbf372014-10-29 23:41:11 -070024 Schema of the generator object:
25 all: Set of all Model objects
26 all_if(regex): Set of Model objects that match regex
Scott Baker57c725c2014-11-12 01:13:53 -080027
Scott Baker2bcbf372014-10-29 23:41:11 -070028 Model object:
29 plural: English plural of object name
30 camel: CamelCase version of object name
31 refs: list of references to other Model objects
32 props: list of properties minus refs
Sapan Bhatiadea39432014-06-13 03:10:36 -040033
Scott Baker2bcbf372014-10-29 23:41:11 -070034 TODO: Deal with subnets
Sapan Bhatiadea39432014-06-13 03:10:36 -040035"""
36
Scott Bakerd51d0bd2014-11-10 16:31:15 -080037def get_REST_patterns():
38 return patterns('',
Scott Baker1faefd32015-02-02 15:53:37 -080039 url(r'^xos/$', api_root),
Scott Bakerd51d0bd2014-11-10 16:31:15 -080040
Scott Baker1faefd32015-02-02 15:53:37 -080041 url(r'xos/serviceattributes/$', ServiceAttributeList.as_view(), name='serviceattribute-list'),
42 url(r'xos/serviceattributes/(?P<pk>[a-zA-Z0-9\-]+)/$', ServiceAttributeDetail.as_view(), name ='serviceattribute-detail'),
Scott Bakerd51d0bd2014-11-10 16:31:15 -080043
Scott Baker1faefd32015-02-02 15:53:37 -080044 url(r'xos/controllerimages/$', ControllerImagesList.as_view(), name='controllerimages-list'),
45 url(r'xos/controllerimages/(?P<pk>[a-zA-Z0-9\-]+)/$', ControllerImagesDetail.as_view(), name ='controllerimages-detail'),
Scott Baker515dc9e2014-12-22 09:29:05 -080046
Scott Baker1faefd32015-02-02 15:53:37 -080047 url(r'xos/controllersiteprivileges/$', ControllerSitePrivilegeList.as_view(), name='controllersiteprivilege-list'),
48 url(r'xos/controllersiteprivileges/(?P<pk>[a-zA-Z0-9\-]+)/$', ControllerSitePrivilegeDetail.as_view(), name ='controllersiteprivilege-detail'),
Scott Baker191f9b22015-01-12 13:16:39 -080049
Scott Baker1faefd32015-02-02 15:53:37 -080050 url(r'xos/images/$', ImageList.as_view(), name='image-list'),
51 url(r'xos/images/(?P<pk>[a-zA-Z0-9\-]+)/$', ImageDetail.as_view(), name ='image-detail'),
Scott Bakerd51d0bd2014-11-10 16:31:15 -080052
Scott Baker1faefd32015-02-02 15:53:37 -080053 url(r'xos/networkparameters/$', NetworkParameterList.as_view(), name='networkparameter-list'),
54 url(r'xos/networkparameters/(?P<pk>[a-zA-Z0-9\-]+)/$', NetworkParameterDetail.as_view(), name ='networkparameter-detail'),
Scott Bakerd51d0bd2014-11-10 16:31:15 -080055
Scott Baker1faefd32015-02-02 15:53:37 -080056 url(r'xos/sites/$', SiteList.as_view(), name='site-list'),
57 url(r'xos/sites/(?P<pk>[a-zA-Z0-9\-]+)/$', SiteDetail.as_view(), name ='site-detail'),
Scott Bakerd51d0bd2014-11-10 16:31:15 -080058
Scott Baker1faefd32015-02-02 15:53:37 -080059 url(r'xos/slice_roles/$', SliceRoleList.as_view(), name='slicerole-list'),
60 url(r'xos/slice_roles/(?P<pk>[a-zA-Z0-9\-]+)/$', SliceRoleDetail.as_view(), name ='slicerole-detail'),
Scott Bakerd51d0bd2014-11-10 16:31:15 -080061
Scott Baker1faefd32015-02-02 15:53:37 -080062 url(r'xos/tags/$', TagList.as_view(), name='tag-list'),
63 url(r'xos/tags/(?P<pk>[a-zA-Z0-9\-]+)/$', TagDetail.as_view(), name ='tag-detail'),
Scott Bakerd51d0bd2014-11-10 16:31:15 -080064
Scott Baker1faefd32015-02-02 15:53:37 -080065 url(r'xos/invoices/$', InvoiceList.as_view(), name='invoice-list'),
66 url(r'xos/invoices/(?P<pk>[a-zA-Z0-9\-]+)/$', InvoiceDetail.as_view(), name ='invoice-detail'),
Scott Bakerd51d0bd2014-11-10 16:31:15 -080067
Scott Baker1faefd32015-02-02 15:53:37 -080068 url(r'xos/slice_privileges/$', SlicePrivilegeList.as_view(), name='sliceprivilege-list'),
69 url(r'xos/slice_privileges/(?P<pk>[a-zA-Z0-9\-]+)/$', SlicePrivilegeDetail.as_view(), name ='sliceprivilege-detail'),
Scott Bakerd51d0bd2014-11-10 16:31:15 -080070
Scott Baker1faefd32015-02-02 15:53:37 -080071 url(r'xos/planetstackroles/$', PlanetStackRoleList.as_view(), name='planetstackrole-list'),
72 url(r'xos/planetstackroles/(?P<pk>[a-zA-Z0-9\-]+)/$', PlanetStackRoleDetail.as_view(), name ='planetstackrole-detail'),
Scott Bakerd51d0bd2014-11-10 16:31:15 -080073
Scott Baker1faefd32015-02-02 15:53:37 -080074 url(r'xos/networkslivers/$', NetworkSliverList.as_view(), name='networksliver-list'),
75 url(r'xos/networkslivers/(?P<pk>[a-zA-Z0-9\-]+)/$', NetworkSliverDetail.as_view(), name ='networksliver-detail'),
Scott Bakerd51d0bd2014-11-10 16:31:15 -080076
Scott Baker1faefd32015-02-02 15:53:37 -080077 url(r'xos/flavors/$', FlavorList.as_view(), name='flavor-list'),
78 url(r'xos/flavors/(?P<pk>[a-zA-Z0-9\-]+)/$', FlavorDetail.as_view(), name ='flavor-detail'),
Scott Baker191f9b22015-01-12 13:16:39 -080079
Scott Baker1faefd32015-02-02 15:53:37 -080080 url(r'xos/controllersites/$', ControllerSiteList.as_view(), name='controllersite-list'),
81 url(r'xos/controllersites/(?P<pk>[a-zA-Z0-9\-]+)/$', ControllerSiteDetail.as_view(), name ='controllersite-detail'),
Scott Baker191f9b22015-01-12 13:16:39 -080082
Scott Baker1faefd32015-02-02 15:53:37 -080083 url(r'xos/projects/$', ProjectList.as_view(), name='project-list'),
84 url(r'xos/projects/(?P<pk>[a-zA-Z0-9\-]+)/$', ProjectDetail.as_view(), name ='project-detail'),
Scott Bakerd51d0bd2014-11-10 16:31:15 -080085
Scott Baker1faefd32015-02-02 15:53:37 -080086 url(r'xos/slices/$', SliceList.as_view(), name='slice-list'),
87 url(r'xos/slices/(?P<pk>[a-zA-Z0-9\-]+)/$', SliceDetail.as_view(), name ='slice-detail'),
Scott Bakerd51d0bd2014-11-10 16:31:15 -080088
Scott Baker1faefd32015-02-02 15:53:37 -080089 url(r'xos/networks/$', NetworkList.as_view(), name='network-list'),
90 url(r'xos/networks/(?P<pk>[a-zA-Z0-9\-]+)/$', NetworkDetail.as_view(), name ='network-detail'),
Scott Bakerd51d0bd2014-11-10 16:31:15 -080091
Scott Baker1faefd32015-02-02 15:53:37 -080092 url(r'xos/services/$', ServiceList.as_view(), name='service-list'),
93 url(r'xos/services/(?P<pk>[a-zA-Z0-9\-]+)/$', ServiceDetail.as_view(), name ='service-detail'),
Scott Bakerd51d0bd2014-11-10 16:31:15 -080094
Scott Baker1faefd32015-02-02 15:53:37 -080095 url(r'xos/serviceclasses/$', ServiceClassList.as_view(), name='serviceclass-list'),
96 url(r'xos/serviceclasses/(?P<pk>[a-zA-Z0-9\-]+)/$', ServiceClassDetail.as_view(), name ='serviceclass-detail'),
Scott Bakerd51d0bd2014-11-10 16:31:15 -080097
Scott Baker1faefd32015-02-02 15:53:37 -080098 url(r'xos/planetstacks/$', PlanetStackList.as_view(), name='planetstack-list'),
99 url(r'xos/planetstacks/(?P<pk>[a-zA-Z0-9\-]+)/$', PlanetStackDetail.as_view(), name ='planetstack-detail'),
Scott Bakerd51d0bd2014-11-10 16:31:15 -0800100
Scott Baker1faefd32015-02-02 15:53:37 -0800101 url(r'xos/charges/$', ChargeList.as_view(), name='charge-list'),
102 url(r'xos/charges/(?P<pk>[a-zA-Z0-9\-]+)/$', ChargeDetail.as_view(), name ='charge-detail'),
Scott Bakerd51d0bd2014-11-10 16:31:15 -0800103
Scott Baker1faefd32015-02-02 15:53:37 -0800104 url(r'xos/roles/$', RoleList.as_view(), name='role-list'),
105 url(r'xos/roles/(?P<pk>[a-zA-Z0-9\-]+)/$', RoleDetail.as_view(), name ='role-detail'),
Scott Bakerd51d0bd2014-11-10 16:31:15 -0800106
Scott Baker1faefd32015-02-02 15:53:37 -0800107 url(r'xos/usableobjects/$', UsableObjectList.as_view(), name='usableobject-list'),
108 url(r'xos/usableobjects/(?P<pk>[a-zA-Z0-9\-]+)/$', UsableObjectDetail.as_view(), name ='usableobject-detail'),
Scott Bakerd51d0bd2014-11-10 16:31:15 -0800109
Scott Baker1faefd32015-02-02 15:53:37 -0800110 url(r'xos/site_roles/$', SiteRoleList.as_view(), name='siterole-list'),
111 url(r'xos/site_roles/(?P<pk>[a-zA-Z0-9\-]+)/$', SiteRoleDetail.as_view(), name ='siterole-detail'),
Scott Bakerd51d0bd2014-11-10 16:31:15 -0800112
Scott Baker1faefd32015-02-02 15:53:37 -0800113 url(r'xos/slicecredentials/$', SliceCredentialList.as_view(), name='slicecredential-list'),
114 url(r'xos/slicecredentials/(?P<pk>[a-zA-Z0-9\-]+)/$', SliceCredentialDetail.as_view(), name ='slicecredential-detail'),
Scott Bakerd51d0bd2014-11-10 16:31:15 -0800115
Scott Baker1faefd32015-02-02 15:53:37 -0800116 url(r'xos/slivers/$', SliverList.as_view(), name='sliver-list'),
117 url(r'xos/slivers/(?P<pk>[a-zA-Z0-9\-]+)/$', SliverDetail.as_view(), name ='sliver-detail'),
Scott Bakerd51d0bd2014-11-10 16:31:15 -0800118
Scott Baker1faefd32015-02-02 15:53:37 -0800119 url(r'xos/nodes/$', NodeList.as_view(), name='node-list'),
120 url(r'xos/nodes/(?P<pk>[a-zA-Z0-9\-]+)/$', NodeDetail.as_view(), name ='node-detail'),
Scott Bakerd51d0bd2014-11-10 16:31:15 -0800121
Scott Baker1faefd32015-02-02 15:53:37 -0800122 url(r'xos/dashboardviews/$', DashboardViewList.as_view(), name='dashboardview-list'),
123 url(r'xos/dashboardviews/(?P<pk>[a-zA-Z0-9\-]+)/$', DashboardViewDetail.as_view(), name ='dashboardview-detail'),
Scott Bakerd51d0bd2014-11-10 16:31:15 -0800124
Scott Baker1faefd32015-02-02 15:53:37 -0800125 url(r'xos/controllernetworks/$', ControllerNetworkList.as_view(), name='controllernetwork-list'),
126 url(r'xos/controllernetworks/(?P<pk>[a-zA-Z0-9\-]+)/$', ControllerNetworkDetail.as_view(), name ='controllernetwork-detail'),
Scott Baker191f9b22015-01-12 13:16:39 -0800127
Scott Baker1faefd32015-02-02 15:53:37 -0800128 url(r'xos/imagedeploymentses/$', ImageDeploymentsList.as_view(), name='imagedeployments-list'),
129 url(r'xos/imagedeploymentses/(?P<pk>[a-zA-Z0-9\-]+)/$', ImageDeploymentsDetail.as_view(), name ='imagedeployments-detail'),
Scott Bakerb744f1c2014-11-21 11:32:24 -0800130
Scott Baker1faefd32015-02-02 15:53:37 -0800131 url(r'xos/controllerusers/$', ControllerUserList.as_view(), name='controlleruser-list'),
132 url(r'xos/controllerusers/(?P<pk>[a-zA-Z0-9\-]+)/$', ControllerUserDetail.as_view(), name ='controlleruser-detail'),
Scott Baker191f9b22015-01-12 13:16:39 -0800133
Scott Baker1faefd32015-02-02 15:53:37 -0800134 url(r'xos/reservedresources/$', ReservedResourceList.as_view(), name='reservedresource-list'),
135 url(r'xos/reservedresources/(?P<pk>[a-zA-Z0-9\-]+)/$', ReservedResourceDetail.as_view(), name ='reservedresource-detail'),
Scott Bakerd51d0bd2014-11-10 16:31:15 -0800136
Scott Baker1faefd32015-02-02 15:53:37 -0800137 url(r'xos/payments/$', PaymentList.as_view(), name='payment-list'),
138 url(r'xos/payments/(?P<pk>[a-zA-Z0-9\-]+)/$', PaymentDetail.as_view(), name ='payment-detail'),
Scott Baker515dc9e2014-12-22 09:29:05 -0800139
Scott Baker1faefd32015-02-02 15:53:37 -0800140 url(r'xos/networkslices/$', NetworkSliceList.as_view(), name='networkslice-list'),
141 url(r'xos/networkslices/(?P<pk>[a-zA-Z0-9\-]+)/$', NetworkSliceDetail.as_view(), name ='networkslice-detail'),
Scott Bakerd51d0bd2014-11-10 16:31:15 -0800142
Scott Baker1faefd32015-02-02 15:53:37 -0800143 url(r'xos/userdashboardviews/$', UserDashboardViewList.as_view(), name='userdashboardview-list'),
144 url(r'xos/userdashboardviews/(?P<pk>[a-zA-Z0-9\-]+)/$', UserDashboardViewDetail.as_view(), name ='userdashboardview-detail'),
Scott Bakerd51d0bd2014-11-10 16:31:15 -0800145
Scott Baker1faefd32015-02-02 15:53:37 -0800146 url(r'xos/controllers/$', ControllerList.as_view(), name='controller-list'),
147 url(r'xos/controllers/(?P<pk>[a-zA-Z0-9\-]+)/$', ControllerDetail.as_view(), name ='controller-detail'),
Scott Baker515dc9e2014-12-22 09:29:05 -0800148
Scott Baker1faefd32015-02-02 15:53:37 -0800149 url(r'xos/planetstackprivileges/$', PlanetStackPrivilegeList.as_view(), name='planetstackprivilege-list'),
150 url(r'xos/planetstackprivileges/(?P<pk>[a-zA-Z0-9\-]+)/$', PlanetStackPrivilegeDetail.as_view(), name ='planetstackprivilege-detail'),
Scott Bakerd51d0bd2014-11-10 16:31:15 -0800151
Scott Baker1faefd32015-02-02 15:53:37 -0800152 url(r'xos/users/$', UserList.as_view(), name='user-list'),
153 url(r'xos/users/(?P<pk>[a-zA-Z0-9\-]+)/$', UserDetail.as_view(), name ='user-detail'),
Scott Bakerd51d0bd2014-11-10 16:31:15 -0800154
Scott Baker1faefd32015-02-02 15:53:37 -0800155 url(r'xos/deployments/$', DeploymentList.as_view(), name='deployment-list'),
156 url(r'xos/deployments/(?P<pk>[a-zA-Z0-9\-]+)/$', DeploymentDetail.as_view(), name ='deployment-detail'),
Scott Bakerd51d0bd2014-11-10 16:31:15 -0800157
Scott Baker1faefd32015-02-02 15:53:37 -0800158 url(r'xos/reservations/$', ReservationList.as_view(), name='reservation-list'),
159 url(r'xos/reservations/(?P<pk>[a-zA-Z0-9\-]+)/$', ReservationDetail.as_view(), name ='reservation-detail'),
Scott Bakerd51d0bd2014-11-10 16:31:15 -0800160
Scott Baker1faefd32015-02-02 15:53:37 -0800161 url(r'xos/siteprivileges/$', SitePrivilegeList.as_view(), name='siteprivilege-list'),
162 url(r'xos/siteprivileges/(?P<pk>[a-zA-Z0-9\-]+)/$', SitePrivilegeDetail.as_view(), name ='siteprivilege-detail'),
Scott Bakerd51d0bd2014-11-10 16:31:15 -0800163
Scott Baker1faefd32015-02-02 15:53:37 -0800164 url(r'xos/controllerslices/$', ControllerSliceList.as_view(), name='controllerslice-list'),
165 url(r'xos/controllerslices/(?P<pk>[a-zA-Z0-9\-]+)/$', ControllerSliceDetail.as_view(), name ='controllerslice-detail'),
Scott Bakerd51d0bd2014-11-10 16:31:15 -0800166
Scott Baker1faefd32015-02-02 15:53:37 -0800167 url(r'xos/controllerdashboardviews/$', ControllerDashboardViewList.as_view(), name='controllerdashboardview-list'),
168 url(r'xos/controllerdashboardviews/(?P<pk>[a-zA-Z0-9\-]+)/$', ControllerDashboardViewDetail.as_view(), name ='controllerdashboardview-detail'),
Scott Bakerf2c0c512014-12-22 17:35:34 -0800169
Scott Baker1faefd32015-02-02 15:53:37 -0800170 url(r'xos/accounts/$', AccountList.as_view(), name='account-list'),
171 url(r'xos/accounts/(?P<pk>[a-zA-Z0-9\-]+)/$', AccountDetail.as_view(), name ='account-detail'),
Scott Bakerd51d0bd2014-11-10 16:31:15 -0800172
Scott Baker1faefd32015-02-02 15:53:37 -0800173 url(r'xos/controllerroles/$', ControllerRoleList.as_view(), name='controllerrole-list'),
174 url(r'xos/controllerroles/(?P<pk>[a-zA-Z0-9\-]+)/$', ControllerRoleDetail.as_view(), name ='controllerrole-detail'),
Scott Baker515dc9e2014-12-22 09:29:05 -0800175
Scott Baker1faefd32015-02-02 15:53:37 -0800176 url(r'xos/networkparametertypes/$', NetworkParameterTypeList.as_view(), name='networkparametertype-list'),
177 url(r'xos/networkparametertypes/(?P<pk>[a-zA-Z0-9\-]+)/$', NetworkParameterTypeDetail.as_view(), name ='networkparametertype-detail'),
Scott Bakerd51d0bd2014-11-10 16:31:15 -0800178
Scott Baker1faefd32015-02-02 15:53:37 -0800179 url(r'xos/sitecredentials/$', SiteCredentialList.as_view(), name='sitecredential-list'),
180 url(r'xos/sitecredentials/(?P<pk>[a-zA-Z0-9\-]+)/$', SiteCredentialDetail.as_view(), name ='sitecredential-detail'),
Scott Bakerd51d0bd2014-11-10 16:31:15 -0800181
Scott Baker1faefd32015-02-02 15:53:37 -0800182 url(r'xos/deploymentprivileges/$', DeploymentPrivilegeList.as_view(), name='deploymentprivilege-list'),
183 url(r'xos/deploymentprivileges/(?P<pk>[a-zA-Z0-9\-]+)/$', DeploymentPrivilegeDetail.as_view(), name ='deploymentprivilege-detail'),
Scott Bakerd51d0bd2014-11-10 16:31:15 -0800184
Scott Baker1faefd32015-02-02 15:53:37 -0800185 url(r'xos/controllersliceprivileges/$', ControllerSlicePrivilegeList.as_view(), name='controllersliceprivilege-list'),
186 url(r'xos/controllersliceprivileges/(?P<pk>[a-zA-Z0-9\-]+)/$', ControllerSlicePrivilegeDetail.as_view(), name ='controllersliceprivilege-detail'),
Scott Baker191f9b22015-01-12 13:16:39 -0800187
Scott Baker1faefd32015-02-02 15:53:37 -0800188 url(r'xos/sitedeployments/$', SiteDeploymentList.as_view(), name='sitedeployment-list'),
189 url(r'xos/sitedeployments/(?P<pk>[a-zA-Z0-9\-]+)/$', SiteDeploymentDetail.as_view(), name ='sitedeployment-detail'),
Scott Baker515dc9e2014-12-22 09:29:05 -0800190
Scott Baker1faefd32015-02-02 15:53:37 -0800191 url(r'xos/deploymentroles/$', DeploymentRoleList.as_view(), name='deploymentrole-list'),
192 url(r'xos/deploymentroles/(?P<pk>[a-zA-Z0-9\-]+)/$', DeploymentRoleDetail.as_view(), name ='deploymentrole-detail'),
Scott Bakerd51d0bd2014-11-10 16:31:15 -0800193
Scott Baker1faefd32015-02-02 15:53:37 -0800194 url(r'xos/usercredentials/$', UserCredentialList.as_view(), name='usercredential-list'),
195 url(r'xos/usercredentials/(?P<pk>[a-zA-Z0-9\-]+)/$', UserCredentialDetail.as_view(), name ='usercredential-detail'),
Scott Bakerd51d0bd2014-11-10 16:31:15 -0800196
Scott Baker1faefd32015-02-02 15:53:37 -0800197 url(r'xos/slicetags/$', SliceTagList.as_view(), name='slicetag-list'),
198 url(r'xos/slicetags/(?P<pk>[a-zA-Z0-9\-]+)/$', SliceTagDetail.as_view(), name ='slicetag-detail'),
Scott Bakerd51d0bd2014-11-10 16:31:15 -0800199
Scott Baker1faefd32015-02-02 15:53:37 -0800200 url(r'xos/networktemplates/$', NetworkTemplateList.as_view(), name='networktemplate-list'),
201 url(r'xos/networktemplates/(?P<pk>[a-zA-Z0-9\-]+)/$', NetworkTemplateDetail.as_view(), name ='networktemplate-detail'),
Scott Bakerd51d0bd2014-11-10 16:31:15 -0800202
Scott Baker1faefd32015-02-02 15:53:37 -0800203 url(r'xos/routers/$', RouterList.as_view(), name='router-list'),
204 url(r'xos/routers/(?P<pk>[a-zA-Z0-9\-]+)/$', RouterDetail.as_view(), name ='router-detail'),
Scott Bakerd51d0bd2014-11-10 16:31:15 -0800205
Scott Baker1faefd32015-02-02 15:53:37 -0800206 url(r'xos/serviceresources/$', ServiceResourceList.as_view(), name='serviceresource-list'),
207 url(r'xos/serviceresources/(?P<pk>[a-zA-Z0-9\-]+)/$', ServiceResourceDetail.as_view(), name ='serviceresource-detail'),
Scott Bakerd51d0bd2014-11-10 16:31:15 -0800208
209 )
Sapan Bhatiadea39432014-06-13 03:10:36 -0400210
211@api_view(['GET'])
212def api_root(request, format=None):
213 return Response({
Scott Baker2bcbf372014-10-29 23:41:11 -0700214 'serviceattributes': reverse('serviceattribute-list', request=request, format=format),
Scott Baker515dc9e2014-12-22 09:29:05 -0800215 'controllerimageses': reverse('controllerimages-list', request=request, format=format),
Scott Baker191f9b22015-01-12 13:16:39 -0800216 'controllersiteprivileges': reverse('controllersiteprivilege-list', request=request, format=format),
Scott Baker2bcbf372014-10-29 23:41:11 -0700217 'images': reverse('image-list', request=request, format=format),
218 'networkparameters': reverse('networkparameter-list', request=request, format=format),
219 'sites': reverse('site-list', request=request, format=format),
220 'sliceroles': reverse('slicerole-list', request=request, format=format),
221 'tags': reverse('tag-list', request=request, format=format),
222 'invoices': reverse('invoice-list', request=request, format=format),
223 'sliceprivileges': reverse('sliceprivilege-list', request=request, format=format),
224 'planetstackroles': reverse('planetstackrole-list', request=request, format=format),
225 'networkslivers': reverse('networksliver-list', request=request, format=format),
Scott Baker191f9b22015-01-12 13:16:39 -0800226 'flavors': reverse('flavor-list', request=request, format=format),
227 'controllersites': reverse('controllersite-list', request=request, format=format),
Scott Baker2bcbf372014-10-29 23:41:11 -0700228 'projects': reverse('project-list', request=request, format=format),
229 'slices': reverse('slice-list', request=request, format=format),
230 'networks': reverse('network-list', request=request, format=format),
231 'services': reverse('service-list', request=request, format=format),
232 'serviceclasses': reverse('serviceclass-list', request=request, format=format),
Scott Baker191f9b22015-01-12 13:16:39 -0800233 'planetstacks': reverse('planetstack-list', request=request, format=format),
Scott Baker2bcbf372014-10-29 23:41:11 -0700234 'charges': reverse('charge-list', request=request, format=format),
235 'roles': reverse('role-list', request=request, format=format),
236 'usableobjects': reverse('usableobject-list', request=request, format=format),
237 'siteroles': reverse('siterole-list', request=request, format=format),
238 'slicecredentials': reverse('slicecredential-list', request=request, format=format),
239 'slivers': reverse('sliver-list', request=request, format=format),
240 'nodes': reverse('node-list', request=request, format=format),
241 'dashboardviews': reverse('dashboardview-list', request=request, format=format),
Scott Baker191f9b22015-01-12 13:16:39 -0800242 'controllernetworks': reverse('controllernetwork-list', request=request, format=format),
Scott Baker515dc9e2014-12-22 09:29:05 -0800243 'imagedeploymentses': reverse('imagedeployments-list', request=request, format=format),
Scott Baker191f9b22015-01-12 13:16:39 -0800244 'controllerusers': reverse('controlleruser-list', request=request, format=format),
Scott Baker2bcbf372014-10-29 23:41:11 -0700245 'reservedresources': reverse('reservedresource-list', request=request, format=format),
Scott Baker515dc9e2014-12-22 09:29:05 -0800246 'payments': reverse('payment-list', request=request, format=format),
Scott Baker2bcbf372014-10-29 23:41:11 -0700247 'networkslices': reverse('networkslice-list', request=request, format=format),
248 'userdashboardviews': reverse('userdashboardview-list', request=request, format=format),
Scott Baker515dc9e2014-12-22 09:29:05 -0800249 'controllers': reverse('controller-list', request=request, format=format),
Scott Baker2bcbf372014-10-29 23:41:11 -0700250 'planetstackprivileges': reverse('planetstackprivilege-list', request=request, format=format),
251 'users': reverse('user-list', request=request, format=format),
252 'deployments': reverse('deployment-list', request=request, format=format),
253 'reservations': reverse('reservation-list', request=request, format=format),
Scott Baker2bcbf372014-10-29 23:41:11 -0700254 'siteprivileges': reverse('siteprivilege-list', request=request, format=format),
Scott Baker191f9b22015-01-12 13:16:39 -0800255 'controllerslices': reverse('controllerslice-list', request=request, format=format),
Scott Bakerf2c0c512014-12-22 17:35:34 -0800256 'controllerdashboardviews': reverse('controllerdashboardview-list', request=request, format=format),
Scott Baker2bcbf372014-10-29 23:41:11 -0700257 'accounts': reverse('account-list', request=request, format=format),
Scott Baker515dc9e2014-12-22 09:29:05 -0800258 'controllerroles': reverse('controllerrole-list', request=request, format=format),
Scott Baker2bcbf372014-10-29 23:41:11 -0700259 'networkparametertypes': reverse('networkparametertype-list', request=request, format=format),
260 'sitecredentials': reverse('sitecredential-list', request=request, format=format),
Scott Baker515dc9e2014-12-22 09:29:05 -0800261 'deploymentprivileges': reverse('deploymentprivilege-list', request=request, format=format),
Scott Baker191f9b22015-01-12 13:16:39 -0800262 'controllersliceprivileges': reverse('controllersliceprivilege-list', request=request, format=format),
263 'sitedeployments': reverse('sitedeployment-list', request=request, format=format),
Scott Baker515dc9e2014-12-22 09:29:05 -0800264 'deploymentroles': reverse('deploymentrole-list', request=request, format=format),
Scott Baker2bcbf372014-10-29 23:41:11 -0700265 'usercredentials': reverse('usercredential-list', request=request, format=format),
Scott Baker2bcbf372014-10-29 23:41:11 -0700266 'slicetags': reverse('slicetag-list', request=request, format=format),
Scott Bakerf2c0c512014-12-22 17:35:34 -0800267 'networktemplates': reverse('networktemplate-list', request=request, format=format),
Scott Baker2bcbf372014-10-29 23:41:11 -0700268 'routers': reverse('router-list', request=request, format=format),
269 'serviceresources': reverse('serviceresource-list', request=request, format=format),
270
Sapan Bhatiadea39432014-06-13 03:10:36 -0400271 })
272
273# Based on serializers.py
274
Scott Baker515dc9e2014-12-22 09:29:05 -0800275class XOSModelSerializer(serializers.ModelSerializer):
276 def save_object(self, obj, **kwargs):
277
278 """ rest_framework can't deal with ManyToMany relations that have a
Scott Baker1faefd32015-02-02 15:53:37 -0800279 through table. In xos, most of the through tables we have
Scott Baker515dc9e2014-12-22 09:29:05 -0800280 use defaults or blank fields, so there's no reason why we shouldn't
281 be able to save these objects.
282
283 So, let's strip out these m2m relations, and deal with them ourself.
284 """
285 obj._complex_m2m_data={};
286 if getattr(obj, '_m2m_data', None):
287 for relatedObject in obj._meta.get_all_related_many_to_many_objects():
288 if (relatedObject.field.rel.through._meta.auto_created):
289 # These are non-trough ManyToMany relations and
290 # can be updated just fine
291 continue
292 fieldName = relatedObject.get_accessor_name()
293 if fieldName in obj._m2m_data.keys():
294 obj._complex_m2m_data[fieldName] = (relatedObject, obj._m2m_data[fieldName])
295 del obj._m2m_data[fieldName]
296
297 serializers.ModelSerializer.save_object(self, obj, **kwargs);
298
299 for (accessor, stuff) in obj._complex_m2m_data.items():
300 (relatedObject, data) = stuff
301 through = relatedObject.field.rel.through
302 local_fieldName = relatedObject.field.m2m_reverse_field_name()
303 remote_fieldName = relatedObject.field.m2m_field_name()
304
305 # get the current set of existing relations
306 existing = through.objects.filter(**{local_fieldName: obj});
307
308 data_ids = [item.id for item in data]
309 existing_ids = [getattr(item,remote_fieldName).id for item in existing]
310
311 #print "data_ids", data_ids
312 #print "existing_ids", existing_ids
313
314 # remove relations that are in 'existing' but not in 'data'
315 for item in list(existing):
316 if (getattr(item,remote_fieldName).id not in data_ids):
317 print "delete", getattr(item,remote_fieldName)
318 item.delete() #(purge=True)
319
320 # add relations that are in 'data' but not in 'existing'
321 for item in data:
322 if (item.id not in existing_ids):
323 #print "add", item
324 newModel = through(**{local_fieldName: obj, remote_fieldName: item})
325 newModel.save()
326
327
328
Scott Baker0caeaf02014-06-19 11:12:55 -0700329class ServiceAttributeSerializer(serializers.HyperlinkedModelSerializer):
Scott Bakerf0480fb2014-12-23 11:12:07 -0800330 id = IdField()
Scott Baker2bcbf372014-10-29 23:41:11 -0700331
Scott Bakerb744f1c2014-11-21 11:32:24 -0800332 humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
Scott Baker96eb3fd2014-11-25 00:53:25 -0800333 validators = serializers.SerializerMethodField("getValidators")
Scott Bakerb744f1c2014-11-21 11:32:24 -0800334 def getHumanReadableName(self, obj):
335 return str(obj)
Scott Baker96eb3fd2014-11-25 00:53:25 -0800336 def getValidators(self, obj):
337 try:
338 return obj.getValidators()
339 except:
340 return None
Scott Baker2bcbf372014-10-29 23:41:11 -0700341 class Meta:
342 model = ServiceAttribute
Scott Baker84cf39e2015-01-30 15:41:39 -0800343 fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','name','value','service',)
Scott Baker46b58542014-08-11 17:26:12 -0700344
Scott Baker515dc9e2014-12-22 09:29:05 -0800345class ServiceAttributeIdSerializer(XOSModelSerializer):
Scott Bakerf0480fb2014-12-23 11:12:07 -0800346 id = IdField()
Scott Baker2bcbf372014-10-29 23:41:11 -0700347
Scott Bakerb744f1c2014-11-21 11:32:24 -0800348 humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
Scott Baker96eb3fd2014-11-25 00:53:25 -0800349 validators = serializers.SerializerMethodField("getValidators")
Scott Bakerb744f1c2014-11-21 11:32:24 -0800350 def getHumanReadableName(self, obj):
351 return str(obj)
Scott Baker96eb3fd2014-11-25 00:53:25 -0800352 def getValidators(self, obj):
353 try:
354 return obj.getValidators()
355 except:
356 return None
Scott Baker515dc9e2014-12-22 09:29:05 -0800357 class Meta:
Scott Baker2bcbf372014-10-29 23:41:11 -0700358 model = ServiceAttribute
Scott Baker84cf39e2015-01-30 15:41:39 -0800359 fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','name','value','service',)
Scott Baker46b58542014-08-11 17:26:12 -0700360
361
Sapan Bhatiadea39432014-06-13 03:10:36 -0400362
363
Scott Baker515dc9e2014-12-22 09:29:05 -0800364class ControllerImagesSerializer(serializers.HyperlinkedModelSerializer):
Scott Bakerf0480fb2014-12-23 11:12:07 -0800365 id = IdField()
Scott Baker515dc9e2014-12-22 09:29:05 -0800366
367 humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
368 validators = serializers.SerializerMethodField("getValidators")
369 def getHumanReadableName(self, obj):
370 return str(obj)
371 def getValidators(self, obj):
372 try:
373 return obj.getValidators()
374 except:
375 return None
376 class Meta:
377 model = ControllerImages
Scott Baker84cf39e2015-01-30 15:41:39 -0800378 fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','image','controller','glance_image_id',)
Scott Baker515dc9e2014-12-22 09:29:05 -0800379
380class ControllerImagesIdSerializer(XOSModelSerializer):
Scott Bakerf0480fb2014-12-23 11:12:07 -0800381 id = IdField()
Scott Baker515dc9e2014-12-22 09:29:05 -0800382
383 humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
384 validators = serializers.SerializerMethodField("getValidators")
385 def getHumanReadableName(self, obj):
386 return str(obj)
387 def getValidators(self, obj):
388 try:
389 return obj.getValidators()
390 except:
391 return None
392 class Meta:
393 model = ControllerImages
Scott Baker84cf39e2015-01-30 15:41:39 -0800394 fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','image','controller','glance_image_id',)
Scott Baker515dc9e2014-12-22 09:29:05 -0800395
396
397
398
Scott Baker191f9b22015-01-12 13:16:39 -0800399class ControllerSitePrivilegeSerializer(serializers.HyperlinkedModelSerializer):
400 id = IdField()
401
402 humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
403 validators = serializers.SerializerMethodField("getValidators")
404 def getHumanReadableName(self, obj):
405 return str(obj)
406 def getValidators(self, obj):
407 try:
408 return obj.getValidators()
409 except:
410 return None
411 class Meta:
412 model = ControllerSitePrivilege
Scott Baker84cf39e2015-01-30 15:41:39 -0800413 fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','controller','site_privilege','role_id',)
Scott Baker191f9b22015-01-12 13:16:39 -0800414
415class ControllerSitePrivilegeIdSerializer(XOSModelSerializer):
416 id = IdField()
417
418 humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
419 validators = serializers.SerializerMethodField("getValidators")
420 def getHumanReadableName(self, obj):
421 return str(obj)
422 def getValidators(self, obj):
423 try:
424 return obj.getValidators()
425 except:
426 return None
427 class Meta:
428 model = ControllerSitePrivilege
Scott Baker84cf39e2015-01-30 15:41:39 -0800429 fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','controller','site_privilege','role_id',)
Scott Baker191f9b22015-01-12 13:16:39 -0800430
431
432
433
Sapan Bhatiadea39432014-06-13 03:10:36 -0400434class ImageSerializer(serializers.HyperlinkedModelSerializer):
Scott Bakerf0480fb2014-12-23 11:12:07 -0800435 id = IdField()
Scott Baker2bcbf372014-10-29 23:41:11 -0700436
Scott Bakerbf4ef6d2014-12-22 15:59:33 -0800437
438 deployments = serializers.HyperlinkedRelatedField(many=True, read_only=True, view_name='deployment-detail')
439
440
Scott Bakerb744f1c2014-11-21 11:32:24 -0800441 humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
Scott Baker96eb3fd2014-11-25 00:53:25 -0800442 validators = serializers.SerializerMethodField("getValidators")
Scott Bakerb744f1c2014-11-21 11:32:24 -0800443 def getHumanReadableName(self, obj):
444 return str(obj)
Scott Baker96eb3fd2014-11-25 00:53:25 -0800445 def getValidators(self, obj):
446 try:
447 return obj.getValidators()
448 except:
449 return None
Scott Baker2bcbf372014-10-29 23:41:11 -0700450 class Meta:
451 model = Image
Scott Baker84cf39e2015-01-30 15:41:39 -0800452 fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','name','disk_format','container_format','path','deployments',)
Scott Baker46b58542014-08-11 17:26:12 -0700453
Scott Baker515dc9e2014-12-22 09:29:05 -0800454class ImageIdSerializer(XOSModelSerializer):
Scott Bakerf0480fb2014-12-23 11:12:07 -0800455 id = IdField()
Scott Baker2bcbf372014-10-29 23:41:11 -0700456
Scott Bakerbf4ef6d2014-12-22 15:59:33 -0800457
Scott Baker201f7da2014-12-23 10:56:06 -0800458 deployments = serializers.PrimaryKeyRelatedField(many=True, queryset = Deployment.objects.all())
Scott Bakerbf4ef6d2014-12-22 15:59:33 -0800459
460
Scott Bakerb744f1c2014-11-21 11:32:24 -0800461 humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
Scott Baker96eb3fd2014-11-25 00:53:25 -0800462 validators = serializers.SerializerMethodField("getValidators")
Scott Bakerb744f1c2014-11-21 11:32:24 -0800463 def getHumanReadableName(self, obj):
464 return str(obj)
Scott Baker96eb3fd2014-11-25 00:53:25 -0800465 def getValidators(self, obj):
466 try:
467 return obj.getValidators()
468 except:
469 return None
Scott Baker515dc9e2014-12-22 09:29:05 -0800470 class Meta:
Scott Baker2bcbf372014-10-29 23:41:11 -0700471 model = Image
Scott Baker84cf39e2015-01-30 15:41:39 -0800472 fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','name','disk_format','container_format','path','deployments',)
Scott Baker46b58542014-08-11 17:26:12 -0700473
474
Sapan Bhatiadea39432014-06-13 03:10:36 -0400475
476
Scott Baker0caeaf02014-06-19 11:12:55 -0700477class NetworkParameterSerializer(serializers.HyperlinkedModelSerializer):
Scott Bakerf0480fb2014-12-23 11:12:07 -0800478 id = IdField()
Scott Baker2bcbf372014-10-29 23:41:11 -0700479
Scott Bakerb744f1c2014-11-21 11:32:24 -0800480 humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
Scott Baker96eb3fd2014-11-25 00:53:25 -0800481 validators = serializers.SerializerMethodField("getValidators")
Scott Bakerb744f1c2014-11-21 11:32:24 -0800482 def getHumanReadableName(self, obj):
483 return str(obj)
Scott Baker96eb3fd2014-11-25 00:53:25 -0800484 def getValidators(self, obj):
485 try:
486 return obj.getValidators()
487 except:
488 return None
Scott Baker2bcbf372014-10-29 23:41:11 -0700489 class Meta:
490 model = NetworkParameter
Scott Baker84cf39e2015-01-30 15:41:39 -0800491 fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','parameter','value','content_type','object_id',)
Scott Baker46b58542014-08-11 17:26:12 -0700492
Scott Baker515dc9e2014-12-22 09:29:05 -0800493class NetworkParameterIdSerializer(XOSModelSerializer):
Scott Bakerf0480fb2014-12-23 11:12:07 -0800494 id = IdField()
Scott Baker2bcbf372014-10-29 23:41:11 -0700495
Scott Bakerb744f1c2014-11-21 11:32:24 -0800496 humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
Scott Baker96eb3fd2014-11-25 00:53:25 -0800497 validators = serializers.SerializerMethodField("getValidators")
Scott Bakerb744f1c2014-11-21 11:32:24 -0800498 def getHumanReadableName(self, obj):
499 return str(obj)
Scott Baker96eb3fd2014-11-25 00:53:25 -0800500 def getValidators(self, obj):
501 try:
502 return obj.getValidators()
503 except:
504 return None
Scott Baker515dc9e2014-12-22 09:29:05 -0800505 class Meta:
Scott Baker2bcbf372014-10-29 23:41:11 -0700506 model = NetworkParameter
Scott Baker84cf39e2015-01-30 15:41:39 -0800507 fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','parameter','value','content_type','object_id',)
Scott Baker46b58542014-08-11 17:26:12 -0700508
509
Sapan Bhatiadea39432014-06-13 03:10:36 -0400510
511
512class SiteSerializer(serializers.HyperlinkedModelSerializer):
Scott Bakerf0480fb2014-12-23 11:12:07 -0800513 id = IdField()
Scott Baker2bcbf372014-10-29 23:41:11 -0700514
Scott Baker515dc9e2014-12-22 09:29:05 -0800515
516 deployments = serializers.HyperlinkedRelatedField(many=True, read_only=True, view_name='deployment-detail')
517
518
Scott Bakerb744f1c2014-11-21 11:32:24 -0800519 humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
Scott Baker96eb3fd2014-11-25 00:53:25 -0800520 validators = serializers.SerializerMethodField("getValidators")
Scott Bakerb744f1c2014-11-21 11:32:24 -0800521 def getHumanReadableName(self, obj):
522 return str(obj)
Scott Baker96eb3fd2014-11-25 00:53:25 -0800523 def getValidators(self, obj):
524 try:
525 return obj.getValidators()
526 except:
527 return None
Scott Baker2bcbf372014-10-29 23:41:11 -0700528 class Meta:
529 model = Site
Scott Baker84cf39e2015-01-30 15:41:39 -0800530 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 Baker46b58542014-08-11 17:26:12 -0700531
Scott Baker515dc9e2014-12-22 09:29:05 -0800532class SiteIdSerializer(XOSModelSerializer):
Scott Bakerf0480fb2014-12-23 11:12:07 -0800533 id = IdField()
Scott Baker2bcbf372014-10-29 23:41:11 -0700534
Scott Baker515dc9e2014-12-22 09:29:05 -0800535
Scott Baker201f7da2014-12-23 10:56:06 -0800536 deployments = serializers.PrimaryKeyRelatedField(many=True, queryset = Deployment.objects.all())
Scott Baker515dc9e2014-12-22 09:29:05 -0800537
538
Scott Bakerb744f1c2014-11-21 11:32:24 -0800539 humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
Scott Baker96eb3fd2014-11-25 00:53:25 -0800540 validators = serializers.SerializerMethodField("getValidators")
Scott Bakerb744f1c2014-11-21 11:32:24 -0800541 def getHumanReadableName(self, obj):
542 return str(obj)
Scott Baker96eb3fd2014-11-25 00:53:25 -0800543 def getValidators(self, obj):
544 try:
545 return obj.getValidators()
546 except:
547 return None
Scott Baker515dc9e2014-12-22 09:29:05 -0800548 class Meta:
Scott Baker2bcbf372014-10-29 23:41:11 -0700549 model = Site
Scott Baker84cf39e2015-01-30 15:41:39 -0800550 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 Baker46b58542014-08-11 17:26:12 -0700551
552
Sapan Bhatiadea39432014-06-13 03:10:36 -0400553
554
Scott Baker0caeaf02014-06-19 11:12:55 -0700555class SliceRoleSerializer(serializers.HyperlinkedModelSerializer):
Scott Bakerf0480fb2014-12-23 11:12:07 -0800556 id = IdField()
Scott Baker2bcbf372014-10-29 23:41:11 -0700557
Scott Bakerb744f1c2014-11-21 11:32:24 -0800558 humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
Scott Baker96eb3fd2014-11-25 00:53:25 -0800559 validators = serializers.SerializerMethodField("getValidators")
Scott Bakerb744f1c2014-11-21 11:32:24 -0800560 def getHumanReadableName(self, obj):
561 return str(obj)
Scott Baker96eb3fd2014-11-25 00:53:25 -0800562 def getValidators(self, obj):
563 try:
564 return obj.getValidators()
565 except:
566 return None
Scott Baker2bcbf372014-10-29 23:41:11 -0700567 class Meta:
568 model = SliceRole
Scott Baker84cf39e2015-01-30 15:41:39 -0800569 fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','role',)
Scott Baker46b58542014-08-11 17:26:12 -0700570
Scott Baker515dc9e2014-12-22 09:29:05 -0800571class SliceRoleIdSerializer(XOSModelSerializer):
Scott Bakerf0480fb2014-12-23 11:12:07 -0800572 id = IdField()
Scott Baker2bcbf372014-10-29 23:41:11 -0700573
Scott Bakerb744f1c2014-11-21 11:32:24 -0800574 humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
Scott Baker96eb3fd2014-11-25 00:53:25 -0800575 validators = serializers.SerializerMethodField("getValidators")
Scott Bakerb744f1c2014-11-21 11:32:24 -0800576 def getHumanReadableName(self, obj):
577 return str(obj)
Scott Baker96eb3fd2014-11-25 00:53:25 -0800578 def getValidators(self, obj):
579 try:
580 return obj.getValidators()
581 except:
582 return None
Scott Baker515dc9e2014-12-22 09:29:05 -0800583 class Meta:
Scott Baker2bcbf372014-10-29 23:41:11 -0700584 model = SliceRole
Scott Baker84cf39e2015-01-30 15:41:39 -0800585 fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','role',)
Scott Baker46b58542014-08-11 17:26:12 -0700586
587
Sapan Bhatiadea39432014-06-13 03:10:36 -0400588
589
590class TagSerializer(serializers.HyperlinkedModelSerializer):
Scott Bakerf0480fb2014-12-23 11:12:07 -0800591 id = IdField()
Scott Baker2bcbf372014-10-29 23:41:11 -0700592
Scott Bakerb744f1c2014-11-21 11:32:24 -0800593 humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
Scott Baker96eb3fd2014-11-25 00:53:25 -0800594 validators = serializers.SerializerMethodField("getValidators")
Scott Bakerb744f1c2014-11-21 11:32:24 -0800595 def getHumanReadableName(self, obj):
596 return str(obj)
Scott Baker96eb3fd2014-11-25 00:53:25 -0800597 def getValidators(self, obj):
598 try:
599 return obj.getValidators()
600 except:
601 return None
Scott Baker2bcbf372014-10-29 23:41:11 -0700602 class Meta:
603 model = Tag
Scott Baker84cf39e2015-01-30 15:41:39 -0800604 fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','service','name','value','content_type','object_id',)
Scott Baker46b58542014-08-11 17:26:12 -0700605
Scott Baker515dc9e2014-12-22 09:29:05 -0800606class TagIdSerializer(XOSModelSerializer):
Scott Bakerf0480fb2014-12-23 11:12:07 -0800607 id = IdField()
Scott Baker2bcbf372014-10-29 23:41:11 -0700608
Scott Bakerb744f1c2014-11-21 11:32:24 -0800609 humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
Scott Baker96eb3fd2014-11-25 00:53:25 -0800610 validators = serializers.SerializerMethodField("getValidators")
Scott Bakerb744f1c2014-11-21 11:32:24 -0800611 def getHumanReadableName(self, obj):
612 return str(obj)
Scott Baker96eb3fd2014-11-25 00:53:25 -0800613 def getValidators(self, obj):
614 try:
615 return obj.getValidators()
616 except:
617 return None
Scott Baker515dc9e2014-12-22 09:29:05 -0800618 class Meta:
Scott Baker2bcbf372014-10-29 23:41:11 -0700619 model = Tag
Scott Baker84cf39e2015-01-30 15:41:39 -0800620 fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','service','name','value','content_type','object_id',)
Scott Baker46b58542014-08-11 17:26:12 -0700621
622
Sapan Bhatiadea39432014-06-13 03:10:36 -0400623
624
625class InvoiceSerializer(serializers.HyperlinkedModelSerializer):
Scott Bakerf0480fb2014-12-23 11:12:07 -0800626 id = IdField()
Scott Baker2bcbf372014-10-29 23:41:11 -0700627
Scott Bakerb744f1c2014-11-21 11:32:24 -0800628 humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
Scott Baker96eb3fd2014-11-25 00:53:25 -0800629 validators = serializers.SerializerMethodField("getValidators")
Scott Bakerb744f1c2014-11-21 11:32:24 -0800630 def getHumanReadableName(self, obj):
631 return str(obj)
Scott Baker96eb3fd2014-11-25 00:53:25 -0800632 def getValidators(self, obj):
633 try:
634 return obj.getValidators()
635 except:
636 return None
Scott Baker2bcbf372014-10-29 23:41:11 -0700637 class Meta:
638 model = Invoice
Scott Baker84cf39e2015-01-30 15:41:39 -0800639 fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','date','account',)
Scott Baker46b58542014-08-11 17:26:12 -0700640
Scott Baker515dc9e2014-12-22 09:29:05 -0800641class InvoiceIdSerializer(XOSModelSerializer):
Scott Bakerf0480fb2014-12-23 11:12:07 -0800642 id = IdField()
Scott Baker2bcbf372014-10-29 23:41:11 -0700643
Scott Bakerb744f1c2014-11-21 11:32:24 -0800644 humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
Scott Baker96eb3fd2014-11-25 00:53:25 -0800645 validators = serializers.SerializerMethodField("getValidators")
Scott Bakerb744f1c2014-11-21 11:32:24 -0800646 def getHumanReadableName(self, obj):
647 return str(obj)
Scott Baker96eb3fd2014-11-25 00:53:25 -0800648 def getValidators(self, obj):
649 try:
650 return obj.getValidators()
651 except:
652 return None
Scott Baker515dc9e2014-12-22 09:29:05 -0800653 class Meta:
Scott Baker2bcbf372014-10-29 23:41:11 -0700654 model = Invoice
Scott Baker84cf39e2015-01-30 15:41:39 -0800655 fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','date','account',)
Scott Baker46b58542014-08-11 17:26:12 -0700656
657
Sapan Bhatiadea39432014-06-13 03:10:36 -0400658
659
Scott Baker0caeaf02014-06-19 11:12:55 -0700660class SlicePrivilegeSerializer(serializers.HyperlinkedModelSerializer):
Scott Bakerf0480fb2014-12-23 11:12:07 -0800661 id = IdField()
Scott Baker2bcbf372014-10-29 23:41:11 -0700662
Scott Bakerb744f1c2014-11-21 11:32:24 -0800663 humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
Scott Baker96eb3fd2014-11-25 00:53:25 -0800664 validators = serializers.SerializerMethodField("getValidators")
Scott Bakerb744f1c2014-11-21 11:32:24 -0800665 def getHumanReadableName(self, obj):
666 return str(obj)
Scott Baker96eb3fd2014-11-25 00:53:25 -0800667 def getValidators(self, obj):
668 try:
669 return obj.getValidators()
670 except:
671 return None
Scott Baker2bcbf372014-10-29 23:41:11 -0700672 class Meta:
673 model = SlicePrivilege
Scott Baker84cf39e2015-01-30 15:41:39 -0800674 fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','user','slice','role',)
Scott Baker46b58542014-08-11 17:26:12 -0700675
Scott Baker515dc9e2014-12-22 09:29:05 -0800676class SlicePrivilegeIdSerializer(XOSModelSerializer):
Scott Bakerf0480fb2014-12-23 11:12:07 -0800677 id = IdField()
Scott Baker2bcbf372014-10-29 23:41:11 -0700678
Scott Bakerb744f1c2014-11-21 11:32:24 -0800679 humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
Scott Baker96eb3fd2014-11-25 00:53:25 -0800680 validators = serializers.SerializerMethodField("getValidators")
Scott Bakerb744f1c2014-11-21 11:32:24 -0800681 def getHumanReadableName(self, obj):
682 return str(obj)
Scott Baker96eb3fd2014-11-25 00:53:25 -0800683 def getValidators(self, obj):
684 try:
685 return obj.getValidators()
686 except:
687 return None
Scott Baker515dc9e2014-12-22 09:29:05 -0800688 class Meta:
Scott Baker2bcbf372014-10-29 23:41:11 -0700689 model = SlicePrivilege
Scott Baker84cf39e2015-01-30 15:41:39 -0800690 fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','user','slice','role',)
Scott Baker46b58542014-08-11 17:26:12 -0700691
692
Scott Baker0caeaf02014-06-19 11:12:55 -0700693
694
Scott Baker89a7b7c2014-10-07 00:10:17 -0700695class PlanetStackRoleSerializer(serializers.HyperlinkedModelSerializer):
Scott Bakerf0480fb2014-12-23 11:12:07 -0800696 id = IdField()
Scott Baker2bcbf372014-10-29 23:41:11 -0700697
Scott Bakerb744f1c2014-11-21 11:32:24 -0800698 humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
Scott Baker96eb3fd2014-11-25 00:53:25 -0800699 validators = serializers.SerializerMethodField("getValidators")
Scott Bakerb744f1c2014-11-21 11:32:24 -0800700 def getHumanReadableName(self, obj):
701 return str(obj)
Scott Baker96eb3fd2014-11-25 00:53:25 -0800702 def getValidators(self, obj):
703 try:
704 return obj.getValidators()
705 except:
706 return None
Scott Baker2bcbf372014-10-29 23:41:11 -0700707 class Meta:
708 model = PlanetStackRole
Scott Baker84cf39e2015-01-30 15:41:39 -0800709 fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','role',)
Scott Baker89a7b7c2014-10-07 00:10:17 -0700710
Scott Baker515dc9e2014-12-22 09:29:05 -0800711class PlanetStackRoleIdSerializer(XOSModelSerializer):
Scott Bakerf0480fb2014-12-23 11:12:07 -0800712 id = IdField()
Scott Baker2bcbf372014-10-29 23:41:11 -0700713
Scott Bakerb744f1c2014-11-21 11:32:24 -0800714 humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
Scott Baker96eb3fd2014-11-25 00:53:25 -0800715 validators = serializers.SerializerMethodField("getValidators")
Scott Bakerb744f1c2014-11-21 11:32:24 -0800716 def getHumanReadableName(self, obj):
717 return str(obj)
Scott Baker96eb3fd2014-11-25 00:53:25 -0800718 def getValidators(self, obj):
719 try:
720 return obj.getValidators()
721 except:
722 return None
Scott Baker515dc9e2014-12-22 09:29:05 -0800723 class Meta:
Scott Baker2bcbf372014-10-29 23:41:11 -0700724 model = PlanetStackRole
Scott Baker84cf39e2015-01-30 15:41:39 -0800725 fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','role',)
Scott Baker89a7b7c2014-10-07 00:10:17 -0700726
727
728
729
Scott Baker0caeaf02014-06-19 11:12:55 -0700730class NetworkSliverSerializer(serializers.HyperlinkedModelSerializer):
Scott Bakerf0480fb2014-12-23 11:12:07 -0800731 id = IdField()
Scott Baker2bcbf372014-10-29 23:41:11 -0700732
Scott Bakerb744f1c2014-11-21 11:32:24 -0800733 humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
Scott Baker96eb3fd2014-11-25 00:53:25 -0800734 validators = serializers.SerializerMethodField("getValidators")
Scott Bakerb744f1c2014-11-21 11:32:24 -0800735 def getHumanReadableName(self, obj):
736 return str(obj)
Scott Baker96eb3fd2014-11-25 00:53:25 -0800737 def getValidators(self, obj):
738 try:
739 return obj.getValidators()
740 except:
741 return None
Scott Baker2bcbf372014-10-29 23:41:11 -0700742 class Meta:
743 model = NetworkSliver
Scott Baker84cf39e2015-01-30 15:41:39 -0800744 fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','network','sliver','ip','port_id',)
Scott Baker46b58542014-08-11 17:26:12 -0700745
Scott Baker515dc9e2014-12-22 09:29:05 -0800746class NetworkSliverIdSerializer(XOSModelSerializer):
Scott Bakerf0480fb2014-12-23 11:12:07 -0800747 id = IdField()
Scott Baker2bcbf372014-10-29 23:41:11 -0700748
Scott Bakerb744f1c2014-11-21 11:32:24 -0800749 humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
Scott Baker96eb3fd2014-11-25 00:53:25 -0800750 validators = serializers.SerializerMethodField("getValidators")
Scott Bakerb744f1c2014-11-21 11:32:24 -0800751 def getHumanReadableName(self, obj):
752 return str(obj)
Scott Baker96eb3fd2014-11-25 00:53:25 -0800753 def getValidators(self, obj):
754 try:
755 return obj.getValidators()
756 except:
757 return None
Scott Baker515dc9e2014-12-22 09:29:05 -0800758 class Meta:
Scott Baker2bcbf372014-10-29 23:41:11 -0700759 model = NetworkSliver
Scott Baker84cf39e2015-01-30 15:41:39 -0800760 fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','network','sliver','ip','port_id',)
Scott Baker46b58542014-08-11 17:26:12 -0700761
762
Scott Baker0caeaf02014-06-19 11:12:55 -0700763
764
Scott Baker191f9b22015-01-12 13:16:39 -0800765class FlavorSerializer(serializers.HyperlinkedModelSerializer):
766 id = IdField()
767
768
769 deployments = serializers.HyperlinkedRelatedField(many=True, read_only=True, view_name='deployment-detail')
770
771
772 humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
773 validators = serializers.SerializerMethodField("getValidators")
774 def getHumanReadableName(self, obj):
775 return str(obj)
776 def getValidators(self, obj):
777 try:
778 return obj.getValidators()
779 except:
780 return None
781 class Meta:
782 model = Flavor
Scott Baker84cf39e2015-01-30 15:41:39 -0800783 fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','name','description','flavor','order','default','deployments',)
Scott Baker191f9b22015-01-12 13:16:39 -0800784
785class FlavorIdSerializer(XOSModelSerializer):
786 id = IdField()
787
788
789 deployments = serializers.PrimaryKeyRelatedField(many=True, queryset = Deployment.objects.all())
790
791
792 humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
793 validators = serializers.SerializerMethodField("getValidators")
794 def getHumanReadableName(self, obj):
795 return str(obj)
796 def getValidators(self, obj):
797 try:
798 return obj.getValidators()
799 except:
800 return None
801 class Meta:
802 model = Flavor
Scott Baker84cf39e2015-01-30 15:41:39 -0800803 fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','name','description','flavor','order','default','deployments',)
Scott Baker191f9b22015-01-12 13:16:39 -0800804
805
806
807
808class ControllerSiteSerializer(serializers.HyperlinkedModelSerializer):
809 id = IdField()
810
811 humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
812 validators = serializers.SerializerMethodField("getValidators")
813 def getHumanReadableName(self, obj):
814 return str(obj)
815 def getValidators(self, obj):
816 try:
817 return obj.getValidators()
818 except:
819 return None
820 class Meta:
821 model = ControllerSite
Scott Baker84cf39e2015-01-30 15:41:39 -0800822 fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','site','controller','tenant_id',)
Scott Baker191f9b22015-01-12 13:16:39 -0800823
824class ControllerSiteIdSerializer(XOSModelSerializer):
825 id = IdField()
826
827 humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
828 validators = serializers.SerializerMethodField("getValidators")
829 def getHumanReadableName(self, obj):
830 return str(obj)
831 def getValidators(self, obj):
832 try:
833 return obj.getValidators()
834 except:
835 return None
836 class Meta:
837 model = ControllerSite
Scott Baker84cf39e2015-01-30 15:41:39 -0800838 fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','site','controller','tenant_id',)
Scott Baker191f9b22015-01-12 13:16:39 -0800839
840
841
842
Scott Baker89a7b7c2014-10-07 00:10:17 -0700843class ProjectSerializer(serializers.HyperlinkedModelSerializer):
Scott Bakerf0480fb2014-12-23 11:12:07 -0800844 id = IdField()
Scott Baker2bcbf372014-10-29 23:41:11 -0700845
Scott Bakerb744f1c2014-11-21 11:32:24 -0800846 humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
Scott Baker96eb3fd2014-11-25 00:53:25 -0800847 validators = serializers.SerializerMethodField("getValidators")
Scott Bakerb744f1c2014-11-21 11:32:24 -0800848 def getHumanReadableName(self, obj):
849 return str(obj)
Scott Baker96eb3fd2014-11-25 00:53:25 -0800850 def getValidators(self, obj):
851 try:
852 return obj.getValidators()
853 except:
854 return None
Scott Baker2bcbf372014-10-29 23:41:11 -0700855 class Meta:
856 model = Project
Scott Baker84cf39e2015-01-30 15:41:39 -0800857 fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','name',)
Scott Baker89a7b7c2014-10-07 00:10:17 -0700858
Scott Baker515dc9e2014-12-22 09:29:05 -0800859class ProjectIdSerializer(XOSModelSerializer):
Scott Bakerf0480fb2014-12-23 11:12:07 -0800860 id = IdField()
Scott Baker2bcbf372014-10-29 23:41:11 -0700861
Scott Bakerb744f1c2014-11-21 11:32:24 -0800862 humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
Scott Baker96eb3fd2014-11-25 00:53:25 -0800863 validators = serializers.SerializerMethodField("getValidators")
Scott Bakerb744f1c2014-11-21 11:32:24 -0800864 def getHumanReadableName(self, obj):
865 return str(obj)
Scott Baker96eb3fd2014-11-25 00:53:25 -0800866 def getValidators(self, obj):
867 try:
868 return obj.getValidators()
869 except:
870 return None
Scott Baker515dc9e2014-12-22 09:29:05 -0800871 class Meta:
Scott Baker2bcbf372014-10-29 23:41:11 -0700872 model = Project
Scott Baker84cf39e2015-01-30 15:41:39 -0800873 fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','name',)
Scott Baker89a7b7c2014-10-07 00:10:17 -0700874
875
876
877
Sapan Bhatiadea39432014-06-13 03:10:36 -0400878class SliceSerializer(serializers.HyperlinkedModelSerializer):
Scott Bakerf0480fb2014-12-23 11:12:07 -0800879 id = IdField()
Scott Baker2bcbf372014-10-29 23:41:11 -0700880
881
882 networks = serializers.HyperlinkedRelatedField(many=True, read_only=True, view_name='network-detail')
883
884
885
Scott Baker2bcbf372014-10-29 23:41:11 -0700886 networks = serializers.HyperlinkedRelatedField(many=True, read_only=True, view_name='network-detail')
887
888
Scott Bakerb744f1c2014-11-21 11:32:24 -0800889 humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
Scott Baker96eb3fd2014-11-25 00:53:25 -0800890 validators = serializers.SerializerMethodField("getValidators")
Scott Bakerb744f1c2014-11-21 11:32:24 -0800891 def getHumanReadableName(self, obj):
892 return str(obj)
Scott Baker96eb3fd2014-11-25 00:53:25 -0800893 def getValidators(self, obj):
894 try:
895 return obj.getValidators()
896 except:
897 return None
Scott Baker2bcbf372014-10-29 23:41:11 -0700898 class Meta:
899 model = Slice
Scott Baker84cf39e2015-01-30 15:41:39 -0800900 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 Baker46b58542014-08-11 17:26:12 -0700901
Scott Baker515dc9e2014-12-22 09:29:05 -0800902class SliceIdSerializer(XOSModelSerializer):
Scott Bakerf0480fb2014-12-23 11:12:07 -0800903 id = IdField()
Scott Baker2bcbf372014-10-29 23:41:11 -0700904
905
Scott Baker201f7da2014-12-23 10:56:06 -0800906 networks = serializers.PrimaryKeyRelatedField(many=True, queryset = Network.objects.all())
Scott Baker2bcbf372014-10-29 23:41:11 -0700907
908
909
Scott Baker201f7da2014-12-23 10:56:06 -0800910 networks = serializers.PrimaryKeyRelatedField(many=True, queryset = Network.objects.all())
Scott Baker2bcbf372014-10-29 23:41:11 -0700911
912
Scott Bakerb744f1c2014-11-21 11:32:24 -0800913 humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
Scott Baker96eb3fd2014-11-25 00:53:25 -0800914 validators = serializers.SerializerMethodField("getValidators")
Scott Bakerb744f1c2014-11-21 11:32:24 -0800915 def getHumanReadableName(self, obj):
916 return str(obj)
Scott Baker96eb3fd2014-11-25 00:53:25 -0800917 def getValidators(self, obj):
918 try:
919 return obj.getValidators()
920 except:
921 return None
Scott Baker515dc9e2014-12-22 09:29:05 -0800922 class Meta:
Scott Baker2bcbf372014-10-29 23:41:11 -0700923 model = Slice
Scott Baker84cf39e2015-01-30 15:41:39 -0800924 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 Baker46b58542014-08-11 17:26:12 -0700925
926
Sapan Bhatiadea39432014-06-13 03:10:36 -0400927
928
929class NetworkSerializer(serializers.HyperlinkedModelSerializer):
Scott Bakerf0480fb2014-12-23 11:12:07 -0800930 id = IdField()
Scott Baker2bcbf372014-10-29 23:41:11 -0700931
932
Scott Baker515dc9e2014-12-22 09:29:05 -0800933 slices = serializers.HyperlinkedRelatedField(many=True, read_only=True, view_name='slice-detail')
Scott Baker2bcbf372014-10-29 23:41:11 -0700934
935
936
Scott Baker515dc9e2014-12-22 09:29:05 -0800937 slices = serializers.HyperlinkedRelatedField(many=True, read_only=True, view_name='slice-detail')
938
939
940
941 slivers = serializers.HyperlinkedRelatedField(many=True, read_only=True, view_name='sliver-detail')
Scott Baker2bcbf372014-10-29 23:41:11 -0700942
943
944
945 routers = serializers.HyperlinkedRelatedField(many=True, read_only=True, view_name='router-detail')
946
947
948
949 routers = serializers.HyperlinkedRelatedField(many=True, read_only=True, view_name='router-detail')
950
951
Scott Bakerb744f1c2014-11-21 11:32:24 -0800952 humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
Scott Baker96eb3fd2014-11-25 00:53:25 -0800953 validators = serializers.SerializerMethodField("getValidators")
Scott Bakerb744f1c2014-11-21 11:32:24 -0800954 def getHumanReadableName(self, obj):
955 return str(obj)
Scott Baker96eb3fd2014-11-25 00:53:25 -0800956 def getValidators(self, obj):
957 try:
958 return obj.getValidators()
959 except:
960 return None
Scott Baker2bcbf372014-10-29 23:41:11 -0700961 class Meta:
962 model = Network
Scott Baker84cf39e2015-01-30 15:41:39 -0800963 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 Baker46b58542014-08-11 17:26:12 -0700964
Scott Baker515dc9e2014-12-22 09:29:05 -0800965class NetworkIdSerializer(XOSModelSerializer):
Scott Bakerf0480fb2014-12-23 11:12:07 -0800966 id = IdField()
Scott Baker2bcbf372014-10-29 23:41:11 -0700967
968
Scott Baker201f7da2014-12-23 10:56:06 -0800969 slices = serializers.PrimaryKeyRelatedField(many=True, queryset = Slice.objects.all())
Scott Baker2bcbf372014-10-29 23:41:11 -0700970
971
972
Scott Baker201f7da2014-12-23 10:56:06 -0800973 slices = serializers.PrimaryKeyRelatedField(many=True, queryset = Slice.objects.all())
Scott Baker2bcbf372014-10-29 23:41:11 -0700974
975
976
Scott Baker201f7da2014-12-23 10:56:06 -0800977 slivers = serializers.PrimaryKeyRelatedField(many=True, queryset = Sliver.objects.all())
Scott Baker2bcbf372014-10-29 23:41:11 -0700978
979
980
Scott Baker201f7da2014-12-23 10:56:06 -0800981 routers = serializers.PrimaryKeyRelatedField(many=True, queryset = Router.objects.all())
Scott Baker515dc9e2014-12-22 09:29:05 -0800982
983
984
Scott Baker201f7da2014-12-23 10:56:06 -0800985 routers = serializers.PrimaryKeyRelatedField(many=True, queryset = Router.objects.all())
Scott Baker2bcbf372014-10-29 23:41:11 -0700986
987
Scott Bakerb744f1c2014-11-21 11:32:24 -0800988 humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
Scott Baker96eb3fd2014-11-25 00:53:25 -0800989 validators = serializers.SerializerMethodField("getValidators")
Scott Bakerb744f1c2014-11-21 11:32:24 -0800990 def getHumanReadableName(self, obj):
991 return str(obj)
Scott Baker96eb3fd2014-11-25 00:53:25 -0800992 def getValidators(self, obj):
993 try:
994 return obj.getValidators()
995 except:
996 return None
Scott Baker515dc9e2014-12-22 09:29:05 -0800997 class Meta:
Scott Baker2bcbf372014-10-29 23:41:11 -0700998 model = Network
Scott Baker84cf39e2015-01-30 15:41:39 -0800999 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 Baker46b58542014-08-11 17:26:12 -07001000
1001
Sapan Bhatiadea39432014-06-13 03:10:36 -04001002
1003
1004class ServiceSerializer(serializers.HyperlinkedModelSerializer):
Scott Bakerf0480fb2014-12-23 11:12:07 -08001005 id = IdField()
Scott Baker2bcbf372014-10-29 23:41:11 -07001006
Scott Bakerb744f1c2014-11-21 11:32:24 -08001007 humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
Scott Baker96eb3fd2014-11-25 00:53:25 -08001008 validators = serializers.SerializerMethodField("getValidators")
Scott Bakerb744f1c2014-11-21 11:32:24 -08001009 def getHumanReadableName(self, obj):
1010 return str(obj)
Scott Baker96eb3fd2014-11-25 00:53:25 -08001011 def getValidators(self, obj):
1012 try:
1013 return obj.getValidators()
1014 except:
1015 return None
Scott Baker2bcbf372014-10-29 23:41:11 -07001016 class Meta:
1017 model = Service
Scott Baker84cf39e2015-01-30 15:41:39 -08001018 fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','description','enabled','name','versionNumber','published',)
Scott Baker46b58542014-08-11 17:26:12 -07001019
Scott Baker515dc9e2014-12-22 09:29:05 -08001020class ServiceIdSerializer(XOSModelSerializer):
Scott Bakerf0480fb2014-12-23 11:12:07 -08001021 id = IdField()
Scott Baker2bcbf372014-10-29 23:41:11 -07001022
Scott Bakerb744f1c2014-11-21 11:32:24 -08001023 humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
Scott Baker96eb3fd2014-11-25 00:53:25 -08001024 validators = serializers.SerializerMethodField("getValidators")
Scott Bakerb744f1c2014-11-21 11:32:24 -08001025 def getHumanReadableName(self, obj):
1026 return str(obj)
Scott Baker96eb3fd2014-11-25 00:53:25 -08001027 def getValidators(self, obj):
1028 try:
1029 return obj.getValidators()
1030 except:
1031 return None
Scott Baker515dc9e2014-12-22 09:29:05 -08001032 class Meta:
Scott Baker2bcbf372014-10-29 23:41:11 -07001033 model = Service
Scott Baker84cf39e2015-01-30 15:41:39 -08001034 fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','description','enabled','name','versionNumber','published',)
Scott Baker46b58542014-08-11 17:26:12 -07001035
1036
Sapan Bhatiadea39432014-06-13 03:10:36 -04001037
1038
Scott Baker0caeaf02014-06-19 11:12:55 -07001039class ServiceClassSerializer(serializers.HyperlinkedModelSerializer):
Scott Bakerf0480fb2014-12-23 11:12:07 -08001040 id = IdField()
Scott Baker2bcbf372014-10-29 23:41:11 -07001041
Scott Bakerb744f1c2014-11-21 11:32:24 -08001042 humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
Scott Baker96eb3fd2014-11-25 00:53:25 -08001043 validators = serializers.SerializerMethodField("getValidators")
Scott Bakerb744f1c2014-11-21 11:32:24 -08001044 def getHumanReadableName(self, obj):
1045 return str(obj)
Scott Baker96eb3fd2014-11-25 00:53:25 -08001046 def getValidators(self, obj):
1047 try:
1048 return obj.getValidators()
1049 except:
1050 return None
Scott Baker2bcbf372014-10-29 23:41:11 -07001051 class Meta:
1052 model = ServiceClass
Scott Baker84cf39e2015-01-30 15:41:39 -08001053 fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','name','description','commitment','membershipFee','membershipFeeMonths','upgradeRequiresApproval',)
Scott Baker46b58542014-08-11 17:26:12 -07001054
Scott Baker515dc9e2014-12-22 09:29:05 -08001055class ServiceClassIdSerializer(XOSModelSerializer):
Scott Bakerf0480fb2014-12-23 11:12:07 -08001056 id = IdField()
Scott Baker2bcbf372014-10-29 23:41:11 -07001057
Scott Bakerb744f1c2014-11-21 11:32:24 -08001058 humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
Scott Baker96eb3fd2014-11-25 00:53:25 -08001059 validators = serializers.SerializerMethodField("getValidators")
Scott Bakerb744f1c2014-11-21 11:32:24 -08001060 def getHumanReadableName(self, obj):
1061 return str(obj)
Scott Baker96eb3fd2014-11-25 00:53:25 -08001062 def getValidators(self, obj):
1063 try:
1064 return obj.getValidators()
1065 except:
1066 return None
Scott Baker515dc9e2014-12-22 09:29:05 -08001067 class Meta:
Scott Baker2bcbf372014-10-29 23:41:11 -07001068 model = ServiceClass
Scott Baker84cf39e2015-01-30 15:41:39 -08001069 fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','name','description','commitment','membershipFee','membershipFeeMonths','upgradeRequiresApproval',)
Scott Baker46b58542014-08-11 17:26:12 -07001070
1071
Sapan Bhatiadea39432014-06-13 03:10:36 -04001072
1073
Scott Baker191f9b22015-01-12 13:16:39 -08001074class PlanetStackSerializer(serializers.HyperlinkedModelSerializer):
Scott Bakerf0480fb2014-12-23 11:12:07 -08001075 id = IdField()
Scott Baker2bcbf372014-10-29 23:41:11 -07001076
Scott Bakerb744f1c2014-11-21 11:32:24 -08001077 humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
Scott Baker96eb3fd2014-11-25 00:53:25 -08001078 validators = serializers.SerializerMethodField("getValidators")
Scott Bakerb744f1c2014-11-21 11:32:24 -08001079 def getHumanReadableName(self, obj):
1080 return str(obj)
Scott Baker96eb3fd2014-11-25 00:53:25 -08001081 def getValidators(self, obj):
1082 try:
1083 return obj.getValidators()
1084 except:
1085 return None
Scott Baker2bcbf372014-10-29 23:41:11 -07001086 class Meta:
Scott Baker191f9b22015-01-12 13:16:39 -08001087 model = PlanetStack
Scott Baker84cf39e2015-01-30 15:41:39 -08001088 fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','description',)
Scott Baker46b58542014-08-11 17:26:12 -07001089
Scott Baker191f9b22015-01-12 13:16:39 -08001090class PlanetStackIdSerializer(XOSModelSerializer):
Scott Bakerf0480fb2014-12-23 11:12:07 -08001091 id = IdField()
Scott Baker2bcbf372014-10-29 23:41:11 -07001092
Scott Bakerb744f1c2014-11-21 11:32:24 -08001093 humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
Scott Baker96eb3fd2014-11-25 00:53:25 -08001094 validators = serializers.SerializerMethodField("getValidators")
Scott Bakerb744f1c2014-11-21 11:32:24 -08001095 def getHumanReadableName(self, obj):
1096 return str(obj)
Scott Baker96eb3fd2014-11-25 00:53:25 -08001097 def getValidators(self, obj):
1098 try:
1099 return obj.getValidators()
1100 except:
1101 return None
Scott Baker515dc9e2014-12-22 09:29:05 -08001102 class Meta:
Scott Baker191f9b22015-01-12 13:16:39 -08001103 model = PlanetStack
Scott Baker84cf39e2015-01-30 15:41:39 -08001104 fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','description',)
Scott Baker46b58542014-08-11 17:26:12 -07001105
1106
Sapan Bhatiadea39432014-06-13 03:10:36 -04001107
1108
1109class ChargeSerializer(serializers.HyperlinkedModelSerializer):
Scott Bakerf0480fb2014-12-23 11:12:07 -08001110 id = IdField()
Scott Baker2bcbf372014-10-29 23:41:11 -07001111
Scott Bakerb744f1c2014-11-21 11:32:24 -08001112 humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
Scott Baker96eb3fd2014-11-25 00:53:25 -08001113 validators = serializers.SerializerMethodField("getValidators")
Scott Bakerb744f1c2014-11-21 11:32:24 -08001114 def getHumanReadableName(self, obj):
1115 return str(obj)
Scott Baker96eb3fd2014-11-25 00:53:25 -08001116 def getValidators(self, obj):
1117 try:
1118 return obj.getValidators()
1119 except:
1120 return None
Scott Baker2bcbf372014-10-29 23:41:11 -07001121 class Meta:
1122 model = Charge
Scott Baker84cf39e2015-01-30 15:41:39 -08001123 fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','account','slice','kind','state','date','object','amount','coreHours','invoice',)
Scott Baker46b58542014-08-11 17:26:12 -07001124
Scott Baker515dc9e2014-12-22 09:29:05 -08001125class ChargeIdSerializer(XOSModelSerializer):
Scott Bakerf0480fb2014-12-23 11:12:07 -08001126 id = IdField()
Scott Baker2bcbf372014-10-29 23:41:11 -07001127
Scott Bakerb744f1c2014-11-21 11:32:24 -08001128 humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
Scott Baker96eb3fd2014-11-25 00:53:25 -08001129 validators = serializers.SerializerMethodField("getValidators")
Scott Bakerb744f1c2014-11-21 11:32:24 -08001130 def getHumanReadableName(self, obj):
1131 return str(obj)
Scott Baker96eb3fd2014-11-25 00:53:25 -08001132 def getValidators(self, obj):
1133 try:
1134 return obj.getValidators()
1135 except:
1136 return None
Scott Baker515dc9e2014-12-22 09:29:05 -08001137 class Meta:
Scott Baker2bcbf372014-10-29 23:41:11 -07001138 model = Charge
Scott Baker84cf39e2015-01-30 15:41:39 -08001139 fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','account','slice','kind','state','date','object','amount','coreHours','invoice',)
Scott Baker46b58542014-08-11 17:26:12 -07001140
1141
Sapan Bhatiadea39432014-06-13 03:10:36 -04001142
1143
1144class RoleSerializer(serializers.HyperlinkedModelSerializer):
Scott Bakerf0480fb2014-12-23 11:12:07 -08001145 id = IdField()
Scott Baker2bcbf372014-10-29 23:41:11 -07001146
Scott Bakerb744f1c2014-11-21 11:32:24 -08001147 humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
Scott Baker96eb3fd2014-11-25 00:53:25 -08001148 validators = serializers.SerializerMethodField("getValidators")
Scott Bakerb744f1c2014-11-21 11:32:24 -08001149 def getHumanReadableName(self, obj):
1150 return str(obj)
Scott Baker96eb3fd2014-11-25 00:53:25 -08001151 def getValidators(self, obj):
1152 try:
1153 return obj.getValidators()
1154 except:
1155 return None
Scott Baker2bcbf372014-10-29 23:41:11 -07001156 class Meta:
1157 model = Role
Scott Baker84cf39e2015-01-30 15:41:39 -08001158 fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','role_type','role','description','content_type',)
Scott Baker46b58542014-08-11 17:26:12 -07001159
Scott Baker515dc9e2014-12-22 09:29:05 -08001160class RoleIdSerializer(XOSModelSerializer):
Scott Bakerf0480fb2014-12-23 11:12:07 -08001161 id = IdField()
Scott Baker2bcbf372014-10-29 23:41:11 -07001162
Scott Bakerb744f1c2014-11-21 11:32:24 -08001163 humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
Scott Baker96eb3fd2014-11-25 00:53:25 -08001164 validators = serializers.SerializerMethodField("getValidators")
Scott Bakerb744f1c2014-11-21 11:32:24 -08001165 def getHumanReadableName(self, obj):
1166 return str(obj)
Scott Baker96eb3fd2014-11-25 00:53:25 -08001167 def getValidators(self, obj):
1168 try:
1169 return obj.getValidators()
1170 except:
1171 return None
Scott Baker515dc9e2014-12-22 09:29:05 -08001172 class Meta:
Scott Baker2bcbf372014-10-29 23:41:11 -07001173 model = Role
Scott Baker84cf39e2015-01-30 15:41:39 -08001174 fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','role_type','role','description','content_type',)
Scott Baker46b58542014-08-11 17:26:12 -07001175
1176
Sapan Bhatiadea39432014-06-13 03:10:36 -04001177
1178
Scott Baker0caeaf02014-06-19 11:12:55 -07001179class UsableObjectSerializer(serializers.HyperlinkedModelSerializer):
Scott Bakerf0480fb2014-12-23 11:12:07 -08001180 id = IdField()
Scott Baker2bcbf372014-10-29 23:41:11 -07001181
Scott Bakerb744f1c2014-11-21 11:32:24 -08001182 humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
Scott Baker96eb3fd2014-11-25 00:53:25 -08001183 validators = serializers.SerializerMethodField("getValidators")
Scott Bakerb744f1c2014-11-21 11:32:24 -08001184 def getHumanReadableName(self, obj):
1185 return str(obj)
Scott Baker96eb3fd2014-11-25 00:53:25 -08001186 def getValidators(self, obj):
1187 try:
1188 return obj.getValidators()
1189 except:
1190 return None
Scott Baker2bcbf372014-10-29 23:41:11 -07001191 class Meta:
1192 model = UsableObject
Scott Baker84cf39e2015-01-30 15:41:39 -08001193 fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','name',)
Scott Baker46b58542014-08-11 17:26:12 -07001194
Scott Baker515dc9e2014-12-22 09:29:05 -08001195class UsableObjectIdSerializer(XOSModelSerializer):
Scott Bakerf0480fb2014-12-23 11:12:07 -08001196 id = IdField()
Scott Baker2bcbf372014-10-29 23:41:11 -07001197
Scott Bakerb744f1c2014-11-21 11:32:24 -08001198 humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
Scott Baker96eb3fd2014-11-25 00:53:25 -08001199 validators = serializers.SerializerMethodField("getValidators")
Scott Bakerb744f1c2014-11-21 11:32:24 -08001200 def getHumanReadableName(self, obj):
1201 return str(obj)
Scott Baker96eb3fd2014-11-25 00:53:25 -08001202 def getValidators(self, obj):
1203 try:
1204 return obj.getValidators()
1205 except:
1206 return None
Scott Baker515dc9e2014-12-22 09:29:05 -08001207 class Meta:
Scott Baker2bcbf372014-10-29 23:41:11 -07001208 model = UsableObject
Scott Baker84cf39e2015-01-30 15:41:39 -08001209 fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','name',)
Scott Baker46b58542014-08-11 17:26:12 -07001210
Scott Baker191f9b22015-01-12 13:16:39 -08001211
1212
1213
Scott Baker0caeaf02014-06-19 11:12:55 -07001214class SiteRoleSerializer(serializers.HyperlinkedModelSerializer):
Scott Bakerf0480fb2014-12-23 11:12:07 -08001215 id = IdField()
Scott Baker2bcbf372014-10-29 23:41:11 -07001216
Scott Bakerb744f1c2014-11-21 11:32:24 -08001217 humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
Scott Baker96eb3fd2014-11-25 00:53:25 -08001218 validators = serializers.SerializerMethodField("getValidators")
Scott Bakerb744f1c2014-11-21 11:32:24 -08001219 def getHumanReadableName(self, obj):
1220 return str(obj)
Scott Baker96eb3fd2014-11-25 00:53:25 -08001221 def getValidators(self, obj):
1222 try:
1223 return obj.getValidators()
1224 except:
1225 return None
Scott Baker2bcbf372014-10-29 23:41:11 -07001226 class Meta:
1227 model = SiteRole
Scott Baker84cf39e2015-01-30 15:41:39 -08001228 fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','role',)
Scott Baker46b58542014-08-11 17:26:12 -07001229
Scott Baker515dc9e2014-12-22 09:29:05 -08001230class SiteRoleIdSerializer(XOSModelSerializer):
Scott Bakerf0480fb2014-12-23 11:12:07 -08001231 id = IdField()
Scott Baker2bcbf372014-10-29 23:41:11 -07001232
Scott Bakerb744f1c2014-11-21 11:32:24 -08001233 humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
Scott Baker96eb3fd2014-11-25 00:53:25 -08001234 validators = serializers.SerializerMethodField("getValidators")
Scott Bakerb744f1c2014-11-21 11:32:24 -08001235 def getHumanReadableName(self, obj):
1236 return str(obj)
Scott Baker96eb3fd2014-11-25 00:53:25 -08001237 def getValidators(self, obj):
1238 try:
1239 return obj.getValidators()
1240 except:
1241 return None
Scott Baker515dc9e2014-12-22 09:29:05 -08001242 class Meta:
Scott Baker2bcbf372014-10-29 23:41:11 -07001243 model = SiteRole
Scott Baker84cf39e2015-01-30 15:41:39 -08001244 fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','role',)
Scott Baker46b58542014-08-11 17:26:12 -07001245
1246
Scott Baker0caeaf02014-06-19 11:12:55 -07001247
1248
Scott Baker89a7b7c2014-10-07 00:10:17 -07001249class SliceCredentialSerializer(serializers.HyperlinkedModelSerializer):
Scott Bakerf0480fb2014-12-23 11:12:07 -08001250 id = IdField()
Scott Baker2bcbf372014-10-29 23:41:11 -07001251
Scott Bakerb744f1c2014-11-21 11:32:24 -08001252 humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
Scott Baker96eb3fd2014-11-25 00:53:25 -08001253 validators = serializers.SerializerMethodField("getValidators")
Scott Bakerb744f1c2014-11-21 11:32:24 -08001254 def getHumanReadableName(self, obj):
1255 return str(obj)
Scott Baker96eb3fd2014-11-25 00:53:25 -08001256 def getValidators(self, obj):
1257 try:
1258 return obj.getValidators()
1259 except:
1260 return None
Scott Baker2bcbf372014-10-29 23:41:11 -07001261 class Meta:
1262 model = SliceCredential
Scott Baker84cf39e2015-01-30 15:41:39 -08001263 fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','slice','name','key_id','enc_value',)
Scott Baker89a7b7c2014-10-07 00:10:17 -07001264
Scott Baker515dc9e2014-12-22 09:29:05 -08001265class SliceCredentialIdSerializer(XOSModelSerializer):
Scott Bakerf0480fb2014-12-23 11:12:07 -08001266 id = IdField()
Scott Baker2bcbf372014-10-29 23:41:11 -07001267
Scott Bakerb744f1c2014-11-21 11:32:24 -08001268 humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
Scott Baker96eb3fd2014-11-25 00:53:25 -08001269 validators = serializers.SerializerMethodField("getValidators")
Scott Bakerb744f1c2014-11-21 11:32:24 -08001270 def getHumanReadableName(self, obj):
1271 return str(obj)
Scott Baker96eb3fd2014-11-25 00:53:25 -08001272 def getValidators(self, obj):
1273 try:
1274 return obj.getValidators()
1275 except:
1276 return None
Scott Baker515dc9e2014-12-22 09:29:05 -08001277 class Meta:
Scott Baker2bcbf372014-10-29 23:41:11 -07001278 model = SliceCredential
Scott Baker84cf39e2015-01-30 15:41:39 -08001279 fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','slice','name','key_id','enc_value',)
Scott Baker89a7b7c2014-10-07 00:10:17 -07001280
1281
1282
1283
Sapan Bhatiadea39432014-06-13 03:10:36 -04001284class SliverSerializer(serializers.HyperlinkedModelSerializer):
Scott Bakerf0480fb2014-12-23 11:12:07 -08001285 id = IdField()
Scott Baker2bcbf372014-10-29 23:41:11 -07001286
1287
1288 networks = serializers.HyperlinkedRelatedField(many=True, read_only=True, view_name='network-detail')
1289
1290
Scott Bakerb744f1c2014-11-21 11:32:24 -08001291 humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
Scott Baker96eb3fd2014-11-25 00:53:25 -08001292 validators = serializers.SerializerMethodField("getValidators")
Scott Bakerb744f1c2014-11-21 11:32:24 -08001293 def getHumanReadableName(self, obj):
1294 return str(obj)
Scott Baker96eb3fd2014-11-25 00:53:25 -08001295 def getValidators(self, obj):
1296 try:
1297 return obj.getValidators()
1298 except:
1299 return None
Scott Baker2bcbf372014-10-29 23:41:11 -07001300 class Meta:
1301 model = Sliver
Scott Baker84cf39e2015-01-30 15:41:39 -08001302 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 Baker46b58542014-08-11 17:26:12 -07001303
Scott Baker515dc9e2014-12-22 09:29:05 -08001304class SliverIdSerializer(XOSModelSerializer):
Scott Bakerf0480fb2014-12-23 11:12:07 -08001305 id = IdField()
Scott Baker2bcbf372014-10-29 23:41:11 -07001306
1307
Scott Baker201f7da2014-12-23 10:56:06 -08001308 networks = serializers.PrimaryKeyRelatedField(many=True, queryset = Network.objects.all())
Scott Baker2bcbf372014-10-29 23:41:11 -07001309
1310
Scott Bakerb744f1c2014-11-21 11:32:24 -08001311 humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
Scott Baker96eb3fd2014-11-25 00:53:25 -08001312 validators = serializers.SerializerMethodField("getValidators")
Scott Bakerb744f1c2014-11-21 11:32:24 -08001313 def getHumanReadableName(self, obj):
1314 return str(obj)
Scott Baker96eb3fd2014-11-25 00:53:25 -08001315 def getValidators(self, obj):
1316 try:
1317 return obj.getValidators()
1318 except:
1319 return None
Scott Baker515dc9e2014-12-22 09:29:05 -08001320 class Meta:
Scott Baker2bcbf372014-10-29 23:41:11 -07001321 model = Sliver
Scott Baker84cf39e2015-01-30 15:41:39 -08001322 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 Baker46b58542014-08-11 17:26:12 -07001323
1324
Sapan Bhatiadea39432014-06-13 03:10:36 -04001325
1326
1327class NodeSerializer(serializers.HyperlinkedModelSerializer):
Scott Bakerf0480fb2014-12-23 11:12:07 -08001328 id = IdField()
Scott Baker2bcbf372014-10-29 23:41:11 -07001329
Scott Bakerb744f1c2014-11-21 11:32:24 -08001330 humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
Scott Baker96eb3fd2014-11-25 00:53:25 -08001331 validators = serializers.SerializerMethodField("getValidators")
Scott Bakerb744f1c2014-11-21 11:32:24 -08001332 def getHumanReadableName(self, obj):
1333 return str(obj)
Scott Baker96eb3fd2014-11-25 00:53:25 -08001334 def getValidators(self, obj):
1335 try:
1336 return obj.getValidators()
1337 except:
1338 return None
Scott Baker2bcbf372014-10-29 23:41:11 -07001339 class Meta:
1340 model = Node
Scott Baker84cf39e2015-01-30 15:41:39 -08001341 fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','name','site_deployment','site',)
Scott Baker46b58542014-08-11 17:26:12 -07001342
Scott Baker515dc9e2014-12-22 09:29:05 -08001343class NodeIdSerializer(XOSModelSerializer):
Scott Bakerf0480fb2014-12-23 11:12:07 -08001344 id = IdField()
Scott Baker2bcbf372014-10-29 23:41:11 -07001345
Scott Bakerb744f1c2014-11-21 11:32:24 -08001346 humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
Scott Baker96eb3fd2014-11-25 00:53:25 -08001347 validators = serializers.SerializerMethodField("getValidators")
Scott Bakerb744f1c2014-11-21 11:32:24 -08001348 def getHumanReadableName(self, obj):
1349 return str(obj)
Scott Baker96eb3fd2014-11-25 00:53:25 -08001350 def getValidators(self, obj):
1351 try:
1352 return obj.getValidators()
1353 except:
1354 return None
Scott Baker515dc9e2014-12-22 09:29:05 -08001355 class Meta:
Scott Baker2bcbf372014-10-29 23:41:11 -07001356 model = Node
Scott Baker84cf39e2015-01-30 15:41:39 -08001357 fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','name','site_deployment','site',)
Scott Baker46b58542014-08-11 17:26:12 -07001358
1359
Sapan Bhatiadea39432014-06-13 03:10:36 -04001360
1361
Scott Baker0caeaf02014-06-19 11:12:55 -07001362class DashboardViewSerializer(serializers.HyperlinkedModelSerializer):
Scott Bakerf0480fb2014-12-23 11:12:07 -08001363 id = IdField()
Scott Baker2bcbf372014-10-29 23:41:11 -07001364
Scott Baker515dc9e2014-12-22 09:29:05 -08001365
1366 controllers = serializers.HyperlinkedRelatedField(many=True, read_only=True, view_name='controller-detail')
1367
1368
Scott Bakerb744f1c2014-11-21 11:32:24 -08001369 humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
Scott Baker96eb3fd2014-11-25 00:53:25 -08001370 validators = serializers.SerializerMethodField("getValidators")
Scott Bakerb744f1c2014-11-21 11:32:24 -08001371 def getHumanReadableName(self, obj):
1372 return str(obj)
Scott Baker96eb3fd2014-11-25 00:53:25 -08001373 def getValidators(self, obj):
1374 try:
1375 return obj.getValidators()
1376 except:
1377 return None
Scott Baker2bcbf372014-10-29 23:41:11 -07001378 class Meta:
1379 model = DashboardView
Scott Baker84cf39e2015-01-30 15:41:39 -08001380 fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','name','url','enabled','controllers',)
Scott Baker46b58542014-08-11 17:26:12 -07001381
Scott Baker515dc9e2014-12-22 09:29:05 -08001382class DashboardViewIdSerializer(XOSModelSerializer):
Scott Bakerf0480fb2014-12-23 11:12:07 -08001383 id = IdField()
Scott Baker2bcbf372014-10-29 23:41:11 -07001384
Scott Baker515dc9e2014-12-22 09:29:05 -08001385
Scott Baker201f7da2014-12-23 10:56:06 -08001386 controllers = serializers.PrimaryKeyRelatedField(many=True, queryset = Controller.objects.all())
Scott Baker515dc9e2014-12-22 09:29:05 -08001387
1388
Scott Bakerb744f1c2014-11-21 11:32:24 -08001389 humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
Scott Baker96eb3fd2014-11-25 00:53:25 -08001390 validators = serializers.SerializerMethodField("getValidators")
Scott Bakerb744f1c2014-11-21 11:32:24 -08001391 def getHumanReadableName(self, obj):
1392 return str(obj)
Scott Baker96eb3fd2014-11-25 00:53:25 -08001393 def getValidators(self, obj):
1394 try:
1395 return obj.getValidators()
1396 except:
1397 return None
Scott Baker515dc9e2014-12-22 09:29:05 -08001398 class Meta:
Scott Baker2bcbf372014-10-29 23:41:11 -07001399 model = DashboardView
Scott Baker84cf39e2015-01-30 15:41:39 -08001400 fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','name','url','enabled','controllers',)
Scott Bakerb744f1c2014-11-21 11:32:24 -08001401
1402
1403
1404
Scott Baker191f9b22015-01-12 13:16:39 -08001405class ControllerNetworkSerializer(serializers.HyperlinkedModelSerializer):
1406 id = IdField()
1407
1408 humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
1409 validators = serializers.SerializerMethodField("getValidators")
1410 def getHumanReadableName(self, obj):
1411 return str(obj)
1412 def getValidators(self, obj):
1413 try:
1414 return obj.getValidators()
1415 except:
1416 return None
1417 class Meta:
1418 model = ControllerNetwork
Scott Baker84cf39e2015-01-30 15:41:39 -08001419 fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','network','controller','net_id','router_id','subnet_id','subnet',)
Scott Baker191f9b22015-01-12 13:16:39 -08001420
1421class ControllerNetworkIdSerializer(XOSModelSerializer):
1422 id = IdField()
1423
1424 humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
1425 validators = serializers.SerializerMethodField("getValidators")
1426 def getHumanReadableName(self, obj):
1427 return str(obj)
1428 def getValidators(self, obj):
1429 try:
1430 return obj.getValidators()
1431 except:
1432 return None
1433 class Meta:
1434 model = ControllerNetwork
Scott Baker84cf39e2015-01-30 15:41:39 -08001435 fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','network','controller','net_id','router_id','subnet_id','subnet',)
Scott Baker191f9b22015-01-12 13:16:39 -08001436
1437
1438
1439
Scott Baker515dc9e2014-12-22 09:29:05 -08001440class ImageDeploymentsSerializer(serializers.HyperlinkedModelSerializer):
Scott Bakerf0480fb2014-12-23 11:12:07 -08001441 id = IdField()
Scott Bakerb744f1c2014-11-21 11:32:24 -08001442
1443 humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
Scott Baker96eb3fd2014-11-25 00:53:25 -08001444 validators = serializers.SerializerMethodField("getValidators")
Scott Bakerb744f1c2014-11-21 11:32:24 -08001445 def getHumanReadableName(self, obj):
1446 return str(obj)
Scott Baker96eb3fd2014-11-25 00:53:25 -08001447 def getValidators(self, obj):
1448 try:
1449 return obj.getValidators()
1450 except:
1451 return None
Scott Bakerb744f1c2014-11-21 11:32:24 -08001452 class Meta:
Scott Baker515dc9e2014-12-22 09:29:05 -08001453 model = ImageDeployments
Scott Baker84cf39e2015-01-30 15:41:39 -08001454 fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','image','deployment',)
Scott Bakerb744f1c2014-11-21 11:32:24 -08001455
Scott Baker515dc9e2014-12-22 09:29:05 -08001456class ImageDeploymentsIdSerializer(XOSModelSerializer):
Scott Bakerf0480fb2014-12-23 11:12:07 -08001457 id = IdField()
Scott Bakerb744f1c2014-11-21 11:32:24 -08001458
1459 humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
Scott Baker96eb3fd2014-11-25 00:53:25 -08001460 validators = serializers.SerializerMethodField("getValidators")
Scott Bakerb744f1c2014-11-21 11:32:24 -08001461 def getHumanReadableName(self, obj):
1462 return str(obj)
Scott Baker96eb3fd2014-11-25 00:53:25 -08001463 def getValidators(self, obj):
1464 try:
1465 return obj.getValidators()
1466 except:
1467 return None
Scott Baker515dc9e2014-12-22 09:29:05 -08001468 class Meta:
1469 model = ImageDeployments
Scott Baker84cf39e2015-01-30 15:41:39 -08001470 fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','image','deployment',)
Scott Baker46b58542014-08-11 17:26:12 -07001471
1472
Sapan Bhatiadea39432014-06-13 03:10:36 -04001473
1474
Scott Baker191f9b22015-01-12 13:16:39 -08001475class ControllerUserSerializer(serializers.HyperlinkedModelSerializer):
1476 id = IdField()
1477
1478 humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
1479 validators = serializers.SerializerMethodField("getValidators")
1480 def getHumanReadableName(self, obj):
1481 return str(obj)
1482 def getValidators(self, obj):
1483 try:
1484 return obj.getValidators()
1485 except:
1486 return None
1487 class Meta:
1488 model = ControllerUser
Scott Baker84cf39e2015-01-30 15:41:39 -08001489 fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','user','controller','kuser_id',)
Scott Baker191f9b22015-01-12 13:16:39 -08001490
1491class ControllerUserIdSerializer(XOSModelSerializer):
1492 id = IdField()
1493
1494 humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
1495 validators = serializers.SerializerMethodField("getValidators")
1496 def getHumanReadableName(self, obj):
1497 return str(obj)
1498 def getValidators(self, obj):
1499 try:
1500 return obj.getValidators()
1501 except:
1502 return None
1503 class Meta:
1504 model = ControllerUser
Scott Baker84cf39e2015-01-30 15:41:39 -08001505 fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','user','controller','kuser_id',)
Scott Baker191f9b22015-01-12 13:16:39 -08001506
1507
1508
1509
Scott Baker0caeaf02014-06-19 11:12:55 -07001510class ReservedResourceSerializer(serializers.HyperlinkedModelSerializer):
Scott Bakerf0480fb2014-12-23 11:12:07 -08001511 id = IdField()
Scott Baker2bcbf372014-10-29 23:41:11 -07001512
Scott Bakerb744f1c2014-11-21 11:32:24 -08001513 humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
Scott Baker96eb3fd2014-11-25 00:53:25 -08001514 validators = serializers.SerializerMethodField("getValidators")
Scott Bakerb744f1c2014-11-21 11:32:24 -08001515 def getHumanReadableName(self, obj):
1516 return str(obj)
Scott Baker96eb3fd2014-11-25 00:53:25 -08001517 def getValidators(self, obj):
1518 try:
1519 return obj.getValidators()
1520 except:
1521 return None
Scott Baker2bcbf372014-10-29 23:41:11 -07001522 class Meta:
1523 model = ReservedResource
Scott Baker84cf39e2015-01-30 15:41:39 -08001524 fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','sliver','resource','quantity','reservationSet',)
Scott Baker46b58542014-08-11 17:26:12 -07001525
Scott Baker515dc9e2014-12-22 09:29:05 -08001526class ReservedResourceIdSerializer(XOSModelSerializer):
Scott Bakerf0480fb2014-12-23 11:12:07 -08001527 id = IdField()
Scott Baker2bcbf372014-10-29 23:41:11 -07001528
Scott Bakerb744f1c2014-11-21 11:32:24 -08001529 humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
Scott Baker96eb3fd2014-11-25 00:53:25 -08001530 validators = serializers.SerializerMethodField("getValidators")
Scott Bakerb744f1c2014-11-21 11:32:24 -08001531 def getHumanReadableName(self, obj):
1532 return str(obj)
Scott Baker96eb3fd2014-11-25 00:53:25 -08001533 def getValidators(self, obj):
1534 try:
1535 return obj.getValidators()
1536 except:
1537 return None
Scott Baker515dc9e2014-12-22 09:29:05 -08001538 class Meta:
Scott Baker2bcbf372014-10-29 23:41:11 -07001539 model = ReservedResource
Scott Baker84cf39e2015-01-30 15:41:39 -08001540 fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','sliver','resource','quantity','reservationSet',)
Scott Baker8b533192014-11-17 22:32:19 -08001541
1542
1543
1544
Scott Baker515dc9e2014-12-22 09:29:05 -08001545class PaymentSerializer(serializers.HyperlinkedModelSerializer):
Scott Bakerf0480fb2014-12-23 11:12:07 -08001546 id = IdField()
Scott Baker515dc9e2014-12-22 09:29:05 -08001547
1548 humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
1549 validators = serializers.SerializerMethodField("getValidators")
1550 def getHumanReadableName(self, obj):
1551 return str(obj)
1552 def getValidators(self, obj):
1553 try:
1554 return obj.getValidators()
1555 except:
1556 return None
1557 class Meta:
1558 model = Payment
Scott Baker84cf39e2015-01-30 15:41:39 -08001559 fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','account','amount','date',)
Scott Baker515dc9e2014-12-22 09:29:05 -08001560
1561class PaymentIdSerializer(XOSModelSerializer):
Scott Bakerf0480fb2014-12-23 11:12:07 -08001562 id = IdField()
Scott Baker515dc9e2014-12-22 09:29:05 -08001563
1564 humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
1565 validators = serializers.SerializerMethodField("getValidators")
1566 def getHumanReadableName(self, obj):
1567 return str(obj)
1568 def getValidators(self, obj):
1569 try:
1570 return obj.getValidators()
1571 except:
1572 return None
1573 class Meta:
1574 model = Payment
Scott Baker84cf39e2015-01-30 15:41:39 -08001575 fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','account','amount','date',)
Scott Baker515dc9e2014-12-22 09:29:05 -08001576
1577
1578
1579
Scott Baker0caeaf02014-06-19 11:12:55 -07001580class NetworkSliceSerializer(serializers.HyperlinkedModelSerializer):
Scott Bakerf0480fb2014-12-23 11:12:07 -08001581 id = IdField()
Scott Baker2bcbf372014-10-29 23:41:11 -07001582
Scott Bakerb744f1c2014-11-21 11:32:24 -08001583 humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
Scott Baker96eb3fd2014-11-25 00:53:25 -08001584 validators = serializers.SerializerMethodField("getValidators")
Scott Bakerb744f1c2014-11-21 11:32:24 -08001585 def getHumanReadableName(self, obj):
1586 return str(obj)
Scott Baker96eb3fd2014-11-25 00:53:25 -08001587 def getValidators(self, obj):
1588 try:
1589 return obj.getValidators()
1590 except:
1591 return None
Scott Baker2bcbf372014-10-29 23:41:11 -07001592 class Meta:
1593 model = NetworkSlice
Scott Baker84cf39e2015-01-30 15:41:39 -08001594 fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','network','slice',)
Scott Baker46b58542014-08-11 17:26:12 -07001595
Scott Baker515dc9e2014-12-22 09:29:05 -08001596class NetworkSliceIdSerializer(XOSModelSerializer):
Scott Bakerf0480fb2014-12-23 11:12:07 -08001597 id = IdField()
Scott Baker2bcbf372014-10-29 23:41:11 -07001598
Scott Bakerb744f1c2014-11-21 11:32:24 -08001599 humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
Scott Baker96eb3fd2014-11-25 00:53:25 -08001600 validators = serializers.SerializerMethodField("getValidators")
Scott Bakerb744f1c2014-11-21 11:32:24 -08001601 def getHumanReadableName(self, obj):
1602 return str(obj)
Scott Baker96eb3fd2014-11-25 00:53:25 -08001603 def getValidators(self, obj):
1604 try:
1605 return obj.getValidators()
1606 except:
1607 return None
Scott Baker515dc9e2014-12-22 09:29:05 -08001608 class Meta:
Scott Baker2bcbf372014-10-29 23:41:11 -07001609 model = NetworkSlice
Scott Baker84cf39e2015-01-30 15:41:39 -08001610 fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','network','slice',)
Scott Baker46b58542014-08-11 17:26:12 -07001611
1612
Scott Baker0caeaf02014-06-19 11:12:55 -07001613
1614
1615class UserDashboardViewSerializer(serializers.HyperlinkedModelSerializer):
Scott Bakerf0480fb2014-12-23 11:12:07 -08001616 id = IdField()
Scott Baker2bcbf372014-10-29 23:41:11 -07001617
Scott Bakerb744f1c2014-11-21 11:32:24 -08001618 humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
Scott Baker96eb3fd2014-11-25 00:53:25 -08001619 validators = serializers.SerializerMethodField("getValidators")
Scott Bakerb744f1c2014-11-21 11:32:24 -08001620 def getHumanReadableName(self, obj):
1621 return str(obj)
Scott Baker96eb3fd2014-11-25 00:53:25 -08001622 def getValidators(self, obj):
1623 try:
1624 return obj.getValidators()
1625 except:
1626 return None
Scott Baker2bcbf372014-10-29 23:41:11 -07001627 class Meta:
1628 model = UserDashboardView
Scott Baker84cf39e2015-01-30 15:41:39 -08001629 fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','user','dashboardView','order',)
Scott Baker46b58542014-08-11 17:26:12 -07001630
Scott Baker515dc9e2014-12-22 09:29:05 -08001631class UserDashboardViewIdSerializer(XOSModelSerializer):
Scott Bakerf0480fb2014-12-23 11:12:07 -08001632 id = IdField()
Scott Baker2bcbf372014-10-29 23:41:11 -07001633
Scott Bakerb744f1c2014-11-21 11:32:24 -08001634 humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
Scott Baker96eb3fd2014-11-25 00:53:25 -08001635 validators = serializers.SerializerMethodField("getValidators")
Scott Bakerb744f1c2014-11-21 11:32:24 -08001636 def getHumanReadableName(self, obj):
1637 return str(obj)
Scott Baker96eb3fd2014-11-25 00:53:25 -08001638 def getValidators(self, obj):
1639 try:
1640 return obj.getValidators()
1641 except:
Scott Baker515dc9e2014-12-22 09:29:05 -08001642 return None
1643 class Meta:
Scott Baker2bcbf372014-10-29 23:41:11 -07001644 model = UserDashboardView
Scott Baker84cf39e2015-01-30 15:41:39 -08001645 fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','user','dashboardView','order',)
Scott Baker8b533192014-11-17 22:32:19 -08001646
1647
1648
1649
Scott Baker515dc9e2014-12-22 09:29:05 -08001650class ControllerSerializer(serializers.HyperlinkedModelSerializer):
Scott Bakerf0480fb2014-12-23 11:12:07 -08001651 id = IdField()
Scott Baker2bcbf372014-10-29 23:41:11 -07001652
Scott Baker515dc9e2014-12-22 09:29:05 -08001653
1654 dashboardviews = serializers.HyperlinkedRelatedField(many=True, read_only=True, view_name='dashboardview-detail')
1655
1656
Scott Bakerb744f1c2014-11-21 11:32:24 -08001657 humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
Scott Baker96eb3fd2014-11-25 00:53:25 -08001658 validators = serializers.SerializerMethodField("getValidators")
Scott Baker515dc9e2014-12-22 09:29:05 -08001659 def getHumanReadableName(self, obj):
Scott Bakerb744f1c2014-11-21 11:32:24 -08001660 return str(obj)
Scott Baker96eb3fd2014-11-25 00:53:25 -08001661 def getValidators(self, obj):
1662 try:
1663 return obj.getValidators()
1664 except:
1665 return None
Scott Baker2bcbf372014-10-29 23:41:11 -07001666 class Meta:
Scott Baker515dc9e2014-12-22 09:29:05 -08001667 model = Controller
Scott Baker84cf39e2015-01-30 15:41:39 -08001668 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 Baker46b58542014-08-11 17:26:12 -07001669
Scott Baker515dc9e2014-12-22 09:29:05 -08001670class ControllerIdSerializer(XOSModelSerializer):
Scott Bakerf0480fb2014-12-23 11:12:07 -08001671 id = IdField()
Scott Baker2bcbf372014-10-29 23:41:11 -07001672
1673
Scott Baker201f7da2014-12-23 10:56:06 -08001674 dashboardviews = serializers.PrimaryKeyRelatedField(many=True, queryset = DashboardView.objects.all())
Scott Baker2bcbf372014-10-29 23:41:11 -07001675
1676
Scott Bakerb744f1c2014-11-21 11:32:24 -08001677 humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
Scott Baker96eb3fd2014-11-25 00:53:25 -08001678 validators = serializers.SerializerMethodField("getValidators")
Scott Bakerb744f1c2014-11-21 11:32:24 -08001679 def getHumanReadableName(self, obj):
1680 return str(obj)
Scott Baker96eb3fd2014-11-25 00:53:25 -08001681 def getValidators(self, obj):
1682 try:
1683 return obj.getValidators()
1684 except:
1685 return None
Scott Baker515dc9e2014-12-22 09:29:05 -08001686 class Meta:
1687 model = Controller
Scott Baker84cf39e2015-01-30 15:41:39 -08001688 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 Baker515dc9e2014-12-22 09:29:05 -08001689
1690
1691
1692
1693class PlanetStackPrivilegeSerializer(serializers.HyperlinkedModelSerializer):
Scott Bakerf0480fb2014-12-23 11:12:07 -08001694 id = IdField()
Scott Baker515dc9e2014-12-22 09:29:05 -08001695
1696 humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
1697 validators = serializers.SerializerMethodField("getValidators")
1698 def getHumanReadableName(self, obj):
1699 return str(obj)
1700 def getValidators(self, obj):
1701 try:
1702 return obj.getValidators()
1703 except:
1704 return None
1705 class Meta:
1706 model = PlanetStackPrivilege
Scott Baker84cf39e2015-01-30 15:41:39 -08001707 fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','user','planetstack','role',)
Scott Baker515dc9e2014-12-22 09:29:05 -08001708
1709class PlanetStackPrivilegeIdSerializer(XOSModelSerializer):
Scott Bakerf0480fb2014-12-23 11:12:07 -08001710 id = IdField()
Scott Baker515dc9e2014-12-22 09:29:05 -08001711
1712 humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
1713 validators = serializers.SerializerMethodField("getValidators")
1714 def getHumanReadableName(self, obj):
1715 return str(obj)
1716 def getValidators(self, obj):
1717 try:
1718 return obj.getValidators()
1719 except:
1720 return None
1721 class Meta:
1722 model = PlanetStackPrivilege
Scott Baker84cf39e2015-01-30 15:41:39 -08001723 fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','user','planetstack','role',)
Scott Baker515dc9e2014-12-22 09:29:05 -08001724
1725
1726
1727
1728class UserSerializer(serializers.HyperlinkedModelSerializer):
Scott Bakerf0480fb2014-12-23 11:12:07 -08001729 id = IdField()
Scott Baker515dc9e2014-12-22 09:29:05 -08001730
1731 humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
1732 validators = serializers.SerializerMethodField("getValidators")
1733 def getHumanReadableName(self, obj):
1734 return str(obj)
1735 def getValidators(self, obj):
1736 try:
1737 return obj.getValidators()
1738 except:
1739 return None
1740 class Meta:
1741 model = User
Scott Baker84cf39e2015-01-30 15:41:39 -08001742 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 Baker515dc9e2014-12-22 09:29:05 -08001743
1744class UserIdSerializer(XOSModelSerializer):
Scott Bakerf0480fb2014-12-23 11:12:07 -08001745 id = IdField()
Scott Baker515dc9e2014-12-22 09:29:05 -08001746
1747 humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
1748 validators = serializers.SerializerMethodField("getValidators")
1749 def getHumanReadableName(self, obj):
1750 return str(obj)
1751 def getValidators(self, obj):
1752 try:
1753 return obj.getValidators()
1754 except:
1755 return None
1756 class Meta:
1757 model = User
Scott Baker84cf39e2015-01-30 15:41:39 -08001758 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 Baker515dc9e2014-12-22 09:29:05 -08001759
1760
1761
1762
1763class DeploymentSerializer(serializers.HyperlinkedModelSerializer):
Scott Bakerf0480fb2014-12-23 11:12:07 -08001764 id = IdField()
Scott Baker515dc9e2014-12-22 09:29:05 -08001765
1766
Scott Bakerbf4ef6d2014-12-22 15:59:33 -08001767 images = serializers.HyperlinkedRelatedField(many=True, read_only=True, view_name='image-detail')
1768
1769
1770
Scott Baker515dc9e2014-12-22 09:29:05 -08001771 sites = serializers.HyperlinkedRelatedField(many=True, read_only=True, view_name='site-detail')
1772
1773
Scott Baker191f9b22015-01-12 13:16:39 -08001774
1775 flavors = serializers.HyperlinkedRelatedField(many=True, read_only=True, view_name='flavor-detail')
1776
1777
Scott Baker515dc9e2014-12-22 09:29:05 -08001778 humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
1779 validators = serializers.SerializerMethodField("getValidators")
1780 def getHumanReadableName(self, obj):
1781 return str(obj)
1782 def getValidators(self, obj):
1783 try:
1784 return obj.getValidators()
1785 except:
1786 return None
Scott Baker2bcbf372014-10-29 23:41:11 -07001787 class Meta:
1788 model = Deployment
Scott Baker84cf39e2015-01-30 15:41:39 -08001789 fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','name','accessControl','images','sites','flavors',)
Scott Baker46b58542014-08-11 17:26:12 -07001790
Scott Baker515dc9e2014-12-22 09:29:05 -08001791class DeploymentIdSerializer(XOSModelSerializer):
Scott Bakerf0480fb2014-12-23 11:12:07 -08001792 id = IdField()
Scott Baker515dc9e2014-12-22 09:29:05 -08001793
1794
Scott Baker201f7da2014-12-23 10:56:06 -08001795 images = serializers.PrimaryKeyRelatedField(many=True, queryset = Image.objects.all())
Scott Bakerbf4ef6d2014-12-22 15:59:33 -08001796
1797
1798
Scott Baker201f7da2014-12-23 10:56:06 -08001799 sites = serializers.PrimaryKeyRelatedField(many=True, queryset = Site.objects.all())
Scott Baker515dc9e2014-12-22 09:29:05 -08001800
1801
Scott Baker191f9b22015-01-12 13:16:39 -08001802
1803 flavors = serializers.PrimaryKeyRelatedField(many=True, queryset = Flavor.objects.all())
1804
1805
Tony Mack06c8e472014-11-30 15:53:08 -05001806 humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
1807 validators = serializers.SerializerMethodField("getValidators")
Scott Baker515dc9e2014-12-22 09:29:05 -08001808 def getHumanReadableName(self, obj):
1809 return str(obj)
1810 def getValidators(self, obj):
Tony Mack06c8e472014-11-30 15:53:08 -05001811 try:
1812 return obj.getValidators()
1813 except:
Scott Baker515dc9e2014-12-22 09:29:05 -08001814 return None
1815 class Meta:
1816 model = Deployment
Scott Baker84cf39e2015-01-30 15:41:39 -08001817 fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','name','accessControl','images','sites','flavors',)
Tony Mack06c8e472014-11-30 15:53:08 -05001818
1819
Sapan Bhatiadea39432014-06-13 03:10:36 -04001820
1821
1822class ReservationSerializer(serializers.HyperlinkedModelSerializer):
Scott Bakerf0480fb2014-12-23 11:12:07 -08001823 id = IdField()
Scott Baker2bcbf372014-10-29 23:41:11 -07001824
Scott Bakerb744f1c2014-11-21 11:32:24 -08001825 humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
Scott Baker96eb3fd2014-11-25 00:53:25 -08001826 validators = serializers.SerializerMethodField("getValidators")
Scott Bakerb744f1c2014-11-21 11:32:24 -08001827 def getHumanReadableName(self, obj):
1828 return str(obj)
Scott Baker96eb3fd2014-11-25 00:53:25 -08001829 def getValidators(self, obj):
1830 try:
1831 return obj.getValidators()
1832 except:
1833 return None
Scott Baker2bcbf372014-10-29 23:41:11 -07001834 class Meta:
1835 model = Reservation
Scott Baker84cf39e2015-01-30 15:41:39 -08001836 fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','startTime','slice','duration',)
Scott Baker46b58542014-08-11 17:26:12 -07001837
Scott Baker515dc9e2014-12-22 09:29:05 -08001838class ReservationIdSerializer(XOSModelSerializer):
Scott Bakerf0480fb2014-12-23 11:12:07 -08001839 id = IdField()
Scott Baker2bcbf372014-10-29 23:41:11 -07001840
Scott Bakerb744f1c2014-11-21 11:32:24 -08001841 humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
Scott Baker96eb3fd2014-11-25 00:53:25 -08001842 validators = serializers.SerializerMethodField("getValidators")
Scott Bakerb744f1c2014-11-21 11:32:24 -08001843 def getHumanReadableName(self, obj):
1844 return str(obj)
Scott Baker96eb3fd2014-11-25 00:53:25 -08001845 def getValidators(self, obj):
1846 try:
1847 return obj.getValidators()
1848 except:
1849 return None
Scott Baker515dc9e2014-12-22 09:29:05 -08001850 class Meta:
Scott Baker2bcbf372014-10-29 23:41:11 -07001851 model = Reservation
Scott Baker84cf39e2015-01-30 15:41:39 -08001852 fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','startTime','slice','duration',)
Scott Baker46b58542014-08-11 17:26:12 -07001853
1854
Scott Baker0caeaf02014-06-19 11:12:55 -07001855
1856
Scott Bakerb744f1c2014-11-21 11:32:24 -08001857class SitePrivilegeSerializer(serializers.HyperlinkedModelSerializer):
Scott Bakerf0480fb2014-12-23 11:12:07 -08001858 id = IdField()
Scott Bakerb744f1c2014-11-21 11:32:24 -08001859
1860 humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
Scott Baker96eb3fd2014-11-25 00:53:25 -08001861 validators = serializers.SerializerMethodField("getValidators")
Scott Bakerb744f1c2014-11-21 11:32:24 -08001862 def getHumanReadableName(self, obj):
1863 return str(obj)
Scott Baker96eb3fd2014-11-25 00:53:25 -08001864 def getValidators(self, obj):
1865 try:
1866 return obj.getValidators()
1867 except:
1868 return None
Scott Bakerb744f1c2014-11-21 11:32:24 -08001869 class Meta:
1870 model = SitePrivilege
Scott Baker84cf39e2015-01-30 15:41:39 -08001871 fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','user','site','role',)
Scott Bakerb744f1c2014-11-21 11:32:24 -08001872
Scott Baker515dc9e2014-12-22 09:29:05 -08001873class SitePrivilegeIdSerializer(XOSModelSerializer):
Scott Bakerf0480fb2014-12-23 11:12:07 -08001874 id = IdField()
Scott Bakerb744f1c2014-11-21 11:32:24 -08001875
1876 humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
Scott Baker96eb3fd2014-11-25 00:53:25 -08001877 validators = serializers.SerializerMethodField("getValidators")
Scott Bakerb744f1c2014-11-21 11:32:24 -08001878 def getHumanReadableName(self, obj):
1879 return str(obj)
Scott Baker96eb3fd2014-11-25 00:53:25 -08001880 def getValidators(self, obj):
1881 try:
1882 return obj.getValidators()
1883 except:
1884 return None
Scott Baker515dc9e2014-12-22 09:29:05 -08001885 class Meta:
Scott Bakerb744f1c2014-11-21 11:32:24 -08001886 model = SitePrivilege
Scott Baker84cf39e2015-01-30 15:41:39 -08001887 fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','user','site','role',)
Scott Bakerb744f1c2014-11-21 11:32:24 -08001888
1889
1890
1891
Scott Baker191f9b22015-01-12 13:16:39 -08001892class ControllerSliceSerializer(serializers.HyperlinkedModelSerializer):
Scott Bakerf0480fb2014-12-23 11:12:07 -08001893 id = IdField()
Scott Bakerb744f1c2014-11-21 11:32:24 -08001894
1895 humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
Scott Baker96eb3fd2014-11-25 00:53:25 -08001896 validators = serializers.SerializerMethodField("getValidators")
Scott Bakerb744f1c2014-11-21 11:32:24 -08001897 def getHumanReadableName(self, obj):
1898 return str(obj)
Scott Baker96eb3fd2014-11-25 00:53:25 -08001899 def getValidators(self, obj):
1900 try:
1901 return obj.getValidators()
1902 except:
1903 return None
Scott Bakerb744f1c2014-11-21 11:32:24 -08001904 class Meta:
Scott Baker191f9b22015-01-12 13:16:39 -08001905 model = ControllerSlice
Scott Baker84cf39e2015-01-30 15:41:39 -08001906 fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','controller','slice','tenant_id',)
Scott Bakerb744f1c2014-11-21 11:32:24 -08001907
Scott Baker191f9b22015-01-12 13:16:39 -08001908class ControllerSliceIdSerializer(XOSModelSerializer):
Scott Bakerf0480fb2014-12-23 11:12:07 -08001909 id = IdField()
Scott Bakerb744f1c2014-11-21 11:32:24 -08001910
1911 humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
Scott Baker96eb3fd2014-11-25 00:53:25 -08001912 validators = serializers.SerializerMethodField("getValidators")
Scott Bakerb744f1c2014-11-21 11:32:24 -08001913 def getHumanReadableName(self, obj):
1914 return str(obj)
Scott Baker96eb3fd2014-11-25 00:53:25 -08001915 def getValidators(self, obj):
1916 try:
1917 return obj.getValidators()
1918 except:
1919 return None
Scott Baker515dc9e2014-12-22 09:29:05 -08001920 class Meta:
Scott Baker191f9b22015-01-12 13:16:39 -08001921 model = ControllerSlice
Scott Baker84cf39e2015-01-30 15:41:39 -08001922 fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','controller','slice','tenant_id',)
Scott Baker46b58542014-08-11 17:26:12 -07001923
1924
Sapan Bhatiadea39432014-06-13 03:10:36 -04001925
1926
Scott Bakerf2c0c512014-12-22 17:35:34 -08001927class ControllerDashboardViewSerializer(serializers.HyperlinkedModelSerializer):
Scott Bakerf0480fb2014-12-23 11:12:07 -08001928 id = IdField()
Scott Bakerf2c0c512014-12-22 17:35:34 -08001929
1930 humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
1931 validators = serializers.SerializerMethodField("getValidators")
1932 def getHumanReadableName(self, obj):
1933 return str(obj)
1934 def getValidators(self, obj):
1935 try:
1936 return obj.getValidators()
1937 except:
1938 return None
1939 class Meta:
1940 model = ControllerDashboardView
Scott Baker84cf39e2015-01-30 15:41:39 -08001941 fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','controller','dashboardView','enabled','url',)
Scott Bakerf2c0c512014-12-22 17:35:34 -08001942
1943class ControllerDashboardViewIdSerializer(XOSModelSerializer):
Scott Bakerf0480fb2014-12-23 11:12:07 -08001944 id = IdField()
Scott Bakerf2c0c512014-12-22 17:35:34 -08001945
1946 humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
1947 validators = serializers.SerializerMethodField("getValidators")
1948 def getHumanReadableName(self, obj):
1949 return str(obj)
1950 def getValidators(self, obj):
1951 try:
1952 return obj.getValidators()
1953 except:
1954 return None
1955 class Meta:
1956 model = ControllerDashboardView
Scott Baker84cf39e2015-01-30 15:41:39 -08001957 fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','controller','dashboardView','enabled','url',)
Scott Bakerf2c0c512014-12-22 17:35:34 -08001958
1959
1960
1961
Sapan Bhatiadea39432014-06-13 03:10:36 -04001962class AccountSerializer(serializers.HyperlinkedModelSerializer):
Scott Bakerf0480fb2014-12-23 11:12:07 -08001963 id = IdField()
Scott Baker2bcbf372014-10-29 23:41:11 -07001964
Scott Bakerb744f1c2014-11-21 11:32:24 -08001965 humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
Scott Baker96eb3fd2014-11-25 00:53:25 -08001966 validators = serializers.SerializerMethodField("getValidators")
Scott Bakerb744f1c2014-11-21 11:32:24 -08001967 def getHumanReadableName(self, obj):
1968 return str(obj)
Scott Baker96eb3fd2014-11-25 00:53:25 -08001969 def getValidators(self, obj):
1970 try:
1971 return obj.getValidators()
1972 except:
1973 return None
Scott Baker2bcbf372014-10-29 23:41:11 -07001974 class Meta:
1975 model = Account
Scott Baker84cf39e2015-01-30 15:41:39 -08001976 fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','site',)
Scott Baker46b58542014-08-11 17:26:12 -07001977
Scott Baker515dc9e2014-12-22 09:29:05 -08001978class AccountIdSerializer(XOSModelSerializer):
Scott Bakerf0480fb2014-12-23 11:12:07 -08001979 id = IdField()
Scott Baker2bcbf372014-10-29 23:41:11 -07001980
Scott Bakerb744f1c2014-11-21 11:32:24 -08001981 humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
Scott Baker96eb3fd2014-11-25 00:53:25 -08001982 validators = serializers.SerializerMethodField("getValidators")
Scott Bakerb744f1c2014-11-21 11:32:24 -08001983 def getHumanReadableName(self, obj):
1984 return str(obj)
Scott Baker96eb3fd2014-11-25 00:53:25 -08001985 def getValidators(self, obj):
1986 try:
1987 return obj.getValidators()
1988 except:
1989 return None
Scott Baker515dc9e2014-12-22 09:29:05 -08001990 class Meta:
Scott Baker2bcbf372014-10-29 23:41:11 -07001991 model = Account
Scott Baker84cf39e2015-01-30 15:41:39 -08001992 fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','site',)
Scott Baker46b58542014-08-11 17:26:12 -07001993
1994
Sapan Bhatiadea39432014-06-13 03:10:36 -04001995
1996
Scott Baker515dc9e2014-12-22 09:29:05 -08001997class ControllerRoleSerializer(serializers.HyperlinkedModelSerializer):
Scott Bakerf0480fb2014-12-23 11:12:07 -08001998 id = IdField()
Scott Baker515dc9e2014-12-22 09:29:05 -08001999
2000 humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
2001 validators = serializers.SerializerMethodField("getValidators")
2002 def getHumanReadableName(self, obj):
2003 return str(obj)
2004 def getValidators(self, obj):
2005 try:
2006 return obj.getValidators()
2007 except:
2008 return None
2009 class Meta:
2010 model = ControllerRole
Scott Baker84cf39e2015-01-30 15:41:39 -08002011 fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','role',)
Scott Baker515dc9e2014-12-22 09:29:05 -08002012
2013class ControllerRoleIdSerializer(XOSModelSerializer):
Scott Bakerf0480fb2014-12-23 11:12:07 -08002014 id = IdField()
Scott Baker515dc9e2014-12-22 09:29:05 -08002015
2016 humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
2017 validators = serializers.SerializerMethodField("getValidators")
2018 def getHumanReadableName(self, obj):
2019 return str(obj)
2020 def getValidators(self, obj):
2021 try:
2022 return obj.getValidators()
2023 except:
2024 return None
2025 class Meta:
2026 model = ControllerRole
Scott Baker84cf39e2015-01-30 15:41:39 -08002027 fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','role',)
Scott Baker515dc9e2014-12-22 09:29:05 -08002028
2029
2030
2031
Scott Baker0caeaf02014-06-19 11:12:55 -07002032class NetworkParameterTypeSerializer(serializers.HyperlinkedModelSerializer):
Scott Bakerf0480fb2014-12-23 11:12:07 -08002033 id = IdField()
Scott Baker2bcbf372014-10-29 23:41:11 -07002034
Scott Bakerb744f1c2014-11-21 11:32:24 -08002035 humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
Scott Baker96eb3fd2014-11-25 00:53:25 -08002036 validators = serializers.SerializerMethodField("getValidators")
Scott Bakerb744f1c2014-11-21 11:32:24 -08002037 def getHumanReadableName(self, obj):
2038 return str(obj)
Scott Baker96eb3fd2014-11-25 00:53:25 -08002039 def getValidators(self, obj):
2040 try:
2041 return obj.getValidators()
2042 except:
2043 return None
Scott Baker2bcbf372014-10-29 23:41:11 -07002044 class Meta:
2045 model = NetworkParameterType
Scott Baker84cf39e2015-01-30 15:41:39 -08002046 fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','name','description',)
Scott Baker46b58542014-08-11 17:26:12 -07002047
Scott Baker515dc9e2014-12-22 09:29:05 -08002048class NetworkParameterTypeIdSerializer(XOSModelSerializer):
Scott Bakerf0480fb2014-12-23 11:12:07 -08002049 id = IdField()
Scott Baker2bcbf372014-10-29 23:41:11 -07002050
Scott Bakerb744f1c2014-11-21 11:32:24 -08002051 humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
Scott Baker96eb3fd2014-11-25 00:53:25 -08002052 validators = serializers.SerializerMethodField("getValidators")
Scott Bakerb744f1c2014-11-21 11:32:24 -08002053 def getHumanReadableName(self, obj):
2054 return str(obj)
Scott Baker96eb3fd2014-11-25 00:53:25 -08002055 def getValidators(self, obj):
2056 try:
2057 return obj.getValidators()
2058 except:
2059 return None
Scott Baker515dc9e2014-12-22 09:29:05 -08002060 class Meta:
Scott Baker2bcbf372014-10-29 23:41:11 -07002061 model = NetworkParameterType
Scott Baker84cf39e2015-01-30 15:41:39 -08002062 fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','name','description',)
Scott Baker46b58542014-08-11 17:26:12 -07002063
2064
Sapan Bhatiadea39432014-06-13 03:10:36 -04002065
2066
Scott Baker89a7b7c2014-10-07 00:10:17 -07002067class SiteCredentialSerializer(serializers.HyperlinkedModelSerializer):
Scott Bakerf0480fb2014-12-23 11:12:07 -08002068 id = IdField()
Scott Baker2bcbf372014-10-29 23:41:11 -07002069
Scott Bakerb744f1c2014-11-21 11:32:24 -08002070 humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
Scott Baker96eb3fd2014-11-25 00:53:25 -08002071 validators = serializers.SerializerMethodField("getValidators")
Scott Bakerb744f1c2014-11-21 11:32:24 -08002072 def getHumanReadableName(self, obj):
2073 return str(obj)
Scott Baker96eb3fd2014-11-25 00:53:25 -08002074 def getValidators(self, obj):
2075 try:
2076 return obj.getValidators()
2077 except:
2078 return None
Scott Baker2bcbf372014-10-29 23:41:11 -07002079 class Meta:
2080 model = SiteCredential
Scott Baker84cf39e2015-01-30 15:41:39 -08002081 fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','site','name','key_id','enc_value',)
Scott Baker46b58542014-08-11 17:26:12 -07002082
Scott Baker515dc9e2014-12-22 09:29:05 -08002083class SiteCredentialIdSerializer(XOSModelSerializer):
Scott Bakerf0480fb2014-12-23 11:12:07 -08002084 id = IdField()
Scott Baker2bcbf372014-10-29 23:41:11 -07002085
Scott Bakerb744f1c2014-11-21 11:32:24 -08002086 humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
Scott Baker96eb3fd2014-11-25 00:53:25 -08002087 validators = serializers.SerializerMethodField("getValidators")
Scott Bakerb744f1c2014-11-21 11:32:24 -08002088 def getHumanReadableName(self, obj):
2089 return str(obj)
Scott Baker96eb3fd2014-11-25 00:53:25 -08002090 def getValidators(self, obj):
2091 try:
2092 return obj.getValidators()
2093 except:
2094 return None
Scott Baker515dc9e2014-12-22 09:29:05 -08002095 class Meta:
Scott Baker2bcbf372014-10-29 23:41:11 -07002096 model = SiteCredential
Scott Baker84cf39e2015-01-30 15:41:39 -08002097 fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','site','name','key_id','enc_value',)
Scott Baker46b58542014-08-11 17:26:12 -07002098
2099
Scott Baker0caeaf02014-06-19 11:12:55 -07002100
2101
Scott Baker515dc9e2014-12-22 09:29:05 -08002102class DeploymentPrivilegeSerializer(serializers.HyperlinkedModelSerializer):
Scott Bakerf0480fb2014-12-23 11:12:07 -08002103 id = IdField()
Scott Baker2bcbf372014-10-29 23:41:11 -07002104
Scott Bakerb744f1c2014-11-21 11:32:24 -08002105 humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
Scott Baker96eb3fd2014-11-25 00:53:25 -08002106 validators = serializers.SerializerMethodField("getValidators")
Scott Bakerb744f1c2014-11-21 11:32:24 -08002107 def getHumanReadableName(self, obj):
2108 return str(obj)
Scott Baker96eb3fd2014-11-25 00:53:25 -08002109 def getValidators(self, obj):
2110 try:
2111 return obj.getValidators()
2112 except:
2113 return None
Scott Baker2bcbf372014-10-29 23:41:11 -07002114 class Meta:
Scott Baker515dc9e2014-12-22 09:29:05 -08002115 model = DeploymentPrivilege
Scott Baker84cf39e2015-01-30 15:41:39 -08002116 fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','user','deployment','role',)
Scott Baker46b58542014-08-11 17:26:12 -07002117
Scott Baker515dc9e2014-12-22 09:29:05 -08002118class DeploymentPrivilegeIdSerializer(XOSModelSerializer):
Scott Bakerf0480fb2014-12-23 11:12:07 -08002119 id = IdField()
Scott Baker2bcbf372014-10-29 23:41:11 -07002120
Scott Bakerb744f1c2014-11-21 11:32:24 -08002121 humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
Scott Baker96eb3fd2014-11-25 00:53:25 -08002122 validators = serializers.SerializerMethodField("getValidators")
Scott Bakerb744f1c2014-11-21 11:32:24 -08002123 def getHumanReadableName(self, obj):
2124 return str(obj)
Scott Baker96eb3fd2014-11-25 00:53:25 -08002125 def getValidators(self, obj):
2126 try:
2127 return obj.getValidators()
2128 except:
2129 return None
Scott Baker515dc9e2014-12-22 09:29:05 -08002130 class Meta:
2131 model = DeploymentPrivilege
Scott Baker84cf39e2015-01-30 15:41:39 -08002132 fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','user','deployment','role',)
Scott Baker8b533192014-11-17 22:32:19 -08002133
2134
2135
2136
Scott Baker191f9b22015-01-12 13:16:39 -08002137class ControllerSlicePrivilegeSerializer(serializers.HyperlinkedModelSerializer):
Scott Bakerf0480fb2014-12-23 11:12:07 -08002138 id = IdField()
Scott Baker2bcbf372014-10-29 23:41:11 -07002139
Scott Bakerb744f1c2014-11-21 11:32:24 -08002140 humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
Scott Baker96eb3fd2014-11-25 00:53:25 -08002141 validators = serializers.SerializerMethodField("getValidators")
Scott Bakerb744f1c2014-11-21 11:32:24 -08002142 def getHumanReadableName(self, obj):
2143 return str(obj)
Scott Baker96eb3fd2014-11-25 00:53:25 -08002144 def getValidators(self, obj):
2145 try:
2146 return obj.getValidators()
2147 except:
2148 return None
Scott Baker2bcbf372014-10-29 23:41:11 -07002149 class Meta:
Scott Baker191f9b22015-01-12 13:16:39 -08002150 model = ControllerSlicePrivilege
Scott Baker84cf39e2015-01-30 15:41:39 -08002151 fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','controller','slice_privilege','role_id',)
Scott Baker515dc9e2014-12-22 09:29:05 -08002152
Scott Baker191f9b22015-01-12 13:16:39 -08002153class ControllerSlicePrivilegeIdSerializer(XOSModelSerializer):
Scott Bakerf0480fb2014-12-23 11:12:07 -08002154 id = IdField()
Scott Baker515dc9e2014-12-22 09:29:05 -08002155
2156 humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
2157 validators = serializers.SerializerMethodField("getValidators")
2158 def getHumanReadableName(self, obj):
2159 return str(obj)
2160 def getValidators(self, obj):
2161 try:
2162 return obj.getValidators()
2163 except:
2164 return None
2165 class Meta:
Scott Baker191f9b22015-01-12 13:16:39 -08002166 model = ControllerSlicePrivilege
Scott Baker84cf39e2015-01-30 15:41:39 -08002167 fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','controller','slice_privilege','role_id',)
Scott Baker191f9b22015-01-12 13:16:39 -08002168
2169
2170
2171
2172class SiteDeploymentSerializer(serializers.HyperlinkedModelSerializer):
2173 id = IdField()
2174
2175 humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
2176 validators = serializers.SerializerMethodField("getValidators")
2177 def getHumanReadableName(self, obj):
2178 return str(obj)
2179 def getValidators(self, obj):
2180 try:
2181 return obj.getValidators()
2182 except:
2183 return None
2184 class Meta:
2185 model = SiteDeployment
Scott Baker84cf39e2015-01-30 15:41:39 -08002186 fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','site','deployment','controller','availability_zone',)
Scott Baker191f9b22015-01-12 13:16:39 -08002187
2188class SiteDeploymentIdSerializer(XOSModelSerializer):
2189 id = IdField()
2190
2191 humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
2192 validators = serializers.SerializerMethodField("getValidators")
2193 def getHumanReadableName(self, obj):
2194 return str(obj)
2195 def getValidators(self, obj):
2196 try:
2197 return obj.getValidators()
2198 except:
2199 return None
2200 class Meta:
2201 model = SiteDeployment
Scott Baker84cf39e2015-01-30 15:41:39 -08002202 fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','site','deployment','controller','availability_zone',)
Scott Baker515dc9e2014-12-22 09:29:05 -08002203
2204
2205
2206
2207class DeploymentRoleSerializer(serializers.HyperlinkedModelSerializer):
Scott Bakerf0480fb2014-12-23 11:12:07 -08002208 id = IdField()
Scott Baker515dc9e2014-12-22 09:29:05 -08002209
2210 humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
2211 validators = serializers.SerializerMethodField("getValidators")
2212 def getHumanReadableName(self, obj):
2213 return str(obj)
2214 def getValidators(self, obj):
2215 try:
2216 return obj.getValidators()
2217 except:
2218 return None
2219 class Meta:
2220 model = DeploymentRole
Scott Baker84cf39e2015-01-30 15:41:39 -08002221 fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','role',)
Scott Baker46b58542014-08-11 17:26:12 -07002222
Scott Baker515dc9e2014-12-22 09:29:05 -08002223class DeploymentRoleIdSerializer(XOSModelSerializer):
Scott Bakerf0480fb2014-12-23 11:12:07 -08002224 id = IdField()
Scott Baker2bcbf372014-10-29 23:41:11 -07002225
Scott Bakerb744f1c2014-11-21 11:32:24 -08002226 humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
Scott Baker96eb3fd2014-11-25 00:53:25 -08002227 validators = serializers.SerializerMethodField("getValidators")
Scott Bakerb744f1c2014-11-21 11:32:24 -08002228 def getHumanReadableName(self, obj):
2229 return str(obj)
Scott Baker96eb3fd2014-11-25 00:53:25 -08002230 def getValidators(self, obj):
2231 try:
2232 return obj.getValidators()
2233 except:
2234 return None
Scott Baker515dc9e2014-12-22 09:29:05 -08002235 class Meta:
2236 model = DeploymentRole
Scott Baker84cf39e2015-01-30 15:41:39 -08002237 fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','role',)
Scott Baker46b58542014-08-11 17:26:12 -07002238
2239
Sapan Bhatiadea39432014-06-13 03:10:36 -04002240
2241
Scott Baker89a7b7c2014-10-07 00:10:17 -07002242class UserCredentialSerializer(serializers.HyperlinkedModelSerializer):
Scott Bakerf0480fb2014-12-23 11:12:07 -08002243 id = IdField()
Scott Baker2bcbf372014-10-29 23:41:11 -07002244
Scott Bakerb744f1c2014-11-21 11:32:24 -08002245 humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
Scott Baker96eb3fd2014-11-25 00:53:25 -08002246 validators = serializers.SerializerMethodField("getValidators")
Scott Bakerb744f1c2014-11-21 11:32:24 -08002247 def getHumanReadableName(self, obj):
2248 return str(obj)
Scott Baker96eb3fd2014-11-25 00:53:25 -08002249 def getValidators(self, obj):
2250 try:
2251 return obj.getValidators()
2252 except:
2253 return None
Scott Baker2bcbf372014-10-29 23:41:11 -07002254 class Meta:
2255 model = UserCredential
Scott Baker84cf39e2015-01-30 15:41:39 -08002256 fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','user','name','key_id','enc_value',)
Scott Baker46b58542014-08-11 17:26:12 -07002257
Scott Baker515dc9e2014-12-22 09:29:05 -08002258class UserCredentialIdSerializer(XOSModelSerializer):
Scott Bakerf0480fb2014-12-23 11:12:07 -08002259 id = IdField()
Scott Baker2bcbf372014-10-29 23:41:11 -07002260
Scott Bakerb744f1c2014-11-21 11:32:24 -08002261 humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
Scott Baker96eb3fd2014-11-25 00:53:25 -08002262 validators = serializers.SerializerMethodField("getValidators")
Scott Bakerb744f1c2014-11-21 11:32:24 -08002263 def getHumanReadableName(self, obj):
2264 return str(obj)
Scott Baker96eb3fd2014-11-25 00:53:25 -08002265 def getValidators(self, obj):
2266 try:
2267 return obj.getValidators()
2268 except:
2269 return None
Scott Baker515dc9e2014-12-22 09:29:05 -08002270 class Meta:
Scott Baker2bcbf372014-10-29 23:41:11 -07002271 model = UserCredential
Scott Baker84cf39e2015-01-30 15:41:39 -08002272 fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','user','name','key_id','enc_value',)
Scott Bakerb744f1c2014-11-21 11:32:24 -08002273
2274
2275
2276
Scott Baker0caeaf02014-06-19 11:12:55 -07002277class SliceTagSerializer(serializers.HyperlinkedModelSerializer):
Scott Bakerf0480fb2014-12-23 11:12:07 -08002278 id = IdField()
Scott Baker2bcbf372014-10-29 23:41:11 -07002279
Scott Bakerb744f1c2014-11-21 11:32:24 -08002280 humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
Scott Baker96eb3fd2014-11-25 00:53:25 -08002281 validators = serializers.SerializerMethodField("getValidators")
Scott Bakerb744f1c2014-11-21 11:32:24 -08002282 def getHumanReadableName(self, obj):
2283 return str(obj)
Scott Baker96eb3fd2014-11-25 00:53:25 -08002284 def getValidators(self, obj):
2285 try:
2286 return obj.getValidators()
2287 except:
2288 return None
Scott Baker2bcbf372014-10-29 23:41:11 -07002289 class Meta:
2290 model = SliceTag
Scott Baker84cf39e2015-01-30 15:41:39 -08002291 fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','slice','name','value',)
Scott Baker46b58542014-08-11 17:26:12 -07002292
Scott Baker515dc9e2014-12-22 09:29:05 -08002293class SliceTagIdSerializer(XOSModelSerializer):
Scott Bakerf0480fb2014-12-23 11:12:07 -08002294 id = IdField()
Scott Baker2bcbf372014-10-29 23:41:11 -07002295
Scott Bakerb744f1c2014-11-21 11:32:24 -08002296 humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
Scott Baker96eb3fd2014-11-25 00:53:25 -08002297 validators = serializers.SerializerMethodField("getValidators")
Scott Bakerb744f1c2014-11-21 11:32:24 -08002298 def getHumanReadableName(self, obj):
2299 return str(obj)
Scott Baker96eb3fd2014-11-25 00:53:25 -08002300 def getValidators(self, obj):
2301 try:
2302 return obj.getValidators()
2303 except:
2304 return None
Scott Baker515dc9e2014-12-22 09:29:05 -08002305 class Meta:
Scott Baker2bcbf372014-10-29 23:41:11 -07002306 model = SliceTag
Scott Baker84cf39e2015-01-30 15:41:39 -08002307 fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','slice','name','value',)
Scott Baker46b58542014-08-11 17:26:12 -07002308
2309
Scott Baker0caeaf02014-06-19 11:12:55 -07002310
2311
Scott Bakerf2c0c512014-12-22 17:35:34 -08002312class NetworkTemplateSerializer(serializers.HyperlinkedModelSerializer):
Scott Bakerf0480fb2014-12-23 11:12:07 -08002313 id = IdField()
Scott Baker2bcbf372014-10-29 23:41:11 -07002314
Scott Bakerb744f1c2014-11-21 11:32:24 -08002315 humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
Scott Baker96eb3fd2014-11-25 00:53:25 -08002316 validators = serializers.SerializerMethodField("getValidators")
Scott Bakerb744f1c2014-11-21 11:32:24 -08002317 def getHumanReadableName(self, obj):
2318 return str(obj)
Scott Baker96eb3fd2014-11-25 00:53:25 -08002319 def getValidators(self, obj):
2320 try:
2321 return obj.getValidators()
2322 except:
2323 return None
Scott Baker2bcbf372014-10-29 23:41:11 -07002324 class Meta:
Scott Bakerf2c0c512014-12-22 17:35:34 -08002325 model = NetworkTemplate
Scott Baker84cf39e2015-01-30 15:41:39 -08002326 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 Baker46b58542014-08-11 17:26:12 -07002327
Scott Bakerf2c0c512014-12-22 17:35:34 -08002328class NetworkTemplateIdSerializer(XOSModelSerializer):
Scott Bakerf0480fb2014-12-23 11:12:07 -08002329 id = IdField()
Scott Baker2bcbf372014-10-29 23:41:11 -07002330
Scott Bakerb744f1c2014-11-21 11:32:24 -08002331 humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
Scott Baker96eb3fd2014-11-25 00:53:25 -08002332 validators = serializers.SerializerMethodField("getValidators")
Scott Bakerb744f1c2014-11-21 11:32:24 -08002333 def getHumanReadableName(self, obj):
2334 return str(obj)
Scott Baker96eb3fd2014-11-25 00:53:25 -08002335 def getValidators(self, obj):
2336 try:
2337 return obj.getValidators()
2338 except:
2339 return None
Scott Baker515dc9e2014-12-22 09:29:05 -08002340 class Meta:
Scott Bakerf2c0c512014-12-22 17:35:34 -08002341 model = NetworkTemplate
Scott Baker84cf39e2015-01-30 15:41:39 -08002342 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 Baker46b58542014-08-11 17:26:12 -07002343
2344
Sapan Bhatiadea39432014-06-13 03:10:36 -04002345
2346
2347class RouterSerializer(serializers.HyperlinkedModelSerializer):
Scott Bakerf0480fb2014-12-23 11:12:07 -08002348 id = IdField()
Scott Baker2bcbf372014-10-29 23:41:11 -07002349
Scott Baker515dc9e2014-12-22 09:29:05 -08002350
2351 networks = serializers.HyperlinkedRelatedField(many=True, read_only=True, view_name='network-detail')
2352
2353
2354
2355 networks = serializers.HyperlinkedRelatedField(many=True, read_only=True, view_name='network-detail')
2356
2357
Scott Bakerb744f1c2014-11-21 11:32:24 -08002358 humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
Scott Baker96eb3fd2014-11-25 00:53:25 -08002359 validators = serializers.SerializerMethodField("getValidators")
Scott Bakerb744f1c2014-11-21 11:32:24 -08002360 def getHumanReadableName(self, obj):
2361 return str(obj)
Scott Baker96eb3fd2014-11-25 00:53:25 -08002362 def getValidators(self, obj):
2363 try:
2364 return obj.getValidators()
2365 except:
2366 return None
Scott Baker2bcbf372014-10-29 23:41:11 -07002367 class Meta:
2368 model = Router
Scott Baker84cf39e2015-01-30 15:41:39 -08002369 fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','name','owner','networks','networks',)
Scott Baker46b58542014-08-11 17:26:12 -07002370
Scott Baker515dc9e2014-12-22 09:29:05 -08002371class RouterIdSerializer(XOSModelSerializer):
Scott Bakerf0480fb2014-12-23 11:12:07 -08002372 id = IdField()
Scott Baker2bcbf372014-10-29 23:41:11 -07002373
Scott Baker515dc9e2014-12-22 09:29:05 -08002374
Scott Baker201f7da2014-12-23 10:56:06 -08002375 networks = serializers.PrimaryKeyRelatedField(many=True, queryset = Network.objects.all())
Scott Baker515dc9e2014-12-22 09:29:05 -08002376
2377
2378
Scott Baker201f7da2014-12-23 10:56:06 -08002379 networks = serializers.PrimaryKeyRelatedField(many=True, queryset = Network.objects.all())
Scott Baker515dc9e2014-12-22 09:29:05 -08002380
2381
Scott Bakerb744f1c2014-11-21 11:32:24 -08002382 humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
Scott Baker96eb3fd2014-11-25 00:53:25 -08002383 validators = serializers.SerializerMethodField("getValidators")
Scott Bakerb744f1c2014-11-21 11:32:24 -08002384 def getHumanReadableName(self, obj):
2385 return str(obj)
Scott Baker96eb3fd2014-11-25 00:53:25 -08002386 def getValidators(self, obj):
2387 try:
2388 return obj.getValidators()
2389 except:
2390 return None
Scott Baker515dc9e2014-12-22 09:29:05 -08002391 class Meta:
Scott Baker2bcbf372014-10-29 23:41:11 -07002392 model = Router
Scott Baker84cf39e2015-01-30 15:41:39 -08002393 fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','name','owner','networks','networks',)
Scott Baker46b58542014-08-11 17:26:12 -07002394
2395
Sapan Bhatiadea39432014-06-13 03:10:36 -04002396
2397
Scott Baker0caeaf02014-06-19 11:12:55 -07002398class ServiceResourceSerializer(serializers.HyperlinkedModelSerializer):
Scott Bakerf0480fb2014-12-23 11:12:07 -08002399 id = IdField()
Scott Baker2bcbf372014-10-29 23:41:11 -07002400
Scott Bakerb744f1c2014-11-21 11:32:24 -08002401 humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
Scott Baker96eb3fd2014-11-25 00:53:25 -08002402 validators = serializers.SerializerMethodField("getValidators")
Scott Bakerb744f1c2014-11-21 11:32:24 -08002403 def getHumanReadableName(self, obj):
2404 return str(obj)
Scott Baker96eb3fd2014-11-25 00:53:25 -08002405 def getValidators(self, obj):
2406 try:
2407 return obj.getValidators()
2408 except:
2409 return None
Scott Baker2bcbf372014-10-29 23:41:11 -07002410 class Meta:
2411 model = ServiceResource
Scott Baker84cf39e2015-01-30 15:41:39 -08002412 fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','serviceClass','name','maxUnitsDeployment','maxUnitsNode','maxDuration','bucketInRate','bucketMaxSize','cost','calendarReservable',)
Scott Baker46b58542014-08-11 17:26:12 -07002413
Scott Baker515dc9e2014-12-22 09:29:05 -08002414class ServiceResourceIdSerializer(XOSModelSerializer):
Scott Bakerf0480fb2014-12-23 11:12:07 -08002415 id = IdField()
Scott Baker2bcbf372014-10-29 23:41:11 -07002416
Scott Bakerb744f1c2014-11-21 11:32:24 -08002417 humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
Scott Baker96eb3fd2014-11-25 00:53:25 -08002418 validators = serializers.SerializerMethodField("getValidators")
Scott Bakerb744f1c2014-11-21 11:32:24 -08002419 def getHumanReadableName(self, obj):
2420 return str(obj)
Scott Baker96eb3fd2014-11-25 00:53:25 -08002421 def getValidators(self, obj):
2422 try:
2423 return obj.getValidators()
2424 except:
2425 return None
Scott Baker515dc9e2014-12-22 09:29:05 -08002426 class Meta:
Scott Baker2bcbf372014-10-29 23:41:11 -07002427 model = ServiceResource
Scott Baker84cf39e2015-01-30 15:41:39 -08002428 fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','serviceClass','name','maxUnitsDeployment','maxUnitsNode','maxDuration','bucketInRate','bucketMaxSize','cost','calendarReservable',)
Scott Baker46b58542014-08-11 17:26:12 -07002429
2430
Sapan Bhatiadea39432014-06-13 03:10:36 -04002431
2432
Scott Baker72758c72015-02-10 19:26:35 -08002433serializerLookUp = {
Sapan Bhatiadea39432014-06-13 03:10:36 -04002434
Scott Baker0caeaf02014-06-19 11:12:55 -07002435 ServiceAttribute: ServiceAttributeSerializer,
Sapan Bhatiadea39432014-06-13 03:10:36 -04002436
Scott Baker515dc9e2014-12-22 09:29:05 -08002437 ControllerImages: ControllerImagesSerializer,
2438
Scott Baker191f9b22015-01-12 13:16:39 -08002439 ControllerSitePrivilege: ControllerSitePrivilegeSerializer,
2440
Sapan Bhatiadea39432014-06-13 03:10:36 -04002441 Image: ImageSerializer,
2442
Scott Baker0caeaf02014-06-19 11:12:55 -07002443 NetworkParameter: NetworkParameterSerializer,
Sapan Bhatiadea39432014-06-13 03:10:36 -04002444
2445 Site: SiteSerializer,
2446
Scott Baker0caeaf02014-06-19 11:12:55 -07002447 SliceRole: SliceRoleSerializer,
Sapan Bhatiadea39432014-06-13 03:10:36 -04002448
2449 Tag: TagSerializer,
2450
2451 Invoice: InvoiceSerializer,
2452
Scott Baker0caeaf02014-06-19 11:12:55 -07002453 SlicePrivilege: SlicePrivilegeSerializer,
Sapan Bhatiadea39432014-06-13 03:10:36 -04002454
Scott Baker89a7b7c2014-10-07 00:10:17 -07002455 PlanetStackRole: PlanetStackRoleSerializer,
2456
Scott Baker0caeaf02014-06-19 11:12:55 -07002457 NetworkSliver: NetworkSliverSerializer,
Sapan Bhatiadea39432014-06-13 03:10:36 -04002458
Scott Baker191f9b22015-01-12 13:16:39 -08002459 Flavor: FlavorSerializer,
2460
2461 ControllerSite: ControllerSiteSerializer,
2462
Scott Baker89a7b7c2014-10-07 00:10:17 -07002463 Project: ProjectSerializer,
2464
Sapan Bhatiadea39432014-06-13 03:10:36 -04002465 Slice: SliceSerializer,
2466
2467 Network: NetworkSerializer,
2468
2469 Service: ServiceSerializer,
2470
Scott Baker0caeaf02014-06-19 11:12:55 -07002471 ServiceClass: ServiceClassSerializer,
Sapan Bhatiadea39432014-06-13 03:10:36 -04002472
Scott Baker191f9b22015-01-12 13:16:39 -08002473 PlanetStack: PlanetStackSerializer,
Sapan Bhatiadea39432014-06-13 03:10:36 -04002474
2475 Charge: ChargeSerializer,
2476
2477 Role: RoleSerializer,
2478
Scott Baker0caeaf02014-06-19 11:12:55 -07002479 UsableObject: UsableObjectSerializer,
2480
2481 SiteRole: SiteRoleSerializer,
Sapan Bhatiadea39432014-06-13 03:10:36 -04002482
Scott Baker89a7b7c2014-10-07 00:10:17 -07002483 SliceCredential: SliceCredentialSerializer,
2484
Sapan Bhatiadea39432014-06-13 03:10:36 -04002485 Sliver: SliverSerializer,
2486
2487 Node: NodeSerializer,
2488
Scott Baker0caeaf02014-06-19 11:12:55 -07002489 DashboardView: DashboardViewSerializer,
Sapan Bhatiadea39432014-06-13 03:10:36 -04002490
Scott Baker191f9b22015-01-12 13:16:39 -08002491 ControllerNetwork: ControllerNetworkSerializer,
2492
Scott Baker515dc9e2014-12-22 09:29:05 -08002493 ImageDeployments: ImageDeploymentsSerializer,
Sapan Bhatiadea39432014-06-13 03:10:36 -04002494
Scott Baker191f9b22015-01-12 13:16:39 -08002495 ControllerUser: ControllerUserSerializer,
2496
Scott Bakerb744f1c2014-11-21 11:32:24 -08002497 ReservedResource: ReservedResourceSerializer,
Scott Baker8b533192014-11-17 22:32:19 -08002498
Scott Baker515dc9e2014-12-22 09:29:05 -08002499 Payment: PaymentSerializer,
2500
Scott Baker0caeaf02014-06-19 11:12:55 -07002501 NetworkSlice: NetworkSliceSerializer,
2502
2503 UserDashboardView: UserDashboardViewSerializer,
2504
Scott Baker515dc9e2014-12-22 09:29:05 -08002505 Controller: ControllerSerializer,
2506
Scott Baker0caeaf02014-06-19 11:12:55 -07002507 PlanetStackPrivilege: PlanetStackPrivilegeSerializer,
Sapan Bhatiadea39432014-06-13 03:10:36 -04002508
2509 User: UserSerializer,
2510
2511 Deployment: DeploymentSerializer,
2512
2513 Reservation: ReservationSerializer,
2514
Scott Baker0caeaf02014-06-19 11:12:55 -07002515 SitePrivilege: SitePrivilegeSerializer,
Sapan Bhatiadea39432014-06-13 03:10:36 -04002516
Scott Baker191f9b22015-01-12 13:16:39 -08002517 ControllerSlice: ControllerSliceSerializer,
Scott Baker0caeaf02014-06-19 11:12:55 -07002518
Scott Bakerf2c0c512014-12-22 17:35:34 -08002519 ControllerDashboardView: ControllerDashboardViewSerializer,
2520
Sapan Bhatiadea39432014-06-13 03:10:36 -04002521 Account: AccountSerializer,
2522
Scott Baker515dc9e2014-12-22 09:29:05 -08002523 ControllerRole: ControllerRoleSerializer,
2524
Scott Baker0caeaf02014-06-19 11:12:55 -07002525 NetworkParameterType: NetworkParameterTypeSerializer,
Sapan Bhatiadea39432014-06-13 03:10:36 -04002526
Scott Baker89a7b7c2014-10-07 00:10:17 -07002527 SiteCredential: SiteCredentialSerializer,
Sapan Bhatiadea39432014-06-13 03:10:36 -04002528
Scott Baker515dc9e2014-12-22 09:29:05 -08002529 DeploymentPrivilege: DeploymentPrivilegeSerializer,
Sapan Bhatiadea39432014-06-13 03:10:36 -04002530
Scott Baker191f9b22015-01-12 13:16:39 -08002531 ControllerSlicePrivilege: ControllerSlicePrivilegeSerializer,
2532
2533 SiteDeployment: SiteDeploymentSerializer,
Scott Baker515dc9e2014-12-22 09:29:05 -08002534
2535 DeploymentRole: DeploymentRoleSerializer,
Sapan Bhatiadea39432014-06-13 03:10:36 -04002536
Scott Baker89a7b7c2014-10-07 00:10:17 -07002537 UserCredential: UserCredentialSerializer,
2538
Scott Baker0caeaf02014-06-19 11:12:55 -07002539 SliceTag: SliceTagSerializer,
Sapan Bhatiadea39432014-06-13 03:10:36 -04002540
Scott Bakerf2c0c512014-12-22 17:35:34 -08002541 NetworkTemplate: NetworkTemplateSerializer,
Sapan Bhatiadea39432014-06-13 03:10:36 -04002542
2543 Router: RouterSerializer,
2544
Scott Baker0caeaf02014-06-19 11:12:55 -07002545 ServiceResource: ServiceResourceSerializer,
Sapan Bhatiadea39432014-06-13 03:10:36 -04002546
2547 None: None,
2548 }
2549
2550# Based on core/views/*.py
2551
2552
Scott Baker72758c72015-02-10 19:26:35 -08002553class ServiceAttributeList(XOSListCreateAPIView):
Scott Baker0caeaf02014-06-19 11:12:55 -07002554 queryset = ServiceAttribute.objects.select_related().all()
2555 serializer_class = ServiceAttributeSerializer
Scott Baker46b58542014-08-11 17:26:12 -07002556 id_serializer_class = ServiceAttributeIdSerializer
2557 filter_backends = (filters.DjangoFilterBackend,)
Scott Baker84cf39e2015-01-30 15:41:39 -08002558 filter_fields = ('id','created','updated','enacted','policed','backend_register','backend_status','deleted','name','value','service',)
Scott Baker46b58542014-08-11 17:26:12 -07002559
2560 def get_serializer_class(self):
Scott Baker84cf39e2015-01-30 15:41:39 -08002561 no_hyperlinks=False
2562 if hasattr(self.request,"QUERY_PARAMS"):
2563 no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
Scott Baker46b58542014-08-11 17:26:12 -07002564 if (no_hyperlinks):
2565 return self.id_serializer_class
2566 else:
2567 return self.serializer_class
2568
Scott Baker0caeaf02014-06-19 11:12:55 -07002569 def get_queryset(self):
Scott Baker20101af2015-02-02 10:41:12 -08002570 if (not self.request.user.is_authenticated()):
Scott Baker4af864e2015-02-02 13:53:46 -08002571 raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API")
Scott Baker0caeaf02014-06-19 11:12:55 -07002572 return ServiceAttribute.select_by_user(self.request.user)
Sapan Bhatiadea39432014-06-13 03:10:36 -04002573
Scott Baker0caeaf02014-06-19 11:12:55 -07002574
Scott Baker72758c72015-02-10 19:26:35 -08002575class ServiceAttributeDetail(XOSRetrieveUpdateDestroyAPIView):
Scott Baker0caeaf02014-06-19 11:12:55 -07002576 queryset = ServiceAttribute.objects.select_related().all()
2577 serializer_class = ServiceAttributeSerializer
Scott Baker46b58542014-08-11 17:26:12 -07002578 id_serializer_class = ServiceAttributeIdSerializer
2579
2580 def get_serializer_class(self):
Scott Baker84cf39e2015-01-30 15:41:39 -08002581 no_hyperlinks=False
2582 if hasattr(self.request,"QUERY_PARAMS"):
2583 no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
Scott Baker46b58542014-08-11 17:26:12 -07002584 if (no_hyperlinks):
2585 return self.id_serializer_class
2586 else:
2587 return self.serializer_class
Scott Baker84cf39e2015-01-30 15:41:39 -08002588
Scott Baker0caeaf02014-06-19 11:12:55 -07002589 def get_queryset(self):
Scott Baker20101af2015-02-02 10:41:12 -08002590 if (not self.request.user.is_authenticated()):
Scott Baker4af864e2015-02-02 13:53:46 -08002591 raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API")
Scott Baker0caeaf02014-06-19 11:12:55 -07002592 return ServiceAttribute.select_by_user(self.request.user)
2593
Scott Baker72758c72015-02-10 19:26:35 -08002594 # update() is handled by XOSRetrieveUpdateDestroyAPIView
Scott Baker0caeaf02014-06-19 11:12:55 -07002595
Scott Baker72758c72015-02-10 19:26:35 -08002596 # destroy() is handled by XOSRetrieveUpdateDestroyAPIView
Sapan Bhatiadea39432014-06-13 03:10:36 -04002597
2598
2599
Scott Baker72758c72015-02-10 19:26:35 -08002600class ControllerImagesList(XOSListCreateAPIView):
Scott Baker515dc9e2014-12-22 09:29:05 -08002601 queryset = ControllerImages.objects.select_related().all()
2602 serializer_class = ControllerImagesSerializer
2603 id_serializer_class = ControllerImagesIdSerializer
2604 filter_backends = (filters.DjangoFilterBackend,)
Scott Baker84cf39e2015-01-30 15:41:39 -08002605 filter_fields = ('id','created','updated','enacted','policed','backend_register','backend_status','deleted','image','controller','glance_image_id',)
Scott Baker515dc9e2014-12-22 09:29:05 -08002606
2607 def get_serializer_class(self):
Scott Baker84cf39e2015-01-30 15:41:39 -08002608 no_hyperlinks=False
2609 if hasattr(self.request,"QUERY_PARAMS"):
2610 no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
Scott Baker515dc9e2014-12-22 09:29:05 -08002611 if (no_hyperlinks):
2612 return self.id_serializer_class
2613 else:
2614 return self.serializer_class
2615
2616 def get_queryset(self):
Scott Baker20101af2015-02-02 10:41:12 -08002617 if (not self.request.user.is_authenticated()):
Scott Baker4af864e2015-02-02 13:53:46 -08002618 raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API")
Scott Baker515dc9e2014-12-22 09:29:05 -08002619 return ControllerImages.select_by_user(self.request.user)
2620
Scott Baker515dc9e2014-12-22 09:29:05 -08002621
Scott Baker72758c72015-02-10 19:26:35 -08002622class ControllerImagesDetail(XOSRetrieveUpdateDestroyAPIView):
Scott Baker515dc9e2014-12-22 09:29:05 -08002623 queryset = ControllerImages.objects.select_related().all()
2624 serializer_class = ControllerImagesSerializer
2625 id_serializer_class = ControllerImagesIdSerializer
2626
2627 def get_serializer_class(self):
Scott Baker84cf39e2015-01-30 15:41:39 -08002628 no_hyperlinks=False
2629 if hasattr(self.request,"QUERY_PARAMS"):
2630 no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
Scott Baker515dc9e2014-12-22 09:29:05 -08002631 if (no_hyperlinks):
2632 return self.id_serializer_class
2633 else:
2634 return self.serializer_class
Scott Baker84cf39e2015-01-30 15:41:39 -08002635
Scott Baker515dc9e2014-12-22 09:29:05 -08002636 def get_queryset(self):
Scott Baker20101af2015-02-02 10:41:12 -08002637 if (not self.request.user.is_authenticated()):
Scott Baker4af864e2015-02-02 13:53:46 -08002638 raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API")
Scott Baker515dc9e2014-12-22 09:29:05 -08002639 return ControllerImages.select_by_user(self.request.user)
2640
Scott Baker72758c72015-02-10 19:26:35 -08002641 # update() is handled by XOSRetrieveUpdateDestroyAPIView
Scott Baker515dc9e2014-12-22 09:29:05 -08002642
Scott Baker72758c72015-02-10 19:26:35 -08002643 # destroy() is handled by XOSRetrieveUpdateDestroyAPIView
Scott Baker515dc9e2014-12-22 09:29:05 -08002644
2645
2646
Scott Baker72758c72015-02-10 19:26:35 -08002647class ControllerSitePrivilegeList(XOSListCreateAPIView):
Scott Baker191f9b22015-01-12 13:16:39 -08002648 queryset = ControllerSitePrivilege.objects.select_related().all()
2649 serializer_class = ControllerSitePrivilegeSerializer
2650 id_serializer_class = ControllerSitePrivilegeIdSerializer
2651 filter_backends = (filters.DjangoFilterBackend,)
Scott Baker84cf39e2015-01-30 15:41:39 -08002652 filter_fields = ('id','created','updated','enacted','policed','backend_register','backend_status','deleted','controller','site_privilege','role_id',)
Scott Baker191f9b22015-01-12 13:16:39 -08002653
2654 def get_serializer_class(self):
Scott Baker84cf39e2015-01-30 15:41:39 -08002655 no_hyperlinks=False
2656 if hasattr(self.request,"QUERY_PARAMS"):
2657 no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
Scott Baker191f9b22015-01-12 13:16:39 -08002658 if (no_hyperlinks):
2659 return self.id_serializer_class
2660 else:
2661 return self.serializer_class
2662
2663 def get_queryset(self):
Scott Baker20101af2015-02-02 10:41:12 -08002664 if (not self.request.user.is_authenticated()):
Scott Baker4af864e2015-02-02 13:53:46 -08002665 raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API")
Scott Baker191f9b22015-01-12 13:16:39 -08002666 return ControllerSitePrivilege.select_by_user(self.request.user)
2667
Scott Baker191f9b22015-01-12 13:16:39 -08002668
Scott Baker72758c72015-02-10 19:26:35 -08002669class ControllerSitePrivilegeDetail(XOSRetrieveUpdateDestroyAPIView):
Scott Baker191f9b22015-01-12 13:16:39 -08002670 queryset = ControllerSitePrivilege.objects.select_related().all()
2671 serializer_class = ControllerSitePrivilegeSerializer
2672 id_serializer_class = ControllerSitePrivilegeIdSerializer
2673
2674 def get_serializer_class(self):
Scott Baker84cf39e2015-01-30 15:41:39 -08002675 no_hyperlinks=False
2676 if hasattr(self.request,"QUERY_PARAMS"):
2677 no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
Scott Baker191f9b22015-01-12 13:16:39 -08002678 if (no_hyperlinks):
2679 return self.id_serializer_class
2680 else:
2681 return self.serializer_class
Scott Baker84cf39e2015-01-30 15:41:39 -08002682
Scott Baker191f9b22015-01-12 13:16:39 -08002683 def get_queryset(self):
Scott Baker20101af2015-02-02 10:41:12 -08002684 if (not self.request.user.is_authenticated()):
Scott Baker4af864e2015-02-02 13:53:46 -08002685 raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API")
Scott Baker191f9b22015-01-12 13:16:39 -08002686 return ControllerSitePrivilege.select_by_user(self.request.user)
2687
Scott Baker72758c72015-02-10 19:26:35 -08002688 # update() is handled by XOSRetrieveUpdateDestroyAPIView
Scott Baker191f9b22015-01-12 13:16:39 -08002689
Scott Baker72758c72015-02-10 19:26:35 -08002690 # destroy() is handled by XOSRetrieveUpdateDestroyAPIView
Scott Baker191f9b22015-01-12 13:16:39 -08002691
2692
2693
Scott Baker72758c72015-02-10 19:26:35 -08002694class ImageList(XOSListCreateAPIView):
Scott Baker0caeaf02014-06-19 11:12:55 -07002695 queryset = Image.objects.select_related().all()
Sapan Bhatiadea39432014-06-13 03:10:36 -04002696 serializer_class = ImageSerializer
Scott Baker46b58542014-08-11 17:26:12 -07002697 id_serializer_class = ImageIdSerializer
2698 filter_backends = (filters.DjangoFilterBackend,)
Scott Baker84cf39e2015-01-30 15:41:39 -08002699 filter_fields = ('id','created','updated','enacted','policed','backend_register','backend_status','deleted','name','disk_format','container_format','path','deployments',)
Scott Baker46b58542014-08-11 17:26:12 -07002700
2701 def get_serializer_class(self):
Scott Baker84cf39e2015-01-30 15:41:39 -08002702 no_hyperlinks=False
2703 if hasattr(self.request,"QUERY_PARAMS"):
2704 no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
Scott Baker46b58542014-08-11 17:26:12 -07002705 if (no_hyperlinks):
2706 return self.id_serializer_class
2707 else:
2708 return self.serializer_class
2709
Scott Baker0caeaf02014-06-19 11:12:55 -07002710 def get_queryset(self):
Scott Baker20101af2015-02-02 10:41:12 -08002711 if (not self.request.user.is_authenticated()):
Scott Baker4af864e2015-02-02 13:53:46 -08002712 raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API")
Scott Baker0caeaf02014-06-19 11:12:55 -07002713 return Image.select_by_user(self.request.user)
2714
Sapan Bhatiadea39432014-06-13 03:10:36 -04002715
Scott Baker72758c72015-02-10 19:26:35 -08002716class ImageDetail(XOSRetrieveUpdateDestroyAPIView):
Scott Baker0caeaf02014-06-19 11:12:55 -07002717 queryset = Image.objects.select_related().all()
Sapan Bhatiadea39432014-06-13 03:10:36 -04002718 serializer_class = ImageSerializer
Scott Baker46b58542014-08-11 17:26:12 -07002719 id_serializer_class = ImageIdSerializer
2720
2721 def get_serializer_class(self):
Scott Baker84cf39e2015-01-30 15:41:39 -08002722 no_hyperlinks=False
2723 if hasattr(self.request,"QUERY_PARAMS"):
2724 no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
Scott Baker46b58542014-08-11 17:26:12 -07002725 if (no_hyperlinks):
2726 return self.id_serializer_class
2727 else:
2728 return self.serializer_class
Scott Baker84cf39e2015-01-30 15:41:39 -08002729
Scott Baker0caeaf02014-06-19 11:12:55 -07002730 def get_queryset(self):
Scott Baker20101af2015-02-02 10:41:12 -08002731 if (not self.request.user.is_authenticated()):
Scott Baker4af864e2015-02-02 13:53:46 -08002732 raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API")
Scott Baker0caeaf02014-06-19 11:12:55 -07002733 return Image.select_by_user(self.request.user)
2734
Scott Baker72758c72015-02-10 19:26:35 -08002735 # update() is handled by XOSRetrieveUpdateDestroyAPIView
Scott Baker0caeaf02014-06-19 11:12:55 -07002736
Scott Baker72758c72015-02-10 19:26:35 -08002737 # destroy() is handled by XOSRetrieveUpdateDestroyAPIView
Sapan Bhatiadea39432014-06-13 03:10:36 -04002738
2739
2740
Scott Baker72758c72015-02-10 19:26:35 -08002741class NetworkParameterList(XOSListCreateAPIView):
Scott Baker0caeaf02014-06-19 11:12:55 -07002742 queryset = NetworkParameter.objects.select_related().all()
2743 serializer_class = NetworkParameterSerializer
Scott Baker46b58542014-08-11 17:26:12 -07002744 id_serializer_class = NetworkParameterIdSerializer
2745 filter_backends = (filters.DjangoFilterBackend,)
Scott Baker84cf39e2015-01-30 15:41:39 -08002746 filter_fields = ('id','created','updated','enacted','policed','backend_register','backend_status','deleted','parameter','value','content_type','object_id',)
Scott Baker46b58542014-08-11 17:26:12 -07002747
2748 def get_serializer_class(self):
Scott Baker84cf39e2015-01-30 15:41:39 -08002749 no_hyperlinks=False
2750 if hasattr(self.request,"QUERY_PARAMS"):
2751 no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
Scott Baker46b58542014-08-11 17:26:12 -07002752 if (no_hyperlinks):
2753 return self.id_serializer_class
2754 else:
2755 return self.serializer_class
2756
Scott Baker0caeaf02014-06-19 11:12:55 -07002757 def get_queryset(self):
Scott Baker20101af2015-02-02 10:41:12 -08002758 if (not self.request.user.is_authenticated()):
Scott Baker4af864e2015-02-02 13:53:46 -08002759 raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API")
Scott Baker0caeaf02014-06-19 11:12:55 -07002760 return NetworkParameter.select_by_user(self.request.user)
Sapan Bhatiadea39432014-06-13 03:10:36 -04002761
Scott Baker0caeaf02014-06-19 11:12:55 -07002762
Scott Baker72758c72015-02-10 19:26:35 -08002763class NetworkParameterDetail(XOSRetrieveUpdateDestroyAPIView):
Scott Baker0caeaf02014-06-19 11:12:55 -07002764 queryset = NetworkParameter.objects.select_related().all()
2765 serializer_class = NetworkParameterSerializer
Scott Baker46b58542014-08-11 17:26:12 -07002766 id_serializer_class = NetworkParameterIdSerializer
2767
2768 def get_serializer_class(self):
Scott Baker84cf39e2015-01-30 15:41:39 -08002769 no_hyperlinks=False
2770 if hasattr(self.request,"QUERY_PARAMS"):
2771 no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
Scott Baker46b58542014-08-11 17:26:12 -07002772 if (no_hyperlinks):
2773 return self.id_serializer_class
2774 else:
2775 return self.serializer_class
Scott Baker84cf39e2015-01-30 15:41:39 -08002776
Scott Baker0caeaf02014-06-19 11:12:55 -07002777 def get_queryset(self):
Scott Baker20101af2015-02-02 10:41:12 -08002778 if (not self.request.user.is_authenticated()):
Scott Baker4af864e2015-02-02 13:53:46 -08002779 raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API")
Scott Baker0caeaf02014-06-19 11:12:55 -07002780 return NetworkParameter.select_by_user(self.request.user)
2781
Scott Baker72758c72015-02-10 19:26:35 -08002782 # update() is handled by XOSRetrieveUpdateDestroyAPIView
Scott Baker0caeaf02014-06-19 11:12:55 -07002783
Scott Baker72758c72015-02-10 19:26:35 -08002784 # destroy() is handled by XOSRetrieveUpdateDestroyAPIView
Sapan Bhatiadea39432014-06-13 03:10:36 -04002785
2786
2787
Scott Baker72758c72015-02-10 19:26:35 -08002788class SiteList(XOSListCreateAPIView):
Scott Baker0caeaf02014-06-19 11:12:55 -07002789 queryset = Site.objects.select_related().all()
Sapan Bhatiadea39432014-06-13 03:10:36 -04002790 serializer_class = SiteSerializer
Scott Baker46b58542014-08-11 17:26:12 -07002791 id_serializer_class = SiteIdSerializer
2792 filter_backends = (filters.DjangoFilterBackend,)
Scott Baker84cf39e2015-01-30 15:41:39 -08002793 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 Baker46b58542014-08-11 17:26:12 -07002794
2795 def get_serializer_class(self):
Scott Baker84cf39e2015-01-30 15:41:39 -08002796 no_hyperlinks=False
2797 if hasattr(self.request,"QUERY_PARAMS"):
2798 no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
Scott Baker46b58542014-08-11 17:26:12 -07002799 if (no_hyperlinks):
2800 return self.id_serializer_class
2801 else:
2802 return self.serializer_class
2803
Scott Baker0caeaf02014-06-19 11:12:55 -07002804 def get_queryset(self):
Scott Baker20101af2015-02-02 10:41:12 -08002805 if (not self.request.user.is_authenticated()):
Scott Baker4af864e2015-02-02 13:53:46 -08002806 raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API")
Scott Baker0caeaf02014-06-19 11:12:55 -07002807 return Site.select_by_user(self.request.user)
2808
Sapan Bhatiadea39432014-06-13 03:10:36 -04002809
Scott Baker72758c72015-02-10 19:26:35 -08002810class SiteDetail(XOSRetrieveUpdateDestroyAPIView):
Scott Baker0caeaf02014-06-19 11:12:55 -07002811 queryset = Site.objects.select_related().all()
Sapan Bhatiadea39432014-06-13 03:10:36 -04002812 serializer_class = SiteSerializer
Scott Baker46b58542014-08-11 17:26:12 -07002813 id_serializer_class = SiteIdSerializer
2814
2815 def get_serializer_class(self):
Scott Baker84cf39e2015-01-30 15:41:39 -08002816 no_hyperlinks=False
2817 if hasattr(self.request,"QUERY_PARAMS"):
2818 no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
Scott Baker46b58542014-08-11 17:26:12 -07002819 if (no_hyperlinks):
2820 return self.id_serializer_class
2821 else:
2822 return self.serializer_class
Scott Baker84cf39e2015-01-30 15:41:39 -08002823
Scott Baker0caeaf02014-06-19 11:12:55 -07002824 def get_queryset(self):
Scott Baker20101af2015-02-02 10:41:12 -08002825 if (not self.request.user.is_authenticated()):
Scott Baker4af864e2015-02-02 13:53:46 -08002826 raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API")
Scott Baker0caeaf02014-06-19 11:12:55 -07002827 return Site.select_by_user(self.request.user)
Sapan Bhatiadea39432014-06-13 03:10:36 -04002828
Scott Baker72758c72015-02-10 19:26:35 -08002829 # update() is handled by XOSRetrieveUpdateDestroyAPIView
Sapan Bhatiadea39432014-06-13 03:10:36 -04002830
Scott Baker72758c72015-02-10 19:26:35 -08002831 # destroy() is handled by XOSRetrieveUpdateDestroyAPIView
Scott Baker0caeaf02014-06-19 11:12:55 -07002832
2833
2834
Scott Baker72758c72015-02-10 19:26:35 -08002835class SliceRoleList(XOSListCreateAPIView):
Scott Baker0caeaf02014-06-19 11:12:55 -07002836 queryset = SliceRole.objects.select_related().all()
2837 serializer_class = SliceRoleSerializer
Scott Baker46b58542014-08-11 17:26:12 -07002838 id_serializer_class = SliceRoleIdSerializer
2839 filter_backends = (filters.DjangoFilterBackend,)
Scott Baker84cf39e2015-01-30 15:41:39 -08002840 filter_fields = ('id','created','updated','enacted','policed','backend_register','backend_status','deleted','role',)
Scott Baker46b58542014-08-11 17:26:12 -07002841
2842 def get_serializer_class(self):
Scott Baker84cf39e2015-01-30 15:41:39 -08002843 no_hyperlinks=False
2844 if hasattr(self.request,"QUERY_PARAMS"):
2845 no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
Scott Baker46b58542014-08-11 17:26:12 -07002846 if (no_hyperlinks):
2847 return self.id_serializer_class
2848 else:
2849 return self.serializer_class
2850
Scott Baker0caeaf02014-06-19 11:12:55 -07002851 def get_queryset(self):
Scott Baker20101af2015-02-02 10:41:12 -08002852 if (not self.request.user.is_authenticated()):
Scott Baker4af864e2015-02-02 13:53:46 -08002853 raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API")
Scott Baker0caeaf02014-06-19 11:12:55 -07002854 return SliceRole.select_by_user(self.request.user)
2855
Scott Baker0caeaf02014-06-19 11:12:55 -07002856
Scott Baker72758c72015-02-10 19:26:35 -08002857class SliceRoleDetail(XOSRetrieveUpdateDestroyAPIView):
Scott Baker0caeaf02014-06-19 11:12:55 -07002858 queryset = SliceRole.objects.select_related().all()
2859 serializer_class = SliceRoleSerializer
Scott Baker46b58542014-08-11 17:26:12 -07002860 id_serializer_class = SliceRoleIdSerializer
2861
2862 def get_serializer_class(self):
Scott Baker84cf39e2015-01-30 15:41:39 -08002863 no_hyperlinks=False
2864 if hasattr(self.request,"QUERY_PARAMS"):
2865 no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
Scott Baker46b58542014-08-11 17:26:12 -07002866 if (no_hyperlinks):
2867 return self.id_serializer_class
2868 else:
2869 return self.serializer_class
Scott Baker84cf39e2015-01-30 15:41:39 -08002870
Scott Baker0caeaf02014-06-19 11:12:55 -07002871 def get_queryset(self):
Scott Baker20101af2015-02-02 10:41:12 -08002872 if (not self.request.user.is_authenticated()):
Scott Baker4af864e2015-02-02 13:53:46 -08002873 raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API")
Scott Baker0caeaf02014-06-19 11:12:55 -07002874 return SliceRole.select_by_user(self.request.user)
2875
Scott Baker72758c72015-02-10 19:26:35 -08002876 # update() is handled by XOSRetrieveUpdateDestroyAPIView
Scott Baker0caeaf02014-06-19 11:12:55 -07002877
Scott Baker72758c72015-02-10 19:26:35 -08002878 # destroy() is handled by XOSRetrieveUpdateDestroyAPIView
Sapan Bhatiadea39432014-06-13 03:10:36 -04002879
2880
2881
Scott Baker72758c72015-02-10 19:26:35 -08002882class TagList(XOSListCreateAPIView):
Scott Baker0caeaf02014-06-19 11:12:55 -07002883 queryset = Tag.objects.select_related().all()
Sapan Bhatiadea39432014-06-13 03:10:36 -04002884 serializer_class = TagSerializer
Scott Baker46b58542014-08-11 17:26:12 -07002885 id_serializer_class = TagIdSerializer
2886 filter_backends = (filters.DjangoFilterBackend,)
Scott Baker84cf39e2015-01-30 15:41:39 -08002887 filter_fields = ('id','created','updated','enacted','policed','backend_register','backend_status','deleted','service','name','value','content_type','object_id',)
Scott Baker46b58542014-08-11 17:26:12 -07002888
2889 def get_serializer_class(self):
Scott Baker84cf39e2015-01-30 15:41:39 -08002890 no_hyperlinks=False
2891 if hasattr(self.request,"QUERY_PARAMS"):
2892 no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
Scott Baker46b58542014-08-11 17:26:12 -07002893 if (no_hyperlinks):
2894 return self.id_serializer_class
2895 else:
2896 return self.serializer_class
2897
Scott Baker0caeaf02014-06-19 11:12:55 -07002898 def get_queryset(self):
Scott Baker20101af2015-02-02 10:41:12 -08002899 if (not self.request.user.is_authenticated()):
Scott Baker4af864e2015-02-02 13:53:46 -08002900 raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API")
Scott Baker0caeaf02014-06-19 11:12:55 -07002901 return Tag.select_by_user(self.request.user)
2902
Sapan Bhatiadea39432014-06-13 03:10:36 -04002903
Scott Baker72758c72015-02-10 19:26:35 -08002904class TagDetail(XOSRetrieveUpdateDestroyAPIView):
Scott Baker0caeaf02014-06-19 11:12:55 -07002905 queryset = Tag.objects.select_related().all()
Sapan Bhatiadea39432014-06-13 03:10:36 -04002906 serializer_class = TagSerializer
Scott Baker46b58542014-08-11 17:26:12 -07002907 id_serializer_class = TagIdSerializer
2908
2909 def get_serializer_class(self):
Scott Baker84cf39e2015-01-30 15:41:39 -08002910 no_hyperlinks=False
2911 if hasattr(self.request,"QUERY_PARAMS"):
2912 no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
Scott Baker46b58542014-08-11 17:26:12 -07002913 if (no_hyperlinks):
2914 return self.id_serializer_class
2915 else:
2916 return self.serializer_class
Scott Baker84cf39e2015-01-30 15:41:39 -08002917
Scott Baker0caeaf02014-06-19 11:12:55 -07002918 def get_queryset(self):
Scott Baker20101af2015-02-02 10:41:12 -08002919 if (not self.request.user.is_authenticated()):
Scott Baker4af864e2015-02-02 13:53:46 -08002920 raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API")
Scott Baker0caeaf02014-06-19 11:12:55 -07002921 return Tag.select_by_user(self.request.user)
2922
Scott Baker72758c72015-02-10 19:26:35 -08002923 # update() is handled by XOSRetrieveUpdateDestroyAPIView
Scott Baker0caeaf02014-06-19 11:12:55 -07002924
Scott Baker72758c72015-02-10 19:26:35 -08002925 # destroy() is handled by XOSRetrieveUpdateDestroyAPIView
Sapan Bhatiadea39432014-06-13 03:10:36 -04002926
2927
2928
Scott Baker72758c72015-02-10 19:26:35 -08002929class InvoiceList(XOSListCreateAPIView):
Scott Baker0caeaf02014-06-19 11:12:55 -07002930 queryset = Invoice.objects.select_related().all()
Sapan Bhatiadea39432014-06-13 03:10:36 -04002931 serializer_class = InvoiceSerializer
Scott Baker46b58542014-08-11 17:26:12 -07002932 id_serializer_class = InvoiceIdSerializer
2933 filter_backends = (filters.DjangoFilterBackend,)
Scott Baker84cf39e2015-01-30 15:41:39 -08002934 filter_fields = ('id','created','updated','enacted','policed','backend_register','backend_status','deleted','date','account',)
Scott Baker46b58542014-08-11 17:26:12 -07002935
2936 def get_serializer_class(self):
Scott Baker84cf39e2015-01-30 15:41:39 -08002937 no_hyperlinks=False
2938 if hasattr(self.request,"QUERY_PARAMS"):
2939 no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
Scott Baker46b58542014-08-11 17:26:12 -07002940 if (no_hyperlinks):
2941 return self.id_serializer_class
2942 else:
2943 return self.serializer_class
2944
Scott Baker0caeaf02014-06-19 11:12:55 -07002945 def get_queryset(self):
Scott Baker20101af2015-02-02 10:41:12 -08002946 if (not self.request.user.is_authenticated()):
Scott Baker4af864e2015-02-02 13:53:46 -08002947 raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API")
Scott Baker0caeaf02014-06-19 11:12:55 -07002948 return Invoice.select_by_user(self.request.user)
2949
Sapan Bhatiadea39432014-06-13 03:10:36 -04002950
Scott Baker72758c72015-02-10 19:26:35 -08002951class InvoiceDetail(XOSRetrieveUpdateDestroyAPIView):
Scott Baker0caeaf02014-06-19 11:12:55 -07002952 queryset = Invoice.objects.select_related().all()
Sapan Bhatiadea39432014-06-13 03:10:36 -04002953 serializer_class = InvoiceSerializer
Scott Baker46b58542014-08-11 17:26:12 -07002954 id_serializer_class = InvoiceIdSerializer
2955
2956 def get_serializer_class(self):
Scott Baker84cf39e2015-01-30 15:41:39 -08002957 no_hyperlinks=False
2958 if hasattr(self.request,"QUERY_PARAMS"):
2959 no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
Scott Baker46b58542014-08-11 17:26:12 -07002960 if (no_hyperlinks):
2961 return self.id_serializer_class
2962 else:
2963 return self.serializer_class
Scott Baker84cf39e2015-01-30 15:41:39 -08002964
Scott Baker0caeaf02014-06-19 11:12:55 -07002965 def get_queryset(self):
Scott Baker20101af2015-02-02 10:41:12 -08002966 if (not self.request.user.is_authenticated()):
Scott Baker4af864e2015-02-02 13:53:46 -08002967 raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API")
Scott Baker0caeaf02014-06-19 11:12:55 -07002968 return Invoice.select_by_user(self.request.user)
2969
Scott Baker72758c72015-02-10 19:26:35 -08002970 # update() is handled by XOSRetrieveUpdateDestroyAPIView
Scott Baker0caeaf02014-06-19 11:12:55 -07002971
Scott Baker72758c72015-02-10 19:26:35 -08002972 # destroy() is handled by XOSRetrieveUpdateDestroyAPIView
Sapan Bhatiadea39432014-06-13 03:10:36 -04002973
2974
2975
Scott Baker72758c72015-02-10 19:26:35 -08002976class SlicePrivilegeList(XOSListCreateAPIView):
Scott Baker0caeaf02014-06-19 11:12:55 -07002977 queryset = SlicePrivilege.objects.select_related().all()
2978 serializer_class = SlicePrivilegeSerializer
Scott Baker46b58542014-08-11 17:26:12 -07002979 id_serializer_class = SlicePrivilegeIdSerializer
2980 filter_backends = (filters.DjangoFilterBackend,)
Scott Baker84cf39e2015-01-30 15:41:39 -08002981 filter_fields = ('id','created','updated','enacted','policed','backend_register','backend_status','deleted','user','slice','role',)
Scott Baker46b58542014-08-11 17:26:12 -07002982
2983 def get_serializer_class(self):
Scott Baker84cf39e2015-01-30 15:41:39 -08002984 no_hyperlinks=False
2985 if hasattr(self.request,"QUERY_PARAMS"):
2986 no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
Scott Baker46b58542014-08-11 17:26:12 -07002987 if (no_hyperlinks):
2988 return self.id_serializer_class
2989 else:
2990 return self.serializer_class
2991
Scott Baker0caeaf02014-06-19 11:12:55 -07002992 def get_queryset(self):
Scott Baker20101af2015-02-02 10:41:12 -08002993 if (not self.request.user.is_authenticated()):
Scott Baker4af864e2015-02-02 13:53:46 -08002994 raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API")
Scott Baker0caeaf02014-06-19 11:12:55 -07002995 return SlicePrivilege.select_by_user(self.request.user)
Sapan Bhatiadea39432014-06-13 03:10:36 -04002996
Scott Baker0caeaf02014-06-19 11:12:55 -07002997
Scott Baker72758c72015-02-10 19:26:35 -08002998class SlicePrivilegeDetail(XOSRetrieveUpdateDestroyAPIView):
Scott Baker0caeaf02014-06-19 11:12:55 -07002999 queryset = SlicePrivilege.objects.select_related().all()
3000 serializer_class = SlicePrivilegeSerializer
Scott Baker46b58542014-08-11 17:26:12 -07003001 id_serializer_class = SlicePrivilegeIdSerializer
3002
3003 def get_serializer_class(self):
Scott Baker84cf39e2015-01-30 15:41:39 -08003004 no_hyperlinks=False
3005 if hasattr(self.request,"QUERY_PARAMS"):
3006 no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
Scott Baker46b58542014-08-11 17:26:12 -07003007 if (no_hyperlinks):
3008 return self.id_serializer_class
3009 else:
3010 return self.serializer_class
Scott Baker84cf39e2015-01-30 15:41:39 -08003011
Scott Baker0caeaf02014-06-19 11:12:55 -07003012 def get_queryset(self):
Scott Baker20101af2015-02-02 10:41:12 -08003013 if (not self.request.user.is_authenticated()):
Scott Baker4af864e2015-02-02 13:53:46 -08003014 raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API")
Scott Baker0caeaf02014-06-19 11:12:55 -07003015 return SlicePrivilege.select_by_user(self.request.user)
3016
Scott Baker72758c72015-02-10 19:26:35 -08003017 # update() is handled by XOSRetrieveUpdateDestroyAPIView
Scott Baker89a7b7c2014-10-07 00:10:17 -07003018
Scott Baker72758c72015-02-10 19:26:35 -08003019 # destroy() is handled by XOSRetrieveUpdateDestroyAPIView
Scott Baker89a7b7c2014-10-07 00:10:17 -07003020
3021
3022
Scott Baker72758c72015-02-10 19:26:35 -08003023class PlanetStackRoleList(XOSListCreateAPIView):
Scott Baker89a7b7c2014-10-07 00:10:17 -07003024 queryset = PlanetStackRole.objects.select_related().all()
3025 serializer_class = PlanetStackRoleSerializer
3026 id_serializer_class = PlanetStackRoleIdSerializer
3027 filter_backends = (filters.DjangoFilterBackend,)
Scott Baker84cf39e2015-01-30 15:41:39 -08003028 filter_fields = ('id','created','updated','enacted','policed','backend_register','backend_status','deleted','role',)
Scott Baker89a7b7c2014-10-07 00:10:17 -07003029
3030 def get_serializer_class(self):
Scott Baker84cf39e2015-01-30 15:41:39 -08003031 no_hyperlinks=False
3032 if hasattr(self.request,"QUERY_PARAMS"):
3033 no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
Scott Baker89a7b7c2014-10-07 00:10:17 -07003034 if (no_hyperlinks):
3035 return self.id_serializer_class
3036 else:
3037 return self.serializer_class
3038
3039 def get_queryset(self):
Scott Baker20101af2015-02-02 10:41:12 -08003040 if (not self.request.user.is_authenticated()):
Scott Baker4af864e2015-02-02 13:53:46 -08003041 raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API")
Scott Baker89a7b7c2014-10-07 00:10:17 -07003042 return PlanetStackRole.select_by_user(self.request.user)
3043
Scott Baker0caeaf02014-06-19 11:12:55 -07003044
Scott Baker72758c72015-02-10 19:26:35 -08003045class PlanetStackRoleDetail(XOSRetrieveUpdateDestroyAPIView):
Scott Baker89a7b7c2014-10-07 00:10:17 -07003046 queryset = PlanetStackRole.objects.select_related().all()
3047 serializer_class = PlanetStackRoleSerializer
3048 id_serializer_class = PlanetStackRoleIdSerializer
3049
3050 def get_serializer_class(self):
Scott Baker84cf39e2015-01-30 15:41:39 -08003051 no_hyperlinks=False
3052 if hasattr(self.request,"QUERY_PARAMS"):
3053 no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
Scott Baker89a7b7c2014-10-07 00:10:17 -07003054 if (no_hyperlinks):
3055 return self.id_serializer_class
Scott Baker0caeaf02014-06-19 11:12:55 -07003056 else:
Scott Baker89a7b7c2014-10-07 00:10:17 -07003057 return self.serializer_class
Scott Baker84cf39e2015-01-30 15:41:39 -08003058
Scott Baker89a7b7c2014-10-07 00:10:17 -07003059 def get_queryset(self):
Scott Baker20101af2015-02-02 10:41:12 -08003060 if (not self.request.user.is_authenticated()):
Scott Baker4af864e2015-02-02 13:53:46 -08003061 raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API")
Scott Baker89a7b7c2014-10-07 00:10:17 -07003062 return PlanetStackRole.select_by_user(self.request.user)
3063
Scott Baker72758c72015-02-10 19:26:35 -08003064 # update() is handled by XOSRetrieveUpdateDestroyAPIView
Scott Baker89a7b7c2014-10-07 00:10:17 -07003065
Scott Baker72758c72015-02-10 19:26:35 -08003066 # destroy() is handled by XOSRetrieveUpdateDestroyAPIView
Sapan Bhatiadea39432014-06-13 03:10:36 -04003067
3068
3069
Scott Baker72758c72015-02-10 19:26:35 -08003070class NetworkSliverList(XOSListCreateAPIView):
Scott Baker0caeaf02014-06-19 11:12:55 -07003071 queryset = NetworkSliver.objects.select_related().all()
3072 serializer_class = NetworkSliverSerializer
Scott Baker46b58542014-08-11 17:26:12 -07003073 id_serializer_class = NetworkSliverIdSerializer
3074 filter_backends = (filters.DjangoFilterBackend,)
Scott Baker84cf39e2015-01-30 15:41:39 -08003075 filter_fields = ('id','created','updated','enacted','policed','backend_register','backend_status','deleted','network','sliver','ip','port_id',)
Scott Baker46b58542014-08-11 17:26:12 -07003076
3077 def get_serializer_class(self):
Scott Baker84cf39e2015-01-30 15:41:39 -08003078 no_hyperlinks=False
3079 if hasattr(self.request,"QUERY_PARAMS"):
3080 no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
Scott Baker46b58542014-08-11 17:26:12 -07003081 if (no_hyperlinks):
3082 return self.id_serializer_class
3083 else:
3084 return self.serializer_class
3085
Scott Baker0caeaf02014-06-19 11:12:55 -07003086 def get_queryset(self):
Scott Baker20101af2015-02-02 10:41:12 -08003087 if (not self.request.user.is_authenticated()):
Scott Baker4af864e2015-02-02 13:53:46 -08003088 raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API")
Scott Baker0caeaf02014-06-19 11:12:55 -07003089 return NetworkSliver.select_by_user(self.request.user)
Sapan Bhatiadea39432014-06-13 03:10:36 -04003090
Scott Baker0caeaf02014-06-19 11:12:55 -07003091
Scott Baker72758c72015-02-10 19:26:35 -08003092class NetworkSliverDetail(XOSRetrieveUpdateDestroyAPIView):
Scott Baker0caeaf02014-06-19 11:12:55 -07003093 queryset = NetworkSliver.objects.select_related().all()
3094 serializer_class = NetworkSliverSerializer
Scott Baker46b58542014-08-11 17:26:12 -07003095 id_serializer_class = NetworkSliverIdSerializer
3096
3097 def get_serializer_class(self):
Scott Baker84cf39e2015-01-30 15:41:39 -08003098 no_hyperlinks=False
3099 if hasattr(self.request,"QUERY_PARAMS"):
3100 no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
Scott Baker46b58542014-08-11 17:26:12 -07003101 if (no_hyperlinks):
3102 return self.id_serializer_class
3103 else:
3104 return self.serializer_class
Scott Baker84cf39e2015-01-30 15:41:39 -08003105
Scott Baker0caeaf02014-06-19 11:12:55 -07003106 def get_queryset(self):
Scott Baker20101af2015-02-02 10:41:12 -08003107 if (not self.request.user.is_authenticated()):
Scott Baker4af864e2015-02-02 13:53:46 -08003108 raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API")
Scott Baker0caeaf02014-06-19 11:12:55 -07003109 return NetworkSliver.select_by_user(self.request.user)
3110
Scott Baker72758c72015-02-10 19:26:35 -08003111 # update() is handled by XOSRetrieveUpdateDestroyAPIView
Scott Baker0caeaf02014-06-19 11:12:55 -07003112
Scott Baker72758c72015-02-10 19:26:35 -08003113 # destroy() is handled by XOSRetrieveUpdateDestroyAPIView
Sapan Bhatiadea39432014-06-13 03:10:36 -04003114
3115
3116
Scott Baker72758c72015-02-10 19:26:35 -08003117class FlavorList(XOSListCreateAPIView):
Scott Baker191f9b22015-01-12 13:16:39 -08003118 queryset = Flavor.objects.select_related().all()
3119 serializer_class = FlavorSerializer
3120 id_serializer_class = FlavorIdSerializer
3121 filter_backends = (filters.DjangoFilterBackend,)
Scott Baker84cf39e2015-01-30 15:41:39 -08003122 filter_fields = ('id','created','updated','enacted','policed','backend_register','backend_status','deleted','name','description','flavor','order','default','deployments',)
Scott Baker191f9b22015-01-12 13:16:39 -08003123
3124 def get_serializer_class(self):
Scott Baker84cf39e2015-01-30 15:41:39 -08003125 no_hyperlinks=False
3126 if hasattr(self.request,"QUERY_PARAMS"):
3127 no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
Scott Baker191f9b22015-01-12 13:16:39 -08003128 if (no_hyperlinks):
3129 return self.id_serializer_class
3130 else:
3131 return self.serializer_class
3132
3133 def get_queryset(self):
Scott Baker20101af2015-02-02 10:41:12 -08003134 if (not self.request.user.is_authenticated()):
Scott Baker4af864e2015-02-02 13:53:46 -08003135 raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API")
Scott Baker191f9b22015-01-12 13:16:39 -08003136 return Flavor.select_by_user(self.request.user)
3137
Scott Baker191f9b22015-01-12 13:16:39 -08003138
Scott Baker72758c72015-02-10 19:26:35 -08003139class FlavorDetail(XOSRetrieveUpdateDestroyAPIView):
Scott Baker191f9b22015-01-12 13:16:39 -08003140 queryset = Flavor.objects.select_related().all()
3141 serializer_class = FlavorSerializer
3142 id_serializer_class = FlavorIdSerializer
3143
3144 def get_serializer_class(self):
Scott Baker84cf39e2015-01-30 15:41:39 -08003145 no_hyperlinks=False
3146 if hasattr(self.request,"QUERY_PARAMS"):
3147 no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
Scott Baker191f9b22015-01-12 13:16:39 -08003148 if (no_hyperlinks):
3149 return self.id_serializer_class
3150 else:
3151 return self.serializer_class
Scott Baker84cf39e2015-01-30 15:41:39 -08003152
Scott Baker191f9b22015-01-12 13:16:39 -08003153 def get_queryset(self):
Scott Baker20101af2015-02-02 10:41:12 -08003154 if (not self.request.user.is_authenticated()):
Scott Baker4af864e2015-02-02 13:53:46 -08003155 raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API")
Scott Baker191f9b22015-01-12 13:16:39 -08003156 return Flavor.select_by_user(self.request.user)
3157
Scott Baker72758c72015-02-10 19:26:35 -08003158 # update() is handled by XOSRetrieveUpdateDestroyAPIView
Scott Baker191f9b22015-01-12 13:16:39 -08003159
Scott Baker72758c72015-02-10 19:26:35 -08003160 # destroy() is handled by XOSRetrieveUpdateDestroyAPIView
Scott Baker191f9b22015-01-12 13:16:39 -08003161
3162
3163
Scott Baker72758c72015-02-10 19:26:35 -08003164class ControllerSiteList(XOSListCreateAPIView):
Scott Baker191f9b22015-01-12 13:16:39 -08003165 queryset = ControllerSite.objects.select_related().all()
3166 serializer_class = ControllerSiteSerializer
3167 id_serializer_class = ControllerSiteIdSerializer
3168 filter_backends = (filters.DjangoFilterBackend,)
Scott Baker84cf39e2015-01-30 15:41:39 -08003169 filter_fields = ('id','created','updated','enacted','policed','backend_register','backend_status','deleted','site','controller','tenant_id',)
Scott Baker191f9b22015-01-12 13:16:39 -08003170
3171 def get_serializer_class(self):
Scott Baker84cf39e2015-01-30 15:41:39 -08003172 no_hyperlinks=False
3173 if hasattr(self.request,"QUERY_PARAMS"):
3174 no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
Scott Baker191f9b22015-01-12 13:16:39 -08003175 if (no_hyperlinks):
3176 return self.id_serializer_class
3177 else:
3178 return self.serializer_class
3179
3180 def get_queryset(self):
Scott Baker20101af2015-02-02 10:41:12 -08003181 if (not self.request.user.is_authenticated()):
Scott Baker4af864e2015-02-02 13:53:46 -08003182 raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API")
Scott Baker191f9b22015-01-12 13:16:39 -08003183 return ControllerSite.select_by_user(self.request.user)
3184
Scott Baker191f9b22015-01-12 13:16:39 -08003185
Scott Baker72758c72015-02-10 19:26:35 -08003186class ControllerSiteDetail(XOSRetrieveUpdateDestroyAPIView):
Scott Baker191f9b22015-01-12 13:16:39 -08003187 queryset = ControllerSite.objects.select_related().all()
3188 serializer_class = ControllerSiteSerializer
3189 id_serializer_class = ControllerSiteIdSerializer
3190
3191 def get_serializer_class(self):
Scott Baker84cf39e2015-01-30 15:41:39 -08003192 no_hyperlinks=False
3193 if hasattr(self.request,"QUERY_PARAMS"):
3194 no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
Scott Baker191f9b22015-01-12 13:16:39 -08003195 if (no_hyperlinks):
3196 return self.id_serializer_class
3197 else:
3198 return self.serializer_class
Scott Baker84cf39e2015-01-30 15:41:39 -08003199
Scott Baker191f9b22015-01-12 13:16:39 -08003200 def get_queryset(self):
Scott Baker20101af2015-02-02 10:41:12 -08003201 if (not self.request.user.is_authenticated()):
Scott Baker4af864e2015-02-02 13:53:46 -08003202 raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API")
Scott Baker191f9b22015-01-12 13:16:39 -08003203 return ControllerSite.select_by_user(self.request.user)
3204
Scott Baker72758c72015-02-10 19:26:35 -08003205 # update() is handled by XOSRetrieveUpdateDestroyAPIView
Scott Baker191f9b22015-01-12 13:16:39 -08003206
Scott Baker72758c72015-02-10 19:26:35 -08003207 # destroy() is handled by XOSRetrieveUpdateDestroyAPIView
Scott Baker191f9b22015-01-12 13:16:39 -08003208
3209
3210
Scott Baker72758c72015-02-10 19:26:35 -08003211class ProjectList(XOSListCreateAPIView):
Scott Baker0caeaf02014-06-19 11:12:55 -07003212 queryset = Project.objects.select_related().all()
3213 serializer_class = ProjectSerializer
Scott Baker46b58542014-08-11 17:26:12 -07003214 id_serializer_class = ProjectIdSerializer
3215 filter_backends = (filters.DjangoFilterBackend,)
Scott Baker84cf39e2015-01-30 15:41:39 -08003216 filter_fields = ('id','created','updated','enacted','policed','backend_register','backend_status','deleted','name',)
Scott Baker46b58542014-08-11 17:26:12 -07003217
3218 def get_serializer_class(self):
Scott Baker84cf39e2015-01-30 15:41:39 -08003219 no_hyperlinks=False
3220 if hasattr(self.request,"QUERY_PARAMS"):
3221 no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
Scott Baker46b58542014-08-11 17:26:12 -07003222 if (no_hyperlinks):
3223 return self.id_serializer_class
3224 else:
3225 return self.serializer_class
3226
Scott Baker0caeaf02014-06-19 11:12:55 -07003227 def get_queryset(self):
Scott Baker20101af2015-02-02 10:41:12 -08003228 if (not self.request.user.is_authenticated()):
Scott Baker4af864e2015-02-02 13:53:46 -08003229 raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API")
Scott Baker0caeaf02014-06-19 11:12:55 -07003230 return Project.select_by_user(self.request.user)
Sapan Bhatiadea39432014-06-13 03:10:36 -04003231
Scott Baker0caeaf02014-06-19 11:12:55 -07003232
Scott Baker72758c72015-02-10 19:26:35 -08003233class ProjectDetail(XOSRetrieveUpdateDestroyAPIView):
Scott Baker0caeaf02014-06-19 11:12:55 -07003234 queryset = Project.objects.select_related().all()
3235 serializer_class = ProjectSerializer
Scott Baker46b58542014-08-11 17:26:12 -07003236 id_serializer_class = ProjectIdSerializer
3237
3238 def get_serializer_class(self):
Scott Baker84cf39e2015-01-30 15:41:39 -08003239 no_hyperlinks=False
3240 if hasattr(self.request,"QUERY_PARAMS"):
3241 no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
Scott Baker46b58542014-08-11 17:26:12 -07003242 if (no_hyperlinks):
3243 return self.id_serializer_class
3244 else:
3245 return self.serializer_class
Scott Baker84cf39e2015-01-30 15:41:39 -08003246
Scott Baker0caeaf02014-06-19 11:12:55 -07003247 def get_queryset(self):
Scott Baker20101af2015-02-02 10:41:12 -08003248 if (not self.request.user.is_authenticated()):
Scott Baker4af864e2015-02-02 13:53:46 -08003249 raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API")
Scott Baker0caeaf02014-06-19 11:12:55 -07003250 return Project.select_by_user(self.request.user)
3251
Scott Baker72758c72015-02-10 19:26:35 -08003252 # update() is handled by XOSRetrieveUpdateDestroyAPIView
Scott Baker89a7b7c2014-10-07 00:10:17 -07003253
Scott Baker72758c72015-02-10 19:26:35 -08003254 # destroy() is handled by XOSRetrieveUpdateDestroyAPIView
Scott Baker89a7b7c2014-10-07 00:10:17 -07003255
3256
3257
Scott Baker72758c72015-02-10 19:26:35 -08003258class SliceList(XOSListCreateAPIView):
Scott Baker89a7b7c2014-10-07 00:10:17 -07003259 queryset = Slice.objects.select_related().all()
3260 serializer_class = SliceSerializer
3261 id_serializer_class = SliceIdSerializer
3262 filter_backends = (filters.DjangoFilterBackend,)
Scott Baker84cf39e2015-01-30 15:41:39 -08003263 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 Baker89a7b7c2014-10-07 00:10:17 -07003264
3265 def get_serializer_class(self):
Scott Baker84cf39e2015-01-30 15:41:39 -08003266 no_hyperlinks=False
3267 if hasattr(self.request,"QUERY_PARAMS"):
3268 no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
Scott Baker89a7b7c2014-10-07 00:10:17 -07003269 if (no_hyperlinks):
3270 return self.id_serializer_class
3271 else:
3272 return self.serializer_class
3273
3274 def get_queryset(self):
Scott Baker20101af2015-02-02 10:41:12 -08003275 if (not self.request.user.is_authenticated()):
Scott Baker4af864e2015-02-02 13:53:46 -08003276 raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API")
Scott Baker89a7b7c2014-10-07 00:10:17 -07003277 return Slice.select_by_user(self.request.user)
3278
Scott Baker0caeaf02014-06-19 11:12:55 -07003279
Scott Baker72758c72015-02-10 19:26:35 -08003280class SliceDetail(XOSRetrieveUpdateDestroyAPIView):
Scott Baker89a7b7c2014-10-07 00:10:17 -07003281 queryset = Slice.objects.select_related().all()
3282 serializer_class = SliceSerializer
3283 id_serializer_class = SliceIdSerializer
3284
3285 def get_serializer_class(self):
Scott Baker84cf39e2015-01-30 15:41:39 -08003286 no_hyperlinks=False
3287 if hasattr(self.request,"QUERY_PARAMS"):
3288 no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
Scott Baker89a7b7c2014-10-07 00:10:17 -07003289 if (no_hyperlinks):
3290 return self.id_serializer_class
3291 else:
3292 return self.serializer_class
Scott Baker84cf39e2015-01-30 15:41:39 -08003293
Scott Baker89a7b7c2014-10-07 00:10:17 -07003294 def get_queryset(self):
Scott Baker20101af2015-02-02 10:41:12 -08003295 if (not self.request.user.is_authenticated()):
Scott Baker4af864e2015-02-02 13:53:46 -08003296 raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API")
Scott Baker89a7b7c2014-10-07 00:10:17 -07003297 return Slice.select_by_user(self.request.user)
3298
Scott Baker72758c72015-02-10 19:26:35 -08003299 # update() is handled by XOSRetrieveUpdateDestroyAPIView
Scott Baker89a7b7c2014-10-07 00:10:17 -07003300
Scott Baker72758c72015-02-10 19:26:35 -08003301 # destroy() is handled by XOSRetrieveUpdateDestroyAPIView
Scott Baker89a7b7c2014-10-07 00:10:17 -07003302
3303
3304
Scott Baker72758c72015-02-10 19:26:35 -08003305class NetworkList(XOSListCreateAPIView):
Scott Baker89a7b7c2014-10-07 00:10:17 -07003306 queryset = Network.objects.select_related().all()
3307 serializer_class = NetworkSerializer
3308 id_serializer_class = NetworkIdSerializer
3309 filter_backends = (filters.DjangoFilterBackend,)
Scott Baker84cf39e2015-01-30 15:41:39 -08003310 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 Baker89a7b7c2014-10-07 00:10:17 -07003311
3312 def get_serializer_class(self):
Scott Baker84cf39e2015-01-30 15:41:39 -08003313 no_hyperlinks=False
3314 if hasattr(self.request,"QUERY_PARAMS"):
3315 no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
Scott Baker89a7b7c2014-10-07 00:10:17 -07003316 if (no_hyperlinks):
3317 return self.id_serializer_class
3318 else:
3319 return self.serializer_class
3320
3321 def get_queryset(self):
Scott Baker20101af2015-02-02 10:41:12 -08003322 if (not self.request.user.is_authenticated()):
Scott Baker4af864e2015-02-02 13:53:46 -08003323 raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API")
Scott Baker89a7b7c2014-10-07 00:10:17 -07003324 return Network.select_by_user(self.request.user)
3325
Scott Baker89a7b7c2014-10-07 00:10:17 -07003326
Scott Baker72758c72015-02-10 19:26:35 -08003327class NetworkDetail(XOSRetrieveUpdateDestroyAPIView):
Scott Baker89a7b7c2014-10-07 00:10:17 -07003328 queryset = Network.objects.select_related().all()
3329 serializer_class = NetworkSerializer
3330 id_serializer_class = NetworkIdSerializer
3331
3332 def get_serializer_class(self):
Scott Baker84cf39e2015-01-30 15:41:39 -08003333 no_hyperlinks=False
3334 if hasattr(self.request,"QUERY_PARAMS"):
3335 no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
Scott Baker89a7b7c2014-10-07 00:10:17 -07003336 if (no_hyperlinks):
3337 return self.id_serializer_class
3338 else:
3339 return self.serializer_class
Scott Baker84cf39e2015-01-30 15:41:39 -08003340
Scott Baker89a7b7c2014-10-07 00:10:17 -07003341 def get_queryset(self):
Scott Baker20101af2015-02-02 10:41:12 -08003342 if (not self.request.user.is_authenticated()):
Scott Baker4af864e2015-02-02 13:53:46 -08003343 raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API")
Scott Baker89a7b7c2014-10-07 00:10:17 -07003344 return Network.select_by_user(self.request.user)
3345
Scott Baker72758c72015-02-10 19:26:35 -08003346 # update() is handled by XOSRetrieveUpdateDestroyAPIView
Scott Baker89a7b7c2014-10-07 00:10:17 -07003347
Scott Baker72758c72015-02-10 19:26:35 -08003348 # destroy() is handled by XOSRetrieveUpdateDestroyAPIView
Scott Baker89a7b7c2014-10-07 00:10:17 -07003349
3350
3351
Scott Baker72758c72015-02-10 19:26:35 -08003352class ServiceList(XOSListCreateAPIView):
Scott Baker89a7b7c2014-10-07 00:10:17 -07003353 queryset = Service.objects.select_related().all()
3354 serializer_class = ServiceSerializer
3355 id_serializer_class = ServiceIdSerializer
3356 filter_backends = (filters.DjangoFilterBackend,)
Scott Baker84cf39e2015-01-30 15:41:39 -08003357 filter_fields = ('id','created','updated','enacted','policed','backend_register','backend_status','deleted','description','enabled','name','versionNumber','published',)
Scott Baker89a7b7c2014-10-07 00:10:17 -07003358
3359 def get_serializer_class(self):
Scott Baker84cf39e2015-01-30 15:41:39 -08003360 no_hyperlinks=False
3361 if hasattr(self.request,"QUERY_PARAMS"):
3362 no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
Scott Baker89a7b7c2014-10-07 00:10:17 -07003363 if (no_hyperlinks):
3364 return self.id_serializer_class
3365 else:
3366 return self.serializer_class
3367
3368 def get_queryset(self):
Scott Baker20101af2015-02-02 10:41:12 -08003369 if (not self.request.user.is_authenticated()):
Scott Baker4af864e2015-02-02 13:53:46 -08003370 raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API")
Scott Baker89a7b7c2014-10-07 00:10:17 -07003371 return Service.select_by_user(self.request.user)
3372
Scott Baker89a7b7c2014-10-07 00:10:17 -07003373
Scott Baker72758c72015-02-10 19:26:35 -08003374class ServiceDetail(XOSRetrieveUpdateDestroyAPIView):
Scott Baker89a7b7c2014-10-07 00:10:17 -07003375 queryset = Service.objects.select_related().all()
3376 serializer_class = ServiceSerializer
3377 id_serializer_class = ServiceIdSerializer
3378
3379 def get_serializer_class(self):
Scott Baker84cf39e2015-01-30 15:41:39 -08003380 no_hyperlinks=False
3381 if hasattr(self.request,"QUERY_PARAMS"):
3382 no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
Scott Baker89a7b7c2014-10-07 00:10:17 -07003383 if (no_hyperlinks):
3384 return self.id_serializer_class
3385 else:
3386 return self.serializer_class
Scott Baker84cf39e2015-01-30 15:41:39 -08003387
Scott Baker89a7b7c2014-10-07 00:10:17 -07003388 def get_queryset(self):
Scott Baker20101af2015-02-02 10:41:12 -08003389 if (not self.request.user.is_authenticated()):
Scott Baker4af864e2015-02-02 13:53:46 -08003390 raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API")
Scott Baker89a7b7c2014-10-07 00:10:17 -07003391 return Service.select_by_user(self.request.user)
3392
Scott Baker72758c72015-02-10 19:26:35 -08003393 # update() is handled by XOSRetrieveUpdateDestroyAPIView
Scott Baker89a7b7c2014-10-07 00:10:17 -07003394
Scott Baker72758c72015-02-10 19:26:35 -08003395 # destroy() is handled by XOSRetrieveUpdateDestroyAPIView
Scott Baker89a7b7c2014-10-07 00:10:17 -07003396
3397
3398
Scott Baker72758c72015-02-10 19:26:35 -08003399class ServiceClassList(XOSListCreateAPIView):
Scott Baker89a7b7c2014-10-07 00:10:17 -07003400 queryset = ServiceClass.objects.select_related().all()
3401 serializer_class = ServiceClassSerializer
3402 id_serializer_class = ServiceClassIdSerializer
3403 filter_backends = (filters.DjangoFilterBackend,)
Scott Baker84cf39e2015-01-30 15:41:39 -08003404 filter_fields = ('id','created','updated','enacted','policed','backend_register','backend_status','deleted','name','description','commitment','membershipFee','membershipFeeMonths','upgradeRequiresApproval',)
Scott Baker89a7b7c2014-10-07 00:10:17 -07003405
3406 def get_serializer_class(self):
Scott Baker84cf39e2015-01-30 15:41:39 -08003407 no_hyperlinks=False
3408 if hasattr(self.request,"QUERY_PARAMS"):
3409 no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
Scott Baker89a7b7c2014-10-07 00:10:17 -07003410 if (no_hyperlinks):
3411 return self.id_serializer_class
3412 else:
3413 return self.serializer_class
3414
3415 def get_queryset(self):
Scott Baker20101af2015-02-02 10:41:12 -08003416 if (not self.request.user.is_authenticated()):
Scott Baker4af864e2015-02-02 13:53:46 -08003417 raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API")
Scott Baker89a7b7c2014-10-07 00:10:17 -07003418 return ServiceClass.select_by_user(self.request.user)
3419
Scott Baker89a7b7c2014-10-07 00:10:17 -07003420
Scott Baker72758c72015-02-10 19:26:35 -08003421class ServiceClassDetail(XOSRetrieveUpdateDestroyAPIView):
Scott Baker89a7b7c2014-10-07 00:10:17 -07003422 queryset = ServiceClass.objects.select_related().all()
3423 serializer_class = ServiceClassSerializer
3424 id_serializer_class = ServiceClassIdSerializer
3425
3426 def get_serializer_class(self):
Scott Baker84cf39e2015-01-30 15:41:39 -08003427 no_hyperlinks=False
3428 if hasattr(self.request,"QUERY_PARAMS"):
3429 no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
Scott Baker89a7b7c2014-10-07 00:10:17 -07003430 if (no_hyperlinks):
3431 return self.id_serializer_class
3432 else:
3433 return self.serializer_class
Scott Baker84cf39e2015-01-30 15:41:39 -08003434
Scott Baker89a7b7c2014-10-07 00:10:17 -07003435 def get_queryset(self):
Scott Baker20101af2015-02-02 10:41:12 -08003436 if (not self.request.user.is_authenticated()):
Scott Baker4af864e2015-02-02 13:53:46 -08003437 raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API")
Scott Baker89a7b7c2014-10-07 00:10:17 -07003438 return ServiceClass.select_by_user(self.request.user)
3439
Scott Baker72758c72015-02-10 19:26:35 -08003440 # update() is handled by XOSRetrieveUpdateDestroyAPIView
Scott Baker89a7b7c2014-10-07 00:10:17 -07003441
Scott Baker72758c72015-02-10 19:26:35 -08003442 # destroy() is handled by XOSRetrieveUpdateDestroyAPIView
Scott Baker89a7b7c2014-10-07 00:10:17 -07003443
3444
3445
Scott Baker72758c72015-02-10 19:26:35 -08003446class PlanetStackList(XOSListCreateAPIView):
Scott Baker191f9b22015-01-12 13:16:39 -08003447 queryset = PlanetStack.objects.select_related().all()
3448 serializer_class = PlanetStackSerializer
3449 id_serializer_class = PlanetStackIdSerializer
Scott Baker89a7b7c2014-10-07 00:10:17 -07003450 filter_backends = (filters.DjangoFilterBackend,)
Scott Baker84cf39e2015-01-30 15:41:39 -08003451 filter_fields = ('id','created','updated','enacted','policed','backend_register','backend_status','deleted','description',)
Scott Baker89a7b7c2014-10-07 00:10:17 -07003452
3453 def get_serializer_class(self):
Scott Baker84cf39e2015-01-30 15:41:39 -08003454 no_hyperlinks=False
3455 if hasattr(self.request,"QUERY_PARAMS"):
3456 no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
Scott Baker89a7b7c2014-10-07 00:10:17 -07003457 if (no_hyperlinks):
3458 return self.id_serializer_class
3459 else:
3460 return self.serializer_class
3461
3462 def get_queryset(self):
Scott Baker20101af2015-02-02 10:41:12 -08003463 if (not self.request.user.is_authenticated()):
Scott Baker4af864e2015-02-02 13:53:46 -08003464 raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API")
Scott Baker191f9b22015-01-12 13:16:39 -08003465 return PlanetStack.select_by_user(self.request.user)
Scott Baker89a7b7c2014-10-07 00:10:17 -07003466
Scott Baker89a7b7c2014-10-07 00:10:17 -07003467
Scott Baker72758c72015-02-10 19:26:35 -08003468class PlanetStackDetail(XOSRetrieveUpdateDestroyAPIView):
Scott Baker191f9b22015-01-12 13:16:39 -08003469 queryset = PlanetStack.objects.select_related().all()
3470 serializer_class = PlanetStackSerializer
3471 id_serializer_class = PlanetStackIdSerializer
Scott Baker89a7b7c2014-10-07 00:10:17 -07003472
3473 def get_serializer_class(self):
Scott Baker84cf39e2015-01-30 15:41:39 -08003474 no_hyperlinks=False
3475 if hasattr(self.request,"QUERY_PARAMS"):
3476 no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
Scott Baker89a7b7c2014-10-07 00:10:17 -07003477 if (no_hyperlinks):
3478 return self.id_serializer_class
3479 else:
3480 return self.serializer_class
Scott Baker84cf39e2015-01-30 15:41:39 -08003481
Scott Baker89a7b7c2014-10-07 00:10:17 -07003482 def get_queryset(self):
Scott Baker20101af2015-02-02 10:41:12 -08003483 if (not self.request.user.is_authenticated()):
Scott Baker4af864e2015-02-02 13:53:46 -08003484 raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API")
Scott Baker191f9b22015-01-12 13:16:39 -08003485 return PlanetStack.select_by_user(self.request.user)
Scott Baker89a7b7c2014-10-07 00:10:17 -07003486
Scott Baker72758c72015-02-10 19:26:35 -08003487 # update() is handled by XOSRetrieveUpdateDestroyAPIView
Scott Baker89a7b7c2014-10-07 00:10:17 -07003488
Scott Baker72758c72015-02-10 19:26:35 -08003489 # destroy() is handled by XOSRetrieveUpdateDestroyAPIView
Scott Baker89a7b7c2014-10-07 00:10:17 -07003490
3491
3492
Scott Baker72758c72015-02-10 19:26:35 -08003493class ChargeList(XOSListCreateAPIView):
Scott Baker89a7b7c2014-10-07 00:10:17 -07003494 queryset = Charge.objects.select_related().all()
3495 serializer_class = ChargeSerializer
3496 id_serializer_class = ChargeIdSerializer
3497 filter_backends = (filters.DjangoFilterBackend,)
Scott Baker84cf39e2015-01-30 15:41:39 -08003498 filter_fields = ('id','created','updated','enacted','policed','backend_register','backend_status','deleted','account','slice','kind','state','date','object','amount','coreHours','invoice',)
Scott Baker89a7b7c2014-10-07 00:10:17 -07003499
3500 def get_serializer_class(self):
Scott Baker84cf39e2015-01-30 15:41:39 -08003501 no_hyperlinks=False
3502 if hasattr(self.request,"QUERY_PARAMS"):
3503 no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
Scott Baker89a7b7c2014-10-07 00:10:17 -07003504 if (no_hyperlinks):
3505 return self.id_serializer_class
3506 else:
3507 return self.serializer_class
3508
3509 def get_queryset(self):
Scott Baker20101af2015-02-02 10:41:12 -08003510 if (not self.request.user.is_authenticated()):
Scott Baker4af864e2015-02-02 13:53:46 -08003511 raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API")
Scott Baker89a7b7c2014-10-07 00:10:17 -07003512 return Charge.select_by_user(self.request.user)
3513
Scott Baker89a7b7c2014-10-07 00:10:17 -07003514
Scott Baker72758c72015-02-10 19:26:35 -08003515class ChargeDetail(XOSRetrieveUpdateDestroyAPIView):
Scott Baker89a7b7c2014-10-07 00:10:17 -07003516 queryset = Charge.objects.select_related().all()
3517 serializer_class = ChargeSerializer
3518 id_serializer_class = ChargeIdSerializer
3519
3520 def get_serializer_class(self):
Scott Baker84cf39e2015-01-30 15:41:39 -08003521 no_hyperlinks=False
3522 if hasattr(self.request,"QUERY_PARAMS"):
3523 no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
Scott Baker89a7b7c2014-10-07 00:10:17 -07003524 if (no_hyperlinks):
3525 return self.id_serializer_class
3526 else:
3527 return self.serializer_class
Scott Baker84cf39e2015-01-30 15:41:39 -08003528
Scott Baker89a7b7c2014-10-07 00:10:17 -07003529 def get_queryset(self):
Scott Baker20101af2015-02-02 10:41:12 -08003530 if (not self.request.user.is_authenticated()):
Scott Baker4af864e2015-02-02 13:53:46 -08003531 raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API")
Scott Baker89a7b7c2014-10-07 00:10:17 -07003532 return Charge.select_by_user(self.request.user)
3533
Scott Baker72758c72015-02-10 19:26:35 -08003534 # update() is handled by XOSRetrieveUpdateDestroyAPIView
Scott Baker89a7b7c2014-10-07 00:10:17 -07003535
Scott Baker72758c72015-02-10 19:26:35 -08003536 # destroy() is handled by XOSRetrieveUpdateDestroyAPIView
Scott Baker89a7b7c2014-10-07 00:10:17 -07003537
3538
3539
Scott Baker72758c72015-02-10 19:26:35 -08003540class RoleList(XOSListCreateAPIView):
Scott Baker89a7b7c2014-10-07 00:10:17 -07003541 queryset = Role.objects.select_related().all()
3542 serializer_class = RoleSerializer
3543 id_serializer_class = RoleIdSerializer
3544 filter_backends = (filters.DjangoFilterBackend,)
Scott Baker84cf39e2015-01-30 15:41:39 -08003545 filter_fields = ('id','created','updated','enacted','policed','backend_register','backend_status','deleted','role_type','role','description','content_type',)
Scott Baker89a7b7c2014-10-07 00:10:17 -07003546
3547 def get_serializer_class(self):
Scott Baker84cf39e2015-01-30 15:41:39 -08003548 no_hyperlinks=False
3549 if hasattr(self.request,"QUERY_PARAMS"):
3550 no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
Scott Baker89a7b7c2014-10-07 00:10:17 -07003551 if (no_hyperlinks):
3552 return self.id_serializer_class
3553 else:
3554 return self.serializer_class
3555
3556 def get_queryset(self):
Scott Baker20101af2015-02-02 10:41:12 -08003557 if (not self.request.user.is_authenticated()):
Scott Baker4af864e2015-02-02 13:53:46 -08003558 raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API")
Scott Baker89a7b7c2014-10-07 00:10:17 -07003559 return Role.select_by_user(self.request.user)
3560
Scott Baker89a7b7c2014-10-07 00:10:17 -07003561
Scott Baker72758c72015-02-10 19:26:35 -08003562class RoleDetail(XOSRetrieveUpdateDestroyAPIView):
Scott Baker89a7b7c2014-10-07 00:10:17 -07003563 queryset = Role.objects.select_related().all()
3564 serializer_class = RoleSerializer
3565 id_serializer_class = RoleIdSerializer
3566
3567 def get_serializer_class(self):
Scott Baker84cf39e2015-01-30 15:41:39 -08003568 no_hyperlinks=False
3569 if hasattr(self.request,"QUERY_PARAMS"):
3570 no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
Scott Baker89a7b7c2014-10-07 00:10:17 -07003571 if (no_hyperlinks):
3572 return self.id_serializer_class
3573 else:
3574 return self.serializer_class
Scott Baker84cf39e2015-01-30 15:41:39 -08003575
Scott Baker89a7b7c2014-10-07 00:10:17 -07003576 def get_queryset(self):
Scott Baker20101af2015-02-02 10:41:12 -08003577 if (not self.request.user.is_authenticated()):
Scott Baker4af864e2015-02-02 13:53:46 -08003578 raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API")
Scott Baker89a7b7c2014-10-07 00:10:17 -07003579 return Role.select_by_user(self.request.user)
3580
Scott Baker72758c72015-02-10 19:26:35 -08003581 # update() is handled by XOSRetrieveUpdateDestroyAPIView
Scott Baker89a7b7c2014-10-07 00:10:17 -07003582
Scott Baker72758c72015-02-10 19:26:35 -08003583 # destroy() is handled by XOSRetrieveUpdateDestroyAPIView
Scott Baker89a7b7c2014-10-07 00:10:17 -07003584
3585
3586
Scott Baker72758c72015-02-10 19:26:35 -08003587class UsableObjectList(XOSListCreateAPIView):
Scott Baker89a7b7c2014-10-07 00:10:17 -07003588 queryset = UsableObject.objects.select_related().all()
3589 serializer_class = UsableObjectSerializer
3590 id_serializer_class = UsableObjectIdSerializer
3591 filter_backends = (filters.DjangoFilterBackend,)
Scott Baker84cf39e2015-01-30 15:41:39 -08003592 filter_fields = ('id','created','updated','enacted','policed','backend_register','backend_status','deleted','name',)
Scott Baker89a7b7c2014-10-07 00:10:17 -07003593
3594 def get_serializer_class(self):
Scott Baker84cf39e2015-01-30 15:41:39 -08003595 no_hyperlinks=False
3596 if hasattr(self.request,"QUERY_PARAMS"):
3597 no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
Scott Baker89a7b7c2014-10-07 00:10:17 -07003598 if (no_hyperlinks):
3599 return self.id_serializer_class
3600 else:
3601 return self.serializer_class
3602
3603 def get_queryset(self):
Scott Baker20101af2015-02-02 10:41:12 -08003604 if (not self.request.user.is_authenticated()):
Scott Baker4af864e2015-02-02 13:53:46 -08003605 raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API")
Scott Baker89a7b7c2014-10-07 00:10:17 -07003606 return UsableObject.select_by_user(self.request.user)
3607
Scott Baker89a7b7c2014-10-07 00:10:17 -07003608
Scott Baker72758c72015-02-10 19:26:35 -08003609class UsableObjectDetail(XOSRetrieveUpdateDestroyAPIView):
Scott Baker89a7b7c2014-10-07 00:10:17 -07003610 queryset = UsableObject.objects.select_related().all()
3611 serializer_class = UsableObjectSerializer
3612 id_serializer_class = UsableObjectIdSerializer
3613
3614 def get_serializer_class(self):
Scott Baker84cf39e2015-01-30 15:41:39 -08003615 no_hyperlinks=False
3616 if hasattr(self.request,"QUERY_PARAMS"):
3617 no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
Scott Baker89a7b7c2014-10-07 00:10:17 -07003618 if (no_hyperlinks):
3619 return self.id_serializer_class
3620 else:
3621 return self.serializer_class
Scott Baker84cf39e2015-01-30 15:41:39 -08003622
Scott Baker89a7b7c2014-10-07 00:10:17 -07003623 def get_queryset(self):
Scott Baker20101af2015-02-02 10:41:12 -08003624 if (not self.request.user.is_authenticated()):
Scott Baker4af864e2015-02-02 13:53:46 -08003625 raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API")
Scott Baker89a7b7c2014-10-07 00:10:17 -07003626 return UsableObject.select_by_user(self.request.user)
3627
Scott Baker72758c72015-02-10 19:26:35 -08003628 # update() is handled by XOSRetrieveUpdateDestroyAPIView
Scott Baker89a7b7c2014-10-07 00:10:17 -07003629
Scott Baker72758c72015-02-10 19:26:35 -08003630 # destroy() is handled by XOSRetrieveUpdateDestroyAPIView
Scott Baker89a7b7c2014-10-07 00:10:17 -07003631
3632
Scott Baker191f9b22015-01-12 13:16:39 -08003633
Scott Baker72758c72015-02-10 19:26:35 -08003634class SiteRoleList(XOSListCreateAPIView):
Scott Baker89a7b7c2014-10-07 00:10:17 -07003635 queryset = SiteRole.objects.select_related().all()
3636 serializer_class = SiteRoleSerializer
3637 id_serializer_class = SiteRoleIdSerializer
3638 filter_backends = (filters.DjangoFilterBackend,)
Scott Baker84cf39e2015-01-30 15:41:39 -08003639 filter_fields = ('id','created','updated','enacted','policed','backend_register','backend_status','deleted','role',)
Scott Baker89a7b7c2014-10-07 00:10:17 -07003640
3641 def get_serializer_class(self):
Scott Baker84cf39e2015-01-30 15:41:39 -08003642 no_hyperlinks=False
3643 if hasattr(self.request,"QUERY_PARAMS"):
3644 no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
Scott Baker89a7b7c2014-10-07 00:10:17 -07003645 if (no_hyperlinks):
3646 return self.id_serializer_class
3647 else:
3648 return self.serializer_class
3649
3650 def get_queryset(self):
Scott Baker20101af2015-02-02 10:41:12 -08003651 if (not self.request.user.is_authenticated()):
Scott Baker4af864e2015-02-02 13:53:46 -08003652 raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API")
Scott Baker89a7b7c2014-10-07 00:10:17 -07003653 return SiteRole.select_by_user(self.request.user)
3654
Scott Baker89a7b7c2014-10-07 00:10:17 -07003655
Scott Baker72758c72015-02-10 19:26:35 -08003656class SiteRoleDetail(XOSRetrieveUpdateDestroyAPIView):
Scott Baker89a7b7c2014-10-07 00:10:17 -07003657 queryset = SiteRole.objects.select_related().all()
3658 serializer_class = SiteRoleSerializer
3659 id_serializer_class = SiteRoleIdSerializer
3660
3661 def get_serializer_class(self):
Scott Baker84cf39e2015-01-30 15:41:39 -08003662 no_hyperlinks=False
3663 if hasattr(self.request,"QUERY_PARAMS"):
3664 no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
Scott Baker89a7b7c2014-10-07 00:10:17 -07003665 if (no_hyperlinks):
3666 return self.id_serializer_class
3667 else:
3668 return self.serializer_class
Scott Baker84cf39e2015-01-30 15:41:39 -08003669
Scott Baker89a7b7c2014-10-07 00:10:17 -07003670 def get_queryset(self):
Scott Baker20101af2015-02-02 10:41:12 -08003671 if (not self.request.user.is_authenticated()):
Scott Baker4af864e2015-02-02 13:53:46 -08003672 raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API")
Scott Baker89a7b7c2014-10-07 00:10:17 -07003673 return SiteRole.select_by_user(self.request.user)
3674
Scott Baker72758c72015-02-10 19:26:35 -08003675 # update() is handled by XOSRetrieveUpdateDestroyAPIView
Scott Baker89a7b7c2014-10-07 00:10:17 -07003676
Scott Baker72758c72015-02-10 19:26:35 -08003677 # destroy() is handled by XOSRetrieveUpdateDestroyAPIView
Scott Baker89a7b7c2014-10-07 00:10:17 -07003678
3679
3680
Scott Baker72758c72015-02-10 19:26:35 -08003681class SliceCredentialList(XOSListCreateAPIView):
Scott Baker89a7b7c2014-10-07 00:10:17 -07003682 queryset = SliceCredential.objects.select_related().all()
3683 serializer_class = SliceCredentialSerializer
3684 id_serializer_class = SliceCredentialIdSerializer
3685 filter_backends = (filters.DjangoFilterBackend,)
Scott Baker84cf39e2015-01-30 15:41:39 -08003686 filter_fields = ('id','created','updated','enacted','policed','backend_register','backend_status','deleted','slice','name','key_id','enc_value',)
Scott Baker89a7b7c2014-10-07 00:10:17 -07003687
3688 def get_serializer_class(self):
Scott Baker84cf39e2015-01-30 15:41:39 -08003689 no_hyperlinks=False
3690 if hasattr(self.request,"QUERY_PARAMS"):
3691 no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
Scott Baker89a7b7c2014-10-07 00:10:17 -07003692 if (no_hyperlinks):
3693 return self.id_serializer_class
3694 else:
3695 return self.serializer_class
3696
3697 def get_queryset(self):
Scott Baker20101af2015-02-02 10:41:12 -08003698 if (not self.request.user.is_authenticated()):
Scott Baker4af864e2015-02-02 13:53:46 -08003699 raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API")
Scott Baker89a7b7c2014-10-07 00:10:17 -07003700 return SliceCredential.select_by_user(self.request.user)
3701
Scott Baker89a7b7c2014-10-07 00:10:17 -07003702
Scott Baker72758c72015-02-10 19:26:35 -08003703class SliceCredentialDetail(XOSRetrieveUpdateDestroyAPIView):
Scott Baker89a7b7c2014-10-07 00:10:17 -07003704 queryset = SliceCredential.objects.select_related().all()
3705 serializer_class = SliceCredentialSerializer
3706 id_serializer_class = SliceCredentialIdSerializer
3707
3708 def get_serializer_class(self):
Scott Baker84cf39e2015-01-30 15:41:39 -08003709 no_hyperlinks=False
3710 if hasattr(self.request,"QUERY_PARAMS"):
3711 no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
Scott Baker89a7b7c2014-10-07 00:10:17 -07003712 if (no_hyperlinks):
3713 return self.id_serializer_class
3714 else:
3715 return self.serializer_class
Scott Baker84cf39e2015-01-30 15:41:39 -08003716
Scott Baker89a7b7c2014-10-07 00:10:17 -07003717 def get_queryset(self):
Scott Baker20101af2015-02-02 10:41:12 -08003718 if (not self.request.user.is_authenticated()):
Scott Baker4af864e2015-02-02 13:53:46 -08003719 raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API")
Scott Baker89a7b7c2014-10-07 00:10:17 -07003720 return SliceCredential.select_by_user(self.request.user)
3721
Scott Baker72758c72015-02-10 19:26:35 -08003722 # update() is handled by XOSRetrieveUpdateDestroyAPIView
Scott Baker89a7b7c2014-10-07 00:10:17 -07003723
Scott Baker72758c72015-02-10 19:26:35 -08003724 # destroy() is handled by XOSRetrieveUpdateDestroyAPIView
Scott Baker89a7b7c2014-10-07 00:10:17 -07003725
3726
3727
Scott Baker72758c72015-02-10 19:26:35 -08003728class SliverList(XOSListCreateAPIView):
Scott Baker89a7b7c2014-10-07 00:10:17 -07003729 queryset = Sliver.objects.select_related().all()
3730 serializer_class = SliverSerializer
3731 id_serializer_class = SliverIdSerializer
3732 filter_backends = (filters.DjangoFilterBackend,)
Scott Baker84cf39e2015-01-30 15:41:39 -08003733 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 Baker89a7b7c2014-10-07 00:10:17 -07003734
3735 def get_serializer_class(self):
Scott Baker84cf39e2015-01-30 15:41:39 -08003736 no_hyperlinks=False
3737 if hasattr(self.request,"QUERY_PARAMS"):
3738 no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
Scott Baker89a7b7c2014-10-07 00:10:17 -07003739 if (no_hyperlinks):
3740 return self.id_serializer_class
3741 else:
3742 return self.serializer_class
3743
3744 def get_queryset(self):
Scott Baker20101af2015-02-02 10:41:12 -08003745 if (not self.request.user.is_authenticated()):
Scott Baker4af864e2015-02-02 13:53:46 -08003746 raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API")
Scott Baker89a7b7c2014-10-07 00:10:17 -07003747 return Sliver.select_by_user(self.request.user)
3748
Scott Baker89a7b7c2014-10-07 00:10:17 -07003749
Scott Baker72758c72015-02-10 19:26:35 -08003750class SliverDetail(XOSRetrieveUpdateDestroyAPIView):
Scott Baker89a7b7c2014-10-07 00:10:17 -07003751 queryset = Sliver.objects.select_related().all()
3752 serializer_class = SliverSerializer
3753 id_serializer_class = SliverIdSerializer
3754
3755 def get_serializer_class(self):
Scott Baker84cf39e2015-01-30 15:41:39 -08003756 no_hyperlinks=False
3757 if hasattr(self.request,"QUERY_PARAMS"):
3758 no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
Scott Baker89a7b7c2014-10-07 00:10:17 -07003759 if (no_hyperlinks):
3760 return self.id_serializer_class
3761 else:
3762 return self.serializer_class
Scott Baker84cf39e2015-01-30 15:41:39 -08003763
Scott Baker89a7b7c2014-10-07 00:10:17 -07003764 def get_queryset(self):
Scott Baker20101af2015-02-02 10:41:12 -08003765 if (not self.request.user.is_authenticated()):
Scott Baker4af864e2015-02-02 13:53:46 -08003766 raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API")
Scott Baker89a7b7c2014-10-07 00:10:17 -07003767 return Sliver.select_by_user(self.request.user)
3768
Scott Baker72758c72015-02-10 19:26:35 -08003769 # update() is handled by XOSRetrieveUpdateDestroyAPIView
Scott Baker89a7b7c2014-10-07 00:10:17 -07003770
Scott Baker72758c72015-02-10 19:26:35 -08003771 # destroy() is handled by XOSRetrieveUpdateDestroyAPIView
Scott Baker89a7b7c2014-10-07 00:10:17 -07003772
3773
3774
Scott Baker72758c72015-02-10 19:26:35 -08003775class NodeList(XOSListCreateAPIView):
Scott Baker89a7b7c2014-10-07 00:10:17 -07003776 queryset = Node.objects.select_related().all()
3777 serializer_class = NodeSerializer
3778 id_serializer_class = NodeIdSerializer
3779 filter_backends = (filters.DjangoFilterBackend,)
Scott Baker84cf39e2015-01-30 15:41:39 -08003780 filter_fields = ('id','created','updated','enacted','policed','backend_register','backend_status','deleted','name','site_deployment','site',)
Scott Baker89a7b7c2014-10-07 00:10:17 -07003781
3782 def get_serializer_class(self):
Scott Baker84cf39e2015-01-30 15:41:39 -08003783 no_hyperlinks=False
3784 if hasattr(self.request,"QUERY_PARAMS"):
3785 no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
Scott Baker89a7b7c2014-10-07 00:10:17 -07003786 if (no_hyperlinks):
3787 return self.id_serializer_class
3788 else:
3789 return self.serializer_class
3790
3791 def get_queryset(self):
Scott Baker20101af2015-02-02 10:41:12 -08003792 if (not self.request.user.is_authenticated()):
Scott Baker4af864e2015-02-02 13:53:46 -08003793 raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API")
Scott Baker89a7b7c2014-10-07 00:10:17 -07003794 return Node.select_by_user(self.request.user)
3795
Scott Baker89a7b7c2014-10-07 00:10:17 -07003796
Scott Baker72758c72015-02-10 19:26:35 -08003797class NodeDetail(XOSRetrieveUpdateDestroyAPIView):
Scott Baker89a7b7c2014-10-07 00:10:17 -07003798 queryset = Node.objects.select_related().all()
3799 serializer_class = NodeSerializer
3800 id_serializer_class = NodeIdSerializer
3801
3802 def get_serializer_class(self):
Scott Baker84cf39e2015-01-30 15:41:39 -08003803 no_hyperlinks=False
3804 if hasattr(self.request,"QUERY_PARAMS"):
3805 no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
Scott Baker89a7b7c2014-10-07 00:10:17 -07003806 if (no_hyperlinks):
3807 return self.id_serializer_class
3808 else:
3809 return self.serializer_class
Scott Baker84cf39e2015-01-30 15:41:39 -08003810
Scott Baker89a7b7c2014-10-07 00:10:17 -07003811 def get_queryset(self):
Scott Baker20101af2015-02-02 10:41:12 -08003812 if (not self.request.user.is_authenticated()):
Scott Baker4af864e2015-02-02 13:53:46 -08003813 raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API")
Scott Baker89a7b7c2014-10-07 00:10:17 -07003814 return Node.select_by_user(self.request.user)
3815
Scott Baker72758c72015-02-10 19:26:35 -08003816 # update() is handled by XOSRetrieveUpdateDestroyAPIView
Scott Baker89a7b7c2014-10-07 00:10:17 -07003817
Scott Baker72758c72015-02-10 19:26:35 -08003818 # destroy() is handled by XOSRetrieveUpdateDestroyAPIView
Scott Baker89a7b7c2014-10-07 00:10:17 -07003819
3820
3821
Scott Baker72758c72015-02-10 19:26:35 -08003822class DashboardViewList(XOSListCreateAPIView):
Scott Baker89a7b7c2014-10-07 00:10:17 -07003823 queryset = DashboardView.objects.select_related().all()
3824 serializer_class = DashboardViewSerializer
3825 id_serializer_class = DashboardViewIdSerializer
3826 filter_backends = (filters.DjangoFilterBackend,)
Scott Baker84cf39e2015-01-30 15:41:39 -08003827 filter_fields = ('id','created','updated','enacted','policed','backend_register','backend_status','deleted','name','url','enabled','controllers',)
Scott Baker89a7b7c2014-10-07 00:10:17 -07003828
3829 def get_serializer_class(self):
Scott Baker84cf39e2015-01-30 15:41:39 -08003830 no_hyperlinks=False
3831 if hasattr(self.request,"QUERY_PARAMS"):
3832 no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
Scott Baker89a7b7c2014-10-07 00:10:17 -07003833 if (no_hyperlinks):
3834 return self.id_serializer_class
3835 else:
3836 return self.serializer_class
3837
3838 def get_queryset(self):
Scott Baker20101af2015-02-02 10:41:12 -08003839 if (not self.request.user.is_authenticated()):
Scott Baker4af864e2015-02-02 13:53:46 -08003840 raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API")
Scott Baker89a7b7c2014-10-07 00:10:17 -07003841 return DashboardView.select_by_user(self.request.user)
3842
Scott Baker89a7b7c2014-10-07 00:10:17 -07003843
Scott Baker72758c72015-02-10 19:26:35 -08003844class DashboardViewDetail(XOSRetrieveUpdateDestroyAPIView):
Scott Baker89a7b7c2014-10-07 00:10:17 -07003845 queryset = DashboardView.objects.select_related().all()
3846 serializer_class = DashboardViewSerializer
3847 id_serializer_class = DashboardViewIdSerializer
3848
3849 def get_serializer_class(self):
Scott Baker84cf39e2015-01-30 15:41:39 -08003850 no_hyperlinks=False
3851 if hasattr(self.request,"QUERY_PARAMS"):
3852 no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
Scott Baker89a7b7c2014-10-07 00:10:17 -07003853 if (no_hyperlinks):
3854 return self.id_serializer_class
3855 else:
3856 return self.serializer_class
Scott Baker84cf39e2015-01-30 15:41:39 -08003857
Scott Baker89a7b7c2014-10-07 00:10:17 -07003858 def get_queryset(self):
Scott Baker20101af2015-02-02 10:41:12 -08003859 if (not self.request.user.is_authenticated()):
Scott Baker4af864e2015-02-02 13:53:46 -08003860 raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API")
Scott Baker89a7b7c2014-10-07 00:10:17 -07003861 return DashboardView.select_by_user(self.request.user)
3862
Scott Baker72758c72015-02-10 19:26:35 -08003863 # update() is handled by XOSRetrieveUpdateDestroyAPIView
Scott Baker89a7b7c2014-10-07 00:10:17 -07003864
Scott Baker72758c72015-02-10 19:26:35 -08003865 # destroy() is handled by XOSRetrieveUpdateDestroyAPIView
Scott Baker89a7b7c2014-10-07 00:10:17 -07003866
Scott Baker89a7b7c2014-10-07 00:10:17 -07003867
Scott Baker57c725c2014-11-12 01:13:53 -08003868
Scott Baker72758c72015-02-10 19:26:35 -08003869class ControllerNetworkList(XOSListCreateAPIView):
Scott Baker191f9b22015-01-12 13:16:39 -08003870 queryset = ControllerNetwork.objects.select_related().all()
3871 serializer_class = ControllerNetworkSerializer
3872 id_serializer_class = ControllerNetworkIdSerializer
3873 filter_backends = (filters.DjangoFilterBackend,)
Scott Baker84cf39e2015-01-30 15:41:39 -08003874 filter_fields = ('id','created','updated','enacted','policed','backend_register','backend_status','deleted','network','controller','net_id','router_id','subnet_id','subnet',)
Scott Baker191f9b22015-01-12 13:16:39 -08003875
3876 def get_serializer_class(self):
Scott Baker84cf39e2015-01-30 15:41:39 -08003877 no_hyperlinks=False
3878 if hasattr(self.request,"QUERY_PARAMS"):
3879 no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
Scott Baker191f9b22015-01-12 13:16:39 -08003880 if (no_hyperlinks):
3881 return self.id_serializer_class
3882 else:
3883 return self.serializer_class
3884
3885 def get_queryset(self):
Scott Baker20101af2015-02-02 10:41:12 -08003886 if (not self.request.user.is_authenticated()):
Scott Baker4af864e2015-02-02 13:53:46 -08003887 raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API")
Scott Baker191f9b22015-01-12 13:16:39 -08003888 return ControllerNetwork.select_by_user(self.request.user)
3889
Scott Baker191f9b22015-01-12 13:16:39 -08003890
Scott Baker72758c72015-02-10 19:26:35 -08003891class ControllerNetworkDetail(XOSRetrieveUpdateDestroyAPIView):
Scott Baker191f9b22015-01-12 13:16:39 -08003892 queryset = ControllerNetwork.objects.select_related().all()
3893 serializer_class = ControllerNetworkSerializer
3894 id_serializer_class = ControllerNetworkIdSerializer
3895
3896 def get_serializer_class(self):
Scott Baker84cf39e2015-01-30 15:41:39 -08003897 no_hyperlinks=False
3898 if hasattr(self.request,"QUERY_PARAMS"):
3899 no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
Scott Baker191f9b22015-01-12 13:16:39 -08003900 if (no_hyperlinks):
3901 return self.id_serializer_class
3902 else:
3903 return self.serializer_class
Scott Baker84cf39e2015-01-30 15:41:39 -08003904
Scott Baker191f9b22015-01-12 13:16:39 -08003905 def get_queryset(self):
Scott Baker20101af2015-02-02 10:41:12 -08003906 if (not self.request.user.is_authenticated()):
Scott Baker4af864e2015-02-02 13:53:46 -08003907 raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API")
Scott Baker191f9b22015-01-12 13:16:39 -08003908 return ControllerNetwork.select_by_user(self.request.user)
3909
Scott Baker72758c72015-02-10 19:26:35 -08003910 # update() is handled by XOSRetrieveUpdateDestroyAPIView
Scott Baker191f9b22015-01-12 13:16:39 -08003911
Scott Baker72758c72015-02-10 19:26:35 -08003912 # destroy() is handled by XOSRetrieveUpdateDestroyAPIView
Scott Baker191f9b22015-01-12 13:16:39 -08003913
3914
3915
Scott Baker72758c72015-02-10 19:26:35 -08003916class ImageDeploymentsList(XOSListCreateAPIView):
Scott Baker515dc9e2014-12-22 09:29:05 -08003917 queryset = ImageDeployments.objects.select_related().all()
3918 serializer_class = ImageDeploymentsSerializer
3919 id_serializer_class = ImageDeploymentsIdSerializer
Scott Bakerb744f1c2014-11-21 11:32:24 -08003920 filter_backends = (filters.DjangoFilterBackend,)
Scott Baker84cf39e2015-01-30 15:41:39 -08003921 filter_fields = ('id','created','updated','enacted','policed','backend_register','backend_status','deleted','image','deployment',)
Scott Bakerb744f1c2014-11-21 11:32:24 -08003922
3923 def get_serializer_class(self):
Scott Baker84cf39e2015-01-30 15:41:39 -08003924 no_hyperlinks=False
3925 if hasattr(self.request,"QUERY_PARAMS"):
3926 no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
Scott Bakerb744f1c2014-11-21 11:32:24 -08003927 if (no_hyperlinks):
3928 return self.id_serializer_class
3929 else:
3930 return self.serializer_class
3931
3932 def get_queryset(self):
Scott Baker20101af2015-02-02 10:41:12 -08003933 if (not self.request.user.is_authenticated()):
Scott Baker4af864e2015-02-02 13:53:46 -08003934 raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API")
Scott Baker515dc9e2014-12-22 09:29:05 -08003935 return ImageDeployments.select_by_user(self.request.user)
Scott Bakerb744f1c2014-11-21 11:32:24 -08003936
Scott Bakerb744f1c2014-11-21 11:32:24 -08003937
Scott Baker72758c72015-02-10 19:26:35 -08003938class ImageDeploymentsDetail(XOSRetrieveUpdateDestroyAPIView):
Scott Baker515dc9e2014-12-22 09:29:05 -08003939 queryset = ImageDeployments.objects.select_related().all()
3940 serializer_class = ImageDeploymentsSerializer
3941 id_serializer_class = ImageDeploymentsIdSerializer
Scott Bakerb744f1c2014-11-21 11:32:24 -08003942
3943 def get_serializer_class(self):
Scott Baker84cf39e2015-01-30 15:41:39 -08003944 no_hyperlinks=False
3945 if hasattr(self.request,"QUERY_PARAMS"):
3946 no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
Scott Bakerb744f1c2014-11-21 11:32:24 -08003947 if (no_hyperlinks):
3948 return self.id_serializer_class
3949 else:
3950 return self.serializer_class
Scott Baker84cf39e2015-01-30 15:41:39 -08003951
Scott Bakerb744f1c2014-11-21 11:32:24 -08003952 def get_queryset(self):
Scott Baker20101af2015-02-02 10:41:12 -08003953 if (not self.request.user.is_authenticated()):
Scott Baker4af864e2015-02-02 13:53:46 -08003954 raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API")
Scott Baker515dc9e2014-12-22 09:29:05 -08003955 return ImageDeployments.select_by_user(self.request.user)
Scott Bakerb744f1c2014-11-21 11:32:24 -08003956
Scott Baker72758c72015-02-10 19:26:35 -08003957 # update() is handled by XOSRetrieveUpdateDestroyAPIView
Scott Bakerb744f1c2014-11-21 11:32:24 -08003958
Scott Baker72758c72015-02-10 19:26:35 -08003959 # destroy() is handled by XOSRetrieveUpdateDestroyAPIView
Scott Bakerb744f1c2014-11-21 11:32:24 -08003960
Scott Bakerb744f1c2014-11-21 11:32:24 -08003961
3962
Scott Baker72758c72015-02-10 19:26:35 -08003963class ControllerUserList(XOSListCreateAPIView):
Scott Baker191f9b22015-01-12 13:16:39 -08003964 queryset = ControllerUser.objects.select_related().all()
3965 serializer_class = ControllerUserSerializer
3966 id_serializer_class = ControllerUserIdSerializer
3967 filter_backends = (filters.DjangoFilterBackend,)
Scott Baker84cf39e2015-01-30 15:41:39 -08003968 filter_fields = ('id','created','updated','enacted','policed','backend_register','backend_status','deleted','user','controller','kuser_id',)
Scott Baker191f9b22015-01-12 13:16:39 -08003969
3970 def get_serializer_class(self):
Scott Baker84cf39e2015-01-30 15:41:39 -08003971 no_hyperlinks=False
3972 if hasattr(self.request,"QUERY_PARAMS"):
3973 no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
Scott Baker191f9b22015-01-12 13:16:39 -08003974 if (no_hyperlinks):
3975 return self.id_serializer_class
3976 else:
3977 return self.serializer_class
3978
3979 def get_queryset(self):
Scott Baker20101af2015-02-02 10:41:12 -08003980 if (not self.request.user.is_authenticated()):
Scott Baker4af864e2015-02-02 13:53:46 -08003981 raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API")
Scott Baker191f9b22015-01-12 13:16:39 -08003982 return ControllerUser.select_by_user(self.request.user)
3983
Scott Baker191f9b22015-01-12 13:16:39 -08003984
Scott Baker72758c72015-02-10 19:26:35 -08003985class ControllerUserDetail(XOSRetrieveUpdateDestroyAPIView):
Scott Baker191f9b22015-01-12 13:16:39 -08003986 queryset = ControllerUser.objects.select_related().all()
3987 serializer_class = ControllerUserSerializer
3988 id_serializer_class = ControllerUserIdSerializer
3989
3990 def get_serializer_class(self):
Scott Baker84cf39e2015-01-30 15:41:39 -08003991 no_hyperlinks=False
3992 if hasattr(self.request,"QUERY_PARAMS"):
3993 no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
Scott Baker191f9b22015-01-12 13:16:39 -08003994 if (no_hyperlinks):
3995 return self.id_serializer_class
3996 else:
3997 return self.serializer_class
Scott Baker84cf39e2015-01-30 15:41:39 -08003998
Scott Baker191f9b22015-01-12 13:16:39 -08003999 def get_queryset(self):
Scott Baker20101af2015-02-02 10:41:12 -08004000 if (not self.request.user.is_authenticated()):
Scott Baker4af864e2015-02-02 13:53:46 -08004001 raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API")
Scott Baker191f9b22015-01-12 13:16:39 -08004002 return ControllerUser.select_by_user(self.request.user)
4003
Scott Baker72758c72015-02-10 19:26:35 -08004004 # update() is handled by XOSRetrieveUpdateDestroyAPIView
Scott Baker191f9b22015-01-12 13:16:39 -08004005
Scott Baker72758c72015-02-10 19:26:35 -08004006 # destroy() is handled by XOSRetrieveUpdateDestroyAPIView
Scott Baker191f9b22015-01-12 13:16:39 -08004007
4008
4009
Scott Baker72758c72015-02-10 19:26:35 -08004010class ReservedResourceList(XOSListCreateAPIView):
Scott Baker89a7b7c2014-10-07 00:10:17 -07004011 queryset = ReservedResource.objects.select_related().all()
4012 serializer_class = ReservedResourceSerializer
4013 id_serializer_class = ReservedResourceIdSerializer
4014 filter_backends = (filters.DjangoFilterBackend,)
Scott Baker84cf39e2015-01-30 15:41:39 -08004015 filter_fields = ('id','created','updated','enacted','policed','backend_register','backend_status','deleted','sliver','resource','quantity','reservationSet',)
Scott Baker89a7b7c2014-10-07 00:10:17 -07004016
4017 def get_serializer_class(self):
Scott Baker84cf39e2015-01-30 15:41:39 -08004018 no_hyperlinks=False
4019 if hasattr(self.request,"QUERY_PARAMS"):
4020 no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
Scott Baker89a7b7c2014-10-07 00:10:17 -07004021 if (no_hyperlinks):
4022 return self.id_serializer_class
4023 else:
4024 return self.serializer_class
4025
4026 def get_queryset(self):
Scott Baker20101af2015-02-02 10:41:12 -08004027 if (not self.request.user.is_authenticated()):
Scott Baker4af864e2015-02-02 13:53:46 -08004028 raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API")
Scott Baker89a7b7c2014-10-07 00:10:17 -07004029 return ReservedResource.select_by_user(self.request.user)
4030
Scott Baker89a7b7c2014-10-07 00:10:17 -07004031
Scott Baker72758c72015-02-10 19:26:35 -08004032class ReservedResourceDetail(XOSRetrieveUpdateDestroyAPIView):
Scott Baker89a7b7c2014-10-07 00:10:17 -07004033 queryset = ReservedResource.objects.select_related().all()
4034 serializer_class = ReservedResourceSerializer
4035 id_serializer_class = ReservedResourceIdSerializer
4036
4037 def get_serializer_class(self):
Scott Baker84cf39e2015-01-30 15:41:39 -08004038 no_hyperlinks=False
4039 if hasattr(self.request,"QUERY_PARAMS"):
4040 no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
Scott Baker89a7b7c2014-10-07 00:10:17 -07004041 if (no_hyperlinks):
4042 return self.id_serializer_class
4043 else:
4044 return self.serializer_class
Scott Baker84cf39e2015-01-30 15:41:39 -08004045
Scott Baker89a7b7c2014-10-07 00:10:17 -07004046 def get_queryset(self):
Scott Baker20101af2015-02-02 10:41:12 -08004047 if (not self.request.user.is_authenticated()):
Scott Baker4af864e2015-02-02 13:53:46 -08004048 raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API")
Scott Baker89a7b7c2014-10-07 00:10:17 -07004049 return ReservedResource.select_by_user(self.request.user)
4050
Scott Baker72758c72015-02-10 19:26:35 -08004051 # update() is handled by XOSRetrieveUpdateDestroyAPIView
Scott Baker89a7b7c2014-10-07 00:10:17 -07004052
Scott Baker72758c72015-02-10 19:26:35 -08004053 # destroy() is handled by XOSRetrieveUpdateDestroyAPIView
Scott Baker89a7b7c2014-10-07 00:10:17 -07004054
4055
4056
Scott Baker72758c72015-02-10 19:26:35 -08004057class PaymentList(XOSListCreateAPIView):
Scott Baker515dc9e2014-12-22 09:29:05 -08004058 queryset = Payment.objects.select_related().all()
4059 serializer_class = PaymentSerializer
4060 id_serializer_class = PaymentIdSerializer
4061 filter_backends = (filters.DjangoFilterBackend,)
Scott Baker84cf39e2015-01-30 15:41:39 -08004062 filter_fields = ('id','created','updated','enacted','policed','backend_register','backend_status','deleted','account','amount','date',)
Scott Baker515dc9e2014-12-22 09:29:05 -08004063
4064 def get_serializer_class(self):
Scott Baker84cf39e2015-01-30 15:41:39 -08004065 no_hyperlinks=False
4066 if hasattr(self.request,"QUERY_PARAMS"):
4067 no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
Scott Baker515dc9e2014-12-22 09:29:05 -08004068 if (no_hyperlinks):
4069 return self.id_serializer_class
4070 else:
4071 return self.serializer_class
4072
4073 def get_queryset(self):
Scott Baker20101af2015-02-02 10:41:12 -08004074 if (not self.request.user.is_authenticated()):
Scott Baker4af864e2015-02-02 13:53:46 -08004075 raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API")
Scott Baker515dc9e2014-12-22 09:29:05 -08004076 return Payment.select_by_user(self.request.user)
4077
Scott Baker515dc9e2014-12-22 09:29:05 -08004078
Scott Baker72758c72015-02-10 19:26:35 -08004079class PaymentDetail(XOSRetrieveUpdateDestroyAPIView):
Scott Baker515dc9e2014-12-22 09:29:05 -08004080 queryset = Payment.objects.select_related().all()
4081 serializer_class = PaymentSerializer
4082 id_serializer_class = PaymentIdSerializer
4083
4084 def get_serializer_class(self):
Scott Baker84cf39e2015-01-30 15:41:39 -08004085 no_hyperlinks=False
4086 if hasattr(self.request,"QUERY_PARAMS"):
4087 no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
Scott Baker515dc9e2014-12-22 09:29:05 -08004088 if (no_hyperlinks):
4089 return self.id_serializer_class
4090 else:
4091 return self.serializer_class
Scott Baker84cf39e2015-01-30 15:41:39 -08004092
Scott Baker515dc9e2014-12-22 09:29:05 -08004093 def get_queryset(self):
Scott Baker20101af2015-02-02 10:41:12 -08004094 if (not self.request.user.is_authenticated()):
Scott Baker4af864e2015-02-02 13:53:46 -08004095 raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API")
Scott Baker515dc9e2014-12-22 09:29:05 -08004096 return Payment.select_by_user(self.request.user)
4097
Scott Baker72758c72015-02-10 19:26:35 -08004098 # update() is handled by XOSRetrieveUpdateDestroyAPIView
Scott Baker515dc9e2014-12-22 09:29:05 -08004099
Scott Baker72758c72015-02-10 19:26:35 -08004100 # destroy() is handled by XOSRetrieveUpdateDestroyAPIView
Scott Baker515dc9e2014-12-22 09:29:05 -08004101
4102
4103
Scott Baker72758c72015-02-10 19:26:35 -08004104class NetworkSliceList(XOSListCreateAPIView):
Scott Baker89a7b7c2014-10-07 00:10:17 -07004105 queryset = NetworkSlice.objects.select_related().all()
4106 serializer_class = NetworkSliceSerializer
4107 id_serializer_class = NetworkSliceIdSerializer
4108 filter_backends = (filters.DjangoFilterBackend,)
Scott Baker84cf39e2015-01-30 15:41:39 -08004109 filter_fields = ('id','created','updated','enacted','policed','backend_register','backend_status','deleted','network','slice',)
Scott Baker89a7b7c2014-10-07 00:10:17 -07004110
4111 def get_serializer_class(self):
Scott Baker84cf39e2015-01-30 15:41:39 -08004112 no_hyperlinks=False
4113 if hasattr(self.request,"QUERY_PARAMS"):
4114 no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
Scott Baker89a7b7c2014-10-07 00:10:17 -07004115 if (no_hyperlinks):
4116 return self.id_serializer_class
4117 else:
4118 return self.serializer_class
4119
4120 def get_queryset(self):
Scott Baker20101af2015-02-02 10:41:12 -08004121 if (not self.request.user.is_authenticated()):
Scott Baker4af864e2015-02-02 13:53:46 -08004122 raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API")
Scott Baker89a7b7c2014-10-07 00:10:17 -07004123 return NetworkSlice.select_by_user(self.request.user)
4124
Scott Baker89a7b7c2014-10-07 00:10:17 -07004125
Scott Baker72758c72015-02-10 19:26:35 -08004126class NetworkSliceDetail(XOSRetrieveUpdateDestroyAPIView):
Scott Baker89a7b7c2014-10-07 00:10:17 -07004127 queryset = NetworkSlice.objects.select_related().all()
4128 serializer_class = NetworkSliceSerializer
4129 id_serializer_class = NetworkSliceIdSerializer
4130
4131 def get_serializer_class(self):
Scott Baker84cf39e2015-01-30 15:41:39 -08004132 no_hyperlinks=False
4133 if hasattr(self.request,"QUERY_PARAMS"):
4134 no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
Scott Baker89a7b7c2014-10-07 00:10:17 -07004135 if (no_hyperlinks):
4136 return self.id_serializer_class
4137 else:
4138 return self.serializer_class
Scott Baker84cf39e2015-01-30 15:41:39 -08004139
Scott Baker89a7b7c2014-10-07 00:10:17 -07004140 def get_queryset(self):
Scott Baker20101af2015-02-02 10:41:12 -08004141 if (not self.request.user.is_authenticated()):
Scott Baker4af864e2015-02-02 13:53:46 -08004142 raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API")
Scott Baker89a7b7c2014-10-07 00:10:17 -07004143 return NetworkSlice.select_by_user(self.request.user)
4144
Scott Baker72758c72015-02-10 19:26:35 -08004145 # update() is handled by XOSRetrieveUpdateDestroyAPIView
Scott Baker89a7b7c2014-10-07 00:10:17 -07004146
Scott Baker72758c72015-02-10 19:26:35 -08004147 # destroy() is handled by XOSRetrieveUpdateDestroyAPIView
Scott Baker89a7b7c2014-10-07 00:10:17 -07004148
4149
4150
Scott Baker72758c72015-02-10 19:26:35 -08004151class UserDashboardViewList(XOSListCreateAPIView):
Scott Baker89a7b7c2014-10-07 00:10:17 -07004152 queryset = UserDashboardView.objects.select_related().all()
4153 serializer_class = UserDashboardViewSerializer
4154 id_serializer_class = UserDashboardViewIdSerializer
4155 filter_backends = (filters.DjangoFilterBackend,)
Scott Baker84cf39e2015-01-30 15:41:39 -08004156 filter_fields = ('id','created','updated','enacted','policed','backend_register','backend_status','deleted','user','dashboardView','order',)
Scott Baker89a7b7c2014-10-07 00:10:17 -07004157
4158 def get_serializer_class(self):
Scott Baker84cf39e2015-01-30 15:41:39 -08004159 no_hyperlinks=False
4160 if hasattr(self.request,"QUERY_PARAMS"):
4161 no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
Scott Baker89a7b7c2014-10-07 00:10:17 -07004162 if (no_hyperlinks):
4163 return self.id_serializer_class
4164 else:
4165 return self.serializer_class
4166
4167 def get_queryset(self):
Scott Baker20101af2015-02-02 10:41:12 -08004168 if (not self.request.user.is_authenticated()):
Scott Baker4af864e2015-02-02 13:53:46 -08004169 raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API")
Scott Baker89a7b7c2014-10-07 00:10:17 -07004170 return UserDashboardView.select_by_user(self.request.user)
4171
Scott Baker89a7b7c2014-10-07 00:10:17 -07004172
Scott Baker72758c72015-02-10 19:26:35 -08004173class UserDashboardViewDetail(XOSRetrieveUpdateDestroyAPIView):
Scott Baker89a7b7c2014-10-07 00:10:17 -07004174 queryset = UserDashboardView.objects.select_related().all()
4175 serializer_class = UserDashboardViewSerializer
4176 id_serializer_class = UserDashboardViewIdSerializer
4177
4178 def get_serializer_class(self):
Scott Baker84cf39e2015-01-30 15:41:39 -08004179 no_hyperlinks=False
4180 if hasattr(self.request,"QUERY_PARAMS"):
4181 no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
Scott Baker89a7b7c2014-10-07 00:10:17 -07004182 if (no_hyperlinks):
4183 return self.id_serializer_class
4184 else:
4185 return self.serializer_class
Scott Baker84cf39e2015-01-30 15:41:39 -08004186
Scott Baker89a7b7c2014-10-07 00:10:17 -07004187 def get_queryset(self):
Scott Baker20101af2015-02-02 10:41:12 -08004188 if (not self.request.user.is_authenticated()):
Scott Baker4af864e2015-02-02 13:53:46 -08004189 raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API")
Scott Baker89a7b7c2014-10-07 00:10:17 -07004190 return UserDashboardView.select_by_user(self.request.user)
4191
Scott Baker72758c72015-02-10 19:26:35 -08004192 # update() is handled by XOSRetrieveUpdateDestroyAPIView
Scott Baker89a7b7c2014-10-07 00:10:17 -07004193
Scott Baker72758c72015-02-10 19:26:35 -08004194 # destroy() is handled by XOSRetrieveUpdateDestroyAPIView
Scott Baker89a7b7c2014-10-07 00:10:17 -07004195
4196
4197
Scott Baker72758c72015-02-10 19:26:35 -08004198class ControllerList(XOSListCreateAPIView):
Scott Baker515dc9e2014-12-22 09:29:05 -08004199 queryset = Controller.objects.select_related().all()
4200 serializer_class = ControllerSerializer
4201 id_serializer_class = ControllerIdSerializer
4202 filter_backends = (filters.DjangoFilterBackend,)
Scott Baker84cf39e2015-01-30 15:41:39 -08004203 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 Baker515dc9e2014-12-22 09:29:05 -08004204
4205 def get_serializer_class(self):
Scott Baker84cf39e2015-01-30 15:41:39 -08004206 no_hyperlinks=False
4207 if hasattr(self.request,"QUERY_PARAMS"):
4208 no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
Scott Baker515dc9e2014-12-22 09:29:05 -08004209 if (no_hyperlinks):
4210 return self.id_serializer_class
4211 else:
4212 return self.serializer_class
4213
4214 def get_queryset(self):
Scott Baker20101af2015-02-02 10:41:12 -08004215 if (not self.request.user.is_authenticated()):
Scott Baker4af864e2015-02-02 13:53:46 -08004216 raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API")
Scott Baker515dc9e2014-12-22 09:29:05 -08004217 return Controller.select_by_user(self.request.user)
4218
Scott Baker515dc9e2014-12-22 09:29:05 -08004219
Scott Baker72758c72015-02-10 19:26:35 -08004220class ControllerDetail(XOSRetrieveUpdateDestroyAPIView):
Scott Baker515dc9e2014-12-22 09:29:05 -08004221 queryset = Controller.objects.select_related().all()
4222 serializer_class = ControllerSerializer
4223 id_serializer_class = ControllerIdSerializer
4224
4225 def get_serializer_class(self):
Scott Baker84cf39e2015-01-30 15:41:39 -08004226 no_hyperlinks=False
4227 if hasattr(self.request,"QUERY_PARAMS"):
4228 no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
Scott Baker515dc9e2014-12-22 09:29:05 -08004229 if (no_hyperlinks):
4230 return self.id_serializer_class
4231 else:
4232 return self.serializer_class
Scott Baker84cf39e2015-01-30 15:41:39 -08004233
Scott Baker515dc9e2014-12-22 09:29:05 -08004234 def get_queryset(self):
Scott Baker20101af2015-02-02 10:41:12 -08004235 if (not self.request.user.is_authenticated()):
Scott Baker4af864e2015-02-02 13:53:46 -08004236 raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API")
Scott Baker515dc9e2014-12-22 09:29:05 -08004237 return Controller.select_by_user(self.request.user)
4238
Scott Baker72758c72015-02-10 19:26:35 -08004239 # update() is handled by XOSRetrieveUpdateDestroyAPIView
Scott Baker515dc9e2014-12-22 09:29:05 -08004240
Scott Baker72758c72015-02-10 19:26:35 -08004241 # destroy() is handled by XOSRetrieveUpdateDestroyAPIView
Scott Baker515dc9e2014-12-22 09:29:05 -08004242
4243
4244
Scott Baker72758c72015-02-10 19:26:35 -08004245class PlanetStackPrivilegeList(XOSListCreateAPIView):
Scott Baker89a7b7c2014-10-07 00:10:17 -07004246 queryset = PlanetStackPrivilege.objects.select_related().all()
4247 serializer_class = PlanetStackPrivilegeSerializer
4248 id_serializer_class = PlanetStackPrivilegeIdSerializer
4249 filter_backends = (filters.DjangoFilterBackend,)
Scott Baker84cf39e2015-01-30 15:41:39 -08004250 filter_fields = ('id','created','updated','enacted','policed','backend_register','backend_status','deleted','user','planetstack','role',)
Scott Baker89a7b7c2014-10-07 00:10:17 -07004251
4252 def get_serializer_class(self):
Scott Baker84cf39e2015-01-30 15:41:39 -08004253 no_hyperlinks=False
4254 if hasattr(self.request,"QUERY_PARAMS"):
4255 no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
Scott Baker89a7b7c2014-10-07 00:10:17 -07004256 if (no_hyperlinks):
4257 return self.id_serializer_class
4258 else:
4259 return self.serializer_class
4260
4261 def get_queryset(self):
Scott Baker20101af2015-02-02 10:41:12 -08004262 if (not self.request.user.is_authenticated()):
Scott Baker4af864e2015-02-02 13:53:46 -08004263 raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API")
Scott Baker89a7b7c2014-10-07 00:10:17 -07004264 return PlanetStackPrivilege.select_by_user(self.request.user)
4265
Scott Baker89a7b7c2014-10-07 00:10:17 -07004266
Scott Baker72758c72015-02-10 19:26:35 -08004267class PlanetStackPrivilegeDetail(XOSRetrieveUpdateDestroyAPIView):
Scott Baker89a7b7c2014-10-07 00:10:17 -07004268 queryset = PlanetStackPrivilege.objects.select_related().all()
4269 serializer_class = PlanetStackPrivilegeSerializer
4270 id_serializer_class = PlanetStackPrivilegeIdSerializer
4271
4272 def get_serializer_class(self):
Scott Baker84cf39e2015-01-30 15:41:39 -08004273 no_hyperlinks=False
4274 if hasattr(self.request,"QUERY_PARAMS"):
4275 no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
Scott Baker89a7b7c2014-10-07 00:10:17 -07004276 if (no_hyperlinks):
4277 return self.id_serializer_class
4278 else:
4279 return self.serializer_class
Scott Baker84cf39e2015-01-30 15:41:39 -08004280
Scott Baker89a7b7c2014-10-07 00:10:17 -07004281 def get_queryset(self):
Scott Baker20101af2015-02-02 10:41:12 -08004282 if (not self.request.user.is_authenticated()):
Scott Baker4af864e2015-02-02 13:53:46 -08004283 raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API")
Scott Baker89a7b7c2014-10-07 00:10:17 -07004284 return PlanetStackPrivilege.select_by_user(self.request.user)
4285
Scott Baker72758c72015-02-10 19:26:35 -08004286 # update() is handled by XOSRetrieveUpdateDestroyAPIView
Scott Baker89a7b7c2014-10-07 00:10:17 -07004287
Scott Baker72758c72015-02-10 19:26:35 -08004288 # destroy() is handled by XOSRetrieveUpdateDestroyAPIView
Scott Baker89a7b7c2014-10-07 00:10:17 -07004289
4290
4291
Scott Baker72758c72015-02-10 19:26:35 -08004292class UserList(XOSListCreateAPIView):
Scott Baker89a7b7c2014-10-07 00:10:17 -07004293 queryset = User.objects.select_related().all()
4294 serializer_class = UserSerializer
4295 id_serializer_class = UserIdSerializer
4296 filter_backends = (filters.DjangoFilterBackend,)
Scott Baker84cf39e2015-01-30 15:41:39 -08004297 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 Baker89a7b7c2014-10-07 00:10:17 -07004298
4299 def get_serializer_class(self):
Scott Baker84cf39e2015-01-30 15:41:39 -08004300 no_hyperlinks=False
4301 if hasattr(self.request,"QUERY_PARAMS"):
4302 no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
Scott Baker89a7b7c2014-10-07 00:10:17 -07004303 if (no_hyperlinks):
4304 return self.id_serializer_class
4305 else:
4306 return self.serializer_class
4307
4308 def get_queryset(self):
Scott Baker20101af2015-02-02 10:41:12 -08004309 if (not self.request.user.is_authenticated()):
Scott Baker4af864e2015-02-02 13:53:46 -08004310 raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API")
Scott Baker89a7b7c2014-10-07 00:10:17 -07004311 return User.select_by_user(self.request.user)
4312
Scott Baker89a7b7c2014-10-07 00:10:17 -07004313
Scott Baker72758c72015-02-10 19:26:35 -08004314class UserDetail(XOSRetrieveUpdateDestroyAPIView):
Scott Baker89a7b7c2014-10-07 00:10:17 -07004315 queryset = User.objects.select_related().all()
4316 serializer_class = UserSerializer
4317 id_serializer_class = UserIdSerializer
4318
4319 def get_serializer_class(self):
Scott Baker84cf39e2015-01-30 15:41:39 -08004320 no_hyperlinks=False
4321 if hasattr(self.request,"QUERY_PARAMS"):
4322 no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
Scott Baker89a7b7c2014-10-07 00:10:17 -07004323 if (no_hyperlinks):
4324 return self.id_serializer_class
4325 else:
4326 return self.serializer_class
Scott Baker84cf39e2015-01-30 15:41:39 -08004327
Scott Baker89a7b7c2014-10-07 00:10:17 -07004328 def get_queryset(self):
Scott Baker20101af2015-02-02 10:41:12 -08004329 if (not self.request.user.is_authenticated()):
Scott Baker4af864e2015-02-02 13:53:46 -08004330 raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API")
Scott Baker89a7b7c2014-10-07 00:10:17 -07004331 return User.select_by_user(self.request.user)
4332
Scott Baker72758c72015-02-10 19:26:35 -08004333 # update() is handled by XOSRetrieveUpdateDestroyAPIView
Scott Baker89a7b7c2014-10-07 00:10:17 -07004334
Scott Baker72758c72015-02-10 19:26:35 -08004335 # destroy() is handled by XOSRetrieveUpdateDestroyAPIView
Scott Baker89a7b7c2014-10-07 00:10:17 -07004336
4337
4338
Scott Baker72758c72015-02-10 19:26:35 -08004339class DeploymentList(XOSListCreateAPIView):
Scott Baker89a7b7c2014-10-07 00:10:17 -07004340 queryset = Deployment.objects.select_related().all()
4341 serializer_class = DeploymentSerializer
4342 id_serializer_class = DeploymentIdSerializer
4343 filter_backends = (filters.DjangoFilterBackend,)
Scott Baker84cf39e2015-01-30 15:41:39 -08004344 filter_fields = ('id','created','updated','enacted','policed','backend_register','backend_status','deleted','name','accessControl','images','sites','flavors',)
Scott Baker89a7b7c2014-10-07 00:10:17 -07004345
4346 def get_serializer_class(self):
Scott Baker84cf39e2015-01-30 15:41:39 -08004347 no_hyperlinks=False
4348 if hasattr(self.request,"QUERY_PARAMS"):
4349 no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
Scott Baker89a7b7c2014-10-07 00:10:17 -07004350 if (no_hyperlinks):
4351 return self.id_serializer_class
4352 else:
4353 return self.serializer_class
4354
4355 def get_queryset(self):
Scott Baker20101af2015-02-02 10:41:12 -08004356 if (not self.request.user.is_authenticated()):
Scott Baker4af864e2015-02-02 13:53:46 -08004357 raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API")
Scott Baker89a7b7c2014-10-07 00:10:17 -07004358 return Deployment.select_by_user(self.request.user)
4359
Scott Baker89a7b7c2014-10-07 00:10:17 -07004360
Scott Baker72758c72015-02-10 19:26:35 -08004361class DeploymentDetail(XOSRetrieveUpdateDestroyAPIView):
Scott Baker89a7b7c2014-10-07 00:10:17 -07004362 queryset = Deployment.objects.select_related().all()
4363 serializer_class = DeploymentSerializer
4364 id_serializer_class = DeploymentIdSerializer
4365
4366 def get_serializer_class(self):
Scott Baker84cf39e2015-01-30 15:41:39 -08004367 no_hyperlinks=False
4368 if hasattr(self.request,"QUERY_PARAMS"):
4369 no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
Scott Baker89a7b7c2014-10-07 00:10:17 -07004370 if (no_hyperlinks):
4371 return self.id_serializer_class
4372 else:
4373 return self.serializer_class
Scott Baker84cf39e2015-01-30 15:41:39 -08004374
Scott Baker89a7b7c2014-10-07 00:10:17 -07004375 def get_queryset(self):
Scott Baker20101af2015-02-02 10:41:12 -08004376 if (not self.request.user.is_authenticated()):
Scott Baker4af864e2015-02-02 13:53:46 -08004377 raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API")
Scott Baker89a7b7c2014-10-07 00:10:17 -07004378 return Deployment.select_by_user(self.request.user)
4379
Scott Baker72758c72015-02-10 19:26:35 -08004380 # update() is handled by XOSRetrieveUpdateDestroyAPIView
Scott Baker89a7b7c2014-10-07 00:10:17 -07004381
Scott Baker72758c72015-02-10 19:26:35 -08004382 # destroy() is handled by XOSRetrieveUpdateDestroyAPIView
Scott Baker89a7b7c2014-10-07 00:10:17 -07004383
4384
4385
Scott Baker72758c72015-02-10 19:26:35 -08004386class ReservationList(XOSListCreateAPIView):
Scott Baker89a7b7c2014-10-07 00:10:17 -07004387 queryset = Reservation.objects.select_related().all()
4388 serializer_class = ReservationSerializer
4389 id_serializer_class = ReservationIdSerializer
4390 filter_backends = (filters.DjangoFilterBackend,)
Scott Baker84cf39e2015-01-30 15:41:39 -08004391 filter_fields = ('id','created','updated','enacted','policed','backend_register','backend_status','deleted','startTime','slice','duration',)
Scott Baker89a7b7c2014-10-07 00:10:17 -07004392
4393 def get_serializer_class(self):
Scott Baker84cf39e2015-01-30 15:41:39 -08004394 no_hyperlinks=False
4395 if hasattr(self.request,"QUERY_PARAMS"):
4396 no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
Scott Baker89a7b7c2014-10-07 00:10:17 -07004397 if (no_hyperlinks):
4398 return self.id_serializer_class
4399 else:
4400 return self.serializer_class
4401
4402 def get_queryset(self):
Scott Baker20101af2015-02-02 10:41:12 -08004403 if (not self.request.user.is_authenticated()):
Scott Baker4af864e2015-02-02 13:53:46 -08004404 raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API")
Scott Baker89a7b7c2014-10-07 00:10:17 -07004405 return Reservation.select_by_user(self.request.user)
4406
Scott Baker89a7b7c2014-10-07 00:10:17 -07004407
Scott Baker72758c72015-02-10 19:26:35 -08004408class ReservationDetail(XOSRetrieveUpdateDestroyAPIView):
Scott Baker89a7b7c2014-10-07 00:10:17 -07004409 queryset = Reservation.objects.select_related().all()
4410 serializer_class = ReservationSerializer
4411 id_serializer_class = ReservationIdSerializer
4412
4413 def get_serializer_class(self):
Scott Baker84cf39e2015-01-30 15:41:39 -08004414 no_hyperlinks=False
4415 if hasattr(self.request,"QUERY_PARAMS"):
4416 no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
Scott Baker89a7b7c2014-10-07 00:10:17 -07004417 if (no_hyperlinks):
4418 return self.id_serializer_class
4419 else:
4420 return self.serializer_class
Scott Baker84cf39e2015-01-30 15:41:39 -08004421
Scott Baker89a7b7c2014-10-07 00:10:17 -07004422 def get_queryset(self):
Scott Baker20101af2015-02-02 10:41:12 -08004423 if (not self.request.user.is_authenticated()):
Scott Baker4af864e2015-02-02 13:53:46 -08004424 raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API")
Scott Baker89a7b7c2014-10-07 00:10:17 -07004425 return Reservation.select_by_user(self.request.user)
4426
Scott Baker72758c72015-02-10 19:26:35 -08004427 # update() is handled by XOSRetrieveUpdateDestroyAPIView
Scott Baker89a7b7c2014-10-07 00:10:17 -07004428
Scott Baker72758c72015-02-10 19:26:35 -08004429 # destroy() is handled by XOSRetrieveUpdateDestroyAPIView
Scott Baker89a7b7c2014-10-07 00:10:17 -07004430
Scott Baker89a7b7c2014-10-07 00:10:17 -07004431
Scott Baker57c725c2014-11-12 01:13:53 -08004432
Scott Baker72758c72015-02-10 19:26:35 -08004433class SitePrivilegeList(XOSListCreateAPIView):
Scott Baker89a7b7c2014-10-07 00:10:17 -07004434 queryset = SitePrivilege.objects.select_related().all()
4435 serializer_class = SitePrivilegeSerializer
4436 id_serializer_class = SitePrivilegeIdSerializer
4437 filter_backends = (filters.DjangoFilterBackend,)
Scott Baker84cf39e2015-01-30 15:41:39 -08004438 filter_fields = ('id','created','updated','enacted','policed','backend_register','backend_status','deleted','user','site','role',)
Scott Baker89a7b7c2014-10-07 00:10:17 -07004439
4440 def get_serializer_class(self):
Scott Baker84cf39e2015-01-30 15:41:39 -08004441 no_hyperlinks=False
4442 if hasattr(self.request,"QUERY_PARAMS"):
4443 no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
Scott Baker89a7b7c2014-10-07 00:10:17 -07004444 if (no_hyperlinks):
4445 return self.id_serializer_class
4446 else:
4447 return self.serializer_class
4448
4449 def get_queryset(self):
Scott Baker20101af2015-02-02 10:41:12 -08004450 if (not self.request.user.is_authenticated()):
Scott Baker4af864e2015-02-02 13:53:46 -08004451 raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API")
Scott Baker89a7b7c2014-10-07 00:10:17 -07004452 return SitePrivilege.select_by_user(self.request.user)
4453
Scott Baker89a7b7c2014-10-07 00:10:17 -07004454
Scott Baker72758c72015-02-10 19:26:35 -08004455class SitePrivilegeDetail(XOSRetrieveUpdateDestroyAPIView):
Scott Baker89a7b7c2014-10-07 00:10:17 -07004456 queryset = SitePrivilege.objects.select_related().all()
4457 serializer_class = SitePrivilegeSerializer
4458 id_serializer_class = SitePrivilegeIdSerializer
4459
4460 def get_serializer_class(self):
Scott Baker84cf39e2015-01-30 15:41:39 -08004461 no_hyperlinks=False
4462 if hasattr(self.request,"QUERY_PARAMS"):
4463 no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
Scott Baker89a7b7c2014-10-07 00:10:17 -07004464 if (no_hyperlinks):
4465 return self.id_serializer_class
4466 else:
4467 return self.serializer_class
Scott Baker84cf39e2015-01-30 15:41:39 -08004468
Scott Baker89a7b7c2014-10-07 00:10:17 -07004469 def get_queryset(self):
Scott Baker20101af2015-02-02 10:41:12 -08004470 if (not self.request.user.is_authenticated()):
Scott Baker4af864e2015-02-02 13:53:46 -08004471 raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API")
Scott Baker89a7b7c2014-10-07 00:10:17 -07004472 return SitePrivilege.select_by_user(self.request.user)
4473
Scott Baker72758c72015-02-10 19:26:35 -08004474 # update() is handled by XOSRetrieveUpdateDestroyAPIView
Scott Baker89a7b7c2014-10-07 00:10:17 -07004475
Scott Baker72758c72015-02-10 19:26:35 -08004476 # destroy() is handled by XOSRetrieveUpdateDestroyAPIView
Scott Baker89a7b7c2014-10-07 00:10:17 -07004477
4478
4479
Scott Baker72758c72015-02-10 19:26:35 -08004480class ControllerSliceList(XOSListCreateAPIView):
Scott Baker191f9b22015-01-12 13:16:39 -08004481 queryset = ControllerSlice.objects.select_related().all()
4482 serializer_class = ControllerSliceSerializer
4483 id_serializer_class = ControllerSliceIdSerializer
Scott Baker89a7b7c2014-10-07 00:10:17 -07004484 filter_backends = (filters.DjangoFilterBackend,)
Scott Baker84cf39e2015-01-30 15:41:39 -08004485 filter_fields = ('id','created','updated','enacted','policed','backend_register','backend_status','deleted','controller','slice','tenant_id',)
Scott Baker89a7b7c2014-10-07 00:10:17 -07004486
4487 def get_serializer_class(self):
Scott Baker84cf39e2015-01-30 15:41:39 -08004488 no_hyperlinks=False
4489 if hasattr(self.request,"QUERY_PARAMS"):
4490 no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
Scott Baker89a7b7c2014-10-07 00:10:17 -07004491 if (no_hyperlinks):
4492 return self.id_serializer_class
4493 else:
4494 return self.serializer_class
4495
4496 def get_queryset(self):
Scott Baker20101af2015-02-02 10:41:12 -08004497 if (not self.request.user.is_authenticated()):
Scott Baker4af864e2015-02-02 13:53:46 -08004498 raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API")
Scott Baker191f9b22015-01-12 13:16:39 -08004499 return ControllerSlice.select_by_user(self.request.user)
Scott Baker89a7b7c2014-10-07 00:10:17 -07004500
Scott Baker89a7b7c2014-10-07 00:10:17 -07004501
Scott Baker72758c72015-02-10 19:26:35 -08004502class ControllerSliceDetail(XOSRetrieveUpdateDestroyAPIView):
Scott Baker191f9b22015-01-12 13:16:39 -08004503 queryset = ControllerSlice.objects.select_related().all()
4504 serializer_class = ControllerSliceSerializer
4505 id_serializer_class = ControllerSliceIdSerializer
Scott Baker89a7b7c2014-10-07 00:10:17 -07004506
4507 def get_serializer_class(self):
Scott Baker84cf39e2015-01-30 15:41:39 -08004508 no_hyperlinks=False
4509 if hasattr(self.request,"QUERY_PARAMS"):
4510 no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
Scott Baker89a7b7c2014-10-07 00:10:17 -07004511 if (no_hyperlinks):
4512 return self.id_serializer_class
4513 else:
4514 return self.serializer_class
Scott Baker84cf39e2015-01-30 15:41:39 -08004515
Scott Baker89a7b7c2014-10-07 00:10:17 -07004516 def get_queryset(self):
Scott Baker20101af2015-02-02 10:41:12 -08004517 if (not self.request.user.is_authenticated()):
Scott Baker4af864e2015-02-02 13:53:46 -08004518 raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API")
Scott Baker191f9b22015-01-12 13:16:39 -08004519 return ControllerSlice.select_by_user(self.request.user)
Scott Baker89a7b7c2014-10-07 00:10:17 -07004520
Scott Baker72758c72015-02-10 19:26:35 -08004521 # update() is handled by XOSRetrieveUpdateDestroyAPIView
Scott Baker89a7b7c2014-10-07 00:10:17 -07004522
Scott Baker72758c72015-02-10 19:26:35 -08004523 # destroy() is handled by XOSRetrieveUpdateDestroyAPIView
Scott Baker89a7b7c2014-10-07 00:10:17 -07004524
Scott Baker89a7b7c2014-10-07 00:10:17 -07004525
Scott Baker57c725c2014-11-12 01:13:53 -08004526
Scott Baker72758c72015-02-10 19:26:35 -08004527class ControllerDashboardViewList(XOSListCreateAPIView):
Scott Bakerf2c0c512014-12-22 17:35:34 -08004528 queryset = ControllerDashboardView.objects.select_related().all()
4529 serializer_class = ControllerDashboardViewSerializer
4530 id_serializer_class = ControllerDashboardViewIdSerializer
4531 filter_backends = (filters.DjangoFilterBackend,)
Scott Baker84cf39e2015-01-30 15:41:39 -08004532 filter_fields = ('id','created','updated','enacted','policed','backend_register','backend_status','deleted','controller','dashboardView','enabled','url',)
Scott Bakerf2c0c512014-12-22 17:35:34 -08004533
4534 def get_serializer_class(self):
Scott Baker84cf39e2015-01-30 15:41:39 -08004535 no_hyperlinks=False
4536 if hasattr(self.request,"QUERY_PARAMS"):
4537 no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
Scott Bakerf2c0c512014-12-22 17:35:34 -08004538 if (no_hyperlinks):
4539 return self.id_serializer_class
4540 else:
4541 return self.serializer_class
4542
4543 def get_queryset(self):
Scott Baker20101af2015-02-02 10:41:12 -08004544 if (not self.request.user.is_authenticated()):
Scott Baker4af864e2015-02-02 13:53:46 -08004545 raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API")
Scott Bakerf2c0c512014-12-22 17:35:34 -08004546 return ControllerDashboardView.select_by_user(self.request.user)
4547
Scott Bakerf2c0c512014-12-22 17:35:34 -08004548
Scott Baker72758c72015-02-10 19:26:35 -08004549class ControllerDashboardViewDetail(XOSRetrieveUpdateDestroyAPIView):
Scott Bakerf2c0c512014-12-22 17:35:34 -08004550 queryset = ControllerDashboardView.objects.select_related().all()
4551 serializer_class = ControllerDashboardViewSerializer
4552 id_serializer_class = ControllerDashboardViewIdSerializer
4553
4554 def get_serializer_class(self):
Scott Baker84cf39e2015-01-30 15:41:39 -08004555 no_hyperlinks=False
4556 if hasattr(self.request,"QUERY_PARAMS"):
4557 no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
Scott Bakerf2c0c512014-12-22 17:35:34 -08004558 if (no_hyperlinks):
4559 return self.id_serializer_class
4560 else:
4561 return self.serializer_class
Scott Baker84cf39e2015-01-30 15:41:39 -08004562
Scott Bakerf2c0c512014-12-22 17:35:34 -08004563 def get_queryset(self):
Scott Baker20101af2015-02-02 10:41:12 -08004564 if (not self.request.user.is_authenticated()):
Scott Baker4af864e2015-02-02 13:53:46 -08004565 raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API")
Scott Bakerf2c0c512014-12-22 17:35:34 -08004566 return ControllerDashboardView.select_by_user(self.request.user)
4567
Scott Baker72758c72015-02-10 19:26:35 -08004568 # update() is handled by XOSRetrieveUpdateDestroyAPIView
Scott Bakerf2c0c512014-12-22 17:35:34 -08004569
Scott Baker72758c72015-02-10 19:26:35 -08004570 # destroy() is handled by XOSRetrieveUpdateDestroyAPIView
Scott Bakerf2c0c512014-12-22 17:35:34 -08004571
4572
4573
Scott Baker72758c72015-02-10 19:26:35 -08004574class AccountList(XOSListCreateAPIView):
Scott Baker89a7b7c2014-10-07 00:10:17 -07004575 queryset = Account.objects.select_related().all()
4576 serializer_class = AccountSerializer
4577 id_serializer_class = AccountIdSerializer
4578 filter_backends = (filters.DjangoFilterBackend,)
Scott Baker84cf39e2015-01-30 15:41:39 -08004579 filter_fields = ('id','created','updated','enacted','policed','backend_register','backend_status','deleted','site',)
Scott Baker89a7b7c2014-10-07 00:10:17 -07004580
4581 def get_serializer_class(self):
Scott Baker84cf39e2015-01-30 15:41:39 -08004582 no_hyperlinks=False
4583 if hasattr(self.request,"QUERY_PARAMS"):
4584 no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
Scott Baker89a7b7c2014-10-07 00:10:17 -07004585 if (no_hyperlinks):
4586 return self.id_serializer_class
4587 else:
4588 return self.serializer_class
4589
4590 def get_queryset(self):
Scott Baker20101af2015-02-02 10:41:12 -08004591 if (not self.request.user.is_authenticated()):
Scott Baker4af864e2015-02-02 13:53:46 -08004592 raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API")
Scott Baker89a7b7c2014-10-07 00:10:17 -07004593 return Account.select_by_user(self.request.user)
4594
Scott Baker89a7b7c2014-10-07 00:10:17 -07004595
Scott Baker72758c72015-02-10 19:26:35 -08004596class AccountDetail(XOSRetrieveUpdateDestroyAPIView):
Scott Baker89a7b7c2014-10-07 00:10:17 -07004597 queryset = Account.objects.select_related().all()
4598 serializer_class = AccountSerializer
4599 id_serializer_class = AccountIdSerializer
4600
4601 def get_serializer_class(self):
Scott Baker84cf39e2015-01-30 15:41:39 -08004602 no_hyperlinks=False
4603 if hasattr(self.request,"QUERY_PARAMS"):
4604 no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
Scott Baker89a7b7c2014-10-07 00:10:17 -07004605 if (no_hyperlinks):
4606 return self.id_serializer_class
4607 else:
4608 return self.serializer_class
Scott Baker84cf39e2015-01-30 15:41:39 -08004609
Scott Baker89a7b7c2014-10-07 00:10:17 -07004610 def get_queryset(self):
Scott Baker20101af2015-02-02 10:41:12 -08004611 if (not self.request.user.is_authenticated()):
Scott Baker4af864e2015-02-02 13:53:46 -08004612 raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API")
Scott Baker89a7b7c2014-10-07 00:10:17 -07004613 return Account.select_by_user(self.request.user)
4614
Scott Baker72758c72015-02-10 19:26:35 -08004615 # update() is handled by XOSRetrieveUpdateDestroyAPIView
Scott Baker89a7b7c2014-10-07 00:10:17 -07004616
Scott Baker72758c72015-02-10 19:26:35 -08004617 # destroy() is handled by XOSRetrieveUpdateDestroyAPIView
Scott Baker89a7b7c2014-10-07 00:10:17 -07004618
4619
4620
Scott Baker72758c72015-02-10 19:26:35 -08004621class ControllerRoleList(XOSListCreateAPIView):
Scott Baker515dc9e2014-12-22 09:29:05 -08004622 queryset = ControllerRole.objects.select_related().all()
4623 serializer_class = ControllerRoleSerializer
4624 id_serializer_class = ControllerRoleIdSerializer
4625 filter_backends = (filters.DjangoFilterBackend,)
Scott Baker84cf39e2015-01-30 15:41:39 -08004626 filter_fields = ('id','created','updated','enacted','policed','backend_register','backend_status','deleted','role',)
Scott Baker515dc9e2014-12-22 09:29:05 -08004627
4628 def get_serializer_class(self):
Scott Baker84cf39e2015-01-30 15:41:39 -08004629 no_hyperlinks=False
4630 if hasattr(self.request,"QUERY_PARAMS"):
4631 no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
Scott Baker515dc9e2014-12-22 09:29:05 -08004632 if (no_hyperlinks):
4633 return self.id_serializer_class
4634 else:
4635 return self.serializer_class
4636
4637 def get_queryset(self):
Scott Baker20101af2015-02-02 10:41:12 -08004638 if (not self.request.user.is_authenticated()):
Scott Baker4af864e2015-02-02 13:53:46 -08004639 raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API")
Scott Baker515dc9e2014-12-22 09:29:05 -08004640 return ControllerRole.select_by_user(self.request.user)
4641
Scott Baker515dc9e2014-12-22 09:29:05 -08004642
Scott Baker72758c72015-02-10 19:26:35 -08004643class ControllerRoleDetail(XOSRetrieveUpdateDestroyAPIView):
Scott Baker515dc9e2014-12-22 09:29:05 -08004644 queryset = ControllerRole.objects.select_related().all()
4645 serializer_class = ControllerRoleSerializer
4646 id_serializer_class = ControllerRoleIdSerializer
4647
4648 def get_serializer_class(self):
Scott Baker84cf39e2015-01-30 15:41:39 -08004649 no_hyperlinks=False
4650 if hasattr(self.request,"QUERY_PARAMS"):
4651 no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
Scott Baker515dc9e2014-12-22 09:29:05 -08004652 if (no_hyperlinks):
4653 return self.id_serializer_class
4654 else:
4655 return self.serializer_class
Scott Baker84cf39e2015-01-30 15:41:39 -08004656
Scott Baker515dc9e2014-12-22 09:29:05 -08004657 def get_queryset(self):
Scott Baker20101af2015-02-02 10:41:12 -08004658 if (not self.request.user.is_authenticated()):
Scott Baker4af864e2015-02-02 13:53:46 -08004659 raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API")
Scott Baker515dc9e2014-12-22 09:29:05 -08004660 return ControllerRole.select_by_user(self.request.user)
4661
Scott Baker72758c72015-02-10 19:26:35 -08004662 # update() is handled by XOSRetrieveUpdateDestroyAPIView
Scott Baker515dc9e2014-12-22 09:29:05 -08004663
Scott Baker72758c72015-02-10 19:26:35 -08004664 # destroy() is handled by XOSRetrieveUpdateDestroyAPIView
Scott Baker515dc9e2014-12-22 09:29:05 -08004665
4666
4667
Scott Baker72758c72015-02-10 19:26:35 -08004668class NetworkParameterTypeList(XOSListCreateAPIView):
Scott Baker89a7b7c2014-10-07 00:10:17 -07004669 queryset = NetworkParameterType.objects.select_related().all()
4670 serializer_class = NetworkParameterTypeSerializer
4671 id_serializer_class = NetworkParameterTypeIdSerializer
4672 filter_backends = (filters.DjangoFilterBackend,)
Scott Baker84cf39e2015-01-30 15:41:39 -08004673 filter_fields = ('id','created','updated','enacted','policed','backend_register','backend_status','deleted','name','description',)
Scott Baker89a7b7c2014-10-07 00:10:17 -07004674
4675 def get_serializer_class(self):
Scott Baker84cf39e2015-01-30 15:41:39 -08004676 no_hyperlinks=False
4677 if hasattr(self.request,"QUERY_PARAMS"):
4678 no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
Scott Baker89a7b7c2014-10-07 00:10:17 -07004679 if (no_hyperlinks):
4680 return self.id_serializer_class
4681 else:
4682 return self.serializer_class
4683
4684 def get_queryset(self):
Scott Baker20101af2015-02-02 10:41:12 -08004685 if (not self.request.user.is_authenticated()):
Scott Baker4af864e2015-02-02 13:53:46 -08004686 raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API")
Scott Baker89a7b7c2014-10-07 00:10:17 -07004687 return NetworkParameterType.select_by_user(self.request.user)
4688
Scott Baker89a7b7c2014-10-07 00:10:17 -07004689
Scott Baker72758c72015-02-10 19:26:35 -08004690class NetworkParameterTypeDetail(XOSRetrieveUpdateDestroyAPIView):
Scott Baker89a7b7c2014-10-07 00:10:17 -07004691 queryset = NetworkParameterType.objects.select_related().all()
4692 serializer_class = NetworkParameterTypeSerializer
4693 id_serializer_class = NetworkParameterTypeIdSerializer
4694
4695 def get_serializer_class(self):
Scott Baker84cf39e2015-01-30 15:41:39 -08004696 no_hyperlinks=False
4697 if hasattr(self.request,"QUERY_PARAMS"):
4698 no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
Scott Baker89a7b7c2014-10-07 00:10:17 -07004699 if (no_hyperlinks):
4700 return self.id_serializer_class
4701 else:
4702 return self.serializer_class
Scott Baker84cf39e2015-01-30 15:41:39 -08004703
Scott Baker89a7b7c2014-10-07 00:10:17 -07004704 def get_queryset(self):
Scott Baker20101af2015-02-02 10:41:12 -08004705 if (not self.request.user.is_authenticated()):
Scott Baker4af864e2015-02-02 13:53:46 -08004706 raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API")
Scott Baker89a7b7c2014-10-07 00:10:17 -07004707 return NetworkParameterType.select_by_user(self.request.user)
4708
Scott Baker72758c72015-02-10 19:26:35 -08004709 # update() is handled by XOSRetrieveUpdateDestroyAPIView
Scott Baker89a7b7c2014-10-07 00:10:17 -07004710
Scott Baker72758c72015-02-10 19:26:35 -08004711 # destroy() is handled by XOSRetrieveUpdateDestroyAPIView
Scott Baker89a7b7c2014-10-07 00:10:17 -07004712
4713
4714
Scott Baker72758c72015-02-10 19:26:35 -08004715class SiteCredentialList(XOSListCreateAPIView):
Scott Baker89a7b7c2014-10-07 00:10:17 -07004716 queryset = SiteCredential.objects.select_related().all()
4717 serializer_class = SiteCredentialSerializer
4718 id_serializer_class = SiteCredentialIdSerializer
4719 filter_backends = (filters.DjangoFilterBackend,)
Scott Baker84cf39e2015-01-30 15:41:39 -08004720 filter_fields = ('id','created','updated','enacted','policed','backend_register','backend_status','deleted','site','name','key_id','enc_value',)
Scott Baker89a7b7c2014-10-07 00:10:17 -07004721
4722 def get_serializer_class(self):
Scott Baker84cf39e2015-01-30 15:41:39 -08004723 no_hyperlinks=False
4724 if hasattr(self.request,"QUERY_PARAMS"):
4725 no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
Scott Baker89a7b7c2014-10-07 00:10:17 -07004726 if (no_hyperlinks):
4727 return self.id_serializer_class
4728 else:
4729 return self.serializer_class
4730
4731 def get_queryset(self):
Scott Baker20101af2015-02-02 10:41:12 -08004732 if (not self.request.user.is_authenticated()):
Scott Baker4af864e2015-02-02 13:53:46 -08004733 raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API")
Scott Baker89a7b7c2014-10-07 00:10:17 -07004734 return SiteCredential.select_by_user(self.request.user)
4735
Scott Baker89a7b7c2014-10-07 00:10:17 -07004736
Scott Baker72758c72015-02-10 19:26:35 -08004737class SiteCredentialDetail(XOSRetrieveUpdateDestroyAPIView):
Scott Baker89a7b7c2014-10-07 00:10:17 -07004738 queryset = SiteCredential.objects.select_related().all()
4739 serializer_class = SiteCredentialSerializer
4740 id_serializer_class = SiteCredentialIdSerializer
4741
4742 def get_serializer_class(self):
Scott Baker84cf39e2015-01-30 15:41:39 -08004743 no_hyperlinks=False
4744 if hasattr(self.request,"QUERY_PARAMS"):
4745 no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
Scott Baker89a7b7c2014-10-07 00:10:17 -07004746 if (no_hyperlinks):
4747 return self.id_serializer_class
4748 else:
4749 return self.serializer_class
Scott Baker84cf39e2015-01-30 15:41:39 -08004750
Scott Baker89a7b7c2014-10-07 00:10:17 -07004751 def get_queryset(self):
Scott Baker20101af2015-02-02 10:41:12 -08004752 if (not self.request.user.is_authenticated()):
Scott Baker4af864e2015-02-02 13:53:46 -08004753 raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API")
Scott Baker89a7b7c2014-10-07 00:10:17 -07004754 return SiteCredential.select_by_user(self.request.user)
4755
Scott Baker72758c72015-02-10 19:26:35 -08004756 # update() is handled by XOSRetrieveUpdateDestroyAPIView
Scott Baker89a7b7c2014-10-07 00:10:17 -07004757
Scott Baker72758c72015-02-10 19:26:35 -08004758 # destroy() is handled by XOSRetrieveUpdateDestroyAPIView
Scott Baker89a7b7c2014-10-07 00:10:17 -07004759
4760
4761
Scott Baker72758c72015-02-10 19:26:35 -08004762class DeploymentPrivilegeList(XOSListCreateAPIView):
Scott Baker515dc9e2014-12-22 09:29:05 -08004763 queryset = DeploymentPrivilege.objects.select_related().all()
4764 serializer_class = DeploymentPrivilegeSerializer
4765 id_serializer_class = DeploymentPrivilegeIdSerializer
Scott Baker89a7b7c2014-10-07 00:10:17 -07004766 filter_backends = (filters.DjangoFilterBackend,)
Scott Baker84cf39e2015-01-30 15:41:39 -08004767 filter_fields = ('id','created','updated','enacted','policed','backend_register','backend_status','deleted','user','deployment','role',)
Scott Baker89a7b7c2014-10-07 00:10:17 -07004768
4769 def get_serializer_class(self):
Scott Baker84cf39e2015-01-30 15:41:39 -08004770 no_hyperlinks=False
4771 if hasattr(self.request,"QUERY_PARAMS"):
4772 no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
Scott Baker89a7b7c2014-10-07 00:10:17 -07004773 if (no_hyperlinks):
4774 return self.id_serializer_class
4775 else:
4776 return self.serializer_class
4777
4778 def get_queryset(self):
Scott Baker20101af2015-02-02 10:41:12 -08004779 if (not self.request.user.is_authenticated()):
Scott Baker4af864e2015-02-02 13:53:46 -08004780 raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API")
Scott Baker515dc9e2014-12-22 09:29:05 -08004781 return DeploymentPrivilege.select_by_user(self.request.user)
Scott Baker89a7b7c2014-10-07 00:10:17 -07004782
Scott Baker89a7b7c2014-10-07 00:10:17 -07004783
Scott Baker72758c72015-02-10 19:26:35 -08004784class DeploymentPrivilegeDetail(XOSRetrieveUpdateDestroyAPIView):
Scott Baker515dc9e2014-12-22 09:29:05 -08004785 queryset = DeploymentPrivilege.objects.select_related().all()
4786 serializer_class = DeploymentPrivilegeSerializer
4787 id_serializer_class = DeploymentPrivilegeIdSerializer
Scott Baker89a7b7c2014-10-07 00:10:17 -07004788
4789 def get_serializer_class(self):
Scott Baker84cf39e2015-01-30 15:41:39 -08004790 no_hyperlinks=False
4791 if hasattr(self.request,"QUERY_PARAMS"):
4792 no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
Scott Baker89a7b7c2014-10-07 00:10:17 -07004793 if (no_hyperlinks):
4794 return self.id_serializer_class
4795 else:
4796 return self.serializer_class
Scott Baker84cf39e2015-01-30 15:41:39 -08004797
Scott Baker89a7b7c2014-10-07 00:10:17 -07004798 def get_queryset(self):
Scott Baker20101af2015-02-02 10:41:12 -08004799 if (not self.request.user.is_authenticated()):
Scott Baker4af864e2015-02-02 13:53:46 -08004800 raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API")
Scott Baker515dc9e2014-12-22 09:29:05 -08004801 return DeploymentPrivilege.select_by_user(self.request.user)
Scott Baker89a7b7c2014-10-07 00:10:17 -07004802
Scott Baker72758c72015-02-10 19:26:35 -08004803 # update() is handled by XOSRetrieveUpdateDestroyAPIView
Scott Baker89a7b7c2014-10-07 00:10:17 -07004804
Scott Baker72758c72015-02-10 19:26:35 -08004805 # destroy() is handled by XOSRetrieveUpdateDestroyAPIView
Scott Baker89a7b7c2014-10-07 00:10:17 -07004806
4807
4808
Scott Baker72758c72015-02-10 19:26:35 -08004809class ControllerSlicePrivilegeList(XOSListCreateAPIView):
Scott Baker191f9b22015-01-12 13:16:39 -08004810 queryset = ControllerSlicePrivilege.objects.select_related().all()
4811 serializer_class = ControllerSlicePrivilegeSerializer
4812 id_serializer_class = ControllerSlicePrivilegeIdSerializer
Scott Baker515dc9e2014-12-22 09:29:05 -08004813 filter_backends = (filters.DjangoFilterBackend,)
Scott Baker84cf39e2015-01-30 15:41:39 -08004814 filter_fields = ('id','created','updated','enacted','policed','backend_register','backend_status','deleted','controller','slice_privilege','role_id',)
Scott Baker515dc9e2014-12-22 09:29:05 -08004815
4816 def get_serializer_class(self):
Scott Baker84cf39e2015-01-30 15:41:39 -08004817 no_hyperlinks=False
4818 if hasattr(self.request,"QUERY_PARAMS"):
4819 no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
Scott Baker515dc9e2014-12-22 09:29:05 -08004820 if (no_hyperlinks):
4821 return self.id_serializer_class
4822 else:
4823 return self.serializer_class
4824
4825 def get_queryset(self):
Scott Baker20101af2015-02-02 10:41:12 -08004826 if (not self.request.user.is_authenticated()):
Scott Baker4af864e2015-02-02 13:53:46 -08004827 raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API")
Scott Baker191f9b22015-01-12 13:16:39 -08004828 return ControllerSlicePrivilege.select_by_user(self.request.user)
Scott Baker515dc9e2014-12-22 09:29:05 -08004829
Scott Baker515dc9e2014-12-22 09:29:05 -08004830
Scott Baker72758c72015-02-10 19:26:35 -08004831class ControllerSlicePrivilegeDetail(XOSRetrieveUpdateDestroyAPIView):
Scott Baker191f9b22015-01-12 13:16:39 -08004832 queryset = ControllerSlicePrivilege.objects.select_related().all()
4833 serializer_class = ControllerSlicePrivilegeSerializer
4834 id_serializer_class = ControllerSlicePrivilegeIdSerializer
Scott Baker515dc9e2014-12-22 09:29:05 -08004835
4836 def get_serializer_class(self):
Scott Baker84cf39e2015-01-30 15:41:39 -08004837 no_hyperlinks=False
4838 if hasattr(self.request,"QUERY_PARAMS"):
4839 no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
Scott Baker515dc9e2014-12-22 09:29:05 -08004840 if (no_hyperlinks):
4841 return self.id_serializer_class
4842 else:
4843 return self.serializer_class
Scott Baker84cf39e2015-01-30 15:41:39 -08004844
Scott Baker515dc9e2014-12-22 09:29:05 -08004845 def get_queryset(self):
Scott Baker20101af2015-02-02 10:41:12 -08004846 if (not self.request.user.is_authenticated()):
Scott Baker4af864e2015-02-02 13:53:46 -08004847 raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API")
Scott Baker191f9b22015-01-12 13:16:39 -08004848 return ControllerSlicePrivilege.select_by_user(self.request.user)
4849
Scott Baker72758c72015-02-10 19:26:35 -08004850 # update() is handled by XOSRetrieveUpdateDestroyAPIView
Scott Baker191f9b22015-01-12 13:16:39 -08004851
Scott Baker72758c72015-02-10 19:26:35 -08004852 # destroy() is handled by XOSRetrieveUpdateDestroyAPIView
Scott Baker191f9b22015-01-12 13:16:39 -08004853
4854
4855
Scott Baker72758c72015-02-10 19:26:35 -08004856class SiteDeploymentList(XOSListCreateAPIView):
Scott Baker191f9b22015-01-12 13:16:39 -08004857 queryset = SiteDeployment.objects.select_related().all()
4858 serializer_class = SiteDeploymentSerializer
4859 id_serializer_class = SiteDeploymentIdSerializer
4860 filter_backends = (filters.DjangoFilterBackend,)
Scott Baker84cf39e2015-01-30 15:41:39 -08004861 filter_fields = ('id','created','updated','enacted','policed','backend_register','backend_status','deleted','site','deployment','controller','availability_zone',)
Scott Baker191f9b22015-01-12 13:16:39 -08004862
4863 def get_serializer_class(self):
Scott Baker84cf39e2015-01-30 15:41:39 -08004864 no_hyperlinks=False
4865 if hasattr(self.request,"QUERY_PARAMS"):
4866 no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
Scott Baker191f9b22015-01-12 13:16:39 -08004867 if (no_hyperlinks):
4868 return self.id_serializer_class
4869 else:
4870 return self.serializer_class
4871
4872 def get_queryset(self):
Scott Baker20101af2015-02-02 10:41:12 -08004873 if (not self.request.user.is_authenticated()):
Scott Baker4af864e2015-02-02 13:53:46 -08004874 raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API")
Scott Baker191f9b22015-01-12 13:16:39 -08004875 return SiteDeployment.select_by_user(self.request.user)
4876
Scott Baker191f9b22015-01-12 13:16:39 -08004877
Scott Baker72758c72015-02-10 19:26:35 -08004878class SiteDeploymentDetail(XOSRetrieveUpdateDestroyAPIView):
Scott Baker191f9b22015-01-12 13:16:39 -08004879 queryset = SiteDeployment.objects.select_related().all()
4880 serializer_class = SiteDeploymentSerializer
4881 id_serializer_class = SiteDeploymentIdSerializer
4882
4883 def get_serializer_class(self):
Scott Baker84cf39e2015-01-30 15:41:39 -08004884 no_hyperlinks=False
4885 if hasattr(self.request,"QUERY_PARAMS"):
4886 no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
Scott Baker191f9b22015-01-12 13:16:39 -08004887 if (no_hyperlinks):
4888 return self.id_serializer_class
4889 else:
4890 return self.serializer_class
Scott Baker84cf39e2015-01-30 15:41:39 -08004891
Scott Baker191f9b22015-01-12 13:16:39 -08004892 def get_queryset(self):
Scott Baker20101af2015-02-02 10:41:12 -08004893 if (not self.request.user.is_authenticated()):
Scott Baker4af864e2015-02-02 13:53:46 -08004894 raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API")
Scott Baker191f9b22015-01-12 13:16:39 -08004895 return SiteDeployment.select_by_user(self.request.user)
Scott Baker515dc9e2014-12-22 09:29:05 -08004896
Scott Baker72758c72015-02-10 19:26:35 -08004897 # update() is handled by XOSRetrieveUpdateDestroyAPIView
Scott Baker515dc9e2014-12-22 09:29:05 -08004898
Scott Baker72758c72015-02-10 19:26:35 -08004899 # destroy() is handled by XOSRetrieveUpdateDestroyAPIView
Scott Baker515dc9e2014-12-22 09:29:05 -08004900
4901
4902
Scott Baker72758c72015-02-10 19:26:35 -08004903class DeploymentRoleList(XOSListCreateAPIView):
Scott Baker515dc9e2014-12-22 09:29:05 -08004904 queryset = DeploymentRole.objects.select_related().all()
4905 serializer_class = DeploymentRoleSerializer
4906 id_serializer_class = DeploymentRoleIdSerializer
Scott Baker89a7b7c2014-10-07 00:10:17 -07004907 filter_backends = (filters.DjangoFilterBackend,)
Scott Baker84cf39e2015-01-30 15:41:39 -08004908 filter_fields = ('id','created','updated','enacted','policed','backend_register','backend_status','deleted','role',)
Scott Baker89a7b7c2014-10-07 00:10:17 -07004909
4910 def get_serializer_class(self):
Scott Baker84cf39e2015-01-30 15:41:39 -08004911 no_hyperlinks=False
4912 if hasattr(self.request,"QUERY_PARAMS"):
4913 no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
Scott Baker89a7b7c2014-10-07 00:10:17 -07004914 if (no_hyperlinks):
4915 return self.id_serializer_class
4916 else:
4917 return self.serializer_class
4918
4919 def get_queryset(self):
Scott Baker20101af2015-02-02 10:41:12 -08004920 if (not self.request.user.is_authenticated()):
Scott Baker4af864e2015-02-02 13:53:46 -08004921 raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API")
Scott Baker515dc9e2014-12-22 09:29:05 -08004922 return DeploymentRole.select_by_user(self.request.user)
Scott Baker89a7b7c2014-10-07 00:10:17 -07004923
Scott Baker89a7b7c2014-10-07 00:10:17 -07004924
Scott Baker72758c72015-02-10 19:26:35 -08004925class DeploymentRoleDetail(XOSRetrieveUpdateDestroyAPIView):
Scott Baker515dc9e2014-12-22 09:29:05 -08004926 queryset = DeploymentRole.objects.select_related().all()
4927 serializer_class = DeploymentRoleSerializer
4928 id_serializer_class = DeploymentRoleIdSerializer
Scott Baker89a7b7c2014-10-07 00:10:17 -07004929
4930 def get_serializer_class(self):
Scott Baker84cf39e2015-01-30 15:41:39 -08004931 no_hyperlinks=False
4932 if hasattr(self.request,"QUERY_PARAMS"):
4933 no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
Scott Baker89a7b7c2014-10-07 00:10:17 -07004934 if (no_hyperlinks):
4935 return self.id_serializer_class
4936 else:
4937 return self.serializer_class
Scott Baker84cf39e2015-01-30 15:41:39 -08004938
Scott Baker89a7b7c2014-10-07 00:10:17 -07004939 def get_queryset(self):
Scott Baker20101af2015-02-02 10:41:12 -08004940 if (not self.request.user.is_authenticated()):
Scott Baker4af864e2015-02-02 13:53:46 -08004941 raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API")
Scott Baker515dc9e2014-12-22 09:29:05 -08004942 return DeploymentRole.select_by_user(self.request.user)
Scott Baker89a7b7c2014-10-07 00:10:17 -07004943
Scott Baker72758c72015-02-10 19:26:35 -08004944 # update() is handled by XOSRetrieveUpdateDestroyAPIView
Scott Baker89a7b7c2014-10-07 00:10:17 -07004945
Scott Baker72758c72015-02-10 19:26:35 -08004946 # destroy() is handled by XOSRetrieveUpdateDestroyAPIView
Scott Baker89a7b7c2014-10-07 00:10:17 -07004947
4948
4949
Scott Baker72758c72015-02-10 19:26:35 -08004950class UserCredentialList(XOSListCreateAPIView):
Scott Baker89a7b7c2014-10-07 00:10:17 -07004951 queryset = UserCredential.objects.select_related().all()
4952 serializer_class = UserCredentialSerializer
4953 id_serializer_class = UserCredentialIdSerializer
4954 filter_backends = (filters.DjangoFilterBackend,)
Scott Baker84cf39e2015-01-30 15:41:39 -08004955 filter_fields = ('id','created','updated','enacted','policed','backend_register','backend_status','deleted','user','name','key_id','enc_value',)
Scott Baker89a7b7c2014-10-07 00:10:17 -07004956
4957 def get_serializer_class(self):
Scott Baker84cf39e2015-01-30 15:41:39 -08004958 no_hyperlinks=False
4959 if hasattr(self.request,"QUERY_PARAMS"):
4960 no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
Scott Baker89a7b7c2014-10-07 00:10:17 -07004961 if (no_hyperlinks):
4962 return self.id_serializer_class
4963 else:
4964 return self.serializer_class
4965
4966 def get_queryset(self):
Scott Baker20101af2015-02-02 10:41:12 -08004967 if (not self.request.user.is_authenticated()):
Scott Baker4af864e2015-02-02 13:53:46 -08004968 raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API")
Scott Baker89a7b7c2014-10-07 00:10:17 -07004969 return UserCredential.select_by_user(self.request.user)
4970
Scott Baker89a7b7c2014-10-07 00:10:17 -07004971
Scott Baker72758c72015-02-10 19:26:35 -08004972class UserCredentialDetail(XOSRetrieveUpdateDestroyAPIView):
Scott Baker89a7b7c2014-10-07 00:10:17 -07004973 queryset = UserCredential.objects.select_related().all()
4974 serializer_class = UserCredentialSerializer
4975 id_serializer_class = UserCredentialIdSerializer
4976
4977 def get_serializer_class(self):
Scott Baker84cf39e2015-01-30 15:41:39 -08004978 no_hyperlinks=False
4979 if hasattr(self.request,"QUERY_PARAMS"):
4980 no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
Scott Baker89a7b7c2014-10-07 00:10:17 -07004981 if (no_hyperlinks):
4982 return self.id_serializer_class
4983 else:
4984 return self.serializer_class
Scott Baker84cf39e2015-01-30 15:41:39 -08004985
Scott Baker89a7b7c2014-10-07 00:10:17 -07004986 def get_queryset(self):
Scott Baker20101af2015-02-02 10:41:12 -08004987 if (not self.request.user.is_authenticated()):
Scott Baker4af864e2015-02-02 13:53:46 -08004988 raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API")
Scott Baker89a7b7c2014-10-07 00:10:17 -07004989 return UserCredential.select_by_user(self.request.user)
4990
Scott Baker72758c72015-02-10 19:26:35 -08004991 # update() is handled by XOSRetrieveUpdateDestroyAPIView
Scott Baker89a7b7c2014-10-07 00:10:17 -07004992
Scott Baker72758c72015-02-10 19:26:35 -08004993 # destroy() is handled by XOSRetrieveUpdateDestroyAPIView
Scott Baker89a7b7c2014-10-07 00:10:17 -07004994
Scott Baker89a7b7c2014-10-07 00:10:17 -07004995
Scott Baker57c725c2014-11-12 01:13:53 -08004996
Scott Baker72758c72015-02-10 19:26:35 -08004997class SliceTagList(XOSListCreateAPIView):
Scott Baker0caeaf02014-06-19 11:12:55 -07004998 queryset = SliceTag.objects.select_related().all()
4999 serializer_class = SliceTagSerializer
Scott Baker46b58542014-08-11 17:26:12 -07005000 id_serializer_class = SliceTagIdSerializer
5001 filter_backends = (filters.DjangoFilterBackend,)
Scott Baker84cf39e2015-01-30 15:41:39 -08005002 filter_fields = ('id','created','updated','enacted','policed','backend_register','backend_status','deleted','slice','name','value',)
Scott Baker46b58542014-08-11 17:26:12 -07005003
5004 def get_serializer_class(self):
Scott Baker84cf39e2015-01-30 15:41:39 -08005005 no_hyperlinks=False
5006 if hasattr(self.request,"QUERY_PARAMS"):
5007 no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
Scott Baker46b58542014-08-11 17:26:12 -07005008 if (no_hyperlinks):
5009 return self.id_serializer_class
5010 else:
5011 return self.serializer_class
5012
Scott Baker0caeaf02014-06-19 11:12:55 -07005013 def get_queryset(self):
Scott Baker20101af2015-02-02 10:41:12 -08005014 if (not self.request.user.is_authenticated()):
Scott Baker4af864e2015-02-02 13:53:46 -08005015 raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API")
Scott Baker0caeaf02014-06-19 11:12:55 -07005016 return SliceTag.select_by_user(self.request.user)
Sapan Bhatiadea39432014-06-13 03:10:36 -04005017
Scott Baker0caeaf02014-06-19 11:12:55 -07005018
Scott Baker72758c72015-02-10 19:26:35 -08005019class SliceTagDetail(XOSRetrieveUpdateDestroyAPIView):
Scott Baker0caeaf02014-06-19 11:12:55 -07005020 queryset = SliceTag.objects.select_related().all()
5021 serializer_class = SliceTagSerializer
Scott Baker46b58542014-08-11 17:26:12 -07005022 id_serializer_class = SliceTagIdSerializer
5023
5024 def get_serializer_class(self):
Scott Baker84cf39e2015-01-30 15:41:39 -08005025 no_hyperlinks=False
5026 if hasattr(self.request,"QUERY_PARAMS"):
5027 no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
Scott Baker46b58542014-08-11 17:26:12 -07005028 if (no_hyperlinks):
5029 return self.id_serializer_class
5030 else:
5031 return self.serializer_class
Scott Baker84cf39e2015-01-30 15:41:39 -08005032
Scott Baker0caeaf02014-06-19 11:12:55 -07005033 def get_queryset(self):
Scott Baker20101af2015-02-02 10:41:12 -08005034 if (not self.request.user.is_authenticated()):
Scott Baker4af864e2015-02-02 13:53:46 -08005035 raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API")
Scott Baker0caeaf02014-06-19 11:12:55 -07005036 return SliceTag.select_by_user(self.request.user)
5037
Scott Baker72758c72015-02-10 19:26:35 -08005038 # update() is handled by XOSRetrieveUpdateDestroyAPIView
Scott Baker0caeaf02014-06-19 11:12:55 -07005039
Scott Baker72758c72015-02-10 19:26:35 -08005040 # destroy() is handled by XOSRetrieveUpdateDestroyAPIView
Sapan Bhatiadea39432014-06-13 03:10:36 -04005041
5042
5043
Scott Baker72758c72015-02-10 19:26:35 -08005044class NetworkTemplateList(XOSListCreateAPIView):
Scott Bakerf2c0c512014-12-22 17:35:34 -08005045 queryset = NetworkTemplate.objects.select_related().all()
5046 serializer_class = NetworkTemplateSerializer
5047 id_serializer_class = NetworkTemplateIdSerializer
Scott Baker46b58542014-08-11 17:26:12 -07005048 filter_backends = (filters.DjangoFilterBackend,)
Scott Baker84cf39e2015-01-30 15:41:39 -08005049 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 Baker46b58542014-08-11 17:26:12 -07005050
5051 def get_serializer_class(self):
Scott Baker84cf39e2015-01-30 15:41:39 -08005052 no_hyperlinks=False
5053 if hasattr(self.request,"QUERY_PARAMS"):
5054 no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
Scott Baker46b58542014-08-11 17:26:12 -07005055 if (no_hyperlinks):
5056 return self.id_serializer_class
5057 else:
5058 return self.serializer_class
5059
Scott Baker0caeaf02014-06-19 11:12:55 -07005060 def get_queryset(self):
Scott Baker20101af2015-02-02 10:41:12 -08005061 if (not self.request.user.is_authenticated()):
Scott Baker4af864e2015-02-02 13:53:46 -08005062 raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API")
Scott Bakerf2c0c512014-12-22 17:35:34 -08005063 return NetworkTemplate.select_by_user(self.request.user)
Sapan Bhatiadea39432014-06-13 03:10:36 -04005064
Scott Baker0caeaf02014-06-19 11:12:55 -07005065
Scott Baker72758c72015-02-10 19:26:35 -08005066class NetworkTemplateDetail(XOSRetrieveUpdateDestroyAPIView):
Scott Bakerf2c0c512014-12-22 17:35:34 -08005067 queryset = NetworkTemplate.objects.select_related().all()
5068 serializer_class = NetworkTemplateSerializer
5069 id_serializer_class = NetworkTemplateIdSerializer
Scott Baker46b58542014-08-11 17:26:12 -07005070
5071 def get_serializer_class(self):
Scott Baker84cf39e2015-01-30 15:41:39 -08005072 no_hyperlinks=False
5073 if hasattr(self.request,"QUERY_PARAMS"):
5074 no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
Scott Baker46b58542014-08-11 17:26:12 -07005075 if (no_hyperlinks):
5076 return self.id_serializer_class
5077 else:
5078 return self.serializer_class
Scott Baker84cf39e2015-01-30 15:41:39 -08005079
Scott Baker0caeaf02014-06-19 11:12:55 -07005080 def get_queryset(self):
Scott Baker20101af2015-02-02 10:41:12 -08005081 if (not self.request.user.is_authenticated()):
Scott Baker4af864e2015-02-02 13:53:46 -08005082 raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API")
Scott Bakerf2c0c512014-12-22 17:35:34 -08005083 return NetworkTemplate.select_by_user(self.request.user)
Scott Baker0caeaf02014-06-19 11:12:55 -07005084
Scott Baker72758c72015-02-10 19:26:35 -08005085 # update() is handled by XOSRetrieveUpdateDestroyAPIView
Scott Baker0caeaf02014-06-19 11:12:55 -07005086
Scott Baker72758c72015-02-10 19:26:35 -08005087 # destroy() is handled by XOSRetrieveUpdateDestroyAPIView
Sapan Bhatiadea39432014-06-13 03:10:36 -04005088
5089
5090
Scott Baker72758c72015-02-10 19:26:35 -08005091class RouterList(XOSListCreateAPIView):
Scott Baker0caeaf02014-06-19 11:12:55 -07005092 queryset = Router.objects.select_related().all()
Sapan Bhatiadea39432014-06-13 03:10:36 -04005093 serializer_class = RouterSerializer
Scott Baker46b58542014-08-11 17:26:12 -07005094 id_serializer_class = RouterIdSerializer
5095 filter_backends = (filters.DjangoFilterBackend,)
Scott Baker84cf39e2015-01-30 15:41:39 -08005096 filter_fields = ('id','created','updated','enacted','policed','backend_register','backend_status','deleted','name','owner','networks','networks',)
Scott Baker46b58542014-08-11 17:26:12 -07005097
5098 def get_serializer_class(self):
Scott Baker84cf39e2015-01-30 15:41:39 -08005099 no_hyperlinks=False
5100 if hasattr(self.request,"QUERY_PARAMS"):
5101 no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
Scott Baker46b58542014-08-11 17:26:12 -07005102 if (no_hyperlinks):
5103 return self.id_serializer_class
5104 else:
5105 return self.serializer_class
5106
Scott Baker0caeaf02014-06-19 11:12:55 -07005107 def get_queryset(self):
Scott Baker20101af2015-02-02 10:41:12 -08005108 if (not self.request.user.is_authenticated()):
Scott Baker4af864e2015-02-02 13:53:46 -08005109 raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API")
Scott Baker0caeaf02014-06-19 11:12:55 -07005110 return Router.select_by_user(self.request.user)
5111
Sapan Bhatiadea39432014-06-13 03:10:36 -04005112
Scott Baker72758c72015-02-10 19:26:35 -08005113class RouterDetail(XOSRetrieveUpdateDestroyAPIView):
Scott Baker0caeaf02014-06-19 11:12:55 -07005114 queryset = Router.objects.select_related().all()
Sapan Bhatiadea39432014-06-13 03:10:36 -04005115 serializer_class = RouterSerializer
Scott Baker46b58542014-08-11 17:26:12 -07005116 id_serializer_class = RouterIdSerializer
5117
5118 def get_serializer_class(self):
Scott Baker84cf39e2015-01-30 15:41:39 -08005119 no_hyperlinks=False
5120 if hasattr(self.request,"QUERY_PARAMS"):
5121 no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
Scott Baker46b58542014-08-11 17:26:12 -07005122 if (no_hyperlinks):
5123 return self.id_serializer_class
5124 else:
5125 return self.serializer_class
Scott Baker84cf39e2015-01-30 15:41:39 -08005126
Scott Baker0caeaf02014-06-19 11:12:55 -07005127 def get_queryset(self):
Scott Baker20101af2015-02-02 10:41:12 -08005128 if (not self.request.user.is_authenticated()):
Scott Baker4af864e2015-02-02 13:53:46 -08005129 raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API")
Scott Baker0caeaf02014-06-19 11:12:55 -07005130 return Router.select_by_user(self.request.user)
5131
Scott Baker72758c72015-02-10 19:26:35 -08005132 # update() is handled by XOSRetrieveUpdateDestroyAPIView
Scott Baker0caeaf02014-06-19 11:12:55 -07005133
Scott Baker72758c72015-02-10 19:26:35 -08005134 # destroy() is handled by XOSRetrieveUpdateDestroyAPIView
Sapan Bhatiadea39432014-06-13 03:10:36 -04005135
5136
5137
Scott Baker72758c72015-02-10 19:26:35 -08005138class ServiceResourceList(XOSListCreateAPIView):
Scott Baker0caeaf02014-06-19 11:12:55 -07005139 queryset = ServiceResource.objects.select_related().all()
5140 serializer_class = ServiceResourceSerializer
Scott Baker46b58542014-08-11 17:26:12 -07005141 id_serializer_class = ServiceResourceIdSerializer
5142 filter_backends = (filters.DjangoFilterBackend,)
Scott Baker84cf39e2015-01-30 15:41:39 -08005143 filter_fields = ('id','created','updated','enacted','policed','backend_register','backend_status','deleted','serviceClass','name','maxUnitsDeployment','maxUnitsNode','maxDuration','bucketInRate','bucketMaxSize','cost','calendarReservable',)
Scott Baker46b58542014-08-11 17:26:12 -07005144
5145 def get_serializer_class(self):
Scott Baker84cf39e2015-01-30 15:41:39 -08005146 no_hyperlinks=False
5147 if hasattr(self.request,"QUERY_PARAMS"):
5148 no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
Scott Baker46b58542014-08-11 17:26:12 -07005149 if (no_hyperlinks):
5150 return self.id_serializer_class
5151 else:
5152 return self.serializer_class
5153
Scott Baker0caeaf02014-06-19 11:12:55 -07005154 def get_queryset(self):
Scott Baker20101af2015-02-02 10:41:12 -08005155 if (not self.request.user.is_authenticated()):
Scott Baker4af864e2015-02-02 13:53:46 -08005156 raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API")
Scott Baker0caeaf02014-06-19 11:12:55 -07005157 return ServiceResource.select_by_user(self.request.user)
Sapan Bhatiadea39432014-06-13 03:10:36 -04005158
Scott Baker0caeaf02014-06-19 11:12:55 -07005159
Scott Baker72758c72015-02-10 19:26:35 -08005160class ServiceResourceDetail(XOSRetrieveUpdateDestroyAPIView):
Scott Baker0caeaf02014-06-19 11:12:55 -07005161 queryset = ServiceResource.objects.select_related().all()
5162 serializer_class = ServiceResourceSerializer
Scott Baker46b58542014-08-11 17:26:12 -07005163 id_serializer_class = ServiceResourceIdSerializer
5164
5165 def get_serializer_class(self):
Scott Baker84cf39e2015-01-30 15:41:39 -08005166 no_hyperlinks=False
5167 if hasattr(self.request,"QUERY_PARAMS"):
5168 no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
Scott Baker46b58542014-08-11 17:26:12 -07005169 if (no_hyperlinks):
5170 return self.id_serializer_class
5171 else:
5172 return self.serializer_class
Scott Baker84cf39e2015-01-30 15:41:39 -08005173
Scott Baker0caeaf02014-06-19 11:12:55 -07005174 def get_queryset(self):
Scott Baker20101af2015-02-02 10:41:12 -08005175 if (not self.request.user.is_authenticated()):
Scott Baker4af864e2015-02-02 13:53:46 -08005176 raise RestFrameworkPermissionDenied("You must be authenticated in order to use this API")
Scott Baker0caeaf02014-06-19 11:12:55 -07005177 return ServiceResource.select_by_user(self.request.user)
5178
Scott Baker72758c72015-02-10 19:26:35 -08005179 # update() is handled by XOSRetrieveUpdateDestroyAPIView
Scott Baker0caeaf02014-06-19 11:12:55 -07005180
Scott Baker72758c72015-02-10 19:26:35 -08005181 # destroy() is handled by XOSRetrieveUpdateDestroyAPIView
Sapan Bhatiadea39432014-06-13 03:10:36 -04005182
Sapan Bhatiadea39432014-06-13 03:10:36 -04005183
5184