Coverage for netbox_data_import/graphql/types.py: 100.00%
12 statements
« prev ^ index » next coverage.py v7.17.0, created at 2026-10-30 09:47 +0000
« prev ^ index » next coverage.py v7.17.0, created at 2026-10-30 09:47 +0000
1# SPDX-License-Identifier: Apache-2.0
2# Copyright (C) 2025 Marcin Zieba <marcinpsk@gmail.com>
4"""GraphQL object types for import profile configuration."""
6import strawberry_django
7from netbox.graphql.types import BaseObjectType, NetBoxObjectType
9from netbox_data_import.models import CableClassMapping, ImportProfile, PortClassMapping
11from .filters import ImportProfileFilter
13_type_kwargs = {"fields": "__all__", "pagination": True}
14if ImportProfileFilter is not None: # pragma: no cover
15 _type_kwargs["filters"] = ImportProfileFilter
18@strawberry_django.type(ImportProfile, **_type_kwargs)
19class ImportProfileType(NetBoxObjectType):
20 """One saved source-file import configuration."""
23@strawberry_django.type(
24 CableClassMapping,
25 fields=[
26 "id",
27 "profile",
28 "cable_class",
29 "cable_type_resolved",
30 "cable_type",
31 "cable_profile_resolved",
32 "cable_profile",
33 ],
34 pagination=True,
35)
36class CableClassMappingType(BaseObjectType):
37 """One trace CableClass policy decision."""
39 profile: ImportProfileType
42@strawberry_django.type(PortClassMapping, fields=["id", "profile", "source_label", "port_class"], pagination=True)
43class PortClassMappingType(BaseObjectType):
44 """One trace PortClass label mapping."""
46 profile: ImportProfileType
49__all__ = ("CableClassMappingType", "ImportProfileType", "PortClassMappingType")