Add GraphQL typing

This commit is contained in:
Brian Tiemann 2024-10-10 18:42:14 -04:00
parent 18becdd0b5
commit ae7c67a1d6
5 changed files with 22 additions and 0 deletions

View File

@ -384,6 +384,7 @@ class InterfaceType(IPAddressesMixin, ModularComponentType, CabledObjectMixin, P
wireless_link: Annotated["WirelessLinkType", strawberry.lazy('wireless.graphql.types')] | None
untagged_vlan: Annotated["VLANType", strawberry.lazy('ipam.graphql.types')] | None
vrf: Annotated["VRFType", strawberry.lazy('ipam.graphql.types')] | None
vlan_translation_policy: Annotated["VLANTranslationPolicyType", strawberry.lazy('ipam.graphql.types')] | None
vdcs: List[Annotated["VirtualDeviceContextType", strawberry.lazy('dcim.graphql.types')]]
tagged_vlans: List[Annotated["VLANType", strawberry.lazy('ipam.graphql.types')]]

View File

@ -19,6 +19,7 @@ __all__ = (
'ServiceTemplateFilter',
'VLANFilter',
'VLANGroupFilter',
'VLANTranslationPolicyFilter',
'VRFFilter',
)
@ -113,6 +114,12 @@ class VLANGroupFilter(BaseFilterMixin):
pass
@strawberry_django.filter(models.VLANTranslationPolicy, lookups=True)
@autotype_decorator(filtersets.VLANTranslationPolicyFilterSet)
class VLANTranslationPolicyFilter(BaseFilterMixin):
pass
@strawberry_django.filter(models.VRF, lookups=True)
@autotype_decorator(filtersets.VRFFilterSet)
class VRFFilter(BaseFilterMixin):

View File

@ -53,5 +53,8 @@ class IPAMQuery:
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()
vrf: VRFType = strawberry_django.field()
vrf_list: List[VRFType] = strawberry_django.field()

View File

@ -27,6 +27,7 @@ __all__ = (
'ServiceTemplateType',
'VLANType',
'VLANGroupType',
'VLANTranslationPolicyType',
'VRFType',
)
@ -266,6 +267,15 @@ class VLANGroupType(OrganizationalObjectType):
return self.scope
@strawberry_django.type(
models.VLANTranslationPolicy,
exclude=('scope_type', 'scope_id'),
filters=VLANTranslationPolicyFilter
)
class VLANTranslationPolicyType(NetBoxObjectType):
pass
@strawberry_django.type(
models.VRF,
fields='__all__',

View File

@ -100,6 +100,7 @@ class VMInterfaceType(IPAddressesMixin, ComponentType):
bridge: Annotated["VMInterfaceType", strawberry.lazy('virtualization.graphql.types')] | None
untagged_vlan: Annotated["VLANType", strawberry.lazy('ipam.graphql.types')] | None
vrf: Annotated["VRFType", strawberry.lazy('ipam.graphql.types')] | None
vlan_translation_policy: Annotated["VLANTranslationPolicyType", strawberry.lazy('ipam.graphql.types')] | None
tagged_vlans: List[Annotated["VLANType", strawberry.lazy('ipam.graphql.types')]]
bridge_interfaces: List[Annotated["VMInterfaceType", strawberry.lazy('virtualization.graphql.types')]]