Apply schema adaptations across all apps

This commit is contained in:
Jeremy Stretch 2024-08-27 13:17:13 -04:00
parent e21d515f34
commit 89c41272c6
11 changed files with 99 additions and 286 deletions

View File

@ -3,38 +3,25 @@ from typing import List
import strawberry import strawberry
import strawberry_django import strawberry_django
from circuits import models
from .types import * from .types import *
@strawberry.type @strawberry.type(name="Query")
class CircuitsQuery: class CircuitsQuery:
@strawberry.field circuit: CircuitType = strawberry_django.field()
def circuit(self, id: int) -> CircuitType:
return models.Circuit.objects.get(pk=id)
circuit_list: List[CircuitType] = strawberry_django.field() circuit_list: List[CircuitType] = strawberry_django.field()
@strawberry.field circuit_termination: CircuitTerminationType = strawberry_django.field()
def circuit_termination(self, id: int) -> CircuitTerminationType:
return models.CircuitTermination.objects.get(pk=id)
circuit_termination_list: List[CircuitTerminationType] = strawberry_django.field() circuit_termination_list: List[CircuitTerminationType] = strawberry_django.field()
@strawberry.field circuit_type: CircuitTypeType = strawberry_django.field()
def circuit_type(self, id: int) -> CircuitTypeType:
return models.CircuitType.objects.get(pk=id)
circuit_type_list: List[CircuitTypeType] = strawberry_django.field() circuit_type_list: List[CircuitTypeType] = strawberry_django.field()
@strawberry.field provider: ProviderType = strawberry_django.field()
def provider(self, id: int) -> ProviderType:
return models.Provider.objects.get(pk=id)
provider_list: List[ProviderType] = strawberry_django.field() provider_list: List[ProviderType] = strawberry_django.field()
@strawberry.field provider_account: ProviderAccountType = strawberry_django.field()
def provider_account(self, id: int) -> ProviderAccountType:
return models.ProviderAccount.objects.get(pk=id)
provider_account_list: List[ProviderAccountType] = strawberry_django.field() provider_account_list: List[ProviderAccountType] = strawberry_django.field()
@strawberry.field provider_network: ProviderNetworkType = strawberry_django.field()
def provider_network(self, id: int) -> ProviderNetworkType:
return models.ProviderNetwork.objects.get(pk=id)
provider_network_list: List[ProviderNetworkType] = strawberry_django.field() provider_network_list: List[ProviderNetworkType] = strawberry_django.field()

View File

@ -3,18 +3,13 @@ from typing import List
import strawberry import strawberry
import strawberry_django import strawberry_django
from core import models
from .types import * from .types import *
@strawberry.type @strawberry.type(name="Query")
class CoreQuery: class CoreQuery:
@strawberry.field data_file: DataFileType = strawberry_django.field()
def data_file(self, id: int) -> DataFileType:
return models.DataFile.objects.get(pk=id)
data_file_list: List[DataFileType] = strawberry_django.field() data_file_list: List[DataFileType] = strawberry_django.field()
@strawberry.field data_source: DataSourceType = strawberry_django.field()
def data_source(self, id: int) -> DataSourceType:
return models.DataSource.objects.get(pk=id)
data_source_list: List[DataSourceType] = strawberry_django.field() data_source_list: List[DataSourceType] = strawberry_django.field()

View File

