19724 Use v2 API for new pagination queries
CI / build (20.x, 3.12) (push) Waiting to run
CI / build (20.x, 3.13) (push) Waiting to run

This commit is contained in:
Arthur
2025-10-20 16:52:46 -07:00
parent b7b7b00885
commit 91b2d61ea4
11 changed files with 424 additions and 20 deletions
+38
View File
@@ -1,3 +1,5 @@
from typing import List
import strawberry
import strawberry_django
from strawberry_django.pagination import OffsetPaginated
@@ -5,6 +7,42 @@ from strawberry_django.pagination import OffsetPaginated
from .types import *
@strawberry.type(name="Query")
class CircuitsQueryOld:
circuit: CircuitType = strawberry_django.field()
circuit_list: List[CircuitType] = strawberry_django.field()
circuit_termination: CircuitTerminationType = strawberry_django.field()
circuit_termination_list: List[CircuitTerminationType] = strawberry_django.field()
circuit_type: CircuitTypeType = strawberry_django.field()
circuit_type_list: List[CircuitTypeType] = strawberry_django.field()
circuit_group: CircuitGroupType = strawberry_django.field()
circuit_group_list: List[CircuitGroupType] = strawberry_django.field()
circuit_group_assignment: CircuitGroupAssignmentType = strawberry_django.field()
circuit_group_assignment_list: List[CircuitGroupAssignmentType] = strawberry_django.field()
provider: ProviderType = strawberry_django.field()
provider_list: List[ProviderType] = strawberry_django.field()
provider_account: ProviderAccountType = strawberry_django.field()
provider_account_list: List[ProviderAccountType] = strawberry_django.field()
provider_network: ProviderNetworkType = strawberry_django.field()
provider_network_list: List[ProviderNetworkType] = strawberry_django.field()
virtual_circuit: VirtualCircuitType = strawberry_django.field()
virtual_circuit_list: List[VirtualCircuitType] = strawberry_django.field()
virtual_circuit_termination: VirtualCircuitTerminationType = strawberry_django.field()
virtual_circuit_termination_list: List[VirtualCircuitTerminationType] = strawberry_django.field()
virtual_circuit_type: VirtualCircuitTypeType = strawberry_django.field()
virtual_circuit_type_list: List[VirtualCircuitTypeType] = strawberry_django.field()
@strawberry.type(name="Query")
class CircuitsQuery:
circuit: CircuitType = strawberry_django.field()
+11
View File
@@ -1,3 +1,5 @@
from typing import List
import strawberry
import strawberry_django
from strawberry_django.pagination import OffsetPaginated
@@ -5,6 +7,15 @@ from strawberry_django.pagination import OffsetPaginated
from .types import *
@strawberry.type(name="Query")
class CoreQueryOld:
data_file: DataFileType = strawberry_django.field()
data_file_list: List[DataFileType] = strawberry_django.field()
data_source: DataSourceType = strawberry_django.field()
data_source_list: List[DataSourceType] = strawberry_django.field()
@strawberry.type(name="Query")
class CoreQuery:
data_file: DataFileType = strawberry_django.field()
+134
View File
@@ -1,3 +1,5 @@
from typing import List
import strawberry
import strawberry_django
from strawberry_django.pagination import OffsetPaginated
@@ -5,6 +7,138 @@ from strawberry_django.pagination import OffsetPaginated
from .types import *
@strawberry.type(name="Query")
class DCIMQueryOld:
cable: CableType = strawberry_django.field()
cable_list: List[CableType] = strawberry_django.field()
console_port: ConsolePortType = strawberry_django.field()
console_port_list: List[ConsolePortType] = strawberry_django.field()
console_port_template: ConsolePortTemplateType = strawberry_django.field()
console_port_template_list: List[ConsolePortTemplateType] = strawberry_django.field()
console_server_port: ConsoleServerPortType = strawberry_django.field()
console_server_port_list: List[ConsoleServerPortType] = strawberry_django.field()
console_server_port_template: ConsoleServerPortTemplateType = strawberry_django.field()
console_server_port_template_list: List[ConsoleServerPortTemplateType] = strawberry_django.field()
device: DeviceType = strawberry_django.field()
device_list: List[DeviceType] = strawberry_django.field()
device_bay: DeviceBayType = strawberry_django.field()
device_bay_list: List[DeviceBayType] = strawberry_django.field()
device_bay_template: DeviceBayTemplateType = strawberry_django.field()
device_bay_template_list: List[DeviceBayTemplateType] = strawberry_django.field()
device_role: DeviceRoleType = strawberry_django.field()
device_role_list: List[DeviceRoleType] = strawberry_django.field()
device_type: DeviceTypeType = strawberry_django.field()
device_type_list: List[DeviceTypeType] = strawberry_django.field()
front_port: FrontPortType = strawberry_django.field()
front_port_list: List[FrontPortType] = strawberry_django.field()
front_port_template: FrontPortTemplateType = strawberry_django.field()
front_port_template_list: List[FrontPortTemplateType] = strawberry_django.field()
mac_address: MACAddressType = strawberry_django.field()
mac_address_list: List[MACAddressType] = strawberry_django.field()
interface: InterfaceType = strawberry_django.field()
interface_list: List[InterfaceType] = strawberry_django.field()
interface_template: InterfaceTemplateType = strawberry_django.field()
interface_template_list: List[InterfaceTemplateType] = strawberry_django.field()
inventory_item: InventoryItemType = strawberry_django.field()
inventory_item_list: List[InventoryItemType] = strawberry_django.field()
inventory_item_role: InventoryItemRoleType = strawberry_django.field()
inventory_item_role_list: List[InventoryItemRoleType] = strawberry_django.field()
inventory_item_template: InventoryItemTemplateType = strawberry_django.field()
inventory_item_template_list: List[InventoryItemTemplateType] = strawberry_django.field()
location: LocationType = strawberry_django.field()
location_list: List[LocationType] = strawberry_django.field()
manufacturer: ManufacturerType = strawberry_django.field()
manufacturer_list: List[ManufacturerType] = strawberry_django.field()
module: ModuleType = strawberry_django.field()
module_list: List[ModuleType] = strawberry_django.field()
module_bay: ModuleBayType = strawberry_django.field()
module_bay_list: List[ModuleBayType] = strawberry_django.field()
module_bay_template: ModuleBayTemplateType = strawberry_django.field()
module_bay_template_list: List[ModuleBayTemplateType] = strawberry_django.field()
module_type_profile: ModuleTypeProfileType = strawberry_django.field()
module_type_profile_list: List[ModuleTypeProfileType] = strawberry_django.field()
module_type: ModuleTypeType = strawberry_django.field()
module_type_list: List[ModuleTypeType] = strawberry_django.field()
platform: PlatformType = strawberry_django.field()
platform_list: List[PlatformType] = strawberry_django.field()
power_feed: PowerFeedType = strawberry_django.field()
power_feed_list: List[PowerFeedType] = strawberry_django.field()
power_outlet: PowerOutletType = strawberry_django.field()
power_outlet_list: List[PowerOutletType] = strawberry_django.field()
power_outlet_template: PowerOutletTemplateType = strawberry_django.field()
power_outlet_template_list: List[PowerOutletTemplateType] = strawberry_django.field()
power_panel: PowerPanelType = strawberry_django.field()
power_panel_list: List[PowerPanelType] = strawberry_django.field()
power_port: PowerPortType = strawberry_django.field()
power_port_list: List[PowerPortType] = strawberry_django.field()
power_port_template: PowerPortTemplateType = strawberry_django.field()
power_port_template_list: List[PowerPortTemplateType] = strawberry_django.field()
rack_type: RackTypeType = strawberry_django.field()
rack_type_list: List[RackTypeType] = strawberry_django.field()
rack: RackType = strawberry_django.field()
rack_list: List[RackType] = strawberry_django.field()
rack_reservation: RackReservationType = strawberry_django.field()
rack_reservation_list: List[RackReservationType] = strawberry_django.field()
rack_role: RackRoleType = strawberry_django.field()
rack_role_list: List[RackRoleType] = strawberry_django.field()
rear_port: RearPortType = strawberry_django.field()
rear_port_list: List[RearPortType] = strawberry_django.field()
rear_port_template: RearPortTemplateType = strawberry_django.field()
rear_port_template_list: List[RearPortTemplateType] = strawberry_django.field()
region: RegionType = strawberry_django.field()
region_list: List[RegionType] = strawberry_django.field()
site: SiteType = strawberry_django.field()
site_list: List[SiteType] = strawberry_django.field()
site_group: SiteGroupType = strawberry_django.field()
site_group_list: List[SiteGroupType] = strawberry_django.field()
virtual_chassis: VirtualChassisType = strawberry_django.field()
virtual_chassis_list: List[VirtualChassisType] = strawberry_django.field()
virtual_device_context: VirtualDeviceContextType = strawberry_django.field()
virtual_device_context_list: List[VirtualDeviceContextType] = strawberry_django.field()
@strawberry.type(name="Query")
class DCIMQuery:
cable: CableType = strawberry_django.field()
+56
View File
@@ -1,3 +1,5 @@
from typing import List
import strawberry
import strawberry_django
from strawberry_django.pagination import OffsetPaginated
@@ -5,6 +7,60 @@ from strawberry_django.pagination import OffsetPaginated
from .types import *
@strawberry.type(name="Query")
class ExtrasQueryOld:
config_context: ConfigContextType = strawberry_django.field()
config_context_list: List[ConfigContextType] = strawberry_django.field()
config_context_profile: ConfigContextProfileType = strawberry_django.field()
config_context_profile_list: List[ConfigContextProfileType] = strawberry_django.field()
config_template: ConfigTemplateType = strawberry_django.field()
config_template_list: List[ConfigTemplateType] = strawberry_django.field()
custom_field: CustomFieldType = strawberry_django.field()
custom_field_list: List[CustomFieldType] = strawberry_django.field()
custom_field_choice_set: CustomFieldChoiceSetType = strawberry_django.field()
custom_field_choice_set_list: List[CustomFieldChoiceSetType] = strawberry_django.field()
custom_link: CustomLinkType = strawberry_django.field()
custom_link_list: List[CustomLinkType] = strawberry_django.field()
export_template: ExportTemplateType = strawberry_django.field()
export_template_list: List[ExportTemplateType] = strawberry_django.field()
image_attachment: ImageAttachmentType = strawberry_django.field()
image_attachment_list: List[ImageAttachmentType] = strawberry_django.field()
saved_filter: SavedFilterType = strawberry_django.field()
saved_filter_list: List[SavedFilterType] = strawberry_django.field()
table_config: TableConfigType = strawberry_django.field()
table_config_list: List[TableConfigType] = strawberry_django.field()
journal_entry: JournalEntryType = strawberry_django.field()
journal_entry_list: List[JournalEntryType] = strawberry_django.field()
notification: NotificationType = strawberry_django.field()
notification_list: List[NotificationType] = strawberry_django.field()
notification_group: NotificationGroupType = strawberry_django.field()
notification_group_list: List[NotificationGroupType] = strawberry_django.field()
subscription: SubscriptionType = strawberry_django.field()
subscription_list: List[SubscriptionType] = strawberry_django.field()
tag: TagType = strawberry_django.field()
tag_list: List[TagType] = strawberry_django.field()
webhook: WebhookType = strawberry_django.field()
webhook_list: List[WebhookType] = strawberry_django.field()
event_rule: EventRuleType = strawberry_django.field()
event_rule_list: List[EventRuleType] = strawberry_django.field()
@strawberry.type(name="Query")
class ExtrasQuery:
config_context: ConfigContextType = strawberry_django.field()
+59
View File
@@ -1,3 +1,5 @@
from typing import List
import strawberry
import strawberry_django
from strawberry_django.pagination import OffsetPaginated
@@ -5,6 +7,63 @@ from strawberry_django.pagination import OffsetPaginated
from .types import *
@strawberry.type(name="Query")
class IPAMQueryOld:
asn: ASNType = strawberry_django.field()
asn_list: List[ASNType] = strawberry_django.field()
asn_range: ASNRangeType = strawberry_django.field()
asn_range_list: List[ASNRangeType] = strawberry_django.field()
aggregate: AggregateType = strawberry_django.field()
aggregate_list: List[AggregateType] = strawberry_django.field()
ip_address: IPAddressType = strawberry_django.field()
ip_address_list: List[IPAddressType] = strawberry_django.field()
ip_range: IPRangeType = strawberry_django.field()
ip_range_list: List[IPRangeType] = strawberry_django.field()
prefix: PrefixType = strawberry_django.field()
prefix_list: List[PrefixType] = strawberry_django.field()
rir: RIRType = strawberry_django.field()
rir_list: List[RIRType] = strawberry_django.field()
role: RoleType = strawberry_django.field()
role_list: List[RoleType] = strawberry_django.field()
route_target: RouteTargetType = strawberry_django.field()
route_target_list: List[RouteTargetType] = strawberry_django.field()
service: ServiceType = strawberry_django.field()
service_list: List[ServiceType] = strawberry_django.field()
service_template: ServiceTemplateType = strawberry_django.field()
service_template_list: List[ServiceTemplateType] = strawberry_django.field()
fhrp_group: FHRPGroupType = strawberry_django.field()
fhrp_group_list: List[FHRPGroupType] = strawberry_django.field()
fhrp_group_assignment: FHRPGroupAssignmentType = strawberry_django.field()
fhrp_group_assignment_list: List[FHRPGroupAssignmentType] = strawberry_django.field()
vlan: VLANType = strawberry_django.field()
vlan_list: List[VLANType] = strawberry_django.field()
vlan_group: VLANGroupType = strawberry_django.field()
vlan_group_list: List[VLANGroupType] = strawberry_django.field()
vlan_translation_policy: VLANTranslationPolicyType = strawberry_django.field()
vlan_translation_policy_list: List[VLANTranslationPolicyType] = strawberry_django.field()
vlan_translation_rule: VLANTranslationRuleType = strawberry_django.field()
vlan_translation_rule_list: List[VLANTranslationRuleType] = strawberry_django.field()
vrf: VRFType = strawberry_django.field()
vrf_list: List[VRFType] = strawberry_django.field()
@strawberry.type(name="Query")
class IPAMQuery:
asn: ASNType = strawberry_django.field()
+20 -20
View File
@@ -4,17 +4,17 @@ from strawberry_django.optimizer import DjangoOptimizerExtension
from strawberry.extensions import MaxAliasesLimiter
from strawberry.schema.config import StrawberryConfig
from circuits.graphql.schema import CircuitsQuery
from core.graphql.schema import CoreQuery
from dcim.graphql.schema import DCIMQuery
from extras.graphql.schema import ExtrasQuery
from ipam.graphql.schema import IPAMQuery
from circuits.graphql.schema import CircuitsQuery, CircuitsQueryOld
from core.graphql.schema import CoreQuery, CoreQueryOld
from dcim.graphql.schema import DCIMQuery, DCIMQueryOld
from extras.graphql.schema import ExtrasQuery, ExtrasQueryOld
from ipam.graphql.schema import IPAMQuery, IPAMQueryOld
from netbox.registry import registry
from tenancy.graphql.schema import TenancyQuery
from users.graphql.schema import UsersQuery
from virtualization.graphql.schema import VirtualizationQuery
from vpn.graphql.schema import VPNQuery
from wireless.graphql.schema import WirelessQuery
from tenancy.graphql.schema import TenancyQuery, TenancyQueryOld
from users.graphql.schema import UsersQuery, UsersQueryOld
from virtualization.graphql.schema import VirtualizationQuery, VirtualizationQueryOld
from vpn.graphql.schema import VPNQuery, VPNQueryOld
from wireless.graphql.schema import WirelessQuery, WirelessQueryOld
__all__ = (
'Query',
@@ -27,16 +27,16 @@ __all__ = (
@strawberry.type
class QueryV1(
UsersQuery,
CircuitsQuery,
CoreQuery,
DCIMQuery,
ExtrasQuery,
IPAMQuery,
TenancyQuery,
VirtualizationQuery,
VPNQuery,
WirelessQuery,
UsersQueryOld,
CircuitsQueryOld,
CoreQueryOld,
DCIMQueryOld,
ExtrasQueryOld,
IPAMQueryOld,
TenancyQueryOld,
VirtualizationQueryOld,
VPNQueryOld,
WirelessQueryOld,
*registry['plugins']['graphql_schemas'], # Append plugin schemas
):
"""Query class for GraphQL API v1"""
+23
View File
@@ -1,3 +1,5 @@
from typing import List
import strawberry
import strawberry_django
from strawberry_django.pagination import OffsetPaginated
@@ -5,6 +7,27 @@ from strawberry_django.pagination import OffsetPaginated
from .types import *
@strawberry.type(name="Query")
class TenancyQueryOld:
tenant: TenantType = strawberry_django.field()
tenant_list: List[TenantType] = strawberry_django.field()
tenant_group: TenantGroupType = strawberry_django.field()
tenant_group_list: List[TenantGroupType] = strawberry_django.field()
contact: ContactType = strawberry_django.field()
contact_list: List[ContactType] = strawberry_django.field()
contact_role: ContactRoleType = strawberry_django.field()
contact_role_list: List[ContactRoleType] = strawberry_django.field()
contact_group: ContactGroupType = strawberry_django.field()
contact_group_list: List[ContactGroupType] = strawberry_django.field()
contact_assignment: ContactAssignmentType = strawberry_django.field()
contact_assignment_list: List[ContactAssignmentType] = strawberry_django.field()
@strawberry.type(name="Query")
class TenancyQuery:
tenant: TenantType = strawberry_django.field()
+11
View File
@@ -1,3 +1,5 @@
from typing import List
import strawberry
import strawberry_django
from strawberry_django.pagination import OffsetPaginated
@@ -5,6 +7,15 @@ from strawberry_django.pagination import OffsetPaginated
from .types import *
@strawberry.type(name="Query")
class UsersQueryOld:
group: GroupType = strawberry_django.field()
group_list: List[GroupType] = strawberry_django.field()
user: UserType = strawberry_django.field()
user_list: List[UserType] = strawberry_django.field()
@strawberry.type(name="Query")
class UsersQuery:
group: GroupType = strawberry_django.field()
+23
View File
@@ -1,3 +1,5 @@
from typing import List
import strawberry
import strawberry_django
from strawberry_django.pagination import OffsetPaginated
@@ -5,6 +7,27 @@ from strawberry_django.pagination import OffsetPaginated
from .types import *
@strawberry.type(name="Query")
class VirtualizationQueryOld:
cluster: ClusterType = strawberry_django.field()
cluster_list: List[ClusterType] = strawberry_django.field()
cluster_group: ClusterGroupType = strawberry_django.field()
cluster_group_list: List[ClusterGroupType] = strawberry_django.field()
cluster_type: ClusterTypeType = strawberry_django.field()
cluster_type_list: List[ClusterTypeType] = strawberry_django.field()
virtual_machine: VirtualMachineType = strawberry_django.field()
virtual_machine_list: List[VirtualMachineType] = strawberry_django.field()
vm_interface: VMInterfaceType = strawberry_django.field()
vm_interface_list: List[VMInterfaceType] = strawberry_django.field()
virtual_disk: VirtualDiskType = strawberry_django.field()
virtual_disk_list: List[VirtualDiskType] = strawberry_django.field()
@strawberry.type(name="Query")
class VirtualizationQuery:
cluster: ClusterType = strawberry_django.field()
+35
View File
@@ -1,3 +1,5 @@
from typing import List
import strawberry
import strawberry_django
from strawberry_django.pagination import OffsetPaginated
@@ -5,6 +7,39 @@ from strawberry_django.pagination import OffsetPaginated
from .types import *
@strawberry.type(name="Query")
class VPNQueryOld:
ike_policy: IKEPolicyType = strawberry_django.field()
ike_policy_list: List[IKEPolicyType] = strawberry_django.field()
ike_proposal: IKEProposalType = strawberry_django.field()
ike_proposal_list: List[IKEProposalType] = strawberry_django.field()
ipsec_policy: IPSecPolicyType = strawberry_django.field()
ipsec_policy_list: List[IPSecPolicyType] = strawberry_django.field()
ipsec_profile: IPSecProfileType = strawberry_django.field()
ipsec_profile_list: List[IPSecProfileType] = strawberry_django.field()
ipsec_proposal: IPSecProposalType = strawberry_django.field()
ipsec_proposal_list: List[IPSecProposalType] = strawberry_django.field()
l2vpn: L2VPNType = strawberry_django.field()
l2vpn_list: List[L2VPNType] = strawberry_django.field()
l2vpn_termination: L2VPNTerminationType = strawberry_django.field()
l2vpn_termination_list: List[L2VPNTerminationType] = strawberry_django.field()
tunnel: TunnelType = strawberry_django.field()
tunnel_list: List[TunnelType] = strawberry_django.field()
tunnel_group: TunnelGroupType = strawberry_django.field()
tunnel_group_list: List[TunnelGroupType] = strawberry_django.field()
tunnel_termination: TunnelTerminationType = strawberry_django.field()
tunnel_termination_list: List[TunnelTerminationType] = strawberry_django.field()
@strawberry.type(name="Query")
class VPNQuery:
ike_policy: IKEPolicyType = strawberry_django.field()
+14
View File
@@ -1,3 +1,5 @@
from typing import List
import strawberry
import strawberry_django
from strawberry_django.pagination import OffsetPaginated
@@ -5,6 +7,18 @@ from strawberry_django.pagination import OffsetPaginated
from .types import *
@strawberry.type(name="Query")
class WirelessQueryOld:
wireless_lan: WirelessLANType = strawberry_django.field()
wireless_lan_list: List[WirelessLANType] = strawberry_django.field()
wireless_lan_group: WirelessLANGroupType = strawberry_django.field()
wireless_lan_group_list: List[WirelessLANGroupType] = strawberry_django.field()
wireless_link: WirelessLinkType = strawberry_django.field()
wireless_link_list: List[WirelessLinkType] = strawberry_django.field()
@strawberry.type(name="Query")
class WirelessQuery:
wireless_lan: WirelessLANType = strawberry_django.field()