octodns.record.uri

Classes

UriNameRfcValidator(id[, sets])

Strict URI name validator per RFC 7553 §3 and RFC 6335 §5.1.

UriNameValidator(id[, sets])

Validates that a URI record's name matches the _service._protocol pattern required by RFC 7553, or is a wildcard.

UriRecord(zone, name, data[, source, context])

UriValue(value)

UriValueRfcValidator(id[, sets])

Strict URI rdata validator per RFC 7553 §4.

UriValueValidator(id[, sets])

Validates URI rdata: priority and weight are present and integer-parsable, and target is non-empty.

class octodns.record.uri.UriNameValidator(id, sets=None)[source]

Bases: RecordValidator

Validates that a URI record’s name matches the _service._protocol pattern required by RFC 7553, or is a wildcard.

_name_re = re.compile('^(\\*|_[^\\.]+)\\.[^\\.]+')
validate(record_cls, name, fqdn, data)[source]

Validate a record’s non-value attributes.

Parameters:
  • record_cls (type) – The concrete Record subclass being validated. Validators that need access to record class-level attributes (e.g. _type, _value_type) should read them from record_cls. Per-instance configuration should live on self, not on record_cls.

  • name (str) – The record’s name relative to its zone ('' for the zone root). Already idna_encode’d.

  • fqdn (str) – The record’s fully-qualified domain name (name + zone name).

  • data (dict) – The raw record config dict (as loaded from YAML/JSON) including ttl, type, value/values, and any type-specific fields like dynamic, geo, or octodns.

Returns:

A list of human-readable reason strings describing validation failures. Must return an empty list when the record is valid. Reasons from multiple validators are concatenated by the caller, so each reason must stand alone without context from the others.

Return type:

list[str]

Notes

Implementations must not raise on invalid input — all failures are reported via the returned list. Reason strings are surfaced verbatim in ValidationError messages, so phrasing and punctuation should be stable across releases.

class octodns.record.uri.UriValueValidator(id, sets=None)[source]

Bases: ValueValidator

Validates URI rdata: priority and weight are present and integer-parsable, and target is non-empty.

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 from value_cls. Per-instance configuration should live on self, not on value_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 data directly — when a validator needs to accept either form it should normalize with if not isinstance(data, (list, tuple)): data = (data,).

  • _type (str) – The record type string (e.g. 'MX', 'A'). Passed through to helpers like _check_target_format which 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:

list[str]

Notes

Implementations must not raise on invalid input — all failures are reported via the returned list. Reason strings are surfaced verbatim in ValidationError messages, so phrasing and punctuation should be stable across releases.

class octodns.record.uri.UriValueRfcValidator(id, sets=None)[source]

Bases: ValueValidator

Strict URI rdata validator per RFC 7553 §4.

  • priority must be an integer in [0, 65535] (uint16).

  • weight must be an integer in [0, 65535] (uint16).

Enabled as part of the strict validator set:

manager:
  enabled:
    - strict
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 from value_cls. Per-instance configuration should live on self, not on value_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 data directly — when a validator needs to accept either form it should normalize with if not isinstance(data, (list, tuple)): data = (data,).

  • _type (str) – The record type string (e.g. 'MX', 'A'). Passed through to helpers like _check_target_format which 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:

list[str]

Notes

Implementations must not raise on invalid input — all failures are reported via the returned list. Reason strings are surfaced verbatim in ValidationError messages, so phrasing and punctuation should be stable across releases.

class octodns.record.uri.UriValue(value)[source]

Bases: EqualityTupleMixin, dict

VALIDATORS = [<octodns.record.uri.UriValueValidator object>, <octodns.record.uri.UriValueRfcValidator object>]
classmethod _schema()[source]
classmethod parse_rdata_text(value)[source]
classmethod process(values)[source]
__init__(value)[source]
property priority
property weight
property target
property data
property rdata_text
template(params)[source]
_equality_tuple()[source]
__repr__()[source]

Return repr(self).

class octodns.record.uri.UriNameRfcValidator(id, sets=None)[source]

Bases: RecordValidator

Strict URI name validator per RFC 7553 §3 and RFC 6335 §5.1.

Requires the first two labels of the record name to be _service._proto (*._proto is still accepted for wildcards). Both label bodies (after the leading _) must conform to the RFC 6335 §5.1 service name syntax: 1-15 characters, starting with a letter, ending with a letter or digit, containing only letters, digits, and hyphens, and with no consecutive hyphens.

Enabled as part of the strict validator set:

manager:
  enabled:
    - strict
_max_len = 15
classmethod _is_valid_service_name(body)[source]
validate(record_cls, name, fqdn, data)[source]

Validate a record’s non-value attributes.

Parameters:
  • record_cls (type) – The concrete Record subclass being validated. Validators that need access to record class-level attributes (e.g. _type, _value_type) should read them from record_cls. Per-instance configuration should live on self, not on record_cls.

  • name (str) – The record’s name relative to its zone ('' for the zone root). Already idna_encode’d.

  • fqdn (str) – The record’s fully-qualified domain name (name + zone name).

  • data (dict) – The raw record config dict (as loaded from YAML/JSON) including ttl, type, value/values, and any type-specific fields like dynamic, geo, or octodns.

Returns:

A list of human-readable reason strings describing validation failures. Must return an empty list when the record is valid. Reasons from multiple validators are concatenated by the caller, so each reason must stand alone without context from the others.

Return type:

list[str]

Notes

Implementations must not raise on invalid input — all failures are reported via the returned list. Reason strings are surfaced verbatim in ValidationError messages, so phrasing and punctuation should be stable across releases.

class octodns.record.uri.UriRecord(zone, name, data, source=None, context=None)[source]

Bases: ValuesMixin, Record

REFERENCES = ('https://datatracker.ietf.org/doc/html/rfc7553',)
_type = 'URI'
_value_type

alias of UriValue

VALIDATORS = [<octodns.record.uri.UriNameValidator object>, <octodns.record.uri.UriNameRfcValidator object>]