@ -3,208 +3,127 @@ from typing import List
import strawberry import strawberry
import strawberry_django import strawberry_django
from dcim import models
from .types import * from .types import *
@strawberry.type @strawberry.type(name="Query")
class DCIMQuery: class DCIMQuery:
@strawberry.field cable: CableType = strawberry_django.field()
def cable(self, id: int) -> CableType:
return models.Cable.objects.get(pk=id)
cable_list: List[CableType] = strawberry_django.field() cable_list: List[CableType] = strawberry_django.field()
@strawberry.field console_port: ConsolePortType = strawberry_django.field()
def console_port(self, id: int) -> ConsolePortType:
return models.ConsolePort.objects.get(pk=id)
console_port_list: List[ConsolePortType] = strawberry_django.field() console_port_list: List[ConsolePortType] = strawberry_django.field()
@strawberry.field console_port_template: ConsolePortTemplateType = strawberry_django.field()
def console_port_template(self, id: int) -> ConsolePortTemplateType:
return models.ConsolePortTemplate.objects.get(pk=id)
console_port_template_list: List[ConsolePortTemplateType] = strawberry_django.field() console_port_template_list: List[ConsolePortTemplateType] = strawberry_django.field()
@strawberry.field console_server_port: ConsoleServerPortType = strawberry_django.field()
def console_server_port(self, id: int) -> ConsoleServerPortType:
return models.ConsoleServerPort.objects.get(pk=id)
console_server_port_list: List[ConsoleServerPortType] = strawberry_django.field() console_server_port_list: List[ConsoleServerPortType] = strawberry_django.field()
@strawberry.field console_server_port_template: ConsoleServerPortTemplateType = strawberry_django.field()
def console_server_port_template(self, id: int) -> ConsoleServerPortTemplateType:
return models.ConsoleServerPortTemplate.objects.get(pk=id)
console_server_port_template_list: List[ConsoleServerPortTemplateType] = strawberry_django.field() console_server_port_template_list: List[ConsoleServerPortTemplateType] = strawberry_django.field()
@strawberry.field device: DeviceType = strawberry_django.field()
def device(self, id: int) -> DeviceType:
return models.Device.objects.get(pk=id)
device_list: List[DeviceType] = strawberry_django.field() device_list: List[DeviceType] = strawberry_django.field()
@strawberry.field device_bay: DeviceBayType = strawberry_django.field()
def device_bay(self, id: int) -> DeviceBayType:
return models.DeviceBay.objects.get(pk=id)
device_bay_list: List[DeviceBayType] = strawberry_django.field() device_bay_list: List[DeviceBayType] = strawberry_django.field()
@strawberry.field device_bay_template: DeviceBayTemplateType = strawberry_django.field()
def device_bay_template(self, id: int) -> DeviceBayTemplateType:
return models.DeviceBayTemplate.objects.get(pk=id)
device_bay_template_list: List[DeviceBayTemplateType] = strawberry_django.field() device_bay_template_list: List[DeviceBayTemplateType] = strawberry_django.field()
@strawberry.field device_role: DeviceRoleType = strawberry_django.field()
def device_role(self, id: int) -> DeviceRoleType:
return models.DeviceRole.objects.get(pk=id)
device_role_list: List[DeviceRoleType] = strawberry_django.field() device_role_list: List[DeviceRoleType] = strawberry_django.field()
@strawberry.field device_type: DeviceTypeType = strawberry_django.field()
def device_type(self, id: int) -> DeviceTypeType:
return models.DeviceType.objects.get(pk=id)
device_type_list: List[DeviceTypeType] = strawberry_django.field() device_type_list: List[DeviceTypeType] = strawberry_django.field()
@strawberry.field front_port: FrontPortType = strawberry_django.field()
def front_port(self, id: int) -> FrontPortType:
return models.FrontPort.objects.get(pk=id)
front_port_list: List[FrontPortType] = strawberry_django.field() front_port_list: List[FrontPortType] = strawberry_django.field()
@strawberry.field front_port_template: FrontPortTemplateType = strawberry_django.field()
def front_port_template(self, id: int) -> FrontPortTemplateType:
return models.FrontPortTemplate.objects.get(pk=id)
front_port_template_list: List[FrontPortTemplateType] = strawberry_django.field() front_port_template_list: List[FrontPortTemplateType] = strawberry_django.field()
@strawberry.field interface: InterfaceType = strawberry_django.field()
def interface(self, id: int) -> InterfaceType:
return models.Interface.objects.get(pk=id)
interface_list: List[InterfaceType] = strawberry_django.field() interface_list: List[InterfaceType] = strawberry_django.field()
@strawberry.field interface_template: InterfaceTemplateType = strawberry_django.field()
def interface_template(self, id: int) -> InterfaceTemplateType:
return models.InterfaceTemplate.objects.get(pk=id)
interface_template_list: List[InterfaceTemplateType] = strawberry_django.field() interface_template_list: List[InterfaceTemplateType] = strawberry_django.field()
@strawberry.field inventory_item: InventoryItemType = strawberry_django.field()
def inventory_item(self, id: int) -> InventoryItemType:
return models.InventoryItem.objects.get(pk=id)
inventory_item_list: List[InventoryItemType] = strawberry_django.field() inventory_item_list: List[InventoryItemType] = strawberry_django.field()
@strawberry.field inventory_item_role: InventoryItemRoleType = strawberry_django.field()
def inventory_item_role(self, id: int) -> InventoryItemRoleType:
return models.InventoryItemRole.objects.get(pk=id)
inventory_item_role_list: List[InventoryItemRoleType] = strawberry_django.field() inventory_item_role_list: List[InventoryItemRoleType] = strawberry_django.field()
@strawberry.field inventory_item_template: InventoryItemTemplateType = strawberry_django.field()
def inventory_item_template(self, id: int) -> InventoryItemTemplateType:
return models.InventoryItemTemplate.objects.get(pk=id)
inventory_item_template_list: List[InventoryItemTemplateType] = strawberry_django.field() inventory_item_template_list: List[InventoryItemTemplateType] = strawberry_django.field()
@strawberry.field location: LocationType = strawberry_django.field()
def location(self, id: int) -> LocationType:
return models.Location.objects.get(pk=id)
location_list: List[LocationType] = strawberry_django.field() location_list: List[LocationType] = strawberry_django.field()
@strawberry.field manufacturer: ManufacturerType = strawberry_django.field()
def manufacturer(self, id: int) -> ManufacturerType:
return models.Manufacturer.objects.get(pk=id)
manufacturer_list: List[ManufacturerType] = strawberry_django.field() manufacturer_list: List[ManufacturerType] = strawberry_django.field()
@strawberry.field module: ModuleType = strawberry_django.field()
def module(self, id: int) -> ModuleType:
return models.Module.objects.get(pk=id)
module_list: List[ModuleType] = strawberry_django.field() module_list: List[ModuleType] = strawberry_django.field()
@strawberry.field module_bay: ModuleBayType = strawberry_django.field()
def module_bay(self, id: int) -> ModuleBayType:
return models.ModuleBay.objects.get(pk=id)
module_bay_list: List[ModuleBayType] = strawberry_django.field() module_bay_list: List[ModuleBayType] = strawberry_django.field()
@strawberry.field module_bay_template: ModuleBayTemplateType = strawberry_django.field()
def module_bay_template(self, id: int) -> ModuleBayTemplateType:
return models.ModuleBayTemplate.objects.get(pk=id)
module_bay_template_list: List[ModuleBayTemplateType] = strawberry_django.field() module_bay_template_list: List[ModuleBayTemplateType] = strawberry_django.field()
@strawberry.field module_type: ModuleTypeType = strawberry_django.field()
def module_type(self, id: int) -> ModuleTypeType:
return models.ModuleType.objects.get(pk=id)
module_type_list: List[ModuleTypeType] = strawberry_django.field() module_type_list: List[ModuleTypeType] = strawberry_django.field()
@strawberry.field platform: PlatformType = strawberry_django.field()
def platform(self, id: int) -> PlatformType:
return models.Platform.objects.get(pk=id)
platform_list: List[PlatformType] = strawberry_django.field() platform_list: List[PlatformType] = strawberry_django.field()
@strawberry.field power_feed: PowerFeedType = strawberry_django.field()
def power_feed(self, id: int) -> PowerFeedType:
return models.PowerFeed.objects.get(pk=id)
power_feed_list: List[PowerFeedType] = strawberry_django.field() power_feed_list: List[PowerFeedType] = strawberry_django.field()
@strawberry.field power_outlet: PowerOutletType = strawberry_django.field()
def power_outlet(self, id: int) -> PowerOutletType:
return models.PowerOutlet.objects.get(pk=id)
power_outlet_list: List[PowerOutletType] = strawberry_django.field() power_outlet_list: List[PowerOutletType] = strawberry_django.field()
@strawberry.field power_outlet_template: PowerOutletTemplateType = strawberry_django.field()
def power_outlet_template(self, id: int) -> PowerOutletTemplateType:
return models.PowerOutletTemplate.objects.get(pk=id)
power_outlet_template_list: List[PowerOutletTemplateType] = strawberry_django.field() power_outlet_template_list: List[PowerOutletTemplateType] = strawberry_django.field()
@strawberry.field power_panel: PowerPanelType = strawberry_django.field()
def power_panel(self, id: int) -> PowerPanelType:
return models.PowerPanel.objects.get(id=id)
power_panel_list: List[PowerPanelType] = strawberry_django.field() power_panel_list: List[PowerPanelType] = strawberry_django.field()
@strawberry.field power_port: PowerPortType = strawberry_django.field()
def power_port(self, id: int) -> PowerPortType:
return models.PowerPort.objects.get(id=id)
power_port_list: List[PowerPortType] = strawberry_django.field() power_port_list: List[PowerPortType] = strawberry_django.field()
@strawberry.field power_port_template: PowerPortTemplateType = strawberry_django.field()
def power_port_template(self, id: int) -> PowerPortTemplateType:
return models.PowerPortTemplate.objects.get(id=id)
power_port_template_list: List[PowerPortTemplateType] = strawberry_django.field() power_port_template_list: List[PowerPortTemplateType] = strawberry_django.field()
@strawberry.field rack: RackType = strawberry_django.field()
def rack(self, id: int) -> RackType:
return models.Rack.objects.get(id=id)
rack_list: List[RackType] = strawberry_django.field() rack_list: List[RackType] = strawberry_django.field()
@strawberry.field rack_reservation: RackReservationType = strawberry_django.field()
def rack_reservation(self, id: int) -> RackReservationType:
return models.RackReservation.objects.get(id=id)
rack_reservation_list: List[RackReservationType] = strawberry_django.field() rack_reservation_list: List[RackReservationType] = strawberry_django.field()
@strawberry.field rack_role: RackRoleType = strawberry_django.field()
def rack_role(self, id: int) -> RackRoleType:
return models.RackRole.objects.get(id=id)
rack_role_list: List[RackRoleType] = strawberry_django.field() rack_role_list: List[RackRoleType] = strawberry_django.field()
@strawberry.field rear_port: RearPortType = strawberry_django.field()
def rear_port(self, id: int) -> RearPortType:
return models.RearPort.objects.get(id=id)
rear_port_list: List[RearPortType] = strawberry_django.field() rear_port_list: List[RearPortType] = strawberry_django.field()
@strawberry.field rear_port_template: RearPortTemplateType = strawberry_django.field()
def rear_port_template(self, id: int) -> RearPortTemplateType:
return models.RearPortTemplate.objects.get(id=id)
rear_port_template_list: List[RearPortTemplateType] = strawberry_django.field() rear_port_template_list: List[RearPortTemplateType] = strawberry_django.field()
@strawberry.field region: RegionType = strawberry_django.field()
def region(self, id: int) -> RegionType:
return models.Region.objects.get(id=id)
region_list: List[RegionType] = strawberry_django.field() region_list: List[RegionType] = strawberry_django.field()
@strawberry.field site: SiteType = strawberry_django.field()
def site(self, id: int) -> SiteType:
return models.Site.objects.get(id=id)
site_list: List[SiteType] = strawberry_django.field() site_list: List[SiteType] = strawberry_django.field()
@strawberry.field site_group: SiteGroupType = strawberry_django.field()
def site_group(self, id: int) -> SiteGroupType:
return models.SiteGroup.objects.get(id=id)
site_group_list: List[SiteGroupType] = strawberry_django.field() site_group_list: List[SiteGroupType] = strawberry_django.field()
@strawberry.field virtual_chassis: VirtualChassisType = strawberry_django.field()
def virtual_chassis(self, id: int) -> VirtualChassisType:
return models.VirtualChassis.objects.get(id=id)
virtual_chassis_list: List[VirtualChassisType] = strawberry_django.field() virtual_chassis_list: List[VirtualChassisType] = strawberry_django.field()
@strawberry.field virtual_device_context: VirtualDeviceContextType = strawberry_django.field()
def virtual_device_context(self, id: int) -> VirtualDeviceContextType:
return models.VirtualDeviceContext.objects.get(id=id)
virtual_device_context_list: List[VirtualDeviceContextType] = strawberry_django.field() virtual_device_context_list: List[VirtualDeviceContextType] = strawberry_django.field()

