Add documentation for new functionality.
Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/fbf6d16b Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/fbf6d16b Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/fbf6d16b Branch: refs/heads/trunk Commit: fbf6d16b63ace23a6aed76fa0e0f50a6c1e0b7a5 Parents: 820223f Author: Tomaz Muraus <[email protected]> Authored: Sat Sep 14 23:27:33 2013 +0200 Committer: Tomaz Muraus <[email protected]> Committed: Sat Sep 14 23:27:33 2013 +0200 ---------------------------------------------------------------------- docs/dns/examples.rst | 26 ++++++++++++++++++++ docs/examples/dns/export_zone_to_bind_format.py | 11 +++++++++ .../dns/export_zone_to_bind_format_file.py | 11 +++++++++ 3 files changed, 48 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/libcloud/blob/fbf6d16b/docs/dns/examples.rst ---------------------------------------------------------------------- diff --git a/docs/dns/examples.rst b/docs/dns/examples.rst index 795d9c4..cf0593b 100644 --- a/docs/dns/examples.rst +++ b/docs/dns/examples.rst @@ -28,3 +28,29 @@ example shows how to do that. .. literalinclude:: /examples/dns/create_record_with_priority.py :language: python + +Export Libcloud Zone to BIND zone format +---------------------------------------- + +.. note:: + + This functionality is only available in trunk. + +This example shows how to export Libcloud Zone to bind format. + +Keep in mind that generated bind zone file content doesn't contain ``SOA`` and +``NS`` records. This should work fine if you just want to import this file +using a DNS provider web interface, but if you want to use it with BIND you +need to manually add those records. + +Printing the output +~~~~~~~~~~~~~~~~~~~ + +.. literalinclude:: /examples/dns/export_zone_to_bind_format.py + :language: python + +Saving output into a file +~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. literalinclude:: /examples/dns/export_zone_to_bind_format_file.py + :language: python http://git-wip-us.apache.org/repos/asf/libcloud/blob/fbf6d16b/docs/examples/dns/export_zone_to_bind_format.py ---------------------------------------------------------------------- diff --git a/docs/examples/dns/export_zone_to_bind_format.py b/docs/examples/dns/export_zone_to_bind_format.py new file mode 100644 index 0000000..c8d72ea --- /dev/null +++ b/docs/examples/dns/export_zone_to_bind_format.py @@ -0,0 +1,11 @@ +from libcloud.dns.providers import get_driver +from libcloud.dns.types import Provider + +CREDENTIALS_ZERIGO = ('email', 'api key') +ZONE_ID = 'example.myzone.com' + +Cls = get_driver(Provider.ZERIGO) +driver = Cls(*CREDENTIALS_ZERIGO) + +zone = driver.get_zone(zone_id=ZONE_ID) +print(zone.export_to_bind_format()) http://git-wip-us.apache.org/repos/asf/libcloud/blob/fbf6d16b/docs/examples/dns/export_zone_to_bind_format_file.py ---------------------------------------------------------------------- diff --git a/docs/examples/dns/export_zone_to_bind_format_file.py b/docs/examples/dns/export_zone_to_bind_format_file.py new file mode 100644 index 0000000..b50e223 --- /dev/null +++ b/docs/examples/dns/export_zone_to_bind_format_file.py @@ -0,0 +1,11 @@ +from libcloud.dns.providers import get_driver +from libcloud.dns.types import Provider + +CREDENTIALS_ZERIGO = ('email', 'api key') +ZONE_ID = 'example.myzone.com' + +Cls = get_driver(Provider.ZERIGO) +driver = Cls(*CREDENTIALS_ZERIGO) + +zone = driver.get_zone(zone_id=ZONE_ID) +zone.export_to_bind_format_file(file_path='/home/user/example.com')
