mirror of
https://github.com/netbox-community/netbox.git
synced 2026-01-16 16:52:17 -06:00
31
netbox/vpn/graphql/enums.py
Normal file
31
netbox/vpn/graphql/enums.py
Normal file
@@ -0,0 +1,31 @@
|
||||
import strawberry
|
||||
|
||||
from vpn.choices import *
|
||||
|
||||
__all__ = (
|
||||
'AuthenticationAlgorithmEnum',
|
||||
'AuthenticationMethodEnum',
|
||||
'DHGroupEnum',
|
||||
'EncryptionAlgorithmEnum',
|
||||
'IKEModeEnum',
|
||||
'IKEVersionEnum',
|
||||
'IPSecModeEnum',
|
||||
'L2VPNTypeEnum',
|
||||
'TunnelEncapsulationEnum',
|
||||
'TunnelStatusEnum',
|
||||
'TunnelTerminationRoleEnum',
|
||||
'TunnelTerminationTypeEnum',
|
||||
)
|
||||
|
||||
AuthenticationAlgorithmEnum = strawberry.enum(AuthenticationAlgorithmChoices.as_enum())
|
||||
AuthenticationMethodEnum = strawberry.enum(AuthenticationMethodChoices.as_enum())
|
||||
DHGroupEnum = strawberry.enum(DHGroupChoices.as_enum())
|
||||
EncryptionAlgorithmEnum = strawberry.enum(EncryptionAlgorithmChoices.as_enum())
|
||||
IKEModeEnum = strawberry.enum(IKEModeChoices.as_enum())
|
||||
IKEVersionEnum = strawberry.enum(IKEVersionChoices.as_enum())
|
||||
IPSecModeEnum = strawberry.enum(IPSecModeChoices.as_enum())
|
||||
L2VPNTypeEnum = strawberry.enum(L2VPNTypeChoices.as_enum())
|
||||
TunnelEncapsulationEnum = strawberry.enum(TunnelEncapsulationChoices.as_enum())
|
||||
TunnelStatusEnum = strawberry.enum(TunnelStatusChoices.as_enum())
|
||||
TunnelTerminationRoleEnum = strawberry.enum(TunnelTerminationRoleChoices.as_enum())
|
||||
TunnelTerminationTypeEnum = strawberry.enum(TunnelTerminationTypeChoices.as_enum())
|
||||
@@ -1,7 +1,21 @@
|
||||
import strawberry_django
|
||||
from typing import Annotated, TYPE_CHECKING
|
||||
|
||||
from netbox.graphql.filter_mixins import autotype_decorator, BaseFilterMixin
|
||||
from vpn import filtersets, models
|
||||
import strawberry
|
||||
import strawberry_django
|
||||
from strawberry.scalars import ID
|
||||
from strawberry_django import FilterLookup
|
||||
|
||||
from core.graphql.filter_mixins import BaseObjectTypeFilterMixin, ChangeLogFilterMixin
|
||||
from extras.graphql.filter_mixins import CustomFieldsFilterMixin, TagsFilterMixin
|
||||
from netbox.graphql.filter_mixins import NetBoxModelFilterMixin, OrganizationalModelFilterMixin, PrimaryModelFilterMixin
|
||||
from tenancy.graphql.filter_mixins import ContactFilterMixin, TenancyFilterMixin
|
||||
from vpn import models
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from core.graphql.filters import ContentTypeFilter
|
||||
from ipam.graphql.filters import IPAddressFilter, RouteTargetFilter
|
||||
from netbox.graphql.filter_lookups import IntegerLookup
|
||||
from .enums import *
|
||||
|
||||
__all__ = (
|
||||
'TunnelGroupFilter',
|
||||
@@ -18,60 +32,143 @@ __all__ = (
|
||||
|
||||
|
||||
@strawberry_django.filter(models.TunnelGroup, lookups=True)
|
||||
@autotype_decorator(filtersets.TunnelGroupFilterSet)
|
||||
class TunnelGroupFilter(BaseFilterMixin):
|
||||
class TunnelGroupFilter(OrganizationalModelFilterMixin):
|
||||
pass
|
||||
|
||||
|
||||
@strawberry_django.filter(models.TunnelTermination, lookups=True)
|
||||
@autotype_decorator(filtersets.TunnelTerminationFilterSet)
|
||||
class TunnelTerminationFilter(BaseFilterMixin):
|
||||
pass
|
||||
class TunnelTerminationFilter(
|
||||
BaseObjectTypeFilterMixin, CustomFieldsFilterMixin, TagsFilterMixin, ChangeLogFilterMixin
|
||||
):
|
||||
tunnel: Annotated['TunnelFilter', strawberry.lazy('vpn.graphql.filters')] | None = strawberry_django.filter_field()
|
||||
tunnel_id: ID | None = strawberry_django.filter_field()
|
||||
role: Annotated['TunnelTerminationRoleEnum', strawberry.lazy('vpn.graphql.enums')] | None = (
|
||||
strawberry_django.filter_field()
|
||||
)
|
||||
termination_type: Annotated['TunnelTerminationTypeEnum', strawberry.lazy('vpn.graphql.enums')] | None = (
|
||||
strawberry_django.filter_field()
|
||||
)
|
||||
termination_type_id: ID | None = strawberry_django.filter_field()
|
||||
termination_id: ID | None = strawberry_django.filter_field()
|
||||
outside_ip: Annotated['IPAddressFilter', strawberry.lazy('ipam.graphql.filters')] | None = (
|
||||
strawberry_django.filter_field()
|
||||
)
|
||||
outside_ip_id: ID | None = strawberry_django.filter_field()
|
||||
|
||||
|
||||
@strawberry_django.filter(models.Tunnel, lookups=True)
|
||||
@autotype_decorator(filtersets.TunnelFilterSet)
|
||||
class TunnelFilter(BaseFilterMixin):
|
||||
pass
|
||||
class TunnelFilter(TenancyFilterMixin, PrimaryModelFilterMixin):
|
||||
name: FilterLookup[str] | None = strawberry_django.filter_field()
|
||||
status: Annotated['TunnelStatusEnum', strawberry.lazy('vpn.graphql.enums')] | None = (
|
||||
strawberry_django.filter_field()
|
||||
)
|
||||
group: Annotated['TunnelGroupFilter', strawberry.lazy('vpn.graphql.filters')] | None = (
|
||||
strawberry_django.filter_field()
|
||||
)
|
||||
group_id: ID | None = strawberry_django.filter_field()
|
||||
encapsulation: Annotated['TunnelEncapsulationEnum', strawberry.lazy('vpn.graphql.enums')] | None = (
|
||||
strawberry_django.filter_field()
|
||||
)
|
||||
ipsec_profile: Annotated['IPSecProfileFilter', strawberry.lazy('vpn.graphql.filters')] | None = (
|
||||
strawberry_django.filter_field()
|
||||
)
|
||||
tunnel_id: Annotated['IntegerLookup', strawberry.lazy('netbox.graphql.filter_lookups')] | None = (
|
||||
strawberry_django.filter_field()
|
||||
)
|
||||
|
||||
|
||||
@strawberry_django.filter(models.IKEProposal, lookups=True)
|
||||
@autotype_decorator(filtersets.IKEProposalFilterSet)
|
||||
class IKEProposalFilter(BaseFilterMixin):
|
||||
pass
|
||||
class IKEProposalFilter(PrimaryModelFilterMixin):
|
||||
name: FilterLookup[str] | None = strawberry_django.filter_field()
|
||||
authentication_method: Annotated['AuthenticationMethodEnum', strawberry.lazy('vpn.graphql.enums')] | None = (
|
||||
strawberry_django.filter_field()
|
||||
)
|
||||
encryption_algorithm: Annotated['EncryptionAlgorithmEnum', strawberry.lazy('vpn.graphql.enums')] | None = (
|
||||
strawberry_django.filter_field()
|
||||
)
|
||||
authentication_algorithm: Annotated['AuthenticationAlgorithmEnum', strawberry.lazy('vpn.graphql.enums')] | None = (
|
||||
strawberry_django.filter_field()
|
||||
)
|
||||
group: Annotated['DHGroupEnum', strawberry.lazy('vpn.graphql.enums')] | None = strawberry_django.filter_field()
|
||||
sa_lifetime: Annotated['IntegerLookup', strawberry.lazy('netbox.graphql.filter_lookups')] | None = (
|
||||
strawberry_django.filter_field()
|
||||
)
|
||||
|
||||
|
||||
@strawberry_django.filter(models.IKEPolicy, lookups=True)
|
||||
@autotype_decorator(filtersets.IKEPolicyFilterSet)
|
||||
class IKEPolicyFilter(BaseFilterMixin):
|
||||
pass
|
||||
class IKEPolicyFilter(PrimaryModelFilterMixin):
|
||||
name: FilterLookup[str] | None = strawberry_django.filter_field()
|
||||
version: Annotated['IKEVersionEnum', strawberry.lazy('vpn.graphql.enums')] | None = strawberry_django.filter_field()
|
||||
mode: Annotated['IKEModeEnum', strawberry.lazy('vpn.graphql.enums')] | None = strawberry_django.filter_field()
|
||||
proposals: Annotated['IKEProposalFilter', strawberry.lazy('vpn.graphql.filters')] | None = (
|
||||
strawberry_django.filter_field()
|
||||
)
|
||||
preshared_key: FilterLookup[str] | None = strawberry_django.filter_field()
|
||||
|
||||
|
||||
@strawberry_django.filter(models.IPSecProposal, lookups=True)
|
||||
@autotype_decorator(filtersets.IPSecProposalFilterSet)
|
||||
class IPSecProposalFilter(BaseFilterMixin):
|
||||
pass
|
||||
class IPSecProposalFilter(PrimaryModelFilterMixin):
|
||||
name: FilterLookup[str] | None = strawberry_django.filter_field()
|
||||
encryption_algorithm: Annotated['EncryptionAlgorithmEnum', strawberry.lazy('vpn.graphql.enums')] | None = (
|
||||
strawberry_django.filter_field()
|
||||
)
|
||||
authentication_algorithm: Annotated['AuthenticationAlgorithmEnum', strawberry.lazy('vpn.graphql.enums')] | None = (
|
||||
strawberry_django.filter_field()
|
||||
)
|
||||
sa_lifetime_seconds: Annotated['IntegerLookup', strawberry.lazy('netbox.graphql.filter_lookups')] | None = (
|
||||
strawberry_django.filter_field()
|
||||
)
|
||||
sa_lifetime_data: Annotated['IntegerLookup', strawberry.lazy('netbox.graphql.filter_lookups')] | None = (
|
||||
strawberry_django.filter_field()
|
||||
)
|
||||
|
||||
|
||||
@strawberry_django.filter(models.IPSecPolicy, lookups=True)
|
||||
@autotype_decorator(filtersets.IPSecPolicyFilterSet)
|
||||
class IPSecPolicyFilter(BaseFilterMixin):
|
||||
pass
|
||||
class IPSecPolicyFilter(PrimaryModelFilterMixin):
|
||||
name: FilterLookup[str] | None = strawberry_django.filter_field()
|
||||
proposals: Annotated['IPSecProposalFilter', strawberry.lazy('vpn.graphql.filters')] | None = (
|
||||
strawberry_django.filter_field()
|
||||
)
|
||||
pfs_group: Annotated['DHGroupEnum', strawberry.lazy('vpn.graphql.enums')] | None = strawberry_django.filter_field()
|
||||
|
||||
|
||||
@strawberry_django.filter(models.IPSecProfile, lookups=True)
|
||||
@autotype_decorator(filtersets.IPSecProfileFilterSet)
|
||||
class IPSecProfileFilter(BaseFilterMixin):
|
||||
pass
|
||||
class IPSecProfileFilter(PrimaryModelFilterMixin):
|
||||
name: FilterLookup[str] | None = strawberry_django.filter_field()
|
||||
mode: Annotated['IPSecModeEnum', strawberry.lazy('vpn.graphql.enums')] | None = strawberry_django.filter_field()
|
||||
ike_policy: Annotated['IKEPolicyFilter', strawberry.lazy('vpn.graphql.filters')] | None = (
|
||||
strawberry_django.filter_field()
|
||||
)
|
||||
ike_policy_id: ID | None = strawberry_django.filter_field()
|
||||
ipsec_policy: Annotated['IPSecPolicyFilter', strawberry.lazy('vpn.graphql.filters')] | None = (
|
||||
strawberry_django.filter_field()
|
||||
)
|
||||
ipsec_policy_id: ID | None = strawberry_django.filter_field()
|
||||
|
||||
|
||||
@strawberry_django.filter(models.L2VPN, lookups=True)
|
||||
@autotype_decorator(filtersets.L2VPNFilterSet)
|
||||
class L2VPNFilter(BaseFilterMixin):
|
||||
pass
|
||||
class L2VPNFilter(ContactFilterMixin, TenancyFilterMixin, PrimaryModelFilterMixin):
|
||||
name: FilterLookup[str] | None = strawberry_django.filter_field()
|
||||
slug: FilterLookup[str] | None = strawberry_django.filter_field()
|
||||
type: Annotated['L2VPNTypeEnum', strawberry.lazy('vpn.graphql.enums')] | None = strawberry_django.filter_field()
|
||||
identifier: Annotated['IntegerLookup', strawberry.lazy('netbox.graphql.filter_lookups')] | None = (
|
||||
strawberry_django.filter_field()
|
||||
)
|
||||
import_targets: Annotated['RouteTargetFilter', strawberry.lazy('ipam.graphql.filters')] | None = (
|
||||
strawberry_django.filter_field()
|
||||
)
|
||||
export_targets: Annotated['RouteTargetFilter', strawberry.lazy('ipam.graphql.filters')] | None = (
|
||||
strawberry_django.filter_field()
|
||||
)
|
||||
|
||||
|
||||
@strawberry_django.filter(models.L2VPNTermination, lookups=True)
|
||||
@autotype_decorator(filtersets.L2VPNTerminationFilterSet)
|
||||
class L2VPNTerminationFilter(BaseFilterMixin):
|
||||
pass
|
||||
class L2VPNTerminationFilter(NetBoxModelFilterMixin):
|
||||
l2vpn: Annotated['L2VPNFilter', strawberry.lazy('vpn.graphql.filters')] | None = strawberry_django.filter_field()
|
||||
l2vpn_id: ID | None = strawberry_django.filter_field()
|
||||
assigned_object_type: Annotated['ContentTypeFilter', strawberry.lazy('core.graphql.filters')] | None = (
|
||||
strawberry_django.filter_field()
|
||||
)
|
||||
assigned_object_id: Annotated['IntegerLookup', strawberry.lazy('netbox.graphql.filter_lookups')] | None = (
|
||||
strawberry_django.filter_field()
|
||||
)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from typing import Annotated, List, Union
|
||||
from typing import Annotated, List, TYPE_CHECKING, Union
|
||||
|
||||
import strawberry
|
||||
import strawberry_django
|
||||
@@ -8,6 +8,13 @@ from netbox.graphql.types import ObjectType, OrganizationalObjectType, NetBoxObj
|
||||
from vpn import models
|
||||
from .filters import *
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from dcim.graphql.types import InterfaceType
|
||||
from ipam.graphql.types import IPAddressType, RouteTargetType, VLANType
|
||||
from netbox.graphql.types import ContentTypeType
|
||||
from tenancy.graphql.types import TenantType
|
||||
from virtualization.graphql.types import VMInterfaceType
|
||||
|
||||
__all__ = (
|
||||
'IKEPolicyType',
|
||||
'IKEProposalType',
|
||||
@@ -125,7 +132,7 @@ class L2VPNType(ContactsMixin, NetBoxObjectType):
|
||||
|
||||
@strawberry_django.type(
|
||||
models.L2VPNTermination,
|
||||
exclude=('assigned_object_type', 'assigned_object_id'),
|
||||
exclude=['assigned_object_type', 'assigned_object_id'],
|
||||
filters=L2VPNTerminationFilter
|
||||
)
|
||||
class L2VPNTerminationType(NetBoxObjectType):
|
||||
|
||||
Reference in New Issue
Block a user