Skip to content

Commit bf808bc

Browse files
committed
feat(graphql): Add support for ACL Interface Assignments
Introduces ACLInterfaceAssignmentType to GraphQL schema and type definitions. Adds fields for accessing ACL interface assignments and their lists in the schema to manage related data effectively. Fixes #251
1 parent 4ea2c7c commit bf808bc

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

netbox_acls/graphql/schema.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
from .types import (
77
AccessListType,
88
ACLExtendedRuleType,
9+
ACLInterfaceAssignmentType,
910
ACLStandardRuleType,
1011
)
1112

@@ -24,3 +25,6 @@ class NetBoxACLSQuery:
2425

2526
acl_standard_rule: ACLStandardRuleType = strawberry_django.field()
2627
acl_standard_rule_list: List[ACLStandardRuleType] = strawberry_django.field()
28+
29+
acl_interface_assignment: ACLInterfaceAssignmentType = strawberry_django.field()
30+
acl_interface_assignment_list: List[ACLInterfaceAssignmentType] = strawberry_django.field()

netbox_acls/graphql/types.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ class AccessListType(NetBoxObjectType):
2323
Defines the object type for the django model AccessList.
2424
"""
2525

26+
# Model fields
2627
assigned_object_type: Annotated["ContentTypeType", strawberry.lazy("netbox.graphql.types")]
2728
assigned_object: Annotated[
2829
Union[
@@ -41,17 +42,18 @@ class AccessListType(NetBoxObjectType):
4142
)
4243
class ACLInterfaceAssignmentType(NetBoxObjectType):
4344
"""
44-
Defines the object type for the django model AccessList.
45+
Defines the object type for the django model ACLInterfaceAssignment.
4546
"""
4647

48+
# Model fields
4749
access_list: Annotated["AccessListType", strawberry.lazy("netbox_acls.graphql.types")]
4850
assigned_object_type: Annotated["ContentTypeType", strawberry.lazy("netbox.graphql.types")]
4951
assigned_object: Annotated[
5052
Union[
5153
Annotated["InterfaceType", strawberry.lazy("dcim.graphql.types")],
5254
Annotated["VMInterfaceType", strawberry.lazy("virtualization.graphql.types")],
5355
],
54-
strawberry.union("ACLInterfaceAssignmentType"),
56+
strawberry.union("ACLInterfaceAssignedObjectType"),
5557
]
5658

5759

@@ -65,6 +67,7 @@ class ACLStandardRuleType(NetBoxObjectType):
6567
Defines the object type for the django model ACLStandardRule.
6668
"""
6769

70+
# Model fields
6871
access_list: Annotated["AccessListType", strawberry.lazy("netbox_acls.graphql.types")]
6972
source_prefix: Annotated["PrefixType", strawberry.lazy("ipam.graphql.types")] | None
7073

@@ -79,6 +82,7 @@ class ACLExtendedRuleType(NetBoxObjectType):
7982
Defines the object type for the django model ACLExtendedRule.
8083
"""
8184

85+
# Model fields
8286
access_list: Annotated["AccessListType", strawberry.lazy("netbox_acls.graphql.types")]
8387
source_prefix: Annotated["PrefixType", strawberry.lazy("ipam.graphql.types")] | None
8488
source_ports: List[int] | None

0 commit comments

Comments
 (0)