View File

@ -3,68 +3,43 @@ from typing import List
import strawberry import strawberry
import strawberry_django import strawberry_django
from extras import models
from .types import * from .types import *
@strawberry.type @strawberry.type(name="Query")
class ExtrasQuery: class ExtrasQuery:
@strawberry.field config_context: ConfigContextType = strawberry_django.field()
def config_context(self, id: int) -> ConfigContextType:
return models.ConfigContext.objects.get(pk=id)
config_context_list: List[ConfigContextType] = strawberry_django.field() config_context_list: List[ConfigContextType] = strawberry_django.field()
@strawberry.field config_template: ConfigTemplateType = strawberry_django.field()
def config_template(self, id: int) -> ConfigTemplateType:
return models.ConfigTemplate.objects.get(pk=id)
config_template_list: List[ConfigTemplateType] = strawberry_django.field() config_template_list: List[ConfigTemplateType] = strawberry_django.field()
@strawberry.field custom_field: CustomFieldType = strawberry_django.field()
def custom_field(self, id: int) -> CustomFieldType:
return models.CustomField.objects.get(pk=id)
custom_field_list: List[CustomFieldType] = strawberry_django.field() custom_field_list: List[CustomFieldType] = strawberry_django.field()
@strawberry.field custom_field_choice_set: CustomFieldChoiceSetType = strawberry_django.field()
def custom_field_choice_set(self, id: int) -> CustomFieldChoiceSetType:
return models.CustomFieldChoiceSet.objects.get(pk=id)
custom_field_choice_set_list: List[CustomFieldChoiceSetType] = strawberry_django.field() custom_field_choice_set_list: List[CustomFieldChoiceSetType] = strawberry_django.field()
@strawberry.field custom_link: CustomLinkType = strawberry_django.field()
def custom_link(self, id: int) -> CustomLinkType:
return models.CustomLink.objects.get(pk=id)
custom_link_list: List[CustomLinkType] = strawberry_django.field() custom_link_list: List[CustomLinkType] = strawberry_django.field()
@strawberry.field export_template: ExportTemplateType = strawberry_django.field()
def export_template(self, id: int) -> ExportTemplateType:
return models.ExportTemplate.objects.get(pk=id)
export_template_list: List[ExportTemplateType] = strawberry_django.field() export_template_list: List[ExportTemplateType] = strawberry_django.field()
@strawberry.field image_attachment: ImageAttachmentType = strawberry_django.field()
def image_attachment(self, id: int) -> ImageAttachmentType:
return models.ImageAttachment.objects.get(pk=id)
image_attachment_list: List[ImageAttachmentType] = strawberry_django.field() image_attachment_list: List[ImageAttachmentType] = strawberry_django.field()
@strawberry.field saved_filter: SavedFilterType = strawberry_django.field()
def saved_filter(self, id: int) -> SavedFilterType:
return models.SavedFilter.objects.get(pk=id)
saved_filter_list: List[SavedFilterType] = strawberry_django.field() saved_filter_list: List[SavedFilterType] = strawberry_django.field()
@strawberry.field journal_entry: JournalEntryType = strawberry_django.field()
def journal_entry(self, id: int) -> JournalEntryType:
return models.JournalEntry.objects.get(pk=id)
journal_entry_list: List[JournalEntryType] = strawberry_django.field() journal_entry_list: List[JournalEntryType] = strawberry_django.field()
@strawberry.field tag: TagType = strawberry_django.field()
def tag(self, id: int) -> TagType:
return models.Tag.objects.get(pk=id)
tag_list: List[TagType] = strawberry_django.field() tag_list: List[TagType] = strawberry_django.field()
@strawberry.field webhook: WebhookType = strawberry_django.field()
def webhook(self, id: int) -> WebhookType:
return models.Webhook.objects.get(pk=id)
webhook_list: List[WebhookType] = strawberry_django.field() webhook_list: List[WebhookType] = strawberry_django.field()
@strawberry.field event_rule: EventRuleType = strawberry_django.field()
def event_rule(self, id: int) -> EventRuleType:
return models.EventRule.objects.get(pk=id)
event_rule_list: List[EventRuleType] = strawberry_django.field() event_rule_list: List[EventRuleType] = strawberry_django.field()

