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
netbox_dns/api/serializers.py
CHANGED
|
@@ -1,296 +1,14 @@
|
|
|
1
|
-
from
|
|
2
|
-
|
|
3
|
-
from
|
|
4
|
-
from
|
|
5
|
-
from
|
|
6
|
-
|
|
7
|
-
from
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
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
|
-
registrar = NestedRegistrarSerializer(
|
|
61
|
-
many=False,
|
|
62
|
-
read_only=False,
|
|
63
|
-
required=False,
|
|
64
|
-
help_text="The registrar the domain is registered with",
|
|
65
|
-
)
|
|
66
|
-
registrant = NestedContactSerializer(
|
|
67
|
-
many=False,
|
|
68
|
-
read_only=False,
|
|
69
|
-
required=False,
|
|
70
|
-
help_text="The owner of the domain",
|
|
71
|
-
)
|
|
72
|
-
admin_c = NestedContactSerializer(
|
|
73
|
-
many=False,
|
|
74
|
-
read_only=False,
|
|
75
|
-
required=False,
|
|
76
|
-
help_text="The administrative contact for the domain",
|
|
77
|
-
)
|
|
78
|
-
tech_c = NestedContactSerializer(
|
|
79
|
-
many=False,
|
|
80
|
-
read_only=False,
|
|
81
|
-
required=False,
|
|
82
|
-
help_text="The technical contact for the domain",
|
|
83
|
-
)
|
|
84
|
-
billing_c = NestedContactSerializer(
|
|
85
|
-
many=False,
|
|
86
|
-
read_only=False,
|
|
87
|
-
required=False,
|
|
88
|
-
help_text="The billing contact for the domain",
|
|
89
|
-
)
|
|
90
|
-
active = serializers.BooleanField(
|
|
91
|
-
required=False,
|
|
92
|
-
read_only=True,
|
|
93
|
-
allow_null=True,
|
|
94
|
-
)
|
|
95
|
-
tenant = NestedTenantSerializer(required=False, allow_null=True)
|
|
96
|
-
|
|
97
|
-
def create(self, validated_data):
|
|
98
|
-
nameservers = validated_data.pop("nameservers", None)
|
|
99
|
-
|
|
100
|
-
zone = super().create(validated_data)
|
|
101
|
-
|
|
102
|
-
if nameservers is not None:
|
|
103
|
-
zone.nameservers.set(nameservers)
|
|
104
|
-
|
|
105
|
-
return zone
|
|
106
|
-
|
|
107
|
-
def update(self, instance, validated_data):
|
|
108
|
-
nameservers = validated_data.pop("nameservers", None)
|
|
109
|
-
|
|
110
|
-
zone = super().update(instance, validated_data)
|
|
111
|
-
|
|
112
|
-
if nameservers is not None:
|
|
113
|
-
zone.nameservers.set(nameservers)
|
|
114
|
-
|
|
115
|
-
return zone
|
|
116
|
-
|
|
117
|
-
class Meta:
|
|
118
|
-
model = Zone
|
|
119
|
-
fields = (
|
|
120
|
-
"id",
|
|
121
|
-
"url",
|
|
122
|
-
"name",
|
|
123
|
-
"view",
|
|
124
|
-
"display",
|
|
125
|
-
"nameservers",
|
|
126
|
-
"status",
|
|
127
|
-
"description",
|
|
128
|
-
"tags",
|
|
129
|
-
"created",
|
|
130
|
-
"last_updated",
|
|
131
|
-
"default_ttl",
|
|
132
|
-
"soa_ttl",
|
|
133
|
-
"soa_mname",
|
|
134
|
-
"soa_rname",
|
|
135
|
-
"soa_serial",
|
|
136
|
-
"soa_serial_auto",
|
|
137
|
-
"soa_refresh",
|
|
138
|
-
"soa_retry",
|
|
139
|
-
"soa_expire",
|
|
140
|
-
"soa_minimum",
|
|
141
|
-
"registrar",
|
|
142
|
-
"registry_domain_id",
|
|
143
|
-
"registrant",
|
|
144
|
-
"tech_c",
|
|
145
|
-
"admin_c",
|
|
146
|
-
"billing_c",
|
|
147
|
-
"active",
|
|
148
|
-
"custom_fields",
|
|
149
|
-
"tenant",
|
|
150
|
-
)
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
class NameServerSerializer(NetBoxModelSerializer):
|
|
154
|
-
url = serializers.HyperlinkedIdentityField(
|
|
155
|
-
view_name="plugins-api:netbox_dns-api:nameserver-detail"
|
|
156
|
-
)
|
|
157
|
-
zones = NestedZoneSerializer(
|
|
158
|
-
many=True,
|
|
159
|
-
read_only=True,
|
|
160
|
-
required=False,
|
|
161
|
-
default=None,
|
|
162
|
-
help_text="Zones served by the authoritative nameserver",
|
|
163
|
-
)
|
|
164
|
-
tenant = NestedTenantSerializer(required=False, allow_null=True)
|
|
165
|
-
|
|
166
|
-
class Meta:
|
|
167
|
-
model = NameServer
|
|
168
|
-
fields = (
|
|
169
|
-
"id",
|
|
170
|
-
"url",
|
|
171
|
-
"display",
|
|
172
|
-
"name",
|
|
173
|
-
"description",
|
|
174
|
-
"tags",
|
|
175
|
-
"zones",
|
|
176
|
-
"created",
|
|
177
|
-
"last_updated",
|
|
178
|
-
"custom_fields",
|
|
179
|
-
"tenant",
|
|
180
|
-
)
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
class RecordSerializer(NetBoxModelSerializer):
|
|
184
|
-
url = serializers.HyperlinkedIdentityField(
|
|
185
|
-
view_name="plugins-api:netbox_dns-api:record-detail"
|
|
186
|
-
)
|
|
187
|
-
ptr_record = NestedRecordSerializer(
|
|
188
|
-
many=False,
|
|
189
|
-
read_only=True,
|
|
190
|
-
required=False,
|
|
191
|
-
allow_null=True,
|
|
192
|
-
help_text="PTR record generated from an address",
|
|
193
|
-
)
|
|
194
|
-
address_record = NestedRecordSerializer(
|
|
195
|
-
many=False,
|
|
196
|
-
read_only=True,
|
|
197
|
-
required=False,
|
|
198
|
-
allow_null=True,
|
|
199
|
-
help_text="Address record defining the PTR",
|
|
200
|
-
)
|
|
201
|
-
zone = NestedZoneSerializer(
|
|
202
|
-
many=False,
|
|
203
|
-
required=False,
|
|
204
|
-
help_text="Zone the record belongs to",
|
|
205
|
-
)
|
|
206
|
-
active = serializers.BooleanField(
|
|
207
|
-
required=False,
|
|
208
|
-
read_only=True,
|
|
209
|
-
)
|
|
210
|
-
ipam_ip_address = NestedIPAddressSerializer(
|
|
211
|
-
many=False,
|
|
212
|
-
read_only=True,
|
|
213
|
-
required=False,
|
|
214
|
-
allow_null=True,
|
|
215
|
-
help_text="IPAddress linked to the record",
|
|
216
|
-
)
|
|
217
|
-
tenant = NestedTenantSerializer(required=False, allow_null=True)
|
|
218
|
-
|
|
219
|
-
class Meta:
|
|
220
|
-
model = Record
|
|
221
|
-
fields = (
|
|
222
|
-
"id",
|
|
223
|
-
"url",
|
|
224
|
-
"zone",
|
|
225
|
-
"display",
|
|
226
|
-
"type",
|
|
227
|
-
"name",
|
|
228
|
-
"value",
|
|
229
|
-
"status",
|
|
230
|
-
"ttl",
|
|
231
|
-
"description",
|
|
232
|
-
"tags",
|
|
233
|
-
"created",
|
|
234
|
-
"last_updated",
|
|
235
|
-
"managed",
|
|
236
|
-
"disable_ptr",
|
|
237
|
-
"ptr_record",
|
|
238
|
-
"address_record",
|
|
239
|
-
"active",
|
|
240
|
-
"custom_fields",
|
|
241
|
-
"tenant",
|
|
242
|
-
"ipam_ip_address",
|
|
243
|
-
)
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
class RegistrarSerializer(NetBoxModelSerializer):
|
|
247
|
-
url = serializers.HyperlinkedIdentityField(
|
|
248
|
-
view_name="plugins-api:netbox_dns-api:registrar-detail"
|
|
249
|
-
)
|
|
250
|
-
|
|
251
|
-
class Meta:
|
|
252
|
-
model = Registrar
|
|
253
|
-
fields = (
|
|
254
|
-
"id",
|
|
255
|
-
"url",
|
|
256
|
-
"display",
|
|
257
|
-
"name",
|
|
258
|
-
"iana_id",
|
|
259
|
-
"referral_url",
|
|
260
|
-
"whois_server",
|
|
261
|
-
"abuse_email",
|
|
262
|
-
"abuse_phone",
|
|
263
|
-
"created",
|
|
264
|
-
"last_updated",
|
|
265
|
-
"custom_fields",
|
|
266
|
-
)
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
class ContactSerializer(NetBoxModelSerializer):
|
|
270
|
-
url = serializers.HyperlinkedIdentityField(
|
|
271
|
-
view_name="plugins-api:netbox_dns-api:contact-detail"
|
|
272
|
-
)
|
|
273
|
-
|
|
274
|
-
class Meta:
|
|
275
|
-
model = Contact
|
|
276
|
-
fields = (
|
|
277
|
-
"id",
|
|
278
|
-
"url",
|
|
279
|
-
"display",
|
|
280
|
-
"name",
|
|
281
|
-
"contact_id",
|
|
282
|
-
"organization",
|
|
283
|
-
"street",
|
|
284
|
-
"city",
|
|
285
|
-
"state_province",
|
|
286
|
-
"postal_code",
|
|
287
|
-
"country",
|
|
288
|
-
"phone",
|
|
289
|
-
"phone_ext",
|
|
290
|
-
"fax",
|
|
291
|
-
"fax_ext",
|
|
292
|
-
"email",
|
|
293
|
-
"created",
|
|
294
|
-
"last_updated",
|
|
295
|
-
"custom_fields",
|
|
296
|
-
)
|
|
1
|
+
from .serializers_.nameserver import *
|
|
2
|
+
from .serializers_.record import *
|
|
3
|
+
from .serializers_.registrar import *
|
|
4
|
+
from .serializers_.registration_contact import *
|
|
5
|
+
from .serializers_.view import *
|
|
6
|
+
from .serializers_.zone import *
|
|
7
|
+
from .serializers_.zone_template import *
|
|
8
|
+
from .serializers_.record_template import *
|
|
9
|
+
from .serializers_.dnssec_key_template import *
|
|
10
|
+
from .serializers_.dnssec_policy import *
|
|
11
|
+
|
|
12
|
+
from .serializers_.prefix import *
|
|
13
|
+
|
|
14
|
+
from .nested_serializers import *
|
|
File without changes
|
|
@@ -0,0 +1,69 @@
|
|
|
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_.tenants import TenantSerializer
|
|
6
|
+
|
|
7
|
+
from netbox_dns.models import DNSSECKeyTemplate
|
|
8
|
+
|
|
9
|
+
from ..nested_serializers import NestedDNSSECPolicySerializer
|
|
10
|
+
from ..field_serializers import TimePeriodField
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
__all__ = ("DNSSECKeyTemplateSerializer",)
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
class DNSSECKeyTemplateSerializer(NetBoxModelSerializer):
|
|
17
|
+
class Meta:
|
|
18
|
+
model = DNSSECKeyTemplate
|
|
19
|
+
|
|
20
|
+
fields = (
|
|
21
|
+
"id",
|
|
22
|
+
"url",
|
|
23
|
+
"display",
|
|
24
|
+
"display_url",
|
|
25
|
+
"name",
|
|
26
|
+
"description",
|
|
27
|
+
"tags",
|
|
28
|
+
"policies",
|
|
29
|
+
"type",
|
|
30
|
+
"lifetime",
|
|
31
|
+
"algorithm",
|
|
32
|
+
"key_size",
|
|
33
|
+
"created",
|
|
34
|
+
"last_updated",
|
|
35
|
+
"custom_fields",
|
|
36
|
+
"tenant",
|
|
37
|
+
)
|
|
38
|
+
|
|
39
|
+
brief_fields = (
|
|
40
|
+
"id",
|
|
41
|
+
"url",
|
|
42
|
+
"display",
|
|
43
|
+
"name",
|
|
44
|
+
"type",
|
|
45
|
+
"lifetime",
|
|
46
|
+
"algorithm",
|
|
47
|
+
"key_size",
|
|
48
|
+
"description",
|
|
49
|
+
)
|
|
50
|
+
|
|
51
|
+
url = serializers.HyperlinkedIdentityField(
|
|
52
|
+
view_name="plugins-api:netbox_dns-api:dnsseckeytemplate-detail"
|
|
53
|
+
)
|
|
54
|
+
lifetime = TimePeriodField(
|
|
55
|
+
required=False,
|
|
56
|
+
allow_null=True,
|
|
57
|
+
)
|
|
58
|
+
policies = NestedDNSSECPolicySerializer(
|
|
59
|
+
many=True,
|
|
60
|
+
read_only=True,
|
|
61
|
+
required=False,
|
|
62
|
+
default=None,
|
|
63
|
+
help_text=_("Policies using this Key Template"),
|
|
64
|
+
)
|
|
65
|
+
tenant = TenantSerializer(
|
|
66
|
+
nested=True,
|
|
67
|
+
required=False,
|
|
68
|
+
allow_null=True,
|
|
69
|
+
)
|
|
@@ -0,0 +1,165 @@
|
|
|
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_.tenants import TenantSerializer
|
|
6
|
+
|
|
7
|
+
from netbox_dns.models import DNSSECPolicy
|
|
8
|
+
|
|
9
|
+
from .dnssec_key_template import DNSSECKeyTemplateSerializer
|
|
10
|
+
from ..nested_serializers import NestedZoneSerializer, NestedZoneTemplateSerializer
|
|
11
|
+
from ..field_serializers import TimePeriodField
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
__all__ = ("DNSSECPolicySerializer",)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
class DNSSECPolicySerializer(NetBoxModelSerializer):
|
|
18
|
+
class Meta:
|
|
19
|
+
model = DNSSECPolicy
|
|
20
|
+
|
|
21
|
+
fields = (
|
|
22
|
+
"id",
|
|
23
|
+
"url",
|
|
24
|
+
"display",
|
|
25
|
+
"display_url",
|
|
26
|
+
"name",
|
|
27
|
+
"description",
|
|
28
|
+
"tags",
|
|
29
|
+
"status",
|
|
30
|
+
"inline_signing",
|
|
31
|
+
"key_templates",
|
|
32
|
+
"zones",
|
|
33
|
+
"zone_templates",
|
|
34
|
+
"dnskey_ttl",
|
|
35
|
+
"purge_keys",
|
|
36
|
+
"publish_safety",
|
|
37
|
+
"retire_safety",
|
|
38
|
+
"signatures_jitter",
|
|
39
|
+
"signatures_refresh",
|
|
40
|
+
"signatures_validity",
|
|
41
|
+
"signatures_validity_dnskey",
|
|
42
|
+
"max_zone_ttl",
|
|
43
|
+
"zone_propagation_delay",
|
|
44
|
+
"create_cdnskey",
|
|
45
|
+
"cds_digest_types",
|
|
46
|
+
"parent_ds_ttl",
|
|
47
|
+
"parent_propagation_delay",
|
|
48
|
+
"use_nsec3",
|
|
49
|
+
"nsec3_iterations",
|
|
50
|
+
"nsec3_opt_out",
|
|
51
|
+
"nsec3_salt_size",
|
|
52
|
+
"created",
|
|
53
|
+
"last_updated",
|
|
54
|
+
"custom_fields",
|
|
55
|
+
"tenant",
|
|
56
|
+
)
|
|
57
|
+
|
|
58
|
+
brief_fields = (
|
|
59
|
+
"id",
|
|
60
|
+
"url",
|
|
61
|
+
"display",
|
|
62
|
+
"name",
|
|
63
|
+
"description",
|
|
64
|
+
"status",
|
|
65
|
+
"inline_signing",
|
|
66
|
+
)
|
|
67
|
+
|
|
68
|
+
url = serializers.HyperlinkedIdentityField(
|
|
69
|
+
view_name="plugins-api:netbox_dns-api:dnssecpolicy-detail"
|
|
70
|
+
)
|
|
71
|
+
key_templates = DNSSECKeyTemplateSerializer(
|
|
72
|
+
nested=True,
|
|
73
|
+
many=True,
|
|
74
|
+
read_only=False,
|
|
75
|
+
required=False,
|
|
76
|
+
default=None,
|
|
77
|
+
help_text=_("Key templates assigned to the policy"),
|
|
78
|
+
)
|
|
79
|
+
dnskey_ttl = TimePeriodField(
|
|
80
|
+
required=False,
|
|
81
|
+
allow_null=True,
|
|
82
|
+
)
|
|
83
|
+
purge_keys = TimePeriodField(
|
|
84
|
+
required=False,
|
|
85
|
+
allow_null=True,
|
|
86
|
+
)
|
|
87
|
+
publish_safety = TimePeriodField(
|
|
88
|
+
required=False,
|
|
89
|
+
allow_null=True,
|
|
90
|
+
)
|
|
91
|
+
retire_safety = TimePeriodField(
|
|
92
|
+
required=False,
|
|
93
|
+
allow_null=True,
|
|
94
|
+
)
|
|
95
|
+
signatures_jitter = TimePeriodField(
|
|
96
|
+
required=False,
|
|
97
|
+
allow_null=True,
|
|
98
|
+
)
|
|
99
|
+
signatures_refresh = TimePeriodField(
|
|
100
|
+
required=False,
|
|
101
|
+
allow_null=True,
|
|
102
|
+
)
|
|
103
|
+
signatures_validity = TimePeriodField(
|
|
104
|
+
required=False,
|
|
105
|
+
allow_null=True,
|
|
106
|
+
)
|
|
107
|
+
signatures_validity_dnskey = TimePeriodField(
|
|
108
|
+
required=False,
|
|
109
|
+
allow_null=True,
|
|
110
|
+
)
|
|
111
|
+
max_zone_ttl = TimePeriodField(
|
|
112
|
+
required=False,
|
|
113
|
+
allow_null=True,
|
|
114
|
+
)
|
|
115
|
+
zone_propagation_delay = TimePeriodField(
|
|
116
|
+
required=False,
|
|
117
|
+
allow_null=True,
|
|
118
|
+
)
|
|
119
|
+
parent_ds_ttl = TimePeriodField(
|
|
120
|
+
required=False,
|
|
121
|
+
allow_null=True,
|
|
122
|
+
)
|
|
123
|
+
parent_propagation_delay = TimePeriodField(
|
|
124
|
+
required=False,
|
|
125
|
+
allow_null=True,
|
|
126
|
+
)
|
|
127
|
+
zones = NestedZoneSerializer(
|
|
128
|
+
many=True,
|
|
129
|
+
read_only=True,
|
|
130
|
+
required=False,
|
|
131
|
+
default=None,
|
|
132
|
+
help_text=_("Zones this policy is assigned to"),
|
|
133
|
+
)
|
|
134
|
+
zone_templates = NestedZoneTemplateSerializer(
|
|
135
|
+
many=True,
|
|
136
|
+
read_only=True,
|
|
137
|
+
required=False,
|
|
138
|
+
default=None,
|
|
139
|
+
help_text=_("Zone templates this policy is assigned to"),
|
|
140
|
+
)
|
|
141
|
+
tenant = TenantSerializer(
|
|
142
|
+
nested=True,
|
|
143
|
+
required=False,
|
|
144
|
+
allow_null=True,
|
|
145
|
+
)
|
|
146
|
+
|
|
147
|
+
def create(self, validated_data):
|
|
148
|
+
dnssec_key_templates = validated_data.pop("key_templates", None)
|
|
149
|
+
|
|
150
|
+
dnssec_policy = super().create(validated_data)
|
|
151
|
+
|
|
152
|
+
if dnssec_key_templates is not None:
|
|
153
|
+
dnssec_policy.key_templates.set(dnssec_key_templates)
|
|
154
|
+
|
|
155
|
+
return dnssec_policy
|
|
156
|
+
|
|
157
|
+
def update(self, instance, validated_data):
|
|
158
|
+
dnssec_key_templates = validated_data.pop("key_templates", None)
|
|
159
|
+
|
|
160
|
+
dnssec_policy = super().update(instance, validated_data)
|
|
161
|
+
|
|
162
|
+
if dnssec_key_templates is not None:
|
|
163
|
+
dnssec_policy.key_templates.set(dnssec_key_templates)
|
|
164
|
+
|
|
165
|
+
return dnssec_policy
|
|
@@ -0,0 +1,56 @@
|
|
|
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_.tenants import TenantSerializer
|
|
6
|
+
|
|
7
|
+
from netbox_dns.models import NameServer
|
|
8
|
+
|
|
9
|
+
from ..nested_serializers import NestedZoneSerializer
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
__all__ = ("NameServerSerializer",)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
class NameServerSerializer(NetBoxModelSerializer):
|
|
16
|
+
class Meta:
|
|
17
|
+
model = NameServer
|
|
18
|
+
|
|
19
|
+
fields = (
|
|
20
|
+
"id",
|
|
21
|
+
"url",
|
|
22
|
+
"display",
|
|
23
|
+
"display_url",
|
|
24
|
+
"name",
|
|
25
|
+
"description",
|
|
26
|
+
"tags",
|
|
27
|
+
"zones",
|
|
28
|
+
"created",
|
|
29
|
+
"last_updated",
|
|
30
|
+
"custom_fields",
|
|
31
|
+
"tenant",
|
|
32
|
+
)
|
|
33
|
+
|
|
34
|
+
brief_fields = (
|
|
35
|
+
"id",
|
|
36
|
+
"url",
|
|
37
|
+
"display",
|
|
38
|
+
"name",
|
|
39
|
+
"description",
|
|
40
|
+
)
|
|
41
|
+
|
|
42
|
+
url = serializers.HyperlinkedIdentityField(
|
|
43
|
+
view_name="plugins-api:netbox_dns-api:nameserver-detail"
|
|
44
|
+
)
|
|
45
|
+
zones = NestedZoneSerializer(
|
|
46
|
+
many=True,
|
|
47
|
+
read_only=True,
|
|
48
|
+
required=False,
|
|
49
|
+
default=None,
|
|
50
|
+
help_text=_("Zones served by the authoritative nameserver"),
|
|
51
|
+
)
|
|
52
|
+
tenant = TenantSerializer(
|
|
53
|
+
nested=True,
|
|
54
|
+
required=False,
|
|
55
|
+
allow_null=True,
|
|
56
|
+
)
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
from rest_framework.serializers import HyperlinkedIdentityField
|
|
2
|
+
|
|
3
|
+
from ipam.api.serializers import PrefixSerializer as IPAMPrefixSerializer
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
__all__ = ("PrefixSerializer",)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class PrefixSerializer(IPAMPrefixSerializer):
|
|
10
|
+
url = HyperlinkedIdentityField(view_name="plugins-api:netbox_dns-api:prefix-detail")
|
|
11
|
+
|
|
12
|
+
def to_representation(self, instance):
|
|
13
|
+
representation = super().to_representation(instance)
|
|
14
|
+
|
|
15
|
+
if instance.vrf is not None:
|
|
16
|
+
representation["display"] += f" [{instance.vrf.name}]"
|
|
17
|
+
|
|
18
|
+
return representation
|