You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@libcloud.apache.org by to...@apache.org on 2011/11/05 22:57:26 UTC

svn commit: r1198096 - in /libcloud/site/trunk: content/docs/dns-base-api.mdtext content/docs/dns-examples.mdtext content/docs/dns-overview.mdtext templates/blocks/menu_docs.html

Author: tomaz
Date: Sat Nov  5 21:57:26 2011
New Revision: 1198096

URL: http://svn.apache.org/viewvc?rev=1198096&view=rev
Log:
Add DNS docs.

Added:
    libcloud/site/trunk/content/docs/dns-base-api.mdtext
    libcloud/site/trunk/content/docs/dns-examples.mdtext
    libcloud/site/trunk/content/docs/dns-overview.mdtext
Modified:
    libcloud/site/trunk/templates/blocks/menu_docs.html

Added: libcloud/site/trunk/content/docs/dns-base-api.mdtext
URL: http://svn.apache.org/viewvc/libcloud/site/trunk/content/docs/dns-base-api.mdtext?rev=1198096&view=auto
==============================================================================
--- libcloud/site/trunk/content/docs/dns-base-api.mdtext (added)
+++ libcloud/site/trunk/content/docs/dns-base-api.mdtext Sat Nov  5 21:57:26 2011
@@ -0,0 +1,100 @@
+title: DNS -> Base API
+
+## Base API ##
+
+* [list_record_types](#list_record_types)
+* [list_zones](#list_zones)
+* [list_records](#list_records)
+* [get_zone](#get_zone)
+* [get_record](#get_record)
+* [create_zone](#create_zone)
+* [update_zone](#update_zone)
+* [create_record](#create_record)
+* [update_record](#update_record)
+* [delete_zone](#delete_zone)
+* [delete_record](#delete_record)
+
+<h3 id="list_record_types">list_record_types</h3>
+
+**Method signature**:
+[driver.list_record_types()](/apidocs/current/libcloud.dns.base.DNSDriver.html#list_record_types)  
+**Description**: Return a list of record types supported by the provider.
+
+
+<h3 id="list_zones">list_zones</h3>
+
+**Method signature**:
+[driver.list_zones()](/apidocs/current/libcloud.dns.base.DNSDriver.html#list_zones)  
+**Description**: Return a list of the Zone objects belonging to your account.
+
+<h3 id="list_records">list_records</h3>
+
+**Method signature**:
+[driver.list_records(zone)](/apidocs/current/libcloud.dns.base.DNSDriver.html#list_record),
+[zone.list_records()](/apidocs/current/libcloud.dns.base.Zone.html#list_record)  
+**Description**: Return a list of Record objects for the specified zone.
+
+<h3 id="get_zone">get_zone</h3>
+
+**Method signature**:
+[driver.get_zone(zone_id)](/apidocs/current/libcloud.dns.base.DNSDriver.html#get_zone)  
+**Description**: Return a Zone instance. This method is useful if you know the
+zone id and want to perform operations on it.
+
+<h3 id="get_record">get_record</h3>
+
+**Method signature**:
+[driver.get_record(zone_id, record_id)](/apidocs/current/libcloud.dns.base.DNSDriver.html#get_record)  
+**Description**: Return a Record instance. This method is useful if you know the
+zone and record id and want to perform operations on the record.
+
+<h3 id="create_zone">create_zone</h3>
+
+**Method signature**:
+[driver.create_zone(domain, type='master', ttl, extra)](/apidocs/current/libcloud.dns.base.DNSDriver.html#create_zone)  
+**Description**: Create a new zone.
+
+Some of the providers require extra attributes to be provided when creating a
+zone. Good example of this is a Rackspace Cloud DNS API which requires you to
+specify 'email' key in the otherwise optional `extra` dictionary.
+
+<h3 id="update_zone">update_zone</h3>
+
+**Method signature**:
+[driver.update_zone(zone, domain, type='master', ttl=None, extra=None)](/apidocs/current/libcloud.dns.base.DNSDriver.html#update_zone),
+[zone.update(domain, type='master', ttl=None, extra=None)](/apidocs/current/libcloud.dns.base.Zone.html#update)  
+**Description**: Update an existing zone. Which attributes can be updated
+depends on the provider. Most of the providers don't allow you to change the
+actual domain name. If you want to change the domain name, you need to first
+delete a zone, create a new one with the wanted domain name and then re-create
+all the old records.
+
+<h3 id="create_record">create_record</h3>
+
+**Method signature**:
+[driver.create_record(name, zone, type, data, extra=None)](/apidocs/current/libcloud.dns.base.DNSDriver.html#create_record),
+[zone.create_record(name, type, data, extra=None)](/apidocs/current/libcloud.dns.base.Zone.html#create_record)  
+**Description**: Create a new record. To view a list of supported records by the
+provider you can use the list_record_types method.
+
+<h3 id="update_record">update_record</h3>
+
+**Method signature**:
+[driver.update_record(record, name, type, data, extra)](/apidocs/current/libcloud.dns.base.DNSDriver.html#update_record),
+[record.update_record(name, type, data, extra)](/apidocs/current/libcloud.dns.base.Record.html#update)  
+**Description**: Update an existing record. Similar to the update_zone which
+attributes can be updated depends on the provider.
+
+<h3 id="delete_zone">delete_zone</h3>
+
+**Method signature**:
+[driver.delete_zone(zone)](/apidocs/current/libcloud.dns.base.DNSDriver.html#delete_zone),
+[zone.delete()](/apidocs/current/libcloud.dns.base.Zone.html#zone)  
+**Description**: Delete a zone.
+
+<h3 id="delete_record">delete_rcord</h3>
+
+**Method signature**:
+[driver.delete_rcord(record)](/apidocs/current/libcloud.dns.base.DNSDriver.html#delete_record),
+[record.delete(record)](/apidocs/current/libcloud.dns.base.Record.html#delete)  
+**Description**: Delete a record.

Added: libcloud/site/trunk/content/docs/dns-examples.mdtext
URL: http://svn.apache.org/viewvc/libcloud/site/trunk/content/docs/dns-examples.mdtext?rev=1198096&view=auto
==============================================================================
--- libcloud/site/trunk/content/docs/dns-examples.mdtext (added)
+++ libcloud/site/trunk/content/docs/dns-examples.mdtext Sat Nov  5 21:57:26 2011
@@ -0,0 +1,51 @@
+title: DNS -> Examples
+
+## Examples
+
+* [Create an A record for all your Rackspace nodes](#create-a-record-for-all-rackspace-nodes)
+
+<h3 id="create-a-record-for-all-rackspace-nodes">Create an 'A' record for all your nodes</h3>
+
+This example creates a  new "mydomain2.com" zone at Zerigo and an A record for all your
+Rackspace nodes. Value for the A record is the Node's first public IP address.
+
+    ::python
+    from pprint import pprint
+
+    from libcloud.compute.providers import get_driver as get_compute_driver
+    from libcloud.compute.types import Provider as ComputeProvider
+    from libcloud.dns.providers import get_driver as get_dns_driver
+    from libcloud.dns.types import Provider as DNSProvider, RecordType
+
+    CREDENTIALS_RACKSPACE = ('username', 'api key')
+    CREDENTIALS_ZERIGO = ('email', 'api key')
+
+    Cls = get_compute_driver(ComputeProvider.RACKSPACE)
+    compute_driver = Cls(*CREDENTIALS_RACKSPACE)
+
+    Cls = get_dns_driver(DNSProvider.ZERIGO)
+    dns_driver = Cls(*CREDENTIALS_ZERIGO)
+
+    # Retrieve all the nodes
+    nodes = compute_driver.list_nodes()
+
+    # Create a new zone
+    zone = dns_driver.create_zone(domain='mydomain2.com')
+
+    created = []
+    for node in nodes:
+        name = node.name
+
+        ips = node.public_ip
+
+        if not ips:
+            continue
+
+        ip = ips[0]
+
+        print 'Creating %s record (data=%s) for node %s' % ('A', ip, name)
+        record = zone.create_record(name=name, type=RecordType.A, data=ip)
+        created.append(record)
+
+    print 'Done, created %d records' % (len(created))
+    pprint(created)

Added: libcloud/site/trunk/content/docs/dns-overview.mdtext
URL: http://svn.apache.org/viewvc/libcloud/site/trunk/content/docs/dns-overview.mdtext?rev=1198096&view=auto
==============================================================================
--- libcloud/site/trunk/content/docs/dns-overview.mdtext (added)
+++ libcloud/site/trunk/content/docs/dns-overview.mdtext Sat Nov  5 21:57:26 2011
@@ -0,0 +1,17 @@
+title: DNS -> Overview
+
+## Overview ##
+
+DNS API allows you to manage DNS as A Service and services such as
+[Zerigo DNS][1], [Rackspace Cloud DNS][2] and
+[others](/supported_providers.html).
+
+### Terminology ###
+
+* **Zone** - represents a DNS zone or so called domain.
+* **Record** - represents a DNS record. Each record belongs to a Zone and has a
+record type and data field. Data depends on the record type.
+* **RecordType** - represents a record type (A, AAAA, MX, TXT, etc.).
+
+[1]: http://www.zerigo.com/managed-dns
+[2]: http://www.rackspace.com/cloud/cloud_hosting_products/dns/

Modified: libcloud/site/trunk/templates/blocks/menu_docs.html
URL: http://svn.apache.org/viewvc/libcloud/site/trunk/templates/blocks/menu_docs.html?rev=1198096&r1=1198095&r2=1198096&view=diff
==============================================================================
--- libcloud/site/trunk/templates/blocks/menu_docs.html (original)
+++ libcloud/site/trunk/templates/blocks/menu_docs.html Sat Nov  5 21:57:26 2011
@@ -21,6 +21,12 @@
             <li><a href="load-balancer-base-api.html">Base API</a></li>
             <li><a href="load-balancer-examples.html">Examples</a></li>
         </ul>
+        <li class="title">DNS (new in 0.6.0)</li>
+        <ul>
+            <li><a href="dns-overview.html">Overview</a></li>
+            <li><a href="dns-base-api.html">Base API</a></li>
+            <li><a href="dns-examples.html">Examples</a></li>
+        </ul>
     </ul>
     <li>Development</li>
     <ul>