View File

@ -3,7 +3,6 @@ from typing import List
import strawberry import strawberry
import strawberry_django import strawberry_django
from ipam import models
from .types import * from .types import *

View File

@ -13,11 +13,9 @@ class DummyModelType:
pass pass
@strawberry.type @strawberry.type(name="Query")
class DummyQuery: class DummyQuery:
@strawberry.field dummymodel: DummyModelType = strawberry_django.field()
def dummymodel(self, id: int) -> DummyModelType:
return None
dummymodel_list: List[DummyModelType] = strawberry_django.field() dummymodel_list: List[DummyModelType] = strawberry_django.field()

View File

@ -3,38 +3,25 @@ from typing import List
import strawberry import strawberry
import strawberry_django import strawberry_django
from tenancy import models
from .types import * from .types import *
@strawberry.type @strawberry.type(name="Query")
class TenancyQuery: class TenancyQuery:
@strawberry.field tenant: TenantType = strawberry_django.field()
def tenant(self, id: int) -> TenantType:
return models.Tenant.objects.get(pk=id)
tenant_list: List[TenantType] = strawberry_django.field() tenant_list: List[TenantType] = strawberry_django.field()
@strawberry.field tenant_group: TenantGroupType = strawberry_django.field()
def tenant_group(self, id: int) -> TenantGroupType:
return models.TenantGroup.objects.get(pk=id)
tenant_group_list: List[TenantGroupType] = strawberry_django.field() tenant_group_list: List[TenantGroupType] = strawberry_django.field()
@strawberry.field contact: ContactType = strawberry_django.field()
def contact(self, id: int) -> ContactType:
return models.Contact.objects.get(pk=id)
contact_list: List[ContactType] = strawberry_django.field() contact_list: List[ContactType] = strawberry_django.field()
@strawberry.field contact_role: ContactRoleType = strawberry_django.field()
def contact_role(self, id: int) -> ContactRoleType:
return models.ContactRole.objects.get(pk=id)
contact_role_list: List[ContactRoleType] = strawberry_django.field() contact_role_list: List[ContactRoleType] = strawberry_django.field()
@strawberry.field contact_group: ContactGroupType = strawberry_django.field()
def contact_group(self, id: int) -> ContactGroupType:
return models.ContactGroup.objects.get(pk=id)
contact_group_list: List[ContactGroupType] = strawberry_django.field() contact_group_list: List[ContactGroupType] = strawberry_django.field()
@strawberry.field contact_assignment: ContactAssignmentType = strawberry_django.field()
def contact_assignment(self, id: int) -> ContactAssignmentType:
return models.ContactAssignment.objects.get(pk=id)
contact_assignment_list: List[ContactAssignmentType] = strawberry_django.field() contact_assignment_list: List[ContactAssignmentType] = strawberry_django.field()

