octodns.record.naptr
Classes
|
|
|
|
|
Checks that the NAPTR |
|
Strict NAPTR rdata validator per RFC 3403 §4.1. |
|
Validates NAPTR rdata: |
- class octodns.record.naptr.NaptrValueValidator(id, sets=None)[source]
Bases:
ValueValidatorValidates NAPTR rdata:
orderandpreferenceare integer-parsable,flagsis one of the RFC 3403 values, andservice,regexp, andreplacementare all present.- validate(value_cls, data, _type)[source]
Validate a record’s rdata values.
- Parameters:
value_cls (type) – The concrete value class being validated (e.g.
MxValue,_Ipv4Value). Validators that need access to value class-level attributes (e.g.VALID_ALGORITHMS,_address_type) should read them fromvalue_cls. Per-instance configuration should live onself, not onvalue_cls.data (list | tuple | str | dict) – The rdata to validate. For multi-value record types this is a list/tuple of value dicts or strings; for single-value types it may be a bare value. Most validators iterate
datadirectly — when a validator needs to accept either form it should normalize withif not isinstance(data, (list, tuple)): data = (data,)._type (str) – The record type string (e.g.
'MX','A'). Passed through to helpers like_check_target_formatwhich format it into their reason strings.
- Returns:
A list of human-readable reason strings describing validation failures. Must return an empty list when the values are valid. Reasons from multiple validators are concatenated by the caller, so each reason must stand alone without context from the others.
- Return type:
Notes
Implementations must not raise on invalid input — all failures are reported via the returned list. Reason strings are surfaced verbatim in
ValidationErrormessages, so phrasing and punctuation should be stable across releases.
- class octodns.record.naptr.NaptrValueRfcValidator(id, sets=None)[source]
Bases:
ValueValidatorStrict NAPTR rdata validator per RFC 3403 §4.1.
orderandpreferencemust be integers in [0, 65535] (uint16).flagsmust be one ofS,A,U,P(case-insensitive) or empty.replacementmust be a fully-qualified domain name (ending with".") or"."for the null replacement.
Enabled as part of the
strictvalidator set:manager: enabled: - strict
- _valid_flags = frozenset({'A', 'P', 'S', 'U'})
- validate(value_cls, data, _type)[source]
Validate a record’s rdata values.
- Parameters:
value_cls (type) – The concrete value class being validated (e.g.
MxValue,_Ipv4Value). Validators that need access to value class-level attributes (e.g.VALID_ALGORITHMS,_address_type) should read them fromvalue_cls. Per-instance configuration should live onself, not onvalue_cls.data (list | tuple | str | dict) – The rdata to validate. For multi-value record types this is a list/tuple of value dicts or strings; for single-value types it may be a bare value. Most validators iterate
datadirectly — when a validator needs to accept either form it should normalize withif not isinstance(data, (list, tuple)): data = (data,)._type (str) – The record type string (e.g.
'MX','A'). Passed through to helpers like_check_target_formatwhich format it into their reason strings.
- Returns:
A list of human-readable reason strings describing validation failures. Must return an empty list when the values are valid. Reasons from multiple validators are concatenated by the caller, so each reason must stand alone without context from the others.
- Return type:
Notes
Implementations must not raise on invalid input — all failures are reported via the returned list. Reason strings are surfaced verbatim in
ValidationErrormessages, so phrasing and punctuation should be stable across releases.
- class octodns.record.naptr.NaptrValueBestPracticeValidator(id, sets=None)[source]
Bases:
ValueValidatorChecks that the NAPTR
replacementfield ends with a trailing.(fully-qualified name) when non-empty and not the null replacement".".Enabled as part of the
best-practicevalidator set:manager: enabled: - best-practice
- validate(value_cls, data, _type)[source]
Validate a record’s rdata values.
- Parameters:
value_cls (type) – The concrete value class being validated (e.g.
MxValue,_Ipv4Value). Validators that need access to value class-level attributes (e.g.VALID_ALGORITHMS,_address_type) should read them fromvalue_cls. Per-instance configuration should live onself, not onvalue_cls.data (list | tuple | str | dict) – The rdata to validate. For multi-value record types this is a list/tuple of value dicts or strings; for single-value types it may be a bare value. Most validators iterate
datadirectly — when a validator needs to accept either form it should normalize withif not isinstance(data, (list, tuple)): data = (data,)._type (str) – The record type string (e.g.
'MX','A'). Passed through to helpers like_check_target_formatwhich format it into their reason strings.
- Returns:
A list of human-readable reason strings describing validation failures. Must return an empty list when the values are valid. Reasons from multiple validators are concatenated by the caller, so each reason must stand alone without context from the others.
- Return type:
Notes
Implementations must not raise on invalid input — all failures are reported via the returned list. Reason strings are surfaced verbatim in
ValidationErrormessages, so phrasing and punctuation should be stable across releases.
- class octodns.record.naptr.NaptrValue(value)[source]
Bases:
EqualityTupleMixin,dict- VALID_FLAGS = ('S', 'A', 'U', 'P', 's', 'a', 'u', 'p')
- VALIDATORS = [<octodns.record.naptr.NaptrValueValidator object>, <octodns.record.naptr.NaptrValueRfcValidator object>, <octodns.record.naptr.NaptrValueBestPracticeValidator object>]
- property order
- property preference
- property flags
- property service
- property regexp
- property replacement
- property data
- property rdata_text
- class octodns.record.naptr.NaptrRecord(zone, name, data, source=None, context=None)[source]
Bases:
ValuesMixin,Record- REFERENCES = ('https://datatracker.ietf.org/doc/html/rfc3401', 'https://datatracker.ietf.org/doc/html/rfc3402', 'https://datatracker.ietf.org/doc/html/rfc3403', 'https://datatracker.ietf.org/doc/html/rfc3404', 'https://datatracker.ietf.org/doc/html/rfc3405')
- _type = 'NAPTR'
- _value_type
alias of
NaptrValue