octodns.record.uri
Classes
|
Strict URI name validator per RFC 7553 §3 and RFC 6335 §5.1. |
|
Validates that a URI record's name matches the |
|
|
|
|
|
Strict URI rdata validator per RFC 7553 §4. |
|
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:
RecordValidatorValidates that a URI record’s name matches the
_service._protocolpattern 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
Recordsubclass being validated. Validators that need access to record class-level attributes (e.g._type,_value_type) should read them fromrecord_cls. Per-instance configuration should live onself, not onrecord_cls.name (str) – The record’s name relative to its zone (
''for the zone root). Alreadyidna_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 likedynamic,geo, oroctodns.
- 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:
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.uri.UriValueValidator(id, sets=None)[source]
Bases:
ValueValidatorValidates 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 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.uri.UriValueRfcValidator(id, sets=None)[source]
Bases:
ValueValidatorStrict URI rdata validator per RFC 7553 §4.
prioritymust be an integer in [0, 65535] (uint16).weightmust be an integer in [0, 65535] (uint16).
Enabled as part of the
strictvalidator 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 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.uri.UriValue(value)[source]
Bases:
EqualityTupleMixin,dict- VALIDATORS = [<octodns.record.uri.UriValueValidator object>, <octodns.record.uri.UriValueRfcValidator object>]
- property priority
- property weight
- property target
- property data
- property rdata_text
- class octodns.record.uri.UriNameRfcValidator(id, sets=None)[source]
Bases:
RecordValidatorStrict 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(*._protois 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
strictvalidator set:manager: enabled: - strict
- _max_len = 15
- validate(record_cls, name, fqdn, data)[source]
Validate a record’s non-value attributes.
- Parameters:
record_cls (type) – The concrete
Recordsubclass being validated. Validators that need access to record class-level attributes (e.g._type,_value_type) should read them fromrecord_cls. Per-instance configuration should live onself, not onrecord_cls.name (str) – The record’s name relative to its zone (
''for the zone root). Alreadyidna_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 likedynamic,geo, oroctodns.
- 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:
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.uri.UriRecord(zone, name, data, source=None, context=None)[source]
Bases:
ValuesMixin,Record- REFERENCES = ('https://datatracker.ietf.org/doc/html/rfc7553',)
- _type = 'URI'
- VALIDATORS = [<octodns.record.uri.UriNameValidator object>, <octodns.record.uri.UriNameRfcValidator object>]