1
0
mirror of https://github.com/netbox-community/netbox.git synced 2024-05-10 07:54:54 +00:00

9856 single item query for schema

This commit is contained in:
Arthur
2024-03-06 09:53:46 -08:00
parent 7c289aebc7
commit 2f719269e8
10 changed files with 309 additions and 103 deletions

View File

@@ -8,20 +8,32 @@ from .types import *
@strawberry.type
class VirtualizationQuery:
cluster: ClusterType = strawberry_django.field()
@strawberry.field
def cluster(self, id: int) -> ClusterType:
return models.Cluster.objects.get(id=id)
cluster_list: List[ClusterType] = strawberry_django.field()
cluster_group: ClusterGroupType = strawberry_django.field()
@strawberry.field
def cluster_group(self, id: int) -> ClusterGroupType:
return models.ClusterGroup.objects.get(id=id)
cluster_group_list: List[ClusterGroupType] = strawberry_django.field()
cluster_type: ClusterTypeType = strawberry_django.field()
@strawberry.field
def cluster_type(self, id: int) -> ClusterTypeType:
return models.ClusterType.objects.get(id=id)
cluster_type_list: List[ClusterTypeType] = strawberry_django.field()
virtual_machine: VirtualMachineType = strawberry_django.field()
@strawberry.field
def virtual_machine(self, id: int) -> VirtualMachineType:
return models.VirtualMachine.objects.get(id=id)
virtual_machine_list: List[VirtualMachineType] = strawberry_django.field()
vm_interface: VMInterfaceType = strawberry_django.field()
@strawberry.field
def vm_interface(self, id: int) -> VMInterfaceType:
return models.VMInterface.objects.get(id=id)
vm_interface_list: List[VMInterfaceType] = strawberry_django.field()
virtual_disk: VirtualDiskType = strawberry_django.field()
@strawberry.field
def virtual_disk(self, id: int) -> VirtualDiskType:
return models.VirtualDisk.objects.get(id=id)
virtual_disk_list: List[VirtualDiskType] = strawberry_django.field()