netbox-plugin-dns 0.22.9__py3-none-any.whl → 1.0.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of netbox-plugin-dns might be problematic. Click here for more details.
- netbox_dns/__init__.py +4 -15
- netbox_dns/api/nested_serializers.py +4 -60
- netbox_dns/api/serializers.py +8 -314
- netbox_dns/api/serializers_/__init__.py +0 -0
- netbox_dns/api/serializers_/contact.py +37 -0
- netbox_dns/api/serializers_/nameserver.py +39 -0
- netbox_dns/api/serializers_/record.py +90 -0
- netbox_dns/api/serializers_/registrar.py +31 -0
- netbox_dns/api/serializers_/view.py +34 -0
- netbox_dns/api/serializers_/zone.py +159 -0
- netbox_dns/api/views.py +13 -13
- netbox_dns/fields/network.py +21 -22
- netbox_dns/fields/rfc2317.py +3 -3
- netbox_dns/{filters → filtersets}/contact.py +2 -1
- netbox_dns/filtersets/nameserver.py +37 -0
- netbox_dns/{filters → filtersets}/record.py +51 -6
- netbox_dns/{filters → filtersets}/registrar.py +2 -1
- netbox_dns/{filters → filtersets}/view.py +2 -2
- netbox_dns/filtersets/zone.py +205 -0
- netbox_dns/forms/contact.py +61 -33
- netbox_dns/forms/nameserver.py +21 -8
- netbox_dns/forms/record.py +65 -38
- netbox_dns/forms/registrar.py +45 -15
- netbox_dns/forms/view.py +23 -9
- netbox_dns/forms/zone.py +182 -188
- netbox_dns/graphql/__init__.py +17 -27
- netbox_dns/graphql/filters.py +49 -0
- netbox_dns/graphql/schema.py +66 -7
- netbox_dns/graphql/types.py +143 -0
- netbox_dns/management/commands/cleanup_database.py +0 -4
- netbox_dns/management/commands/cleanup_rrset_ttl.py +2 -4
- netbox_dns/management/commands/setup_coupling.py +15 -15
- netbox_dns/management/commands/update_soa.py +1 -1
- netbox_dns/migrations/0001_squashed_netbox_dns_0_15.py +0 -27
- netbox_dns/migrations/0001_squashed_netbox_dns_0_22.py +558 -0
- netbox_dns/migrations/{0013_add_nameserver_zone_record_description.py → 0002_contact_description_registrar_description.py} +4 -9
- netbox_dns/migrations/0003_default_view.py +15 -0
- netbox_dns/migrations/0004_create_and_assign_default_view.py +26 -0
- netbox_dns/migrations/0005_alter_zone_view_not_null.py +18 -0
- netbox_dns/migrations/0020_netbox_3_4.py +1 -1
- netbox_dns/models/contact.py +6 -1
- netbox_dns/models/nameserver.py +2 -0
- netbox_dns/models/record.py +28 -33
- netbox_dns/models/registrar.py +5 -1
- netbox_dns/models/view.py +54 -1
- netbox_dns/models/zone.py +68 -54
- netbox_dns/navigation.py +1 -15
- netbox_dns/signals/ipam_coupling.py +3 -9
- netbox_dns/tables/contact.py +1 -0
- netbox_dns/tables/nameserver.py +0 -2
- netbox_dns/tables/registrar.py +1 -0
- netbox_dns/tables/view.py +9 -2
- netbox_dns/template_content.py +4 -8
- netbox_dns/templates/netbox_dns/contact.html +60 -56
- netbox_dns/templates/netbox_dns/nameserver.html +27 -27
- netbox_dns/templates/netbox_dns/record.html +92 -94
- netbox_dns/templates/netbox_dns/registrar.html +38 -36
- netbox_dns/templates/netbox_dns/view.html +25 -21
- netbox_dns/templates/netbox_dns/zone/base.html +5 -3
- netbox_dns/templates/netbox_dns/zone/child.html +3 -3
- netbox_dns/templates/netbox_dns/zone/managed_record.html +1 -1
- netbox_dns/templates/netbox_dns/zone/record.html +3 -3
- netbox_dns/templates/netbox_dns/zone/registration.html +26 -27
- netbox_dns/templates/netbox_dns/zone/rfc2317_child_zone.html +1 -1
- netbox_dns/templates/netbox_dns/zone.html +148 -149
- netbox_dns/urls/__init__.py +17 -0
- netbox_dns/urls/contact.py +51 -0
- netbox_dns/urls/nameserver.py +69 -0
- netbox_dns/urls/record.py +41 -0
- netbox_dns/urls/registrar.py +63 -0
- netbox_dns/urls/view.py +39 -0
- netbox_dns/urls/zone.py +57 -0
- netbox_dns/utilities/__init__.py +1 -6
- netbox_dns/utilities/ipam_coupling.py +2 -7
- netbox_dns/validators/dns_name.py +4 -9
- netbox_dns/validators/rfc2317.py +2 -2
- netbox_dns/views/contact.py +4 -4
- netbox_dns/views/nameserver.py +5 -5
- netbox_dns/views/record.py +15 -23
- netbox_dns/views/registrar.py +4 -4
- netbox_dns/views/view.py +4 -4
- netbox_dns/views/zone.py +7 -8
- {netbox_plugin_dns-0.22.9.dist-info → netbox_plugin_dns-1.0.0.dist-info}/METADATA +27 -13
- netbox_plugin_dns-1.0.0.dist-info/RECORD +112 -0
- netbox_dns/filters/nameserver.py +0 -18
- netbox_dns/filters/zone.py +0 -112
- netbox_dns/graphql/contact.py +0 -19
- netbox_dns/graphql/nameserver.py +0 -19
- netbox_dns/graphql/record.py +0 -19
- netbox_dns/graphql/registrar.py +0 -19
- netbox_dns/graphql/view.py +0 -19
- netbox_dns/graphql/zone.py +0 -19
- netbox_dns/migrations/0001_initial.py +0 -115
- netbox_dns/migrations/0002_zone_default_ttl.py +0 -18
- netbox_dns/migrations/0003_soa_managed_records.py +0 -112
- netbox_dns/migrations/0004_create_ptr_for_a_aaaa_records.py +0 -80
- netbox_dns/migrations/0005_update_ns_records.py +0 -41
- netbox_dns/migrations/0006_zone_soa_serial_auto.py +0 -29
- netbox_dns/migrations/0007_alter_zone_soa_serial_auto.py +0 -17
- netbox_dns/migrations/0008_zone_status_names.py +0 -21
- netbox_dns/migrations/0009_netbox32.py +0 -71
- netbox_dns/migrations/0010_update_soa_records.py +0 -58
- netbox_dns/migrations/0011_add_view_model.py +0 -70
- netbox_dns/migrations/0012_adjust_zone_and_record.py +0 -17
- netbox_dns/migrations/0014_add_view_description.py +0 -16
- netbox_dns/migrations/0015_add_record_status.py +0 -17
- netbox_dns/migrations/0016_cleanup_ptr_records.py +0 -38
- netbox_dns/migrations/0017_alter_record_ttl.py +0 -17
- netbox_dns/migrations/0018_zone_arpa_network.py +0 -51
- netbox_dns/migrations/0019_update_ns_ttl.py +0 -19
- netbox_dns/urls.py +0 -297
- netbox_plugin_dns-0.22.9.dist-info/RECORD +0 -117
- /netbox_dns/{filters → filtersets}/__init__.py +0 -0
- {netbox_plugin_dns-0.22.9.dist-info → netbox_plugin_dns-1.0.0.dist-info}/LICENSE +0 -0
- {netbox_plugin_dns-0.22.9.dist-info → netbox_plugin_dns-1.0.0.dist-info}/WHEEL +0 -0
netbox_dns/__init__.py
CHANGED
|
@@ -1,31 +1,20 @@
|
|
|
1
|
-
import
|
|
1
|
+
from netbox.plugins import PluginConfig
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
from django.db.utils import OperationalError
|
|
5
|
-
|
|
6
|
-
try:
|
|
7
|
-
# NetBox 3.5.0 - 3.5.7, 3.5.9+
|
|
8
|
-
from extras.plugins import get_plugin_config
|
|
9
|
-
except ImportError:
|
|
10
|
-
# NetBox 3.5.8
|
|
11
|
-
from extras.plugins.utils import get_plugin_config
|
|
12
|
-
|
|
13
|
-
__version__ = "0.22.9"
|
|
3
|
+
__version__ = "1.0.0"
|
|
14
4
|
|
|
15
5
|
|
|
16
6
|
class DNSConfig(PluginConfig):
|
|
17
7
|
name = "netbox_dns"
|
|
18
8
|
verbose_name = "NetBox DNS"
|
|
19
9
|
description = "NetBox plugin for DNS data"
|
|
20
|
-
min_version = "
|
|
21
|
-
max_version = "3.99.0"
|
|
10
|
+
min_version = "4.0.0"
|
|
22
11
|
version = __version__
|
|
23
12
|
author = "Peter Eckel"
|
|
24
13
|
author_email = "pete@netbox-dns.org"
|
|
25
14
|
required_settings = []
|
|
26
15
|
default_settings = {
|
|
27
16
|
"zone_default_ttl": 86400,
|
|
28
|
-
"
|
|
17
|
+
"zone_soa_ttl": 86400,
|
|
29
18
|
"zone_soa_serial": 1,
|
|
30
19
|
"zone_soa_refresh": 43200,
|
|
31
20
|
"zone_soa_retry": 7200,
|
|
@@ -2,25 +2,10 @@ from rest_framework import serializers
|
|
|
2
2
|
|
|
3
3
|
from netbox.api.serializers import WritableNestedSerializer
|
|
4
4
|
|
|
5
|
-
from netbox_dns.models import
|
|
5
|
+
from netbox_dns.models import Zone, Record
|
|
6
|
+
from netbox_dns.api.serializers_.view import ViewSerializer
|
|
6
7
|
|
|
7
8
|
|
|
8
|
-
#
|
|
9
|
-
# Views
|
|
10
|
-
#
|
|
11
|
-
class NestedViewSerializer(WritableNestedSerializer):
|
|
12
|
-
url = serializers.HyperlinkedIdentityField(
|
|
13
|
-
view_name="plugins-api:netbox_dns-api:view-detail"
|
|
14
|
-
)
|
|
15
|
-
|
|
16
|
-
class Meta:
|
|
17
|
-
model = View
|
|
18
|
-
fields = ["id", "url", "display", "name"]
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
#
|
|
22
|
-
# Zones
|
|
23
|
-
#
|
|
24
9
|
class NestedZoneSerializer(WritableNestedSerializer):
|
|
25
10
|
def to_representation(self, instance):
|
|
26
11
|
# +
|
|
@@ -39,7 +24,8 @@ class NestedZoneSerializer(WritableNestedSerializer):
|
|
|
39
24
|
url = serializers.HyperlinkedIdentityField(
|
|
40
25
|
view_name="plugins-api:netbox_dns-api:zone-detail"
|
|
41
26
|
)
|
|
42
|
-
view =
|
|
27
|
+
view = ViewSerializer(
|
|
28
|
+
nested=True,
|
|
43
29
|
many=False,
|
|
44
30
|
required=False,
|
|
45
31
|
read_only=True,
|
|
@@ -65,22 +51,6 @@ class NestedZoneSerializer(WritableNestedSerializer):
|
|
|
65
51
|
]
|
|
66
52
|
|
|
67
53
|
|
|
68
|
-
#
|
|
69
|
-
# Nameservers
|
|
70
|
-
#
|
|
71
|
-
class NestedNameServerSerializer(WritableNestedSerializer):
|
|
72
|
-
url = serializers.HyperlinkedIdentityField(
|
|
73
|
-
view_name="plugins-api:netbox_dns-api:nameserver-detail"
|
|
74
|
-
)
|
|
75
|
-
|
|
76
|
-
class Meta:
|
|
77
|
-
model = NameServer
|
|
78
|
-
fields = ["id", "url", "display", "name"]
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
#
|
|
82
|
-
# Records
|
|
83
|
-
#
|
|
84
54
|
class NestedRecordSerializer(WritableNestedSerializer):
|
|
85
55
|
url = serializers.HyperlinkedIdentityField(
|
|
86
56
|
view_name="plugins-api:netbox_dns-api:record-detail"
|
|
@@ -110,29 +80,3 @@ class NestedRecordSerializer(WritableNestedSerializer):
|
|
|
110
80
|
"zone",
|
|
111
81
|
"active",
|
|
112
82
|
]
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
#
|
|
116
|
-
# Registrars
|
|
117
|
-
#
|
|
118
|
-
class NestedRegistrarSerializer(WritableNestedSerializer):
|
|
119
|
-
url = serializers.HyperlinkedIdentityField(
|
|
120
|
-
view_name="plugins-api:netbox_dns-api:registrar-detail"
|
|
121
|
-
)
|
|
122
|
-
|
|
123
|
-
class Meta:
|
|
124
|
-
model = Registrar
|
|
125
|
-
fields = ["display", "id", "url", "name", "iana_id"]
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
#
|
|
129
|
-
# Contacts
|
|
130
|
-
#
|
|
131
|
-
class NestedContactSerializer(WritableNestedSerializer):
|
|
132
|
-
url = serializers.HyperlinkedIdentityField(
|
|
133
|
-
view_name="plugins-api:netbox_dns-api:contact-detail"
|
|
134
|
-
)
|
|
135
|
-
|
|
136
|
-
class Meta:
|
|
137
|
-
model = Contact
|
|
138
|
-
fields = ["display", "id", "url", "name", "contact_id"]
|
netbox_dns/api/serializers.py
CHANGED
|
@@ -1,314 +1,8 @@
|
|
|
1
|
-
from
|
|
2
|
-
|
|
3
|
-
from
|
|
4
|
-
from
|
|
5
|
-
from
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
NestedZoneSerializer,
|
|
10
|
-
NestedNameServerSerializer,
|
|
11
|
-
NestedRecordSerializer,
|
|
12
|
-
NestedRegistrarSerializer,
|
|
13
|
-
NestedContactSerializer,
|
|
14
|
-
)
|
|
15
|
-
from netbox_dns.models import View, Zone, NameServer, Record, Registrar, Contact
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
class ViewSerializer(NetBoxModelSerializer):
|
|
19
|
-
url = serializers.HyperlinkedIdentityField(
|
|
20
|
-
view_name="plugins-api:netbox_dns-api:view-detail"
|
|
21
|
-
)
|
|
22
|
-
tenant = NestedTenantSerializer(required=False, allow_null=True)
|
|
23
|
-
|
|
24
|
-
class Meta:
|
|
25
|
-
model = View
|
|
26
|
-
fields = (
|
|
27
|
-
"id",
|
|
28
|
-
"url",
|
|
29
|
-
"display",
|
|
30
|
-
"name",
|
|
31
|
-
"tags",
|
|
32
|
-
"description",
|
|
33
|
-
"created",
|
|
34
|
-
"last_updated",
|
|
35
|
-
"custom_fields",
|
|
36
|
-
"tenant",
|
|
37
|
-
)
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
class ZoneSerializer(NetBoxModelSerializer):
|
|
41
|
-
url = serializers.HyperlinkedIdentityField(
|
|
42
|
-
view_name="plugins-api:netbox_dns-api:zone-detail"
|
|
43
|
-
)
|
|
44
|
-
view = NestedViewSerializer(
|
|
45
|
-
many=False,
|
|
46
|
-
read_only=False,
|
|
47
|
-
required=False,
|
|
48
|
-
default=None,
|
|
49
|
-
help_text="View the zone belongs to",
|
|
50
|
-
)
|
|
51
|
-
nameservers = NestedNameServerSerializer(
|
|
52
|
-
many=True, read_only=False, required=False, help_text="Nameservers for the zone"
|
|
53
|
-
)
|
|
54
|
-
soa_mname = NestedNameServerSerializer(
|
|
55
|
-
many=False,
|
|
56
|
-
read_only=False,
|
|
57
|
-
required=False,
|
|
58
|
-
help_text="Primary nameserver for the zone",
|
|
59
|
-
)
|
|
60
|
-
rfc2317_parent_zone = NestedZoneSerializer(
|
|
61
|
-
many=False,
|
|
62
|
-
read_only=True,
|
|
63
|
-
required=False,
|
|
64
|
-
help_text="RFC2317 arent zone for the zone",
|
|
65
|
-
)
|
|
66
|
-
rfc2317_child_zones = NestedZoneSerializer(
|
|
67
|
-
many=True,
|
|
68
|
-
read_only=True,
|
|
69
|
-
required=False,
|
|
70
|
-
help_text="RFC2317 child zones of the zone",
|
|
71
|
-
)
|
|
72
|
-
registrar = NestedRegistrarSerializer(
|
|
73
|
-
many=False,
|
|
74
|
-
read_only=False,
|
|
75
|
-
required=False,
|
|
76
|
-
help_text="The registrar the domain is registered with",
|
|
77
|
-
)
|
|
78
|
-
registrant = NestedContactSerializer(
|
|
79
|
-
many=False,
|
|
80
|
-
read_only=False,
|
|
81
|
-
required=False,
|
|
82
|
-
help_text="The owner of the domain",
|
|
83
|
-
)
|
|
84
|
-
admin_c = NestedContactSerializer(
|
|
85
|
-
many=False,
|
|
86
|
-
read_only=False,
|
|
87
|
-
required=False,
|
|
88
|
-
help_text="The administrative contact for the domain",
|
|
89
|
-
)
|
|
90
|
-
tech_c = NestedContactSerializer(
|
|
91
|
-
many=False,
|
|
92
|
-
read_only=False,
|
|
93
|
-
required=False,
|
|
94
|
-
help_text="The technical contact for the domain",
|
|
95
|
-
)
|
|
96
|
-
billing_c = NestedContactSerializer(
|
|
97
|
-
many=False,
|
|
98
|
-
read_only=False,
|
|
99
|
-
required=False,
|
|
100
|
-
help_text="The billing contact for the domain",
|
|
101
|
-
)
|
|
102
|
-
active = serializers.BooleanField(
|
|
103
|
-
required=False,
|
|
104
|
-
read_only=True,
|
|
105
|
-
allow_null=True,
|
|
106
|
-
)
|
|
107
|
-
tenant = NestedTenantSerializer(required=False, allow_null=True)
|
|
108
|
-
|
|
109
|
-
def create(self, validated_data):
|
|
110
|
-
nameservers = validated_data.pop("nameservers", None)
|
|
111
|
-
|
|
112
|
-
zone = super().create(validated_data)
|
|
113
|
-
|
|
114
|
-
if nameservers is not None:
|
|
115
|
-
zone.nameservers.set(nameservers)
|
|
116
|
-
|
|
117
|
-
return zone
|
|
118
|
-
|
|
119
|
-
def update(self, instance, validated_data):
|
|
120
|
-
nameservers = validated_data.pop("nameservers", None)
|
|
121
|
-
|
|
122
|
-
zone = super().update(instance, validated_data)
|
|
123
|
-
|
|
124
|
-
if nameservers is not None:
|
|
125
|
-
zone.nameservers.set(nameservers)
|
|
126
|
-
|
|
127
|
-
return zone
|
|
128
|
-
|
|
129
|
-
class Meta:
|
|
130
|
-
model = Zone
|
|
131
|
-
fields = (
|
|
132
|
-
"id",
|
|
133
|
-
"url",
|
|
134
|
-
"name",
|
|
135
|
-
"view",
|
|
136
|
-
"display",
|
|
137
|
-
"nameservers",
|
|
138
|
-
"status",
|
|
139
|
-
"description",
|
|
140
|
-
"tags",
|
|
141
|
-
"created",
|
|
142
|
-
"last_updated",
|
|
143
|
-
"default_ttl",
|
|
144
|
-
"soa_ttl",
|
|
145
|
-
"soa_mname",
|
|
146
|
-
"soa_rname",
|
|
147
|
-
"soa_serial",
|
|
148
|
-
"soa_serial_auto",
|
|
149
|
-
"soa_refresh",
|
|
150
|
-
"soa_retry",
|
|
151
|
-
"soa_expire",
|
|
152
|
-
"soa_minimum",
|
|
153
|
-
"rfc2317_prefix",
|
|
154
|
-
"rfc2317_parent_managed",
|
|
155
|
-
"rfc2317_parent_zone",
|
|
156
|
-
"rfc2317_child_zones",
|
|
157
|
-
"registrar",
|
|
158
|
-
"registry_domain_id",
|
|
159
|
-
"registrant",
|
|
160
|
-
"tech_c",
|
|
161
|
-
"admin_c",
|
|
162
|
-
"billing_c",
|
|
163
|
-
"active",
|
|
164
|
-
"custom_fields",
|
|
165
|
-
"tenant",
|
|
166
|
-
)
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
class NameServerSerializer(NetBoxModelSerializer):
|
|
170
|
-
url = serializers.HyperlinkedIdentityField(
|
|
171
|
-
view_name="plugins-api:netbox_dns-api:nameserver-detail"
|
|
172
|
-
)
|
|
173
|
-
zones = NestedZoneSerializer(
|
|
174
|
-
many=True,
|
|
175
|
-
read_only=True,
|
|
176
|
-
required=False,
|
|
177
|
-
default=None,
|
|
178
|
-
help_text="Zones served by the authoritative nameserver",
|
|
179
|
-
)
|
|
180
|
-
tenant = NestedTenantSerializer(required=False, allow_null=True)
|
|
181
|
-
|
|
182
|
-
class Meta:
|
|
183
|
-
model = NameServer
|
|
184
|
-
fields = (
|
|
185
|
-
"id",
|
|
186
|
-
"url",
|
|
187
|
-
"display",
|
|
188
|
-
"name",
|
|
189
|
-
"description",
|
|
190
|
-
"tags",
|
|
191
|
-
"zones",
|
|
192
|
-
"created",
|
|
193
|
-
"last_updated",
|
|
194
|
-
"custom_fields",
|
|
195
|
-
"tenant",
|
|
196
|
-
)
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
class RecordSerializer(NetBoxModelSerializer):
|
|
200
|
-
url = serializers.HyperlinkedIdentityField(
|
|
201
|
-
view_name="plugins-api:netbox_dns-api:record-detail"
|
|
202
|
-
)
|
|
203
|
-
ptr_record = NestedRecordSerializer(
|
|
204
|
-
many=False,
|
|
205
|
-
read_only=True,
|
|
206
|
-
required=False,
|
|
207
|
-
allow_null=True,
|
|
208
|
-
help_text="PTR record generated from an address",
|
|
209
|
-
)
|
|
210
|
-
address_record = NestedRecordSerializer(
|
|
211
|
-
many=False,
|
|
212
|
-
read_only=True,
|
|
213
|
-
required=False,
|
|
214
|
-
allow_null=True,
|
|
215
|
-
help_text="Address record defining the PTR",
|
|
216
|
-
)
|
|
217
|
-
zone = NestedZoneSerializer(
|
|
218
|
-
many=False,
|
|
219
|
-
required=False,
|
|
220
|
-
help_text="Zone the record belongs to",
|
|
221
|
-
)
|
|
222
|
-
active = serializers.BooleanField(
|
|
223
|
-
required=False,
|
|
224
|
-
read_only=True,
|
|
225
|
-
)
|
|
226
|
-
ipam_ip_address = NestedIPAddressSerializer(
|
|
227
|
-
many=False,
|
|
228
|
-
read_only=True,
|
|
229
|
-
required=False,
|
|
230
|
-
allow_null=True,
|
|
231
|
-
help_text="IPAddress linked to the record",
|
|
232
|
-
)
|
|
233
|
-
tenant = NestedTenantSerializer(required=False, allow_null=True)
|
|
234
|
-
|
|
235
|
-
class Meta:
|
|
236
|
-
model = Record
|
|
237
|
-
fields = (
|
|
238
|
-
"id",
|
|
239
|
-
"url",
|
|
240
|
-
"zone",
|
|
241
|
-
"display",
|
|
242
|
-
"type",
|
|
243
|
-
"name",
|
|
244
|
-
"fqdn",
|
|
245
|
-
"value",
|
|
246
|
-
"status",
|
|
247
|
-
"ttl",
|
|
248
|
-
"description",
|
|
249
|
-
"tags",
|
|
250
|
-
"created",
|
|
251
|
-
"last_updated",
|
|
252
|
-
"managed",
|
|
253
|
-
"disable_ptr",
|
|
254
|
-
"ptr_record",
|
|
255
|
-
"address_record",
|
|
256
|
-
"active",
|
|
257
|
-
"custom_fields",
|
|
258
|
-
"tenant",
|
|
259
|
-
"ipam_ip_address",
|
|
260
|
-
)
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
class RegistrarSerializer(NetBoxModelSerializer):
|
|
264
|
-
url = serializers.HyperlinkedIdentityField(
|
|
265
|
-
view_name="plugins-api:netbox_dns-api:registrar-detail"
|
|
266
|
-
)
|
|
267
|
-
|
|
268
|
-
class Meta:
|
|
269
|
-
model = Registrar
|
|
270
|
-
fields = (
|
|
271
|
-
"id",
|
|
272
|
-
"url",
|
|
273
|
-
"display",
|
|
274
|
-
"name",
|
|
275
|
-
"iana_id",
|
|
276
|
-
"address",
|
|
277
|
-
"referral_url",
|
|
278
|
-
"whois_server",
|
|
279
|
-
"abuse_email",
|
|
280
|
-
"abuse_phone",
|
|
281
|
-
"created",
|
|
282
|
-
"last_updated",
|
|
283
|
-
"custom_fields",
|
|
284
|
-
)
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
class ContactSerializer(NetBoxModelSerializer):
|
|
288
|
-
url = serializers.HyperlinkedIdentityField(
|
|
289
|
-
view_name="plugins-api:netbox_dns-api:contact-detail"
|
|
290
|
-
)
|
|
291
|
-
|
|
292
|
-
class Meta:
|
|
293
|
-
model = Contact
|
|
294
|
-
fields = (
|
|
295
|
-
"id",
|
|
296
|
-
"url",
|
|
297
|
-
"display",
|
|
298
|
-
"name",
|
|
299
|
-
"contact_id",
|
|
300
|
-
"organization",
|
|
301
|
-
"street",
|
|
302
|
-
"city",
|
|
303
|
-
"state_province",
|
|
304
|
-
"postal_code",
|
|
305
|
-
"country",
|
|
306
|
-
"phone",
|
|
307
|
-
"phone_ext",
|
|
308
|
-
"fax",
|
|
309
|
-
"fax_ext",
|
|
310
|
-
"email",
|
|
311
|
-
"created",
|
|
312
|
-
"last_updated",
|
|
313
|
-
"custom_fields",
|
|
314
|
-
)
|
|
1
|
+
from .serializers_.contact import *
|
|
2
|
+
from .serializers_.nameserver import *
|
|
3
|
+
from .serializers_.record import *
|
|
4
|
+
from .serializers_.registrar import *
|
|
5
|
+
from .serializers_.view import *
|
|
6
|
+
from .serializers_.zone import *
|
|
7
|
+
|
|
8
|
+
from .nested_serializers import *
|
|
File without changes
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
from rest_framework import serializers
|
|
2
|
+
|
|
3
|
+
from netbox.api.serializers import NetBoxModelSerializer
|
|
4
|
+
|
|
5
|
+
from netbox_dns.models import Contact
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class ContactSerializer(NetBoxModelSerializer):
|
|
9
|
+
url = serializers.HyperlinkedIdentityField(
|
|
10
|
+
view_name="plugins-api:netbox_dns-api:contact-detail"
|
|
11
|
+
)
|
|
12
|
+
|
|
13
|
+
class Meta:
|
|
14
|
+
model = Contact
|
|
15
|
+
fields = (
|
|
16
|
+
"id",
|
|
17
|
+
"url",
|
|
18
|
+
"display",
|
|
19
|
+
"name",
|
|
20
|
+
"description",
|
|
21
|
+
"contact_id",
|
|
22
|
+
"organization",
|
|
23
|
+
"street",
|
|
24
|
+
"city",
|
|
25
|
+
"state_province",
|
|
26
|
+
"postal_code",
|
|
27
|
+
"country",
|
|
28
|
+
"phone",
|
|
29
|
+
"phone_ext",
|
|
30
|
+
"fax",
|
|
31
|
+
"fax_ext",
|
|
32
|
+
"email",
|
|
33
|
+
"created",
|
|
34
|
+
"last_updated",
|
|
35
|
+
"custom_fields",
|
|
36
|
+
)
|
|
37
|
+
brief_fields = ("id", "url", "display", "name", "description", "contact_id")
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
from rest_framework import serializers
|
|
2
|
+
|
|
3
|
+
from netbox.api.serializers import NetBoxModelSerializer
|
|
4
|
+
from tenancy.api.serializers_.tenants import TenantSerializer
|
|
5
|
+
|
|
6
|
+
from netbox_dns.models import NameServer
|
|
7
|
+
|
|
8
|
+
from netbox_dns.api.nested_serializers import NestedZoneSerializer
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class NameServerSerializer(NetBoxModelSerializer):
|
|
12
|
+
url = serializers.HyperlinkedIdentityField(
|
|
13
|
+
view_name="plugins-api:netbox_dns-api:nameserver-detail"
|
|
14
|
+
)
|
|
15
|
+
zones = NestedZoneSerializer(
|
|
16
|
+
many=True,
|
|
17
|
+
read_only=True,
|
|
18
|
+
required=False,
|
|
19
|
+
default=None,
|
|
20
|
+
help_text="Zones served by the authoritative nameserver",
|
|
21
|
+
)
|
|
22
|
+
tenant = TenantSerializer(required=False, allow_null=True)
|
|
23
|
+
|
|
24
|
+
class Meta:
|
|
25
|
+
model = NameServer
|
|
26
|
+
fields = (
|
|
27
|
+
"id",
|
|
28
|
+
"url",
|
|
29
|
+
"display",
|
|
30
|
+
"name",
|
|
31
|
+
"description",
|
|
32
|
+
"tags",
|
|
33
|
+
"zones",
|
|
34
|
+
"created",
|
|
35
|
+
"last_updated",
|
|
36
|
+
"custom_fields",
|
|
37
|
+
"tenant",
|
|
38
|
+
)
|
|
39
|
+
brief_fields = ("id", "url", "display", "name", "description")
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
from rest_framework import serializers
|
|
2
|
+
|
|
3
|
+
from netbox.api.serializers import NetBoxModelSerializer
|
|
4
|
+
from ipam.api.serializers import IPAddressSerializer
|
|
5
|
+
from tenancy.api.serializers import TenantSerializer
|
|
6
|
+
|
|
7
|
+
from netbox_dns.models import Record
|
|
8
|
+
from netbox_dns.api.nested_serializers import (
|
|
9
|
+
NestedZoneSerializer,
|
|
10
|
+
NestedRecordSerializer,
|
|
11
|
+
)
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
class RecordSerializer(NetBoxModelSerializer):
|
|
15
|
+
url = serializers.HyperlinkedIdentityField(
|
|
16
|
+
view_name="plugins-api:netbox_dns-api:record-detail"
|
|
17
|
+
)
|
|
18
|
+
ptr_record = NestedRecordSerializer(
|
|
19
|
+
many=False,
|
|
20
|
+
read_only=True,
|
|
21
|
+
required=False,
|
|
22
|
+
allow_null=True,
|
|
23
|
+
help_text="PTR record generated from an address",
|
|
24
|
+
)
|
|
25
|
+
address_record = NestedRecordSerializer(
|
|
26
|
+
many=False,
|
|
27
|
+
read_only=True,
|
|
28
|
+
required=False,
|
|
29
|
+
allow_null=True,
|
|
30
|
+
help_text="Address record defining the PTR",
|
|
31
|
+
)
|
|
32
|
+
zone = NestedZoneSerializer(
|
|
33
|
+
many=False,
|
|
34
|
+
required=False,
|
|
35
|
+
help_text="Zone the record belongs to",
|
|
36
|
+
)
|
|
37
|
+
active = serializers.BooleanField(
|
|
38
|
+
required=False,
|
|
39
|
+
read_only=True,
|
|
40
|
+
)
|
|
41
|
+
ipam_ip_address = IPAddressSerializer(
|
|
42
|
+
nested=True,
|
|
43
|
+
many=False,
|
|
44
|
+
read_only=True,
|
|
45
|
+
required=False,
|
|
46
|
+
allow_null=True,
|
|
47
|
+
help_text="IPAddress linked to the record",
|
|
48
|
+
)
|
|
49
|
+
tenant = TenantSerializer(nested=True, required=False, allow_null=True)
|
|
50
|
+
|
|
51
|
+
class Meta:
|
|
52
|
+
model = Record
|
|
53
|
+
fields = (
|
|
54
|
+
"id",
|
|
55
|
+
"url",
|
|
56
|
+
"zone",
|
|
57
|
+
"display",
|
|
58
|
+
"type",
|
|
59
|
+
"name",
|
|
60
|
+
"fqdn",
|
|
61
|
+
"value",
|
|
62
|
+
"status",
|
|
63
|
+
"ttl",
|
|
64
|
+
"description",
|
|
65
|
+
"tags",
|
|
66
|
+
"created",
|
|
67
|
+
"last_updated",
|
|
68
|
+
"managed",
|
|
69
|
+
"disable_ptr",
|
|
70
|
+
"ptr_record",
|
|
71
|
+
"address_record",
|
|
72
|
+
"active",
|
|
73
|
+
"custom_fields",
|
|
74
|
+
"tenant",
|
|
75
|
+
"ipam_ip_address",
|
|
76
|
+
)
|
|
77
|
+
brief_fields = (
|
|
78
|
+
"id",
|
|
79
|
+
"url",
|
|
80
|
+
"zone",
|
|
81
|
+
"display",
|
|
82
|
+
"type",
|
|
83
|
+
"name",
|
|
84
|
+
"fqdn",
|
|
85
|
+
"value",
|
|
86
|
+
"status",
|
|
87
|
+
"ttl",
|
|
88
|
+
"description",
|
|
89
|
+
"active",
|
|
90
|
+
)
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
from rest_framework import serializers
|
|
2
|
+
|
|
3
|
+
from netbox.api.serializers import NetBoxModelSerializer
|
|
4
|
+
|
|
5
|
+
from netbox_dns.models import Registrar
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class RegistrarSerializer(NetBoxModelSerializer):
|
|
9
|
+
url = serializers.HyperlinkedIdentityField(
|
|
10
|
+
view_name="plugins-api:netbox_dns-api:registrar-detail"
|
|
11
|
+
)
|
|
12
|
+
|
|
13
|
+
class Meta:
|
|
14
|
+
model = Registrar
|
|
15
|
+
fields = (
|
|
16
|
+
"id",
|
|
17
|
+
"url",
|
|
18
|
+
"display",
|
|
19
|
+
"name",
|
|
20
|
+
"description",
|
|
21
|
+
"iana_id",
|
|
22
|
+
"address",
|
|
23
|
+
"referral_url",
|
|
24
|
+
"whois_server",
|
|
25
|
+
"abuse_email",
|
|
26
|
+
"abuse_phone",
|
|
27
|
+
"created",
|
|
28
|
+
"last_updated",
|
|
29
|
+
"custom_fields",
|
|
30
|
+
)
|
|
31
|
+
brief_fields = ("id", "url", "display", "name", "description", "iana_id")
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
from rest_framework import serializers
|
|
2
|
+
|
|
3
|
+
from netbox.api.serializers import NetBoxModelSerializer
|
|
4
|
+
from tenancy.api.serializers_.tenants import TenantSerializer
|
|
5
|
+
|
|
6
|
+
from netbox_dns.models import View
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class ViewSerializer(NetBoxModelSerializer):
|
|
10
|
+
url = serializers.HyperlinkedIdentityField(
|
|
11
|
+
view_name="plugins-api:netbox_dns-api:view-detail"
|
|
12
|
+
)
|
|
13
|
+
default_view = serializers.BooleanField(
|
|
14
|
+
read_only=True,
|
|
15
|
+
)
|
|
16
|
+
|
|
17
|
+
tenant = TenantSerializer(nested=True, required=False, allow_null=True)
|
|
18
|
+
|
|
19
|
+
class Meta:
|
|
20
|
+
model = View
|
|
21
|
+
fields = (
|
|
22
|
+
"id",
|
|
23
|
+
"url",
|
|
24
|
+
"display",
|
|
25
|
+
"name",
|
|
26
|
+
"default_view",
|
|
27
|
+
"tags",
|
|
28
|
+
"description",
|
|
29
|
+
"created",
|
|
30
|
+
"last_updated",
|
|
31
|
+
"custom_fields",
|
|
32
|
+
"tenant",
|
|
33
|
+
)
|
|
34
|
+
brief_fields = ("id", "url", "display", "name", "default_view", "description")
|