octodns.processor.filter
Classes
|
Do not allow root NS record changes |
|
Do not manage Root NS Records. |
|
Only manage records with names that match the provider patterns |
|
Reject managing records with names that match the provider patterns |
|
Only manage A and AAAA records with values that match the provider patterns All other types will be left as-is. |
|
Reject managing A and AAAA records with value matching a that match the provider patterns All other types will be left as-is. |
|
Only manage records of the specified type(s). |
|
Ignore records of the specified type(s). |
|
Only manage records with values that match the provider patterns |
|
Reject managing records with names that match the provider patterns |
|
Filter or error on record names that contain the zone name |
- class octodns.processor.filter._FilterProcessor(name, include_target=True, **kwargs)[source]
Bases:
BaseProcessor- __init__(name, include_target=True, **kwargs)[source]
Initialize the processor.
- Parameters:
Note
The
nameparameter is deprecated and will be removed in version 2.0. Useidinstead.
- process_source_zone(desired, sources, lenient=False)[source]
Process the desired zone after all sources have populated.
Called after all sources have completed populate. Provides an opportunity for the processor to modify the desired zone that targets will receive.
- Parameters:
desired (octodns.zone.Zone) – The desired zone state after all sources have populated. This zone will be used as the target state for planning.
sources (list[octodns.provider.base.BaseProvider]) – List of source providers that populated the zone. May be empty for aliased zones.
lenient (bool) – When True, relaxed validation rules should be applied when modifying zone records.
- Returns:
The modified desired zone, typically the same object passed in.
- Return type:
Important
Will see
desiredafter any modifications done byProvider._process_desired_zoneand processors configured to run before this one.May modify
desireddirectly.Must return
desiredwhich will normally be thedesiredparam.Must not modify records directly;
record.copyshould be called, the results of which can be modified, and thenZone.add_recordmay be used withreplace=True.May call
Zone.remove_recordto remove records fromdesired.Sources may be empty, as will be the case for aliased zones.
Implementations should combine
self.lenient or lenientand pass the result to any record and zone calls that acceptlenientas a parameter, e.g.zone.add_record(..., lenient=lenient).
- process_target_zone(existing, target, lenient=False)[source]
Process the existing zone after the target has populated.
Called after a target has completed
populate, before changes are computed betweenexistinganddesired. This provides an opportunity to modify the existing zone state.- Parameters:
existing (octodns.zone.Zone) – The current zone state from the target provider.
target (octodns.provider.base.BaseProvider) – The target provider that populated the existing zone.
lenient (bool) – When True, relaxed validation rules should be applied when modifying zone records.
- Returns:
The modified existing zone, typically the same object passed in.
- Return type:
Important
Will see
existingafter any modifications done by processors configured to run before this one.May modify
existingdirectly.Must return
existingwhich will normally be theexistingparam.Must not modify records directly;
record.copyshould be called, the results of which can be modified, and thenZone.add_recordmay be used withreplace=True.May call
Zone.remove_recordto remove records fromexisting.Implementations should combine
self.lenient or lenientand pass the result to any record and zone calls that acceptlenientas a parameter, e.g.zone.add_record(..., lenient=lenient).
- class octodns.processor.filter._TypeBaseFilter(name, _list, **kwargs)[source]
Bases:
_FilterProcessor
- class octodns.processor.filter.TypeAllowlistFilter(name, allowlist, **kwargs)[source]
Bases:
_TypeBaseFilter,AllowsMixinOnly manage records of the specified type(s).
Example usage:
processors: only-a-and-aaaa: class: octodns.processor.filter.TypeAllowlistFilter allowlist: - A - AAAA # Optional param that can be set to False to leave the target zone # alone, thus allowing deletion of existing records # (default: true) # include_target: True zones: exxampled.com.: sources: - config processors: - only-a-and-aaaa targets: - ns1
- class octodns.processor.filter.TypeRejectlistFilter(name, rejectlist, **kwargs)[source]
Bases:
_TypeBaseFilter,RejectsMixinIgnore records of the specified type(s).
Example usage:
processors: ignore-cnames: class: octodns.processor.filter.TypeRejectlistFilter rejectlist: - CNAME # Optional param that can be set to False to leave the target zone # alone, thus allowing deletion of existing records # (default: true) # include_target: True zones: exxampled.com.: sources: - config processors: - ignore-cnames targets: - route53
- class octodns.processor.filter._NameBaseFilter(name, _list, **kwargs)[source]
Bases:
_FilterProcessor
- class octodns.processor.filter.NameAllowlistFilter(name, allowlist, **kwargs)[source]
Bases:
_NameBaseFilter,AllowsMixinOnly manage records with names that match the provider patterns
Example usage:
processors: only-these: class: octodns.processor.filter.NameAllowlistFilter allowlist: # exact string match - www # contains/substring match - /substring/ # regex pattern match - /some-pattern-\d\+/ # regex - anchored so has to match start to end - /^start-.+-end$/ # Optional param that can be set to False to leave the target zone # alone, thus allowing deletion of existing records # (default: true) # include_target: True zones: exxampled.com.: sources: - config processors: - only-these targets: - route53
- class octodns.processor.filter.NameRejectlistFilter(name, rejectlist, **kwargs)[source]
Bases:
_NameBaseFilter,RejectsMixinReject managing records with names that match the provider patterns
Example usage:
processors: not-these: class: octodns.processor.filter.NameRejectlistFilter rejectlist: # exact string match - www # contains/substring match - /substring/ # regex pattern match - /some-pattern-\d\+/ # regex - anchored so has to match start to end - /^start-.+-end$/ # Optional param that can be set to False to leave the target zone # alone, thus allowing deletion of existing records # (default: true) # include_target: True zones: exxampled.com.: sources: - config processors: - not-these targets: - route53
- class octodns.processor.filter._ValueBaseFilter(name, _list, **kwargs)[source]
Bases:
_FilterProcessor
- class octodns.processor.filter.ValueAllowlistFilter(name, allowlist, **kwargs)[source]
Bases:
_ValueBaseFilter,AllowsMixinOnly manage records with values that match the provider patterns
Example usage:
processors: only-these: class: octodns.processor.filter.ValueAllowlistFilter allowlist: # exact string match - www # contains/substring match - /substring/ # regex pattern match - /some-pattern-\d\+/ # regex - anchored so has to match start to end - /^start-.+-end$/ # Optional param that can be set to False to leave the target zone # alone, thus allowing deletion of existing records # (default: true) # include_target: True zones: exxampled.com.: sources: - config processors: - only-these targets: - route53
- class octodns.processor.filter.ValueRejectlistFilter(name, rejectlist, **kwargs)[source]
Bases:
_ValueBaseFilter,RejectsMixinReject managing records with names that match the provider patterns
Example usage:
processors: not-these: class: octodns.processor.filter.ValueRejectlistFilter rejectlist: # exact string match - www # contains/substring match - /substring/ # regex pattern match - /some-pattern-\d\+/ # regex - anchored so has to match start to end - /^start-.+-end$/ # Optional param that can be set to False to leave the target zone # alone, thus allowing deletion of existing records # (default: true) # include_target: True zones: exxampled.com.: sources: - config processors: - not-these targets: - route53
- class octodns.processor.filter._NetworkValueBaseFilter(name, _list, **kwargs)[source]
Bases:
BaseProcessor- __init__(name, _list, **kwargs)[source]
Initialize the processor.
- Parameters:
Note
The
nameparameter is deprecated and will be removed in version 2.0. Useidinstead.
- process_source_zone(zone, *args, **kwargs)
Process the desired zone after all sources have populated.
Called after all sources have completed populate. Provides an opportunity for the processor to modify the desired zone that targets will receive.
- Parameters:
desired (octodns.zone.Zone) – The desired zone state after all sources have populated. This zone will be used as the target state for planning.
sources (list[octodns.provider.base.BaseProvider]) – List of source providers that populated the zone. May be empty for aliased zones.
lenient (bool) – When True, relaxed validation rules should be applied when modifying zone records.
- Returns:
The modified desired zone, typically the same object passed in.
- Return type:
Important
Will see
desiredafter any modifications done byProvider._process_desired_zoneand processors configured to run before this one.May modify
desireddirectly.Must return
desiredwhich will normally be thedesiredparam.Must not modify records directly;
record.copyshould be called, the results of which can be modified, and thenZone.add_recordmay be used withreplace=True.May call
Zone.remove_recordto remove records fromdesired.Sources may be empty, as will be the case for aliased zones.
Implementations should combine
self.lenient or lenientand pass the result to any record and zone calls that acceptlenientas a parameter, e.g.zone.add_record(..., lenient=lenient).
- process_target_zone(zone, *args, **kwargs)
Process the existing zone after the target has populated.
Called after a target has completed
populate, before changes are computed betweenexistinganddesired. This provides an opportunity to modify the existing zone state.- Parameters:
existing (octodns.zone.Zone) – The current zone state from the target provider.
target (octodns.provider.base.BaseProvider) – The target provider that populated the existing zone.
lenient (bool) – When True, relaxed validation rules should be applied when modifying zone records.
- Returns:
The modified existing zone, typically the same object passed in.
- Return type:
Important
Will see
existingafter any modifications done by processors configured to run before this one.May modify
existingdirectly.Must return
existingwhich will normally be theexistingparam.Must not modify records directly;
record.copyshould be called, the results of which can be modified, and thenZone.add_recordmay be used withreplace=True.May call
Zone.remove_recordto remove records fromexisting.Implementations should combine
self.lenient or lenientand pass the result to any record and zone calls that acceptlenientas a parameter, e.g.zone.add_record(..., lenient=lenient).
- class octodns.processor.filter.NetworkValueAllowlistFilter(name, allowlist, **kwargs)[source]
Bases:
_NetworkValueBaseFilter,AllowsMixinOnly manage A and AAAA records with values that match the provider patterns All other types will be left as-is.
Example usage:
processors: only-these: class: octodns.processor.filter.NetworkValueAllowlistFilter allowlist: - 127.0.0.1/32 - 192.168.0.0/16 - fd00::/8 zones: exxampled.com.: sources: - config processors: - only-these targets: - route53
- class octodns.processor.filter.NetworkValueRejectlistFilter(name, rejectlist, **kwargs)[source]
Bases:
_NetworkValueBaseFilter,RejectsMixinReject managing A and AAAA records with value matching a that match the provider patterns All other types will be left as-is.
Example usage:
processors: not-these: class: octodns.processor.filter.NetworkValueRejectlistFilter rejectlist: - 127.0.0.1/32 - 192.168.0.0/16 - fd00::/8 zones: exxampled.com.: sources: - config processors: - not-these targets: - route53
- class octodns.processor.filter.IgnoreRootNsFilter(name, lenient=False)[source]
Bases:
BaseProcessorDo not manage Root NS Records.
Example usage:
processors: no-root-ns: class: octodns.processor.filter.IgnoreRootNsFilter zones: exxampled.com.: sources: - config processors: - no-root-ns targets: - ns1
- process_source_zone(zone, *args, **kwargs)
Process the desired zone after all sources have populated.
Called after all sources have completed populate. Provides an opportunity for the processor to modify the desired zone that targets will receive.
- Parameters:
desired (octodns.zone.Zone) – The desired zone state after all sources have populated. This zone will be used as the target state for planning.
sources (list[octodns.provider.base.BaseProvider]) – List of source providers that populated the zone. May be empty for aliased zones.
lenient (bool) – When True, relaxed validation rules should be applied when modifying zone records.
- Returns:
The modified desired zone, typically the same object passed in.
- Return type:
Important
Will see
desiredafter any modifications done byProvider._process_desired_zoneand processors configured to run before this one.May modify
desireddirectly.Must return
desiredwhich will normally be thedesiredparam.Must not modify records directly;
record.copyshould be called, the results of which can be modified, and thenZone.add_recordmay be used withreplace=True.May call
Zone.remove_recordto remove records fromdesired.Sources may be empty, as will be the case for aliased zones.
Implementations should combine
self.lenient or lenientand pass the result to any record and zone calls that acceptlenientas a parameter, e.g.zone.add_record(..., lenient=lenient).
- process_target_zone(zone, *args, **kwargs)
Process the existing zone after the target has populated.
Called after a target has completed
populate, before changes are computed betweenexistinganddesired. This provides an opportunity to modify the existing zone state.- Parameters:
existing (octodns.zone.Zone) – The current zone state from the target provider.
target (octodns.provider.base.BaseProvider) – The target provider that populated the existing zone.
lenient (bool) – When True, relaxed validation rules should be applied when modifying zone records.
- Returns:
The modified existing zone, typically the same object passed in.
- Return type:
Important
Will see
existingafter any modifications done by processors configured to run before this one.May modify
existingdirectly.Must return
existingwhich will normally be theexistingparam.Must not modify records directly;
record.copyshould be called, the results of which can be modified, and thenZone.add_recordmay be used withreplace=True.May call
Zone.remove_recordto remove records fromexisting.Implementations should combine
self.lenient or lenientand pass the result to any record and zone calls that acceptlenientas a parameter, e.g.zone.add_record(..., lenient=lenient).
- class octodns.processor.filter.ExcludeRootNsChanges(name, error=True, **kwargs)[source]
Bases:
BaseProcessorDo not allow root NS record changes
Example usage:
processors: exclude-root-ns-changes: class: octodns.processor.filter.ExcludeRootNsChanges # If true an a change for a root NS is seen an error will be thrown. # If false a warning will be printed and the change will be removed # from the plan. # (default: true) error: true zones: exxampled.com.: sources: - config processors: - exclude-root-ns-changes targets: - ns1
- __init__(name, error=True, **kwargs)[source]
Initialize the processor.
- Parameters:
Note
The
nameparameter is deprecated and will be removed in version 2.0. Useidinstead.
- process_plan(plan, sources, target, lenient=False)[source]
Process the plan after it has been computed.
Called after the planning phase has completed. Provides an opportunity for the processor to modify the plan, thus changing the actions that will be displayed and potentially applied.
- Parameters:
plan (octodns.provider.plan.Plan or None) – The computed plan containing the changes to be applied. May be None if no changes were detected.
sources (list[octodns.provider.base.BaseProvider]) – List of source providers for this zone. May be empty for aliased zones.
target (octodns.provider.base.BaseProvider) – The target provider for which the plan was created.
lenient (bool) – When True, relaxed validation rules should be applied when modifying zone records.
- Returns:
The modified plan, which may be the same object passed in, a newly created Plan, or None if no changes are needed.
- Return type:
octodns.provider.plan.Plan or None
Important
planmay be None if no changes were detected; if so, aPlanmay still be created and returned.May modify
plan.changesdirectly or create a newPlan.Does not have to modify
plan.desiredand/orplan.existingto line up with any modifications made toplan.changes.Should copy over
plan.exists,plan.update_pcent_threshold, andplan.delete_pcent_thresholdwhen creating a newPlan.Must return a
Planwhich may beplanor can be a newly created one withplan.desiredandplan.existingcopied over as-is or modified.Sources may be empty, as will be the case for aliased zones.
Implementations should combine
self.lenient or lenientand pass the result to any record and zone calls that acceptlenientas a parameter, e.g.zone.add_record(..., lenient=lenient).
- class octodns.processor.filter.ZoneNameFilter(name, error=True, **kwargs)[source]
Bases:
_FilterProcessorFilter or error on record names that contain the zone name
Example usage:
processors: zone-name: class: octodns.processor.filter.ZoneNameFilter # If true a ValidationError will be throw when such records are # encouterd, if false the records will just be ignored/omitted. # (default: true) # error: True # Optional param that can be set to False to leave the target zone # alone, thus allowing deletion of existing records # (default: true) # include_target: True zones: exxampled.com.: sources: - config processors: - zone-name targets: - azure