View File

@ -1,21 +1,15 @@
from typing import List from typing import List
import strawberry import strawberry
import strawberry_django import strawberry_django
from django.contrib.auth import get_user_model
from django.contrib.auth.models import Group
from users import models
from .types import * from .types import *
@strawberry.type @strawberry.type(name="Query")
class UsersQuery: class UsersQuery:
@strawberry.field group: GroupType = strawberry_django.field()
def group(self, id: int) -> GroupType:
return models.Group.objects.get(pk=id)
group_list: List[GroupType] = strawberry_django.field() group_list: List[GroupType] = strawberry_django.field()
@strawberry.field user: UserType = strawberry_django.field()
def user(self, id: int) -> UserType:
return models.User.objects.get(pk=id)
user_list: List[UserType] = strawberry_django.field() user_list: List[UserType] = strawberry_django.field()

View File

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

View File

@ -3,58 +3,37 @@ from typing import List
import strawberry import strawberry
import strawberry_django import strawberry_django
from vpn import models
from .types import * from .types import *
@strawberry.type @strawberry.type(name="Query")
class VPNQuery: class VPNQuery:
@strawberry.field ike_policy: IKEPolicyType = strawberry_django.field()
def ike_policy(self, id: int) -> IKEPolicyType:
return models.IKEPolicy.objects.get(pk=id)
ike_policy_list: List[IKEPolicyType] = strawberry_django.field() ike_policy_list: List[IKEPolicyType] = strawberry_django.field()
@strawberry.field ike_proposal: IKEProposalType = strawberry_django.field()
def ike_proposal(self, id: int) -> IKEProposalType:
return models.IKEProposal.objects.get(pk=id)
ike_proposal_list: List[IKEProposalType] = strawberry_django.field() ike_proposal_list: List[IKEProposalType] = strawberry_django.field()
@strawberry.field ipsec_policy: IPSecPolicyType = strawberry_django.field()
def ipsec_policy(self, id: int) -> IPSecPolicyType:
return models.IPSecPolicy.objects.get(pk=id)
ipsec_policy_list: List[IPSecPolicyType] = strawberry_django.field() ipsec_policy_list: List[IPSecPolicyType] = strawberry_django.field()
@strawberry.field ipsec_profile: IPSecProfileType = strawberry_django.field()
def ipsec_profile(self, id: int) -> IPSecProfileType:
return models.IPSecProfile.objects.get(pk=id)
ipsec_profile_list: List[IPSecProfileType] = strawberry_django.field() ipsec_profile_list: List[IPSecProfileType] = strawberry_django.field()
@strawberry.field ipsec_proposal: IPSecProposalType = strawberry_django.field()
def ipsec_proposal(self, id: int) -> IPSecProposalType:
return models.IPSecProposal.objects.get(pk=id)
ipsec_proposal_list: List[IPSecProposalType] = strawberry_django.field() ipsec_proposal_list: List[IPSecProposalType] = strawberry_django.field()
@strawberry.field l2vpn: L2VPNType = strawberry_django.field()
def l2vpn(self, id: int) -> L2VPNType:
return models.L2VPN.objects.get(pk=id)
l2vpn_list: List[L2VPNType] = strawberry_django.field() l2vpn_list: List[L2VPNType] = strawberry_django.field()
@strawberry.field l2vpn_termination: L2VPNTerminationType = strawberry_django.field()
def l2vpn_termination(self, id: int) -> L2VPNTerminationType:
return models.L2VPNTermination.objects.get(pk=id)
l2vpn_termination_list: List[L2VPNTerminationType] = strawberry_django.field() l2vpn_termination_list: List[L2VPNTerminationType] = strawberry_django.field()
@strawberry.field tunnel: TunnelType = strawberry_django.field()
def tunnel(self, id: int) -> TunnelType:
return models.Tunnel.objects.get(pk=id)
tunnel_list: List[TunnelType] = strawberry_django.field() tunnel_list: List[TunnelType] = strawberry_django.field()
@strawberry.field tunnel_group: TunnelGroupType = strawberry_django.field()
def tunnel_group(self, id: int) -> TunnelGroupType:
return models.TunnelGroup.objects.get(pk=id)
tunnel_group_list: List[TunnelGroupType] = strawberry_django.field() tunnel_group_list: List[TunnelGroupType] = strawberry_django.field()
@strawberry.field tunnel_termination: TunnelTerminationType = strawberry_django.field()
def tunnel_termination(self, id: int) -> TunnelTerminationType:
return models.TunnelTermination.objects.get(pk=id)
tunnel_termination_list: List[TunnelTerminationType] = strawberry_django.field() tunnel_termination_list: List[TunnelTerminationType] = strawberry_django.field()

