16244 add pagination

This commit is contained in:
Arthur 2025-03-13 21:57:43 -07:00
parent 03a0b1749c
commit 0754c85715
12 changed files with 213 additions and 201 deletions

View File

@ -8,35 +8,35 @@ from .types import *
@strawberry.type(name="Query") @strawberry.type(name="Query")
class CircuitsQuery: class CircuitsQuery:
circuit: CircuitType = strawberry_django.field(pagination=True) circuit: CircuitType = strawberry_django.field()
circuit_list: List[CircuitType] = strawberry_django.field(pagination=True) circuit_list: List[CircuitType] = strawberry_django.field()
circuit_termination: CircuitTerminationType = strawberry_django.field(pagination=True) circuit_termination: CircuitTerminationType = strawberry_django.field()
circuit_termination_list: List[CircuitTerminationType] = strawberry_django.field(pagination=True) circuit_termination_list: List[CircuitTerminationType] = strawberry_django.field()
circuit_type: CircuitTypeType = strawberry_django.field(pagination=True) circuit_type: CircuitTypeType = strawberry_django.field()
circuit_type_list: List[CircuitTypeType] = strawberry_django.field(pagination=True) circuit_type_list: List[CircuitTypeType] = strawberry_django.field()
circuit_group: CircuitGroupType = strawberry_django.field(pagination=True) circuit_group: CircuitGroupType = strawberry_django.field()
circuit_group_list: List[CircuitGroupType] = strawberry_django.field(pagination=True) circuit_group_list: List[CircuitGroupType] = strawberry_django.field()
circuit_group_assignment: CircuitGroupAssignmentType = strawberry_django.field(pagination=True) circuit_group_assignment: CircuitGroupAssignmentType = strawberry_django.field()
circuit_group_assignment_list: List[CircuitGroupAssignmentType] = strawberry_django.field(pagination=True) circuit_group_assignment_list: List[CircuitGroupAssignmentType] = strawberry_django.field()
provider: ProviderType = strawberry_django.field(pagination=True) provider: ProviderType = strawberry_django.field()
provider_list: List[ProviderType] = strawberry_django.field(pagination=True) provider_list: List[ProviderType] = strawberry_django.field()
provider_account: ProviderAccountType = strawberry_django.field(pagination=True) provider_account: ProviderAccountType = strawberry_django.field()
provider_account_list: List[ProviderAccountType] = strawberry_django.field(pagination=True) provider_account_list: List[ProviderAccountType] = strawberry_django.field()
provider_network: ProviderNetworkType = strawberry_django.field(pagination=True) provider_network: ProviderNetworkType = strawberry_django.field()
provider_network_list: List[ProviderNetworkType] = strawberry_django.field(pagination=True) provider_network_list: List[ProviderNetworkType] = strawberry_django.field()
virtual_circuit: VirtualCircuitType = strawberry_django.field(pagination=True) virtual_circuit: VirtualCircuitType = strawberry_django.field()
virtual_circuit_list: List[VirtualCircuitType] = strawberry_django.field(pagination=True) virtual_circuit_list: List[VirtualCircuitType] = strawberry_django.field()
virtual_circuit_termination: VirtualCircuitTerminationType = strawberry_django.field(pagination=True) virtual_circuit_termination: VirtualCircuitTerminationType = strawberry_django.field()
virtual_circuit_termination_list: List[VirtualCircuitTerminationType] = strawberry_django.field(pagination=True) virtual_circuit_termination_list: List[VirtualCircuitTerminationType] = strawberry_django.field()
virtual_circuit_type: VirtualCircuitTypeType = strawberry_django.field(pagination=True) virtual_circuit_type: VirtualCircuitTypeType = strawberry_django.field()
virtual_circuit_type_list: List[VirtualCircuitTypeType] = strawberry_django.field(pagination=True) virtual_circuit_type_list: List[VirtualCircuitTypeType] = strawberry_django.field()

View File

@ -48,7 +48,6 @@ class ProviderType(NetBoxObjectType, ContactsMixin):
fields='__all__', fields='__all__',
filters=ProviderAccountFilter, filters=ProviderAccountFilter,
pagination=True pagination=True
) )
class ProviderAccountType(NetBoxObjectType): class ProviderAccountType(NetBoxObjectType):
provider: Annotated["ProviderType", strawberry.lazy('circuits.graphql.types')] provider: Annotated["ProviderType", strawberry.lazy('circuits.graphql.types')]
@ -61,7 +60,6 @@ class ProviderAccountType(NetBoxObjectType):
fields='__all__', fields='__all__',
filters=ProviderNetworkFilter, filters=ProviderNetworkFilter,
pagination=True pagination=True
) )
class ProviderNetworkType(NetBoxObjectType): class ProviderNetworkType(NetBoxObjectType):
provider: Annotated["ProviderType", strawberry.lazy('circuits.graphql.types')] provider: Annotated["ProviderType", strawberry.lazy('circuits.graphql.types')]
@ -74,7 +72,6 @@ class ProviderNetworkType(NetBoxObjectType):
exclude=['termination_type', 'termination_id', '_location', '_region', '_site', '_site_group', '_provider_network'], exclude=['termination_type', 'termination_id', '_location', '_region', '_site', '_site_group', '_provider_network'],
filters=CircuitTerminationFilter, filters=CircuitTerminationFilter,
pagination=True pagination=True
) )
class CircuitTerminationType(CustomFieldsMixin, TagsMixin, CabledObjectMixin, ObjectType): class CircuitTerminationType(CustomFieldsMixin, TagsMixin, CabledObjectMixin, ObjectType):
circuit: Annotated["CircuitType", strawberry.lazy('circuits.graphql.types')] circuit: Annotated["CircuitType", strawberry.lazy('circuits.graphql.types')]
@ -95,7 +92,6 @@ class CircuitTerminationType(CustomFieldsMixin, TagsMixin, CabledObjectMixin, Ob
fields='__all__', fields='__all__',
filters=CircuitTypeFilter, filters=CircuitTypeFilter,
pagination=True pagination=True
) )
class CircuitTypeType(OrganizationalObjectType): class CircuitTypeType(OrganizationalObjectType):
color: str color: str
@ -108,7 +104,6 @@ class CircuitTypeType(OrganizationalObjectType):
fields='__all__', fields='__all__',
filters=CircuitFilter, filters=CircuitFilter,
pagination=True pagination=True
) )
class CircuitType(NetBoxObjectType, ContactsMixin): class CircuitType(NetBoxObjectType, ContactsMixin):
provider: ProviderType provider: ProviderType
@ -126,7 +121,6 @@ class CircuitType(NetBoxObjectType, ContactsMixin):
fields='__all__', fields='__all__',
filters=CircuitGroupFilter, filters=CircuitGroupFilter,
pagination=True pagination=True
) )
class CircuitGroupType(OrganizationalObjectType): class CircuitGroupType(OrganizationalObjectType):
tenant: TenantType | None tenant: TenantType | None
@ -137,7 +131,6 @@ class CircuitGroupType(OrganizationalObjectType):
exclude=['member_type', 'member_id'], exclude=['member_type', 'member_id'],
filters=CircuitGroupAssignmentFilter, filters=CircuitGroupAssignmentFilter,
pagination=True pagination=True
) )
class CircuitGroupAssignmentType(TagsMixin, BaseObjectType): class CircuitGroupAssignmentType(TagsMixin, BaseObjectType):
group: Annotated["CircuitGroupType", strawberry.lazy('circuits.graphql.types')] group: Annotated["CircuitGroupType", strawberry.lazy('circuits.graphql.types')]
@ -155,7 +148,6 @@ class CircuitGroupAssignmentType(TagsMixin, BaseObjectType):
fields='__all__', fields='__all__',
filters=VirtualCircuitTypeFilter, filters=VirtualCircuitTypeFilter,
pagination=True pagination=True
) )
class VirtualCircuitTypeType(OrganizationalObjectType): class VirtualCircuitTypeType(OrganizationalObjectType):
color: str color: str
@ -168,7 +160,6 @@ class VirtualCircuitTypeType(OrganizationalObjectType):
fields='__all__', fields='__all__',
filters=VirtualCircuitTerminationFilter, filters=VirtualCircuitTerminationFilter,
pagination=True pagination=True
) )
class VirtualCircuitTerminationType(CustomFieldsMixin, TagsMixin, ObjectType): class VirtualCircuitTerminationType(CustomFieldsMixin, TagsMixin, ObjectType):
virtual_circuit: Annotated[ virtual_circuit: Annotated[
@ -186,7 +177,6 @@ class VirtualCircuitTerminationType(CustomFieldsMixin, TagsMixin, ObjectType):
fields='__all__', fields='__all__',
filters=VirtualCircuitFilter, filters=VirtualCircuitFilter,
pagination=True pagination=True
) )
class VirtualCircuitType(NetBoxObjectType): class VirtualCircuitType(NetBoxObjectType):
provider_network: ProviderNetworkType = strawberry_django.field(select_related=["provider_network"]) provider_network: ProviderNetworkType = strawberry_django.field(select_related=["provider_network"])

