2024-03-22 09:56:30 -07:00
|
|
|
from typing import List
|
2021-06-25 15:31:43 -04:00
|
|
|
|
2024-03-22 09:56:30 -07:00
|
|
|
import strawberry
|
|
|
|
import strawberry_django
|
2023-03-23 05:42:18 -07:00
|
|
|
|
2024-03-22 09:56:30 -07:00
|
|
|
from virtualization import models
|
|
|
|
from .types import *
|
2023-11-17 12:02:56 -08:00
|
|
|
|
|
|
|
|
2024-03-22 09:56:30 -07:00
|
|
|
@strawberry.type
|
|
|
|
class VirtualizationQuery:
|
|
|
|
@strawberry.field
|
|
|
|
def cluster(self, id: int) -> ClusterType:
|
|
|
|
return models.Cluster.objects.get(pk=id)
|
|
|
|
cluster_list: List[ClusterType] = strawberry_django.field()
|
|
|
|
|
|
|
|
@strawberry.field
|
|
|
|
def cluster_group(self, id: int) -> ClusterGroupType:
|
|
|
|
return models.ClusterGroup.objects.get(pk=id)
|
|
|
|
cluster_group_list: List[ClusterGroupType] = strawberry_django.field()
|
|
|
|
|
|
|
|
@strawberry.field
|
|
|
|
def cluster_type(self, id: int) -> ClusterTypeType:
|
|
|
|
return models.ClusterType.objects.get(pk=id)
|
|
|
|
cluster_type_list: List[ClusterTypeType] = strawberry_django.field()
|
|
|
|
|
|
|
|
@strawberry.field
|
|
|
|
def virtual_machine(self, id: int) -> VirtualMachineType:
|
|
|
|
return models.VirtualMachine.objects.get(pk=id)
|
|
|
|
virtual_machine_list: List[VirtualMachineType] = strawberry_django.field()
|
|
|
|
|
|
|
|
@strawberry.field
|
|
|
|
def vm_interface(self, id: int) -> VMInterfaceType:
|
|
|
|
return models.VMInterface.objects.get(pk=id)
|
|
|
|
vm_interface_list: List[VMInterfaceType] = strawberry_django.field()
|
|
|
|
|
|
|
|
@strawberry.field
|
|
|
|
def virtual_disk(self, id: int) -> VirtualDiskType:
|
|
|
|
return models.VirtualDisk.objects.get(pk=id)
|
|
|
|
virtual_disk_list: List[VirtualDiskType] = strawberry_django.field()
|