Skip to content

feat(graphql): Add support for ACL Interface Assignments #260

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions netbox_acls/graphql/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from .types import (
AccessListType,
ACLExtendedRuleType,
ACLInterfaceAssignmentType,
ACLStandardRuleType,
)

Expand All @@ -24,3 +25,6 @@ class NetBoxACLSQuery:

acl_standard_rule: ACLStandardRuleType = strawberry_django.field()
acl_standard_rule_list: List[ACLStandardRuleType] = strawberry_django.field()

acl_interface_assignment: ACLInterfaceAssignmentType = strawberry_django.field()
acl_interface_assignment_list: List[ACLInterfaceAssignmentType] = strawberry_django.field()
8 changes: 6 additions & 2 deletions netbox_acls/graphql/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ class AccessListType(NetBoxObjectType):
Defines the object type for the django model AccessList.
"""

# Model fields
assigned_object_type: Annotated["ContentTypeType", strawberry.lazy("netbox.graphql.types")]
assigned_object: Annotated[
Union[
Expand All @@ -41,17 +42,18 @@ class AccessListType(NetBoxObjectType):
)
class ACLInterfaceAssignmentType(NetBoxObjectType):
"""
Defines the object type for the django model AccessList.
Defines the object type for the django model ACLInterfaceAssignment.
"""

# Model fields
access_list: Annotated["AccessListType", strawberry.lazy("netbox_acls.graphql.types")]
assigned_object_type: Annotated["ContentTypeType", strawberry.lazy("netbox.graphql.types")]
assigned_object: Annotated[
Union[
Annotated["InterfaceType", strawberry.lazy("dcim.graphql.types")],
Annotated["VMInterfaceType", strawberry.lazy("virtualization.graphql.types")],
],
strawberry.union("ACLInterfaceAssignmentType"),
strawberry.union("ACLInterfaceAssignedObjectType"),
]


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

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

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

# Model fields
access_list: Annotated["AccessListType", strawberry.lazy("netbox_acls.graphql.types")]
source_prefix: Annotated["PrefixType", strawberry.lazy("ipam.graphql.types")] | None
source_ports: List[int] | None
Expand Down