View File

@ -8,128 +8,128 @@ from .types import *
@strawberry.type(name="Query") @strawberry.type(name="Query")
class DCIMQuery: class DCIMQuery:
cable: CableType = strawberry_django.field(pagination=True) cable: CableType = strawberry_django.field()
cable_list: List[CableType] = strawberry_django.field(pagination=True) cable_list: List[CableType] = strawberry_django.field()
console_port: ConsolePortType = strawberry_django.field(pagination=True) console_port: ConsolePortType = strawberry_django.field()
console_port_list: List[ConsolePortType] = strawberry_django.field(pagination=True) console_port_list: List[ConsolePortType] = strawberry_django.field()
console_port_template: ConsolePortTemplateType = strawberry_django.field(pagination=True) console_port_template: ConsolePortTemplateType = strawberry_django.field()
console_port_template_list: List[ConsolePortTemplateType] = strawberry_django.field(pagination=True) console_port_template_list: List[ConsolePortTemplateType] = strawberry_django.field()
console_server_port: ConsoleServerPortType = strawberry_django.field(pagination=True) console_server_port: ConsoleServerPortType = strawberry_django.field()
console_server_port_list: List[ConsoleServerPortType] = strawberry_django.field(pagination=True) console_server_port_list: List[ConsoleServerPortType] = strawberry_django.field()
console_server_port_template: ConsoleServerPortTemplateType = strawberry_django.field(pagination=True) console_server_port_template: ConsoleServerPortTemplateType = strawberry_django.field()
console_server_port_template_list: List[ConsoleServerPortTemplateType] = strawberry_django.field(pagination=True) console_server_port_template_list: List[ConsoleServerPortTemplateType] = strawberry_django.field()
device: DeviceType = strawberry_django.field(pagination=True) device: DeviceType = strawberry_django.field()
device_list: List[DeviceType] = strawberry_django.field(pagination=True) device_list: List[DeviceType] = strawberry_django.field()
device_bay: DeviceBayType = strawberry_django.field(pagination=True) device_bay: DeviceBayType = strawberry_django.field()
device_bay_list: List[DeviceBayType] = strawberry_django.field(pagination=True) device_bay_list: List[DeviceBayType] = strawberry_django.field()
device_bay_template: DeviceBayTemplateType = strawberry_django.field(pagination=True) device_bay_template: DeviceBayTemplateType = strawberry_django.field()
device_bay_template_list: List[DeviceBayTemplateType] = strawberry_django.field(pagination=True) device_bay_template_list: List[DeviceBayTemplateType] = strawberry_django.field()
device_role: DeviceRoleType = strawberry_django.field(pagination=True) device_role: DeviceRoleType = strawberry_django.field()
device_role_list: List[DeviceRoleType] = strawberry_django.field(pagination=True) device_role_list: List[DeviceRoleType] = strawberry_django.field()
device_type: DeviceTypeType = strawberry_django.field(pagination=True) device_type: DeviceTypeType = strawberry_django.field()
device_type_list: List[DeviceTypeType] = strawberry_django.field(pagination=True) device_type_list: List[DeviceTypeType] = strawberry_django.field()
front_port: FrontPortType = strawberry_django.field(pagination=True) front_port: FrontPortType = strawberry_django.field()
front_port_list: List[FrontPortType] = strawberry_django.field(pagination=True) front_port_list: List[FrontPortType] = strawberry_django.field()
front_port_template: FrontPortTemplateType = strawberry_django.field(pagination=True) front_port_template: FrontPortTemplateType = strawberry_django.field()
front_port_template_list: List[FrontPortTemplateType] = strawberry_django.field(pagination=True) front_port_template_list: List[FrontPortTemplateType] = strawberry_django.field()
mac_address: MACAddressType = strawberry_django.field(pagination=True) mac_address: MACAddressType = strawberry_django.field()
mac_address_list: List[MACAddressType] = strawberry_django.field(pagination=True) mac_address_list: List[MACAddressType] = strawberry_django.field()
interface: InterfaceType = strawberry_django.field(pagination=True) interface: InterfaceType = strawberry_django.field()
interface_list: List[InterfaceType] = strawberry_django.field(pagination=True) interface_list: List[InterfaceType] = strawberry_django.field()
interface_template: InterfaceTemplateType = strawberry_django.field(pagination=True) interface_template: InterfaceTemplateType = strawberry_django.field()
interface_template_list: List[InterfaceTemplateType] = strawberry_django.field(pagination=True) interface_template_list: List[InterfaceTemplateType] = strawberry_django.field()
inventory_item: InventoryItemType = strawberry_django.field(pagination=True) inventory_item: InventoryItemType = strawberry_django.field()
inventory_item_list: List[InventoryItemType] = strawberry_django.field(pagination=True) inventory_item_list: List[InventoryItemType] = strawberry_django.field()
inventory_item_role: InventoryItemRoleType = strawberry_django.field(pagination=True) inventory_item_role: InventoryItemRoleType = strawberry_django.field()
inventory_item_role_list: List[InventoryItemRoleType] = strawberry_django.field(pagination=True) inventory_item_role_list: List[InventoryItemRoleType] = strawberry_django.field()
inventory_item_template: InventoryItemTemplateType = strawberry_django.field(pagination=True) inventory_item_template: InventoryItemTemplateType = strawberry_django.field()
inventory_item_template_list: List[InventoryItemTemplateType] = strawberry_django.field(pagination=True) inventory_item_template_list: List[InventoryItemTemplateType] = strawberry_django.field()
location: LocationType = strawberry_django.field(pagination=True) location: LocationType = strawberry_django.field()
location_list: List[LocationType] = strawberry_django.field(pagination=True) location_list: List[LocationType] = strawberry_django.field()
manufacturer: ManufacturerType = strawberry_django.field(pagination=True) manufacturer: ManufacturerType = strawberry_django.field()
manufacturer_list: List[ManufacturerType] = strawberry_django.field(pagination=True) manufacturer_list: List[ManufacturerType] = strawberry_django.field()
module: ModuleType = strawberry_django.field(pagination=True) module: ModuleType = strawberry_django.field()
module_list: List[ModuleType] = strawberry_django.field(pagination=True) module_list: List[ModuleType] = strawberry_django.field()
module_bay: ModuleBayType = strawberry_django.field(pagination=True) module_bay: ModuleBayType = strawberry_django.field()
module_bay_list: List[ModuleBayType] = strawberry_django.field(pagination=True) module_bay_list: List[ModuleBayType] = strawberry_django.field()
module_bay_template: ModuleBayTemplateType = strawberry_django.field(pagination=True) module_bay_template: ModuleBayTemplateType = strawberry_django.field()
module_bay_template_list: List[ModuleBayTemplateType] = strawberry_django.field(pagination=True) module_bay_template_list: List[ModuleBayTemplateType] = strawberry_django.field()
module_type: ModuleTypeType = strawberry_django.field(pagination=True) module_type: ModuleTypeType = strawberry_django.field()
module_type_list: List[ModuleTypeType] = strawberry_django.field(pagination=True) module_type_list: List[ModuleTypeType] = strawberry_django.field()
platform: PlatformType = strawberry_django.field(pagination=True) platform: PlatformType = strawberry_django.field()
platform_list: List[PlatformType] = strawberry_django.field(pagination=True) platform_list: List[PlatformType] = strawberry_django.field()
power_feed: PowerFeedType = strawberry_django.field(pagination=True) power_feed: PowerFeedType = strawberry_django.field()
power_feed_list: List[PowerFeedType] = strawberry_django.field(pagination=True) power_feed_list: List[PowerFeedType] = strawberry_django.field()
power_outlet: PowerOutletType = strawberry_django.field(pagination=True) power_outlet: PowerOutletType = strawberry_django.field()
power_outlet_list: List[PowerOutletType] = strawberry_django.field(pagination=True) power_outlet_list: List[PowerOutletType] = strawberry_django.field()
power_outlet_template: PowerOutletTemplateType = strawberry_django.field(pagination=True) power_outlet_template: PowerOutletTemplateType = strawberry_django.field()
power_outlet_template_list: List[PowerOutletTemplateType] = strawberry_django.field(pagination=True) power_outlet_template_list: List[PowerOutletTemplateType] = strawberry_django.field()
power_panel: PowerPanelType = strawberry_django.field(pagination=True) power_panel: PowerPanelType = strawberry_django.field()
power_panel_list: List[PowerPanelType] = strawberry_django.field(pagination=True) power_panel_list: List[PowerPanelType] = strawberry_django.field()
power_port: PowerPortType = strawberry_django.field(pagination=True) power_port: PowerPortType = strawberry_django.field()
power_port_list: List[PowerPortType] = strawberry_django.field(pagination=True) power_port_list: List[PowerPortType] = strawberry_django.field()
power_port_template: PowerPortTemplateType = strawberry_django.field(pagination=True) power_port_template: PowerPortTemplateType = strawberry_django.field()
power_port_template_list: List[PowerPortTemplateType] = strawberry_django.field(pagination=True) power_port_template_list: List[PowerPortTemplateType] = strawberry_django.field()
rack_type: RackTypeType = strawberry_django.field(pagination=True) rack_type: RackTypeType = strawberry_django.field()
rack_type_list: List[RackTypeType] = strawberry_django.field(pagination=True) rack_type_list: List[RackTypeType] = strawberry_django.field()
rack: RackType = strawberry_django.field(pagination=True) rack: RackType = strawberry_django.field()
rack_list: List[RackType] = strawberry_django.field(pagination=True) rack_list: List[RackType] = strawberry_django.field()
rack_reservation: RackReservationType = strawberry_django.field(pagination=True) rack_reservation: RackReservationType = strawberry_django.field()
rack_reservation_list: List[RackReservationType] = strawberry_django.field(pagination=True) rack_reservation_list: List[RackReservationType] = strawberry_django.field()
rack_role: RackRoleType = strawberry_django.field(pagination=True) rack_role: RackRoleType = strawberry_django.field()
rack_role_list: List[RackRoleType] = strawberry_django.field(pagination=True) rack_role_list: List[RackRoleType] = strawberry_django.field()
rear_port: RearPortType = strawberry_django.field(pagination=True) rear_port: RearPortType = strawberry_django.field()
rear_port_list: List[RearPortType] = strawberry_django.field(pagination=True) rear_port_list: List[RearPortType] = strawberry_django.field()
rear_port_template: RearPortTemplateType = strawberry_django.field(pagination=True) rear_port_template: RearPortTemplateType = strawberry_django.field()
rear_port_template_list: List[RearPortTemplateType] = strawberry_django.field(pagination=True) rear_port_template_list: List[RearPortTemplateType] = strawberry_django.field()
region: RegionType = strawberry_django.field(pagination=True) region: RegionType = strawberry_django.field()
region_list: List[RegionType] = strawberry_django.field(pagination=True) region_list: List[RegionType] = strawberry_django.field()
site: SiteType = strawberry_django.field(pagination=True) site: SiteType = strawberry_django.field()
site_list: List[SiteType] = strawberry_django.field(pagination=True) site_list: List[SiteType] = strawberry_django.field()
site_group: SiteGroupType = strawberry_django.field(pagination=True) site_group: SiteGroupType = strawberry_django.field()
site_group_list: List[SiteGroupType] = strawberry_django.field(pagination=True) site_group_list: List[SiteGroupType] = strawberry_django.field()
virtual_chassis: VirtualChassisType = strawberry_django.field(pagination=True) virtual_chassis: VirtualChassisType = strawberry_django.field()
virtual_chassis_list: List[VirtualChassisType] = strawberry_django.field(pagination=True) virtual_chassis_list: List[VirtualChassisType] = strawberry_django.field()
virtual_device_context: VirtualDeviceContextType = strawberry_django.field(pagination=True) virtual_device_context: VirtualDeviceContextType = strawberry_django.field()
virtual_device_context_list: List[VirtualDeviceContextType] = strawberry_django.field(pagination=True) virtual_device_context_list: List[VirtualDeviceContextType] = strawberry_django.field()

