netbox-plugin-dns 0.21.4__py3-none-any.whl → 1.4.7__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.
- netbox_dns/__init__.py +106 -41
- netbox_dns/api/field_serializers.py +25 -0
- netbox_dns/api/nested_serializers.py +95 -52
- netbox_dns/api/serializers.py +14 -296
- netbox_dns/api/serializers_/__init__.py +0 -0
- netbox_dns/api/serializers_/dnssec_key_template.py +69 -0
- netbox_dns/api/serializers_/dnssec_policy.py +165 -0
- netbox_dns/api/serializers_/nameserver.py +56 -0
- netbox_dns/api/serializers_/prefix.py +18 -0
- netbox_dns/api/serializers_/record.py +105 -0
- netbox_dns/api/serializers_/record_template.py +71 -0
- netbox_dns/api/serializers_/registrar.py +45 -0
- netbox_dns/api/serializers_/registration_contact.py +50 -0
- netbox_dns/api/serializers_/view.py +81 -0
- netbox_dns/api/serializers_/zone.py +247 -0
- netbox_dns/api/serializers_/zone_template.py +157 -0
- netbox_dns/api/urls.py +13 -2
- netbox_dns/api/views.py +96 -58
- netbox_dns/choices/__init__.py +4 -0
- netbox_dns/choices/dnssec_key_template.py +67 -0
- netbox_dns/choices/dnssec_policy.py +40 -0
- netbox_dns/choices/record.py +104 -0
- netbox_dns/choices/utilities.py +4 -0
- netbox_dns/choices/zone.py +119 -0
- netbox_dns/fields/__init__.py +4 -0
- netbox_dns/fields/address.py +22 -16
- netbox_dns/fields/choice_array.py +33 -0
- netbox_dns/fields/ipam.py +15 -0
- netbox_dns/fields/network.py +42 -18
- netbox_dns/fields/rfc2317.py +97 -0
- netbox_dns/fields/timeperiod.py +33 -0
- netbox_dns/filters.py +7 -0
- netbox_dns/filtersets/__init__.py +12 -0
- netbox_dns/filtersets/dnssec_key_template.py +57 -0
- netbox_dns/filtersets/dnssec_policy.py +101 -0
- netbox_dns/filtersets/nameserver.py +46 -0
- netbox_dns/filtersets/record.py +135 -0
- netbox_dns/filtersets/record_template.py +59 -0
- netbox_dns/{filters → filtersets}/registrar.py +8 -1
- netbox_dns/{filters/contact.py → filtersets/registration_contact.py} +9 -3
- netbox_dns/filtersets/view.py +45 -0
- netbox_dns/filtersets/zone.py +254 -0
- netbox_dns/filtersets/zone_template.py +165 -0
- netbox_dns/forms/__init__.py +5 -1
- netbox_dns/forms/dnssec_key_template.py +250 -0
- netbox_dns/forms/dnssec_policy.py +654 -0
- netbox_dns/forms/nameserver.py +121 -27
- netbox_dns/forms/record.py +215 -104
- netbox_dns/forms/record_template.py +285 -0
- netbox_dns/forms/registrar.py +108 -31
- netbox_dns/forms/registration_contact.py +282 -0
- netbox_dns/forms/view.py +331 -20
- netbox_dns/forms/zone.py +769 -373
- netbox_dns/forms/zone_template.py +463 -0
- netbox_dns/graphql/__init__.py +25 -22
- netbox_dns/graphql/enums.py +41 -0
- netbox_dns/graphql/filter_lookups.py +13 -0
- netbox_dns/graphql/filters/__init__.py +12 -0
- netbox_dns/graphql/filters/dnssec_key_template.py +63 -0
- netbox_dns/graphql/filters/dnssec_policy.py +124 -0
- netbox_dns/graphql/filters/nameserver.py +32 -0
- netbox_dns/graphql/filters/record.py +89 -0
- netbox_dns/graphql/filters/record_template.py +55 -0
- netbox_dns/graphql/filters/registrar.py +30 -0
- netbox_dns/graphql/filters/registration_contact.py +27 -0
- netbox_dns/graphql/filters/view.py +28 -0
- netbox_dns/graphql/filters/zone.py +147 -0
- netbox_dns/graphql/filters/zone_template.py +97 -0
- netbox_dns/graphql/schema.py +89 -7
- netbox_dns/graphql/types.py +355 -0
- netbox_dns/locale/de/LC_MESSAGES/django.mo +0 -0
- netbox_dns/locale/en/LC_MESSAGES/django.mo +0 -0
- netbox_dns/locale/fr/LC_MESSAGES/django.mo +0 -0
- netbox_dns/management/commands/cleanup_database.py +175 -156
- netbox_dns/management/commands/cleanup_rrset_ttl.py +64 -0
- netbox_dns/management/commands/rebuild_dnssync.py +23 -0
- netbox_dns/management/commands/setup_dnssync.py +140 -0
- netbox_dns/migrations/0001_squashed_netbox_dns_0_15.py +0 -27
- netbox_dns/migrations/0001_squashed_netbox_dns_0_22.py +557 -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/0006_templating.py +172 -0
- netbox_dns/migrations/0007_alter_ordering_options.py +25 -0
- netbox_dns/migrations/0008_view_prefixes.py +18 -0
- netbox_dns/migrations/0009_rename_contact_registrationcontact.py +36 -0
- netbox_dns/migrations/0010_view_ip_address_filter.py +18 -0
- netbox_dns/migrations/0011_rename_related_fields.py +63 -0
- netbox_dns/migrations/0012_natural_ordering.py +88 -0
- netbox_dns/migrations/0013_zonetemplate_soa_mname_zonetemplate_soa_rname.py +30 -0
- netbox_dns/migrations/0014_alter_unique_constraints_lowercase.py +42 -0
- netbox_dns/migrations/0015_dnssec.py +168 -0
- netbox_dns/migrations/{0015_add_record_status.py → 0016_dnssec_policy_status.py} +5 -4
- netbox_dns/migrations/0017_dnssec_policy_zone_zone_template.py +41 -0
- netbox_dns/migrations/0018_zone_domain_status_zone_expiration_date.py +23 -0
- netbox_dns/migrations/0019_dnssecpolicy_parental_agents.py +25 -0
- netbox_dns/migrations/0020_netbox_3_4.py +1 -1
- netbox_dns/migrations/0020_remove_dnssecpolicy_parental_agents_and_more.py +29 -0
- netbox_dns/migrations/0021_alter_record_ptr_record.py +25 -0
- netbox_dns/migrations/0021_record_ip_address.py +1 -1
- netbox_dns/migrations/0022_alter_record_ipam_ip_address.py +26 -0
- netbox_dns/migrations/0023_disable_ptr_false.py +27 -0
- netbox_dns/migrations/0024_zonetemplate_parental_agents.py +25 -0
- netbox_dns/migrations/0025_remove_zone_inline_signing_and_more.py +22 -0
- netbox_dns/migrations/0026_alter_dnssecpolicy_nsec3_opt_out.py +18 -0
- netbox_dns/migrations/0026_domain_registration.py +1 -1
- netbox_dns/migrations/0027_zone_comments.py +18 -0
- netbox_dns/migrations/0028_alter_zone_default_ttl_alter_zone_soa_minimum_and_more.py +54 -0
- netbox_dns/migrations/0028_rfc2317_fields.py +44 -0
- netbox_dns/migrations/0029_alter_registrationcontact_street.py +18 -0
- netbox_dns/migrations/0029_record_fqdn.py +30 -0
- netbox_dns/mixins/__init__.py +1 -0
- netbox_dns/mixins/object_modification.py +57 -0
- netbox_dns/models/__init__.py +5 -1
- netbox_dns/models/dnssec_key_template.py +114 -0
- netbox_dns/models/dnssec_policy.py +203 -0
- netbox_dns/models/nameserver.py +61 -30
- netbox_dns/models/record.py +781 -234
- netbox_dns/models/record_template.py +198 -0
- netbox_dns/models/registrar.py +34 -15
- netbox_dns/models/{contact.py → registration_contact.py} +72 -43
- netbox_dns/models/view.py +129 -9
- netbox_dns/models/zone.py +806 -242
- netbox_dns/models/zone_template.py +209 -0
- netbox_dns/navigation.py +176 -76
- netbox_dns/signals/__init__.py +0 -0
- netbox_dns/signals/dnssec.py +32 -0
- netbox_dns/signals/ipam_dnssync.py +216 -0
- netbox_dns/tables/__init__.py +5 -1
- netbox_dns/tables/dnssec_key_template.py +49 -0
- netbox_dns/tables/dnssec_policy.py +140 -0
- netbox_dns/tables/ipam_dnssync.py +12 -0
- netbox_dns/tables/nameserver.py +14 -17
- netbox_dns/tables/record.py +117 -59
- netbox_dns/tables/record_template.py +91 -0
- netbox_dns/tables/registrar.py +20 -10
- netbox_dns/tables/{contact.py → registration_contact.py} +22 -11
- netbox_dns/tables/view.py +47 -3
- netbox_dns/tables/zone.py +62 -31
- netbox_dns/tables/zone_template.py +78 -0
- netbox_dns/template_content.py +124 -38
- netbox_dns/templates/netbox_dns/dnsseckeytemplate.html +70 -0
- netbox_dns/templates/netbox_dns/dnssecpolicy.html +163 -0
- netbox_dns/templates/netbox_dns/nameserver.html +31 -28
- netbox_dns/templates/netbox_dns/record/managed.html +2 -1
- netbox_dns/templates/netbox_dns/record/related.html +17 -6
- netbox_dns/templates/netbox_dns/record.html +140 -93
- netbox_dns/templates/netbox_dns/recordtemplate.html +96 -0
- netbox_dns/templates/netbox_dns/registrar.html +41 -34
- netbox_dns/templates/netbox_dns/registrationcontact.html +76 -0
- netbox_dns/templates/netbox_dns/view/button.html +10 -0
- netbox_dns/templates/netbox_dns/view/prefix.html +44 -0
- netbox_dns/templates/netbox_dns/view/related.html +33 -0
- netbox_dns/templates/netbox_dns/view.html +62 -18
- netbox_dns/templates/netbox_dns/zone/base.html +6 -3
- netbox_dns/templates/netbox_dns/zone/child.html +6 -5
- netbox_dns/templates/netbox_dns/zone/child_zone.html +18 -0
- netbox_dns/templates/netbox_dns/zone/delegation_record.html +18 -0
- netbox_dns/templates/netbox_dns/zone/managed_record.html +1 -1
- netbox_dns/templates/netbox_dns/zone/record.html +6 -5
- netbox_dns/templates/netbox_dns/zone/registration.html +43 -24
- netbox_dns/templates/netbox_dns/zone/rfc2317_child_zone.html +18 -0
- netbox_dns/templates/netbox_dns/zone.html +178 -119
- netbox_dns/templates/netbox_dns/zonetemplate/child.html +46 -0
- netbox_dns/templates/netbox_dns/zonetemplate.html +124 -0
- netbox_dns/templatetags/netbox_dns.py +10 -0
- netbox_dns/urls.py +50 -210
- netbox_dns/utilities/__init__.py +3 -0
- netbox_dns/{utilities.py → utilities/conversions.py} +55 -7
- netbox_dns/utilities/dns.py +11 -0
- netbox_dns/utilities/ipam_dnssync.py +370 -0
- netbox_dns/validators/__init__.py +4 -0
- netbox_dns/validators/dns_name.py +116 -0
- netbox_dns/validators/dns_value.py +147 -0
- netbox_dns/validators/dnssec.py +148 -0
- netbox_dns/validators/rfc2317.py +28 -0
- netbox_dns/views/__init__.py +5 -1
- netbox_dns/views/dnssec_key_template.py +78 -0
- netbox_dns/views/dnssec_policy.py +146 -0
- netbox_dns/views/nameserver.py +34 -15
- netbox_dns/views/record.py +156 -15
- netbox_dns/views/record_template.py +93 -0
- netbox_dns/views/registrar.py +32 -13
- netbox_dns/views/registration_contact.py +101 -0
- netbox_dns/views/view.py +58 -14
- netbox_dns/views/zone.py +130 -33
- netbox_dns/views/zone_template.py +82 -0
- netbox_plugin_dns-1.4.7.dist-info/METADATA +132 -0
- netbox_plugin_dns-1.4.7.dist-info/RECORD +201 -0
- {netbox_plugin_dns-0.21.4.dist-info → netbox_plugin_dns-1.4.7.dist-info}/WHEEL +2 -1
- {netbox_plugin_dns-0.21.4.dist-info → netbox_plugin_dns-1.4.7.dist-info/licenses}/LICENSE +2 -1
- netbox_plugin_dns-1.4.7.dist-info/top_level.txt +1 -0
- netbox_dns/filters/__init__.py +0 -6
- netbox_dns/filters/nameserver.py +0 -18
- netbox_dns/filters/record.py +0 -53
- netbox_dns/filters/view.py +0 -18
- netbox_dns/filters/zone.py +0 -112
- netbox_dns/forms/contact.py +0 -211
- 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/management/commands/setup_coupling.py +0 -75
- netbox_dns/management/commands/update_soa.py +0 -22
- netbox_dns/middleware.py +0 -226
- 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/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/templates/netbox_dns/contact.html +0 -71
- netbox_dns/templates/netbox_dns/related_dns_objects.html +0 -21
- netbox_dns/templatetags/view_helpers.py +0 -15
- netbox_dns/validators.py +0 -57
- netbox_dns/views/contact.py +0 -83
- netbox_plugin_dns-0.21.4.dist-info/METADATA +0 -101
- netbox_plugin_dns-0.21.4.dist-info/RECORD +0 -110
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
from django.utils.translation import gettext as _
|
|
2
|
+
from rest_framework import serializers
|
|
3
|
+
|
|
4
|
+
from netbox.api.serializers import NetBoxModelSerializer
|
|
5
|
+
from ipam.api.serializers import IPAddressSerializer
|
|
6
|
+
from tenancy.api.serializers import TenantSerializer
|
|
7
|
+
|
|
8
|
+
from netbox_dns.models import Record
|
|
9
|
+
|
|
10
|
+
from ..nested_serializers import NestedZoneSerializer, NestedRecordSerializer
|
|
11
|
+
from ..field_serializers import TimePeriodField
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
__all__ = ("RecordSerializer",)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
class RecordSerializer(NetBoxModelSerializer):
|
|
18
|
+
class Meta:
|
|
19
|
+
model = Record
|
|
20
|
+
fields = (
|
|
21
|
+
"id",
|
|
22
|
+
"url",
|
|
23
|
+
"zone",
|
|
24
|
+
"display",
|
|
25
|
+
"display_url",
|
|
26
|
+
"type",
|
|
27
|
+
"name",
|
|
28
|
+
"fqdn",
|
|
29
|
+
"value",
|
|
30
|
+
"status",
|
|
31
|
+
"ttl",
|
|
32
|
+
"description",
|
|
33
|
+
"tags",
|
|
34
|
+
"created",
|
|
35
|
+
"last_updated",
|
|
36
|
+
"managed",
|
|
37
|
+
"disable_ptr",
|
|
38
|
+
"ptr_record",
|
|
39
|
+
"address_records",
|
|
40
|
+
"active",
|
|
41
|
+
"custom_fields",
|
|
42
|
+
"tenant",
|
|
43
|
+
"ipam_ip_address",
|
|
44
|
+
"absolute_value",
|
|
45
|
+
)
|
|
46
|
+
|
|
47
|
+
brief_fields = (
|
|
48
|
+
"id",
|
|
49
|
+
"url",
|
|
50
|
+
"zone",
|
|
51
|
+
"display",
|
|
52
|
+
"type",
|
|
53
|
+
"name",
|
|
54
|
+
"fqdn",
|
|
55
|
+
"value",
|
|
56
|
+
"status",
|
|
57
|
+
"ttl",
|
|
58
|
+
"description",
|
|
59
|
+
"managed",
|
|
60
|
+
"active",
|
|
61
|
+
)
|
|
62
|
+
|
|
63
|
+
url = serializers.HyperlinkedIdentityField(
|
|
64
|
+
view_name="plugins-api:netbox_dns-api:record-detail"
|
|
65
|
+
)
|
|
66
|
+
ttl = TimePeriodField(
|
|
67
|
+
required=False,
|
|
68
|
+
allow_null=True,
|
|
69
|
+
)
|
|
70
|
+
ptr_record = NestedRecordSerializer(
|
|
71
|
+
many=False,
|
|
72
|
+
read_only=True,
|
|
73
|
+
required=False,
|
|
74
|
+
allow_null=True,
|
|
75
|
+
help_text=_("PTR record related to an address"),
|
|
76
|
+
)
|
|
77
|
+
address_records = NestedRecordSerializer(
|
|
78
|
+
many=True,
|
|
79
|
+
read_only=True,
|
|
80
|
+
required=False,
|
|
81
|
+
allow_null=True,
|
|
82
|
+
help_text=_("Address records related to the PTR"),
|
|
83
|
+
)
|
|
84
|
+
zone = NestedZoneSerializer(
|
|
85
|
+
many=False,
|
|
86
|
+
required=False,
|
|
87
|
+
help_text=_("Zone the record belongs to"),
|
|
88
|
+
)
|
|
89
|
+
active = serializers.BooleanField(
|
|
90
|
+
required=False,
|
|
91
|
+
read_only=True,
|
|
92
|
+
)
|
|
93
|
+
ipam_ip_address = IPAddressSerializer(
|
|
94
|
+
nested=True,
|
|
95
|
+
many=False,
|
|
96
|
+
read_only=True,
|
|
97
|
+
required=False,
|
|
98
|
+
allow_null=True,
|
|
99
|
+
help_text=_("IPAddress linked to the record"),
|
|
100
|
+
)
|
|
101
|
+
tenant = TenantSerializer(
|
|
102
|
+
nested=True,
|
|
103
|
+
required=False,
|
|
104
|
+
allow_null=True,
|
|
105
|
+
)
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
from django.utils.translation import gettext as _
|
|
2
|
+
from rest_framework import serializers
|
|
3
|
+
|
|
4
|
+
from netbox.api.serializers import NetBoxModelSerializer
|
|
5
|
+
from tenancy.api.serializers import TenantSerializer
|
|
6
|
+
|
|
7
|
+
from netbox_dns.models import RecordTemplate
|
|
8
|
+
|
|
9
|
+
from ..nested_serializers import NestedZoneTemplateSerializer
|
|
10
|
+
from ..field_serializers import TimePeriodField
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
__all__ = ("RecordTemplateSerializer",)
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
class RecordTemplateSerializer(NetBoxModelSerializer):
|
|
17
|
+
class Meta:
|
|
18
|
+
model = RecordTemplate
|
|
19
|
+
|
|
20
|
+
fields = (
|
|
21
|
+
"id",
|
|
22
|
+
"url",
|
|
23
|
+
"display",
|
|
24
|
+
"display_url",
|
|
25
|
+
"type",
|
|
26
|
+
"name",
|
|
27
|
+
"record_name",
|
|
28
|
+
"value",
|
|
29
|
+
"status",
|
|
30
|
+
"ttl",
|
|
31
|
+
"description",
|
|
32
|
+
"tags",
|
|
33
|
+
"created",
|
|
34
|
+
"last_updated",
|
|
35
|
+
"disable_ptr",
|
|
36
|
+
"custom_fields",
|
|
37
|
+
"tenant",
|
|
38
|
+
"zone_templates",
|
|
39
|
+
)
|
|
40
|
+
|
|
41
|
+
brief_fields = (
|
|
42
|
+
"id",
|
|
43
|
+
"url",
|
|
44
|
+
"display",
|
|
45
|
+
"type",
|
|
46
|
+
"name",
|
|
47
|
+
"record_name",
|
|
48
|
+
"value",
|
|
49
|
+
"status",
|
|
50
|
+
"ttl",
|
|
51
|
+
"description",
|
|
52
|
+
)
|
|
53
|
+
|
|
54
|
+
url = serializers.HyperlinkedIdentityField(
|
|
55
|
+
view_name="plugins-api:netbox_dns-api:recordtemplate-detail"
|
|
56
|
+
)
|
|
57
|
+
ttl = TimePeriodField(
|
|
58
|
+
required=False,
|
|
59
|
+
allow_null=True,
|
|
60
|
+
)
|
|
61
|
+
tenant = TenantSerializer(
|
|
62
|
+
nested=True,
|
|
63
|
+
required=False,
|
|
64
|
+
allow_null=True,
|
|
65
|
+
)
|
|
66
|
+
zone_templates = NestedZoneTemplateSerializer(
|
|
67
|
+
many=True,
|
|
68
|
+
read_only=True,
|
|
69
|
+
required=False,
|
|
70
|
+
help_text=_("Zone templates using the record template"),
|
|
71
|
+
)
|
|
@@ -0,0 +1,45 @@
|
|
|
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
|
+
__all__ = ("RegistrarSerializer",)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class RegistrarSerializer(NetBoxModelSerializer):
|
|
12
|
+
class Meta:
|
|
13
|
+
model = Registrar
|
|
14
|
+
|
|
15
|
+
fields = (
|
|
16
|
+
"id",
|
|
17
|
+
"url",
|
|
18
|
+
"display",
|
|
19
|
+
"display_url",
|
|
20
|
+
"name",
|
|
21
|
+
"description",
|
|
22
|
+
"tags",
|
|
23
|
+
"iana_id",
|
|
24
|
+
"address",
|
|
25
|
+
"referral_url",
|
|
26
|
+
"whois_server",
|
|
27
|
+
"abuse_email",
|
|
28
|
+
"abuse_phone",
|
|
29
|
+
"created",
|
|
30
|
+
"last_updated",
|
|
31
|
+
"custom_fields",
|
|
32
|
+
)
|
|
33
|
+
|
|
34
|
+
brief_fields = (
|
|
35
|
+
"id",
|
|
36
|
+
"url",
|
|
37
|
+
"display",
|
|
38
|
+
"name",
|
|
39
|
+
"description",
|
|
40
|
+
"iana_id",
|
|
41
|
+
)
|
|
42
|
+
|
|
43
|
+
url = serializers.HyperlinkedIdentityField(
|
|
44
|
+
view_name="plugins-api:netbox_dns-api:registrar-detail"
|
|
45
|
+
)
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
from rest_framework import serializers
|
|
2
|
+
|
|
3
|
+
from netbox.api.serializers import NetBoxModelSerializer
|
|
4
|
+
|
|
5
|
+
from netbox_dns.models import RegistrationContact
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
__all__ = ("RegistrationContactSerializer",)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class RegistrationContactSerializer(NetBoxModelSerializer):
|
|
12
|
+
class Meta:
|
|
13
|
+
model = RegistrationContact
|
|
14
|
+
|
|
15
|
+
fields = (
|
|
16
|
+
"id",
|
|
17
|
+
"url",
|
|
18
|
+
"display",
|
|
19
|
+
"display_url",
|
|
20
|
+
"name",
|
|
21
|
+
"description",
|
|
22
|
+
"tags",
|
|
23
|
+
"contact_id",
|
|
24
|
+
"organization",
|
|
25
|
+
"street",
|
|
26
|
+
"city",
|
|
27
|
+
"state_province",
|
|
28
|
+
"postal_code",
|
|
29
|
+
"country",
|
|
30
|
+
"phone",
|
|
31
|
+
"phone_ext",
|
|
32
|
+
"fax",
|
|
33
|
+
"fax_ext",
|
|
34
|
+
"email",
|
|
35
|
+
"created",
|
|
36
|
+
"last_updated",
|
|
37
|
+
"custom_fields",
|
|
38
|
+
)
|
|
39
|
+
brief_fields = (
|
|
40
|
+
"id",
|
|
41
|
+
"url",
|
|
42
|
+
"display",
|
|
43
|
+
"name",
|
|
44
|
+
"description",
|
|
45
|
+
"contact_id",
|
|
46
|
+
)
|
|
47
|
+
|
|
48
|
+
url = serializers.HyperlinkedIdentityField(
|
|
49
|
+
view_name="plugins-api:netbox_dns-api:registrationcontact-detail"
|
|
50
|
+
)
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
from django.utils.translation import gettext as _
|
|
2
|
+
from rest_framework import serializers
|
|
3
|
+
|
|
4
|
+
from netbox.api.serializers import NetBoxModelSerializer
|
|
5
|
+
from tenancy.api.serializers import TenantSerializer
|
|
6
|
+
from ipam.api.serializers import PrefixSerializer
|
|
7
|
+
|
|
8
|
+
from netbox_dns.models import View
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
__all__ = ("ViewSerializer",)
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
class ViewSerializer(NetBoxModelSerializer):
|
|
15
|
+
class Meta:
|
|
16
|
+
model = View
|
|
17
|
+
|
|
18
|
+
fields = (
|
|
19
|
+
"id",
|
|
20
|
+
"url",
|
|
21
|
+
"display",
|
|
22
|
+
"display_url",
|
|
23
|
+
"name",
|
|
24
|
+
"default_view",
|
|
25
|
+
"description",
|
|
26
|
+
"tags",
|
|
27
|
+
"created",
|
|
28
|
+
"last_updated",
|
|
29
|
+
"custom_fields",
|
|
30
|
+
"tenant",
|
|
31
|
+
"prefixes",
|
|
32
|
+
"ip_address_filter",
|
|
33
|
+
)
|
|
34
|
+
|
|
35
|
+
brief_fields = (
|
|
36
|
+
"id",
|
|
37
|
+
"url",
|
|
38
|
+
"display",
|
|
39
|
+
"name",
|
|
40
|
+
"default_view",
|
|
41
|
+
"description",
|
|
42
|
+
)
|
|
43
|
+
|
|
44
|
+
url = serializers.HyperlinkedIdentityField(
|
|
45
|
+
view_name="plugins-api:netbox_dns-api:view-detail"
|
|
46
|
+
)
|
|
47
|
+
default_view = serializers.BooleanField(
|
|
48
|
+
read_only=True,
|
|
49
|
+
)
|
|
50
|
+
prefixes = PrefixSerializer(
|
|
51
|
+
many=True,
|
|
52
|
+
nested=True,
|
|
53
|
+
read_only=False,
|
|
54
|
+
required=False,
|
|
55
|
+
help_text=_("IPAM Prefixes assigned to the View"),
|
|
56
|
+
)
|
|
57
|
+
tenant = TenantSerializer(
|
|
58
|
+
nested=True,
|
|
59
|
+
required=False,
|
|
60
|
+
allow_null=True,
|
|
61
|
+
)
|
|
62
|
+
|
|
63
|
+
def create(self, validated_data):
|
|
64
|
+
prefixes = validated_data.pop("prefixes", None)
|
|
65
|
+
|
|
66
|
+
view = super().create(validated_data)
|
|
67
|
+
|
|
68
|
+
if prefixes is not None:
|
|
69
|
+
view.prefixes.set(prefixes)
|
|
70
|
+
|
|
71
|
+
return view
|
|
72
|
+
|
|
73
|
+
def update(self, instance, validated_data):
|
|
74
|
+
prefixes = validated_data.pop("prefixes", None)
|
|
75
|
+
|
|
76
|
+
view = super().update(instance, validated_data)
|
|
77
|
+
|
|
78
|
+
if prefixes is not None:
|
|
79
|
+
view.prefixes.set(prefixes)
|
|
80
|
+
|
|
81
|
+
return view
|
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
from django.utils.translation import gettext as _
|
|
2
|
+
from rest_framework import serializers
|
|
3
|
+
|
|
4
|
+
from netbox.api.serializers import NetBoxModelSerializer
|
|
5
|
+
from tenancy.api.serializers import TenantSerializer
|
|
6
|
+
|
|
7
|
+
from .view import ViewSerializer
|
|
8
|
+
from .nameserver import NameServerSerializer
|
|
9
|
+
from .registrar import RegistrarSerializer
|
|
10
|
+
from .registration_contact import RegistrationContactSerializer
|
|
11
|
+
from .zone_template import ZoneTemplateSerializer
|
|
12
|
+
from .dnssec_policy import DNSSECPolicySerializer
|
|
13
|
+
|
|
14
|
+
from ..nested_serializers import NestedZoneSerializer
|
|
15
|
+
from ..field_serializers import TimePeriodField
|
|
16
|
+
|
|
17
|
+
from netbox_dns.models import Zone
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
__all__ = ("ZoneSerializer",)
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
class ZoneSerializer(NetBoxModelSerializer):
|
|
24
|
+
class Meta:
|
|
25
|
+
model = Zone
|
|
26
|
+
|
|
27
|
+
fields = (
|
|
28
|
+
"id",
|
|
29
|
+
"url",
|
|
30
|
+
"name",
|
|
31
|
+
"view",
|
|
32
|
+
"display",
|
|
33
|
+
"display_url",
|
|
34
|
+
"nameservers",
|
|
35
|
+
"status",
|
|
36
|
+
"description",
|
|
37
|
+
"tags",
|
|
38
|
+
"created",
|
|
39
|
+
"last_updated",
|
|
40
|
+
"default_ttl",
|
|
41
|
+
"soa_ttl",
|
|
42
|
+
"soa_mname",
|
|
43
|
+
"soa_rname",
|
|
44
|
+
"soa_serial",
|
|
45
|
+
"soa_serial_auto",
|
|
46
|
+
"soa_refresh",
|
|
47
|
+
"soa_retry",
|
|
48
|
+
"soa_expire",
|
|
49
|
+
"soa_minimum",
|
|
50
|
+
"rfc2317_prefix",
|
|
51
|
+
"rfc2317_parent_managed",
|
|
52
|
+
"rfc2317_parent_zone",
|
|
53
|
+
"rfc2317_child_zones",
|
|
54
|
+
"dnssec_policy",
|
|
55
|
+
"inline_signing",
|
|
56
|
+
"parental_agents",
|
|
57
|
+
"registrar",
|
|
58
|
+
"registry_domain_id",
|
|
59
|
+
"expiration_date",
|
|
60
|
+
"domain_status",
|
|
61
|
+
"registrant",
|
|
62
|
+
"tech_c",
|
|
63
|
+
"admin_c",
|
|
64
|
+
"billing_c",
|
|
65
|
+
"comments",
|
|
66
|
+
"active",
|
|
67
|
+
"custom_fields",
|
|
68
|
+
"tenant",
|
|
69
|
+
"template",
|
|
70
|
+
)
|
|
71
|
+
|
|
72
|
+
brief_fields = (
|
|
73
|
+
"id",
|
|
74
|
+
"url",
|
|
75
|
+
"name",
|
|
76
|
+
"view",
|
|
77
|
+
"display",
|
|
78
|
+
"status",
|
|
79
|
+
"description",
|
|
80
|
+
"rfc2317_prefix",
|
|
81
|
+
"active",
|
|
82
|
+
)
|
|
83
|
+
|
|
84
|
+
url = serializers.HyperlinkedIdentityField(
|
|
85
|
+
view_name="plugins-api:netbox_dns-api:zone-detail"
|
|
86
|
+
)
|
|
87
|
+
view = ViewSerializer(
|
|
88
|
+
nested=True,
|
|
89
|
+
many=False,
|
|
90
|
+
read_only=False,
|
|
91
|
+
required=False,
|
|
92
|
+
default=None,
|
|
93
|
+
help_text=_("View the zone belongs to"),
|
|
94
|
+
)
|
|
95
|
+
nameservers = NameServerSerializer(
|
|
96
|
+
nested=True,
|
|
97
|
+
many=True,
|
|
98
|
+
read_only=False,
|
|
99
|
+
required=False,
|
|
100
|
+
help_text=_("Nameservers for the zone"),
|
|
101
|
+
)
|
|
102
|
+
default_ttl = TimePeriodField(
|
|
103
|
+
required=False,
|
|
104
|
+
allow_null=True,
|
|
105
|
+
)
|
|
106
|
+
soa_ttl = TimePeriodField(
|
|
107
|
+
required=False,
|
|
108
|
+
allow_null=True,
|
|
109
|
+
)
|
|
110
|
+
soa_mname = NameServerSerializer(
|
|
111
|
+
nested=True,
|
|
112
|
+
many=False,
|
|
113
|
+
read_only=False,
|
|
114
|
+
required=False,
|
|
115
|
+
help_text=_("Primary nameserver for the zone"),
|
|
116
|
+
)
|
|
117
|
+
soa_rname = serializers.CharField(
|
|
118
|
+
max_length=255,
|
|
119
|
+
read_only=False,
|
|
120
|
+
required=False,
|
|
121
|
+
help_text=_("Contact email for the zone"),
|
|
122
|
+
)
|
|
123
|
+
soa_refresh = TimePeriodField(
|
|
124
|
+
required=False,
|
|
125
|
+
allow_null=True,
|
|
126
|
+
)
|
|
127
|
+
soa_retry = TimePeriodField(
|
|
128
|
+
required=False,
|
|
129
|
+
allow_null=True,
|
|
130
|
+
)
|
|
131
|
+
soa_expire = TimePeriodField(
|
|
132
|
+
required=False,
|
|
133
|
+
allow_null=True,
|
|
134
|
+
)
|
|
135
|
+
soa_minimum = TimePeriodField(
|
|
136
|
+
required=False,
|
|
137
|
+
allow_null=True,
|
|
138
|
+
)
|
|
139
|
+
rfc2317_parent_zone = NestedZoneSerializer(
|
|
140
|
+
many=False,
|
|
141
|
+
read_only=True,
|
|
142
|
+
required=False,
|
|
143
|
+
help_text=_("RFC2317 parent zone of the zone"),
|
|
144
|
+
)
|
|
145
|
+
rfc2317_child_zones = NestedZoneSerializer(
|
|
146
|
+
many=True,
|
|
147
|
+
read_only=True,
|
|
148
|
+
required=False,
|
|
149
|
+
help_text=_("RFC2317 child zones of the zone"),
|
|
150
|
+
)
|
|
151
|
+
dnssec_policy = DNSSECPolicySerializer(
|
|
152
|
+
nested=True,
|
|
153
|
+
many=False,
|
|
154
|
+
read_only=False,
|
|
155
|
+
required=False,
|
|
156
|
+
help_text=_("DNSSEC policy to apply to the zone"),
|
|
157
|
+
)
|
|
158
|
+
registrar = RegistrarSerializer(
|
|
159
|
+
nested=True,
|
|
160
|
+
many=False,
|
|
161
|
+
read_only=False,
|
|
162
|
+
required=False,
|
|
163
|
+
help_text=_("Registrar the domain is registered with"),
|
|
164
|
+
)
|
|
165
|
+
registrant = RegistrationContactSerializer(
|
|
166
|
+
nested=True,
|
|
167
|
+
many=False,
|
|
168
|
+
read_only=False,
|
|
169
|
+
required=False,
|
|
170
|
+
help_text=_("Registrant of the domain"),
|
|
171
|
+
)
|
|
172
|
+
admin_c = RegistrationContactSerializer(
|
|
173
|
+
nested=True,
|
|
174
|
+
many=False,
|
|
175
|
+
read_only=False,
|
|
176
|
+
required=False,
|
|
177
|
+
help_text=_("Administrative contact for the domain"),
|
|
178
|
+
)
|
|
179
|
+
tech_c = RegistrationContactSerializer(
|
|
180
|
+
nested=True,
|
|
181
|
+
many=False,
|
|
182
|
+
read_only=False,
|
|
183
|
+
required=False,
|
|
184
|
+
help_text=_("Technical contact for the domain"),
|
|
185
|
+
)
|
|
186
|
+
billing_c = RegistrationContactSerializer(
|
|
187
|
+
nested=True,
|
|
188
|
+
many=False,
|
|
189
|
+
read_only=False,
|
|
190
|
+
required=False,
|
|
191
|
+
help_text=_("Billing contact for the domain"),
|
|
192
|
+
)
|
|
193
|
+
template = ZoneTemplateSerializer(
|
|
194
|
+
nested=True,
|
|
195
|
+
write_only=True,
|
|
196
|
+
required=False,
|
|
197
|
+
default=None,
|
|
198
|
+
help_text=_("Template to apply to the zone"),
|
|
199
|
+
)
|
|
200
|
+
inline_signing = serializers.SerializerMethodField()
|
|
201
|
+
active = serializers.BooleanField(
|
|
202
|
+
required=False,
|
|
203
|
+
read_only=True,
|
|
204
|
+
allow_null=True,
|
|
205
|
+
)
|
|
206
|
+
tenant = TenantSerializer(
|
|
207
|
+
nested=True,
|
|
208
|
+
required=False,
|
|
209
|
+
allow_null=True,
|
|
210
|
+
)
|
|
211
|
+
|
|
212
|
+
def validate(self, data):
|
|
213
|
+
if isinstance(data, dict) and (template := data.get("template")) is not None:
|
|
214
|
+
template.apply_to_zone_data(data)
|
|
215
|
+
|
|
216
|
+
return super().validate(data)
|
|
217
|
+
|
|
218
|
+
def get_inline_signing(self, instance):
|
|
219
|
+
return instance.inline_signing
|
|
220
|
+
|
|
221
|
+
def create(self, validated_data):
|
|
222
|
+
template = validated_data.pop("template", None)
|
|
223
|
+
nameservers = validated_data.pop("nameservers", None)
|
|
224
|
+
|
|
225
|
+
zone = super().create(validated_data)
|
|
226
|
+
|
|
227
|
+
if nameservers is not None:
|
|
228
|
+
zone.nameservers.set(nameservers)
|
|
229
|
+
|
|
230
|
+
if template is not None:
|
|
231
|
+
template.apply_to_zone_relations(zone)
|
|
232
|
+
|
|
233
|
+
return zone
|
|
234
|
+
|
|
235
|
+
def update(self, instance, validated_data):
|
|
236
|
+
template = validated_data.pop("template", None)
|
|
237
|
+
nameservers = validated_data.pop("nameservers", None)
|
|
238
|
+
|
|
239
|
+
zone = super().update(instance, validated_data)
|
|
240
|
+
|
|
241
|
+
if nameservers is not None:
|
|
242
|
+
zone.nameservers.set(nameservers)
|
|
243
|
+
|
|
244
|
+
if template is not None:
|
|
245
|
+
template.apply_to_zone_relations(zone)
|
|
246
|
+
|
|
247
|
+
return zone
|