View File

@ -3,23 +3,16 @@ from typing import List
import strawberry import strawberry
import strawberry_django import strawberry_django
from wireless import models
from .types import * from .types import *
@strawberry.type @strawberry.type(name="Query")
class WirelessQuery: class WirelessQuery:
@strawberry.field wireless_lan: WirelessLANType = strawberry_django.field()
def wireless_lan(self, id: int) -> WirelessLANType:
return models.WirelessLAN.objects.get(pk=id)
wireless_lan_list: List[WirelessLANType] = strawberry_django.field() wireless_lan_list: List[WirelessLANType] = strawberry_django.field()
@strawberry.field wireless_lan_group: WirelessLANGroupType = strawberry_django.field()
def wireless_lan_group(self, id: int) -> WirelessLANGroupType:
return models.WirelessLANGroup.objects.get(pk=id)
wireless_lan_group_list: List[WirelessLANGroupType] = strawberry_django.field() wireless_lan_group_list: List[WirelessLANGroupType] = strawberry_django.field()
@strawberry.field wireless_link: WirelessLinkType = strawberry_django.field()
def wireless_link(self, id: int) -> WirelessLinkType:
return models.WirelessLink.objects.get(pk=id)
wireless_link_list: List[WirelessLinkType] = strawberry_django.field() wireless_link_list: List[WirelessLinkType] = strawberry_django.field()