Sapan Bhatia | dea3943 | 2014-06-13 03:10:36 -0400 | [diff] [blame] | 1 | from rest_framework.decorators import api_view |
| 2 | from rest_framework.response import Response |
| 3 | from rest_framework.reverse import reverse |
| 4 | from rest_framework import serializers |
| 5 | from core.models import * |
| 6 | from django.forms import widgets |
| 7 | |
| 8 | """ |
| 9 | Schema of the generator object: |
| 10 | all: Set of all Model objects |
| 11 | all_if(regex): Set of Model objects that match regex |
| 12 | |
| 13 | Model object: |
| 14 | plural: English plural of object name |
| 15 | camel: CamelCase version of object name |
| 16 | refs: list of references to other Model objects |
| 17 | props: list of properties minus refs |
| 18 | |
| 19 | TODO: Deal with subnets |
| 20 | """ |
| 21 | |
| 22 | # Based on api_root.py |
| 23 | |
| 24 | @api_view(['GET']) |
| 25 | def api_root(request, format=None): |
| 26 | return Response({ |
| 27 | 'serviceattributes': reverse('serviceattribute-list', request=request, format=format), |
| 28 | 'images': reverse('image-list', request=request, format=format), |
| 29 | 'networkparameters': reverse('networkparameter-list', request=request, format=format), |
| 30 | 'sites': reverse('site-list', request=request, format=format), |
| 31 | 'sliceroles': reverse('slicerole-list', request=request, format=format), |
| 32 | 'tags': reverse('tag-list', request=request, format=format), |
| 33 | 'invoices': reverse('invoice-list', request=request, format=format), |
| 34 | 'sliceprivileges': reverse('sliceprivilege-list', request=request, format=format), |
| 35 | 'planetstackroles': reverse('planetstackrole-list', request=request, format=format), |
| 36 | 'networkslivers': reverse('networksliver-list', request=request, format=format), |
| 37 | 'projects': reverse('project-list', request=request, format=format), |
| 38 | 'slices': reverse('slice-list', request=request, format=format), |
| 39 | 'networks': reverse('network-list', request=request, format=format), |
| 40 | 'services': reverse('service-list', request=request, format=format), |
| 41 | 'serviceclasses': reverse('serviceclass-list', request=request, format=format), |
| 42 | 'siteroles': reverse('siterole-list', request=request, format=format), |
| 43 | 'charges': reverse('charge-list', request=request, format=format), |
| 44 | 'roles': reverse('role-list', request=request, format=format), |
| 45 | 'usableobjects': reverse('usableobject-list', request=request, format=format), |
| 46 | 'slivers': reverse('sliver-list', request=request, format=format), |
| 47 | 'nodes': reverse('node-list', request=request, format=format), |
| 48 | 'reservedresources': reverse('reservedresource-list', request=request, format=format), |
| 49 | 'payments': reverse('payment-list', request=request, format=format), |
| 50 | 'networkslices': reverse('networkslice-list', request=request, format=format), |
| 51 | 'planetstackprivileges': reverse('planetstackprivilege-list', request=request, format=format), |
| 52 | 'users': reverse('user-list', request=request, format=format), |
| 53 | 'deployments': reverse('deployment-list', request=request, format=format), |
| 54 | 'reservations': reverse('reservation-list', request=request, format=format), |
| 55 | 'siteprivileges': reverse('siteprivilege-list', request=request, format=format), |
| 56 | 'singletonmodels': reverse('singletonmodel-list', request=request, format=format), |
| 57 | 'planetstacks': reverse('planetstack-list', request=request, format=format), |
| 58 | 'accounts': reverse('account-list', request=request, format=format), |
| 59 | 'networkparametertypes': reverse('networkparametertype-list', request=request, format=format), |
| 60 | 'sitedeploymentses': reverse('sitedeployments-list', request=request, format=format), |
| 61 | 'deploymentprivileges': reverse('deploymentprivilege-list', request=request, format=format), |
| 62 | 'deploymentroles': reverse('deploymentrole-list', request=request, format=format), |
| 63 | 'plcorebases': reverse('plcorebase-list', request=request, format=format), |
| 64 | 'slicetags': reverse('slicetag-list', request=request, format=format), |
| 65 | 'networktemplates': reverse('networktemplate-list', request=request, format=format), |
| 66 | 'routers': reverse('router-list', request=request, format=format), |
| 67 | 'serviceresources': reverse('serviceresource-list', request=request, format=format), |
| 68 | |
| 69 | }) |
| 70 | |
| 71 | # Based on serializers.py |
| 72 | |
| 73 | |
| 74 | |
| 75 | class ServiceattributeSerializer(serializers.HyperlinkedModelSerializer): |
| 76 | id = serializers.Field() |
| 77 | |
| 78 | services = serializers.HyperlinkedRelatedField(view_name='service-detail') |
| 79 | |
| 80 | class Meta: |
| 81 | model = serviceattribute |
| 82 | fields = ('id','created','updated','enacted','name','value',) |
| 83 | |
| 84 | |
| 85 | class ImageSerializer(serializers.HyperlinkedModelSerializer): |
| 86 | id = serializers.Field() |
| 87 | |
| 88 | class Meta: |
| 89 | model = image |
| 90 | fields = ('id','created','updated','enacted','image_id','name','disk_format','container_format',) |
| 91 | |
| 92 | |
| 93 | class NetworkparameterSerializer(serializers.HyperlinkedModelSerializer): |
| 94 | id = serializers.Field() |
| 95 | |
| 96 | class Meta: |
| 97 | model = networkparameter |
| 98 | fields = ('id','created','updated','enacted','parameter','value','content_type','object_id',) |
| 99 | |
| 100 | |
| 101 | class SiteSerializer(serializers.HyperlinkedModelSerializer): |
| 102 | id = serializers.Field() |
| 103 | |
| 104 | class Meta: |
| 105 | model = site |
| 106 | fields = ('id','created','updated','enacted','tenant_id','name','site_url','enabled','location','longitude','latitude','login_base','is_public','abbreviated_name',) |
| 107 | |
| 108 | |
| 109 | class SliceroleSerializer(serializers.HyperlinkedModelSerializer): |
| 110 | id = serializers.Field() |
| 111 | |
| 112 | class Meta: |
| 113 | model = slicerole |
| 114 | fields = ('id','created','updated','enacted','role',) |
| 115 | |
| 116 | |
| 117 | class TagSerializer(serializers.HyperlinkedModelSerializer): |
| 118 | id = serializers.Field() |
| 119 | |
| 120 | services = serializers.HyperlinkedRelatedField(view_name='service-detail') |
| 121 | |
| 122 | class Meta: |
| 123 | model = tag |
| 124 | fields = ('id','created','updated','enacted','name','value','content_type','object_id',) |
| 125 | |
| 126 | |
| 127 | class InvoiceSerializer(serializers.HyperlinkedModelSerializer): |
| 128 | id = serializers.Field() |
| 129 | |
| 130 | accounts = serializers.HyperlinkedRelatedField(view_name='account-detail') |
| 131 | |
| 132 | class Meta: |
| 133 | model = invoice |
| 134 | fields = ('id','created','updated','enacted','date',) |
| 135 | |
| 136 | |
| 137 | class SliceprivilegeSerializer(serializers.HyperlinkedModelSerializer): |
| 138 | id = serializers.Field() |
| 139 | |
| 140 | users = serializers.HyperlinkedRelatedField(view_name='user-detail') |
| 141 | |
| 142 | slices = serializers.HyperlinkedRelatedField(view_name='slice-detail') |
| 143 | |
| 144 | roles = serializers.HyperlinkedRelatedField(view_name='role-detail') |
| 145 | |
| 146 | class Meta: |
| 147 | model = sliceprivilege |
| 148 | fields = ('id','created','updated','enacted',) |
| 149 | |
| 150 | |
| 151 | class PlanetstackroleSerializer(serializers.HyperlinkedModelSerializer): |
| 152 | id = serializers.Field() |
| 153 | |
| 154 | class Meta: |
| 155 | model = planetstackrole |
| 156 | fields = ('id','created','updated','enacted','role',) |
| 157 | |
| 158 | |
| 159 | class NetworksliverSerializer(serializers.HyperlinkedModelSerializer): |
| 160 | id = serializers.Field() |
| 161 | |
| 162 | networks = serializers.HyperlinkedRelatedField(view_name='network-detail') |
| 163 | |
| 164 | slivers = serializers.HyperlinkedRelatedField(view_name='sliver-detail') |
| 165 | |
| 166 | class Meta: |
| 167 | model = networksliver |
| 168 | fields = ('id','created','updated','enacted','ip','port_id',) |
| 169 | |
| 170 | |
| 171 | class ProjectSerializer(serializers.HyperlinkedModelSerializer): |
| 172 | id = serializers.Field() |
| 173 | |
| 174 | class Meta: |
| 175 | model = project |
| 176 | fields = ('id','created','updated','enacted','name',) |
| 177 | |
| 178 | |
| 179 | class SliceSerializer(serializers.HyperlinkedModelSerializer): |
| 180 | id = serializers.Field() |
| 181 | |
| 182 | sites = serializers.HyperlinkedRelatedField(view_name='site-detail') |
| 183 | |
| 184 | services = serializers.HyperlinkedRelatedField(view_name='service-detail') |
| 185 | |
| 186 | class Meta: |
| 187 | model = slice |
| 188 | fields = ('id','created','updated','enacted','tenant_id','name','enabled','omf_friendly','description','slice_url','network_id','router_id','subnet_id','serviceClass','creator',) |
| 189 | |
| 190 | |
| 191 | class NetworkSerializer(serializers.HyperlinkedModelSerializer): |
| 192 | id = serializers.Field() |
| 193 | |
| 194 | class Meta: |
| 195 | model = network |
| 196 | fields = ('id','created','updated','enacted','name','template','subnet','ports','labels','owner','guaranteedBandwidth','permitAllSlices','network_id','router_id','subnet_id',) |
| 197 | |
| 198 | |
| 199 | class ServiceSerializer(serializers.HyperlinkedModelSerializer): |
| 200 | id = serializers.Field() |
| 201 | |
| 202 | class Meta: |
| 203 | model = service |
| 204 | fields = ('id','created','updated','enacted','description','enabled','name','versionNumber','published',) |
| 205 | |
| 206 | |
| 207 | class ServiceclassSerializer(serializers.HyperlinkedModelSerializer): |
| 208 | id = serializers.Field() |
| 209 | |
| 210 | class Meta: |
| 211 | model = serviceclass |
| 212 | fields = ('id','created','updated','enacted','name','description','commitment','membershipFee','membershipFeeMonths','upgradeRequiresApproval',) |
| 213 | |
| 214 | |
| 215 | class SiteroleSerializer(serializers.HyperlinkedModelSerializer): |
| 216 | id = serializers.Field() |
| 217 | |
| 218 | class Meta: |
| 219 | model = siterole |
| 220 | fields = ('id','created','updated','enacted','role',) |
| 221 | |
| 222 | |
| 223 | class ChargeSerializer(serializers.HyperlinkedModelSerializer): |
| 224 | id = serializers.Field() |
| 225 | |
| 226 | accounts = serializers.HyperlinkedRelatedField(view_name='account-detail') |
| 227 | |
| 228 | slices = serializers.HyperlinkedRelatedField(view_name='slice-detail') |
| 229 | |
| 230 | invoices = serializers.HyperlinkedRelatedField(view_name='invoice-detail') |
| 231 | |
| 232 | class Meta: |
| 233 | model = charge |
| 234 | fields = ('id','created','updated','enacted','kind','state','date','object','amount','coreHours',) |
| 235 | |
| 236 | |
| 237 | class RoleSerializer(serializers.HyperlinkedModelSerializer): |
| 238 | id = serializers.Field() |
| 239 | |
| 240 | class Meta: |
| 241 | model = role |
| 242 | fields = ('id','created','updated','enacted','role_type','role','description','content_type',) |
| 243 | |
| 244 | |
| 245 | class UsableobjectSerializer(serializers.HyperlinkedModelSerializer): |
| 246 | id = serializers.Field() |
| 247 | |
| 248 | class Meta: |
| 249 | model = usableobject |
| 250 | fields = ('id','created','updated','enacted','name',) |
| 251 | |
| 252 | |
| 253 | class SliverSerializer(serializers.HyperlinkedModelSerializer): |
| 254 | id = serializers.Field() |
| 255 | |
| 256 | images = serializers.HyperlinkedRelatedField(view_name='image-detail') |
| 257 | |
| 258 | slices = serializers.HyperlinkedRelatedField(view_name='slice-detail') |
| 259 | |
| 260 | nodes = serializers.HyperlinkedRelatedField(view_name='node-detail') |
| 261 | |
| 262 | class Meta: |
| 263 | model = sliver |
| 264 | fields = ('id','created','updated','enacted','instance_id','name','instance_name','ip','creator','deploymentNetwork','numberCores',) |
| 265 | |
| 266 | |
| 267 | class NodeSerializer(serializers.HyperlinkedModelSerializer): |
| 268 | id = serializers.Field() |
| 269 | |
| 270 | sites = serializers.HyperlinkedRelatedField(view_name='site-detail') |
| 271 | |
| 272 | deployments = serializers.HyperlinkedRelatedField(view_name='deployment-detail') |
| 273 | |
| 274 | class Meta: |
| 275 | model = node |
| 276 | fields = ('id','created','updated','enacted','name',) |
| 277 | |
| 278 | |
| 279 | class ReservedresourceSerializer(serializers.HyperlinkedModelSerializer): |
| 280 | id = serializers.Field() |
| 281 | |
| 282 | slivers = serializers.HyperlinkedRelatedField(view_name='sliver-detail') |
| 283 | |
| 284 | class Meta: |
| 285 | model = reservedresource |
| 286 | fields = ('id','created','updated','enacted','resource','quantity','reservationSet',) |
| 287 | |
| 288 | |
| 289 | class PaymentSerializer(serializers.HyperlinkedModelSerializer): |
| 290 | id = serializers.Field() |
| 291 | |
| 292 | accounts = serializers.HyperlinkedRelatedField(view_name='account-detail') |
| 293 | |
| 294 | class Meta: |
| 295 | model = payment |
| 296 | fields = ('id','created','updated','enacted','amount','date',) |
| 297 | |
| 298 | |
| 299 | class NetworksliceSerializer(serializers.HyperlinkedModelSerializer): |
| 300 | id = serializers.Field() |
| 301 | |
| 302 | networks = serializers.HyperlinkedRelatedField(view_name='network-detail') |
| 303 | |
| 304 | slices = serializers.HyperlinkedRelatedField(view_name='slice-detail') |
| 305 | |
| 306 | class Meta: |
| 307 | model = networkslice |
| 308 | fields = ('id','created','updated','enacted',) |
| 309 | |
| 310 | |
| 311 | class PlanetstackprivilegeSerializer(serializers.HyperlinkedModelSerializer): |
| 312 | id = serializers.Field() |
| 313 | |
| 314 | users = serializers.HyperlinkedRelatedField(view_name='user-detail') |
| 315 | |
| 316 | planetstacks = serializers.HyperlinkedRelatedField(view_name='planetstack-detail') |
| 317 | |
| 318 | roles = serializers.HyperlinkedRelatedField(view_name='role-detail') |
| 319 | |
| 320 | class Meta: |
| 321 | model = planetstackprivilege |
| 322 | fields = ('id','created','updated','enacted',) |
| 323 | |
| 324 | |
| 325 | class UserSerializer(serializers.HyperlinkedModelSerializer): |
| 326 | id = serializers.Field() |
| 327 | |
| 328 | sites = serializers.HyperlinkedRelatedField(view_name='site-detail') |
| 329 | |
| 330 | class Meta: |
| 331 | model = user |
| 332 | fields = ('id','password','last_login','email','username','kuser_id','firstname','lastname','phone','user_url','public_key','is_active','is_admin','is_staff','is_readonly','created','updated','enacted','timezone',) |
| 333 | |
| 334 | |
| 335 | class DeploymentSerializer(serializers.HyperlinkedModelSerializer): |
| 336 | id = serializers.Field() |
| 337 | |
| 338 | class Meta: |
| 339 | model = deployment |
| 340 | fields = ('id','created','updated','enacted','name',) |
| 341 | |
| 342 | |
| 343 | class ReservationSerializer(serializers.HyperlinkedModelSerializer): |
| 344 | id = serializers.Field() |
| 345 | |
| 346 | slices = serializers.HyperlinkedRelatedField(view_name='slice-detail') |
| 347 | |
| 348 | class Meta: |
| 349 | model = reservation |
| 350 | fields = ('id','created','updated','enacted','startTime','duration',) |
| 351 | |
| 352 | |
| 353 | class SiteprivilegeSerializer(serializers.HyperlinkedModelSerializer): |
| 354 | id = serializers.Field() |
| 355 | |
| 356 | users = serializers.HyperlinkedRelatedField(view_name='user-detail') |
| 357 | |
| 358 | sites = serializers.HyperlinkedRelatedField(view_name='site-detail') |
| 359 | |
| 360 | roles = serializers.HyperlinkedRelatedField(view_name='role-detail') |
| 361 | |
| 362 | class Meta: |
| 363 | model = siteprivilege |
| 364 | fields = ('id','created','updated','enacted',) |
| 365 | |
| 366 | |
| 367 | class SingletonmodelSerializer(serializers.HyperlinkedModelSerializer): |
| 368 | id = serializers.Field() |
| 369 | |
| 370 | class Meta: |
| 371 | model = singletonmodel |
| 372 | fields = () |
| 373 | |
| 374 | |
| 375 | class PlanetstackSerializer(serializers.HyperlinkedModelSerializer): |
| 376 | id = serializers.Field() |
| 377 | |
| 378 | class Meta: |
| 379 | model = planetstack |
| 380 | fields = ('id','created','updated','enacted','description',) |
| 381 | |
| 382 | |
| 383 | class AccountSerializer(serializers.HyperlinkedModelSerializer): |
| 384 | id = serializers.Field() |
| 385 | |
| 386 | sites = serializers.HyperlinkedRelatedField(view_name='site-detail') |
| 387 | |
| 388 | class Meta: |
| 389 | model = account |
| 390 | fields = ('id','created','updated','enacted',) |
| 391 | |
| 392 | |
| 393 | class NetworkparametertypeSerializer(serializers.HyperlinkedModelSerializer): |
| 394 | id = serializers.Field() |
| 395 | |
| 396 | class Meta: |
| 397 | model = networkparametertype |
| 398 | fields = ('id','created','updated','enacted','name','description',) |
| 399 | |
| 400 | |
| 401 | class SitedeploymentsSerializer(serializers.HyperlinkedModelSerializer): |
| 402 | id = serializers.Field() |
| 403 | |
| 404 | sites = serializers.HyperlinkedRelatedField(view_name='site-detail') |
| 405 | |
| 406 | deployments = serializers.HyperlinkedRelatedField(view_name='deployment-detail') |
| 407 | |
| 408 | class Meta: |
| 409 | model = sitedeployments |
| 410 | fields = ('id','created','updated','enacted',) |
| 411 | |
| 412 | |
| 413 | class DeploymentprivilegeSerializer(serializers.HyperlinkedModelSerializer): |
| 414 | id = serializers.Field() |
| 415 | |
| 416 | users = serializers.HyperlinkedRelatedField(view_name='user-detail') |
| 417 | |
| 418 | deployments = serializers.HyperlinkedRelatedField(view_name='deployment-detail') |
| 419 | |
| 420 | roles = serializers.HyperlinkedRelatedField(view_name='role-detail') |
| 421 | |
| 422 | class Meta: |
| 423 | model = deploymentprivilege |
| 424 | fields = ('id','created','updated','enacted',) |
| 425 | |
| 426 | |
| 427 | class DeploymentroleSerializer(serializers.HyperlinkedModelSerializer): |
| 428 | id = serializers.Field() |
| 429 | |
| 430 | class Meta: |
| 431 | model = deploymentrole |
| 432 | fields = ('id','created','updated','enacted','role',) |
| 433 | |
| 434 | |
| 435 | class PlcorebaseSerializer(serializers.HyperlinkedModelSerializer): |
| 436 | id = serializers.Field() |
| 437 | |
| 438 | class Meta: |
| 439 | model = plcorebase |
| 440 | fields = ('created','updated','enacted',) |
| 441 | |
| 442 | |
| 443 | class SlicetagSerializer(serializers.HyperlinkedModelSerializer): |
| 444 | id = serializers.Field() |
| 445 | |
| 446 | slices = serializers.HyperlinkedRelatedField(view_name='slice-detail') |
| 447 | |
| 448 | class Meta: |
| 449 | model = slicetag |
| 450 | fields = ('id','created','updated','enacted','name','value',) |
| 451 | |
| 452 | |
| 453 | class NetworktemplateSerializer(serializers.HyperlinkedModelSerializer): |
| 454 | id = serializers.Field() |
| 455 | |
| 456 | class Meta: |
| 457 | model = networktemplate |
| 458 | fields = ('id','created','updated','enacted','name','description','guaranteedBandwidth','visibility','translation','sharedNetworkName','sharedNetworkId',) |
| 459 | |
| 460 | |
| 461 | class RouterSerializer(serializers.HyperlinkedModelSerializer): |
| 462 | id = serializers.Field() |
| 463 | |
| 464 | class Meta: |
| 465 | model = router |
| 466 | fields = ('id','created','updated','enacted','name','owner',) |
| 467 | |
| 468 | |
| 469 | class ServiceresourceSerializer(serializers.HyperlinkedModelSerializer): |
| 470 | id = serializers.Field() |
| 471 | |
| 472 | class Meta: |
| 473 | model = serviceresource |
| 474 | fields = ('id','created','updated','enacted','serviceClass','name','maxUnitsDeployment','maxUnitsNode','maxDuration','bucketInRate','bucketMaxSize','cost','calendarReservable',) |
| 475 | |
| 476 | |
| 477 | serializerLookUp = { |
| 478 | |
| 479 | Serviceattribute: ServiceattributeSerializer, |
| 480 | |
| 481 | Image: ImageSerializer, |
| 482 | |
| 483 | Networkparameter: NetworkparameterSerializer, |
| 484 | |
| 485 | Site: SiteSerializer, |
| 486 | |
| 487 | Slicerole: SliceroleSerializer, |
| 488 | |
| 489 | Tag: TagSerializer, |
| 490 | |
| 491 | Invoice: InvoiceSerializer, |
| 492 | |
| 493 | Sliceprivilege: SliceprivilegeSerializer, |
| 494 | |
| 495 | Planetstackrole: PlanetstackroleSerializer, |
| 496 | |
| 497 | Networksliver: NetworksliverSerializer, |
| 498 | |
| 499 | Project: ProjectSerializer, |
| 500 | |
| 501 | Slice: SliceSerializer, |
| 502 | |
| 503 | Network: NetworkSerializer, |
| 504 | |
| 505 | Service: ServiceSerializer, |
| 506 | |
| 507 | Serviceclass: ServiceclassSerializer, |
| 508 | |
| 509 | Siterole: SiteroleSerializer, |
| 510 | |
| 511 | Charge: ChargeSerializer, |
| 512 | |
| 513 | Role: RoleSerializer, |
| 514 | |
| 515 | Usableobject: UsableobjectSerializer, |
| 516 | |
| 517 | Sliver: SliverSerializer, |
| 518 | |
| 519 | Node: NodeSerializer, |
| 520 | |
| 521 | Reservedresource: ReservedresourceSerializer, |
| 522 | |
| 523 | Payment: PaymentSerializer, |
| 524 | |
| 525 | Networkslice: NetworksliceSerializer, |
| 526 | |
| 527 | Planetstackprivilege: PlanetstackprivilegeSerializer, |
| 528 | |
| 529 | User: UserSerializer, |
| 530 | |
| 531 | Deployment: DeploymentSerializer, |
| 532 | |
| 533 | Reservation: ReservationSerializer, |
| 534 | |
| 535 | Siteprivilege: SiteprivilegeSerializer, |
| 536 | |
| 537 | Singletonmodel: SingletonmodelSerializer, |
| 538 | |
| 539 | Planetstack: PlanetstackSerializer, |
| 540 | |
| 541 | Account: AccountSerializer, |
| 542 | |
| 543 | Networkparametertype: NetworkparametertypeSerializer, |
| 544 | |
| 545 | Sitedeployments: SitedeploymentsSerializer, |
| 546 | |
| 547 | Deploymentprivilege: DeploymentprivilegeSerializer, |
| 548 | |
| 549 | Deploymentrole: DeploymentroleSerializer, |
| 550 | |
| 551 | Plcorebase: PlcorebaseSerializer, |
| 552 | |
| 553 | Slicetag: SlicetagSerializer, |
| 554 | |
| 555 | Networktemplate: NetworktemplateSerializer, |
| 556 | |
| 557 | Router: RouterSerializer, |
| 558 | |
| 559 | Serviceresource: ServiceresourceSerializer, |
| 560 | |
| 561 | None: None, |
| 562 | } |
| 563 | |
| 564 | # Based on core/views/*.py |
| 565 | |
| 566 | |
| 567 | class ServiceattributeList(generics.ListCreateAPIView): |
| 568 | queryset = Serviceattribute.objects.all() |
| 569 | serializer_class = ServiceattributeSerializer |
| 570 | |
| 571 | class ServiceattributeDetail(generics.RetrieveUpdateDestroyAPIView): |
| 572 | queryset = Serviceattribute.objects.all() |
| 573 | serializer_class = ServiceattributeSerializer |
| 574 | |
| 575 | |
| 576 | |
| 577 | class ImageList(generics.ListCreateAPIView): |
| 578 | queryset = Image.objects.all() |
| 579 | serializer_class = ImageSerializer |
| 580 | |
| 581 | class ImageDetail(generics.RetrieveUpdateDestroyAPIView): |
| 582 | queryset = Image.objects.all() |
| 583 | serializer_class = ImageSerializer |
| 584 | |
| 585 | |
| 586 | |
| 587 | class NetworkparameterList(generics.ListCreateAPIView): |
| 588 | queryset = Networkparameter.objects.all() |
| 589 | serializer_class = NetworkparameterSerializer |
| 590 | |
| 591 | class NetworkparameterDetail(generics.RetrieveUpdateDestroyAPIView): |
| 592 | queryset = Networkparameter.objects.all() |
| 593 | serializer_class = NetworkparameterSerializer |
| 594 | |
| 595 | |
| 596 | |
| 597 | class SiteList(generics.ListCreateAPIView): |
| 598 | queryset = Site.objects.all() |
| 599 | serializer_class = SiteSerializer |
| 600 | |
| 601 | class SiteDetail(generics.RetrieveUpdateDestroyAPIView): |
| 602 | queryset = Site.objects.all() |
| 603 | serializer_class = SiteSerializer |
| 604 | |
| 605 | class SliceroleList(generics.ListCreateAPIView): |
| 606 | queryset = Slicerole.objects.all() |
| 607 | serializer_class = SliceroleSerializer |
| 608 | |
| 609 | class SliceroleDetail(generics.RetrieveUpdateDestroyAPIView): |
| 610 | queryset = Slicerole.objects.all() |
| 611 | serializer_class = SliceroleSerializer |
| 612 | |
| 613 | |
| 614 | |
| 615 | class TagList(generics.ListCreateAPIView): |
| 616 | queryset = Tag.objects.all() |
| 617 | serializer_class = TagSerializer |
| 618 | |
| 619 | class TagDetail(generics.RetrieveUpdateDestroyAPIView): |
| 620 | queryset = Tag.objects.all() |
| 621 | serializer_class = TagSerializer |
| 622 | |
| 623 | |
| 624 | |
| 625 | class InvoiceList(generics.ListCreateAPIView): |
| 626 | queryset = Invoice.objects.all() |
| 627 | serializer_class = InvoiceSerializer |
| 628 | |
| 629 | class InvoiceDetail(generics.RetrieveUpdateDestroyAPIView): |
| 630 | queryset = Invoice.objects.all() |
| 631 | serializer_class = InvoiceSerializer |
| 632 | |
| 633 | |
| 634 | |
| 635 | class SliceprivilegeList(generics.ListCreateAPIView): |
| 636 | queryset = Sliceprivilege.objects.all() |
| 637 | serializer_class = SliceprivilegeSerializer |
| 638 | |
| 639 | class SliceprivilegeDetail(generics.RetrieveUpdateDestroyAPIView): |
| 640 | queryset = Sliceprivilege.objects.all() |
| 641 | serializer_class = SliceprivilegeSerializer |
| 642 | |
| 643 | |
| 644 | |
| 645 | class PlanetstackroleList(generics.ListCreateAPIView): |
| 646 | queryset = Planetstackrole.objects.all() |
| 647 | serializer_class = PlanetstackroleSerializer |
| 648 | |
| 649 | class PlanetstackroleDetail(generics.RetrieveUpdateDestroyAPIView): |
| 650 | queryset = Planetstackrole.objects.all() |
| 651 | serializer_class = PlanetstackroleSerializer |
| 652 | |
| 653 | |
| 654 | |
| 655 | class NetworksliverList(generics.ListCreateAPIView): |
| 656 | queryset = Networksliver.objects.all() |
| 657 | serializer_class = NetworksliverSerializer |
| 658 | |
| 659 | class NetworksliverDetail(generics.RetrieveUpdateDestroyAPIView): |
| 660 | queryset = Networksliver.objects.all() |
| 661 | serializer_class = NetworksliverSerializer |
| 662 | |
| 663 | |
| 664 | |
| 665 | class ProjectList(generics.ListCreateAPIView): |
| 666 | queryset = Project.objects.all() |
| 667 | serializer_class = ProjectSerializer |
| 668 | |
| 669 | class ProjectDetail(generics.RetrieveUpdateDestroyAPIView): |
| 670 | queryset = Project.objects.all() |
| 671 | serializer_class = ProjectSerializer |
| 672 | |
| 673 | |
| 674 | |
| 675 | class SliceList(generics.ListCreateAPIView): |
| 676 | queryset = Slice.objects.all() |
| 677 | serializer_class = SliceSerializer |
| 678 | |
| 679 | class SliceDetail(generics.RetrieveUpdateDestroyAPIView): |
| 680 | queryset = Slice.objects.all() |
| 681 | serializer_class = SliceSerializer |
| 682 | |
| 683 | |
| 684 | |
| 685 | class NetworkList(generics.ListCreateAPIView): |
| 686 | queryset = Network.objects.all() |
| 687 | serializer_class = NetworkSerializer |
| 688 | |
| 689 | class NetworkDetail(generics.RetrieveUpdateDestroyAPIView): |
| 690 | queryset = Network.objects.all() |
| 691 | serializer_class = NetworkSerializer |
| 692 | |
| 693 | |
| 694 | |
| 695 | class ServiceList(generics.ListCreateAPIView): |
| 696 | queryset = Service.objects.all() |
| 697 | serializer_class = ServiceSerializer |
| 698 | |
| 699 | class ServiceDetail(generics.RetrieveUpdateDestroyAPIView): |
| 700 | queryset = Service.objects.all() |
| 701 | serializer_class = ServiceSerializer |
| 702 | |
| 703 | |
| 704 | |
| 705 | class ServiceclassList(generics.ListCreateAPIView): |
| 706 | queryset = Serviceclass.objects.all() |
| 707 | serializer_class = ServiceclassSerializer |
| 708 | |
| 709 | class ServiceclassDetail(generics.RetrieveUpdateDestroyAPIView): |
| 710 | queryset = Serviceclass.objects.all() |
| 711 | serializer_class = ServiceclassSerializer |
| 712 | |
| 713 | |
| 714 | |
| 715 | class SiteroleList(generics.ListCreateAPIView): |
| 716 | queryset = Siterole.objects.all() |
| 717 | serializer_class = SiteroleSerializer |
| 718 | |
| 719 | class SiteroleDetail(generics.RetrieveUpdateDestroyAPIView): |
| 720 | queryset = Siterole.objects.all() |
| 721 | serializer_class = SiteroleSerializer |
| 722 | |
| 723 | |
| 724 | |
| 725 | class ChargeList(generics.ListCreateAPIView): |
| 726 | queryset = Charge.objects.all() |
| 727 | serializer_class = ChargeSerializer |
| 728 | |
| 729 | class ChargeDetail(generics.RetrieveUpdateDestroyAPIView): |
| 730 | queryset = Charge.objects.all() |
| 731 | serializer_class = ChargeSerializer |
| 732 | |
| 733 | |
| 734 | |
| 735 | class RoleList(generics.ListCreateAPIView): |
| 736 | queryset = Role.objects.all() |
| 737 | serializer_class = RoleSerializer |
| 738 | |
| 739 | class RoleDetail(generics.RetrieveUpdateDestroyAPIView): |
| 740 | queryset = Role.objects.all() |
| 741 | serializer_class = RoleSerializer |
| 742 | |
| 743 | |
| 744 | |
| 745 | class UsableobjectList(generics.ListCreateAPIView): |
| 746 | queryset = Usableobject.objects.all() |
| 747 | serializer_class = UsableobjectSerializer |
| 748 | |
| 749 | class UsableobjectDetail(generics.RetrieveUpdateDestroyAPIView): |
| 750 | queryset = Usableobject.objects.all() |
| 751 | serializer_class = UsableobjectSerializer |
| 752 | |
| 753 | |
| 754 | |
| 755 | class SliverList(generics.ListCreateAPIView): |
| 756 | queryset = Sliver.objects.all() |
| 757 | serializer_class = SliverSerializer |
| 758 | |
| 759 | class SliverDetail(generics.RetrieveUpdateDestroyAPIView): |
| 760 | queryset = Sliver.objects.all() |
| 761 | serializer_class = SliverSerializer |
| 762 | |
| 763 | |
| 764 | |
| 765 | class NodeList(generics.ListCreateAPIView): |
| 766 | queryset = Node.objects.all() |
| 767 | serializer_class = NodeSerializer |
| 768 | |
| 769 | class NodeDetail(generics.RetrieveUpdateDestroyAPIView): |
| 770 | queryset = Node.objects.all() |
| 771 | serializer_class = NodeSerializer |
| 772 | |
| 773 | |
| 774 | |
| 775 | class ReservedresourceList(generics.ListCreateAPIView): |
| 776 | queryset = Reservedresource.objects.all() |
| 777 | serializer_class = ReservedresourceSerializer |
| 778 | |
| 779 | class ReservedresourceDetail(generics.RetrieveUpdateDestroyAPIView): |
| 780 | queryset = Reservedresource.objects.all() |
| 781 | serializer_class = ReservedresourceSerializer |
| 782 | |
| 783 | |
| 784 | |
| 785 | class PaymentList(generics.ListCreateAPIView): |
| 786 | queryset = Payment.objects.all() |
| 787 | serializer_class = PaymentSerializer |
| 788 | |
| 789 | class PaymentDetail(generics.RetrieveUpdateDestroyAPIView): |
| 790 | queryset = Payment.objects.all() |
| 791 | serializer_class = PaymentSerializer |
| 792 | |
| 793 | |
| 794 | |
| 795 | class NetworksliceList(generics.ListCreateAPIView): |
| 796 | queryset = Networkslice.objects.all() |
| 797 | serializer_class = NetworksliceSerializer |
| 798 | |
| 799 | class NetworksliceDetail(generics.RetrieveUpdateDestroyAPIView): |
| 800 | queryset = Networkslice.objects.all() |
| 801 | serializer_class = NetworksliceSerializer |
| 802 | |
| 803 | |
| 804 | |
| 805 | class PlanetstackprivilegeList(generics.ListCreateAPIView): |
| 806 | queryset = Planetstackprivilege.objects.all() |
| 807 | serializer_class = PlanetstackprivilegeSerializer |
| 808 | |
| 809 | class PlanetstackprivilegeDetail(generics.RetrieveUpdateDestroyAPIView): |
| 810 | queryset = Planetstackprivilege.objects.all() |
| 811 | serializer_class = PlanetstackprivilegeSerializer |
| 812 | |
| 813 | |
| 814 | |
| 815 | class UserList(generics.ListCreateAPIView): |
| 816 | queryset = User.objects.all() |
| 817 | serializer_class = UserSerializer |
| 818 | |
| 819 | class UserDetail(generics.RetrieveUpdateDestroyAPIView): |
| 820 | queryset = User.objects.all() |
| 821 | serializer_class = UserSerializer |
| 822 | |
| 823 | |
| 824 | |
| 825 | class DeploymentList(generics.ListCreateAPIView): |
| 826 | queryset = Deployment.objects.all() |
| 827 | serializer_class = DeploymentSerializer |
| 828 | |
| 829 | class DeploymentDetail(generics.RetrieveUpdateDestroyAPIView): |
| 830 | queryset = Deployment.objects.all() |
| 831 | serializer_class = DeploymentSerializer |
| 832 | |
| 833 | |
| 834 | |
| 835 | class ReservationList(generics.ListCreateAPIView): |
| 836 | queryset = Reservation.objects.all() |
| 837 | serializer_class = ReservationSerializer |
| 838 | |
| 839 | class ReservationDetail(generics.RetrieveUpdateDestroyAPIView): |
| 840 | queryset = Reservation.objects.all() |
| 841 | serializer_class = ReservationSerializer |
| 842 | |
| 843 | |
| 844 | |
| 845 | class SiteprivilegeList(generics.ListCreateAPIView): |
| 846 | queryset = Siteprivilege.objects.all() |
| 847 | serializer_class = SiteprivilegeSerializer |
| 848 | |
| 849 | class SiteprivilegeDetail(generics.RetrieveUpdateDestroyAPIView): |
| 850 | queryset = Siteprivilege.objects.all() |
| 851 | serializer_class = SiteprivilegeSerializer |
| 852 | |
| 853 | |
| 854 | |
| 855 | class SingletonmodelList(generics.ListCreateAPIView): |
| 856 | queryset = Singletonmodel.objects.all() |
| 857 | serializer_class = SingletonmodelSerializer |
| 858 | |
| 859 | class SingletonmodelDetail(generics.RetrieveUpdateDestroyAPIView): |
| 860 | queryset = Singletonmodel.objects.all() |
| 861 | serializer_class = SingletonmodelSerializer |
| 862 | |
| 863 | |
| 864 | |
| 865 | class PlanetstackList(generics.ListCreateAPIView): |
| 866 | queryset = Planetstack.objects.all() |
| 867 | serializer_class = PlanetstackSerializer |
| 868 | |
| 869 | class PlanetstackDetail(generics.RetrieveUpdateDestroyAPIView): |
| 870 | queryset = Planetstack.objects.all() |
| 871 | serializer_class = PlanetstackSerializer |
| 872 | |
| 873 | |
| 874 | |
| 875 | class AccountList(generics.ListCreateAPIView): |
| 876 | queryset = Account.objects.all() |
| 877 | serializer_class = AccountSerializer |
| 878 | |
| 879 | class AccountDetail(generics.RetrieveUpdateDestroyAPIView): |
| 880 | queryset = Account.objects.all() |
| 881 | serializer_class = AccountSerializer |
| 882 | |
| 883 | |
| 884 | |
| 885 | class NetworkparametertypeList(generics.ListCreateAPIView): |
| 886 | queryset = Networkparametertype.objects.all() |
| 887 | serializer_class = NetworkparametertypeSerializer |
| 888 | |
| 889 | class NetworkparametertypeDetail(generics.RetrieveUpdateDestroyAPIView): |
| 890 | queryset = Networkparametertype.objects.all() |
| 891 | serializer_class = NetworkparametertypeSerializer |
| 892 | |
| 893 | |
| 894 | |
| 895 | class SitedeploymentsList(generics.ListCreateAPIView): |
| 896 | queryset = Sitedeployments.objects.all() |
| 897 | serializer_class = SitedeploymentsSerializer |
| 898 | |
| 899 | class SitedeploymentsDetail(generics.RetrieveUpdateDestroyAPIView): |
| 900 | queryset = Sitedeployments.objects.all() |
| 901 | serializer_class = SitedeploymentsSerializer |
| 902 | |
| 903 | |
| 904 | |
| 905 | class DeploymentprivilegeList(generics.ListCreateAPIView): |
| 906 | queryset = Deploymentprivilege.objects.all() |
| 907 | serializer_class = DeploymentprivilegeSerializer |
| 908 | |
| 909 | class DeploymentprivilegeDetail(generics.RetrieveUpdateDestroyAPIView): |
| 910 | queryset = Deploymentprivilege.objects.all() |
| 911 | serializer_class = DeploymentprivilegeSerializer |
| 912 | |
| 913 | |
| 914 | |
| 915 | class DeploymentroleList(generics.ListCreateAPIView): |
| 916 | queryset = Deploymentrole.objects.all() |
| 917 | serializer_class = DeploymentroleSerializer |
| 918 | |
| 919 | class DeploymentroleDetail(generics.RetrieveUpdateDestroyAPIView): |
| 920 | queryset = Deploymentrole.objects.all() |
| 921 | serializer_class = DeploymentroleSerializer |
| 922 | |
| 923 | |
| 924 | |
| 925 | class PlcorebaseList(generics.ListCreateAPIView): |
| 926 | queryset = Plcorebase.objects.all() |
| 927 | serializer_class = PlcorebaseSerializer |
| 928 | |
| 929 | class PlcorebaseDetail(generics.RetrieveUpdateDestroyAPIView): |
| 930 | queryset = Plcorebase.objects.all() |
| 931 | serializer_class = PlcorebaseSerializer |
| 932 | |
| 933 | |
| 934 | |
| 935 | class SlicetagList(generics.ListCreateAPIView): |
| 936 | queryset = Slicetag.objects.all() |
| 937 | serializer_class = SlicetagSerializer |
| 938 | |
| 939 | class SlicetagDetail(generics.RetrieveUpdateDestroyAPIView): |
| 940 | queryset = Slicetag.objects.all() |
| 941 | serializer_class = SlicetagSerializer |
| 942 | |
| 943 | |
| 944 | |
| 945 | class NetworktemplateList(generics.ListCreateAPIView): |
| 946 | queryset = Networktemplate.objects.all() |
| 947 | serializer_class = NetworktemplateSerializer |
| 948 | |
| 949 | class NetworktemplateDetail(generics.RetrieveUpdateDestroyAPIView): |
| 950 | queryset = Networktemplate.objects.all() |
| 951 | serializer_class = NetworktemplateSerializer |
| 952 | |
| 953 | |
| 954 | |
| 955 | class RouterList(generics.ListCreateAPIView): |
| 956 | queryset = Router.objects.all() |
| 957 | serializer_class = RouterSerializer |
| 958 | |
| 959 | class RouterDetail(generics.RetrieveUpdateDestroyAPIView): |
| 960 | queryset = Router.objects.all() |
| 961 | serializer_class = RouterSerializer |
| 962 | |
| 963 | |
| 964 | |
| 965 | class ServiceresourceList(generics.ListCreateAPIView): |
| 966 | queryset = Serviceresource.objects.all() |
| 967 | serializer_class = ServiceresourceSerializer |
| 968 | |
| 969 | class ServiceresourceDetail(generics.RetrieveUpdateDestroyAPIView): |
| 970 | queryset = Serviceresource.objects.all() |
| 971 | serializer_class = ServiceresourceSerializer |
| 972 | |
| 973 | |
| 974 | |