View File

@ -135,7 +135,6 @@ class ModularComponentTemplateType(ComponentTemplateType):
exclude=['termination_type', 'termination_id', '_device', '_rack', '_location', '_site'], exclude=['termination_type', 'termination_id', '_device', '_rack', '_location', '_site'],
filters=CableTerminationFilter, filters=CableTerminationFilter,
pagination=True pagination=True
) )
class CableTerminationType(NetBoxObjectType): class CableTerminationType(NetBoxObjectType):
cable: Annotated["CableType", strawberry.lazy('dcim.graphql.types')] | None cable: Annotated["CableType", strawberry.lazy('dcim.graphql.types')] | None
@ -157,7 +156,6 @@ class CableTerminationType(NetBoxObjectType):
fields='__all__', fields='__all__',
filters=CableFilter, filters=CableFilter,
pagination=True pagination=True
) )
class CableType(NetBoxObjectType): class CableType(NetBoxObjectType):
color: str color: str
@ -195,7 +193,6 @@ class CableType(NetBoxObjectType):
exclude=['_path'], exclude=['_path'],
filters=ConsolePortFilter, filters=ConsolePortFilter,
pagination=True pagination=True
) )
class ConsolePortType(ModularComponentType, CabledObjectMixin, PathEndpointMixin): class ConsolePortType(ModularComponentType, CabledObjectMixin, PathEndpointMixin):
pass pass
@ -206,7 +203,6 @@ class ConsolePortType(ModularComponentType, CabledObjectMixin, PathEndpointMixin
fields='__all__', fields='__all__',
filters=ConsolePortTemplateFilter, filters=ConsolePortTemplateFilter,
pagination=True pagination=True
) )
class ConsolePortTemplateType(ModularComponentTemplateType): class ConsolePortTemplateType(ModularComponentTemplateType):
pass pass
@ -217,7 +213,6 @@ class ConsolePortTemplateType(ModularComponentTemplateType):
exclude=['_path'], exclude=['_path'],
filters=ConsoleServerPortFilter, filters=ConsoleServerPortFilter,
pagination=True pagination=True
) )
class ConsoleServerPortType(ModularComponentType, CabledObjectMixin, PathEndpointMixin): class ConsoleServerPortType(ModularComponentType, CabledObjectMixin, PathEndpointMixin):
pass pass
@ -228,7 +223,6 @@ class ConsoleServerPortType(ModularComponentType, CabledObjectMixin, PathEndpoin
fields='__all__', fields='__all__',
filters=ConsoleServerPortTemplateFilter, filters=ConsoleServerPortTemplateFilter,
pagination=True pagination=True
) )
class ConsoleServerPortTemplateType(ModularComponentTemplateType): class ConsoleServerPortTemplateType(ModularComponentTemplateType):
pass pass
@ -239,7 +233,6 @@ class ConsoleServerPortTemplateType(ModularComponentTemplateType):
fields='__all__', fields='__all__',
filters=DeviceFilter, filters=DeviceFilter,
pagination=True pagination=True
) )
class DeviceType(ConfigContextMixin, ImageAttachmentsMixin, ContactsMixin, NetBoxObjectType): class DeviceType(ConfigContextMixin, ImageAttachmentsMixin, ContactsMixin, NetBoxObjectType):
console_port_count: BigInt console_port_count: BigInt
@ -296,7 +289,6 @@ class DeviceType(ConfigContextMixin, ImageAttachmentsMixin, ContactsMixin, NetBo
fields='__all__', fields='__all__',
filters=DeviceBayFilter, filters=DeviceBayFilter,
pagination=True pagination=True
) )
class DeviceBayType(ComponentType): class DeviceBayType(ComponentType):
installed_device: Annotated["DeviceType", strawberry.lazy('dcim.graphql.types')] | None installed_device: Annotated["DeviceType", strawberry.lazy('dcim.graphql.types')] | None
@ -307,7 +299,6 @@ class DeviceBayType(ComponentType):
fields='__all__', fields='__all__',
filters=DeviceBayTemplateFilter, filters=DeviceBayTemplateFilter,
pagination=True pagination=True
) )
class DeviceBayTemplateType(ComponentTemplateType): class DeviceBayTemplateType(ComponentTemplateType):
pass pass
@ -318,7 +309,6 @@ class DeviceBayTemplateType(ComponentTemplateType):
exclude=['component_type', 'component_id', 'parent'], exclude=['component_type', 'component_id', 'parent'],
filters=InventoryItemTemplateFilter, filters=InventoryItemTemplateFilter,
pagination=True pagination=True
) )
class InventoryItemTemplateType(ComponentTemplateType): class InventoryItemTemplateType(ComponentTemplateType):
role: Annotated["InventoryItemRoleType", strawberry.lazy('dcim.graphql.types')] | None role: Annotated["InventoryItemRoleType", strawberry.lazy('dcim.graphql.types')] | None
@ -346,7 +336,6 @@ class InventoryItemTemplateType(ComponentTemplateType):
fields='__all__', fields='__all__',
filters=DeviceRoleFilter, filters=DeviceRoleFilter,
pagination=True pagination=True
) )
class DeviceRoleType(OrganizationalObjectType): class DeviceRoleType(OrganizationalObjectType):
color: str color: str
@ -361,7 +350,6 @@ class DeviceRoleType(OrganizationalObjectType):
fields='__all__', fields='__all__',
filters=DeviceTypeFilter, filters=DeviceTypeFilter,
pagination=True pagination=True
) )
class DeviceTypeType(NetBoxObjectType): class DeviceTypeType(NetBoxObjectType):
console_port_template_count: BigInt console_port_template_count: BigInt
@ -397,7 +385,6 @@ class DeviceTypeType(NetBoxObjectType):
fields='__all__', fields='__all__',
filters=FrontPortFilter, filters=FrontPortFilter,
pagination=True pagination=True
) )
class FrontPortType(ModularComponentType, CabledObjectMixin): class FrontPortType(ModularComponentType, CabledObjectMixin):
color: str color: str
@ -409,7 +396,6 @@ class FrontPortType(ModularComponentType, CabledObjectMixin):
fields='__all__', fields='__all__',
filters=FrontPortTemplateFilter, filters=FrontPortTemplateFilter,
pagination=True pagination=True
) )
class FrontPortTemplateType(ModularComponentTemplateType): class FrontPortTemplateType(ModularComponentTemplateType):
color: str color: str
@ -421,7 +407,6 @@ class FrontPortTemplateType(ModularComponentTemplateType):
exclude=['assigned_object_type', 'assigned_object_id'], exclude=['assigned_object_type', 'assigned_object_id'],
filters=MACAddressFilter, filters=MACAddressFilter,
pagination=True pagination=True
) )
class MACAddressType(NetBoxObjectType): class MACAddressType(NetBoxObjectType):
mac_address: str mac_address: str
@ -439,7 +424,6 @@ class MACAddressType(NetBoxObjectType):
exclude=['_path'], exclude=['_path'],
filters=InterfaceFilter, filters=InterfaceFilter,
pagination=True pagination=True
) )
class InterfaceType(IPAddressesMixin, ModularComponentType, CabledObjectMixin, PathEndpointMixin): class InterfaceType(IPAddressesMixin, ModularComponentType, CabledObjectMixin, PathEndpointMixin):
_name: str _name: str
@ -482,7 +466,6 @@ class InterfaceTemplateType(ModularComponentTemplateType):
exclude=['component_type', 'component_id', 'parent'], exclude=['component_type', 'component_id', 'parent'],
filters=InventoryItemFilter, filters=InventoryItemFilter,
pagination=True pagination=True
) )
class InventoryItemType(ComponentType): class InventoryItemType(ComponentType):
role: Annotated["InventoryItemRoleType", strawberry.lazy('dcim.graphql.types')] | None role: Annotated["InventoryItemRoleType", strawberry.lazy('dcim.graphql.types')] | None
@ -510,7 +493,6 @@ class InventoryItemType(ComponentType):
fields='__all__', fields='__all__',
filters=InventoryItemRoleFilter, filters=InventoryItemRoleFilter,
pagination=True pagination=True
) )
class InventoryItemRoleType(OrganizationalObjectType): class InventoryItemRoleType(OrganizationalObjectType):
color: str color: str
@ -525,7 +507,6 @@ class InventoryItemRoleType(OrganizationalObjectType):
exclude=['parent'], # bug - temp exclude=['parent'], # bug - temp
filters=LocationFilter, filters=LocationFilter,
pagination=True pagination=True
) )
class LocationType(VLANGroupsMixin, ImageAttachmentsMixin, ContactsMixin, OrganizationalObjectType): class LocationType(VLANGroupsMixin, ImageAttachmentsMixin, ContactsMixin, OrganizationalObjectType):
site: Annotated["SiteType", strawberry.lazy('dcim.graphql.types')] site: Annotated["SiteType", strawberry.lazy('dcim.graphql.types')]
@ -554,7 +535,6 @@ class LocationType(VLANGroupsMixin, ImageAttachmentsMixin, ContactsMixin, Organi
fields='__all__', fields='__all__',
filters=ManufacturerFilter, filters=ManufacturerFilter,
pagination=True pagination=True
) )
class ManufacturerType(OrganizationalObjectType, ContactsMixin): class ManufacturerType(OrganizationalObjectType, ContactsMixin):
@ -570,7 +550,6 @@ class ManufacturerType(OrganizationalObjectType, ContactsMixin):
fields='__all__', fields='__all__',
filters=ModuleFilter, filters=ModuleFilter,
pagination=True pagination=True
) )
class ModuleType(NetBoxObjectType): class ModuleType(NetBoxObjectType):
device: Annotated["DeviceType", strawberry.lazy('dcim.graphql.types')] device: Annotated["DeviceType", strawberry.lazy('dcim.graphql.types')]
@ -592,7 +571,6 @@ class ModuleType(NetBoxObjectType):
exclude=['parent'], exclude=['parent'],
filters=ModuleBayFilter, filters=ModuleBayFilter,
pagination=True pagination=True
) )
class ModuleBayType(ModularComponentType): class ModuleBayType(ModularComponentType):
@ -609,7 +587,6 @@ class ModuleBayType(ModularComponentType):
fields='__all__', fields='__all__',
filters=ModuleBayTemplateFilter, filters=ModuleBayTemplateFilter,
pagination=True pagination=True
) )
class ModuleBayTemplateType(ModularComponentTemplateType): class ModuleBayTemplateType(ModularComponentTemplateType):
pass pass
@ -620,7 +597,6 @@ class ModuleBayTemplateType(ModularComponentTemplateType):
fields='__all__', fields='__all__',
filters=ModuleTypeFilter, filters=ModuleTypeFilter,
pagination=True pagination=True
) )
class ModuleTypeType(NetBoxObjectType): class ModuleTypeType(NetBoxObjectType):
manufacturer: Annotated["ManufacturerType", strawberry.lazy('dcim.graphql.types')] manufacturer: Annotated["ManufacturerType", strawberry.lazy('dcim.graphql.types')]
@ -640,7 +616,6 @@ class ModuleTypeType(NetBoxObjectType):
fields='__all__', fields='__all__',
filters=PlatformFilter, filters=PlatformFilter,
pagination=True pagination=True
) )
class PlatformType(OrganizationalObjectType): class PlatformType(OrganizationalObjectType):
manufacturer: Annotated["ManufacturerType", strawberry.lazy('dcim.graphql.types')] | None manufacturer: Annotated["ManufacturerType", strawberry.lazy('dcim.graphql.types')] | None
@ -655,7 +630,6 @@ class PlatformType(OrganizationalObjectType):
exclude=['_path'], exclude=['_path'],
filters=PowerFeedFilter, filters=PowerFeedFilter,
pagination=True pagination=True
) )
class PowerFeedType(NetBoxObjectType, CabledObjectMixin, PathEndpointMixin): class PowerFeedType(NetBoxObjectType, CabledObjectMixin, PathEndpointMixin):
power_panel: Annotated["PowerPanelType", strawberry.lazy('dcim.graphql.types')] power_panel: Annotated["PowerPanelType", strawberry.lazy('dcim.graphql.types')]
@ -668,7 +642,6 @@ class PowerFeedType(NetBoxObjectType, CabledObjectMixin, PathEndpointMixin):
exclude=['_path'], exclude=['_path'],
filters=PowerOutletFilter, filters=PowerOutletFilter,
pagination=True pagination=True
) )
class PowerOutletType(ModularComponentType, CabledObjectMixin, PathEndpointMixin): class PowerOutletType(ModularComponentType, CabledObjectMixin, PathEndpointMixin):
power_port: Annotated["PowerPortType", strawberry.lazy('dcim.graphql.types')] | None power_port: Annotated["PowerPortType", strawberry.lazy('dcim.graphql.types')] | None
@ -680,7 +653,6 @@ class PowerOutletType(ModularComponentType, CabledObjectMixin, PathEndpointMixin
fields='__all__', fields='__all__',
filters=PowerOutletTemplateFilter, filters=PowerOutletTemplateFilter,
pagination=True pagination=True
) )
class PowerOutletTemplateType(ModularComponentTemplateType): class PowerOutletTemplateType(ModularComponentTemplateType):
power_port: Annotated["PowerPortTemplateType", strawberry.lazy('dcim.graphql.types')] | None power_port: Annotated["PowerPortTemplateType", strawberry.lazy('dcim.graphql.types')] | None
@ -691,7 +663,6 @@ class PowerOutletTemplateType(ModularComponentTemplateType):
fields='__all__', fields='__all__',
filters=PowerPanelFilter, filters=PowerPanelFilter,
pagination=True pagination=True
) )
class PowerPanelType(NetBoxObjectType, ContactsMixin): class PowerPanelType(NetBoxObjectType, ContactsMixin):
site: Annotated["SiteType", strawberry.lazy('dcim.graphql.types')] site: Annotated["SiteType", strawberry.lazy('dcim.graphql.types')]
@ -705,7 +676,6 @@ class PowerPanelType(NetBoxObjectType, ContactsMixin):
exclude=['_path'], exclude=['_path'],
filters=PowerPortFilter, filters=PowerPortFilter,
pagination=True pagination=True
) )
class PowerPortType(ModularComponentType, CabledObjectMixin, PathEndpointMixin): class PowerPortType(ModularComponentType, CabledObjectMixin, PathEndpointMixin):
@ -717,7 +687,6 @@ class PowerPortType(ModularComponentType, CabledObjectMixin, PathEndpointMixin):
fields='__all__', fields='__all__',
filters=PowerPortTemplateFilter, filters=PowerPortTemplateFilter,
pagination=True pagination=True
) )
class PowerPortTemplateType(ModularComponentTemplateType): class PowerPortTemplateType(ModularComponentTemplateType):
poweroutlet_templates: List[Annotated["PowerOutletTemplateType", strawberry.lazy('dcim.graphql.types')]] poweroutlet_templates: List[Annotated["PowerOutletTemplateType", strawberry.lazy('dcim.graphql.types')]]
@ -728,7 +697,6 @@ class PowerPortTemplateType(ModularComponentTemplateType):
fields='__all__', fields='__all__',
filters=RackTypeFilter, filters=RackTypeFilter,
pagination=True pagination=True
) )
class RackTypeType(NetBoxObjectType): class RackTypeType(NetBoxObjectType):
manufacturer: Annotated["ManufacturerType", strawberry.lazy('dcim.graphql.types')] manufacturer: Annotated["ManufacturerType", strawberry.lazy('dcim.graphql.types')]
@ -739,7 +707,6 @@ class RackTypeType(NetBoxObjectType):
fields='__all__', fields='__all__',
filters=RackFilter, filters=RackFilter,
pagination=True pagination=True
) )
class RackType(VLANGroupsMixin, ImageAttachmentsMixin, ContactsMixin, NetBoxObjectType): class RackType(VLANGroupsMixin, ImageAttachmentsMixin, ContactsMixin, NetBoxObjectType):
site: Annotated["SiteType", strawberry.lazy('dcim.graphql.types')] site: Annotated["SiteType", strawberry.lazy('dcim.graphql.types')]
@ -759,7 +726,6 @@ class RackType(VLANGroupsMixin, ImageAttachmentsMixin, ContactsMixin, NetBoxObje
fields='__all__', fields='__all__',
filters=RackReservationFilter, filters=RackReservationFilter,
pagination=True pagination=True
) )
class RackReservationType(NetBoxObjectType): class RackReservationType(NetBoxObjectType):
units: List[int] units: List[int]
@ -773,7 +739,6 @@ class RackReservationType(NetBoxObjectType):
fields='__all__', fields='__all__',
filters=RackRoleFilter, filters=RackRoleFilter,
pagination=True pagination=True
) )
class RackRoleType(OrganizationalObjectType): class RackRoleType(OrganizationalObjectType):
color: str color: str
@ -786,7 +751,6 @@ class RackRoleType(OrganizationalObjectType):
fields='__all__', fields='__all__',
filters=RearPortFilter, filters=RearPortFilter,
pagination=True pagination=True
) )
class RearPortType(ModularComponentType, CabledObjectMixin): class RearPortType(ModularComponentType, CabledObjectMixin):
color: str color: str
@ -799,7 +763,6 @@ class RearPortType(ModularComponentType, CabledObjectMixin):
fields='__all__', fields='__all__',
filters=RearPortTemplateFilter, filters=RearPortTemplateFilter,
pagination=True pagination=True
) )
class RearPortTemplateType(ModularComponentTemplateType): class RearPortTemplateType(ModularComponentTemplateType):
color: str color: str
@ -812,7 +775,6 @@ class RearPortTemplateType(ModularComponentTemplateType):
exclude=['parent'], exclude=['parent'],
filters=RegionFilter, filters=RegionFilter,
pagination=True pagination=True
) )
class RegionType(VLANGroupsMixin, ContactsMixin, OrganizationalObjectType): class RegionType(VLANGroupsMixin, ContactsMixin, OrganizationalObjectType):
@ -839,7 +801,6 @@ class RegionType(VLANGroupsMixin, ContactsMixin, OrganizationalObjectType):
fields='__all__', fields='__all__',
filters=SiteFilter, filters=SiteFilter,
pagination=True pagination=True
) )
class SiteType(VLANGroupsMixin, ImageAttachmentsMixin, ContactsMixin, NetBoxObjectType): class SiteType(VLANGroupsMixin, ImageAttachmentsMixin, ContactsMixin, NetBoxObjectType):
time_zone: str | None time_zone: str | None
@ -875,7 +836,6 @@ class SiteType(VLANGroupsMixin, ImageAttachmentsMixin, ContactsMixin, NetBoxObje
exclude=['parent'], # bug - temp exclude=['parent'], # bug - temp
filters=SiteGroupFilter, filters=SiteGroupFilter,
pagination=True pagination=True
) )
class SiteGroupType(VLANGroupsMixin, ContactsMixin, OrganizationalObjectType): class SiteGroupType(VLANGroupsMixin, ContactsMixin, OrganizationalObjectType):
@ -902,7 +862,6 @@ class SiteGroupType(VLANGroupsMixin, ContactsMixin, OrganizationalObjectType):
fields='__all__', fields='__all__',
filters=VirtualChassisFilter, filters=VirtualChassisFilter,
pagination=True pagination=True
) )
class VirtualChassisType(NetBoxObjectType): class VirtualChassisType(NetBoxObjectType):
member_count: BigInt member_count: BigInt
@ -916,7 +875,6 @@ class VirtualChassisType(NetBoxObjectType):
fields='__all__', fields='__all__',
filters=VirtualDeviceContextFilter, filters=VirtualDeviceContextFilter,
pagination=True pagination=True
) )
class VirtualDeviceContextType(NetBoxObjectType): class VirtualDeviceContextType(NetBoxObjectType):
device: Annotated["DeviceType", strawberry.lazy('dcim.graphql.types')] | None device: Annotated["DeviceType", strawberry.lazy('dcim.graphql.types')] | None

