mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-30 04:16:24 -06:00
Add GraphQL types/filters/schema
This commit is contained in:
parent
a3eb80b975
commit
2536f941cb
@ -23,6 +23,7 @@ __all__ = (
|
|||||||
'InventoryItemFilter',
|
'InventoryItemFilter',
|
||||||
'InventoryItemRoleFilter',
|
'InventoryItemRoleFilter',
|
||||||
'LocationFilter',
|
'LocationFilter',
|
||||||
|
'MACAddressFilter',
|
||||||
'ManufacturerFilter',
|
'ManufacturerFilter',
|
||||||
'ModuleFilter',
|
'ModuleFilter',
|
||||||
'ModuleBayFilter',
|
'ModuleBayFilter',
|
||||||
@ -133,6 +134,12 @@ class FrontPortTemplateFilter(BaseFilterMixin):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
@strawberry_django.filter(models.MACAddress, lookups=True)
|
||||||
|
@autotype_decorator(filtersets.MACAddressFilterSet)
|
||||||
|
class MACAddressFilter(BaseFilterMixin):
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
@strawberry_django.filter(models.Interface, lookups=True)
|
@strawberry_django.filter(models.Interface, lookups=True)
|
||||||
@autotype_decorator(filtersets.InterfaceFilterSet)
|
@autotype_decorator(filtersets.InterfaceFilterSet)
|
||||||
class InterfaceFilter(BaseFilterMixin):
|
class InterfaceFilter(BaseFilterMixin):
|
||||||
|
@ -44,6 +44,9 @@ class DCIMQuery:
|
|||||||
front_port_template: FrontPortTemplateType = strawberry_django.field()
|
front_port_template: FrontPortTemplateType = strawberry_django.field()
|
||||||
front_port_template_list: List[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: InterfaceType = strawberry_django.field()
|
||||||
interface_list: List[InterfaceType] = strawberry_django.field()
|
interface_list: List[InterfaceType] = strawberry_django.field()
|
||||||
|
|
||||||
|
@ -34,6 +34,7 @@ __all__ = (
|
|||||||
'InventoryItemRoleType',
|
'InventoryItemRoleType',
|
||||||
'InventoryItemTemplateType',
|
'InventoryItemTemplateType',
|
||||||
'LocationType',
|
'LocationType',
|
||||||
|
'MACAddressType',
|
||||||
'ManufacturerType',
|
'ManufacturerType',
|
||||||
'ModularComponentType',
|
'ModularComponentType',
|
||||||
'ModuleType',
|
'ModuleType',
|
||||||
@ -371,13 +372,21 @@ class FrontPortTemplateType(ModularComponentTemplateType):
|
|||||||
rear_port: Annotated["RearPortTemplateType", strawberry.lazy('dcim.graphql.types')]
|
rear_port: Annotated["RearPortTemplateType", strawberry.lazy('dcim.graphql.types')]
|
||||||
|
|
||||||
|
|
||||||
|
@strawberry_django.type(
|
||||||
|
models.MACAddress,
|
||||||
|
fields='__all__',
|
||||||
|
filters=MACAddressFilter
|
||||||
|
)
|
||||||
|
class MACAddressType(NetBoxObjectType):
|
||||||
|
mac_address: str
|
||||||
|
|
||||||
|
|
||||||
@strawberry_django.type(
|
@strawberry_django.type(
|
||||||
models.Interface,
|
models.Interface,
|
||||||
exclude=('_path',),
|
exclude=('_path',),
|
||||||
filters=InterfaceFilter
|
filters=InterfaceFilter
|
||||||
)
|
)
|
||||||
class InterfaceType(IPAddressesMixin, ModularComponentType, CabledObjectMixin, PathEndpointMixin):
|
class InterfaceType(IPAddressesMixin, ModularComponentType, CabledObjectMixin, PathEndpointMixin):
|
||||||
# _mac_address: str | None
|
|
||||||
wwn: str | None
|
wwn: str | None
|
||||||
parent: Annotated["InterfaceType", strawberry.lazy('dcim.graphql.types')] | None
|
parent: Annotated["InterfaceType", strawberry.lazy('dcim.graphql.types')] | None
|
||||||
bridge: Annotated["InterfaceType", strawberry.lazy('dcim.graphql.types')] | None
|
bridge: Annotated["InterfaceType", strawberry.lazy('dcim.graphql.types')] | None
|
||||||
@ -393,6 +402,7 @@ class InterfaceType(IPAddressesMixin, ModularComponentType, CabledObjectMixin, P
|
|||||||
wireless_lans: List[Annotated["WirelessLANType", strawberry.lazy('wireless.graphql.types')]]
|
wireless_lans: List[Annotated["WirelessLANType", strawberry.lazy('wireless.graphql.types')]]
|
||||||
member_interfaces: List[Annotated["InterfaceType", strawberry.lazy('dcim.graphql.types')]]
|
member_interfaces: List[Annotated["InterfaceType", strawberry.lazy('dcim.graphql.types')]]
|
||||||
child_interfaces: List[Annotated["InterfaceType", strawberry.lazy('dcim.graphql.types')]]
|
child_interfaces: List[Annotated["InterfaceType", strawberry.lazy('dcim.graphql.types')]]
|
||||||
|
mac_addresses: List[Annotated["MACAddressType", strawberry.lazy('dcim.graphql.types')]]
|
||||||
|
|
||||||
|
|
||||||
@strawberry_django.type(
|
@strawberry_django.type(
|
||||||
|
@ -95,7 +95,6 @@ class VirtualMachineType(ConfigContextMixin, ContactsMixin, NetBoxObjectType):
|
|||||||
filters=VMInterfaceFilter
|
filters=VMInterfaceFilter
|
||||||
)
|
)
|
||||||
class VMInterfaceType(IPAddressesMixin, ComponentType):
|
class VMInterfaceType(IPAddressesMixin, ComponentType):
|
||||||
# _mac_address: str | None
|
|
||||||
parent: Annotated["VMInterfaceType", strawberry.lazy('virtualization.graphql.types')] | None
|
parent: Annotated["VMInterfaceType", strawberry.lazy('virtualization.graphql.types')] | None
|
||||||
bridge: Annotated["VMInterfaceType", strawberry.lazy('virtualization.graphql.types')] | None
|
bridge: Annotated["VMInterfaceType", strawberry.lazy('virtualization.graphql.types')] | None
|
||||||
untagged_vlan: Annotated["VLANType", strawberry.lazy('ipam.graphql.types')] | None
|
untagged_vlan: Annotated["VLANType", strawberry.lazy('ipam.graphql.types')] | None
|
||||||
@ -105,6 +104,7 @@ class VMInterfaceType(IPAddressesMixin, ComponentType):
|
|||||||
tagged_vlans: List[Annotated["VLANType", strawberry.lazy('ipam.graphql.types')]]
|
tagged_vlans: List[Annotated["VLANType", strawberry.lazy('ipam.graphql.types')]]
|
||||||
bridge_interfaces: List[Annotated["VMInterfaceType", strawberry.lazy('virtualization.graphql.types')]]
|
bridge_interfaces: List[Annotated["VMInterfaceType", strawberry.lazy('virtualization.graphql.types')]]
|
||||||
child_interfaces: List[Annotated["VMInterfaceType", strawberry.lazy('virtualization.graphql.types')]]
|
child_interfaces: List[Annotated["VMInterfaceType", strawberry.lazy('virtualization.graphql.types')]]
|
||||||
|
mac_addresses: List[Annotated["MACAddressType", strawberry.lazy('dcim.graphql.types')]]
|
||||||
|
|
||||||
|
|
||||||
@strawberry_django.type(
|
@strawberry_django.type(
|
||||||
|
Loading…
Reference in New Issue
Block a user