mirror of
https://github.com/lucaspalomodevelop/netbox-acls.git
synced 2026-03-12 23:27:23 +00:00
updated graphql api (#140)
This commit is contained in:
parent
269354f3c0
commit
1cdc9a4924
2
netbox_acls/graphql/__init__.py
Normal file
2
netbox_acls/graphql/__init__.py
Normal file
@ -0,0 +1,2 @@
|
||||
from .schema import *
|
||||
from .types import *
|
||||
21
netbox_acls/graphql/schema.py
Normal file
21
netbox_acls/graphql/schema.py
Normal file
@ -0,0 +1,21 @@
|
||||
from graphene import ObjectType
|
||||
from netbox.graphql.fields import ObjectField, ObjectListField
|
||||
|
||||
from .types import *
|
||||
|
||||
class Query(ObjectType):
|
||||
"""
|
||||
Defines the queries available to this plugin via the graphql api.
|
||||
"""
|
||||
|
||||
access_list = ObjectField(AccessListType)
|
||||
access_list_list = ObjectListField(AccessListType)
|
||||
|
||||
acl_extended_rule = ObjectField(ACLExtendedRuleType)
|
||||
acl_extended_rule_list = ObjectListField(ACLExtendedRuleType)
|
||||
|
||||
acl_standard_rule = ObjectField(ACLStandardRuleType)
|
||||
acl_standard_rule_list = ObjectListField(ACLStandardRuleType)
|
||||
|
||||
|
||||
schema = Query
|
||||
@ -2,11 +2,9 @@
|
||||
Define the object types and queries availble via the graphql api.
|
||||
"""
|
||||
|
||||
from graphene import ObjectType
|
||||
from netbox.graphql.fields import ObjectField, ObjectListField
|
||||
from netbox.graphql.types import NetBoxObjectType
|
||||
|
||||
from . import filtersets, models
|
||||
from .. import filtersets, models
|
||||
|
||||
__all__ = (
|
||||
"AccessListType",
|
||||
@ -15,10 +13,6 @@ __all__ = (
|
||||
"ACLStandardRuleType",
|
||||
)
|
||||
|
||||
#
|
||||
# Object types
|
||||
#
|
||||
|
||||
|
||||
class AccessListType(NetBoxObjectType):
|
||||
"""
|
||||
@ -79,25 +73,3 @@ class ACLStandardRuleType(NetBoxObjectType):
|
||||
fields = "__all__"
|
||||
filterset_class = filtersets.ACLStandardRuleFilterSet
|
||||
|
||||
|
||||
#
|
||||
# Queries
|
||||
#
|
||||
|
||||
|
||||
class Query(ObjectType):
|
||||
"""
|
||||
Defines the queries availible to this plugin via the graphql api.
|
||||
"""
|
||||
|
||||
access_list = ObjectField(AccessListType)
|
||||
access_list_list = ObjectListField(AccessListType)
|
||||
|
||||
acl_extended_rule = ObjectField(ACLExtendedRuleType)
|
||||
acl_extended_rule_list = ObjectListField(ACLExtendedRuleType)
|
||||
|
||||
acl_standard_rule = ObjectField(ACLStandardRuleType)
|
||||
acl_standard_rule_list = ObjectListField(ACLStandardRuleType)
|
||||
|
||||
|
||||
schema = Query
|
||||
@ -17,11 +17,7 @@ class AppTest(APITestCase):
|
||||
|
||||
|
||||
class ACLTestCase(
|
||||
APIViewTestCases.GetObjectViewTestCase,
|
||||
APIViewTestCases.ListObjectsViewTestCase,
|
||||
APIViewTestCases.CreateObjectViewTestCase,
|
||||
APIViewTestCases.UpdateObjectViewTestCase,
|
||||
APIViewTestCases.DeleteObjectViewTestCase,
|
||||
APIViewTestCases.APIViewTestCase,
|
||||
):
|
||||
"""Test the AccessList Test"""
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user