octodns.record.base
Functions
|
Classes
|
Validates the optional |
|
Validates record name and FQDN shape: rejects the legacy |
|
|
|
Validates that the record has a ttl and that it is a non-negative integer. |
|
|
Single-value variant of |
|
|
|
Bridges a record's |
- class octodns.record.base.NameValidator(id, sets=None)[source]
Bases:
RecordValidatorValidates record name and FQDN shape: rejects the legacy
@alias, enforces the 253-char total FQDN length and 63-char per-label length limits from RFC 1035, and flags empty/double-dot labels.- validate(record_cls, name, fqdn, data, disabled=None)[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.disabled (dict or None) – The zone’s per-type map of disabled validator ids (
record_cls ._typeor'*'-> set of ids), as configured via the zone’svalidators.record.disable_validators. Most validators can ignore this; it only matters to validators that themselves dispatch to other validators (e.g. value-type bridges,geoanddynamicvalidators), which must forward it along so the disabled ids are honored down the chain.
- Returns:
A list of
ValidationReasonobjects describing validation failures — construct each withValidationReason(reason, validator_id=self.id). 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. Returning barestrreasons is DEPRECATED — the registry wraps them inValidationReasonand emits a deprecation warning; support will be removed in 2.0.- Return type:
Notes
Implementations must not raise on invalid input — all failures are reported via the returned list. Reason text is surfaced verbatim in
ValidationErrormessages, so phrasing and punctuation should be stable across releases.Third-party validators that predate the
disabledparameter and implementvalidate(self, record_cls, name, fqdn, data)continue to work: the caller detects theTypeErrorand falls back to calling without it, emitting a deprecation warning. Support for the parameter-less form will be removed in 2.0.
- class octodns.record.base.TtlValidator(id, sets=None)[source]
Bases:
RecordValidatorValidates that the record has a ttl and that it is a non-negative integer.
- validate(record_cls, name, fqdn, data, disabled=None)[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.disabled (dict or None) – The zone’s per-type map of disabled validator ids (
record_cls ._typeor'*'-> set of ids), as configured via the zone’svalidators.record.disable_validators. Most validators can ignore this; it only matters to validators that themselves dispatch to other validators (e.g. value-type bridges,geoanddynamicvalidators), which must forward it along so the disabled ids are honored down the chain.
- Returns:
A list of
ValidationReasonobjects describing validation failures — construct each withValidationReason(reason, validator_id=self.id). 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. Returning barestrreasons is DEPRECATED — the registry wraps them inValidationReasonand emits a deprecation warning; support will be removed in 2.0.- Return type:
Notes
Implementations must not raise on invalid input — all failures are reported via the returned list. Reason text is surfaced verbatim in
ValidationErrormessages, so phrasing and punctuation should be stable across releases.Third-party validators that predate the
disabledparameter and implementvalidate(self, record_cls, name, fqdn, data)continue to work: the caller detects theTypeErrorand falls back to calling without it, emitting a deprecation warning. Support for the parameter-less form will be removed in 2.0.
- class octodns.record.base.HealthcheckValidator(id, sets=None)[source]
Bases:
RecordValidatorValidates the optional
octodns.healthcheck.protocolsetting, if present, is one of the supported protocols.- validate(record_cls, name, fqdn, data, disabled=None)[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.disabled (dict or None) – The zone’s per-type map of disabled validator ids (
record_cls ._typeor'*'-> set of ids), as configured via the zone’svalidators.record.disable_validators. Most validators can ignore this; it only matters to validators that themselves dispatch to other validators (e.g. value-type bridges,geoanddynamicvalidators), which must forward it along so the disabled ids are honored down the chain.
- Returns:
A list of
ValidationReasonobjects describing validation failures — construct each withValidationReason(reason, validator_id=self.id). 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. Returning barestrreasons is DEPRECATED — the registry wraps them inValidationReasonand emits a deprecation warning; support will be removed in 2.0.- Return type:
Notes
Implementations must not raise on invalid input — all failures are reported via the returned list. Reason text is surfaced verbatim in
ValidationErrormessages, so phrasing and punctuation should be stable across releases.Third-party validators that predate the
disabledparameter and implementvalidate(self, record_cls, name, fqdn, data)continue to work: the caller detects theTypeErrorand falls back to calling without it, emitting a deprecation warning. Support for the parameter-less form will be removed in 2.0.
- class octodns.record.base.ValueTypeValidator[source]
Bases:
RecordValidatorSingle-value variant of
ValuesTypeValidatorfor records that useValueMixin: passesdata['value'](orNone) through to the value type’s validators.- __init__()[source]
- Parameters:
id – Non-empty identifier for this validator instance. Used to look up the validator in the registry and to reference it in config (for enabling/disabling, etc.).
sets – Iterable of set names this validator belongs to, or
None(the default) to always activate regardless ofmanager.enabled. Pass an explicit set such assets={'legacy'}to opt into set-based filtering.
- validate(record_cls, name, fqdn, data, disabled=None)[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.disabled (dict or None) – The zone’s per-type map of disabled validator ids (
record_cls ._typeor'*'-> set of ids), as configured via the zone’svalidators.record.disable_validators. Most validators can ignore this; it only matters to validators that themselves dispatch to other validators (e.g. value-type bridges,geoanddynamicvalidators), which must forward it along so the disabled ids are honored down the chain.
- Returns:
A list of
ValidationReasonobjects describing validation failures — construct each withValidationReason(reason, validator_id=self.id). 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. Returning barestrreasons is DEPRECATED — the registry wraps them inValidationReasonand emits a deprecation warning; support will be removed in 2.0.- Return type:
Notes
Implementations must not raise on invalid input — all failures are reported via the returned list. Reason text is surfaced verbatim in
ValidationErrormessages, so phrasing and punctuation should be stable across releases.Third-party validators that predate the
disabledparameter and implementvalidate(self, record_cls, name, fqdn, data)continue to work: the caller detects theTypeErrorand falls back to calling without it, emitting a deprecation warning. Support for the parameter-less form will be removed in 2.0.
- class octodns.record.base.ValuesTypeValidator[source]
Bases:
RecordValidatorBridges a record’s
_value_typeinto the record-level validation pipeline: pullsvalues/valuefromdata, coerces to a list, and delegates toValidatorRegistry.process_values, which handles both the legacyvalidateclassmethod on the value class (for 3rd-party back-compat) and any activeValueValidatorinstances for the type.- __init__()[source]
- Parameters:
id – Non-empty identifier for this validator instance. Used to look up the validator in the registry and to reference it in config (for enabling/disabling, etc.).
sets – Iterable of set names this validator belongs to, or
None(the default) to always activate regardless ofmanager.enabled. Pass an explicit set such assets={'legacy'}to opt into set-based filtering.
- validate(record_cls, name, fqdn, data, disabled=None)[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.disabled (dict or None) – The zone’s per-type map of disabled validator ids (
record_cls ._typeor'*'-> set of ids), as configured via the zone’svalidators.record.disable_validators. Most validators can ignore this; it only matters to validators that themselves dispatch to other validators (e.g. value-type bridges,geoanddynamicvalidators), which must forward it along so the disabled ids are honored down the chain.
- Returns:
A list of
ValidationReasonobjects describing validation failures — construct each withValidationReason(reason, validator_id=self.id). 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. Returning barestrreasons is DEPRECATED — the registry wraps them inValidationReasonand emits a deprecation warning; support will be removed in 2.0.- Return type:
Notes
Implementations must not raise on invalid input — all failures are reported via the returned list. Reason text is surfaced verbatim in
ValidationErrormessages, so phrasing and punctuation should be stable across releases.Third-party validators that predate the
disabledparameter and implementvalidate(self, record_cls, name, fqdn, data)continue to work: the caller detects theTypeErrorand falls back to calling without it, emitting a deprecation warning. Support for the parameter-less form will be removed in 2.0.
- class octodns.record.base.Record(zone, name, data, source=None, context=None)[source]
Bases:
EqualityTupleMixin- log = <Logger Record (WARNING)>
- REFERENCES = ('https://datatracker.ietf.org/doc/html/rfc1035', 'https://datatracker.ietf.org/doc/html/rfc1123', 'https://datatracker.ietf.org/doc/html/rfc2181', 'https://datatracker.ietf.org/doc/html/rfc4592', 'https://datatracker.ietf.org/doc/html/rfc5890')
- _CLASSES = {'A': <class 'octodns.record.a.ARecord'>, 'AAAA': <class 'octodns.record.aaaa.AaaaRecord'>, 'ALIAS': <class 'octodns.record.alias.AliasRecord'>, 'CAA': <class 'octodns.record.caa.CaaRecord'>, 'CNAME': <class 'octodns.record.cname.CnameRecord'>, 'DNAME': <class 'octodns.record.dname.DnameRecord'>, 'DS': <class 'octodns.record.ds.DsRecord'>, 'HTTPS': <class 'octodns.record.https.HttpsRecord'>, 'LOC': <class 'octodns.record.loc.LocRecord'>, 'MX': <class 'octodns.record.mx.MxRecord'>, 'NAPTR': <class 'octodns.record.naptr.NaptrRecord'>, 'NS': <class 'octodns.record.ns.NsRecord'>, 'OPENPGPKEY': <class 'octodns.record.openpgpkey.OpenpgpkeyRecord'>, 'PTR': <class 'octodns.record.ptr.PtrRecord'>, 'SPF': <class 'octodns.record.spf.SpfRecord'>, 'SRV': <class 'octodns.record.srv.SrvRecord'>, 'SSHFP': <class 'octodns.record.sshfp.SshfpRecord'>, 'SVCB': <class 'octodns.record.svcb.SvcbRecord'>, 'TLSA': <class 'octodns.record.tlsa.TlsaRecord'>, 'TXT': <class 'octodns.record.txt.TxtRecord'>, 'URI': <class 'octodns.record.uri.UriRecord'>, 'URLFWD': <class 'octodns.record.urlfwd.UrlfwdRecord'>}
- validators = <octodns.record.validator.ValidatorRegistry object>
- property _octodns
- property data
- property fqdn
- property decoded_fqdn
- property ignored
- property excluded
- property included
- property healthcheck_path
- property healthcheck_protocol
- property healthcheck_port
- property lenient
- class octodns.record.base.ValuesMixin(zone, name, data, source=None, context=None)[source]
Bases:
object- VALIDATORS = [<octodns.record.base.ValuesTypeValidator object>]
- property rr_values
- property rrs