From f250c97de20d60db0cffa0497389002d902f0ae1 Mon Sep 17 00:00:00 2001 From: Greg Taylor Date: Wed, 7 Nov 2012 23:52:59 -0500 Subject: [PATCH] Syntax hilighting fixes, and some light formatting. All in quickstart. --- doc_src/quickstart.rst | 48 ++++++++++++++++++++++++++++++++---------- 1 file changed, 37 insertions(+), 11 deletions(-) diff --git a/doc_src/quickstart.rst b/doc_src/quickstart.rst index 3e30aeb..3af7003 100644 --- a/doc_src/quickstart.rst +++ b/doc_src/quickstart.rst @@ -21,11 +21,15 @@ API credentials. Visit your `security credentials`_ page and note your Instantiate the API client -------------------------- -Next, you'll want to import the module:: +Next, you'll want to import the module: + +.. code-block:: python import route53 -You can then instantiate a connection to Route53 via :py:func:`route53.connect`:: +You can then instantiate a connection to Route53 via :py:func:`route53.connect`: + +.. code-block:: python conn = route53.connect( aws_access_key_id='YOURACCESSKEYHERE', @@ -44,15 +48,19 @@ angry-squirrel.com, or python.org. The :py:meth:`Route53Connection.list_hosted_zones ` method returns a generator of -:py:class:`HostedZone ` instances:: +:py:class:`HostedZone ` instances: + +.. code-block:: python # This is a generator. for zone in conn.list_hosted_zones(): # You can then do various things to the zone. print(zone.name) + # Perhaps you want to see the record sets under this zone for record_set in zone.record_sets: print(record_set) + # Or maybe you don't like this zone, and want to blow it away. zone.delete() @@ -62,13 +70,17 @@ Creating a Hosted Zone The :py:meth:`Route53Connection.create_hosted_zone ` method creates hosted zones, and returns a tuple that contains a :py:class:`HostedZone ` -instance, and some details about the pending change from the API:: +instance, and some details about the pending change from the API: + +.. code-block:: python new_zone, change_info = conn.create_hosted_zone( 'some-domain.com.', comment='An optional comment.' ) + # You can then manipulate the HostedZone. print("Zone ID", new_zone.id) + # This has some details about the change from the API. print(change_info) @@ -81,7 +93,9 @@ Retrieving a Hosted Zone The :py:meth:`Route53Connection.get_hosted_zone_by_id ` -method retrieves a specific hosted zone, by Zone ID:: +method retrieves a specific hosted zone, by Zone ID: + +.. code-block:: python zone = conn.get_hosted_zone_by_id('ZONE-ID-HERE') @@ -94,7 +108,9 @@ Deleting a Hosted Zone Simply call the :py:meth:`HostedZone.delete ` method on a :py:class:`HostedZone ` to delete -it:: +it: + +.. code-block:: python zone = conn.get_hosted_zone_by_id('ZONE-ID-HERE') zone.delete() @@ -102,7 +118,9 @@ it:: If you have record sets under the hosted zone, you'll need to delete those first, or an exception will be raised. Alternatively, you can call :py:meth:`delete` with ``force=True`` to delete the record sets and the -hosted zones:: +hosted zones: + +.. code-block:: python zone.delete(force=True) @@ -112,7 +130,9 @@ Creating a record set Depending on which kind of record set you'd like to create, choose the appropriate ``create_*_record`` method on :py:class:`HostedZone `. The methods -return one of the :py:class:`ResourceRecordSet` sub-classes:: +return one of the :py:class:`ResourceRecordSet` sub-classes: + +.. code-block:: python new_record, change_info = zone.create_a_record( # Notice that this is a full-qualified name. @@ -142,7 +162,9 @@ In order to list record sets, use the :py:meth:`HostedZone.record_sets ` property on :py:class:`HostedZone `. Note that we don't currently implement any convenience -methods for finding record sets, so this is the way to go:: +methods for finding record sets, so this is the way to go: + +.. code-block:: python # Note that this is a fully-qualified domain name. name_to_match = 'fuzzy.bunny.com.' @@ -160,7 +182,9 @@ Changing a record set --------------------- Simply change one of the attributes on the various :py:class:`ResourceRecordSet` -sub-classed instances and call its :py:meth:`save` method:: +sub-classed instances and call its :py:meth:`save` method: + +.. code-block:: python record_set.values = ['8.8.8.7'] record_set.save() @@ -168,7 +192,9 @@ sub-classed instances and call its :py:meth:`save` method:: Deleting a record set --------------------- -Similarly, delete a record set via its :py:meth:`delete` method:: +Similarly, delete a record set via its :py:meth:`delete` method: + +.. code-block:: python record_set.delete()