View File

@ -46,7 +46,8 @@ __all__ = (
@strawberry_django.type( @strawberry_django.type(
models.ConfigContext, models.ConfigContext,
fields='__all__', fields='__all__',
filters=ConfigContextFilter filters=ConfigContextFilter,
pagination=True
) )
class ConfigContextType(ObjectType): class ConfigContextType(ObjectType):
data_source: Annotated["DataSourceType", strawberry.lazy('core.graphql.types')] | None data_source: Annotated["DataSourceType", strawberry.lazy('core.graphql.types')] | None
@ -69,7 +70,8 @@ class ConfigContextType(ObjectType):
@strawberry_django.type( @strawberry_django.type(
models.ConfigTemplate, models.ConfigTemplate,
fields='__all__', fields='__all__',
filters=ConfigTemplateFilter filters=ConfigTemplateFilter,
pagination=True
) )
class ConfigTemplateType(TagsMixin, ObjectType): class ConfigTemplateType(TagsMixin, ObjectType):
data_source: Annotated["DataSourceType", strawberry.lazy('core.graphql.types')] | None data_source: Annotated["DataSourceType", strawberry.lazy('core.graphql.types')] | None
@ -84,7 +86,8 @@ class ConfigTemplateType(TagsMixin, ObjectType):
@strawberry_django.type( @strawberry_django.type(
models.CustomField, models.CustomField,
fields='__all__', fields='__all__',
filters=CustomFieldFilter filters=CustomFieldFilter,
pagination=True
) )
class CustomFieldType(ObjectType): class CustomFieldType(ObjectType):
related_object_type: Annotated["ContentTypeType", strawberry.lazy('netbox.graphql.types')] | None related_object_type: Annotated["ContentTypeType", strawberry.lazy('netbox.graphql.types')] | None
@ -94,7 +97,8 @@ class CustomFieldType(ObjectType):
@strawberry_django.type( @strawberry_django.type(
models.CustomFieldChoiceSet, models.CustomFieldChoiceSet,
exclude=['extra_choices'], exclude=['extra_choices'],
filters=CustomFieldChoiceSetFilter filters=CustomFieldChoiceSetFilter,
pagination=True
) )
class CustomFieldChoiceSetType(ObjectType): class CustomFieldChoiceSetType(ObjectType):
@ -105,7 +109,8 @@ class CustomFieldChoiceSetType(ObjectType):
@strawberry_django.type( @strawberry_django.type(
models.CustomLink, models.CustomLink,
fields='__all__', fields='__all__',
filters=CustomLinkFilter filters=CustomLinkFilter,
pagination=True
) )
class CustomLinkType(ObjectType): class CustomLinkType(ObjectType):
pass pass
@ -114,7 +119,8 @@ class CustomLinkType(ObjectType):
@strawberry_django.type( @strawberry_django.type(
models.ExportTemplate, models.ExportTemplate,
fields='__all__', fields='__all__',
filters=ExportTemplateFilter filters=ExportTemplateFilter,
pagination=True
) )
class ExportTemplateType(ObjectType): class ExportTemplateType(ObjectType):
data_source: Annotated["DataSourceType", strawberry.lazy('core.graphql.types')] | None data_source: Annotated["DataSourceType", strawberry.lazy('core.graphql.types')] | None
@ -124,7 +130,8 @@ class ExportTemplateType(ObjectType):
@strawberry_django.type( @strawberry_django.type(
models.ImageAttachment, models.ImageAttachment,
fields='__all__', fields='__all__',
filters=ImageAttachmentFilter filters=ImageAttachmentFilter,
pagination=True
) )
class ImageAttachmentType(BaseObjectType): class ImageAttachmentType(BaseObjectType):
object_type: Annotated["ContentTypeType", strawberry.lazy('netbox.graphql.types')] | None object_type: Annotated["ContentTypeType", strawberry.lazy('netbox.graphql.types')] | None
@ -133,7 +140,8 @@ class ImageAttachmentType(BaseObjectType):
@strawberry_django.type( @strawberry_django.type(
models.JournalEntry, models.JournalEntry,
fields='__all__', fields='__all__',
filters=JournalEntryFilter filters=JournalEntryFilter,
pagination=True
) )
class JournalEntryType(CustomFieldsMixin, TagsMixin, ObjectType): class JournalEntryType(CustomFieldsMixin, TagsMixin, ObjectType):
assigned_object_type: Annotated["ContentTypeType", strawberry.lazy('netbox.graphql.types')] | None assigned_object_type: Annotated["ContentTypeType", strawberry.lazy('netbox.graphql.types')] | None
@ -150,7 +158,8 @@ class NotificationType(ObjectType):
@strawberry_django.type( @strawberry_django.type(
models.NotificationGroup, models.NotificationGroup,
filters=NotificationGroupFilter filters=NotificationGroupFilter,
pagination=True
) )
class NotificationGroupType(ObjectType): class NotificationGroupType(ObjectType):
users: List[Annotated["UserType", strawberry.lazy('users.graphql.types')]] users: List[Annotated["UserType", strawberry.lazy('users.graphql.types')]]
@ -160,7 +169,8 @@ class NotificationGroupType(ObjectType):
@strawberry_django.type( @strawberry_django.type(
models.SavedFilter, models.SavedFilter,
exclude=['content_types',], exclude=['content_types',],
filters=SavedFilterFilter filters=SavedFilterFilter,
pagination=True
) )
class SavedFilterType(ObjectType): class SavedFilterType(ObjectType):
user: Annotated["UserType", strawberry.lazy('users.graphql.types')] | None user: Annotated["UserType", strawberry.lazy('users.graphql.types')] | None
@ -177,7 +187,8 @@ class SubscriptionType(ObjectType):
@strawberry_django.type( @strawberry_django.type(
models.Tag, models.Tag,
exclude=['extras_taggeditem_items', ], exclude=['extras_taggeditem_items', ],
filters=TagFilter filters=TagFilter,
pagination=True
) )
class TagType(ObjectType): class TagType(ObjectType):
color: str color: str
@ -188,7 +199,8 @@ class TagType(ObjectType):
@strawberry_django.type( @strawberry_django.type(
models.Webhook, models.Webhook,
exclude=['content_types',], exclude=['content_types',],
filters=WebhookFilter filters=WebhookFilter,
pagination=True
) )
class WebhookType(OrganizationalObjectType): class WebhookType(OrganizationalObjectType):
pass pass
@ -197,7 +209,8 @@ class WebhookType(OrganizationalObjectType):
@strawberry_django.type( @strawberry_django.type(
models.EventRule, models.EventRule,
exclude=['content_types',], exclude=['content_types',],
filters=EventRuleFilter filters=EventRuleFilter,
pagination=True
) )
class EventRuleType(OrganizationalObjectType): class EventRuleType(OrganizationalObjectType):
action_object_type: Annotated["ContentTypeType", strawberry.lazy('netbox.graphql.types')] | None action_object_type: Annotated["ContentTypeType", strawberry.lazy('netbox.graphql.types')] | None

View File

@ -145,7 +145,6 @@ class FHRPGroupAssignmentType(BaseObjectType):
exclude=['assigned_object_type', 'assigned_object_id', 'address'], exclude=['assigned_object_type', 'assigned_object_id', 'address'],
filters=IPAddressFilter, filters=IPAddressFilter,
pagination=True pagination=True
) )
class IPAddressType(NetBoxObjectType, BaseIPAddressFamilyType): class IPAddressType(NetBoxObjectType, BaseIPAddressFamilyType):
address: str address: str
@ -354,7 +353,8 @@ class VLANTranslationRuleType(NetBoxObjectType):
@strawberry_django.type( @strawberry_django.type(
models.VRF, models.VRF,
fields='__all__', fields='__all__',
filters=VRFFilter filters=VRFFilter,
pagination=True
) )
class VRFType(NetBoxObjectType): class VRFType(NetBoxObjectType):
tenant: Annotated["TenantType", strawberry.lazy('tenancy.graphql.types')] | None tenant: Annotated["TenantType", strawberry.lazy('tenancy.graphql.types')] | None

