Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Return a complete zone for a domain #22

Closed
wgjr opened this issue Feb 19, 2020 · 3 comments
Closed

Return a complete zone for a domain #22

wgjr opened this issue Feb 19, 2020 · 3 comments
Assignees

Comments

@wgjr
Copy link

wgjr commented Feb 19, 2020

Thank you for providing this excellent class of PowerDns control

I'm having a hard time understanding. How can we receive and format all entries in a domain's zone?

I can get the entries with -> zone ($ domain) -> get ();
However, I can't understand how to format it in a readable form.

@trizz
Copy link
Member

trizz commented Feb 19, 2020

Hi @wgjr,

The results of the zone->get() call can be looped to get data for each record. I've just pushed an additional example showing how to get the records created by the 'new_domain' example. You can change line 13 to a zone of your own if you want to try it with your own data.

Based on the other examples the output of the script should look something like this:

| AAAA |      www.dns-new-zone-test.nl. --> 2a00:1e28:3:1629::1
| A    |      www.dns-new-zone-test.nl. --> 127.0.0.1
| AAAA |   mail02.dns-new-zone-test.nl. --> 2a00:1e28:3:1629::3
| A    |   mail02.dns-new-zone-test.nl. --> 127.0.0.2
| AAAA |   mail01.dns-new-zone-test.nl. --> 2a00:1e28:3:1629::2
| A    |   mail01.dns-new-zone-test.nl. --> 127.0.0.1
| AAAA |          dns-new-zone-test.nl. --> 2a00:1e28:3:1629::1
| TXT  |          dns-new-zone-test.nl. --> "v=spf1 a mx include:_spf.example.com ?all"
| MX   |          dns-new-zone-test.nl. --> 10 mail01.dns-new-zone-test.nl., 20 mail02.dns-new-zone-test.nl.
| SOA  |          dns-new-zone-test.nl. --> ns1.exonet.nl. hostmaster.exonet.nl. 2020021903 10800 3600 604800 3600
| NS   |          dns-new-zone-test.nl. --> ns1.example.com., ns2.example.
| A    |          dns-new-zone-test.nl. --> 127.0.0.1

Is this what you are looking for?

@trizz trizz self-assigned this Feb 19, 2020
@wgjr
Copy link
Author

wgjr commented Feb 19, 2020

Hi @trizz,

Thanks for the quick response.

It works perfectly.

@wgjr wgjr closed this as completed Feb 19, 2020
trizz added a commit that referenced this issue Mar 31, 2020
@matt-smartlabs
Copy link

@trizz can you think of a way to export a zone in AXFR format? As far as I can see it's possible to get it via powerdns API

GET /servers/{server_id}/zones/{zone_id}/export

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants