From 0ad440fea57cd5c252f8f9bb972cb257b7b20403 Mon Sep 17 00:00:00 2001 From: Daniel Sheppard Date: Wed, 27 Oct 2021 23:06:09 -0500 Subject: [PATCH] #6732 - GraphQL support --- netbox/ipam/graphql/schema.py | 3 +++ netbox/ipam/graphql/types.py | 9 +++++++++ 2 files changed, 12 insertions(+) diff --git a/netbox/ipam/graphql/schema.py b/netbox/ipam/graphql/schema.py index 58909e57f..aa9f89f2b 100644 --- a/netbox/ipam/graphql/schema.py +++ b/netbox/ipam/graphql/schema.py @@ -5,6 +5,9 @@ from .types import * class IPAMQuery(graphene.ObjectType): + asn = ObjectField(ASNType) + asn_list = ObjectListField(ASNType) + aggregate = ObjectField(AggregateType) aggregate_list = ObjectListField(AggregateType) diff --git a/netbox/ipam/graphql/types.py b/netbox/ipam/graphql/types.py index c822dab6b..0fbe06c50 100644 --- a/netbox/ipam/graphql/types.py +++ b/netbox/ipam/graphql/types.py @@ -2,6 +2,7 @@ from ipam import filtersets, models from netbox.graphql.types import OrganizationalObjectType, PrimaryObjectType __all__ = ( + 'ASNType', 'AggregateType', 'IPAddressType', 'IPRangeType', @@ -16,6 +17,14 @@ __all__ = ( ) +class ASNType(PrimaryObjectType): + + class Meta: + model = models.ASN + fields = '__all__' + filterset_class = filtersets.ASNFilterSet + + class AggregateType(PrimaryObjectType): class Meta: