rvrdata.adapters.bind
Data adapter for BIND Zone files.
This adapter is used to manage DNS records by reading and writing zone files.
For more information about DNS and Bind, see https://bind9.readthedocs.io/
class RvrdataBind
Data adapter for DNS BIND Zone files.
read()
Read zone file into memory.
- Parameters:
- filename (str) – Path to file
- zone (str) – Optional explicit zone
- origin (str) – Optional explicit origin
The action bind.read in a dataflow step reads the contents of a zone file into the .data property of the step.
Data dictionary includes zone, origin, ttl, and records.
write()
Write zone file.
- Parameters:
- filename (str) – Path to file
- data (dict) – Dictionary containing DNS records
The data must contain a “zone” property (used as the $ORIGIN) and it must also contain a “ttl” property.
Individual records should be in an array (list) under the “records” property. Each record should have a “type”.
The allowed types of records are:
- A
- AAAA
- CNAME
- MX
- NS
- PTR
- SOA
- SRV
- TXT
The structure of the records should adhere to valid zone file schema. For more background, see https://bind9.readthedocs.io/en/v9_18_4/chapter3.html#soa-rr
create()
Create new zone file only if it is not already present.
This action works similar to a POST action in a REST API. It is intended for situations that need to avoid overwriting existing data. This will fail if there is an existing file in the path specified.
Syntax is the same as bind.write.
delete()
Delete file.
This works the same as text.delete.
update()
Append records to a zone file.
Records to be added need to be included under the ‘data’ param in an array (list) with the key ‘records’. See [bind.write] for more details on the record format.
force_pass()
Fake successful action that does nothing.
See force_pass in stdout adapter.