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 wireless_link: Annotated["WirelessLinkType", strawberry.lazy('wireless.graphql.types')] | None
untagged_vlan: Annotated["VLANType", strawberry.lazy('ipam.graphql.types')] | None untagged_vlan: Annotated["VLANType", strawberry.lazy('ipam.graphql.types')] | None
vrf: Annotated["VRFType", 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')]] vdcs: List[Annotated["VirtualDeviceContextType", strawberry.lazy('dcim.graphql.types')]]
tagged_vlans: List[Annotated["VLANType", strawberry.lazy('ipam.graphql.types')]] tagged_vlans: List[Annotated["VLANType", strawberry.lazy('ipam.graphql.types')]]

View File

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

View File

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

View File

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

View File

@ -100,6 +100,7 @@ class VMInterfaceType(IPAddressesMixin, ComponentType):
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
vrf: Annotated["VRFType", 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')]] 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')]]