Skip to content
This repository has been archived by the owner on Dec 28, 2017. It is now read-only.

Commit

Permalink
Syntax hilighting fixes, and some light formatting. All in quickstart.
Browse files Browse the repository at this point in the history
  • Loading branch information
gtaylor committed Nov 8, 2012
1 parent 91ec773 commit f250c97
Showing 1 changed file with 37 additions and 11 deletions.
48 changes: 37 additions & 11 deletions doc_src/quickstart.rst
Expand Up @@ -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',
Expand All @@ -44,15 +48,19 @@ angry-squirrel.com, or python.org.

The :py:meth:`Route53Connection.list_hosted_zones <route53.connection.Route53Connection.list_hosted_zones>`
method returns a generator of
:py:class:`HostedZone <route53.hosted_zone.HostedZone>` instances::
:py:class:`HostedZone <route53.hosted_zone.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()
Expand All @@ -62,13 +70,17 @@ Creating a Hosted Zone
The :py:meth:`Route53Connection.create_hosted_zone <route53.connection.Route53Connection.create_hosted_zone>`
method creates hosted zones, and returns a tuple that contains a
:py:class:`HostedZone <route53.hosted_zone.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)
Expand All @@ -81,7 +93,9 @@ Retrieving a Hosted Zone

The
:py:meth:`Route53Connection.get_hosted_zone_by_id <route53.connection.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')
Expand All @@ -94,15 +108,19 @@ Deleting a Hosted Zone

Simply call the :py:meth:`HostedZone.delete <route53.hosted_zone.HostedZone.delete>`
method on a :py:class:`HostedZone <route53.hosted_zone.HostedZone>` to delete
it::
it:

.. code-block:: python
zone = conn.get_hosted_zone_by_id('ZONE-ID-HERE')
zone.delete()
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)
Expand All @@ -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 <route53.hosted_zone.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.
Expand Down Expand Up @@ -142,7 +162,9 @@ In order to list record sets, use the
:py:meth:`HostedZone.record_sets <route53.hosted_zone.HostedZone.record_sets>`
property on :py:class:`HostedZone <route53.hosted_zone.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.'
Expand All @@ -160,15 +182,19 @@ 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()
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()

0 comments on commit f250c97

Please sign in to comment.