View File

@ -788,7 +788,7 @@ LOCALE_PATHS = (
STRAWBERRY_DJANGO = { STRAWBERRY_DJANGO = {
"DEFAULT_PK_FIELD_NAME": "id", "DEFAULT_PK_FIELD_NAME": "id",
"TYPE_DESCRIPTION_FROM_MODEL_DOCSTRING": True, "TYPE_DESCRIPTION_FROM_MODEL_DOCSTRING": True,
"PAGINATION_DEFAULT_LIMIT": 11, "PAGINATION_DEFAULT_LIMIT": 100,
} }
# #

View File

@ -52,7 +52,12 @@ __all__ = (
# #
@strawberry_django.type(models.Tenant, fields='__all__', filters=TenantFilter) @strawberry_django.type(
models.Tenant,
fields='__all__',
filters=TenantFilter,
pagination=True
)
class TenantType(NetBoxObjectType): class TenantType(NetBoxObjectType):
group: Annotated['TenantGroupType', strawberry.lazy('tenancy.graphql.types')] | None group: Annotated['TenantGroupType', strawberry.lazy('tenancy.graphql.types')] | None
contacts: List[Annotated['ContactType', strawberry.lazy('tenancy.graphql.types')]] contacts: List[Annotated['ContactType', strawberry.lazy('tenancy.graphql.types')]]
@ -82,7 +87,12 @@ class TenantType(NetBoxObjectType):
l2vpns: List[Annotated['L2VPNType', strawberry.lazy('vpn.graphql.types')]] l2vpns: List[Annotated['L2VPNType', strawberry.lazy('vpn.graphql.types')]]
@strawberry_django.type(models.TenantGroup, fields='__all__', filters=TenantGroupFilter) @strawberry_django.type(
models.TenantGroup,
fields='__all__',
filters=TenantGroupFilter,
pagination=True
)
class TenantGroupType(OrganizationalObjectType): class TenantGroupType(OrganizationalObjectType):
parent: Annotated['TenantGroupType', strawberry.lazy('tenancy.graphql.types')] | None parent: Annotated['TenantGroupType', strawberry.lazy('tenancy.graphql.types')] | None
@ -95,17 +105,32 @@ class TenantGroupType(OrganizationalObjectType):
# #
@strawberry_django.type(models.Contact, fields='__all__', filters=ContactFilter) @strawberry_django.type(
models.Contact,
fields='__all__',
filters=ContactFilter,
pagination=True
)
class ContactType(ContactAssignmentsMixin, NetBoxObjectType): class ContactType(ContactAssignmentsMixin, NetBoxObjectType):
group: Annotated['ContactGroupType', strawberry.lazy('tenancy.graphql.types')] | None group: Annotated['ContactGroupType', strawberry.lazy('tenancy.graphql.types')] | None
@strawberry_django.type(models.ContactRole, fields='__all__', filters=ContactRoleFilter) @strawberry_django.type(
models.ContactRole,
fields='__all__',
filters=ContactRoleFilter,
pagination=True
)
class ContactRoleType(ContactAssignmentsMixin, OrganizationalObjectType): class ContactRoleType(ContactAssignmentsMixin, OrganizationalObjectType):
pass pass
@strawberry_django.type(models.ContactGroup, fields='__all__', filters=ContactGroupFilter) @strawberry_django.type(
models.ContactGroup,
fields='__all__',
filters=ContactGroupFilter,
pagination=True
)
class ContactGroupType(OrganizationalObjectType): class ContactGroupType(OrganizationalObjectType):
parent: Annotated['ContactGroupType', strawberry.lazy('tenancy.graphql.types')] | None parent: Annotated['ContactGroupType', strawberry.lazy('tenancy.graphql.types')] | None
@ -113,7 +138,12 @@ class ContactGroupType(OrganizationalObjectType):
children: List[Annotated['ContactGroupType', strawberry.lazy('tenancy.graphql.types')]] children: List[Annotated['ContactGroupType', strawberry.lazy('tenancy.graphql.types')]]
@strawberry_django.type(models.ContactAssignment, fields='__all__', filters=ContactAssignmentFilter) @strawberry_django.type(
models.ContactAssignment,
fields='__all__',
filters=ContactAssignmentFilter,
pagination=True
)
class ContactAssignmentType(CustomFieldsMixin, TagsMixin, BaseObjectType): class ContactAssignmentType(CustomFieldsMixin, TagsMixin, BaseObjectType):
object_type: Annotated['ContentTypeType', strawberry.lazy('netbox.graphql.types')] | None object_type: Annotated['ContentTypeType', strawberry.lazy('netbox.graphql.types')] | None
contact: Annotated['ContactType', strawberry.lazy('tenancy.graphql.types')] | None contact: Annotated['ContactType', strawberry.lazy('tenancy.graphql.types')] | None

View File

@ -15,7 +15,8 @@ __all__ = (
@strawberry_django.type( @strawberry_django.type(
Group, Group,
fields=['id', 'name'], fields=['id', 'name'],
filters=GroupFilter filters=GroupFilter,
pagination=True
) )
class GroupType(BaseObjectType): class GroupType(BaseObjectType):
pass pass
@ -26,7 +27,8 @@ class GroupType(BaseObjectType):
fields=[ fields=[
'id', 'username', 'first_name', 'last_name', 'email', 'is_staff', 'is_active', 'date_joined', 'groups', 'id', 'username', 'first_name', 'last_name', 'email', 'is_staff', 'is_active', 'date_joined', 'groups',
], ],
filters=UserFilter filters=UserFilter,
pagination=True
) )
class UserType(BaseObjectType): class UserType(BaseObjectType):
groups: List[GroupType] groups: List[GroupType]

View File

@ -46,7 +46,8 @@ class ComponentType(NetBoxObjectType):
@strawberry_django.type( @strawberry_django.type(
models.Cluster, models.Cluster,
exclude=['scope_type', 'scope_id', '_location', '_region', '_site', '_site_group'], exclude=['scope_type', 'scope_id', '_location', '_region', '_site', '_site_group'],
filters=ClusterFilter filters=ClusterFilter,
pagination=True
) )
class ClusterType(VLANGroupsMixin, NetBoxObjectType): class ClusterType(VLANGroupsMixin, NetBoxObjectType):
type: Annotated["ClusterTypeType", strawberry.lazy('virtualization.graphql.types')] | None type: Annotated["ClusterTypeType", strawberry.lazy('virtualization.graphql.types')] | None
@ -68,7 +69,8 @@ class ClusterType(VLANGroupsMixin, NetBoxObjectType):
@strawberry_django.type( @strawberry_django.type(
models.ClusterGroup, models.ClusterGroup,
fields='__all__', fields='__all__',
filters=ClusterGroupFilter filters=ClusterGroupFilter,
pagination=True
) )
class ClusterGroupType(VLANGroupsMixin, OrganizationalObjectType): class ClusterGroupType(VLANGroupsMixin, OrganizationalObjectType):
@ -78,7 +80,8 @@ class ClusterGroupType(VLANGroupsMixin, OrganizationalObjectType):
@strawberry_django.type( @strawberry_django.type(
models.ClusterType, models.ClusterType,
fields='__all__', fields='__all__',
filters=ClusterTypeFilter filters=ClusterTypeFilter,
pagination=True
) )
class ClusterTypeType(OrganizationalObjectType): class ClusterTypeType(OrganizationalObjectType):
@ -88,7 +91,8 @@ class ClusterTypeType(OrganizationalObjectType):
@strawberry_django.type( @strawberry_django.type(
models.VirtualMachine, models.VirtualMachine,
fields='__all__', fields='__all__',
filters=VirtualMachineFilter filters=VirtualMachineFilter,
pagination=True
) )
class VirtualMachineType(ConfigContextMixin, ContactsMixin, NetBoxObjectType): class VirtualMachineType(ConfigContextMixin, ContactsMixin, NetBoxObjectType):
interface_count: BigInt interface_count: BigInt
@ -112,7 +116,8 @@ class VirtualMachineType(ConfigContextMixin, ContactsMixin, NetBoxObjectType):
@strawberry_django.type( @strawberry_django.type(
models.VMInterface, models.VMInterface,
fields='__all__', fields='__all__',
filters=VMInterfaceFilter filters=VMInterfaceFilter,
pagination=True
) )
class VMInterfaceType(IPAddressesMixin, ComponentType): class VMInterfaceType(IPAddressesMixin, ComponentType):
_name: str _name: str
@ -134,7 +139,8 @@ class VMInterfaceType(IPAddressesMixin, ComponentType):
@strawberry_django.type( @strawberry_django.type(
models.VirtualDisk, models.VirtualDisk,
fields='__all__', fields='__all__',
filters=VirtualDiskFilter filters=VirtualDiskFilter,
pagination=True
) )
class VirtualDiskType(ComponentType): class VirtualDiskType(ComponentType):
pass pass

View File

@ -32,7 +32,8 @@ __all__ = (
@strawberry_django.type( @strawberry_django.type(
models.TunnelGroup, models.TunnelGroup,
fields='__all__', fields='__all__',
filters=TunnelGroupFilter filters=TunnelGroupFilter,
pagination=True
) )
class TunnelGroupType(OrganizationalObjectType): class TunnelGroupType(OrganizationalObjectType):
@ -42,7 +43,8 @@ class TunnelGroupType(OrganizationalObjectType):
@strawberry_django.type( @strawberry_django.type(
models.TunnelTermination, models.TunnelTermination,
fields='__all__', fields='__all__',
filters=TunnelTerminationFilter filters=TunnelTerminationFilter,
pagination=True
) )
class TunnelTerminationType(CustomFieldsMixin, TagsMixin, ObjectType): class TunnelTerminationType(CustomFieldsMixin, TagsMixin, ObjectType):
tunnel: Annotated["TunnelType", strawberry.lazy('vpn.graphql.types')] tunnel: Annotated["TunnelType", strawberry.lazy('vpn.graphql.types')]
@ -53,7 +55,8 @@ class TunnelTerminationType(CustomFieldsMixin, TagsMixin, ObjectType):
@strawberry_django.type( @strawberry_django.type(
models.Tunnel, models.Tunnel,
fields='__all__', fields='__all__',
filters=TunnelFilter filters=TunnelFilter,
pagination=True
) )
class TunnelType(NetBoxObjectType): class TunnelType(NetBoxObjectType):
group: Annotated["TunnelGroupType", strawberry.lazy('vpn.graphql.types')] | None group: Annotated["TunnelGroupType", strawberry.lazy('vpn.graphql.types')] | None
@ -66,7 +69,8 @@ class TunnelType(NetBoxObjectType):
@strawberry_django.type( @strawberry_django.type(
models.IKEProposal, models.IKEProposal,
fields='__all__', fields='__all__',
filters=IKEProposalFilter filters=IKEProposalFilter,
pagination=True
) )
class IKEProposalType(OrganizationalObjectType): class IKEProposalType(OrganizationalObjectType):
@ -76,7 +80,8 @@ class IKEProposalType(OrganizationalObjectType):
@strawberry_django.type( @strawberry_django.type(
models.IKEPolicy, models.IKEPolicy,
fields='__all__', fields='__all__',
filters=IKEPolicyFilter filters=IKEPolicyFilter,
pagination=True
) )
class IKEPolicyType(OrganizationalObjectType): class IKEPolicyType(OrganizationalObjectType):
@ -87,7 +92,8 @@ class IKEPolicyType(OrganizationalObjectType):
@strawberry_django.type( @strawberry_django.type(
models.IPSecProposal, models.IPSecProposal,
fields='__all__', fields='__all__',
filters=IPSecProposalFilter filters=IPSecProposalFilter,
pagination=True
) )
class IPSecProposalType(OrganizationalObjectType): class IPSecProposalType(OrganizationalObjectType):
@ -97,7 +103,8 @@ class IPSecProposalType(OrganizationalObjectType):
@strawberry_django.type( @strawberry_django.type(
models.IPSecPolicy, models.IPSecPolicy,
fields='__all__', fields='__all__',
filters=IPSecPolicyFilter filters=IPSecPolicyFilter,
pagination=True
) )
class IPSecPolicyType(OrganizationalObjectType): class IPSecPolicyType(OrganizationalObjectType):
@ -108,7 +115,8 @@ class IPSecPolicyType(OrganizationalObjectType):
@strawberry_django.type( @strawberry_django.type(
models.IPSecProfile, models.IPSecProfile,
fields='__all__', fields='__all__',
filters=IPSecProfileFilter filters=IPSecProfileFilter,
pagination=True
) )
class IPSecProfileType(OrganizationalObjectType): class IPSecProfileType(OrganizationalObjectType):
ike_policy: Annotated["IKEPolicyType", strawberry.lazy('vpn.graphql.types')] ike_policy: Annotated["IKEPolicyType", strawberry.lazy('vpn.graphql.types')]
@ -120,7 +128,8 @@ class IPSecProfileType(OrganizationalObjectType):
@strawberry_django.type( @strawberry_django.type(
models.L2VPN, models.L2VPN,
fields='__all__', fields='__all__',
filters=L2VPNFilter filters=L2VPNFilter,
pagination=True
) )
class L2VPNType(ContactsMixin, NetBoxObjectType): class L2VPNType(ContactsMixin, NetBoxObjectType):
tenant: Annotated["TenantType", strawberry.lazy('tenancy.graphql.types')] | None tenant: Annotated["TenantType", strawberry.lazy('tenancy.graphql.types')] | None
@ -133,7 +142,8 @@ class L2VPNType(ContactsMixin, NetBoxObjectType):
@strawberry_django.type( @strawberry_django.type(
models.L2VPNTermination, models.L2VPNTermination,
exclude=['assigned_object_type', 'assigned_object_id'], exclude=['assigned_object_type', 'assigned_object_id'],
filters=L2VPNTerminationFilter filters=L2VPNTerminationFilter,
pagination=True
) )
class L2VPNTerminationType(NetBoxObjectType): class L2VPNTerminationType(NetBoxObjectType):
l2vpn: Annotated["L2VPNType", strawberry.lazy('vpn.graphql.types')] l2vpn: Annotated["L2VPNType", strawberry.lazy('vpn.graphql.types')]

View File

@ -22,7 +22,8 @@ __all__ = (
@strawberry_django.type( @strawberry_django.type(
models.WirelessLANGroup, models.WirelessLANGroup,
fields='__all__', fields='__all__',
filters=WirelessLANGroupFilter filters=WirelessLANGroupFilter,
pagination=True
) )
class WirelessLANGroupType(OrganizationalObjectType): class WirelessLANGroupType(OrganizationalObjectType):
parent: Annotated["WirelessLANGroupType", strawberry.lazy('wireless.graphql.types')] | None parent: Annotated["WirelessLANGroupType", strawberry.lazy('wireless.graphql.types')] | None
@ -34,7 +35,8 @@ class WirelessLANGroupType(OrganizationalObjectType):
@strawberry_django.type( @strawberry_django.type(
models.WirelessLAN, models.WirelessLAN,
exclude=['scope_type', 'scope_id', '_location', '_region', '_site', '_site_group'], exclude=['scope_type', 'scope_id', '_location', '_region', '_site', '_site_group'],
filters=WirelessLANFilter filters=WirelessLANFilter,
pagination=True
) )
class WirelessLANType(NetBoxObjectType): class WirelessLANType(NetBoxObjectType):
group: Annotated["WirelessLANGroupType", strawberry.lazy('wireless.graphql.types')] | None group: Annotated["WirelessLANGroupType", strawberry.lazy('wireless.graphql.types')] | None
@ -56,7 +58,8 @@ class WirelessLANType(NetBoxObjectType):
@strawberry_django.type( @strawberry_django.type(
models.WirelessLink, models.WirelessLink,
fields='__all__', fields='__all__',
filters=WirelessLinkFilter filters=WirelessLinkFilter,
pagination=True
) )
class WirelessLinkType(NetBoxObjectType): class WirelessLinkType(NetBoxObjectType):
interface_a: Annotated["InterfaceType", strawberry.lazy('dcim.graphql.types')] interface_a: Annotated["InterfaceType", strawberry.lazy('dcim.graphql.types')]